<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
	<div>
		<el-dialog
			:title="title"
			:close-on-click-modal="false"
			draggable
			width="1200px"
			@close="close"
			append-to-body
			@keyup.enter.native="doSubmit"
			v-model="visible">
		<el-form :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''" :disabled="method==='view' || status === 'audit' || status === 'taskFormDetail'"
				 label-width="100px" @submit.native.prevent>

			<el-divider content-position="left"><i class="el-icon-document"></i> 基础信息</el-divider>
			<el-row :gutter="26">
				<el-col :span="12">
					<el-form-item label="经办人" prop="createName">
						<el-input v-model="inputForm.createName" :disabled="true"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="报销编号" prop="no">
						<el-input v-model="inputForm.no" :disabled="true"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="所属部门" prop="departmentName">
						<el-input v-model="inputForm.departmentName" :disabled="true"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="报销日期" prop="createTime" :rules="[]">
						<el-date-picker
							:disabled="true"
							placement="bottom-start"
							v-model="inputForm.createTime"
							type="date"
							value-format="YYYY-MM-DD"
							style="width: 100%"
							placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item label="报销类型" prop="applyType"
								  :rules="[
                        {required: true, message:'请选择报销类型', trigger:'change'}
                 ]">
						<el-select v-model="inputForm.applyType" @change="changeSourceType" placeholder="请选择报销类型" style="width:100%;">
							<el-option
								v-for="item in $dictUtils.getDictList('jy_apply')"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="24">
					<el-form-item label="备注" prop="remarks">
						<el-input v-model="inputForm.remarks"
								  type="textarea"
								  :rows="5"
								  maxlength="500"
								  placeholder="请输入简介"
								  show-word-limit>
						</el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<div v-if="inputForm.applyType === '1'">
				<el-divider content-position="left"><i class="el-icon-document"></i>
					借款冲抵详情
					<el-button style="margin-left: 20px" type="primary" :disabled="method==='view' || status === 'audit' || status === 'taskFormDetail'" @click="insertEvent('borrows')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod"
							ref="detailTable"
							:key="detailKey"
							class="vxe-table-element"
							:data="inputForm.infoborrows"
							style="margin-left: 5em"
							highlight-current-row
							:edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon:'_'}"
							:edit-rules="validRules"
						>
							<vxe-table-column field="userName" title="报销人" :edit-render="{}" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.userName" :disabled='true'></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.deptName" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="typeName" title="报销类别" :edit-render="{}" :rules="[{required: true, message:'请选择报销类别', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.typeName" @focus="typePullForm(scope.$rowIndex, scope.row.deptId)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="projectName" title="借款详情" :edit-render="{}" :rules="[{required: true, message:'请填写借款详情', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.projectName" @focus="openBorrowForm(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="reportNumber" title="借款编号" :edit-render="{}" :rules="[]">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.reportNumber"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="moneyLower" title="借款金额(元)" :edit-render="{}" :rules="[]">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.moneyLower"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" v-on:input="scope.row.number=scope.row.number.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template v-slot="scope">
									<el-button size="small" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'borrow')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>
				</el-row>
			</div>
			<div v-if="inputForm.applyType === '2'">
				<el-divider content-position="left"><i class="el-icon-document"></i>
					付款冲抵详情
					<el-button style="margin-left: 20px" type="primary" :disabled="method==='view' || status === 'audit' || status === 'taskFormDetail'" @click="insertEvent('payment')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod"
							ref="detailTablePayment"
							:key="detailKeyContract"
							class="vxe-table-element"
							:data="inputForm.infoPayments"
							style="margin-left: 5em"
							highlight-current-row
							:edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon:'_'}"
							:edit-rules="validRules"
						>
							<vxe-table-column field="userName" title="报销人" :edit-render="{}" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.userName" :disabled='true'></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.deptName" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="typeName" title="报销类别" :edit-render="{}" :rules="[{required: true, message:'请选择报销类别', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.typeName" @focus="typePullForm2(scope.$rowIndex, scope.row.deptId)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="projectName" title="付款详情" :edit-render="{}" :rules="[{required: true, message:'请选择付款详情', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.projectName" @focus="openPayment(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="reportNumber" title="付款编号" :edit-render="{}" :rules="[]">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.reportNumber"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="paymentLower" title="付款金额(元)" :edit-render="{}" :rules="[]">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.paymentLower"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" v-on:input="scope.row.number=scope.row.number.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template v-slot="scope">
									<el-button size="small" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'payment')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>
				</el-row>
			</div>

			<div v-if="inputForm.applyType === '3'">
				<el-divider content-position="left"><i class="el-icon-document"></i>
					其他报销详情
					<el-button style="margin-left: 20px" type="primary" :disabled="method==='view' || status === 'audit' || status === 'taskFormDetail'" @click="insertEvent('others')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod"
							ref="detailTableOthers"
							class="vxe-table-element"
							:data="inputForm.infoOthers"
							style="margin-left: 5em"
							:key="detailKeyOthers"
							highlight-current-row
							:edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon:'_'}"
							:edit-rules="validRules"
						>
							<vxe-table-column field="userName" title="报销人" :edit-render="{}" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.userName" :disabled='true'></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.deptName" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="typeName" title="报销类别" :edit-render="{}" :rules="[{required: true, message:'请选择报销类别', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.typeName" @focus="typePullForm3(scope.$rowIndex, scope.row.deptId)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="projectName" title="报销详情" :edit-render="{}" :rules="[{required: true, message:'请填写报销详情', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.projectName" @focus="openProgramPageForm4(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" v-on:input="scope.row.number=scope.row.number.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template v-slot="scope">
									<el-button size="small" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'others')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>
				</el-row>
			</div>
			<div v-if="inputForm.applyType === '4'">
				<el-divider content-position="left"><i class="el-icon-document"></i>
					项目报销详情
					<el-button style="margin-left: 20px" type="primary" :disabled="method==='view' || status === 'audit' || status === 'taskFormDetail'" @click="insertEvent('project')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod"
							ref="detailTableProject"
							:key="detailKeyProject"
							class="vxe-table-element"
							:data="inputForm.infoProjects"
							style="margin-left: 5em"
							highlight-current-row
							:edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon:'_'}"
							:edit-rules="validRules"
						>
							<vxe-table-column field="userName" title="报销人" :edit-render="{}" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.userName" @focus="userPullListForm3(scope.$rowIndex)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}">
								<template v-slot:edit="scope">
									<el-input :disabled='true' v-model="scope.row.deptName" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="typeName" title="报销类别" :edit-render="{}" :rules="[{required: true, message:'请选择报销类别', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.typeName" @focus="typePullForm4(scope.$rowIndex, scope.row.deptId)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="projectName" title="报销项目" :edit-render="{}" :rules="[{required: true, message:'请选择报销项目', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.projectName" @focus="openProgramPageForm3(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template v-slot:edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" v-on:input="scope.row.number=scope.row.number.replace(/[^\d.]/g,'')
							  .replace(/^\./g,'')
							  .replace(/\.{2,}/g,'.')
							  .replace('.','$#$').replace(/\./g,'').replace('$#$','.')
							  .replace(/^(\-)*(\d+)\.(\d\d).*$/,'$1$2.$3').replace(/^0+/, '0')"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.receiptNumber" oninput ="value=value.replace(/\D|^0/g,'')" maxlength="10"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="days" title="出差天数" :edit-render="{}">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.days" oninput ="value=value.replace(/\D|^0/g,'')" maxlength="10"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="content" title="内容" :edit-render="{}">
								<template v-slot:edit="scope">
									<el-input v-model="scope.row.content" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template v-slot="scope">
									<el-button size="small" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'report_detail')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>
				</el-row>
			</div>
			<el-divider content-position="left"><i class="el-icon-document"></i>
				专用发票信息
				<el-button style="margin-left: 20px" type="primary" :disabled="method==='view' || status === 'audit' || status === 'taskFormDetail' " @click="insertEvent('amount')" plain>
					新增
				</el-button>
			</el-divider>
			<el-row  :gutter="15" >
				<el-col :span="24">
					<vxe-table
						border
						show-overflow
						ref="amountTable"
						class="vxe-table-element"
						:data="inputForm.amountInfos"
						style="margin-left: 5em"
						:key="amountKey"
						highlight-current-row
						:edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon:'_'}"
					>
						<vxe-table-column field="code" title="发票代码" :edit-render="{}">
							<template v-slot:edit="scope">
								<el-input oninput ="value=value.replace(/\D|^/g,'')" maxlength="20" v-model="scope.row.code" ></el-input>
							</template>
						</vxe-table-column>
						<vxe-table-column field="number" title="发票号" :edit-render="{}">
							<template v-slot:edit="scope">
								<el-input oninput ="value=value.replace(/\D|^/g,'')" maxlength="8" @change="isExict(scope.row)" v-model="scope.row.number" ></el-input>
							</template>
						</vxe-table-column>
						<vxe-table-column field="amount" title="金额" :edit-render="{}">
							<template v-slot:edit="scope">
								<el-input maxlength="15" v-model="scope.row.amount" @keyup.native="scope.row.amount = twoDecimalPlaces(scope.row.amount)" @change="countAmount(scope.row)"></el-input>
							</template>
						</vxe-table-column>
						<vxe-table-column field="taxAmount" title="税额" :edit-render="{}">
							<template v-slot:edit="scope">
								<el-input maxlength="15" v-model="scope.row.taxAmount" @keyup.native="scope.row.taxAmount = twoDecimalPlaces(scope.row.taxAmount)" @change="countAmount(scope.row)"></el-input>
							</template>
						</vxe-table-column>
						<vxe-table-column field="count" title="价税合计" :edit-render="{}">
							<template v-slot:edit="scope">
								<el-input :disabled="true" v-model="scope.row.count" ></el-input>
							</template>
						</vxe-table-column>
						<vxe-table-column title="操作" width="100">
							<template v-slot="scope">
								<el-button size="small" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'amount')">删除</el-button>
							</template>
						</vxe-table-column>
					</vxe-table>
				</el-col>
			</el-row>



			<!--      <ReimbursementTypePullForm ref="reimbursementTypePullForm" @getProgramForType="getProgramForType"></ReimbursementTypePullForm>-->
			<CwReimbursementTypePullForm ref="cwReimbursementTypePullForm" @getProgramForType="getProgramForType"></CwReimbursementTypePullForm>
			<CwReimbursementTypePullForm ref="cwReimbursementTypePullForm2" @getProgramForType="getProgramForType2"></CwReimbursementTypePullForm>
			<CwReimbursementTypePullForm ref="cwReimbursementTypePullForm3" @getProgramForType="getProgramForType3"></CwReimbursementTypePullForm>
			<CwReimbursementTypePullForm ref="cwReimbursementTypePullForm4" @getProgramForType="getProgramForType4"></CwReimbursementTypePullForm>

			<!--			<UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>-->
			<!--			<UserPullForm ref="userPullForm2" @getProgramForUser="getProgramForUser2"></UserPullForm>-->
			<!--			<UserPullForm ref="userPullForm3" @getProgramForUser="getProgramForUser3"></UserPullForm>-->
			<!--			<UserPullForm ref="userPullForm4" @getProgramForUser="getProgramForUser4"></UserPullForm>-->
			<!--			<UserPullForm ref="userPullForm5" @getProgramForUser="getProgramForUser5"></UserPullForm>-->

			<BorrowByUserIdForm ref="borrowByUserIdForm" @getBorrow="getBorrow"></BorrowByUserIdForm>
			<PaymentByUserIdForm ref="paymentByUserIdForm" @getPayment="getPayment"></PaymentByUserIdForm>
			<ProjectForm ref="projectForm" @getProgram="getProgram"></ProjectForm>

		</el-form>
			<!-- 附件 -->
			<UpLoadComponent ref="uploadComponent"></UpLoadComponent>
			<template #footer>
			<span class="dialog-footer">
			  <el-button @click="close()" icon="el-icon-circle-close">关闭</el-button>
			  <el-button type="primary" v-if="method != 'view'" @click="doSubmit()" icon="el-icon-circle-check" v-noMoreClick>确定</el-button>
			</span>
			</template>
		</el-dialog>
	</div>
</template>

<script>

	import ReimbursementService from '@/api/jy/ReimbursementService'
	import ReimbursementApprovalTypeService from '@/api/cw/reimbursementApproval/ReimbursementApprovalTypeService'
	import UpLoadComponent from '@/views/common/UpLoadComponent'
	import XEUtils from 'xe-utils'
	import CwReimbursementTypePullForm from './CwReimbursementTypePullForm'
	import UserPullForm from '@/views/finance/invoice/UserPullForm'
	import CommonApi from '@/api/cw/common/CommonApi'
	import BorrowByUserIdForm from './BorrowByUserIdForm'
	import PaymentByUserIdForm from './PaymentByUserIdForm'
	import ProjectForm from '@/views/materialManagement/userSeal/ProjectForm'
	export default {
		props: {
			businessId: {
				type: String,
				default: ''
			},
			formReadOnly: {
				type: Boolean,
				default: false
			},
			status: {
				type: String,
				default: ''
			}
		},
		data () {
			return {
				validRules: {
					userName: [
						{required: true, message: '报销人不能为空'}
					],
					deptName: [
						{required: true, message: '报销部门不能为空'}
					],
					typeName: [
						{required: true, message: '报销类型不能为空'}
					],
					projectName: [
						{required: true, message: '报销项目不能为空'}
					],
					number: [
						{required: true, message: '费用(元)不能为空'}
					]
				},
				title: '',
				method: '',
				visible: false,
				loading: false,
				indexRow: '',
				detailKey: '',
				detailKeyContract: '',
				detailKeyReport: '',
				detailKeyOthers: '',
				detailKeyProject: '',
				inputForm: {
					userId: '',
					createName: '',
					no: '',
					department: '',
					createTime: '',
					remarks: '',
					infoborrows: [],
					infoPayments: [],
					infoOthers: [],
					infoProjects: [],
					amountInfos: [],
					files: [], // 附件信息
					procInsId: '',
					applyType: '',
					preList: [],
					purchaseNo: '',
					tradeTotalPrice: '',
					purchaseId: '',
					departmentName: ''
				},
				keyWatch: '',
				amountKey: ''
			}
		},
		ReimbursementService: null,
		reimbursementApprovalTypeService: null,
		commonApi: null,
		created () {
			this.reimbursementService = new ReimbursementService()
			this.reimbursementApprovalTypeService = new ReimbursementApprovalTypeService()
			this.commonApi = new CommonApi()
		},
		components: {
			UpLoadComponent,
			CwReimbursementTypePullForm,
			UserPullForm,
			BorrowByUserIdForm,
			PaymentByUserIdForm,
			ProjectForm
		},
		computed: {
			bus: {
				get () {
					this.$refs.uploadComponent.setDividerName('附件')
					return this.businessId
				},
				set (val) {
					this.businessId = val
				}
			},
			name () {
				return this.$store.state.user.name
			},
			officeName () {
				return this.$store.state.user.office.name
			},
			userId () {
				return this.$store.state.user.id
			}
		},
		watch: {
			'keyWatch': {
				handler (newVal) {
					if (this.commonJS.isNotEmpty(this.bus)) {
						this.init('', this.bus)
					} else {
						this.$nextTick(() => {
							this.$refs.inputForm.resetFields()
						})
					}
				}
			},
			'loading': {
				handler (newVal) {
					this.$emit('changeLoading', newVal)
					this.$refs.uploadComponent.changeLoading(newVal)
				}
			}
		},
		methods: {
			getKeyWatch (keyWatch) {
				this.keyWatch = keyWatch
			},
			getUpload () {
			},
			init (method, id) {
				this.method = method
				this.inputForm = {
					id:'',
					userId: '',
					createName: '',
					no: '',
					department: '',
					createTime: '',
					remarks: '',
					infoborrows: [],
					infoPayments: [],
					infoOthers: [],
					infoProjects: [],
					amountInfos: [],
					files: [], // 附件信息
					procInsId: '',
					applyType: '',
					preList: [],
					purchaseNo: '',
					tradeTotalPrice: '',
					purchaseId: '',
					departmentName: ''
				}
				if (method === 'view') {
					this.title = `查看报销类型`
				} else if (method === 'edit') {
					this.title = '修改报销类型'
				}
				this.inputForm.id = id
				this.visible = true
				this.loading = false
				this.$nextTick(() => {
					this.loading = true
					this.$refs.inputForm.resetFields()
					this.reimbursementService.findById(this.inputForm.id).then((data) => {

						this.$refs.uploadComponent.clearUpload()
						if (this.status === 'audit' || this.status === 'taskFormDetail') {
							method = 'view'
						}
						this.inputForm = this.recover(this.inputForm, data)
						console.log('data',this.inputForm)
						this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
						if (this.commonJS.isEmpty(this.inputForm.department)) {
							this.inputForm.department = this.$store.state.user.office.id
							this.inputForm.departmentName = this.$store.state.user.office.name
						}
						if (this.commonJS.isEmpty(this.inputForm.userId)) {
							this.inputForm.userId = this.$store.state.user.id
						}
						if (this.commonJS.isEmpty(this.inputForm.createName)) {
							this.inputForm.createName = this.$store.state.user.name
						}
						if (this.commonJS.isEmpty(this.inputForm.createTime)) {
							this.inputForm.createTime = this.moment(new Date()).format('YYYY-MM-DD')
						}
						this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'jyReimbursement')
						this.loading = false
					})


				})
			},
			// 表单提交
			doSubmit () {
				this.$refs['inputForm'].validate((valid) => {
					if (valid) {
						this.loading = true
						if (this.$refs.uploadComponent.checkProgress()) {
							this.loading = false
							return
						}
						if (this.commonJS.isEmpty(this.inputForm.files)) {
							this.inputForm.files = []
						}
						this.inputForm.files = this.$refs.uploadComponent.getDataList()
						this.reimbursementService.saveForm(this.inputForm).then((data) => {
							this.close()
							this.$message.success(data)
							this.$emit('refreshDataList')
							this.loading = false
						}).catch(() => {
							this.loading = false
						})

					}
				})
			},
			close () {
				this.inputForm.infoborrows = []
				this.inputForm.infoPayments = []
				this.inputForm.infoOthers = []
				this.inputForm.infoProjects = []
				this.inputForm.purchaseNo = ''
				this.inputForm.preList = ''
				this.inputForm.purchaseId = ''
				this.$refs.inputForm.resetFields()
				this.inputForm.amountInfos = []
				this.$refs.uploadComponent.clearUpload()
				this.visible = false
			},
			// 删除
			removeEvent (row, rowIndex, type) {
				if (type === 'borrow') {
					this.$refs.detailTable.remove(row)
					this.inputForm.infoborrows.splice(rowIndex, 1)
				}
				if (type === 'payment') {
					this.$refs.detailTablePayment.remove(row)
					this.inputForm.infoPayments.splice(rowIndex, 1)
				}
				if (type === 'others') {
					this.$refs.detailTableOthers.remove(row)
					this.inputForm.infoOthers.splice(rowIndex, 1)
				}
				if (type === 'project') {
					this.$refs.detailTableProject.remove(row)
					this.inputForm.infoProjects.splice(rowIndex, 1)
				}
				if (type === 'amount') {
					this.$refs.amountTable.remove(row)
					this.inputForm.amountInfos.splice(rowIndex, 1)
				}
			},
			// 新增
			async insertEvent (type) {
				if (type === 'borrows') {
					let d = {
						userName: this.$store.state.user.name,
						deptName: this.$store.state.user.office.name,
						userId: this.$store.state.user.id,
						deptId: this.$store.state.user.office.id
					}
					if (this.commonJS.isEmpty(this.inputForm.infoborrows)) {
						this.inputForm.infoborrows = []
					}
					this.$refs.detailTable.insertAt(d)
					this.inputForm.infoborrows.push(d)
					this.detailKey = Math.random()
				}
				if (type === 'payment') {
					let d = {
						userName: this.$store.state.user.name,
						deptName: this.$store.state.user.office.name,
						userId: this.$store.state.user.id,
						deptId: this.$store.state.user.office.id}
					if (this.commonJS.isEmpty(this.inputForm.infoPayments)) {
						this.inputForm.infoPayments = []
					}
					this.$refs.detailTablePayment.insertAt(d)
					this.inputForm.infoPayments.push(d)
					this.amountKey = Math.random()
				}
				if (type === 'others') {
					let d = {
						userName: this.$store.state.user.name,
						deptName: this.$store.state.user.office.name,
						userId: this.$store.state.user.id,
						deptId: this.$store.state.user.office.id
					}
					if (this.commonJS.isEmpty(this.inputForm.infoOthers)) {
						this.inputForm.infoOthers = []
					}
					this.$refs.detailTableOthers.insertAt(d)
					this.inputForm.infoOthers.push(d)
					this.detailKeyOthers = Math.random()
				}
				if (type === 'project') {
					let d = {
						userName: this.$store.state.user.name,
						deptName: this.$store.state.user.office.name,
						userId: this.$store.state.user.id,
						deptId: this.$store.state.user.office.id
					}
					if (this.commonJS.isEmpty(this.inputForm.infoProjects)) {
						this.inputForm.infoProjects = []
					}
					this.$refs.detailTableProject.insertAt(d)
					this.inputForm.infoProjects.push(d)
					this.detailKeyProject = Math.random()
				}
				if (type === 'amount') {
					let d = {}
					if (this.commonJS.isEmpty(this.inputForm.amountInfos)) {
						this.inputForm.amountInfos = []
					}
					this.$refs.amountTable.insertAt(d)
					this.inputForm.amountInfos.push(d)
					this.amountKey = Math.random()
				}
			},
			// 暂存
			async saveForm (callback) {
				this.loading = true
				if (this.$refs.uploadComponent.checkProgress()) {
					this.loading = false
					return
				}
				if (this.commonJS.isEmpty(this.inputForm.files)) {
					this.inputForm.files = []
				}
				this.inputForm.files = this.$refs.uploadComponent.getDataList()
				this.inputForm.status = '1'
				this.reimbursementService.saveForm(this.inputForm).then((data) => {
					callback()
					this.$refs.inputForm.resetFields()
					this.loading = false
				}).catch(() => {
					this.$refs.inputForm.resetFields()
					this.loading = false
				})
			},
			reapplyForm (callback) {
				this.loading = true
				this.reimbursementService.findById(this.inputForm.id).then((data) => {
					if (data.status !== '4') { // 审核状态不是“驳回”，就弹出提示
						this.loading = false
						this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
					} else {
						this.startFormTrue(callback)
					}
				})
			},
			startForm (callback) {
				this.loading = true
				if (this.commonJS.isNotEmpty(this.inputForm.id)) {
					this.reimbursementService.findById(this.inputForm.id).then((data) => {
						if (data.status !== '0' && data.status !== '1' && data.status !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”，就弹出提示
							this.loading = false
							this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
							throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						} else {
							this.startFormTrue(callback)
						}
					})
				} else {
					this.startFormTrue(callback)
				}
			},
			// 送审
			async startFormTrue (callback) {
				this.$refs['inputForm'].validate(async (valid) => {
					if (valid) {
						this.loading = true
						this.submitCheck()
						if (this.$refs.uploadComponent.checkProgress()) {
							this.loading = false
							return
						}
						if (this.commonJS.isEmpty(this.inputForm.files)) {
							this.inputForm.files = []
						}
						this.inputForm.files = this.$refs.uploadComponent.getDataList()
						this.inputForm.status = '2'
						this.reimbursementService.saveForm(this.inputForm).then((data) => {
							this.inputForm.id = data.businessId
							callback(data.businessTable, data.businessId, this.inputForm)
							this.$refs.inputForm.resetFields()
							this.loading = false
						}).catch(() => {
							this.$refs.inputForm.resetFields()
							this.loading = false
						})
					} else {
						this.loading = false
					}
				})
			},
			// 通过
			async agreeForm (callback) {
				this.loading = true
				this.reimbursementService.findById(this.inputForm.id).then((data) => {
					if (data.status !== '2') { // 审核状态不是“审核中”，就弹出提示
						this.loading = false
						this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
					} else {
						this.$refs['inputForm'].validate(async (valid) => {
							if (valid) {
								this.loading = true
								this.submitCheck()
								if (this.$refs.uploadComponent.checkProgress()) {
									this.loading = false
									return
								}
								if (this.commonJS.isEmpty(this.inputForm.files)) {
									this.inputForm.files = []
								}
								this.inputForm.files = this.$refs.uploadComponent.getDataList()
								this.inputForm.status = '2'
								this.commonApi.getTaskNameByProcInsId(this.inputForm.procInsId).then((data) => {
									if (this.commonJS.isNotEmpty(data)) {
										if (data === '总经理审核') {
											this.inputForm.status = '5'
										}
									}
									this.reimbursementService.updateStatusById(this.inputForm).then((data) => {
										callback(data.businessTable, data.businessId, this.inputForm)
										this.loading = false
									}).catch(() => {
										this.loading = false
									})
								})
							} else {
								this.loading = false
							}
						})
					}
				})
			},
			// 修改状态
			updateStatusById (type, callback) {
				if (type === 'reject') {
					this.loading = true
					this.reimbursementService.findById(this.inputForm.id).then((data) => {
						if (data.status !== '2') { // 审核状态不是“审核中”，就弹出提示
							this.loading = false
							this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
							throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						} else {
							this.inputForm.status = '4'
							this.reimbursementService.updateStatusById(this.inputForm).then(() => {
								this.loading = false
								callback()
							})
						}
					})
				} else if (type === 'hold') {
					this.loading = true
					this.reimbursementService.findById(this.inputForm.id).then((data) => {
						if (data.status !== '4') { // 审核状态不是“驳回”，就弹出提示
							this.loading = false
							this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
							throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						} else {
							this.inputForm.status = '1'
							this.reimbursementService.updateStatusById(this.inputForm).then(() => {
								this.loading = false
								callback()
							})
						}
					})
				}
			},
			footerMethod ({ columns, data }) {
				const footerData = [
					columns.map((column, columnIndex) => {
						if (columnIndex === 0) {
							return '总报销费用'
						}
						if (['number'].includes(column.property)) {
							// eslint-disable-next-line no-undef
							return XEUtils.sum(data, column.property)
						}
						return null
					})
				]
				return footerData
			},
			isExict (row) {
				this.reimbursementService.checkNumber(row.number).then((data) => {
					if (data) {
						this.$message.error('该发票号已存在')
						row.number = ''
					}
				})
				// this.reimbursementService.checkNumber(row.number).then((data) => {
				//   if (data) {
				//     this.$message.error('该发票号已存在')
				//     row.number = ''
				//   }
				// })
			},
			countAmount (row) {
				let amount
				let taxAmount
				let count = 0
				if (!this.commonJS.isEmpty(row.amount)) {
					amount = parseFloat(row.amount)
					count = count + amount
				}
				if (!this.commonJS.isEmpty(row.taxAmount)) {
					taxAmount = parseFloat(row.taxAmount)
					count = count + taxAmount
				}
				row.count = parseFloat(count).toFixed(2)
			},
			// 选择借款信息
			openBorrowForm (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类别')
					return
				}
				this.indexRow = rowIndex

				this.$refs.borrowByUserIdForm.init()

			},
			openPayment(rowIndex, row){
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类别')
					return
				}
				this.indexRow = rowIndex
				this.$refs.paymentByUserIdForm.init()
			},
			openProgramPageForm (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类型')
					return
				}
				this.indexRow = rowIndex
				this.reimbursementApprovalTypeService.findById(row.typeId).then((data) => {
					console.log('typeInfo', data.sort)
					console.log('data', data)
					let i = data.sort.toString()
					i = i.substring(0, 1)
					// 非业务报销
					console.log('i', i)
					if (i !== '1') {
						this.$refs.cwProgramPageForm.init('2', false)
					} else {
						// 打开单选组件
						this.$refs.cwProgramPageForm.init('1', true)
					}
				})
			},
			openProgramPageForm3 (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类型')
					return
				}
				this.indexRow = rowIndex
				this.$refs.projectForm.init('', true)
			},
			openProgramPageForm4 (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类型')
					return
				}
				this.indexRow = rowIndex
				this.$refs.cwProgramPageForm4.init('2', false)
			},
			getBorrow (rows) {
				if (this.commonJS.isNotEmpty(rows)) {
					this.inputForm.infoborrows[this.indexRow].projectId = rows.id
					this.inputForm.infoborrows[this.indexRow].projectName = rows.reason
					this.inputForm.infoborrows[this.indexRow].moneyLower = rows.moneyLower
					this.inputForm.infoborrows[this.indexRow].reportNumber = rows.no
				}
				this.indexRow = ''
				this.$forceUpdate()
			},
			getPayment (rows) {
				this.inputForm.infoPayments[this.indexRow].projectId = rows.id
				this.inputForm.infoPayments[this.indexRow].projectName = rows.reason
				this.inputForm.infoPayments[this.indexRow].paymentLower = rows.paymentLower
				this.inputForm.infoPayments[this.indexRow].reportNumber = rows.no
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgram4 (rows) {
				this.inputForm.infoOthers[this.indexRow].projectId = rows[0].id
				this.inputForm.infoOthers[this.indexRow].projectName = rows[0].projectName
				this.inputForm.infoOthers[this.indexRow].reportNumber = rows[0].reportNumber
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgram (rows) {
				console.log('rows',rows)
				this.inputForm.infoProjects[this.indexRow].projectId = rows.map(item => { return item.id }).join(',')
				this.inputForm.infoProjects[this.indexRow].projectName = rows.map(item => { return item.name }).join(',')
				// this.inputForm.infoProjects[this.indexRow].reportNumber = rows[0].no
				this.indexRow = ''
				this.$forceUpdate()
			},
			// 报销类型下拉弹窗
			//借款
			typePullForm (rowIndex, deptName) {
				this.indexRow = rowIndex
				// this.$refs.reimbursementTypePullForm.init()
				this.$refs.cwReimbursementTypePullForm.init('1', deptName)
			},
			//付款
			typePullForm2 (rowIndex, deptName) {
				this.indexRow = rowIndex
				// this.$refs.reimbursementTypePullForm.init()
				this.$refs.cwReimbursementTypePullForm2.init('2', deptName)
			},
			//其他
			typePullForm3 (rowIndex, deptName) {
				this.indexRow = rowIndex
				// this.$refs.reimbursementTypePullForm.init()
				this.$refs.cwReimbursementTypePullForm3.init('1', deptName)
			},
			//项目
			typePullForm4 (rowIndex, deptName) {
				this.indexRow = rowIndex
				// this.$refs.reimbursementTypePullForm.init()
				this.$refs.cwReimbursementTypePullForm4.init('2', deptName)
			},
			// 报销内容详情
			getProgramForType (rows) {
				this.inputForm.infoborrows[this.indexRow].typeId = rows.id
				this.inputForm.infoborrows[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForType2 (rows) {
				this.inputForm.infoPayments[this.indexRow].typeId = rows.id
				this.inputForm.infoPayments[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForType3 (rows) {
				this.inputForm.infoOthers[this.indexRow].typeId = rows.id
				this.inputForm.infoOthers[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForType4 (rows) {
				this.inputForm.infoProjects[this.indexRow].typeId = rows.id
				this.inputForm.infoProjects[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			// 报销人下拉弹窗
			userPullListForm (rowIndex) {
				this.indexRow = rowIndex
				this.$refs.userPullForm.init()
			},
			userPullListForm2 (rowIndex) {
				this.indexRow = rowIndex
				this.$refs.userPullForm2.init()
			},
			userPullListForm3 (rowIndex) {
				this.indexRow = rowIndex
				this.$refs.userPullForm3.init()
			},
			userPullListForm4 (rowIndex) {
				this.indexRow = rowIndex
				this.$refs.userPullForm4.init()
			},
			userPullListForm5 (rowIndex) {
				this.indexRow = rowIndex
				this.$refs.userPullForm5.init()
			},
			getProgramForUser (rows) {
				this.inputForm.infoborrows[this.indexRow].userId = rows[0].id
				this.inputForm.infoborrows[this.indexRow].userName = rows[0].name
				this.inputForm.infoborrows[this.indexRow].deptId = rows[0].parentId
				this.inputForm.infoborrows[this.indexRow].deptName = rows[0].officeName
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForUser2 (rows) {
				this.inputForm.detailInfoContracts[this.indexRow].userId = rows[0].id
				this.inputForm.detailInfoContracts[this.indexRow].userName = rows[0].name
				this.inputForm.detailInfoContracts[this.indexRow].deptId = rows[0].parentId
				this.inputForm.detailInfoContracts[this.indexRow].deptName = rows[0].officeName
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForUser3 (rows) {
				this.inputForm.detailInfoReports[this.indexRow].userId = rows[0].id
				this.inputForm.detailInfoReports[this.indexRow].userName = rows[0].name
				this.inputForm.detailInfoReports[this.indexRow].deptId = rows[0].parentId
				this.inputForm.detailInfoReports[this.indexRow].deptName = rows[0].officeName
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForUser4 (rows) {
				this.inputForm.infoOthers[this.indexRow].userId = rows[0].id
				this.inputForm.infoOthers[this.indexRow].userName = rows[0].name
				this.inputForm.infoOthers[this.indexRow].deptId = rows[0].parentId
				this.inputForm.infoOthers[this.indexRow].deptName = rows[0].officeName
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForUser5 (rows) {
				this.inputForm.detailInfoProcured[this.indexRow].userId = rows[0].id
				this.inputForm.detailInfoProcured[this.indexRow].userName = rows[0].name
				this.inputForm.detailInfoProcured[this.indexRow].deptId = rows[0].parentId
				this.inputForm.detailInfoProcured[this.indexRow].deptName = rows[0].officeName
				this.indexRow = ''
				this.$forceUpdate()
			},
			getWorkClientChoose2 (list) {
				this.inputForm.detailInfoReports[this.indexRow].reportNumber = list.reportNo
				this.indexRow = ''
				this.$forceUpdate()
			},
			getContract (row, rowIndex) {
				this.inputForm.detailInfoContracts[rowIndex].contractId = row.id
				this.inputForm.detailInfoContracts[rowIndex].contractName = row.contractName
				this.$forceUpdate()
			},
			changeSourceType () {
				this.inputForm.infoborrows = []
				this.inputForm.infoPayments = []
				this.inputForm.infoOthers = []
				this.inputForm.infoProjects = []
				this.inputForm.purchaseNo = ''
				this.inputForm.preList = ''
				this.inputForm.purchaseId = ''
				this.detailKey = Math.random()
				this.detailKeyContract = Math.random()
				this.detailKeyReport = Math.random()
				this.detailKeyOthers = Math.random()
				this.detailKeyProject = Math.random()
			},
			submitCheck () {
				if (this.commonJS.isEmpty(this.inputForm.applyType)) {
					this.$message.error('请填写报销类型')
					this.loading = false
					throw new Error('请填写报销类型')
				} else {
					if (this.inputForm.applyType === '1') {
						if (this.commonJS.isEmpty(this.inputForm.infoborrows)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.infoborrows.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.infoborrows[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoborrows[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoborrows[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请选择借款信息')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择借款信息')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoborrows[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					} else if (this.inputForm.applyType === '2') {
						if (this.commonJS.isEmpty(this.inputForm.infoPayments)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.infoPayments.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.infoPayments[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoPayments[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoPayments[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请选择付款信息')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择付款信息')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoPayments[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					} else if (this.inputForm.applyType === '3') {
						if (this.commonJS.isEmpty(this.inputForm.infoOthers)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.infoOthers.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.infoOthers[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoOthers[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoOthers[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请填写报销详情')
									this.loading = false
									throw new Error('报销详情第' + k + '行请填写报销详情')
								}

								if (this.commonJS.isEmpty(this.inputForm.infoOthers[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					} else if (this.inputForm.applyType === '4') {
						if (this.commonJS.isEmpty(this.inputForm.infoProjects)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.infoProjects.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.infoProjects[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoProjects[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoProjects[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请选择项目详情')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择项目详情')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoProjects[j].reportNumber)) {
									this.$message.error('报销详情第' + k + '行请选择报告号')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报告号')
								}
								if (this.commonJS.isEmpty(this.inputForm.infoProjects[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					}
				}
			},
			openPurForm () {
				this.$refs.purchaseChooseForm.init()
			},
			startPur (id) {

				this.$forceUpdate()
			},
			getPurChoose (row) {
				this.inputForm.purchaseId = row.id
				this.startPur(row.id)
			},
			footerMethod555 ({ columns, data }) {
				const footerData = [
					columns.map((column, columnIndex) => {
						if (columnIndex === 0) {
							return '商品总价'
						}
						if (['priceSum'].includes(column.property)) {
							// eslint-disable-next-line no-undef
							this.inputForm.tradeTotalPrice = XEUtils.sum(data, column.property)
							return XEUtils.sum(data, column.property)
						}
						return null
					})
				]
				return footerData
			},
			seeFileInfo (index) {
				if (this.commonJS.isEmpty(this.inputForm.preList[index].fileInfoLost)) {
					this.inputForm.preList[index].fileInfoLost = []
				}
				// this.$refs.materialManagementDialog.newUpload('view', this.inputForm.preList[index].fileInfoLost, null, null, null, null, null, false, index)
			},
			// 查看报销项目
			viewProject (id) {
				this.$refs.projectListForm.init(id)
			}
		}
	}
</script>
