<template xmlns:v-slot="http://www.w3.org/1999/XSL/Transform">
	<div>
		<el-form size="large" :model="inputForm" ref="inputForm" v-loading="loading" :class="method==='view'?'readonly':''"  :disabled="true"
				 label-width="120px" @submit.native.prevent>

			<el-divider content-position="left"><i class="el-icon-document"></i> 基础信息</el-divider>
			<el-row >
				<el-col :span="12">
					<el-form-item hidden label="报销项" prop="reimbursementType" :disabled="status === 'audit' || status === 'taskFormDetail'"
								  :rules="[
                        {required: true, message:'报销项不能为空', trigger:'blur'}
               ]">
						<el-radio v-model="inputForm.reimbursementType" v-for="item in $dictUtils.getDictList('reimbursement_type')" :label="item.value" style="margin-right: 20px">
							{{item.label}}</el-radio>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row >
				<el-col :span="12">
					<el-form-item label="经办人" prop="userName">
						<el-input v-model="inputForm.userName" :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" placeholder="自动生成"></el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<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="reimDate" :rules="[{required: true, message:'请选择报销日期', trigger:'blur'}]">
						<el-date-picker
							placement="bottom-start"
							v-model="inputForm.reimDate"
							type="date"
							value-format="YYYY-MM-DD"
							style="width: 100%"
							placeholder="选择日期">
						</el-date-picker>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<el-col :span="12">
					<el-form-item label="报销类型" prop="sourceType"
								  :rules="[
                        {required: true, message:'请选择报销类型', trigger:'change'}
                 ]">
						<el-select v-model="inputForm.sourceType" @change="changeSourceType" placeholder="请选择报销类型" style="width:100%;">
							<el-option
								v-for="item in $dictUtils.getDictList('pg_reimbursement_source_type')"
								:key="item.value"
								:label="item.label"
								:value="item.value">
							</el-option>
						</el-select>
					</el-form-item>
				</el-col>
				<el-col :span="12">
					<el-form-item v-if="hasPermission('pg:user:payment')" label="是否付款" prop="paymentStatus">
						<el-input v-if="inputForm.paymentStatus === '1'" :disabled="true" v-model = 'payment' class="bold-red"></el-input>
						<el-input v-else v-model = 'payment' :disabled="true"></el-input>
					</el-form-item>
				</el-col>
				<el-col :span="12" v-if="inputForm.sourceType === '5'">
					<el-form-item label="采购编号" prop="purchaseNo"
								  :rules="[{required: true, message:'采购编号不能为空', trigger:'blur'},
                              {required: true, message:'采购编号不能为空', trigger:'change'}]">
						<el-input size="large" :readonly="true" @focus="openPurForm()" v-model="inputForm.purchaseNo" placeholder="请选择采购编号">
							<el-button size="default" slot="append" icon="el-icon-search" @click="openPurForm()"></el-button>
						</el-input>
					</el-form-item>
				</el-col>
			</el-row>
			<el-row>
				<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.sourceType === '5'">
				<el-divider content-position="left"><i class="el-icon-document"></i>
					采购详情
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod555"
							ref="preTable"
							class="vxe-table-element"
							:data="inputForm.preList"
							style="margin-left: 5em"
							@cell-click=""
							@edit-closed=""
							highlight-current-row
						>
							<vxe-table-column field="purchaserAgent" title="采购人" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请选择采购人', trigger:'blur'}]"></vxe-table-column>
							<vxe-table-column field="procurementOffice" title="采购部门" :edit-render="{}" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="procurementType" title="采购类型" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请选择采购类型', trigger:'blur'}]"></vxe-table-column>
							<vxe-table-column field="tradeName" title="商品名称" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请填写商品名称', trigger:'blur'}]"></vxe-table-column>
							<vxe-table-column field="tradePrice" title="商品单价(元)" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请输入商品单价', trigger:'blur'}]"></vxe-table-column>
							<vxe-table-column field="tradeNumber" title="商品数量" :edit-render="{}" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="priceSum" title="商品总价" :edit-render="{}" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="company" title="单位" :edit-render="{}" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="remarks" title="备注" :edit-render="{}" show-overflow="title"></vxe-table-column>
							<vxe-table-column title="操作">
								<template v-slot="scope">
									<el-button size="default" type="primary" :disabled="false" @click="seeFileInfo(scope.$rowIndex)">文件详情</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>

				</el-row>
			</div>
			<div v-if="(status === 'taskFormDetail') && inputForm.sourceType === '1'">
				<el-divider content-position="left"><i class="el-icon-document"></i>项目报销详情</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.detailInfos"
							style="margin-left: 5em"
						>
							<vxe-table-column field="userName" title="报销人" align="center" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" align="center" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="typeName" title="报销类别" align="center" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="projectName" title="报销项目" align="center" show-overflow="title">
								<template #default="scope">
									<el-link  type="primary" :underline="false" v-if="commonJS.isNotEmpty(scope.row.projectId)" @click="viewProject(scope.row.projectId)">{{scope.row.projectName}}</el-link>
									<span v-else>{{scope.row.projectName}}</span>
								</template>
							</vxe-table-column>
							<vxe-table-column field="reportNumber" title="报告号" align="center" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="number" title="费用(元)" align="center" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="receiptNumber" title="收据张数" align="center" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="days" title="出差天数" align="center" show-overflow="title"></vxe-table-column>
							<vxe-table-column field="content" title="内容" align="center" show-overflow="title"></vxe-table-column>
						</vxe-table>
					</el-col>

				</el-row>
			</div>
			<div v-else-if="(status !== 'taskFormDetail') && inputForm.sourceType === '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'" size="default" @click="insertEvent('detail')" 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.detailInfos"
							style="margin-left: 5em"
							@cell-click=""
							@edit-closed=""
							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="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.userName" @focus="userPullListForm(scope.$rowIndex)"></el-input>
									<!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销项目', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.projectName" @focus="openProgramPageForm(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="reportNumber" title="报告号" :edit-render="{}" show-overflow="title">
								<template #edit="scope">
									<!--                <el-input :readonly="true" v-model="scope.row.reportNumber" @focus="openReportNoPageForm(scope.$rowIndex, scope.row)"></el-input>-->
									<el-input :readonly="true" v-model="scope.row.reportNumber"></el-input>

								</template>
							</vxe-table-column>
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template #edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" @input="scope.row.number = twoDecimalPlaces(scope.row.number)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #edit="scope">
									<el-input v-model="scope.row.content" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template #default="scope">
									<el-button size="default" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'detail')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>

				</el-row>
			</div>

			<div v-if="inputForm.sourceType === '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'" size="default" @click="insertEvent('contract_detail')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod"
							ref="detailTableContract"
							:key="detailKeyContract"
							class="vxe-table-element"
							:data="inputForm.detailInfoContracts"
							style="margin-left: 5em"
							@cell-click=""
							@edit-closed=""
							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="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.userName" @focus="userPullListForm2(scope.$rowIndex)"></el-input>
									<!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
								<template #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="contractName" title="报销合同" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销合同', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.contractName" @focus="openContractForm(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<!--            <vxe-table-column field="reportNumber" title="报告号" :edit-render="{}">-->
							<!--              <template v-slot:edit="scope">-->
							<!--                <el-input :readonly="true" v-model="scope.row.reportNumber" @focus="openReportNoPageForm(scope.$rowIndex, scope.row)"></el-input>-->
							<!--              </template>-->
							<!--            </vxe-table-column>-->
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template #edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" @input="scope.row.number = twoDecimalPlaces(scope.row.number)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #edit="scope">
									<el-input v-model="scope.row.content" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template #default="scope">
									<el-button size="default" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'contract_detail')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>

				</el-row>
			</div>
			<div v-if="inputForm.sourceType === '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'" size="default" @click="insertEvent('report_detail')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod"
							ref="detailTableReport"
							:key="detailKeyReport"
							class="vxe-table-element"
							:data="inputForm.detailInfoReports"
							style="margin-left: 5em"
							@cell-click=""
							@edit-closed=""
							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="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.userName" @focus="userPullListForm3(scope.$rowIndex)"></el-input>
									<!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销项目', trigger:'blur'}]">
								<template #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="reportNumber" title="报告号" :edit-render="{}" show-overflow="title">
								<template #edit="scope">
									<el-input :readonly="true" v-model="scope.row.reportNumber" @focus="openReportNoPageForm(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template #edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" @input="scope.row.number = twoDecimalPlaces(scope.row.number)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #edit="scope">
									<el-input v-model="scope.row.content" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template #default="scope">
									<el-button size="default" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'report_detail')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>

				</el-row>
			</div>
			<div v-if="inputForm.sourceType === '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'" size="default" @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.detailInfoOthers"
							style="margin-left: 5em"
							:key="detailKeyOthers"
							@cell-click=""
							@edit-closed=""
							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="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.userName" @focus="userPullListForm4(scope.$rowIndex)"></el-input>
									<!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title" :rules="[{required: true, message:'请填写报销详情', trigger:'blur'}]">
								<template #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="reportNumber" title="报告号" :edit-render="{}">-->
							<!--              <template v-slot:edit="scope">-->
							<!--                <el-input :readonly="true" v-model="scope.row.reportNumber" @focus="openReportNoPageForm(scope.$rowIndex, scope.row)"></el-input>-->
							<!--              </template>-->
							<!--            </vxe-table-column>-->
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template #edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" @input="scope.row.number = twoDecimalPlaces(scope.row.number)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #edit="scope">
									<el-input v-model="scope.row.content" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template #default="scope">
									<el-button size="default" 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.sourceType === '5'">
				<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'" size="default" @click="insertEvent('procured')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							:footer-method="footerMethod"
							ref="detailTableProcured"
							class="vxe-table-element"
							:data="inputForm.detailInfoProcured"
							style="margin-left: 5em"
							:key="detailKeyProcured"
							@cell-click=""
							@edit-closed=""
							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="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销人', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.userName" @focus="userPullListForm5(scope.$rowIndex)"></el-input>
									<!--              <UserSelectV2 :limit='1' :userName="scope.row.userName" @getValue='(value, label) => {scope.row.userName = label}'></UserSelectV2>-->
								</template>
							</vxe-table-column>
							<vxe-table-column field="deptName" title="报销部门" :edit-render="{}" show-overflow="title">
								<template #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="typePullForm5(scope.$rowIndex, scope.row.deptId)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="projectName" title="报销项目" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请选择报销项目', trigger:'blur'}]">
								<template #edit="scope">
									<el-input v-model="scope.row.projectName" @focus="openProgramPageForm5(scope.$rowIndex, scope.row)"></el-input>
								</template>
							</vxe-table-column>
							<!--            <vxe-table-column field="reportNumber" title="报告号" :edit-render="{}">-->
							<!--              <template v-slot:edit="scope">-->
							<!--                <el-input :readonly="true" v-model="scope.row.reportNumber" @focus="openReportNoPageForm(scope.$rowIndex, scope.row)"></el-input>-->
							<!--              </template>-->
							<!--            </vxe-table-column>-->
							<vxe-table-column field="number" title="费用(元)" :edit-render="{}" show-overflow="title" :rules="[{required: true, message:'请输入费用', trigger:'blur'}]">
								<template #edit="scope">
									<el-input maxlength="15" v-model="scope.row.number" @input="scope.row.number = twoDecimalPlaces(scope.row.number)"></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="receiptNumber" title="收据张数" :edit-render="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #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="{}" show-overflow="title">
								<template #edit="scope">
									<el-input v-model="scope.row.content" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template #default="scope">
									<el-button size="default" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'procured')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>
				</el-row>
			</div>

			<div v-if="inputForm.reimbursementType === '0'">
				<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' " size="default" @click="insertEvent('amount')" plain>
						新增
					</el-button>
				</el-divider>
				<el-row  :gutter="15" >
					<el-col :span="24">
						<vxe-table
							border
							show-footer
							show-overflow
							ref="amountTable"
							class="vxe-table-element"
							:data="inputForm.amountInfos"
							style="margin-left: 5em"
							@cell-click=""
							:key="amountKey"
							@edit-closed=""
							highlight-current-row
							:edit-config="{trigger: 'click', mode: 'cell', showStatus: true, autoClear: true}"
							:edit-rules="amountInfoRules"
						>
							<vxe-table-column field="code" title="发票代码" :edit-render="{}" show-overflow="title">
								<template #edit="scope">
									<el-input oninput ="value=value.replace(/\D|^/g,'')" maxlength="30" v-model="scope.row.code" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="number" title="发票号" :edit-render="{}" show-overflow="title">
								<template #edit="scope">
									<el-input oninput ="value=value.replace(/\D|^/g,'')" maxlength="30" @change="isExict(scope.row)" v-model="scope.row.number" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column field="amount" title="金额" :edit-render="{}" show-overflow="title">
								<template #edit="scope">
									<el-input maxlength="15" v-model="scope.row.amount" @input="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="{}" show-overflow="title">
								<template #edit="scope">
									<el-input maxlength="15" v-model="scope.row.taxAmount" @input="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="{}" show-overflow="title">
								<template #edit="scope">
									<el-input disabled="true" v-model="scope.row.count" ></el-input>
								</template>
							</vxe-table-column>
							<vxe-table-column title="操作" width="100">
								<template #default="scope">
									<el-button size="default" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'amount')">删除</el-button>
								</template>
							</vxe-table-column>
						</vxe-table>
					</el-col>
				</el-row>
			</div>

