<template>
	<div class="page">
		<el-form :inline="true" class="query-form" ref="searchForm" :model="searchForm"
			@keyup.enter.native="refreshList()" @submit.native.prevent>
			<!-- 搜索框-->
			<el-form-item label="项目名称" prop="name">
				<el-input v-model="searchForm.name" placeholder="请输入项目名称" clearable></el-input>
			</el-form-item>
			<el-form-item label="项目编号" prop="no">
				<el-input v-model="searchForm.no" placeholder="请输入项目编号" clearable></el-input>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="报告号" prop="reportNo">
				<el-input v-model="searchForm.reportNo" placeholder="请输入报告号" clearable></el-input>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="登记人" prop="createById">
				<!--        <UserSelect :limit='1' :readonly="true" :modelValue="searchForm.createById" @update:modelValue='(value) => {searchForm.createById = value}'></UserSelect>-->
				<el-input v-model="searchForm.createById" placeholder="请选择登记人">
					<template #suffix>
						<el-button style="background-color: white;color: #1b1e25;border-color: white;" type="primary"
							slot="append" icon="el-icon-search" @click="openUserDia">
						</el-button>
					</template>
				</el-input>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="项目负责人" prop="projectManagerName">
				<el-input v-model="searchForm.projectManagerName" placeholder="请输入项目负责人" clearable></el-input>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="合同名称" prop="contractName">
				<el-input v-model="searchForm.contractName" placeholder="请输入合同名称" clearable></el-input>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="委托方" prop="clientName">
				<el-input v-model="searchForm.clientName" placeholder="请输入委托方" clearable></el-input>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="创建时间" prop="createDates">
				<el-date-picker placement="bottom-start" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
					v-model="searchForm.createDates" type="datetimerange" range-separator="至" start-placeholder="开始日期"
					end-placeholder="结束日期">
				</el-date-picker>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="状态" prop="status">
				<el-select v-model="searchForm.status" placeholder="请选择" style="width:100%;" clearable>
					<el-option v-for="item in $dictUtils.getDictList('program_project_list_info_status')"
						:key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="一级校审状态" prop="status1">
				<el-select v-model="searchForm.status1" placeholder="请选择" style="width:100%;" clearable>
					<el-option v-for="item in $dictUtils.getDictList('program_project_list_info_status')"
						:key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="二级校审状态" prop="status2">
				<el-select v-model="searchForm.status2" placeholder="请选择" style="width:100%;" clearable>
					<el-option v-for="item in $dictUtils.getDictList('program_project_list_info_status')"
						:key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="三级校审状态" prop="status3">
				<el-select v-model="searchForm.status3" placeholder="请选择" style="width:100%;" clearable>
					<el-option v-for="item in $dictUtils.getDictList('program_project_list_info_status')"
						:key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="签发单状态" prop="issuedStatus">
				<el-select v-model="searchForm.issuedStatus" placeholder="请选择" style="width:100%;" clearable>
					<el-option v-for="item in $dictUtils.getDictList('program_project_list_info_status')"
						:key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="归档状态" prop="archiveStatus">
				<el-select v-model="searchForm.archiveStatus" placeholder="请选择" style="width:100%;" clearable>
					<el-option v-for="item in $dictUtils.getDictList('program_project_archive_list_info_status')"
						:key="item.value" :label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item v-if="showHideItem" label="作废状态" prop="cancellationStatus">
				<el-select v-model="searchForm.cancellationStatus" placeholder="请选择" style="width:100%;" clearable>
					<el-option v-for="item in $dictUtils.getDictList('program_cancellation')" :key="item.value"
						:label="item.label" :value="item.value">
					</el-option>
				</el-select>
			</el-form-item>
			<el-form-item>
				<el-button type="default" @click="showHide" :icon="showHideIcon">{{ showHideName }}</el-button>
				<el-button type="primary" @click="refreshList()" icon="el-icon-search">查询</el-button>
				<el-button @click="resetSearch()" icon="el-icon-refresh-right">重置</el-button>
			</el-form-item>
		</el-form>

		<div class="jp-table">
			<vxe-toolbar ref="toolbarRef" :refresh="{ query: refreshList }" export custom>
				<template #buttons>
					<!--          <el-button v-if="hasPermission('program:registered:add')" type="primary" icon="el-icon-plus" @click="start()">新建</el-button>-->
					<!--			v-if="(hasPermission('program:registered:add') && overArchiveFlag === 0)" v-show="isOver"-->
					<el-button v-if="(hasPermission('program:registered:add') && overArchiveFlag === 0)" v-show="isOver"
						type="primary" icon="el-icon-plus" @click="start()">新建</el-button>
					<a style="color:red;" v-show="!isOver">已登记项目存在信息未填写完成情况，请补充完整(可通过筛选项筛选归档状态为：已归档、超期已归档。进行查看)</a>
				</template>
			</vxe-toolbar>
			<div class="jp-table-body">
				<vxe-table border="inner" auto-resize resizable height="auto" :loading="loading" size="small"
					ref="typeDictTable" show-header-overflow show-overflow highlight-hover-row :menu-config="{}"
					:column-config="{ resizable: true }" @sort-change="sortChangeHandle" :export-config="{
						remote: true,
						filename: `兴光评估项目数据${moment(new Date()).format('YYYY-MM-DD')}`,
						sheetName: `兴光评估项目数据${moment(new Date()).format('YYYY-MM-DD')}`,
						exportMethod: exportMethod,
						types: ['xlsx'],
						modes: ['current', 'selected', 'all']
					}" :sort-config="{ remote: true }" :data="dataList" :tree-config="{}" :checkbox-config="{}">
					<vxe-column type="seq" width="60" title="序号"></vxe-column>
					<vxe-column type="checkbox" width="50"></vxe-column>
					<vxe-column min-width="170" align="center" title="项目名称" field="name">
						<template #default="scope">
							<el-link type="primary" :underline="false" v-if="hasPermission('program:registered:view')"
								@click="view(scope.row)">{{ scope.row.name }}</el-link>
							<el-link type="primary" :underline="false"
								v-else-if="hasPermission('program:registered:view')" @click="view(scope.row)">{{
									scope.row.name }}</el-link>
							<span v-else>{{ scope.row.name }}</span>
						</template>
					</vxe-column>
					<vxe-column min-width="100" align="center" title="项目编号" field="no"></vxe-column>
					<vxe-column min-width="180" align="center" title="合同名称" field="contractName">
						<template #default="scope">
							<el-link type="primary" :underline="false" v-if="hasPermission('program:registered:view')"
								@click="viewContract(scope.row.contractId)">{{ scope.row.contractName }}</el-link>
							<el-link type="primary" :underline="false"
								v-else-if="hasPermission('program:registered:view')"
								@click="viewContract(scope.row.contractId)">{{ scope.row.contractName }}</el-link>
							<span v-else>{{ scope.row.name }}</span>
						</template>
					</vxe-column>
					<vxe-column min-width="100" align="center" title="项目负责人" field="projectManagerName"></vxe-column>
					<vxe-column min-width="180" align="center" title="委托方" field="clientName"></vxe-column>
					<vxe-column min-width="210" align="center" title="报告号" field="reportNo"></vxe-column>
					<vxe-column min-width="100" align="center" title="登记人" field="createById"></vxe-column>
					<vxe-column min-width="120" align="center" title="创建日期" field="createTime"></vxe-column>

					<vxe-column min-width="150px" align="center" title="状态" field="status">
						<template #default="scope">
							<el-button @click="registeredDetail(scope.row)"
								:type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.status, '')"
								effect="dark">{{ $dictUtils.getDictLabel("program_project_list_info_status",
									scope.row.status, '未登记') }}
							</el-button>
						</template>
					</vxe-column>
					<vxe-column min-width="120" align="center" title="一级校审" field="status1">
						<template #default="scope">
							<el-button @click="firstAuditDetail(scope.row)"
								:type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.status1, '')"
								effect="dark">{{ $dictUtils.getDictLabel("program_project_list_info_status",
									scope.row.status1, '未登记')
								}}
							</el-button>
						</template>
					</vxe-column>
					<vxe-column min-width="120" align="center" title="二级校审" field="status2">
						<template #default="scope">
							<el-button @click="secondAuditDetail(scope.row)"
								:type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.status2, '')"
								effect="dark">{{ $dictUtils.getDictLabel("program_project_list_info_status",
									scope.row.status2, '未登记')
								}}
							</el-button>
						</template>
					</vxe-column>
					<vxe-column min-width="120" align="center" title="三级校审" field="status3">
						<template #default="scope">
							<el-button @click="thirdAuditDetail(scope.row)"
								:type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.status3, '')"
								effect="dark">{{ $dictUtils.getDictLabel("program_project_list_info_status",
									scope.row.status3, '未登记')
								}}
							</el-button>
						</template>
					</vxe-column>
					<vxe-column min-width="150px" align="center" title="签发单状态" field="issuedStatus">
						<template #default="scope">
							<el-button @click="issuedDetail(scope.row)"
								:type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.issuedStatus, '')"
								effect="dark">{{ $dictUtils.getDictLabel("program_project_list_info_status",
									scope.row.issuedStatus,
									'未登记') }} </el-button>
						</template>
					</vxe-column>
					<vxe-column min-width="120" align="center" title="项目归档" field="archiveStatus">
						<template #default="scope">
							<el-button @click="archiveDetail(scope.row)"
								:type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.archiveStatus, '')"
								effect="dark">{{ $dictUtils.getDictLabel("program_project_archive_list_info_status",
									scope.row.archiveStatus, '未登记') }} </el-button>
						</template>
					</vxe-column>
					<vxe-column min-width="150px" align="center" title="项目作废" field="cancellationStatus">
						<template #default="scope">
							<el-button @click="cancellationDetail(scope.row)"
								:type="$dictUtils.getDictLabel('program_project_list_info_status_info', scope.row.cancellationStatus, '')"
								effect="dark">{{ $dictUtils.getDictLabel("program_cancellation",
									scope.row.cancellationStatus, '未作废') }}
							</el-button>
						</template>
					</vxe-column>
					<vxe-column title="操作" min-width="300px" fixed="right" align="center">
						<template #default="scope">
							<!-- 校审管理员修改 -->
							<el-button
								v-if="hasPermission('program:registered:adminEdit') && scope.row.status1 === '5' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="auditEdit(scope.row, 1)">修改一级校审</el-button>
							<el-button
								v-if="hasPermission('program:registered:adminEdit') && scope.row.status2 === '5' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="auditEdit(scope.row, 2)">修改二级校审</el-button>
							<el-button
								v-if="hasPermission('program:registered:adminEdit') && scope.row.status3 === '5' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="auditEdit(scope.row, 3)">修改三级校审</el-button>
							<!--				补充信息-->
							<el-button
								v-if="(scope.row.isOver === false && scope.row.createBy === $store.state.user.id) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="editInfo(scope.row)">补充信息</el-button>

							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.status === '1' || scope.row.status === '3') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="registeredPush(scope.row)">修改</el-button>
							<!--管理员角色登记完成后可修改-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status === '5' && isAdmin && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="edit(scope.row.id)">修改</el-button>
							<!--项目负责人修改-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status === '5' && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && (scope.row.archiveStatus === null || scope.row.archiveStatus === undefined || scope.row.archiveStatus === '' || scope.row.archiveStatus === '0') && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="edit(scope.row.id)">修改</el-button>
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status === '2' && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="registeredReback(scope.row)">撤回</el-button>
							<!--项目登记  审核-->
							<el-button
								v-if="scope.row.status === '2' && checkIsAudit(scope.row) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="examine(scope.row)">登记审核</el-button>
							<!--项目登记  被驳回后当前申请人重新调整-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status === '4' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="adjust(scope.row)">驳回调整</el-button>

							<el-button
								v-if="hasPermission('program:registered:del') && (scope.row.status === '1' || scope.row.status === '3') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="del(scope.row.id)">删除</el-button>
							<!--管理员角色登记完成后可删除-->
							<el-button
								v-if="hasPermission('program:registered:del') && scope.row.status === '5' && isAdmin && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="del(scope.row.id)">删除</el-button>

							<!--              <el-button v-if="hasPermission('program:registered:edit')&&scope.row.status === '5' && commonJS.isEmpty(scope.row.reportNo) && scope.row.createBy === $store.state.user.id" text type="primary"  @click="saveReportNo(scope.row.id)">生成报告号</el-button>-->

							<!-- 一级校审  发起-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status === '5' && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && (scope.row.status1 === '0' || scope.row.status1 === '1' || scope.row.status1 === '3') && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="firstAuditPush(scope.row)">一级校审</el-button>
							<!-- 一级校审  撤回-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status1 === '2' && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="firstAuditReback(scope.row)">校审撤回</el-button>
							<!-- 一级校审  审核-->
							<el-button
								v-if="scope.row.status1 === '2' && checkIsAuditFirst(scope.row) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="examineFirst(scope.row)">一级校审审核</el-button>
							<!-- 一级校审  被驳回后当前申请人重新调整-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status1 === '4' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="adjustFirst(scope.row)">驳回调整</el-button>
							<!--	管理员可撤回			-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status1 === '5' && isAdmin && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="backFirst(scope.row)">一级校审撤回</el-button>

							<!-- 二级校审  发起-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status1 === '5' && (scope.row.status2 === '0' || scope.row.status2 === '1' || scope.row.status2 === '3') && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="secondAuditPush(scope.row)">二级校审</el-button>
							<!-- 二级校审  撤回-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status2 === '2' && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.cancellationStatus !== '5'"
								type="text" @click="secondAuditReback(scope.row)">校审撤回</el-button>
							<!-- 二级校审  审核-->
							<el-button
								v-if="scope.row.status2 === '2' && checkIsAuditSecond(scope.row) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="examineSecond(scope.row)">二级校审审核</el-button>
							<!-- 二级校审  被驳回后当前申请人重新调整-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status2 === '4' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="adjustSecond(scope.row)">驳回调整</el-button>
							<!--	管理员可撤回			-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status2 === '5' && isAdmin && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="backSecond(scope.row)">二级校审撤回</el-button>

							<!-- 三级校审  发起-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status2 === '5' && (scope.row.status3 === '0' || scope.row.status3 === '1' || scope.row.status3 === '3') && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="thirdAuditPush(scope.row)">三级校审</el-button>
							<!-- 三级校审  撤回-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status3 === '2' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="thirdAuditReback(scope.row)">校审撤回</el-button>
							<!-- 三级校审  审核-->
							<el-button
								v-if="scope.row.status3 === '2' && checkIsAuditThird(scope.row) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="examineThird(scope.row)">三级校审审核</el-button>
							<!-- 三级校审  被驳回后当前申请人重新调整-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status3 === '4' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="adjustThird(scope.row)">驳回调整</el-button>
							<!--	管理员可撤回			-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.status3 === '5' && isAdmin && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="backThird(scope.row)">三级校审撤回</el-button>
							<!--三神结束后，评估报告签发前进行资产评估项目（校对）-->
							<el-button
								v-if="hasPermission('program:registered:proo') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status3 === '5' && scope.row.issuedStatus === '0' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="proofread(scope.row.id)">校对</el-button>
							<!--报告签发-->
							<el-button
								v-if="hasPermission('program:registered:browse') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.status3 === '5' && (scope.row.issuedStatus === null || scope.row.issuedStatus === undefined || scope.row.issuedStatus === '' || scope.row.issuedStatus === '0' || scope.row.issuedStatus === '1' || scope.row.issuedStatus === '3') && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="issued(scope.row)">签发</el-button>
							<!--报告签发撤回-->
							<el-button
								v-if="hasPermission('program:registered:browse') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.issuedStatus === '2' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="issuedReback(scope.row)">签发撤回</el-button>
							<!-- 报告签发  审核-->
							<el-button
								v-if="scope.row.issuedStatus === '2' && checkIsAuditIssued(scope.row) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="examineIssued(scope.row)">签发审核</el-button>
							<!-- 报告签发  被驳回后当前申请人重新调整-->
							<el-button
								v-if="hasPermission('program:registered:browse') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.issuedStatus === '4' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="adjustIssued(scope.row)">驳回调整</el-button>

							<!--评估报告装订后的审核-->
							<el-button
								v-if="hasPermission('program:registered:browse') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.issuedStatus === '5' && scope.row.archiveStatus === '0' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="browse(scope.row.id)">装订自校</el-button>

							<!-- 项目归档-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.issuedStatus === '5' && (scope.row.archiveStatus === '0' || scope.row.archiveStatus === '1' || scope.row.archiveStatus === '3' || scope.row.archiveStatus === '6') && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="archivePush(scope.row)">项目归档</el-button>
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.issuedStatus === '5' && ((scope.row.archiveStatus == '7' || scope.row.archiveStatus == '5') && !scope.row.invoiceDate) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="archivePush(scope.row)">重新归档</el-button>
							<!-- 项目归档撤回-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.archiveStatus === '2' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="archiveReback(scope.row)">项目归档撤回</el-button>
							<!-- 项目归档  审核-->
							<el-button
								v-if="scope.row.archiveStatus === '2' && checkIsAuditArchive(scope.row) && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="examineArchive(scope.row)">归档审核</el-button>
							<!-- 项目归档  被驳回后当前申请人重新调整-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id || haveProjectIds.includes(scope.row.id)) && scope.row.archiveStatus === '4' && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="adjustArchive(scope.row)">驳回调整</el-button>

							<!-- 项目作废  发起-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.createBy === $store.state.user.id && (scope.row.cancellationStatus === '0' || scope.row.cancellationStatus === '1' || scope.row.cancellationStatus === '3' || scope.row.cancellationStatus === '' || scope.row.cancellationStatus === null || scope.row.cancellationStatus === undefined)"
								text type="primary" @click="cancellationPush(scope.row)">项目作废</el-button>
							<!-- 项目作废  撤回-->
							<el-button
								v-if="hasPermission('program:registered:edit') && scope.row.cancellationStatus === '2' && (scope.row.createBy === $store.state.user.id)"
								text type="primary" @click="cancellationReback(scope.row)">作废撤回</el-button>
							<!-- 项目作废  审核-->
							<el-button v-if="scope.row.cancellationStatus === '2' && checkIsCancellation(scope.row)"
								text type="primary" @click="examineCancellation(scope.row)">作废审核</el-button>
							<!-- 项目作废  被驳回后当前申请人重新调整-->
							<el-button
								v-if="hasPermission('program:registered:edit') && (scope.row.createBy === $store.state.user.id) && scope.row.cancellationStatus === '4'"
								text type="primary" @click="adjustCancellation(scope.row)">作废调整</el-button>
							<!--				管理员角色可对作废项目进行恢复-->
							<el-button
								v-if="hasPermission('program:info:cancellation') && scope.row.cancellationStatus === '5'"
								text type="primary" @click="rnew(scope.row)">恢复</el-button>
							<!--				部门主任可以修改归档完成的项目-->
							<el-button
								v-if="hasPermission('project:achieve:edit') && (scope.row.archiveStatus === '5' || scope.row.archiveStatus === '7') && scope.row.cancellationStatus !== '5'"
								text type="primary" @click="archiveEdit(scope.row)">归档修改</el-button>


							<!-- 项目归档撤回-->
							<el-button
								v-if="hasPermission('project:achieve:break') && (scope.row.archiveStatus === '5' || scope.row.archiveStatus === '7')"
								text type="primary" @click="archiveRebackOnbmzr(scope.row)">项目归档撤回</el-button>

							<!--一级校审ftl文件下载-->
							<!--              <el-button v-if="hasPermission('program:registered:edit')" text type="primary"  icon="el-icon-circle-check"  @click="downloadFirstAuditTpl(scope.row)">一级校审下载</el-button>-->
							<!--              <el-button v-if="hasPermission('program:registered:edit')" text type="primary"  icon="el-icon-circle-check"  @click="downloadSecondAuditTpl(scope.row)">二级校审下载</el-button>-->
							<!--              <el-button v-if="hasPermission('program:registered:edit')" text type="primary"  icon="el-icon-circle-check"  @click="downloadThirdlyAuditTpl(scope.row)">三级校审下载</el-button>-->

							<!--自校功能ftl文件下载-->
							<!--              <el-button v-if="hasPermission('program:registered:edit')" text type="primary"  icon="el-icon-circle-check"  @click="downloadProofreadAuditTpl(scope.row)">校对审核</el-button>-->
							<!--              <el-button v-if="hasPermission('program:registered:edit')" text type="primary"  icon="el-icon-circle-check"  @click="downloadAuditRecordFormAfterBindingTpl(scope.row)">评估报告装订后</el-button>-->

							<!--报告签发单-->
							<!--              <el-button v-if="hasPermission('program:registered:edit')" text type="primary"  icon="el-icon-circle-check"  @click="downloadReportAusstellungTpl(scope.row)">报告签发单</el-button>-->

						</template>
					</vxe-column>
				</vxe-table>
				<vxe-pager background size="small" :current-page="tablePage.currentPage" :page-size="tablePage.pageSize"
					:total="tablePage.total" :page-sizes="[10, 20, 100, 1000, { label: '全量数据', value: 1000000 }]"
					:layouts="['PrevPage', 'JumpNumber', 'NextPage', 'FullJump', 'Sizes', 'Total']"
					@page-change="currentChangeHandle">
				</vxe-pager>
			</div>
		</div>
		<ProjectForm ref="projectForm" @refreshDataList="refreshList"></ProjectForm>
		<ProjectAdditionalInformationForm ref="projectAdditionalInformationForm" @refreshDataList="refreshList">
		</ProjectAdditionalInformationForm>
		<ProjectFormUpdate ref="projectFormUpdate" @refreshDataList="refreshList"></ProjectFormUpdate>
		<ProofreadForm ref="proofreadForm" @refreshDataList="refreshList"></ProofreadForm>
		<ProofreadBrowseForm ref="proofreadBrowseForm" @refreshDataList="refreshList"></ProofreadBrowseForm>
		<WorkContractForm2 ref="workContractForm2" @refreshDataList="refreshList"></WorkContractForm2>
		<ProjectArchiveFormDialog ref="projectArchiveFormDialog" @refreshDataList="refreshList">
		</ProjectArchiveFormDialog>
		<user-select ref="userSelect2" @doSubmit="selectUser"></user-select>
		<!-- 一级校审修改 -->
		<ProjectThreeAuditFormEditDialog ref="projectThreeAuditFormEditDialog" @refreshDataList="refreshList">
		</ProjectThreeAuditFormEditDialog>
		<!--	  <el-dialog-->
		<!--		  v-model="dialogVisible"-->
		<!--		  title="提示"-->
		<!--		  width="500"-->
		<!--	  >-->
		<!--		  <span>报告号-{{usedNo.reportNo}}已经被使用,是否要恢复</span>-->
		<!--		  <template #footer>-->
		<!--			  <div class="dialog-footer">-->
		<!--				  <el-button @click="dialogVisible = false">否</el-button>-->
		<!--				  <el-button type="primary" @click="reUsedReportNo(usedNo)">-->
		<!--					  是-->
		<!--				  </el-button>-->
		<!--			  </div>-->
		<!--		  </template>-->
		<!--	  </el-dialog>-->
	</div>
