<template>
	<div id="protectedItems" class="content-main">
		<el-form :inline="true" ref="formInline" :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;">上报单位：{{formInline.orgName}}</div>
				<div style="flex: 1;text-align: center;">填报期数：{{formInline.period}}</div>
				<div style="flex: 1;text-align: right;">
					<span>单位：吨/元</span>
				</div>
			</div> -->
			<table id='summaryData'>
				<thead>
					<tr>
						<th colspan='19' style="border: none;">
						    <div style="text-align: center;font-size: 20px;font-weight: 600;margin-bottom: 20px;">拨付市级储备粮油储存费明细表</div>	
						</th>
					</tr>
					<tr>
						<th colspan='8' style="border: none;">
							   <div style="text-align: left;">上报单位：{{formInline.orgName}}</div>
						</th>
						<th colspan="8" style="border: none;">
							<div style="text-align: left;">填报期数：{{formInline.period}}</div>
						</th>
						<th colspan="1" style="border: none;">
						</th>
						<th colspan="1" style="border: none;">
						</th>
						<th colspan="1" style="border: none;">
							<div style="text-align: right;" >
							  <span>单位：吨/元</span>
							</div>
						</th>
					</tr>
					<tr>
						<th rowspan="4">
							序号
						</th>
						<th rowspan="4">
							承储企业名称
						</th>
						<th rowspan="4">
							储存费
						</th>
						<th colspan="13">
							市级储备粮
						</th>
						<th colspan="3">
							市级储备油
						</th>
					</tr>
					<tr>
						<th colspan="6">
							原粮
						</th>
						<th colspan="6">
							成品粮
						</th>
						<th rowspan="3">
							金额小计
						</th>
						<th rowspan="3">
							数量
						</th>
						<th rowspan="3">
							费率
						</th>
						<th rowspan="3">
							金额
						</th>
					</tr>
					<tr>
						<th colspan="3">
							小麦
						</th>
						<th colspan="3">
							稻谷
						</th>
						<th colspan="3">
							大米
						</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.infoList">
						<td>{{index == 0 ? '' : index}}</td>
						<td>
							{{item.ccqy}}
						</td>
						<td>
							{{String(item.ccf).indexOf('.') > -1 ? Number(item.ccf).toFixed(2) : item.ccf}}
						</td>
						<!-- <div v-for="(val,info) in item.dataList"> -->
						<td>
							{{String(item.dataList[0].sl).indexOf('.') > -1 ? Number(item.dataList[0].sl).toFixed(3) : item.dataList[0].sl ==0 ? '' : item.dataList[0].sl}}
							<!-- {{item.dataList[0].sl}} -->
						</td>
						<td>
							{{item.dataList[0].sl== 0 ? '' : item.dataList[0].fl}}
						</td>
						<td>
							{{String(item.dataList[0].je).indexOf('.') > -1 ? Number(Math.round(item.dataList[0].je*100)/100).toFixed(2) : item.dataList[0].je == 0 ? '' : item.dataList[0].je}}
						</td>
						<!-- </div> -->
						<td>
							{{String(item.dataList[1].sl).indexOf('.') > -1 ? Number(item.dataList[1].sl).toFixed(3) : item.dataList[1].sl == 0 ? '' : item.dataList[1].sl}}
							<!-- {{item.dataList[1].sl}} -->
						</td>
						<td>
							{{item.dataList[1].sl == 0 ? '' : item.dataList[1].fl}}
						</td>
						<td>
							{{String(item.dataList[1].je).indexOf('.') > -1 ? Number(Math.round(item.dataList[1].je*100)/100).toFixed(2) : item.dataList[1].je == 0 ? '' :item.dataList[1].je }}
						</td>
						<td>
							{{String(item.dataList[2].sl).indexOf('.') > -1 ? Number(item.dataList[2].sl).toFixed(3) : item.dataList[2].sl == 0 ? '' : item.dataList[2].sl}}
						</td>
						<td>
							{{item.dataList[2].sl == 0 ? '' : item.dataList[2].fl}}
						</td>
						<td>
							{{String(item.dataList[2].je).indexOf('.') > -1 ? Number(Math.round(item.dataList[2].je*100)/100).toFixed(2) : item.dataList[2].je == 0 ? '' : item.dataList[2].je}}
						</td>
						<td>
							{{String(item.dataList[3].sl).indexOf('.') > -1 ? Number(item.dataList[3].sl).toFixed(3) : item.dataList[3].sl == 0 ? '' : item.dataList[3].sl}}
						</td>
						<td>
							{{item.dataList[3].sl == 0 ? '' : item.dataList[3].fl}}
						</td>
						<td>
							{{String(item.dataList[3].je).indexOf('.') > -1 ? Number(Math.round(item.dataList[3].je*100)/100).toFixed(2) : item.dataList[3].je == 0 ? '' : item.dataList[3].je}}
						</td>
						<td>
							{{String(item.cblccf).indexOf('.') > -1 ? Number(item.cblccf).toFixed(2) : item.cblccf}}
						</td>
						<td>
							{{String(item.dataList[4].sl).indexOf('.') > -1 ? Number(item.dataList[4].sl).toFixed(3) : item.dataList[4].sl == 0 ? '' : item.dataList[4].sl}}
						</td>
						<td>
							{{item.dataList[4].sl == 0 ? '' : item.dataList[4].fl}}
						</td>
						<td>
							{{String(item.dataList[4].je).indexOf('.') > -1 ? Number(Math.round(item.dataList[4].je*100)/100).toFixed(2) : item.dataList[4].je == 0 ? '' : item.dataList[4].je}}
						</td>
					</tr>
					<div v-if="type != 'xg'" style="margin-top: 20px;"></div>
					<tr v-if="type != 'xg' && formInline.remark">
					  <td colspan="1" style="border: none;text-align: center;">
						  <div>备注</div>
					  </td>
					  <td colspan="18" style="border: none;text-align: left;">
						  <div class="textarap"
						  style="white-space: pre-wrap" v-html="formInline.remark">
						   </div>
						  <!-- <el-input :readonly="type != 'xg'" type="textarea" :rows="2" clearable v-model="formInline.remark" placeholder="请输入"></el-input> -->
					  </td>
					</tr>
					<div v-if="type == 'ck'" style="margin-top: 20px;"></div>
					<tr v-if="type == 'ck'">
					  <td colspan="1" style="border: none;text-align: left;">
						<div style="text-align: right;margin-right: 10px;">
							制表
						 </div>
					  </td>
					  <td colspan="1" style="border: none;text-align: left;">
						<div class="inputText"
						style="white-space: pre-wrap" v-html="formInline.tabulator">
						 </div> 
					  </td>
					  <td colspan="2" style="border: none;text-align: left;">
						 <div class="inputText"
						 style="white-space: pre-wrap;margin-left: 5px;" v-html="formInline.tabulatorDate">
						  </div>  
					  </td>
					  <td colspan="1" style="border: none;text-align: left;">
					  						
					   </td>
					 <td colspan="1" style="border: none;text-align: left;">
						<div style="text-align: right;margin-right: 10px;">
							复核
						 </div>
					  </td>
					  <td colspan="1" style="border: none;text-align: left;">
					   <div class="inputText"
					   style="white-space: pre-wrap" v-html="formInline.reviewer">
					    </div>
					  </td>
					  <td colspan="2" style="border: none;text-align: left;">
						   <div class="inputText"
						   style="white-space: pre-wrap;margin-left: 5px;" v-html="formInline.reviewDate">
							</div>
					  </td>
					  <td colspan="1" style="border: none;text-align: left;">
					  						
					   </td>
					 <td colspan="1" style="border: none;text-align: left;">
						<div style="text-align: right;margin-right: 10px;">
							财务领导批示
						 </div>
					  </td>
					  <td colspan="1" style="border: none;text-align: left;">
						<div class="inputText"
						style="white-space: pre-wrap" v-html="formInline.financeUsername">
						 </div>
					  </td>
					  <td colspan="2" style="border: none;text-align: left;">
						 <div class="inputText"
						 style="white-space: pre-wrap;margin-left: 5px;" v-html="formInline.financeDate">
						  </div>				
					  </td>
					 <td colspan="1" style="border: none;text-align: left;">
						
					  </td>
					  <td colspan="1" style="border: none;text-align: left;">
						<div style="text-align: right;margin-right: 10px;">
							单位负责人批示
						 </div>
					  </td>
					  <td colspan="1" style="border: none;text-align: left;">
						<div class="inputText"
						style="white-space: pre-wrap" v-html="formInline.leaderUsername">
						 </div>
					  </td>
					  <td colspan="2" style="border: none;text-align: left;">
						 <div class="inputText"
						 style="white-space: pre-wrap;margin-left: 5px;" v-html="formInline.leaderDate">
						  </div>  
					  </td>
					</tr>
					
				</tbody>
			</table>
			<div v-if="type != 'ck'">
				<div style="margin-top: 20px;"></div>
				<div class="areawidth" v-if="type != 'xg' && formInline.remark">
				   <el-form-item label="备注" label-width="80px">
				   <el-input :readonly="type != 'xg'" type="textarea" :rows="2" clearable v-model="formInline.remark" placeholder="请输入"></el-input>
				   </el-form-item>
				 </div> 
				 <div class="areawidth" v-if="type == 'xg'">
				    <el-form-item label="备注" label-width="80px">
				    <el-input :readonly="type != 'xg'" type="textarea" :rows="2" clearable v-model="formInline.remark" placeholder="请输入"></el-input>
				    </el-form-item>
				  </div> 
				<el-row>
					<el-form-item label="制表">
					  <el-input style="width: 100px;" readonly v-model="formInline.tabulator" placeholder="请输入"></el-input>
					</el-form-item>
					<el-form-item label-width="0">
					  <el-date-picker
					  style="width: 130px;"
					  :readonly="type != 'xg'"
					   v-model="formInline.tabulatorDate"
					   type="date"
					   placeholder="选择时间"
					   format="yyyy-MM-dd"
					   value-format="yyyy-MM-dd">
					  </el-date-picker>
					</el-form-item>
					<el-form-item label="复核">
					  <el-input style="width: 100px;" readonly v-model="formInline.reviewer" placeholder="请输入"></el-input>
					</el-form-item>
					<el-form-item label-width="0">
					  <el-date-picker
					  style="width: 130px;"
					  :readonly="type != 'fh'"
					   v-model="formInline.reviewDate"
					   type="date"
					   placeholder="选择时间"
					   format="yyyy-MM-dd"
					   value-format="yyyy-MM-dd">
					  </el-date-picker>
					</el-form-item>
					<el-form-item label="财务领导批示">
					  <el-input style="width: 100px;" readonly v-model="formInline.financeUsername" placeholder="请输入"></el-input>
					</el-form-item>
					<el-form-item label-width="0">
					  <el-date-picker
					  style="width: 130px;"
					  :readonly="type != 'cwsh'"
					   v-model="formInline.financeDate"
					   type="date"
					   placeholder="选择时间"
					   format="yyyy-MM-dd"
					   value-format="yyyy-MM-dd">
					  </el-date-picker>
					</el-form-item>
					<el-form-item label="单位负责人批示">
					  <el-input style="width: 100px;" readonly v-model="formInline.leaderUsername" placeholder="请输入"></el-input>
					</el-form-item>  
					<el-form-item label-width="0">
					  <el-date-picker
					  style="width: 130px;"
					  :readonly="type != 'fzrsh'"
					   v-model="formInline.leaderDate"
					   type="date"
					   placeholder="选择时间"
					   format="yyyy-MM-dd"
					   value-format="yyyy-MM-dd">
					  </el-date-picker>
					</el-form-item>
				</el-row>
			</div>
			<div style="text-align: center; margin-top: 20px">
				<el-button v-if="type != 'ck' && type == 'xg' " type="primary" icon="iconfont iconbaocun" @click="saveZc('0','formInline','1')">保存</el-button>
				<el-button v-if="type != 'ck'&& type == 'xg'" type="primary" icon="iconfont icontijiao" @click="saveZc('1','formInline','1')">提交</el-button>
				<el-button type="primary" :loading="stateLoading" @click="saveZc('','formInline','2')" size="small" class="iconfont icongaizhang"
				 v-if="type != 'ck' && (formInline.status == '91000401' || formInline.status == '91000300')">复核</el-button>
				 <el-button type="primary" :loading="stateLoading" @click="saveZc('','formInline','3')" size="small" class="iconfont icongaizhang"
				  v-if="type != 'ck' && (formInline.status == '91000501' || formInline.status == '91000400')">财务审核</el-button>
				<el-button type="primary" :loading="stateLoading" @click="saveZc('','formInline','4')" size="small" class="iconfont icongaizhang"
				 v-if="type != 'ck' && (formInline.status == '91000500')">负责人审核</el-button>
				<el-button type="primary" :loading="stateLoading" @click="saveZc('bh','formInline','')" size="small" class="iconfont iconbohui"
				 v-if="type != 'ck' && type != 'xg'">驳回</el-button>
				<el-button
				  type="primary"
				  class="iconfont icondaochu11"
				  @click="exportExcel"
				  >导出</el-button
				>
				<el-button @click="cancelClick" type="primary" icon="iconfont iconfanhui">返回</el-button>
				
			</div>
		</el-form>
		<!-- <sealDialog ref="sealDialog" sealId="btgrainsubsidy" @sealTodo="sealTodo" @sealError="sealError"></sealDialog> -->
	</div>