<!--			<div v-if="inputForm.reimbursementType === '1'">-->
<!--				<el-divider content-position="left">数电发票信息-->
<!--					&lt;!&ndash;<el-button style="margin-left: 20px" type="primary" :disabled="method==='view' || status === 'audit' || status === 'taskFormDetail' " size="default" @click="insertEvent('invoiceReimbursement')" plain>-->
<!--						新增-->
<!--					</el-button>&ndash;&gt;-->
<!--				</el-divider>-->
<!--				<el-row  :gutter="15" >-->
<!--					<el-col :span="24">-->
<!--						<vxe-table-->
<!--							border-->
<!--							show-footer-->
<!--							show-overflow-->
<!--							ref="invoiceReimbursementTable"-->
<!--							class="vxe-table-element"-->
<!--							:data="inputForm.invoiceReimbursements"-->
<!--							:footer-method="footerMethod1111"-->
<!--							style="margin-left: 5em"-->
<!--							@cell-click=""-->
<!--							:key="invoiceReimbursementKey"-->
<!--							@edit-closed=""-->
<!--							highlight-current-row-->
<!--							:edit-config="{trigger: 'click', mode: 'row', showStatus: true, autoClear: true, icon:'_'}"-->
<!--							:edit-rules="invoiceReimbursementRules"-->
<!--						>-->
<!--							<vxe-table-column  field="invoiceType" title="发票类型" :edit-render="{name: '$select', options: $dictUtils.getDictList('invoice_reimbursement_type')}">-->
<!--								<template v-slot:edit="scope">-->
<!--									<vxe-select :disabled="true" v-model="scope.row.invoiceType" placeholder="请选择发票类型" clearable style="width: 100%;" transfer>-->
<!--										<vxe-option-->
<!--											v-for="item in $dictUtils.getDictList('invoice_reimbursement_type')"-->
<!--											:key="item.value"-->
<!--											:label="item.label"-->
<!--											:value="item.value">-->
<!--										</vxe-option>-->
<!--									</vxe-select>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							<vxe-table-column field="invoiceProjectName" title="发票项目名" :edit-render="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input maxlength="50" readonly="true" v-model="scope.row.invoiceProjectName" ></el-input>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							<vxe-table-column field="number" title="发票号" :edit-render="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input oninput ="value=value.replace(/\D|^/g,'')" readonly="true" maxlength="30" @change="isExict(scope.row)" v-model="scope.row.number" ></el-input>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							<vxe-table-column field="invoiceDate" title="开票日期" :edit-render="{}" show-overflow="title">-->
<!--								<template v-slot:edit="scope">-->
<!--									<vxe-input v-model="scope.row.invoiceDate" readonly="true" type="datetime" transfer placeholder="请选择日期"></vxe-input>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							<vxe-table-column field="invoiceUnit" title="开票单位" :edit-render="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input maxlength="50" readonly="true" v-model="scope.row.invoiceUnit" ></el-input>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							<vxe-table-column field="buyerName" title="购买方名称" :edit-render="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input maxlength="50" readonly="true" v-model="scope.row.buyerName" ></el-input>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							<vxe-table-column field="amount" title="金额" :edit-render="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input maxlength="15" readonly="true" v-model="scope.row.amount" @input="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="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input maxlength="15" readonly="true" v-model="scope.row.taxAmount" @input="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="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input disabled="true" v-model="scope.row.count" ></el-input>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							<vxe-table-column field="remarks" title="备注" :edit-render="{}" show-overflow="title">-->
<!--								<template #edit="scope">-->
<!--									<el-input maxlength="250" v-model="scope.row.remarks" ></el-input>-->
<!--								</template>-->
<!--							</vxe-table-column>-->
<!--							&lt;!&ndash;<vxe-table-column title="操作" width="100">-->
<!--								<template #default="scope">-->
<!--									<el-button size="default" type="danger" @click="removeEvent(scope.row,scope.$rowIndex,'invoiceReimbursement')">删除</el-button>-->
<!--								</template>-->
<!--							</vxe-table-column>&ndash;&gt;-->
<!--						</vxe-table>-->
<!--					</el-col>-->
<!--				</el-row>-->
<!--			</div>-->


		</el-form>
		<!-- 附件 -->

		<InvoiceReimbursementUpLoadComponent ref="invoiceReimbursementUpLoadComponent" v-show="'1' === this.inputForm.reimbursementType"></InvoiceReimbursementUpLoadComponent>
		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>
		<!--      <ProgramPageForm ref="programPageForm" @getProgram="getProgram"></ProgramPageForm>-->
		<ProgramPageForm ref="programPageForm" @getProgram="getProgram"></ProgramPageForm>
		<ProgramPageForm ref="programPageForm3" @getProgram="getProgram3"></ProgramPageForm>
		<ProgramPageForm ref="programPageForm4" @getProgram="getProgram4"></ProgramPageForm>
		<ProgramPageForm ref="programPageForm5" @getProgram="getProgram5"></ProgramPageForm>

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

		<!--      <UserPullForm ref="userPullForm" @getProgramForUser="getProgramForUser"></UserPullForm>-->
		<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>

		<WorkContractChooseCom ref="workContractChooseCom" @getContract="getContract"></WorkContractChooseCom>