</template>

<script>
import ProgramProjectListInfoService from '@/api/program/ProgramProjectListInfoService'
import WorkContractService from '@/api/sys/WorkContractService'
import ProjectForm from './ProjectForm'
import ProjectAdditionalInformationForm from './ProjectAdditionalInformationForm'
import ProjectFormUpdate from './ProjectFormUpdate'
import ProofreadForm from './ProofreadForm'
import ProofreadBrowseForm from './ProofreadBrowseForm'
import WorkContractForm2 from '@/views/workContract/WorkContractForm2'
import pick from 'lodash.pick'
import taskService from '@/api/flowable/taskService'
import processService from '@/api/flowable/processService'
import userService from '@/api/sys/userService'
import ProofreadIssuedService from '@/api/sys/ProofreadIssuedService'
// import UserSelect from '@/components/userSelect'
import ProjectArchiveFormDialog from "./ProjectArchiveFormDialog";
import UserSelect from '@/views/utils/UserTreeSelect'
// 一级校审修改
import ProjectThreeAuditFormEditDialog from './ProjectThreeAuditFormEditDialog'
export default {
	data() {
		return {
			isOver: true,
			overArchiveFlag: '',
			applyUserName: '',
			showHideItem: false,
			dialogVisible: false,
			showHideIcon: 'el-icon-arrow-down',
			showHideName: '展示',
			searchForm: {
				name: '',
				no: '',
				createById: '',
				projectManager: '',
				contractName: '',
				clientName: '',
				createDates: [],
				status: '',
				status1: '',  // 一级校审状态
				status2: '',	// 二级校审状态
				status3: '',	// 三级校审状态
				issuedStatus: '',	// 签发单状态
				archiveStatus: '',	// 归档状态
				reportNo: '', // 报告号
				cancellationStatus: '', //作废状态
			},
			dataList: [],
			tablePage: {
				total: 0,
				currentPage: 1,
				pageSize: 10,
				orders: []
			},
			createName: '',
			loading: false,
			processDefinitionAuditId: '',
			procDefAuditKey: '',
			isAdmin: false,
			processDefinitionId1: '',
			procDefKey1: '',
			processDefinitionId2: '',
			procDefKey2: '',
			processDefinitionId3: '',
			procDefKey3: '',
			processDefinitionIdArchive: '',
			procDefKeyArchive: '',
			processDefinitionId4: '',
			procDefKey4: '',
			haveProjectIds: '',
			processDefinitionIdCell: '',
			procDefKeyCell: '',
			usedNo: {}
		}
	},
	workContractService: null,
	programProjectListInfoService: null,
	// taskService: null,
	// processService: null,
	// userService: null,
	proofreadIssuedService: null,
	created() {
		this.workContractService = new WorkContractService()
		this.programProjectListInfoService = new ProgramProjectListInfoService()
		// this.taskService = new TaskService()
		// this.processService = new ProcessService()
		// this.userService = new UserService()
		this.proofreadIssuedService = new ProofreadIssuedService()
	},
	components: {
		ProjectForm,
		ProjectAdditionalInformationForm,
		WorkContractForm2,
		ProofreadForm,
		ProofreadBrowseForm,
		ProjectFormUpdate,
		UserSelect,
		ProjectArchiveFormDialog,
		ProjectThreeAuditFormEditDialog
	},
	mounted() {
		this.$nextTick(() => {
			// 将表格和工具栏进行关联
			const $table = this.$refs.typeDictTable;
			const $toolbar = this.$refs.toolbarRef;
			$table.connect($toolbar);
		});
		this.refreshList();
	},
	activated() {
		this.is()
		this.refreshList()
	},
	computed: {
		userName() {
			return this.$store.state.user.name
		},
		user() {
			this.createName = this.$store.state.user.name
			return this.$store.state.user
		}
	},
	methods: {
		showHide() {
			if (this.showHideItem === false) {
				this.showHideItem = true
				this.showHideIcon = 'el-icon-arrow-up'
				this.showHideName = '隐藏'
			} else {
				this.showHideItem = false
				this.showHideIcon = 'el-icon-arrow-down'
				this.showHideName = '展示'
			}
		},
		// 新增
		add() {
			this.$refs.projectForm.init('add', '')
		},
		// 修改
		edit(id) {
			id = id || this.$refs.typeDictTable.getCheckboxRecords().map(item => {
				return item.id
			})[0]
			this.$refs.projectFormUpdate.init('edit', id)
		},
		// 查看
		view(row) {
			this.$refs.projectForm.init('view', row.id, row.auditId1, row.auditId2, row.auditId3, row.archiveId)
		},
		editInfo(row) {
			this.$refs.projectAdditionalInformationForm.init('edit', row.id)
		},
		// 获取数据列表
		refreshList() {
			this.loading = true
			this.createName = this.$store.state.user.name
			this.programProjectListInfoService.list({
				'current': this.tablePage.currentPage,
				'size': this.tablePage.pageSize,
				'orders': this.tablePage.orders,
				...this.searchForm
			}).then((data) => {
				console.log('data', data.records)
				this.dataList = data.records
				this.tablePage.total = data.total
				this.loading = false
			})
			// 获取当前人是否存在超期未归档项目数据信息
			this.programProjectListInfoService.getOverArchiveFlag().then((data) => {
				if (this.commonJS.isNotEmpty(data)) {
					this.overArchiveFlag = data
				}
			})
			this.isOver = true
			//获取当前登陆人所有的项目
			this.programProjectListInfoService.allList().then((data) => {
				data.forEach((data) => {
					if (this.commonJS.isNotEmpty(data.isOver)) {
						this.isOver = data.isOver
					}
				})
			})

			// 获取当前登录人的所属项目id集合
			this.programProjectListInfoService.getHaveProjectIds().then((data) => {
				if (this.commonJS.isNotEmpty(data)) {
					this.haveProjectIds = data.map(i => {
						if (this.commonJS.isNotEmpty(i)) {
							return i
						}
					}).join(',')
				}
			})
			processService.getByName('评估-项目登记').then((data) => {
				if (!this.commonJS.isEmpty(data.id)) {
					this.processDefinitionAuditId = data.id
					this.procDefAuditKey = data.key
				}
			})
			processService.getByName('评估-项目一级校审').then((data) => {
				if (!this.commonJS.isEmpty(data.id)) {
					this.processDefinitionId1 = data.id
					this.procDefKey1 = data.key
				}
			})
			processService.getByName('评估-项目二级校审').then((data) => {
				if (!this.commonJS.isEmpty(data.id)) {
					this.processDefinitionId2 = data.id
					this.procDefKey2 = data.key
				}
			})
			processService.getByName('评估-项目三级校审').then((data) => {
				if (!this.commonJS.isEmpty(data.id)) {
					this.processDefinitionId3 = data.id
					this.procDefKey3 = data.key
				}
			})
			processService.getByName('评估-项目归档').then((data) => {
				if (!this.commonJS.isEmpty(data.id)) {
					this.processDefinitionIdArchive = data.id
					this.procDefKeyArchive = data.key
				}
			})
			processService.getByName('评估-报告签发').then((data) => {
				if (!this.commonJS.isEmpty(data.id)) {
					this.processDefinitionId4 = data.id
					this.procDefKey4 = data.key
				}
			})
			processService.getByName('评估-项目作废').then((data) => {
				if (!this.commonJS.isEmpty(data.id)) {
					this.processDefinitionIdCell = data.id
					this.procDefKeyCell = data.key
				}
			})
		},
		// 当前页
		currentChangeHandle({ currentPage, pageSize }) {
			this.tablePage.currentPage = currentPage
			this.tablePage.pageSize = pageSize
			this.refreshList()
		},
		// 排序
		sortChangeHandle(column) {
			this.tablePage.orders = []
			if (column.order != null) {
				this.tablePage.orders.push({ column: this.$utils.toLine(column.property), asc: column.order === 'asc' })
			}
			this.refreshList()
		},
		// 删除
		deleteAll(id) {
			let ids = id || this.$refs.typeDictTable.getCheckboxRecords().map(item => {
				return item.id
			}).join(',')
			this.$confirm(`确定删除所选项吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				this.loading = true
				this.programProjectListInfoService.deleteAll(ids).then((data) => {
					this.$message.success(data)
					this.refreshList()
					this.loading = false
				})
			})
		},
		// 删除
		del(id) {
			let ids = id || this.$refs.typeDictTable.getCheckboxRecords().map(item => {
				return item.id
			}).join(',')
			this.$confirm(`确定删除所选项吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				this.loading = true
				this.programProjectListInfoService.delete(ids).then((data) => {
					this.$message.success(data)
					this.refreshList()
					this.loading = false
				})
			})
		},
		resetSearch() {
			this.searchForm.createById = ''
			this.applyUserName = ''
			this.$refs.searchForm.resetFields()
			this.refreshList()
		},
		viewContract(id) {
			this.$refs.workContractForm2.init('view', id)
		},
		start() {
			// 读取流程表单
			let tabTitle = `发起流程【评估-项目登记】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了 [评估-项目登记]`
			taskService.getTaskDef({
				procDefId: this.processDefinitionAuditId,
				status: 'startAndHold'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionAuditId,
						procDefKey: this.procDefAuditKey,
						status: 'startAndHold',
						title: tabTitle,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessId: 'false',
						isShow: false,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 发起项目登记审批
		registeredPush(row) {
			// 读取流程表单
			let title = `发起流程【项目登记审批】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[项目登记审批]`
			let status = 'startAndHold'
			if (row.status === '3') {
				status = 'startAndClose'
			} else if (row.status === '4') {
				status = 'reapplyFlag'
			}
			taskService.getTaskDef({
				procDefId: this.processDefinitionAuditId,
				businessId: row.id,
				businessTable: 'program_project_list_info'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionAuditId,
						procDefKey: this.procDefAuditKey,
						title: title,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessTable: 'program_project_list_info',
						businessId: row.id,
						isShow: 'false',
						status: status,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 查看项目登记审批流程结果
		registeredDetail(row) {
			if (row.status !== '0' && row.status !== '1') {
				// eslint-disable-next-line eqeqeq
				taskService.getTaskDef({
					procInsId: row.procInsId,
					procDefId: this.processDefinitionAuditId
				}).then((data) => {
					this.$router.push({
						path: '/flowable/task/TaskFormDetail',
						query: {
							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
							isShow: 'false',
							readOnly: true,
							title: '项目登记' + '流程详情',
							formTitle: '项目登记' + '流程详情',
							businessId: row.id,
							status: 'reback'
						}
					})
				})
			}
		},
		// 撤回项目登记审批
		registeredReback(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.programProjectListInfoService.queryById(row.id).then((data) => {
					if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('数据已发生改变或不存在，请刷新数据')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsId).then((data) => {
							let form = { status: '3', id: row.id }
							this.programProjectListInfoService.updateStatusById(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		// 校审修改
		auditEdit(row, auditLevel) {
			let id = ""
			let title = ""
			if (auditLevel == '1') {
				id = row.auditId1
				title = "一级校审修改"
			}
			else if (auditLevel == '2') {
				id = row.auditId2
				title = "二级校审修改"
			}
			else if (auditLevel == '3') {
				id = row.auditId3
				title = "三级校审修改"
			}
			this.$refs.projectThreeAuditFormEditDialog.init('edit', id, title)
		},
		// 发起一级校审
		firstAuditPush(row) {
			// 读取流程表单
			let title = `发起流程【评估-项目一级校审】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[评估-项目一级校审]`
			let status = 'startAndHold'
			if (row.status1 === '3') {
				status = 'startAndClose'
			} else if (row.status1 === '4') {
				status = 'reapplyFlag'
			}
			taskService.getTaskDef({
				procDefId: this.processDefinitionId1,
				businessId: row.auditId1,
				businessTable: 'program_audit'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionId1,
						procDefKey: this.procDefKey1,
						title: title,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessTable: 'program_audit',
						businessId: row.auditId1,
						isShow: 'false',
						status: status,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 查看一级校审审批流程结果
		firstAuditDetail(row) {
			if (row.status1 !== '0' && row.status1 !== '1') {
				// eslint-disable-next-line eqeqeq
				taskService.getTaskDef({
					procInsId: row.procInsId1,
					procDefId: this.processDefinitionId1
				}).then((data) => {
					this.$router.push({
						path: '/flowable/task/TaskFormDetail',
						query: {
							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
							isShow: 'false',
							readOnly: true,
							title: '一级校审' + '流程详情',
							formTitle: '一级校审' + '流程详情',
							businessId: row.auditId1,
							status: 'reback'
						}
					})
				})
			}
		},
		// 撤回一级校审
		firstAuditReback(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.programProjectListInfoService.findByIdAudit(row.auditId1).then((data) => {
					if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('数据已发生改变或不存在，请刷新数据')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsId1).then((data) => {
							let form = { status: '3', id: row.auditId1 }
							this.programProjectListInfoService.updateStatusByAuditId(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		//管理员撤回一级校审
		backFirst(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				let form = { status: '1', id: row.auditId1 }
				this.programProjectListInfoService.updateStatusByAuditId(form).then((data) => {
					this.$message.success('撤回成功')
					this.refreshList()
				})
			})
		},

		// 发起二级校审
		secondAuditPush(row) {
			// 读取流程表单
			let title = `发起流程【评估-项目二级校审】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[评估-项目二级校审]`
			let status = 'startAndHold'
			if (row.status2 === '3') {
				status = 'startAndClose'
			} else if (row.status2 === '4') {
				status = 'reapplyFlag'
			}
			taskService.getTaskDef({
				procDefId: this.processDefinitionId2,
				businessId: row.auditId2,
				businessTable: 'program_audit'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionId2,
						procDefKey: this.procDefKey2,
						title: title,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessTable: 'program_audit',
						businessId: row.auditId2,
						isShow: 'false',
						status: status,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 查看二级校审审批流程结果
		secondAuditDetail(row) {
			if (row.status2 !== '0' && row.status2 !== '1') {
				// eslint-disable-next-line eqeqeq
				taskService.getTaskDef({
					procInsId: row.procInsId2,
					procDefId: this.processDefinitionId2
				}).then((data) => {
					this.$router.push({
						path: '/flowable/task/TaskFormDetail',
						query: {
							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
							isShow: 'false',
							readOnly: true,
							title: '二级校审' + '流程详情',
							formTitle: '二级校审' + '流程详情',
							businessId: row.auditId2,
							status: 'reback'
						}
					})
				})
			}
		},
		// 撤回二级校审
		secondAuditReback(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.programProjectListInfoService.findByIdAudit(row.auditId2).then((data) => {
					if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('数据已发生改变或不存在，请刷新数据')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsId2).then((data) => {
							let form = { status: '3', id: row.auditId2 }
							this.programProjectListInfoService.updateStatusByAuditId(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		//管理员撤回二级校审
		backSecond(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				let form = { status: '1', id: row.auditId2 }
				this.programProjectListInfoService.updateStatusByAuditId(form).then((data) => {
					this.$message.success('撤回成功')
					this.refreshList()
				})
			})
		},
		// 发起三级校审
		thirdAuditPush(row) {
			// 读取流程表单
			let title = `发起流程【评估-项目三级校审】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[评估-项目三级校审]`
			let status = 'startAndHold'
			if (row.status3 === '3') {
				status = 'startAndClose'
			} else if (row.status3 === '4') {
				status = 'reapplyFlag'
			}
			taskService.getTaskDef({
				procDefId: this.processDefinitionId3,
				businessId: row.auditId3,
				businessTable: 'program_audit'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionId3,
						procDefKey: this.procDefKey3,
						title: title,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessTable: 'program_audit',
						businessId: row.auditId3,
						isShow: 'false',
						status: status,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 查看三级校审审批流程结果
		thirdAuditDetail(row) {
			if (row.status3 !== '0' && row.status3 !== '1') {
				// eslint-disable-next-line eqeqeq
				taskService.getTaskDef({
					procInsId: row.procInsId3,
					procDefId: this.processDefinitionId3
				}).then((data) => {
					this.$router.push({
						path: '/flowable/task/TaskFormDetail',
						query: {
							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
							isShow: 'false',
							readOnly: true,
							title: '三级校审' + '流程详情',
							formTitle: '三级校审' + '流程详情',
							businessId: row.auditId3,
							status: 'reback'
						}
					})
				})
			}
		},
		// 撤回三级校审
		thirdAuditReback(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.programProjectListInfoService.findByIdAudit(row.auditId3).then((data) => {
					if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('数据已发生改变或不存在，请刷新数据')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsId3).then((data) => {
							let form = { status: '3', id: row.auditId3 }
							this.programProjectListInfoService.updateStatusByAuditId(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		backThird(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				let form = { status: '1', id: row.auditId3 }
				this.programProjectListInfoService.updateStatusByAuditId(form).then((data) => {
					this.$message.success('撤回成功')
					this.refreshList()
				})
			})
		},
		// 发起项目登记归档
		archivePush(row) {
			// 读取流程表单
			let title = `发起流程【评估-项目归档】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[评估-项目归档]`
			let status = 'startAndHold'
			if (row.archiveStatus === '3') {
				status = 'startAndClose'
			} else if (row.archiveStatus === '4') {
				status = 'reapplyFlag'
			}
			taskService.getTaskDef({
				procDefId: this.processDefinitionIdArchive,
				businessId: row.archiveId,
				businessTable: 'program_archive'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionIdArchive,
						procDefKey: this.procDefKeyArchive,
						title: title,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessTable: 'program_archive',
						businessId: row.archiveId,
						isShow: 'false',
						status: status,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 查看项目归档审批流程结果
		archiveDetail(row) {
			if (row.archiveStatus !== '0' && row.archiveStatus !== '1') {
				// eslint-disable-next-line eqeqeq
				taskService.getTaskDef({
					procInsId: row.procInsIdArchive,
					procDefId: this.processDefinitionIdArchive
				}).then((data) => {
					this.$router.push({
						path: '/flowable/task/TaskFormDetail',
						query: {
							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
							isShow: 'false',
							readOnly: true,
							title: '评估-项目归档' + '流程详情',
							formTitle: '评估-项目归档' + '流程详情',
							businessId: row.archiveId,
							status: 'reback'
						}
					})
				})
			}
		},
		// 撤回三级校审
		archiveReback(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.programProjectListInfoService.findByIdArchive(row.archiveId).then((data) => {
					if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('数据已发生改变或不存在，请刷新数据')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsIdArchive).then((data) => {
							let form = { status: '3', id: row.archiveId }
							this.programProjectListInfoService.updateStatusByArchiveId(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		// 部门主任撤回已审核完成的项目归档信息
		archiveRebackOnbmzr(row) {
			this.$confirm(`确定要撤回该报告归档吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.programProjectListInfoService.findByIdArchive(row.archiveId).then((data) => {
					if (data.status !== '5' && data.status !== '7') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('报告归档当前为非完成状态，无法进行撤回')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsIdArchive).then((data) => {
							let form = { status: '3', id: row.archiveId }
							this.programProjectListInfoService.updateStatusByArchiveId(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		// 下载一级校审
		downloadFirstAuditTpl(row) {
			// this.$utils.downloadExcel('/sys/project/import/template')
			this.loading = true
			this.programProjectListInfoService.downloadFirstAuditTpl(row.id, row.auditId1).then((res) => {
				// 将二进制流文件写入excel表，以下为重要步骤
				this.$utils.downloadWord(res, '一级校审')
				this.loading = false
			}).catch(function (err) {
				this.loading = false
				if (err.response) {
					console.log(err.response)
				}
			})
		},
		// 下载二级校审
		downloadSecondAuditTpl(row) {
			// this.$utils.downloadExcel('/sys/project/import/template')
			this.loading = true
			this.programProjectListInfoService.downloadSecondAuditTpl(row.id, row.auditId2).then((res) => {
				// 将二进制流文件写入excel表，以下为重要步骤
				this.$utils.downloadWord(res, '二级校审')
				this.loading = false
			}).catch(function (err) {
				this.loading = false
				if (err.response) {
					console.log(err.response)
				}
			})
		},
		// 下载三级校审
		downloadThirdlyAuditTpl(row) {
			// this.$utils.downloadExcel('/sys/project/import/template')
			this.loading = true
			this.programProjectListInfoService.downloadThirdlyAuditTpl(row.id, row.auditId3).then((res) => {
				// 将二进制流文件写入excel表，以下为重要步骤
				this.$utils.downloadWord(res, '三级校审')
				this.loading = false
			}).catch(function (err) {
				this.loading = false
				if (err.response) {
					console.log(err.response)
				}
			})
		},
		// 下载资产评估项目（校对）审核记录表
		downloadProofreadAuditTpl(row) {
			// this.$utils.downloadExcel('/sys/project/import/template')
			this.loading = true
			this.programProjectListInfoService.downloadProofreadAuditTpl(row.id).then((res) => {
				// 将二进制流文件写入excel表，以下为重要步骤
				this.$utils.downloadExcel(res, '资产评估项目（校对）审核记录表.xls')
				this.loading = false
			}).catch(function (err) {
				this.loading = false
				if (err.response) {
					console.log(err.response)
				}
			})
		},
		// 下载评估报告装订后浏览审核记录表
		downloadAuditRecordFormAfterBindingTpl(row) {
			// this.$utils.downloadExcel('/sys/project/import/template')
			this.loading = true
			this.programProjectListInfoService.downloadAuditRecordFormAfterBindingTpl(row.id).then((res) => {
				// 将二进制流文件写入excel表，以下为重要步骤
				this.$utils.downloadExcel(res, '评估报告装订后浏览审核记录表.xls')
				this.loading = false
			}).catch(function (err) {
				this.loading = false
				if (err.response) {
					console.log(err.response)
				}
			})
		},
		// 下载报告签发单
		downloadReportAusstellungTpl(row) {
			// this.$utils.downloadExcel('/sys/project/import/template')
			this.loading = true
			this.programProjectListInfoService.downloadReportAusstellungTpl(row.id).then((res) => {
				// 将二进制流文件写入excel表，以下为重要步骤
				this.$utils.downloadWord(res, '报告签发单')
				this.loading = false
			}).catch(function (err) {
				this.loading = false
				if (err.response) {
					console.log(err.response)
				}
			})
		},
		is() {
			userService.is().then((data) => {
				this.isAdmin = data
			})
		},
		saveReportNo(id) {
			this.$confirm(`确定生成项目报告号吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(() => {
				this.loading = true
				this.programProjectListInfoService.saveReportNo(id).then((data) => {
					this.$message.success(data)
					this.refreshList()
					this.loading = false
				}).catch((e) => {
					this.loading = false
				})
			})
		},
		// 校对
		proofread(id) {
			this.$refs.proofreadForm.init(id)
		},
		// 浏览审核
		browse(id) {
			this.$refs.proofreadBrowseForm.init(id)
		},
		// 签发
		issued(row) {
			// 读取流程表单
			let title = `发起流程【评估-报告签发】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[评估-报告签发]`
			let status = 'startAndHold'
			if (row.issuedStatus === '3' || row.issuedStatus === '2') {
				status = 'startAndClose'
			} else if (row.issuedStatus === '4') {
				status = 'reapplyFlag'
			}
			taskService.getTaskDef({
				procDefId: this.processDefinitionId4,
				businessId: row.id,
				businessTable: 'proofread_issued'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionId4,
						procDefKey: this.procDefKey4,
						title: title,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessTable: 'proofread_issued',
						businessId: row.id,
						isShow: 'false',
						status: status,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 签发单详情
		issuedDetail(row) {
			if (row.issuedStatus !== undefined && row.issuedStatus !== '1') {
				// eslint-disable-next-line eqeqeq
				taskService.getTaskDef({
					procInsId: row.procInsId4,
					procDefId: this.processDefinitionId4
				}).then((data) => {
					this.$router.push({
						path: '/flowable/task/TaskFormDetail',
						query: {
							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
							isShow: 'false',
							readOnly: true,
							title: '报告签发单' + '流程详情',
							formTitle: '报告签发单' + '流程详情',
							businessId: row.id,
							status: 'reback'
						}
					})
				})
			}
		},
		// 签发撤回
		issuedReback(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.proofreadIssuedService.findById(row.id).then((data) => {
					if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('数据已发生改变或不存在，请刷新数据')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsId4).then((data) => {
							let form = { status: '3', id: row.id }
							this.proofreadIssuedService.updateStatus(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		// 驳回后调整
		adjust(row) {
			this.programProjectListInfoService.queryById(row.id).then((data) => {
				if (data.status !== '4') { // status的值不等于“驳回”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todo(row)
				}
			})
		},
		// 审核
		examine(row) {
			this.programProjectListInfoService.queryById(row.id).then((data) => {
				if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todo(row)
				}
			})
		},
		// 审核或重新调整跳转
		todo(row) {
			let cUser = false
			taskService.getTaskDefInfo({
				taskId: row.taskId
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
						isShow: false,
						formReadOnly: true,
						formTitle: `${data.taskName}`,
						cUser: cUser,
						title: `审批【${data.taskName || ''}】`,
						routePath: '/program/registered/ProjectList'   // 数据处理后需要跳转的页面路径
					}
				})
			})
		},
		// 查询当前登录人是否是数据的审核人
		checkIsAudit(row) {
			let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
			if (this.commonJS.isNotEmpty(row.auditUserIds)) {
				for (const userId of row.auditUserIds) {
					if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时，返回true
						return true
					}
				}
			}
			return false
		},
		// 驳回后调整  一级校审
		adjustFirst(row) {
			this.programProjectListInfoService.findByIdAudit(row.auditId1).then((data) => {
				if (data.status !== '4') { // status的值不等于“驳回”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoFirst(row)
				}
			})
		},
		// 审核  一级校审
		examineFirst(row) {
			this.programProjectListInfoService.findByIdAudit(row.auditId1).then((data) => {
				if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoFirst(row)
				}
			})
		},
		// 审核或重新调整跳转  一级校审
		todoFirst(row) {
			let cUser = false
			taskService.getTaskDefInfo({
				taskId: row.taskIdAudit1
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
						isShow: false,
						formReadOnly: true,
						formTitle: `${data.taskName}`,
						cUser: cUser,
						title: `审批【${data.taskName || ''}】`,
						routePath: '/program/registered/ProjectList'   // 数据处理后需要跳转的页面路径
					}
				})
			})
		},
		// 查询当前登录人是否是数据的审核人  一级校审
		checkIsAuditFirst(row) {
			let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
			if (this.commonJS.isNotEmpty(row.auditUserIds1)) {
				for (const userId of row.auditUserIds1) {
					if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时，返回true
						return true
					}
				}
			}
			return false
		},
		// 驳回后调整  二级校审
		adjustSecond(row) {
			this.programProjectListInfoService.findByIdAudit(row.auditId2).then((data) => {
				if (data.status !== '4') { // status的值不等于“驳回”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoSecond(row)
				}
			})
		},
		// 审核  二级校审
		examineSecond(row) {
			this.programProjectListInfoService.findByIdAudit(row.auditId2).then((data) => {
				if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoSecond(row)
				}
			})
		},
		// 审核或重新调整跳转  二级校审
		todoSecond(row) {
			let cUser = false
			taskService.getTaskDefInfo({
				taskId: row.taskIdAudit2
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
						isShow: false,
						formReadOnly: true,
						formTitle: `${data.taskName}`,
						cUser: cUser,
						title: `审批【${data.taskName || ''}】`,
						routePath: '/program/registered/ProjectList'   // 数据处理后需要跳转的页面路径
					}
				})
			})
		},
		// 查询当前登录人是否是数据的审核人  二级校审
		checkIsAuditSecond(row) {
			let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
			if (this.commonJS.isNotEmpty(row.auditUserIds2)) {
				for (const userId of row.auditUserIds2) {
					if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时，返回true
						return true
					}
				}
			}
			return false
		},
		// 驳回后调整  三级校审
		adjustThird(row) {
			this.programProjectListInfoService.findByIdAudit(row.auditId3).then((data) => {
				if (data.status !== '4') { // status的值不等于“驳回”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoThird(row)
				}
			})
		},
		// 审核  三级校审
		examineThird(row) {
			this.programProjectListInfoService.findByIdAudit(row.auditId3).then((data) => {
				if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoThird(row)
				}
			})
		},
		// 审核或重新调整跳转  三级校审
		todoThird(row) {
			let cUser = false
			taskService.getTaskDefInfo({
				taskId: row.taskIdAudit3
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
						isShow: false,
						formReadOnly: true,
						formTitle: `${data.taskName}`,
						cUser: cUser,
						title: `审批【${data.taskName || ''}】`,
						routePath: '/program/registered/ProjectList'   // 数据处理后需要跳转的页面路径
					}
				})
			})
		},
		// 查询当前登录人是否是数据的审核人  三级校审
		checkIsAuditThird(row) {
			let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
			if (this.commonJS.isNotEmpty(row.auditUserIds3)) {
				for (const userId of row.auditUserIds3) {
					if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时，返回true
						return true
					}
				}
			}
			return false
		},
		// 驳回后调整  签发
		adjustIssued(row) {
			this.proofreadIssuedService.findById(row.id).then((data) => {
				if (data.status !== '4') { // status的值不等于“驳回”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoIssued(row)
				}
			})
		},
		// 审核  签发
		examineIssued(row) {
			this.proofreadIssuedService.findById(row.id).then((data) => {
				if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoIssued(row)
				}
			})
		},
		// 审核或重新调整跳转  签发
		todoIssued(row) {
			let cUser = false
			taskService.getTaskDefInfo({
				taskId: row.taskIdIssued
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
						isShow: false,
						formReadOnly: true,
						formTitle: `${data.taskName}`,
						cUser: cUser,
						title: `审批【${data.taskName || ''}】`,
						routePath: '/program/registered/ProjectList'   // 数据处理后需要跳转的页面路径
					}
				})
			})
		},
		// 查询当前登录人是否是数据的审核人  签发
		checkIsAuditIssued(row) {
			let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
			if (this.commonJS.isNotEmpty(row.auditUserIdsIssued)) {
				for (const userId of row.auditUserIdsIssued) {
					if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时，返回true
						return true
					}
				}
			}
			return false
		},
		// 驳回后调整  归档
		adjustArchive(row) {
			this.programProjectListInfoService.findByIdArchive(row.archiveId).then((data) => {
				if (data.status !== '4') { // status的值不等于“驳回”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoArchive(row)
				}
			})
		},
		// 审核  归档
		examineArchive(row) {
			this.programProjectListInfoService.findByIdArchive(row.archiveId).then((data) => {
				if (data.status !== '2') { // status的值不等于“审核中”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoArchive(row)
				}
			})
		},
		// 审核或重新调整跳转  归档
		todoArchive(row) {
			let cUser = false
			taskService.getTaskDefInfo({
				taskId: row.taskIdArchive
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
						isShow: false,
						formReadOnly: true,
						formTitle: `${data.taskName}`,
						cUser: cUser,
						title: `审批【${data.taskName || ''}】`,
						routePath: '/program/registered/ProjectList'   // 数据处理后需要跳转的页面路径
					}
				})
			})
		},
		// 查询当前登录人是否是数据的审核人  归档
		checkIsAuditArchive(row) {
			let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
			if (this.commonJS.isNotEmpty(row.auditUserIdsArchive)) {
				for (const userId of row.auditUserIdsArchive) {
					if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时，返回true
						return true
					}
				}
			}
			return false
		},
		// 自定义服务端导出
		exportMethod({ options }) {
			// 传给服务端的参数
			const params = {
				'current': this.tablePage.currentPage,
				'size': this.tablePage.pageSize,
				'orders': this.tablePage.orders,
				...this.searchForm,
				filename: options.filename,
				sheetName: options.sheetName,
				isHeader: options.isHeader,
				original: options.original,
				mode: options.mode,
				selectIds: options.mode === 'selected' ? options.data.map(item => item.id) : [],
				exportFields: options.columns.map(column => column.property)
			}
			return this.programProjectListInfoService.exportFile(params).then((res) => {
				// 将二进制流文件写入excel表，以下为重要步骤
				this.$utils.downloadExcel(res, options.filename)
			}).catch(function (err) {
				if (err.response) {
					console.log(err.response)
				}
			})
		},
		// 发起项目作废
		cancellationPush(row) {
			// 读取流程表单
			let title = `发起流程【评估-项目作废】`
			let processTitle = `${this.userName} 在 ${this.moment(new Date()).format('YYYY-MM-DD HH:mm')} 发起了[评估-项目作废]`
			let status = 'startAndHold'
			if (row.status1 === '3') {
				status = 'startAndClose'
			} else if (row.status1 === '4') {
				status = 'reapplyFlag'
			}
			taskService.getTaskDef({
				procDefId: this.processDefinitionIdCell,
				businessId: row.id,
				businessTable: 'program_cancellation'
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
						procDefId: this.processDefinitionIdCell,
						procDefKey: this.procDefKeyCell,
						title: title,
						formType: data.formType,
						formUrl: data.formUrl,
						formTitle: processTitle,
						businessTable: 'program_cancellation',
						businessId: row.id,
						isShow: 'false',
						status: status,
						routePath: '/program/registered/ProjectList'
					}
				})
			})
		},
		// 查看项目作废审批流程结果
		cancellationDetail(row) {
			if (row.cancellationStatus !== '0' && row.cancellationStatus !== '1') {
				// eslint-disable-next-line eqeqeq
				taskService.getTaskDef({
					procInsId: row.procInsIdCancell,
					procDefId: this.processDefinitionIdCell
				}).then((data) => {
					this.$router.push({
						path: '/flowable/task/TaskFormDetail',
						query: {
							...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title'),
							isShow: 'false',
							readOnly: true,
							title: '项目作废' + '流程详情',
							formTitle: '项目作废' + '流程详情',
							businessId: row.cancellId,
							status: 'reback'
						}
					})
				})
			}
		},
		// 撤回项目作废
		cancellationReback(row) {
			this.$confirm(`确定要撤回该申请吗?`, '提示', {
				confirmButtonText: '确定',
				cancelButtonText: '取消',
				type: 'warning'
			}).then(async () => {
				await this.programProjectListInfoService.queryById(row.cancellId).then((data) => {
					if (data.cancellationStatus !== '2') { // status的值不等于“审核中”，就弹出提示
						this.$message.error('数据已发生改变或不存在，请刷新数据')
						this.refreshList()
					} else {
						processService.revokeProcIns(row.procInsIdCancell).then((data) => {
							let form = { cancellationStatus: '3', cancellId: row.cancellId }
							this.programProjectListInfoService.updateStatusByCancellId(form)
							this.$message.success(data)
							this.refreshList()
						})
					}
				})
			})
		},
		// 驳回后调整  项目作废
		adjustCancellation(row) {
			this.programProjectListInfoService.queryById(row.cancellId).then((data) => {
				if (data.cancellationStatus !== '4') { // status的值不等于“驳回”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoCancellation(row)
				}
			})
		},
		// 审核  项目作废
		examineCancellation(row) {
			this.programProjectListInfoService.queryById(row.cancellId).then((data) => {
				if (data.cancellationStatus !== '2') { // status的值不等于“审核中”，就弹出提示
					this.$message.error('数据已发生改变或不存在，请刷新数据')
					this.refreshList()
				} else {
					this.todoCancellation(row)
				}
			})
		},
		// 审核或重新调整跳转  项目作废
		todoCancellation(row) {
			let cUser = false
			taskService.getTaskDefInfo({
				taskId: row.taskIdCan
			}).then((data) => {
				this.$router.push({
					path: '/flowable/task/TaskForm',
					query: {
						...pick(data, 'formType', 'formUrl', 'procDefKey', 'taskDefKey', 'procInsId', 'procDefId', 'taskId', 'status', 'title', 'businessId'),
						isShow: false,
						formReadOnly: true,
						formTitle: `${data.taskName}`,
						cUser: cUser,
						title: `审批【${data.taskName || ''}】`,
						routePath: '/program/registered/ProjectList'   // 数据处理后需要跳转的页面路径
					}
				})
			})
		},
		// 查询当前登录人是否是数据的审核人  归档
		checkIsCancellation(row) {
			let loginUserId = this.$store.state.user.id  // 获取当前登录用户id
			if (this.commonJS.isNotEmpty(row.auditUserIdsCancellation)) {
				for (const userId of row.auditUserIdsCancellation) {
					if (userId === loginUserId) {  // 当数据的审核人中包含当前登录人id时，返回true
						return true
					}
				}
			}
			return false
		},
		// 恢复作废的项目
		rnew(row) {
			// 判断关联合同是否作废
			this.workContractService.getContractByProgramId({
				programId: row.id
			}).then((data) => {
				if (data.cancelStatus == '5') {
					this.$message.warning(`请先恢复合同： ${data.name}，合同恢复后，才可恢复该项目`)
					return
				}
				this.programProjectListInfoService.getIsUsed(row.reportNo).then((data) => {
					console.log('data', data)
					if (data) {
						this.$confirm('报告号' + row.reportNo + '已经被使用,若恢复则会生成新的报告号,是否继续恢复', '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning'
						}).then(async () => {
							this.$confirm(`确定要恢复该项目吗?`, '提示', {
								confirmButtonText: '确定',
								cancelButtonText: '取消',
								type: 'warning'
							}).then(async () => {
								await this.programProjectListInfoService.queryById(row.cancellId).then((data) => {
									if (data.cancellationStatus !== '5') { // status的值不等于“审核中”，就弹出提示
										this.$message.error('数据已发生改变或不存在，请刷新数据')
										this.refreshList()
									} else {
										let form = { cancellationStatus: '0', cancellId: row.cancellId }
										this.programProjectListInfoService.updateStatusByCancellId(form)
										this.dialogVisible = false
										this.refreshList()
									}
								})
							})
						})
						// this.usedNo = row
						// this.dialogVisible = true
					} else {
						this.$confirm(`确定要恢复该项目吗?`, '提示', {
							confirmButtonText: '确定',
							cancelButtonText: '取消',
							type: 'warning'
						}).then(async () => {
							await this.programProjectListInfoService.queryById(row.cancellId).then((data) => {
								if (data.cancellationStatus !== '5') { // status的值不等于“审核中”，就弹出提示
									this.$message.error('数据已发生改变或不存在，请刷新数据')
									this.refreshList()
								} else {
									let form = { cancellationStatus: '0', cancellId: row.cancellId }
									this.programProjectListInfoService.updateStatusByCancellId(form)
									this.dialogVisible = false
									this.refreshList()
								}
							})
						})
					}
				})

			})
		},
		// reUsedReportNo(usedNo){
		// 	this.$confirm(`确定要恢复该项目吗?`, '提示', {
		// 		confirmButtonText: '确定',
		// 		cancelButtonText: '取消',
		// 		type: 'warning'
		// 	}).then(async () => {
		// 		await this.programProjectListInfoService.queryById(usedNo.cancellId).then((data) => {
		// 			if (data.cancellationStatus !== '5') { // status的值不等于“审核中”，就弹出提示
		// 				this.$message.error('数据已发生改变或不存在，请刷新数据')
		// 				this.refreshList()
		// 			} else {
		// 				let form = {cancellationStatus: '0', cancellId: usedNo.cancellId}
		// 				this.programProjectListInfoService.updateStatusByCancellId(form)
		// 				this.dialogVisible = false
		// 				this.refreshList()
		// 			}
		// 		})
		// 	})
		// },
		archiveEdit(row) {
			console.log('id', row.archiveId)
			this.$refs.projectArchiveFormDialog.init('edit', row.archiveId);
		},
		openUserDia() {
			this.$refs.userSelect2.init()
		},
		selectUser(user) {
			console.log(user[0].name)
			this.searchForm.createById = user[0].name
		},
	}
}
</script>
