
<template>
  <div id="protectedItems" class="content-main">
    <el-form :inline="true" ref="formInline.reserveSizeReportVOList" :model="formInline" class="demo-form-inline recordsDetailsTable">
      <!-- <div style="text-align: center;font-size: 20px;font-weight: 600;margin-bottom: 20px;">市级粮食调节储备补贴申请明细表</div> -->
	  <div class="flexBox">
        <div style="flex: 1;font-size: 14px;font-weight: 600;">上报月份：{{formInline.reportMonth}}</div>
        <div style="flex: 1;text-align: center;font-size: 14px;font-weight: 600;">粮食性质：{{formInline.orgLevelName}}</div>
        <div style="flex: 1;text-align: right;">
          <!-- <span>单位：吨/元</span> -->
        </div>
      </div>
	  <div style="float: right;width: 300px;margin-top: -120px;">
	    <div id="tjbtgrainsubsidy"></div>
	  </div>
      <table>
        <thead>
          <tr>
            <th rowspan="3">
              序号
            </th>
			<th rowspan="3">
			  库点名称
			</th>
            <th colspan="9">储备粮</th>
			<th colspan="5">储备油</th>
            <th rowspan='2'>地址</th>
            <th rowspan='2'>联系人</th>
            <th rowspan='2'>电话</th>
			<th v-if="$route.query.type !='ck'" rowspan='3'>操作</th>
          </tr>
		  <tr>
			<th rowspan="2">折合原粮合计</th>
			<th rowspan="2">小麦</th>
			<th rowspan="2">稻谷</th>
			<th colspan="3">面粉</th>
			<th colspan="3">大米</th>
			<th rowspan="2">合计</th>
			<th rowspan="2">大豆原油</th>
			<th colspan="3">成品油</th>
		  </tr>
		  <tr>
			<th>小计</th>
			<th>小包装</th>
			<th>罐存</th>
			<th>小计</th>
			<th>小包装</th>
			<th>罐存</th>
			<th>合计</th>
			<th>小包装</th>
			<th>罐存</th>
			<th></th>
			<th></th>
			<th></th>
		  </tr>
        </thead>
        <tbody>
          <tr v-for="(item,index) in formInline.reserveSizeReportVOList">
			<td style="min-width: 30px;"><span>{{index== 0 ? '' : index}}</span></td>
           <!-- <td style="width: 120px;">
              <span style="width: 120px;">{{item.kdmc}}</span>
            </td> -->
			<td style="max-width: 140px;min-width: 120px;">
				<!-- <el-form-item :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.xm'"> -->
				 
				  <el-form-item  style="margin-bottom: 0;margin-right: 0;" :prop="'reserveSizeReportVOList.' + index + '.kdmc'" :rules="[
                   {
                     required: true,
                     message: '库点名称不能为空',
                     trigger: 'change',
                   },
                 ]">
				  <span v-if="item.kdmc">{{item.kdmc}}</span>
				    <el-select
					v-else
				      filterable
				      clearable
				      collapse-tags
				      class="inputCompatibleCck"
				      v-model="item.qymc"
				      placeholder="请选择"
				      @change="getchList($event,index)"
				    >
				      <el-option
				        v-for="item in ssyddmOptions"
				        :key="item.tyshxydm"
				        :label="item.qymc"
				        :value="item.tyshxydm"
						:disabled="item.disabled"
				      ></el-option>
				    </el-select>
				  </el-form-item>
				<!-- </el-form-item> -->
			  
			</td>
            <td>
              <span>
                {{String(item.cblhj).indexOf(".") > -1
                ? Number(item.cblhj).toFixed(3)
                : item.cblhj}}</span>
             <!-- <el-form-item v-else :key="item.key" :prop="'detailList.' + index + '.ncwb'" :rules="[
                   {
                     pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
                     message: '请输入数字,最多保留三位小数',
                     trigger: 'blur',
                   },
                 ]">
                <el-input clearable v-model="item.ncwb" @change="gcinputnum(index,'ncwb')" placeholder="请输入">
                </el-input>
              </el-form-item> -->
            </td>
            <td>
              <span v-if="type == 'ck' || index== 0">
                {{String(item.xm).indexOf(".") > -1
                ? Number(item.xm).toFixed(3)
                : item.xm}}</span>
              <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.xm'" :rules="[
                   {
                     pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
                     message: '请输入数字,最多保留三位小数',
                     trigger: 'blur',
                   },
                 ]">
                <el-input clearable v-model="item.xm" @change="gcinputnum(index,'xm')" placeholder="请输入">
                </el-input>
              </el-form-item>
            </td>
            <td>
              <span v-if="type == 'ck' || index== 0">
                {{String(item.dg).indexOf(".") > -1
                ? Number(item.dg).toFixed(3)
                : item.dg}}</span>
             <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.dg'" :rules="[
                   {
                     pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
                     message: '请输入数字,最多保留三位小数',
                     trigger: 'blur',
                   },
                 ]">
                <el-input clearable v-model="item.dg" @change="gcinputnum(index,'dg')" placeholder="请输入">
                </el-input>
              </el-form-item>
            </td>
            <td>
              <span>
                {{String(item.mfhj).indexOf(".") > -1
                ? Number(item.mfhj).toFixed(3)
                : item.mfhj}}</span>
              <!-- <el-form-item v-else :key="item.key" :prop="'detailList.' + index + '.mfxj'" :rules="[
                   {
                     pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
                     message: '请输入数字,最多保留三位小数',
                     trigger: 'blur',
                   },
                 ]">
                <el-input clearable v-model="item.mfxj" @change="gcinputnum(index,'mfxj')" placeholder="请输入">
                </el-input>
              </el-form-item> -->
            </td>
            <td>
              <span v-if="type == 'ck' || index== 0">
                {{String(item.mfXbz).indexOf(".") > -1
                ? Number(item.mfXbz).toFixed(3)
                : item.mfXbz}}</span>
              <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.mfXbz'" :rules="[
                   {
                     pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
                     message: '请输入数字,最多保留三位小数',
                     trigger: 'blur',
                   },
                 ]">
                <el-input clearable v-model="item.mfXbz" @change="gcinputnum(index,'mfXbz')" placeholder="请输入">
                </el-input>
              </el-form-item>
            </td>
            <td>
              <span v-if="type == 'ck' || index== 0">
                {{String(item.mfGc).indexOf(".") > -1
                ? Number(item.mfGc).toFixed(3)
                : item.mfGc}}</span>
              <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.mfGc'" :rules="[
                   {
                     pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
                     message: '请输入数字,最多保留三位小数',
                     trigger: 'blur',
                   },
                 ]">
                <el-input clearable v-model="item.mfGc" @change="gcinputnum(index,'mfGc')" placeholder="请输入">
                </el-input>
              </el-form-item>
            </td>
            <td>
              <span>
                {{String(item.dmhj).indexOf(".") > -1
                ? Number(item.dmhj).toFixed(3)
                : item.dmhj}}</span>
              <!-- <el-form-item v-else :key="item.key" :prop="'detailList.' + index + '.qmwb'" :rules="[
                   {
                     pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
                     message: '请输入数字,最多保留三位小数',
                     trigger: 'blur',
                   },
                 ]">
                <el-input clearable v-model="item.qmwb" @change="gcinputnum(index,'qmwb')" placeholder="请输入">
                </el-input>
              </el-form-item> -->
            </td>
			<td>
			  <span v-if="type == 'ck' || index== 0">
			    {{String(item.dmXbz).indexOf(".") > -1
			    ? Number(item.dmXbz).toFixed(3)
			    : item.dmXbz}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.dmXbz'" :rules="[
			       {
			         pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
			         message: '请输入数字,最多保留三位小数',
			         trigger: 'blur',
			       },
			     ]">
			    <el-input clearable v-model="item.dmXbz" @change="gcinputnum(index,'dmXbz')" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td>
			  <span v-if="type == 'ck' || index== 0">
			    {{String(item.dmGc).indexOf(".") > -1
			    ? Number(item.dmGc).toFixed(3)
			    : item.dmGc}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.dmGc'" :rules="[
			       {
			         pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
			         message: '请输入数字,最多保留三位小数',
			         trigger: 'blur',
			       },
			     ]">
			    <el-input clearable v-model="item.dmGc" @change="gcinputnum(index,'dmGc')" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td>
			  <span>
			    {{String(item.cbyhj).indexOf(".") > -1
			    ? Number(item.cbyhj).toFixed(3)
			    : item.cbyhj}}</span>
			  <!-- <el-form-item v-else :key="item.key" :prop="'detailList.' + index + '.qmwb'" :rules="[
			       {
			         pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
			         message: '请输入数字,最多保留三位小数',
			         trigger: 'blur',
			       },
			     ]">
			    <el-input clearable v-model="item.qmwb" @change="gcinputnum(index,'qmwb')" placeholder="请输入">
			    </el-input>
			  </el-form-item> -->
			</td>
			<td>
			  <span v-if="type == 'ck' || index== 0">
			    {{String(item.ddyy).indexOf(".") > -1
			    ? Number(item.ddyy).toFixed(3)
			    : item.ddyy}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.ddyy'" :rules="[
			       {
			         pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
			         message: '请输入数字,最多保留三位小数',
			         trigger: 'blur',
			       },
			     ]">
			    <el-input clearable v-model="item.ddyy" @change="gcinputnum(index,'ddyy')" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td>
			  <span>
			    {{String(item.cpyhj).indexOf(".") > -1
			    ? Number(item.cpyhj).toFixed(3)
			    : item.cpyhj}}</span>
			  <!-- <el-form-item v-else :key="item.key" :prop="'detailList.' + index + '.qmwb'" :rules="[
			       {
			         pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
			         message: '请输入数字,最多保留三位小数',
			         trigger: 'blur',
			       },
			     ]">
			    <el-input clearable v-model="item.qmwb" @change="gcinputnum(index,'qmwb')" placeholder="请输入">
			    </el-input>
			  </el-form-item> -->
			</td>
			<td>
			  <span v-if="type == 'ck' || index== 0">
			    {{String(item.cpyxbzhj).indexOf(".") > -1
			    ? Number(item.cpyxbzhj).toFixed(3)
			    : item.cpyxbzhj}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.cpyxbzhj'" :rules="[
			       {
			         pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
			         message: '请输入数字,最多保留三位小数',
			         trigger: 'blur',
			       },
			     ]">
			    <el-input clearable v-model="item.cpyxbzhj" @change="gcinputnum(index,'cpyxbzhj')" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td>
			  <span v-if="type == 'ck' || index== 0">
			    {{String(item.cpyGc).indexOf(".") > -1
			    ? Number(item.cpyGc).toFixed(3)
			    : item.cpyGc}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.cpyGc'" :rules="[
			       {
			         pattern:/^(-)?(0|[1-9]\d*)(\s|$|\.\d{1,3}\b)/,
			         message: '请输入数字,最多保留三位小数',
			         trigger: 'blur',
			       },
			     ]">
			    <el-input clearable v-model="item.cpyGc" @change="gcinputnum(index,'cpyGc')" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td style="max-width: 140px;">
			  <span v-if="type == 'ck' || index== 0">
			    {{item.address}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.address'">
			    <el-input clearable v-model="item.address" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td>
			  <span v-if="type == 'ck' || index== 0">
			    {{String(item.linkman).indexOf(".") > -1
			    ? Number(item.linkman).toFixed(3)
			    : item.linkman}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.linkman'">
			    <el-input clearable v-model="item.linkman" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td>
			  <span v-if="type == 'ck' || index== 0">
			    {{String(item.phone).indexOf(".") > -1
			    ? Number(item.phone).toFixed(3)
			    : item.phone}}</span>
			  <el-form-item style="margin-bottom: 0;margin-right: 0;" v-else :key="item.key" :prop="'reserveSizeReportVOList.' + index + '.phone'">
			    <el-input clearable v-model="item.phone" placeholder="请输入">
			    </el-input>
			  </el-form-item>
			</td>
			<td v-if="$route.query.type !='ck'">
			<el-button v-if="index == 0" type="text"
			  ></el-button
			>
			<el-button v-else type="text" @click="deleteNodeBtn(index)"
			  >删除</el-button
			>
			</td>
          </tr>
        </tbody>
      </table>
	  <div class="addTable" v-if="$route.query.type !='ck'">
	    <span class="iconfont iconzengjia" @click="addZJ()"></span>
	  </div>
	  <div class="flexBox">
	    <div style="flex: 1;">上报单位：{{formInline.orgName}}</div>
	    <div style="flex: 1;text-align: right;">
	      <span>上报时间：{{formInline.reportDay}}</span>
	    </div>
	  </div>
      <div style="text-align: center; margin-top: 20px">
		  <el-button type="primary" :loading="stateLoading" @click="saveZc('','formInline','save')" size="small" class="iconfont icongaizhang"
		  	v-if="type != 'ck'">保存</el-button>
       <el-button type="primary" :loading="stateLoading" @click="saveZc('','formInline','')" size="small" class="iconfont icongaizhang"
       	v-if="type != 'ck'">提交</el-button>
      		<!-- <el-button type="primary" :loading="stateLoading" @click="saveZc('','formInline','3')" size="small" class="iconfont iconbohui"
      			v-if="type != 'ck' && (formInline.status == '91000202' || formInline.status == '91000200')">驳回</el-button> -->
		<el-button @click="cancelClick" type="primary"
          icon="iconfont iconfanhui">返回</el-button>
      </div>
    </el-form>
  </div>
</template>

<script>
  import {
	  reserveSizeId,
	  reserveSizeReport,
	  companyList
  } from "@/api/reserveScaleReport/index";
  import {dateFormat} from '@/utils/index'
  export default {
    data() {
      return {
		  ssyddmOptions:[],
        stateLoading:false,
        type: this.$route.query.type,
        formInline: {
          orgCode: sessionStorage.getItem("orgCode"),
          period: '',
          sskdbm: sessionStorage.getItem("tyshxydm") + '001',
          orgName: sessionStorage.getItem("orgName"),
          operationType: '',
		  summaryStatus:0,
		  isDelete:0,
          reserveSizeReportVOList: [
			  {
				  dg:0,
				  xm:0,
			  }
          ],
        }
      }
    },
    created() {
		const now = new Date();
		const year = now.getFullYear(); // 年
		// const month = now.getMonth()+1
		const month = now.getMonth() <9 ? '0'+(now.getMonth()+ 1) : now.getMonth()+ 1; // 月
		this.formInline.period=`${year}-${month}`
		this.formInline.year=dateFormat(new Date())
		console.log(this.$route.query.id,'uyu========')
		// this.getJxcInfo()
      if (this.$route.query.id) {
        this.getJxcInfo()
      } else {
        // this.GetPeriod()
      }
    },
    methods: {
		getchList(val,index) {
			console.log(val,index,'hhgggw---------')
			this.ssyddmOptions.forEach((item) =>{
				if(item.tyshxydm == val){
					item.disabled=true
					this.formInline.reserveSizeReportVOList[index].kdmc=item.qymc
					this.formInline.reserveSizeReportVOList[index].kdbm=item.qyjgdm
					this.formInline.reserveSizeReportVOList[index].address=item.qytxdz
					this.formInline.reserveSizeReportVOList[index].linkman=item.fddbr
					this.formInline.reserveSizeReportVOList[index].phone=item.frsjh
				}
			})
		},
		addZJ(){
			const newList = {
			  address: "",
			  cblhj: null,
			  cbyhj: null,
			  cpy5: null,
			  cpy10: null,
			  cpy20: null,
			  cpyGc: null,
			  cpyhj: null,
			  cpyxbzhj: null,
			  createTime: null,
			  ddyy: null,
			  dg: null,
			  dmGc: null,
			  dmXbz: null,
			  dmhj: null,
			  id: null,
			  kdLevel: "",
			  kdbm: "",
			  kdmc: "",
			  linkman: "",
			  mfGc: null,
			  mfXbz: null,
			  mfhj:null,
			  phone: null,
			  reserveSizeId: this.$route.query.id,
			  updateTime: null,
			  xm: null,
			};
			this.formInline.reserveSizeReportVOList.push(newList);
		},
		deleteNodeBtn(i) {
		  if (this.formInline.reserveSizeReportVOList.length == 1) {
		    this.formInline.reserveSizeReportVOList = [
				{
				  address: "",
				  cblhj: null,
				  cbyhj: null,
				  cpy5: null,
				  cpy10: null,
				  cpy20: null,
				  cpyGc: null,
				  cpyhj: null,
				  cpyxbzhj: null,
				  createTime: null,
				  ddyy: null,
				  dg: null,
				  dmGc: null,
				  dmXbz: null,
				  dmhj: null,
				  id: null,
				  kdLevel: "",
				  kdbm: "",
				  kdmc: "",
				  linkman: "",
				  mfGc: null,
				  mfXbz: null,
				  mfhj:null,
				  phone: null,
				  reserveSizeId: this.$route.query.id,
				  updateTime: null,
				  xm: null,
				}
			];
		  } else {
			  this.ssyddmOptions.forEach((item) =>{
			  	if(item.qyjgdm ==this.formInline.reserveSizeReportVOList[i].kdbm){
			  		item.disabled=false
			  	}
			  })
			  this.formInline.reserveSizeReportVOList[0].cblhj=Number(this.formInline.reserveSizeReportVOList[0].cblhj)-Number(this.formInline.reserveSizeReportVOList[i].cblhj)
			  this.formInline.reserveSizeReportVOList[0].xm=Number(this.formInline.reserveSizeReportVOList[0].xm)-Number(this.formInline.reserveSizeReportVOList[i].xm)
			  this.formInline.reserveSizeReportVOList[0].dg=Number(this.formInline.reserveSizeReportVOList[0].dg)-Number(this.formInline.reserveSizeReportVOList[i].dg)
			  this.formInline.reserveSizeReportVOList[0].mfhj=Number(this.formInline.reserveSizeReportVOList[0].mfhj)-Number(this.formInline.reserveSizeReportVOList[i].mfhj)
			  this.formInline.reserveSizeReportVOList[0].mfXbz=Number(this.formInline.reserveSizeReportVOList[0].mfXbz)-Number(this.formInline.reserveSizeReportVOList[i].mfXbz)
			  this.formInline.reserveSizeReportVOList[0].mfGc=Number(this.formInline.reserveSizeReportVOList[0].mfGc)-Number(this.formInline.reserveSizeReportVOList[i].mfGc)
			  this.formInline.reserveSizeReportVOList[0].dmhj=Number(this.formInline.reserveSizeReportVOList[0].dmhj)-Number(this.formInline.reserveSizeReportVOList[i].dmhj)
			  this.formInline.reserveSizeReportVOList[0].dmXbz=Number(this.formInline.reserveSizeReportVOList[0].dmXbz)-Number(this.formInline.reserveSizeReportVOList[i].dmXbz)
			  this.formInline.reserveSizeReportVOList[0].dmGc=Number(this.formInline.reserveSizeReportVOList[0].dmGc)-Number(this.formInline.reserveSizeReportVOList[i].dmGc)
			  this.formInline.reserveSizeReportVOList[0].cbyhj=Number(this.formInline.reserveSizeReportVOList[0].cbyhj)-Number(this.formInline.reserveSizeReportVOList[i].cbyhj)
			  this.formInline.reserveSizeReportVOList[0].ddyy=Number(this.formInline.reserveSizeReportVOList[0].ddyy)-Number(this.formInline.reserveSizeReportVOList[i].ddyy)
			  this.formInline.reserveSizeReportVOList[0].cpyhj=Number(this.formInline.reserveSizeReportVOList[0].cpyhj)-Number(this.formInline.reserveSizeReportVOList[i].cpyhj)
			  this.formInline.reserveSizeReportVOList[0].cpyxbzhj=Number(this.formInline.reserveSizeReportVOList[0].cpyxbzhj)-Number(this.formInline.reserveSizeReportVOList[i].cpyxbzhj)
			  this.formInline.reserveSizeReportVOList[0].cpyGc=Number(this.formInline.reserveSizeReportVOList[0].cpyGc)-Number(this.formInline.reserveSizeReportVOList[i].cpyGc)
			  this.formInline.reserveSizeReportVOList.splice(i, 1);
		  }
		},
      cancelClick() {
        this.$router.push({
          name: "escalationIndex"
        });
      },
      saveZc(type, formName, shtype, sussInfo, errInfo) {
        console.log('66555-==============')
        // this.shtype = shtype
		// console.log(this.formInline,'fhdf------')
		// this.formInline.reserveSizeReportVOList=this.formInline.reserveSizeReportVOList.shift()
		this.formInline.reportStatus=shtype
        this.$refs['formInline.reserveSizeReportVOList'].validate((valid) => {
          if (valid) {
			  this.formInline.reserveSizeReportVOList.shift()
            if (this.$route.query.id) {
              console.log(this.formInline,'ooiyy7778-----')
              reserveSizeReport(this.formInline).then(res => {
                if (res.infoCode == 200) {
                  this.$message({
                    message: "提交成功",
                    type: "success",
                  });
                  this.$router.push({
                    name: "escalationIndex",
                  });
                } else {
                  this.$message.error(res.msg);
                }
              })
            }
          }
        })

      },
      getJxcInfo() {
        var data = {
          id: this.$route.query.id
        }
        reserveSizeId(data).then(res => {
          if (res.infoCode == 200) {
            // this.formInline = res.data
			// reserveSizeReportVOList
			var arr=[]
			var Hjsl={
				address: "",
				cblhj: null,
				cbyhj: null,
				cpy5: null,
				cpy10: null,
				cpy20: null,
				cpyGc: null,
				cpyhj: null,
				cpyxbzhj: null,
				createTime: null,
				ddyy: null,
				dg: null,
				dmGc: null,
				dmXbz: null,
				dmhj: null,
				id: null,
				kdLevel: "",
				kdbm: "",
				kdmc: "合计",
				linkman: "",
				mfGc: null,
				mfXbz: null,
				mfhj:null,
				phone: null,
				reserveSizeId: this.$route.query.id,
				updateTime: null,
				xm: null,
			}
			res.data.reserveSizeReportVOList.forEach((item) =>{
				console.log(item)
				if(item !=null){
					Hjsl.cblhj+=Number(item.cblhj)
					Hjsl.xm+=Number(item.xm)
					Hjsl.dg+=Number(item.dg)
					Hjsl.mfhj+=Number(item.mfhj)
					Hjsl.mfXbz+=Number(item.mfXbz)
					Hjsl.mfGc+=Number(item.mfGc)
					Hjsl.dmhj+=Number(item.dmhj)
					Hjsl.dmXbz+=Number(item.dmXbz)
					Hjsl.dmGc+=Number(item.dmGc)
					Hjsl.cbyhj+=Number(item.cbyhj)
					Hjsl.ddyy+=Number(item.ddyy)
					Hjsl.cpyhj+=Number(item.cpyhj)
					Hjsl.cpyxbzhj+=Number(item.cpyxbzhj)
					Hjsl.cpyGc+=Number(item.cpyGc)
				    arr.push(item)
				}
			})
			console.log(arr,'hggtgggggggggggggg-----------')
			console.log(res.data,'jfdfs=====')
			arr.unshift(Hjsl)
			this.formInline = res.data
			this.formInline.reserveSizeReportVOList=arr
			this.formInline.reserveSizeId=this.$route.query.id
			this.formInline.orgLevelName=this.$route.query.orgLevelName
			this.formInline.reportMonth=this.$route.query.reportMonth
			this.formInline.orgLevel=this.$route.query.orgLevel
			if(this.type == 'sb'){
				this.formInline.orgName=sessionStorage.getItem("orgName"),
				this.formInline.reportDay=dateFormat(new Date())
			}else{
				this.formInline.orgName=this.$route.query.orgName
				this.formInline.reportDay=this.$route.query.reportDay
			}
			this.$nextTick(() =>{
				companyList().then((res) => {
				  if (res.infoCode == 200) {
					  this.ssyddmOptions = res.data;
					this.formInline.reserveSizeReportVOList.forEach((items,index) =>{
						res.data.forEach((val,s) =>{
							if(items.kdbm == val.qyjgdm){
								val.disabled=true
							}
						})
					})  
				    
				  }
				});
			})
			
          }
        })
      },
	  gcinputnum(index,name){
		  this.formInline.reserveSizeReportVOList[0].cblhj=0
		  this.formInline.reserveSizeReportVOList[0].xm=0
		  this.formInline.reserveSizeReportVOList[0].dg=0
		  this.formInline.reserveSizeReportVOList[0].mfhj=0
		  this.formInline.reserveSizeReportVOList[0].mfXbz=0
		  this.formInline.reserveSizeReportVOList[0].mfGc=0
		  this.formInline.reserveSizeReportVOList[0].dmhj=0
		  this.formInline.reserveSizeReportVOList[0].dmXbz=0
		  this.formInline.reserveSizeReportVOList[0].dmGc=0
		  this.formInline.reserveSizeReportVOList[0].cbyhj=0
		  this.formInline.reserveSizeReportVOList[0].ddyy=0
		  this.formInline.reserveSizeReportVOList[0].cpyhj=0
		  this.formInline.reserveSizeReportVOList[0].cpyxbzhj=0
		  this.formInline.reserveSizeReportVOList[0].cpyGc=0
		 this.formInline.reserveSizeReportVOList[index].mfhj=0
		 this.formInline.reserveSizeReportVOList[index].dmhj=0
		 this.formInline.reserveSizeReportVOList[index].cblhj=0
		 this.formInline.reserveSizeReportVOList[index].cbyhj=0
		 this.formInline.reserveSizeReportVOList[index].mfhj=Number(this.formInline.reserveSizeReportVOList[index].mfXbz)+Number(this.formInline.reserveSizeReportVOList[index].mfGc)
		 this.formInline.reserveSizeReportVOList[index].dmhj=Number(this.formInline.reserveSizeReportVOList[index].dmXbz)+Number(this.formInline.reserveSizeReportVOList[index].dmGc)
		 this.formInline.reserveSizeReportVOList[index].cblhj=Number(this.formInline.reserveSizeReportVOList[index].xm)+Number(this.formInline.reserveSizeReportVOList[index].dg)+Number(this.formInline.reserveSizeReportVOList[index].mfhj)/0.7+Number(this.formInline.reserveSizeReportVOList[index].dmhj)/0.7
		 this.formInline.reserveSizeReportVOList[index].cpyhj=Number(this.formInline.reserveSizeReportVOList[index].cpyxbzhj)+Number(this.formInline.reserveSizeReportVOList[index].cpyGc)
		 this.formInline.reserveSizeReportVOList[index].cbyhj=Number(this.formInline.reserveSizeReportVOList[index].cpyhj)+Number(this.formInline.reserveSizeReportVOList[index].ddyy)
	     this.formInline.reserveSizeReportVOList.forEach((item,i) =>{
			 if(i > 0){
				 this.formInline.reserveSizeReportVOList[0].cblhj+=Number(item.cblhj)
				 this.formInline.reserveSizeReportVOList[0].xm+=Number(item.xm)
				 this.formInline.reserveSizeReportVOList[0].dg+=Number(item.dg)
				 this.formInline.reserveSizeReportVOList[0].mfhj+=Number(item.mfhj)
				 this.formInline.reserveSizeReportVOList[0].mfXbz+=Number(item.mfXbz)
				 this.formInline.reserveSizeReportVOList[0].mfGc+=Number(item.mfGc)
				 this.formInline.reserveSizeReportVOList[0].dmhj+=Number(item.dmhj)
				 this.formInline.reserveSizeReportVOList[0].dmXbz+=Number(item.dmXbz)
				 this.formInline.reserveSizeReportVOList[0].dmGc+=Number(item.dmGc)
				 this.formInline.reserveSizeReportVOList[0].cbyhj+=Number(item.cbyhj)
				 this.formInline.reserveSizeReportVOList[0].ddyy+=Number(item.ddyy)
				 this.formInline.reserveSizeReportVOList[0].cpyhj+=Number(item.cpyhj)
				 this.formInline.reserveSizeReportVOList[0].cpyxbzhj+=Number(item.cpyxbzhj)
				 this.formInline.reserveSizeReportVOList[0].cpyGc+=Number(item.cpyGc)
			 }
			
		 })
		// this.formInline.reserveSizeReportVOList[0].cblhj=Number(this.formInline.reserveSizeReportVOList[0].cblhj)+Number(this.formInline.reserveSizeReportVOList[index].cbyhj)
	  },
    }
  }
</script>

<style scoped lang="scss">
  .recordsDetailsTable {
    background-color: #fff;
    font-size: 14px;
    padding-bottom: 20px;

    table {
      width: 100%;
      margin-top: 10px;
      font-size: 14px;
    }

    .tdsize {
      font-size: 18px;
      font-weight: 700;
    }

    td,
    th {
      text-align: center;
      border: 1px solid #eaeaea;
      word-wrap: break-word;
      height: 40px;
    }

    span,
    .el-input,
    .el-textarea {
      font-size: 12px;
    }
  }

  .flexBox {
    display: flex;
    line-height: 40px;
    height: 40px;
    // text-align: center;
  }
  .areawidth{
     width: 100%;
   }
  .areawidth /deep/ .el-textarea__inner{
    width: 100%!important;
  }
  // .el-form--inline .el-form-item
  .areawidth /deep/.el-form-item{
    width: 100%!important;
  }
  .areawidth /deep/ .el-form-item__content{
    width: 93%!important;
  }
  .addTable {
    text-align: right;
    // margin-right: 40px;
  }
  .addTable span {
    font-size: 20px;
    font-weight: bold;
    color: #4588db;
    cursor: pointer;
  }
</style>
<style>
  #tjbtgrainsubsidy {
    position: relative !important;
  }

  #tjbtgrainsubsidy > div {
    left: 0px !important;
    top: -40px !important;
  }
</style>