</template>

<script>
	import {
		storageSubsidySummarySave,
		storageSubsidySummaryUpdate,
		storageSubsidygenerate,
		storageSummaryInfo
	} from "@/api/cwbb/index";
	import * as XLSX from "xlsx";
	import * as XLSXS from "xlsx-style";
	import FileSaver from "file-saver";
	import {dateFormat} from '@/utils/index'
	// import sealDialog from "@/components/sealDialog/index.vue";
	export default {
		// components:{
		//   sealDialog
		// },
		data() {
			return {
				stateLoading: false,
				type: this.$route.query.type,
				formInliney:{
					
				},
				formInline: {
					dataType: '0',
					leader: '',
					auditor: '',
					reporter: '',
					reportDate: '',
					tabulatorDate:'',
					reviewDate:'',
					financeDate:'',
					leaderDate:'',
					orgCode: sessionStorage.getItem("orgCode"),
					period: '',
					sskdbm: sessionStorage.getItem("tyshxydm") + '001',
					orgName: sessionStorage.getItem("orgName"),
					operationType: '',
					summaryStatus: 1,
					reviewStatus:0,//复核状态
					financeStatus:0,//领导人批复状态
					leaderStatus:0,//单位负责人批复状态
					tabulator:'',
					reviewer:'',
					financeUsername:'',
					leaderUsername:'',
					isDelete:0,
					infoList: [],
				}
			}
		},
		created() {
			this.getJxcInfo()

		},
		methods: {
			cancelClick() {
				this.$router.push({
					name: "storageFeeSummary",
					query: {
						active: 'bt'
					}
				});
			},
			saveZc(type, formName, shtype, sussInfo, errInfo) {
				console.log('66555-==============')
				this.shtype = shtype
				if(type == 'bh'){
					if(this.type == 'fh'){
						this.shtype=2
						this.formInline.reviewStatus = 0
					}else if(this.type == 'cwsh'){
						this.shtype=3
						this.formInline.financeStatus = 0
					}else if(this.type == 'fzrsh'){
						this.shtype=4
						this.formInline.leaderStatus = 0
					}
					
				}
				if(shtype ==1){
					this.formInline.tabulator =this.formInline.tabulator ? this.formInline.tabulator :sessionStorage.getItem("userName")
				    this.formInline.operationType = type
				}else if (shtype == 2) {
					this.formInline.reviewStatus = 1
				}
				else if (shtype == 3) {
					this.formInline.financeStatus = 1
				}else if (shtype == 4) {
					this.formInline.leaderStatus = 1
				}
				this.formInline.summaryStatus = 1
				this.$refs[formName].validate((valid) => {
					if (valid) {
						if (this.$route.query.id) {
							// console.log(this.formInline,'ooiyy7778-----')
							storageSubsidySummaryUpdate(this.formInline, this.shtype).then(res => {
								if (res.infoCode == 200) {
									this.$message({
										message: "提交成功",
										type: "success",
									});
									this.$router.push({
										name: "storageFeeSummary",
										query: {
											active: 'bt'
										}
									});
								} else {
									this.$message.error(res.msg);
								}
							})
						} else {
							// console.log(this.formInline,'ooiyy7778----+++++++++++++-')

							storageSubsidySummarySave(this.formInline).then(res => {
								if (res.infoCode == 200) {
									this.$message({
										message: "保存成功",
										type: "success",
									});
									this.$router.push({
										name: "storageFeeSummary",
										query: {
											active: 'bt'
										}
									});
								} else {
									this.$message.error(res.msg);
								}
							})
						}
					}
				})

			},
			getJxcInfo() {
				if(this.$route.query.id){
					var data = {
						// ssId: this.$route.query.id,
						id:this.$route.query.id
						// dataType: 0,
					}
					storageSummaryInfo(data).then(res => {
						if (res.infoCode == 200) {
							var m=0
							var n=0
							var cblarr = []
							var cblyArr = []
							var cblyobj={}
							var ysl=null
							var yje=null
							var yfl=null
							var gcxmf = {}
							var hjsj = {
								ccqy: '合计',
								ccf: null,
								cblccf: null,
								dataList: [{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									}
								],
							}
							this.formInline = res.data
							var formInliney=JSON.stringify(this.formInline)
							this.formInliney=JSON.parse(formInliney)
							// this.formInline={...this.formInliney}
							// this.formInliney=Object.assign({},this.formInline)
							// res.data
							if(this.type == 'xg'){
								this.formInline.tabulator =this.formInline.tabulator ? this.formInline.tabulator :sessionStorage.getItem("userName")
							    this.formInline.tabulatorDate=this.formInline.tabulatorDate ? this.formInline.tabulatorDate :dateFormat(new Date())
								this.formInline.reviewer=''
								this.formInline.reviewDate=''
								this.formInline.financeUsername=''
								this.formInline.financeDate=''
								this.formInline.leaderUsername =''
								this.formInline.leaderDate=''
							}else if(this.type == 'fh'){
								this.formInline.reviewer =this.formInline.reviewer ? this.formInline.reviewer :sessionStorage.getItem("userName")	
							    this.formInline.reviewDate=dateFormat(new Date())
								this.formInline.financeUsername=''
								this.formInline.financeDate=''
								this.formInline.leaderUsername =''
								this.formInline.leaderDate=''
							}
							else if(this.type == 'cwsh'){
								this.formInline.financeUsername =this.formInline.financeUsername ? this.formInline.financeUsername :sessionStorage.getItem("userName")	
							    this.formInline.financeDate=dateFormat(new Date())
								this.formInline.leaderUsername =''
								this.formInline.leaderDate=''
							}
							else if(this.type == 'fzrsh'){
								this.formInline.leaderUsername =this.formInline.leaderUsername ? this.formInline.leaderUsername :sessionStorage.getItem("userName")	
							    this.formInline.leaderDate=dateFormat(new Date())
							}
							// console.log(this.formInline,'6623ttggfgjs--------------')
							this.formInliney.infoList.forEach((info,j) => {
								hjsj.ccf += info.ccf
								hjsj.cblccf += info.cblccf
								info.dataList.forEach((item, i) => {
									console.log(info,'6782kkjh---------')
										console.log('7777711sss==========')
									if (item.pzbm == '2310000' && item.typeCode == '08' && item.sl > 0) {
										m++
										gcxmf = item
										info.dataList.splice(i, 1)
										this.formInline.infoList[j+m-1].dataList.splice(i,1)
										var objList = {
											ccqy:info.ccqy,
											ccf: null,
											cblccf: null,
											dataList: [{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												},{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												}
											],
										}
										objList.dataList.splice(3,0,gcxmf)
										if(m ==1){
											this.formInline.infoList.splice(j+m,0,objList)
										}else{
											this.formInline.infoList.splice(j+m+1,0,objList)
										}
										// this.formInline.infoList.splice(j*2+1,0,objList)
									} else if (item.pzbm == '2310000' && item.typeCode == '08' && item.sl <= 0) {
										info.dataList.splice(i, 1)
										// if(m == 0){
										// 	this.formInline.infoList[j].dataList.splice(i,1)
										// }else{
										// 	this.formInline.infoList[j+m].dataList.splice(i,1)
										// }
										if(m == 0){
											this.formInline.infoList[j].dataList.splice(i,1)
										}else if(m == 1){
											this.formInline.infoList[j+m].dataList.splice(i,1)
										}else{
											this.formInline.infoList[j+m-1].dataList.splice(i,1)
										}
									}
					
								})
							})
							this.formInline.infoList.forEach((val,k) =>{
								val.dataList.forEach((vals, d) => {
								
									hjsj.dataList[d].sl += val.dataList[d].sl
									hjsj.dataList[d].je += val.dataList[d].je
							
								})
								
							})
							// console.log()
							this.formInline.infoList.unshift(hjsj)
							console.log(this.formInline, 'kkjho-------')
						}else{
							this.$message.error(res.msg);
						}
					})
				}else{
					var data = {
						// ssId: this.$route.query.isd,s
						dataType: 0,
					}
					storageSubsidygenerate(data).then(res => {
						if (res.infoCode == 200) {
							var n=0
							var m=0
							var cblarr = []
							var cblyArr = []
							var cblyobj={}
							var ysl=null
							var yje=null
							var yfl=null
							var gcxmf = {}
							var hjsj = {
								ccqy: '合计',
								ccf: null,
								cblccf: null,
								dataList: [{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									},
									{
										sl: null,
										fl: null,
										je: null,
									}
								],
							}
							this.formInline = res.data
							var formInliney=JSON.stringify(this.formInline)
							this.formInliney=JSON.parse(formInliney)
							this.formInline.orgCode=this.formInline.orgCode ? this.formInline.orgCode :sessionStorage.getItem("orgCode")
							this.formInline.sskdbm=this.formInline.sskdbm ? this.formInline.sskdbm :sessionStorage.getItem("tyshxydm") + '001'
							this.formInline.orgName= this.formInline.orgName ? this.formInline.orgName :sessionStorage.getItem("orgName")
							if(this.type == 'xg'){
								this.formInline.tabulator =this.formInline.tabulator ? this.formInline.tabulator :sessionStorage.getItem("userName")
								this.formInline.tabulatorDate=dateFormat(new Date())
							}
							this.formInliney.infoList.forEach((info,j) => {
								// n++
								hjsj.ccf += info.ccf
								hjsj.cblccf += info.cblccf
								info.dataList.forEach((item, i) => {
									if (item.pzbm == '2310000' && item.typeCode == '08' && item.sl > 0) {
										m++
										// n++
										gcxmf = item
										info.dataList.splice(i, 1)
										console.log('')
										this.formInline.infoList[j+m-1].dataList.splice(i,1)
										var objList = {
											ccqy:info.ccqy,
											ccf: null,
											cblccf: null,
											dataList: [{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												},
												{
													sl: null,
													fl: null,
													je: null,
												},
											],
										}
										objList.dataList.splice(3,0,gcxmf)
										// this.formInline.infoList.splice(j*2+1,0,objList)
										if(m ==1){
											this.formInline.infoList.splice(j+m,0,objList)
										}else{
											this.formInline.infoList.splice(j+m+1,0,objList)
										}
										
									} else if (item.pzbm == '2310000' && item.typeCode == '08' && item.sl <= 0) {
										console.log(info.dataList,'')
										console.log(j,m,'712-------------')
										console.log(this.formInline,'00000000')
										info.dataList.splice(i, 1)
										if(m == 0){
											this.formInline.infoList[j].dataList.splice(i,1)
										}else if(m == 1){
											this.formInline.infoList[j+m].dataList.splice(i,1)
										}else{
											this.formInline.infoList[j+m-1].dataList.splice(i,1)
										}
										
										
									}
									
									console.log(i, 'uiouo----------')
									console.log(hjsj.dataList[i], 'uytr66666666666')
									// hjsj.dataList[i].sl += info.dataList[i].sl
									// // hjsj.dataList[i].fl += info.dataList[i].fl
									// hjsj.dataList[i].je += info.dataList[i].je
					
								})
								console.log(this.formInline.infoList, 'kkjho-------')
							})
							// console.log(this.formInline.infoList, 'kkjho-------')
							this.formInline.infoList.forEach((val,k) =>{
								val.dataList.forEach((vals, d) => {
									console.log(val,k,'66678743-------')
									// console.log(val.dataList[k].sl,'6347358485gggggggggggg')
									hjsj.dataList[d].sl += val.dataList[d].sl
									hjsj.dataList[d].je += val.dataList[d].je
									// console.log(hjsj.dataList[k].sl,'6325463257hjdshfu=========')
								})
								
							})
							console.log(hjsj,'yyeuweuywe-=============')
							this.formInline.infoList.unshift(hjsj)
							// this.formInline=JSON.stringify(this.formInline)
							// console.log(this.formInline, 'kkjho-------')
						}else{
							this.$message.error(res.msg);
						}
					})
				}
				
			},
			exportExcel() {
			  this.$confirm("是否下载Excel表？", "提示", {
			    closeOnClickModal: false,
			    closeOnPressEscape: false,
			    confirmButtonText: "确定",
			    cancelButtonText: "取消",
			    type: "warning",
			    customClass: "messageBox",
			  }).then(() => {
			    let wb = XLSX.utils.table_to_book(
			      document.getElementById("summaryData"),
			      { sheet: "存储费补贴汇总" }
			    );
			    this.setExlStyle(wb["Sheets"]["存储费补贴汇总"]);
			    //合并单元格边框补齐
			    this.addRangeBorder(
			      wb["Sheets"]["存储费补贴汇总"]["!merges"],
			      wb["Sheets"]["存储费补贴汇总"]
			    );
			    var ws = XLSXS.write(wb, {
			      type: "buffer",
			    });
			    try {
			      FileSaver.saveAs(
			        new Blob([ws], { type: "application/octet-stream" }),
			        `存储费补贴汇总.xlsx`
			      );
			    } catch (e) {
			      if (typeof console !== "undefined") console.log(e, ws);
			    }
			    return ws;
			  });
			},
			setExlStyle(data, type) {
			  let borderAll = {
			    //单元格外侧框线
			    top: {
			      style: "thin",
			    },
			    bottom: {
			      style: "thin",
			    },
			    left: {
			      style: "thin",
			    },
			    right: {
			      style: "thin",
			    },
			  };
			  data["!cols"] = [];
			  // if(type =='kc'){
			  // data['!cols'].push({wpx: 60},{wpx: 260});
			  for (let i = 0; i < 22; i++) {
			    data["!cols"].push({ wpx: 120 });
			  }
			  // }
			  // this.$nextTick(() =>{
			  for (let key in data) {
			    console.log(key, data[key], "datakey----------------");
			    if (data[key] instanceof Object) {
			      // data[key].t='s'
			      data[key].s = {
			        // item.NumberFormat = "@";
			        border: borderAll,
			        alignment: {
			          horizontal: "center", //水平居中对齐
			          vertical: "center",
			        },
			        font: {
			          sz: 11,
			        },
			        bold: true,
			        numFmt: 0,
			      };
			      // console.log(key,data[key],'datakey----------------')
			    }
			  }
			  this.$nextTick(() => {
			    return data;
			  });
			},
			addRangeBorder(range, ws) {
			  let cols = [
			    "A",
			    "B",
			    "C",
			    "D",
			    "E",
			    "F",
			    "G",
			    "H",
			    "I",
			    "J",
			    "K",
			    "L",
			    "M",
			    "N",
			    "O",
			    "P",
			    "Q",
			    "R",
			    "S",
			    "T",
			    "U",
			    "V",
			    "W",
			    "X",
			    "Y",
			    "Z",
			  ];
			  range.forEach((item) => {
			    console.log(item);
			    let style = {
			      s: {
			        border: {
			          top: { style: "thin" },
			          left: { style: "thin" },
			          bottom: { style: "thin" },
			          right: { style: "thin" },
			        },
			      },
			    };
			    // 处理合并行
			    for (let i = item.s.c; i <= item.e.c; i++) {
			      ws[`${cols[i]}${Number(item.e.r) + 1}`] =
			        ws[`${cols[i]}${Number(item.e.r) + 1}`] || style;
			      // 处理合并列
			      for (let k = item.s.r + 2; k <= item.e.r + 1; k++) {
			        ws[cols[i] + k] = ws[cols[k] + item.e.r] || style;
			      }
			    }
			  });
			  return ws;
			},
		}
	}
</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;
	}
	.textarap {
	  border: 1px solid #dcdfe6;
	  background-color: #ffffff;
	  line-height: 1.5;
	  padding: 5px 15px;
	  border-radius: 4px;
	  color: #606266;
	  font-size: 12px;
	  min-height: 40px;
	}
	.inputText {
	  border: 1px solid #dcdfe6;
	  background-color: #ffffff;
	  line-height: 40px;
	  height: 40px;
	  padding: 0 15px;
	  border-radius: 4px;
	  color: #606266;
	  font-size: 12px;
	  // width: 120px;
	}
</style>
<style>
</style>