<!--		<PurchaseChooseForm  ref="purchaseChooseForm" @getProject="getPurChoose"></PurchaseChooseForm>-->
<!--		<MaterialManagementDialog ref="materialManagementDialog" @getUpload="getUpload"></MaterialManagementDialog>-->
		<ProjectListForm ref="projectListForm"></ProjectListForm>
	</div>
</template>

<script>
	// import CommonApi from '@/api/cw/common/CommonApi'
	import ReimbursementApprovalTypeService from '@/api/pubmodules/ReimbursementApprovalTypeService'
	import ReimbursementService from '@/api/sys/ReimbursementService'
	import ReimbursementTypeService from '@/api/sys/ReimbursementTypeService'
	import InvoiceReimbursementUpLoadComponent from '@/views/common/DigitalInvoiceUploadComponent'
	import UpLoadComponent from '@/views/common/UpLoadComponent'
	import SelectUserTree from '@/views/utils/treeUserSelect'
	import SelectTree from '@/components/treeSelect/treeSelect.vue'
	import XEUtils from 'xe-utils'
	import userService from '@/api/sys/userService'
	import taskService from '@/api/flowable/taskService'
	import ProgramPageForm from '@/views/finance/invoice/ProgramPageForm'
	import ReimbursementTypePullForm from '@/views/common/CwReimbursementTypePullForm'
	// import CwReimbursementTypePullForm from '@/views/cw/reimbursementApproval/info/CwReimbursementTypePullForm'
	import UserPullForm from '@/views/finance/invoice/UserPullForm'
	import WorkContractChooseCom from '@/views/workContract/WorkContractChooseCom'
	import processService from '@/api/flowable/processService'
	// import PurchaseChooseForm from '@/views/materialManagement/wareHouse/PurchaseChooseForm'
	// import MaterialManagementService from '@/api/materialManagement/MaterialManagementService'
	// import MaterialManagementDialog from '@/views/materialManagement/file/MaterialManagementDialog'
	import ProjectListForm from './ProgramForm'
	export default {
		data () {
			return {
				validRules: {
					userName: [
						{required: true, message: '报销人不能为空'}
					],
					deptName: [
						{required: true, message: '报销部门不能为空'}
					],
					typeName: [
						{required: true, message: '报销类型不能为空'}
					],
					projectName: [
						{required: true, message: '报销项目不能为空'}
					],
					contractName: [
						{required: true, message: '报销合同不能为空'}
					],
					reportNumber: [
						{required: true, message: '报告号不能为空'}
					],
					number: [
						{required: true, message: '费用(元)不能为空'}
					]
				},
				amountInfoRules: {
					code: [
						{required: true, message: '发票代码不能为空'}
					],
					number: [
						{required: true, message: '发票号不能为空'}
					],
					amount: [
						{required: true, message: '金额不能为空'}
					],
					taxAmount: [
						{required: true, message: '税额不能为空'}
					]
				},
				invoiceReimbursementRules: {
					invoiceType: [
						{required: true, message: '发票类型不能为空'}
					],
					invoiceProjectName: [
						{required: true, message: '发票项目名不能为空'}
					],
					number: [
						{required: true, message: '发票号不能为空'}
					],
					invoiceDate: [
						{required: true, message: '开票日期不能为空'}
					],
					invoiceUnit: [
						{required: true, message: '开票单位不能为空'}
					],
					buyerName: [
						{required: true, message: '购买方名称不能为空'}
					],
					amount: [
						{required: true, message: '金额不能为空'}
					],
					taxAmount: [
						{required: true, message: '税额不能为空'}
					]
				},
				title: '',
				method: '',
				visible: false,
				loading: false,
				indexRow: '',
				detailKey: '',
				detailKeyContract: '',
				detailKeyReport: '',
				detailKeyOthers: '',
				detailKeyProcured: '',
				inputForm: {
					reimbursementType: '1',
					userId: '',
					userName: '',
					no: '',
					department: '',
					reimDate: '',
					remarks: '',
					detailInfos: [],
					detailInfoContracts: [],
					detailInfoReports: [],
					detailInfoOthers: [],
					detailInfoProcured: [],
					amountInfos: [],
					invoiceReimbursements: [],
					invoiceReimbursementFiles: [], // 电子发票附件信息
					files: [], // 附件信息
					procInsId: '',
					sourceType: '',
					preList: [],
					purchaseNo: '',
					tradeTotalPrice: '',
					purchaseId: '',
					procDefId: '',
					procDefKey: '',
					formTitle: '',
					departmentName: '',
					paymentStatus:'',
					createById:'',
					fileSuppleId:'' //文件补充id
				},
				keyWatch: '',
				amountKey: '',
				invoiceReimbursementKey: '',
				isZj:false,
				isDgsbxBmzr:false,
				isZjbry:false,
				isKjsz:false,
				payment:''
			}
		},

		provide() {
			return {
				getParentReimbursementType: this.getParentReimbursementType
			}
		},
		reimbursementApprovalTypeService: null,
		reimbursementService: null,
		reimbursementTypeService: null,
		// userService: null,
		// commonApi: null,
		// materialManagementService: null,
		created () {
			this.reimbursementApprovalTypeService = new ReimbursementApprovalTypeService()
			this.reimbursementService = new ReimbursementService()
			this.inputForm.userId = this.userId
			this.inputForm.userName = this.name
			this.inputForm.reimDate = new Date()
			this.inputForm.department = this.officeName
			// this.userService = new UserService()
			// this.commonApi = new CommonApi()
			this.reimbursementTypeService = new ReimbursementTypeService()
			// this.materialManagementService = new MaterialManagementService()
		},
		props: {
			businessId: {
				type: String,
				default: ''
			},
			formReadOnly: {
				type: Boolean,
				default: false
			},
			status: {
				type: String,
				default: ''
			}
		},
		components: {
			InvoiceReimbursementUpLoadComponent,
			UpLoadComponent,
			SelectUserTree,
			SelectTree,
			ProgramPageForm,
			UserPullForm,
			ReimbursementTypePullForm,
			WorkContractChooseCom,
			// PurchaseChooseForm,
			// MaterialManagementDialog,
			ProjectListForm
		},
		computed: {
			bus: {
				get () {
					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.invoiceReimbursementUpLoadComponent.changeLoading(newVal)
					this.$refs.uploadComponent.changeLoading(newVal)
				}
			}
		},
		methods: {
			getParentReimbursementType() {
				return this.inputForm.reimbursementType
			},
			getKeyWatch (keyWatch) {
				this.keyWatch = keyWatch
			},
			init (method, id) {
				this.method = method
				this.inputForm = {
					reimbursementType: '1',
					userId: '',
					userName: '',
					no: '',
					department: '',
					reimDate: '',
					remarks: '',
					detailInfos: [],
					detailInfoContracts: [],
					detailInfoReports: [],
					detailInfoOthers: [],
					detailInfoProcured: [],
					amountInfos: [],
					invoiceReimbursements: [],
					invoiceReimbursementFiles: [], // 电子发票附件信息
					files: [], // 附件信息
					procInsId: '',
					sourceType: '',
					preList: [],
					purchaseNo: '',
					tradeTotalPrice: '',
					purchaseId: '',
					departmentName: '',
					paymentStatus:'',
					createById:'',
					procInsIdFile: '',
					fileSuppleId:'' //文件补充id
				}
				this.inputForm.id = id
				this.visible = true
				this.loading = false
				this.$nextTick(() => {
					this.loading = true
					this.$refs.inputForm.resetFields()
					this.reimbursementService.findFileById(this.inputForm.id).then((data) => {
						this.inputForm = this.recover(this.inputForm, data)
						this.inputForm = JSON.parse(JSON.stringify(this.inputForm))
						this.$refs.invoiceReimbursementUpLoadComponent.clearUpload()
						this.$refs.uploadComponent.clearUpload()
						// if (this.status === 'audit' || this.status === 'taskFormDetail') {
						// 	method = 'view'
						// }
						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.userName)) {
							this.inputForm.userName = this.$store.state.user.name
						}
						if (this.commonJS.isEmpty(this.inputForm.reimDate)) {
							this.inputForm.reimDate = new Date()
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursementFiles)) {
							this.inputForm.invoiceReimbursementFiles = []
						}
						if (this.commonJS.isEmpty(this.inputForm.files)) {
							this.inputForm.files = []
						}
						this.inputForm.reimbursementType = '1'

						if (this.commonJS.isNotEmpty(this.inputForm.paymentStatus) && this.inputForm.paymentStatus === '1'){
							this.payment = '已付款'
						}else {
							this.payment = '未付款'
						}
						taskService.getTaskNameByProcInsId(this.inputForm.procInsIdFile).then((data) => {
							if (this.commonJS.isNotEmpty(data)) {
								if ((data === '报销人审核'|| data === '报销人调整') && this.status != 'taskFormDetail') {
									method = 'add'
								}else {
									method = 'view'
								}
							}else {
								method = 'view'
							}
							this.$refs.invoiceReimbursementUpLoadComponent.newUpload(method, this.inputForm.invoiceReimbursementFiles, 'reimbursement_ping_gu',300,'数电发票信息',null,null,null,'江苏兴光资产评估有限公司')
							this.$refs.uploadComponent.newUpload(method, this.inputForm.files, 'reimbursement_ping_gu')
						})
						if (this.commonJS.isNotEmpty(this.inputForm.purchaseId)) {
							// this.startPur(this.inputForm.purchaseId)
						}
						this.loading = false
					})
					if (method !== 'edit' && method !== 'view') {
						this.$refs.invoiceReimbursementUpLoadComponent.newUpload(method, [], 'reimbursement_ping_gu')
						this.$refs.uploadComponent.newUpload(method, [], 'reimbursement_ping_gu')
					}
					userService.isZj().then((data)=>{
						this.isZj = data
					})
					userService.isDgsbxBmzr().then((data)=>{
						this.isDgsbxBmzr = data
					})
					userService.isZjbry().then((data)=>{
						this.isZjbry = data
					})
					userService.isKjsz().then((data)=>{
						this.isKjsz = data
					})
				})
			},
			reapplyForm (callback) {
				this.loading = true
				this.reimbursementService.findFileById(this.inputForm.fileSuppleId).then((data) => {
					if (data.fileStatus !== '4') { // 审核状态不是“驳回”，就弹出提示
						this.loading = false
						this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
					} else {
						this.startFormTrue(callback)
					}
				})
			},
			// 表单提交
			doSubmit () {
				this.$refs['inputForm'].validate((valid) => {
					if (valid) {
						this.loading = true
						if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
							this.loading = false
							return
						}
						if (this.$refs.uploadComponent.checkProgress()) {
							this.loading = false
							return
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursementFiles)) {
							this.inputForm.invoiceReimbursementFiles = []
						}
						if (this.commonJS.isEmpty(this.inputForm.files)) {
							this.inputForm.files = []
						}
						this.dataFiltering()
						this.inputForm.id = this.businessId
						this.inputForm.invoiceReimbursementFiles = this.$refs.invoiceReimbursementUpLoadComponent.getDataList()
						this.inputForm.files = this.$refs.uploadComponent.getDataList()
						this.reimbursementService.save(this.inputForm).then((data) => {
							this.close()
							this.$message.success(data)
							this.$emit('refreshDataList')
							this.loading = false
						}).catch(() => {
							this.loading = false
						})
					}
				})
			},
			//数据过滤
			dataFiltering(){
				if (this.commonJS.isNotEmpty(this.inputForm.amountInfos) && "0" === this.inputForm.reimbursementType) {
					let i = this.inputForm.amountInfos.length
					for (let j = 0; j < i; j++) {
						let k = j + 1
						if (this.commonJS.isEmpty(this.inputForm.amountInfos[j].code)) {
							this.$message.error('专用发票信息 第' + k + '行请填写发票代码')
							this.loading = false
							throw new Error('专用发票信息 第' + k + '行请填写发票代码')
						}
						if (this.commonJS.isEmpty(this.inputForm.amountInfos[j].number)) {
							this.$message.error('专用发票信息 第' + k + '行请填写发票号')
							this.loading = false
							throw new Error('专用发票信息 第' + k + '行请填写发票号')
						}
						if (this.commonJS.isEmpty(this.inputForm.amountInfos[j].amount)) {
							this.$message.error('专用发票信息 第' + k + '行请填写金额')
							this.loading = false
							throw new Error('专用发票信息 第' + k + '行请填写金额')
						}
						if (this.commonJS.isEmpty(this.inputForm.amountInfos[j].taxAmount)) {
							this.$message.error('专用发票信息 第' + k + '行请填写税额')
							this.loading = false
							throw new Error('专用发票信息 第' + k + '行请填写税额')
						}
					}
				}
				if (this.commonJS.isNotEmpty(this.inputForm.invoiceReimbursements) && "1" === this.inputForm.reimbursementType) {
					let i = this.inputForm.invoiceReimbursements.length
					for (let j = 0; j < i; j++) {
						let k = j + 1
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].invoiceType)) {
							this.$message.error('数电发票信息 第' + k + '行请选择发票类型')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请选择发票类型')
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].invoiceProjectName)) {
							this.$message.error('数电发票信息 第' + k + '行请填写发票项目名')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请填写发票项目名')
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].number)) {
							this.$message.error('数电发票信息 第' + k + '行请填写发票号')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请填写发票号')
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].invoiceDate)) {
							this.$message.error('数电发票信息 第' + k + '行请填写发票日期')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请填写发票日期')
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].invoiceUnit)) {
							this.$message.error('数电发票信息 第' + k + '行请填写发票单位')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请填写发票单位')
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].buyerName)) {
							this.$message.error('数电发票信息 第' + k + '行请填写购买方名称')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请填写购买方名称')
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].amount)) {
							this.$message.error('数电发票信息 第' + k + '行请填写金额')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请填写金额')
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements[j].taxAmount)) {
							this.$message.error('数电发票信息 第' + k + '行请填写税额')
							this.loading = false
							throw new Error('数电发票信息 第' + k + '行请填写税额')
						}

					}
				}
			},
			close () {
				this.inputForm.detailInfos = []
				this.inputForm.detailInfoContracts = []
				this.inputForm.detailInfoReports = []
				this.inputForm.detailInfoOthers = []
				this.inputForm.detailInfoProcured = []
				this.inputForm.purchaseNo = ''
				this.inputForm.preList = ''
				this.inputForm.purchaseId = ''
				this.$refs.inputForm.resetFields()
				this.inputForm.amountInfos = []
				this.inputForm.invoiceReimbursements = []
				this.$refs.invoiceReimbursementUpLoadComponent.clearUpload()
				this.$refs.uploadComponent.clearUpload()
				this.visible = false
			},
			// 删除
			removeEvent (row, rowIndex, type) {
				if (type === 'detail') {
					this.$refs.detailTable.remove(row)
					this.inputForm.detailInfos.splice(rowIndex, 1)
				}
				if (type === 'amount') {
					this.$refs.amountTable.remove(row)
					this.inputForm.amountInfos.splice(rowIndex, 1)
				}
				if (type === 'invoiceReimbursement') {
					this.$refs.invoiceReimbursementTable.remove(row)
					this.inputForm.invoiceReimbursements.splice(rowIndex, 1)
				}
				if (type === 'contract_detail') {
					this.$refs.detailTableContract.remove(row)
					this.inputForm.detailInfoContracts.splice(rowIndex, 1)
				}
				if (type === 'report_detail') {
					this.$refs.detailTableReport.remove(row)
					this.inputForm.detailInfoReports.splice(rowIndex, 1)
				}
				if (type === 'others') {
					this.$refs.detailTableOthers.remove(row)
					this.inputForm.detailInfoOthers.splice(rowIndex, 1)
				}
				if (type === 'procured') {
					this.$refs.detailTableProcured.remove(row)
					this.inputForm.detailInfoProcured.splice(rowIndex, 1)
				}
			},
			// 新增
			insertEvent (type) {
				if (type === 'detail') {
					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.detailInfos)) {
						this.inputForm.detailInfos = []
					}
					this.$refs.detailTable.insertAt(d)
					this.inputForm.detailInfos.push(d)
					this.detailKey = 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()
				}
				if (type === 'invoiceReimbursement') {
					let d = {}
					if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements)) {
						this.inputForm.invoiceReimbursements = []
					}
					this.$refs.invoiceReimbursementTable.insertAt(d)
					this.inputForm.invoiceReimbursements.push(d)
					this.invoiceReimbursementKey = Math.random()
				}
				if (type === 'contract_detail') {
					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.detailInfoContracts)) {
						this.inputForm.detailInfoContracts = []
					}
					this.$refs.detailTableContract.insertAt(d)
					this.inputForm.detailInfoContracts.push(d)
					this.detailKeyContract = Math.random()
				}
				if (type === 'report_detail') {
					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.detailInfoReports)) {
						this.inputForm.detailInfoReports = []
					}
					this.$refs.detailTableReport.insertAt(d)
					this.inputForm.detailInfoReports.push(d)
					this.detailKeyReport = 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.detailInfoOthers)) {
						this.inputForm.detailInfoOthers = []
					}
					this.$refs.detailTableOthers.insertAt(d)
					this.inputForm.detailInfoOthers.push(d)
					this.detailKeyOthers = Math.random()
				}
				if (type === 'procured') {
					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.detailInfoProcured)) {
						this.inputForm.detailInfoProcured = []
					}
					this.$refs.detailTableProcured.insertAt(d)
					this.inputForm.detailInfoProcured.push(d)
					this.detailKeyProcured = Math.random()
				}
			},
			insertInvoiceReimbursementEvent (type,value) {
				if (type === 'invoiceReimbursement') {
					if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursements)) {
						this.inputForm.invoiceReimbursements = []
					}
					this.$refs.invoiceReimbursementTable.insertAt(value)
					this.inputForm.invoiceReimbursements.push(value)
					this.invoiceReimbursementKey = Math.random()
				}
			},
			// 暂存
			async saveForm (callback) {
				this.loading = true
				if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
					this.loading = false
					return
				}
				if (this.$refs.uploadComponent.checkProgress()) {
					this.loading = false
					return
				}
				if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursementFiles)) {
					this.inputForm.invoiceReimbursementFiles = []
				}
				if (this.commonJS.isEmpty(this.inputForm.files)) {
					this.inputForm.files = []
				}
				this.inputForm.invoiceReimbursementFiles = this.$refs.invoiceReimbursementUpLoadComponent.getDataList()
				this.inputForm.files = this.$refs.uploadComponent.getDataList()
				this.inputForm.type = '1'
				this.reimbursementService.save(this.inputForm).then((data) => {
					callback()
					this.$refs.inputForm.resetFields()
					this.loading = false
				}).catch(() => {
					this.$refs.inputForm.resetFields()
					this.loading = false
				})
			},
			startForm (callback) {
				this.loading = true
				if (this.commonJS.isNotEmpty(this.inputForm.fileSuppleId)) {
					this.reimbursementService.findFileById(this.inputForm.fileSuppleId).then((data) => {
						if (data.fileStatus !== '0' && data.fileStatus !== '1' && data.fileStatus !== '3') { // 审核状态不是“未发起”或“暂存”或“撤回”，就弹出提示
							this.loading = false
							this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
							throw new Error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						} else {
							this.startFormTrue(callback)
						}
					})
				} else {
					this.startFormTrue(callback)
				}
			},
			// 送审
			async startFormTrue (callback) {

				let title = `发起流程【评估-报销文件补充】`
				let describe = `[评估-报销文件补充]`
				this.$refs['inputForm'].validate(async (valid) => {
					if (valid) {
						this.loading = true
						this.submitCheck()
						if (this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
							this.loading = false
							return
						}
						if (this.$refs.uploadComponent.checkProgress()) {
							this.loading = false
							return
						}
						if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursementFiles)) {
							this.inputForm.invoiceReimbursementFiles = []
						}
						if (this.commonJS.isEmpty(this.inputForm.files)) {
							this.inputForm.files = []
						}
						// if (this.commonJS.isEmpty(this.inputForm.amountInfos)) {
						//   this.$message.error('至少填写一条专用发票信息')
						//   this.loading = false
						//   return
						// }


						this.inputForm.invoiceReimbursementFiles = this.$refs.invoiceReimbursementUpLoadComponent.getDataList()
						this.inputForm.files = this.$refs.uploadComponent.getDataList()

						// this.dataFiltering()
						// if(this.inputForm.invoiceReimbursementFiles<=0 && "1" === this.inputForm.reimbursementType){
						// 	this.$message.error("请上传数电发票发票xml文件!")
						// 	this.loading = false
						// 	throw new Error("已填写数电发票信息，请上传对应发票的xml文件!")
						// }
						//判定附件中xml文件数量是否小于电子发票报销行数量
						// if (this.commonJS.isNotEmpty(this.inputForm.invoiceReimbursements) && "1" === this.inputForm.reimbursementType) {
						// 	//获取电子报销行数
						// 	let invoiceReimbursementCount = this.inputForm.invoiceReimbursements.length
						// 	if(invoiceReimbursementCount>0){
						// 		//获取附件信息以xml结尾的附件数量
						// 		var flag = false;
						// 		var countFlag = 0;
						//
						// 		for (var i=0; i<this.inputForm.invoiceReimbursementFiles.length; i++){
						// 			//如果文件以xml文件结尾，则需要将该文件上传到后台进行数据处理后返回数据
						// 			const spliceLength2 = this.inputForm.invoiceReimbursementFiles[i].name.lastIndexOf(".");
						// 			var fileNameSuffix = this.inputForm.invoiceReimbursementFiles[i].name.slice(spliceLength2 + 1);
						// 			if(fileNameSuffix === "xml" ) {
						// 				flag = true;
						// 				countFlag ++;
						// 			}
						// 		}
						// 		if(!flag){
						// 			this.$message.error("已填写数电发票信息，请上传对应发票的xml文件!")
						// 			this.loading = false
						// 			throw new Error("已填写数电发票信息，请上传对应发票的xml文件!")
						// 		}
						// 	}
						// }

						this.inputForm.fileStatus = '2'
						this.inputForm.assignee = this.inputForm.createById
						this.reimbursementService.saveFile(this.inputForm).then((data) => {
							this.inputForm.id = data.businessId
							this.inputForm.title = `${this.$store.state.user.name} 发起了${data.name} 的 [${data.no}] - ` + describe
							this.inputForm.formTitle = title
							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
				// await this.reimbursementService.findFileById(this.inputForm.fileSuppleId).then((data) => {
				// 	if (data.fileStatus !== '2') { // status的值不等于“审核中”，就弹出提示
				// 		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.invoiceReimbursementUpLoadComponent.checkProgress()) {
									this.loading = false
									return
								}
								if (this.$refs.uploadComponent.checkProgress()) {
									this.loading = false
									return
								}
								if (this.commonJS.isEmpty(this.inputForm.invoiceReimbursementFiles)) {
									this.inputForm.invoiceReimbursementFiles = []
								}
								if (this.commonJS.isEmpty(this.inputForm.files)) {
									this.inputForm.files = []
								}
								this.inputForm.invoiceReimbursementFiles = this.$refs.invoiceReimbursementUpLoadComponent.getDataList()
								this.inputForm.files = this.$refs.uploadComponent.getDataList()
								// if(this.inputForm.invoiceReimbursementFiles<=0){
								// 	this.$message.error("请上传数电发票发票xml文件!")
								// 	this.loading = false
								// 	throw new Error("已填写数电发票信息，请上传对应发票的xml文件!")
								// }
								// this.dataFiltering()
								this.inputForm.fileStatus = '2'
								taskService.getTaskNameByProcInsId(this.inputForm.procInsIdFile).then((data) => {
									if (this.commonJS.isNotEmpty(data)) {
										if (data === '财务审核') {
											this.inputForm.fileStatus = '5'
										}
									}
									this.reimbursementService.saveFile(this.inputForm).then((data) => {
										callback(data.businessTable, data.businessId, this.inputForm)
										this.loading = false
									}).catch(() => {
										this.loading = false
									})
								})
							}
						})
				// 	}
				// })
			},
			async updateStatusById (type, callback) {
				this.loading = true
				if (await this.$refs.invoiceReimbursementUpLoadComponent.checkProgress()) {
					this.loading = false
					throw new Error()
				}
				if (await this.$refs.uploadComponent.checkProgress()) {
					this.loading = false
					throw new Error()
				} else {
					if (type === 'reject' || type === 'reback') {
						// this.reimbursementService.findFileById(this.inputForm.fileSuppleId).then((data) => {
						// 	if (data.fileStatus !== '2') { // status的值不等于“审核中”，就弹出提示
						// 		this.loading = false
						// 		this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
						// 		throw new Error()
						// 	} else {
								if (type === 'reject') {
									// 驳回
									this.inputForm.fileStatus = '4'
									taskService.getTaskNameByProcInsId(this.inputForm.procInsIdFile).then((data) => {
										if (this.commonJS.isNotEmpty(data)) {
											if (data === '财务审核') {
												console.log('this.inputForm.userId', this.inputForm.userId)
												this.inputForm.assignee = this.inputForm.userId
											}
										}
										this.reimbursementService.updateFileStatusById(this.inputForm).then(() => {
											this.loading = false
											callback(this.inputForm.assignee)
										})
									})
								}
								if (type === 'reback') {
									// 撤回
									this.inputForm.fileStatus = '3'
									this.reimbursementService.updateFileStatusById(this.inputForm).then(() => {
										this.loading = false
										callback()
									})
								}
						// 	}
						// })
					} else if (type === 'hold') {
						this.reimbursementService.findFileById(this.inputForm.fileSuppleId).then((data) => {
							if (data.fileStatus !== '4') { // status的值不等于“驳回”就弹出提示
								this.loading = false
								this.$message.error('任务数据已发生改变或不存在，请在待办任务中确认此任务是否存在')
								throw new Error()
							} else {
								// 终止
								let param = {fileStatus: '1', fileSuppleId: this.inputForm.fileSuppleId}
								this.reimbursementService.updateFileStatusById(param).then(() => {
									this.loading = false
									callback()
								})
							}
						})
					}
				}
			},
			// 修改状态
			// updateStatusById (type) {
			//   if (type === 'reject') {
			//     this.inputForm.type = '4'
			//     this.reimbursementService.updateStatusById(this.inputForm)
			//   }
			// },
			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
			},
			twoDecimalPlaces (num) {
				let str = num.toString()
				str=str.replace(/\s+/g,"");
				var len1 = str.substr(0, 1)
				var len2 = str.substr(1, 1)
				// eslint-disable-next-line eqeqeq
				if (str.length > 1 && len1 == 0 && len2 != '.') {
					str = str.substr(1, 1)
				}
				// eslint-disable-next-line eqeqeq
				if (len1 == '.') {
					str = ''
				}
				// eslint-disable-next-line eqeqeq
				if (str.indexOf('.') != -1) {
					var str_ = str.substr(str.indexOf('.') + 1)
					// eslint-disable-next-line eqeqeq
					if (str_.indexOf('.') != -1) {
						str = str.substr(0, str.indexOf('.') + str_.indexOf('.') + 1)
					}
					if (str_.length > 2) {
						this.$message.warning(`金额小数点后只能输入两位，请正确输入！`)
						return (str = '')
					}
				}
				// eslint-disable-next-line no-useless-escape
				str = str.replace(/[^\d^\.]+/g, '') // 保留数字和小数点
				return str
			},
			isExict (row) {
				this.reimbursementService.checkNumber(row.number).then((data) => {
					if (data) {
						this.$message.error('该发票号已存在')
						row.number = ''
					}
				})
				if (this.commonJS.isNotEmpty(this.inputForm.reimbursementType) && "1" === this.inputForm.reimbursementType) {
					var invoiceReimbursements = this.inputForm.invoiceReimbursements;
					//创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
					if(!invoiceReimbursements) {
						invoiceReimbursements = [];
					}
					var count = 0;
					for (var i=0;i<invoiceReimbursements.length;i++){
						var item = invoiceReimbursements[i];
						if(item.number === row.number) {
							count ++;
							if(count === 2){
								this.$message.error('数电发票号：' + row.number + ' 已存在')
								row.number = ''
								throw new 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)
			},
			// openProgramPageForm (rowIndex, row) {
			//   if (this.commonJS.isEmpty(row.typeName)) {
			//     this.$message.error('请选择报销类型')
			//     return
			//   }
			//   this.indexRow = rowIndex
			//   this.reimbursementApprovalTypeService.findById(row.typeId).then((data) => {
			//     let i = data.sort.toString()
			//     i = i.substring(0, 1)
			//     // 非业务报销
			//     if (i !== '1') {
			//       this.$refs.programPageForm.init('2', false)
			//     } else {
			//       // 打开单选组件
			//       this.$refs.programPageForm.init(null, false)
			//     }
			//   })
			// },
			openProgramPageForm (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类型')
					return
				}
				this.indexRow = rowIndex
				this.reimbursementApprovalTypeService.findById(row.typeId).then((data) => {
					let i = data.sort.toString()
					i = i.substring(0, 1)
					// 非业务报销
					if (i !== '1') {
						this.$refs.programPageForm.init('2', false)
					} else {
						// 打开单选组件
						this.$refs.programPageForm.init('1', true)
					}
				})
			},
			openProgramPageForm3 (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类型')
					return
				}
				this.indexRow = rowIndex
				this.reimbursementApprovalTypeService.findById(row.typeId).then((data) => {
					let i = data.sort.toString()
					i = i.substring(0, 1)
					// 非业务报销
					if (i !== '1') {
						this.$refs.programPageForm3.init('2', false)
					} else {
						// 打开单选组件
						this.$refs.programPageForm3.init('1', false)
					}
				})
			},
			openProgramPageForm4 (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类型')
					return
				}
				this.indexRow = rowIndex
				this.$refs.programPageForm4.init('2', false)
			},
			openProgramPageForm5 (rowIndex, row) {
				if (this.commonJS.isEmpty(row.typeName)) {
					this.$message.error('请选择报销类型')
					return
				}
				this.indexRow = rowIndex
				this.$refs.programPageForm5.init('2', false)
			},
			// getProgram (rows) {
			//   this.inputForm.detailInfos[this.indexRow].projectId = rows[0].id
			//   this.inputForm.detailInfos[this.indexRow].projectName = rows[0].name
			//   this.inputForm.detailInfos[this.indexRow].reportNumber = rows[0].reportNo
			//   this.indexRow = ''
			//   this.$forceUpdate()
			// },
			getProgram (rows) {
				if (this.commonJS.isNotEmpty(rows)) {
					this.inputForm.detailInfos[this.indexRow].projectId = rows.map(item => { return item.id }).join(',')
					this.inputForm.detailInfos[this.indexRow].projectName = rows.map(item => { return item.name }).join(',')
					this.inputForm.detailInfos[this.indexRow].reportNumber = rows.map(item => { return item.reportNo }).join(',')
				}
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgram3 (rows) {
				this.inputForm.detailInfoReports[this.indexRow].projectId = rows[0].id
				this.inputForm.detailInfoReports[this.indexRow].projectName = rows[0].name
				this.inputForm.detailInfoReports[this.indexRow].reportNumber = rows[0].reportNo
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgram4 (rows) {
				this.inputForm.detailInfoOthers[this.indexRow].projectId = rows[0].id
				this.inputForm.detailInfoOthers[this.indexRow].projectName = rows[0].name
				this.inputForm.detailInfoOthers[this.indexRow].reportNumber = rows[0].reportNo
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgram5 (rows) {
				this.inputForm.detailInfoProcured[this.indexRow].projectId = rows[0].id
				this.inputForm.detailInfoProcured[this.indexRow].projectName = rows[0].name
				this.inputForm.detailInfoProcured[this.indexRow].reportNumber = rows[0].reportNo
				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.cwReimbursementTypePullForm2.init('2', deptName)
			},
			typePullForm3 (rowIndex, deptName) {
				this.indexRow = rowIndex
				this.$refs.cwReimbursementTypePullForm3.init('1', deptName)
			},
			typePullForm4 (rowIndex, deptName) {
				this.indexRow = rowIndex
				this.$refs.cwReimbursementTypePullForm4.init('2', deptName)
			},
			typePullForm5 (rowIndex, deptName) {
				this.indexRow = rowIndex
				this.$refs.cwReimbursementTypePullForm5.init('2', deptName)
			},
			// 报销内容详情
			getProgramForType (rows) {
				this.inputForm.detailInfos[this.indexRow].typeId = rows.id
				this.inputForm.detailInfos[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForType2 (rows) {
				this.inputForm.detailInfoContracts[this.indexRow].typeId = rows.id
				this.inputForm.detailInfoContracts[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForType3 (rows) {
				this.inputForm.detailInfoReports[this.indexRow].typeId = rows.id
				this.inputForm.detailInfoReports[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForType4 (rows) {
				this.inputForm.detailInfoOthers[this.indexRow].typeId = rows.id
				this.inputForm.detailInfoOthers[this.indexRow].typeName = rows.name
				this.indexRow = ''
				this.$forceUpdate()
			},
			getProgramForType5 (rows) {
				this.inputForm.detailInfoProcured[this.indexRow].typeId = rows.id
				this.inputForm.detailInfoProcured[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.detailInfos[this.indexRow].userId = rows[0].id
				this.inputForm.detailInfos[this.indexRow].userName = rows[0].name
				this.inputForm.detailInfos[this.indexRow].deptId = rows[0].parentId
				this.inputForm.detailInfos[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.detailInfoOthers[this.indexRow].userId = rows[0].id
				this.inputForm.detailInfoOthers[this.indexRow].userName = rows[0].name
				this.inputForm.detailInfoOthers[this.indexRow].deptId = rows[0].parentId
				this.inputForm.detailInfoOthers[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()
			},
			// 报销类型change事件
			changeSourceType () {
				this.inputForm.detailInfos = []
				this.inputForm.detailInfoContracts = []
				this.inputForm.detailInfoReports = []
				this.inputForm.detailInfoOthers = []
				this.inputForm.detailInfoProcured = []
				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.detailKeyProcured = Math.random()
			},
			openContractForm (rowIndex, row) {
				this.$refs.workContractChooseCom.init(rowIndex)
			},
			getContract (row, rowIndex) {
				this.inputForm.detailInfoContracts[rowIndex].contractId = row.id
				this.inputForm.detailInfoContracts[rowIndex].contractName = row.name
				this.$forceUpdate()
			},
			startPur (id) {
				this.materialManagementService.findById(id).then((data) => {
					this.inputForm.preList = data.detailInfos
					this.inputForm.purchaseNo = data.purchaseNo
					let i = this.inputForm.preList.length
					for (let j = 0; j < i; j++) {
						if (this.commonJS.isNotEmpty(this.inputForm.preList[j].tradePrice)) {
							if (this.commonJS.isNotEmpty(this.inputForm.preList[j].tradeNumber)) {
								this.inputForm.preList[j].priceSum = this.inputForm.preList[j].tradePrice * this.inputForm.preList[j].tradeNumber
							}
						}
					}
				})
				this.$forceUpdate()
			},
			openPurForm () {
				this.$refs.purchaseChooseForm.init()
			},
			getPurChoose (row) {
				this.inputForm.purchaseId = row.id
				this.startPur(row.id)
			},
			getUpload () {
			},
			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)
			},
			submitCheck () {
				if (this.commonJS.isEmpty(this.inputForm.sourceType)) {
					this.$message.error('请填写报销类型')
					this.loading = false
					throw new Error('请填写报销类型')
				} else {
					if (this.inputForm.sourceType === '1') {
						if (this.commonJS.isEmpty(this.inputForm.detailInfos)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.detailInfos.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请选择报销项目')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销项目')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfos[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					} else if (this.inputForm.sourceType === '2') {
						if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.detailInfoContracts.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].contractName)) {
									this.$message.error('报销详情第' + k + '行请选择报销合同')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销合同')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoContracts[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					} else if (this.inputForm.sourceType === '3') {
						if (this.commonJS.isEmpty(this.inputForm.detailInfoReports)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.detailInfoReports.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请选择报销项目')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销项目')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].reportNumber)) {
									this.$message.error('报销详情第' + k + '行请选择报告号')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报告号')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoReports[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					} else if (this.inputForm.sourceType === '4') {
						if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.detailInfoOthers.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请填写报销详情')
									this.loading = false
									throw new Error('报销详情第' + k + '行请填写报销详情')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoOthers[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					} else if (this.inputForm.sourceType === '5') {
						if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured)) {
							this.$message.error('至少填写一条报销详情信息')
							this.loading = false
							throw new Error('至少填写一条报销详情信息')
						} else {
							let i = this.inputForm.detailInfoProcured.length
							for (let j = 0; j < i; j++) {
								let k = j + 1
								if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].userName)) {
									this.$message.error('报销详情第' + k + '行请选择报销人')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销人')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].typeName)) {
									this.$message.error('报销详情第' + k + '行请选择报销类型')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销类型')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].projectName)) {
									this.$message.error('报销详情第' + k + '行请选择报销项目')
									this.loading = false
									throw new Error('报销详情第' + k + '行请选择报销项目')
								}
								if (this.commonJS.isEmpty(this.inputForm.detailInfoProcured[j].number)) {
									this.$message.error('报销详情第' + k + '行请输入费用')
									this.loading = false
									throw new Error('报销详情第' + k + '行请输入费用')
								}
							}
						}
					}
				}
			},
			// 查看报销项目
			viewProject (id) {
				this.$refs.projectListForm.init(id)
			},
			invoiceReimbursementDisposeData: function (data,file) {
				var invoiceReimbursements = this.inputForm.invoiceReimbursements;
					//创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
					var includeFlag = false;
					if(!invoiceReimbursements) {
						invoiceReimbursements = [];
					}
					this.reimbursementService.getEffectiveDataByInvoiceNumber(data.InvoiceNumber,this.inputForm.id).then((decide) => {
						if(!decide.success){
							//删除上传的附件信息
							this.$refs.invoiceReimbursementUpLoadComponent.parentDeleteById(file)
							//进行提醒
							this.$message.warning(decide.message)
						}else{
							invoiceReimbursements.forEach(item => {
								if(item.number === data.InvoiceNumber) {
									includeFlag = true;
									item.invoiceType = data.InherentLabelGeneralOrSpecialVATLabelCode;
									item.invoiceProjectName = data.IssuItemInformationItemName;
									item.number = data.InvoiceNumber;
									item.invoiceDate = data.IssueTime;
									item.invoiceUnit = data.SellerInformationSellerName;
									item.amount = data.BasicInformationTotalAmWithoutTax;
									item.taxAmount = data.BasicInformationTotalTaxAm;
									item.count = data.BasicInformationTotalTaxincludedAmount;
									item.buyerName = data.BuyerInformationBuyerName;
								}
							})
							//列表中未查到相同发票号
							if(!includeFlag){
								let value = {
									invoiceType: data.InherentLabelGeneralOrSpecialVATLabelCode,
									invoiceProjectName: data.IssuItemInformationItemName,
									number: data.InvoiceNumber,
									invoiceDate: data.IssueTime,
									invoiceUnit: data.SellerInformationSellerName,
									amount: data.BasicInformationTotalAmWithoutTax,
									taxAmount: data.BasicInformationTotalTaxAm,
									count: data.BasicInformationTotalTaxincludedAmount,
									buyerName: data.BuyerInformationBuyerName,
									remarks: ''
								}
								this.insertInvoiceReimbursementEvent('invoiceReimbursement',value)
							}
						}

					}).catch(() => {
						this.$refs.inputForm.resetFields()
						this.loading = false
					})

			},
			invoiceReimbursementDispose: function (data) {
				var invoiceReimbursements = this.inputForm.invoiceReimbursements;
				//创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
				var includeFlag = false;
				if(!invoiceReimbursements) {
					invoiceReimbursements = [];
				}

				invoiceReimbursements.forEach(item => {
					if(item.number === data.InvoiceNumber) {
						includeFlag = true;
					}
				})
				return includeFlag;
			},
			deleteInvoiceReimbursementDisposeData: function (data) {
				var invoiceReimbursements = this.inputForm.invoiceReimbursements;
					//创建判断值，若行信息存在相同的发票号，则进行数据检查调整，若不存在发票号，则新增行，并将信息写入
					if(!invoiceReimbursements) {
						invoiceReimbursements = [];
					}

					for (var i=0;i<invoiceReimbursements.length;i++){
						var item = invoiceReimbursements[i];
						if(item.number === data.InvoiceNumber) {
							this.removeEvent(item,i,'invoiceReimbursement')
						}
						if(this.inputForm.id && item.number){
							//根据电子发票号和报销表id去删除数据库中存在的数据
							this.reimbursementService.deleteByIdAndNumber(this.inputForm.id,data.InvoiceNumber).then((data) => {
								if(!data.success){
									this.$message.error(data.message)
								}
							})
						}
					}

			},
			footerMethod1111 ({ columns, data }) {
				const footerData = [
					columns.map((column, columnIndex) => {
						if (columnIndex === 0) {
							return '汇总'
						}
						if (['amount'].includes(column.property)) {
							// eslint-disable-next-line no-undef
							return XEUtils.sum(data, column.property)
						}
						if (['taxAmount'].includes(column.property)) {
							// eslint-disable-next-line no-undef
							return XEUtils.sum(data, column.property)
						}
						if (['count'].includes(column.property)) {
							// eslint-disable-next-line no-undef
							return XEUtils.sum(data, column.property)
						}
						return null
					})
				]
				return footerData
			},
		}
	}
</script>

<style scoped>
	/deep/ .el-input-number .el-input__inner {
		text-align: left;
	}
	.bold-red >>> .el-input__inner {
		-webkit-text-fill-color: #ff0000 !important;
		font-weight: bolder;
		text-align: left;
	}
</style>
