123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972 |
- <template>
- <div class="hc-layout-box">
- <div :style="'width:' + leftWidth + 'px;'" class="hc-layout-left-box">
- <div class="hc-project-box">
- <div class="hc-project-icon-box">
- <HcIcon name="stack"/>
- </div>
- <div class="ml-2 project-name-box">
- <span class="text-xl text-cut project-alias">{{ projectInfo['projectAlias'] }}</span>
- <div class="text-xs text-cut project-name">{{ projectInfo['name'] }}</div>
- </div>
- </div>
- <div class="hc-tree-box">
- <el-scrollbar>
- <ProjectTree :autoExpandKeys="TreeAutoExpandKeys" :datas="ElTreeData" @nodeTap="nodeElTreeClick"/>
- </el-scrollbar>
- </div>
- <!--左右拖动-->
- <div class="horizontal-drag-line" @mousedown="onmousedown"/>
- </div>
- <div class="hc-layout-content-box">
- <HcCard :scrollbar="false" actionSize="lg">
- <template #header>
- <HcTooltip keys="project-scanning-upload">
- <el-button :disabled="!nodeIds" hc-btn type="primary" @click="uploadModalClick">
- <HcIcon name="add-circle"/>
- <span>上传文件</span>
- </el-button>
- </HcTooltip>
- <HcTooltip keys="project-scanning-download">
- <el-button :disabled="tableCheckedKeys.length <= 0" :loading="batchDownloadLoading" hc-btn
- @click="batchDownload">
- <HcIcon name="download"/>
- <span>批量下载</span>
- </el-button>
- </HcTooltip>
- <HcTooltip keys="project-scanning-report">
- <el-button :disabled="tableCheckedKeys.length <= 0" :loading="reportLoading" hc-btn
- @click="reportModalClick">
- <HcIcon name="send-plane-2"/>
- <span>批量上报</span>
- </el-button>
- </HcTooltip>
- <HcTooltip keys="project-scanning-attest">
- <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="certificationModalClick">
- <HcIcon name="vip-diamond"/>
- <span>批量认证</span>
- </el-button>
- </HcTooltip>
- <HcTooltip keys="project-scanning-del">
- <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="batchDel">
- <HcIcon name="delete-bin-2"/>
- <span>批量删除</span>
- </el-button>
- </HcTooltip>
- <HcTooltip keys="project-scanning-edit">
- <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="batchEditClick">
- <HcIcon name="draft"/>
- <span>批量编辑</span>
- </el-button>
- </HcTooltip>
- <HcTooltip keys="project-scanning-abolish">
- <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="batchAbolishClick">
- <HcIcon name="delete-bin-3"/>
- <span>批量废除</span>
- </el-button>
- </HcTooltip>
- </template>
- <template #search>
- <div class="w-32">
- <el-select v-model="searchForm.isApprovalValue" clearable placeholder="审批状态">
- <el-option v-for="item in approvalData" :label="item['dictValue']"
- :value="item['dictKey']"/>
- </el-select>
- </div>
- <div class="w-32 ml-4">
- <el-select v-model="searchForm.isCertificationValue" clearable placeholder="认证状态">
- <el-option v-for="item in certificationType" :label="item['dictValue']"
- :value="item['dictKey']"/>
- </el-select>
- </div>
- <div class="w-64 ml-3">
- <el-input v-model="searchForm.queryValue" clearable placeholder="请输入文件名、责任者进行搜索"
- @keyup="keyUpEvent"/>
- </div>
- <div class="ml-2">
- <el-button type="primary" @click="searchClick">
- <HcIcon name="search-2"/>
- <span>搜索</span>
- </el-button>
- </div>
- </template>
- <HcTable ref="tableListRef" :column="tableListColumn" :datas="tableListData" :loading="tableLoading"
- isCheck @selection-change="tableSelectionChange">
- <template #fileName="{row}">
- <span class="text-link" @click="tablePreview(row)">{{ row?.fileName }}</span>
- </template>
- <template #isApprovalValue="{row}">
- <el-tag
- v-if="row['isApprovalValue']"
- :type="`${row.status === 2 ? 'success' : row.status === 0 ? 'warning' : row.status === 1 ? 'danger' : 'info'}`"
- class="mx-1" effect="dark">{{ row['isApprovalValue'] }}
- </el-tag>
- </template>
- </HcTable>
- <template #action>
- <HcPages :pages="searchForm" @change="pageChange"/>
- </template>
- </HcCard>
- </div>
- <!--新增编辑文件-->
- <el-dialog v-model="showUploadModal" class="hc-modal-border hc-modal-table" title="上传工程文件" width="80vw">
- <HcTable :column="tableUploadColumn" :datas="tableUploadData" :loading="uploadSaveLoading"
- ui="hc-form-table">
- <template #fileNumber="{row}">
- <el-input v-model="row.fileNumber" :class="row['isFileNumber'] ? 'is-error' : ''"
- @input="tableInput($event, row, 'isFileNumber')"/>
- </template>
- <template #fileName="{row}">
- <el-input v-model="row.fileName" :class="row['isFileName'] ? 'is-error' : ''"
- @input="tableInput($event, row, 'isFileName')"/>
- </template>
- <template #fileTime="{row}">
- <el-date-picker v-model="row.fileTime" :clearable="false" format="YYYY/MM/DD" type="date"
- value-format="YYYY-MM-DD"/>
- </template>
- <template v-if="isBuiltDrawing === 1" #sheetType="{row}">
- <el-select v-model="row.sheetType">
- <el-option v-for="item in sheetType" :key="item['dictKey']" :label="item['dictValue']"
- :value="item['dictKey']"/>
- </el-select>
- </template>
- <template v-if="isBuiltDrawing === 1" #sheetSource="{row}">
- <el-select v-model="row.sheetSource">
- <el-option v-for="item in sheetSourceType" :key="item['dictKey']" :label="item['dictValue']"
- :value="item['dictKey']"/>
- </el-select>
- </template>
- <template v-if="isBuiltDrawing === 1" #drawingNo="{row}">
- <el-input v-model="row.drawingNo"/>
- </template>
- <template v-if="isBuiltDrawing === 1" #citeChangeNumber="{row}">
- <el-input v-model="row.citeChangeNumber"/>
- </template>
- <template #isApproval="{row}">
- <el-select v-model="row.isApproval">
- <el-option v-for="item in whetherData" :key="item.value" :label="item.label"
- :value="item.value"/>
- </el-select>
- </template>
- <template #isNeedCertification="{row}">
- <el-select v-model="row.isNeedCertification">
- <el-option v-for="item in whetherData" :key="item.value" :label="item.label"
- :value="item.value"/>
- </el-select>
- </template>
- <template #dutyUser="{row}">
- <el-input v-model="row.dutyUser"/>
- </template>
- <template #action="{row,index}">
- <HcFileUpload1 v-if="row.id" @change="newUploadsChange($event, row)"
- @progress="newUploadsProgress($event, row)">
- <el-button :loading="row['newBtnLoading']" plain size="small" type="primary">上传新文件
- </el-button>
- </HcFileUpload1>
- <el-button :loading="row['delBtnLoading']" plain size="small" type="danger"
- @click="delUploadData(row,index)">删除
- </el-button>
- </template>
- </HcTable>
- <template #footer>
- <div class="lr-dialog-footer">
- <div class="left flex items-center">
- <HcFileUpload @change="uploadsChange" @progress="uploadsProgress">
- <el-button :disabled="uploadSaveLoading" :loading="uploadsLoading" hc-btn type="primary">
- <HcIcon name="add-circle"/>
- <span>新增上传</span>
- </el-button>
- </HcFileUpload>
- </div>
- <div class="right">
- <el-button size="large" @click="batchUploadCancel">
- <HcIcon name="close"/>
- <span>取消</span>
- </el-button>
- <el-button :disabled="uploadsLoading" :loading="uploadSaveLoading" hc-btn type="primary"
- @click="batchUploadSave">
- <HcIcon name="save"/>
- <span>提交保存</span>
- </el-button>
- </div>
- </div>
- </template>
- </el-dialog>
- <!--批量上报审批-->
- <HcReportModal
- :contractId="contractId"
- :datas="reportDatas"
- :ids="reportIds"
- :projectId="projectId"
- :show="showReportModal"
- :taskName="reportTaskName"
- isDatas
- title="批量上报审批"
- url="archiveFile/batchApproval"
- @finish="showReportFinish"
- @hide="showReportModal = false"
- @tagClose="reportTaskTagClose"
- />
- <!--批量认证-->
- <el-dialog v-model="showCertificationModal" class="hc-modal-border hc-modal-table" title="批量认证"
- width="80vw">
- <div class="hc-card-body-flex">
- <div class="flex-table">
- <HcTable :column="CertColumns" :datas="CertData" ui="hc-form-table" @row-click="CertRowClick">
- <template #action="{row,index}">
- <el-button plain size="small" type="primary" @click.stop="CertRowClick2(row)">预览
- </el-button>
- </template>
- </HcTable>
- </div>
- <div v-if="CertPdf" class="flex-iframe">
- <iframe :src="CertPdf" allow="display-capture" frameborder='1' height='100%' width='100%'></iframe>
- </div>
- <div v-else class="flex-iframe hc-no-table-form">
- <div class="table-form-no">
- <img :src="notableform" alt=""/>
- <div class="desc">暂无 PDF 数据</div>
- </div>
- </div>
- </div>
- <template #footer>
- <div class="dialog-footer">
- <el-button size="large" @click="showCertificationModal = false">
- <HcIcon name="close"/>
- <span>取消</span>
- </el-button>
- <el-button :loading="CertLoading" hc-btn type="primary" @click="CertClick">
- <HcIcon name="save"/>
- <span>确认认证</span>
- </el-button>
- </div>
- </template>
- </el-dialog>
- </div>
- </template>
- <script setup>
- import {onMounted, ref, watch} from 'vue'
- import {useAppStore} from "~src/store";
- import {useRouter, useRoute} from 'vue-router'
- import ProjectTree from "./components/ProjectTree.vue"
- import HcFileUpload from "./components/HcFileUpload.vue"
- import HcFileUpload1 from "./components/HcFileUpload1.vue"
- import {getStoreValue, setStoreValue} from '~src/utils/storage'
- import projectScanningApi from "~api/other-file/projectScanning";
- import notableform from '~src/assets/view/notableform.svg';
- import {downloadBlob, getArrValue, deepClone} from "js-fast-way"
- import {eVisaTaskCheckApi} from "~api/other"
- import tasksDataApi from '~api/tasks/data';
- import ossApi from "~api/oss";
- import dayjs from "dayjs"
- //变量
- const router = useRouter()
- const useRoutes = useRoute()
- const useAppState = useAppStore()
- const projectId = ref(useAppState.getProjectId);
- const contractId = ref(useAppState.getContractId);
- const projectInfo = ref(useAppState.getProjectInfo);
- const isCollapse = ref(useAppState.getCollapse)
- //监听
- watch(() => [
- useAppState.getCollapse
- ], ([Collapse]) => {
- isCollapse.value = Collapse
- })
- //自动展开缓存
- const TreeAutoExpandKeys = ref(getStoreValue('scanningTreeExpandKeys') || [])
- const dayDate = ref('')
- //渲染完成
- onMounted(() => {
- getClassIfyList()
- firstTaskStatus()
- certificationStatus()
- dayDate.value = dayjs(new Date()).format('YYYY-MM-DD')
- })
- //获取树的数据
- const ElTreeData = ref([])
- const getClassIfyList = async () => {
- const {error, code, data} = await projectScanningApi.getClassIfyList({
- projectId: projectId.value,
- contractId: contractId.value
- })
- //处理数据
- if (!error && code === 200) {
- ElTreeData.value = getArrValue(data)
- } else {
- ElTreeData.value = []
- }
- }
- //项目树被点击
- const treeNodeInfo = ref({})
- const treeDataInfo = ref({})
- const nodeIds = ref('')
- const isStorageNode = ref(0)
- const isBuiltDrawing = ref(0)
- const nodeElTreeClick = ({node, data, keys, key}) => {
- treeNodeInfo.value = node
- treeDataInfo.value = data
- //设置变量
- nodeIds.value = key || ''
- isStorageNode.value = data['isStorageNode'] || 0
- isBuiltDrawing.value = data['isBuiltDrawing'] || 0
- //设置搜索数据
- searchForm.value.current = 1;
- searchForm.value.nodeIds = key || ''
- setTableColumns()
- getTableData()
- //缓存展开的节点
- setStoreValue('scanningTreeExpandKeys', keys)
- }
- //获取任务类型
- const approvalData = ref([])
- const firstTaskStatus = async () => {
- const {error, code, data} = await tasksDataApi.queryTaskTypeStatus({
- typeOrStatus: 'first_task_status'
- })
- //处理数据
- if (!error && code === 200) {
- approvalData.value = getArrValue(data)
- } else {
- approvalData.value = []
- }
- }
- //获取认证状态
- const certificationType = ref([])
- const certificationStatus = async () => {
- const {error, code, data} = await tasksDataApi.queryTaskTypeStatus({
- typeOrStatus: 'certification_status'
- })
- //处理数据
- if (!error && code === 200) {
- certificationType.value = getArrValue(data)
- } else {
- certificationType.value = []
- }
- }
- //获取图幅类型
- const sheetType = ref([])
- const sheetTypeStatus = async () => {
- const {error, code, data} = await tasksDataApi.queryTaskTypeStatus({
- typeOrStatus: 'sheet_type'
- })
- //处理数据
- if (!error && code === 200) {
- sheetType.value = getArrValue(data)
- } else {
- sheetType.value = []
- }
- }
- //获取图表来源
- const sheetSourceType = ref([])
- const sheetSourceStatus = async () => {
- const {error, code, data} = await tasksDataApi.queryTaskTypeStatus({
- typeOrStatus: 'sheet_source'
- })
- //处理数据
- if (!error && code === 200) {
- sheetSourceType.value = getArrValue(data)
- } else {
- sheetSourceType.value = []
- }
- }
- //搜索表单
- const searchForm = ref({
- nodeIds: '', isApprovalValue: null, isCertificationValue: null, queryValue: null,
- current: 1, size: 20, total: 0
- })
- //回车搜索
- const keyUpEvent = (e) => {
- if (e.key === "Enter") {
- searchClick()
- }
- }
- //搜索
- const searchClick = () => {
- if (nodeIds.value) {
- searchForm.value.current = 1;
- getTableData()
- } else {
- window?.$message?.warning('请先在左边选择一个树节点')
- }
- }
- //分页被点击
- const pageChange = ({current, size}) => {
- searchForm.value.current = current
- searchForm.value.size = size
- getTableData()
- }
- //设置表头
- const tableListColumn = ref([
- {key: 'fileNumber', name: '文件编号', width: 160},
- {key: 'fileName', name: '文件名称'},
- {key: 'filePage', name: '文件页数', width: 120},
- {key: 'isCertificationValue', name: '认证状态', width: 160},
- {key: 'isApprovalValue', name: '状态', width: 160},
- {key: 'fileTime', name: '文件时间', width: 160},
- {key: 'dutyUser', name: '责任者', width: 160}
- ])
- const setTableColumns = () => {
- if (isBuiltDrawing.value === 1) {
- tableListColumn.value = [
- {key: 'fileNumber', name: '文件编号', width: 160},
- {key: 'fileName', name: '文件名称'},
- {key: 'filePage', name: '文件页数', width: 120},
- {key: 'sheetType', name: '图幅'},
- {key: 'sheetSourceValue', name: '图表来源'},
- {key: 'drawingNo', name: '图号'},
- {key: 'citeChangeNumber', name: '引用变更令编号'},
- {key: 'isCertificationValue', name: '认证状态', width: 160},
- {key: 'isApprovalValue', name: '状态', width: 160},
- {key: 'fileTime', name: '文件时间', width: 160},
- {key: 'dutyUser', name: '责任者', width: 160}
- ]
- sheetTypeStatus()
- sheetSourceStatus()
- } else {
- tableListColumn.value = [
- {key: 'fileNumber', name: '文件编号', width: 160},
- {key: 'fileName', name: '文件名称'},
- {key: 'filePage', name: '文件页数', width: 120},
- {key: 'isCertificationValue', name: '认证状态', width: 160},
- {key: 'isApprovalValue', name: '状态', width: 160},
- {key: 'fileTime', name: '文件时间', width: 160},
- {key: 'dutyUser', name: '责任者', width: 160}
- ]
- }
- }
- //获取数据
- const tableLoading = ref(false)
- const tableListData = ref([])
- const getTableData = async () => {
- tableLoading.value = true
- const {error, code, data} = await projectScanningApi.getarchiveFilePage({
- ...searchForm.value,
- projectId: projectId.value,
- contractId: contractId.value
- })
- //判断状态
- tableLoading.value = false
- if (!error && code === 200) {
- tableListData.value = getArrValue(data['records'])
- searchForm.value.total = data['total'] || 0
- } else {
- tableListData.value = []
- searchForm.value.total = 0
- }
- }
- //多选
- const tableListRef = ref(null)
- const tableCheckedKeys = ref([]);
- const tableSelectionChange = (rows) => {
- tableCheckedKeys.value = rows.filter((item) => {
- return (item ?? '') !== '';
- })
- }
- //文件名称被点击
- const tablePreview = (row) => {
- const pdfUrl = row['pdfFileUrl'] || ''
- const evisaFile = row['evisaFile'] || ''
- if (evisaFile) {
- window.open(evisaFile, '_blank')
- } else if (pdfUrl) {
- window.open(pdfUrl, '_blank')
- } else {
- window.$message?.warning('该数据暂无PDF')
- }
- }
- //新增文件
- const tableUploadType = ref('add')
- const showUploadModal = ref(false)
- const uploadModalClick = () => {
- if (nodeIds.value && isStorageNode.value === 1) {
- tableUploadType.value = 'add'
- setTableUploadColumn()
- uploadSaveLoading.value = false
- tableUploadData.value = []
- showUploadModal.value = true
- } else {
- window?.$message?.warning('请先选择一个子节点')
- }
- }
- //设置文件表头
- const tableUploadColumn = ref([
- {key: 'fileNumber', name: '文件编号'},
- {key: 'fileName', name: '文件名称'},
- {key: 'fileTime', name: '文件时间'},
- {key: 'isApproval', name: '是否需要审批'},
- {key: 'isNeedCertification', name: '是否需要认证'},
- {key: 'dutyUser', name: '责任者'},
- {key: 'action', name: '操作', width: 180}
- ])
- const setTableUploadColumn = () => {
- if (isBuiltDrawing.value === 1) {
- tableUploadColumn.value = [
- {key: 'fileNumber', name: '文件编号'},
- {key: 'fileName', name: '文件名称'},
- {key: 'fileTime', name: '文件时间'},
- {key: 'sheetType', name: '图幅'},
- {key: 'sheetSource', name: '图表来源'},
- {key: 'drawingNo', name: '图号'},
- {key: 'citeChangeNumber', name: '引用变更令编号'},
- {key: 'isApproval', name: '是否需要审批'},
- {key: 'isNeedCertification', name: '是否需要认证'},
- {key: 'dutyUser', name: '责任者'},
- {key: 'action', name: '操作', width: 180}
- ]
- } else {
- tableUploadColumn.value = [
- {key: 'fileNumber', name: '文件编号'},
- {key: 'fileName', name: '文件名称'},
- {key: 'fileTime', name: '文件时间'},
- {key: 'isApproval', name: '是否需要审批'},
- {key: 'isNeedCertification', name: '是否需要认证'},
- {key: 'dutyUser', name: '责任者'},
- {key: 'action', name: '操作', width: 180}
- ]
- }
- }
- const tableUploadData = ref([])
- //上传的文件结果
- const uploadsChange = ({fileList}) => {
- let newArr = []
- const sheet = sheetType.value, source = sheetSourceType.value
- for (let i = 0; i < fileList.length; i++) {
- const item = fileList[i]
- let name = item['originalName'] || ''
- let fileName = name.substring(0, name.lastIndexOf("."))
- newArr.push({
- projectId: projectId.value,
- contractId: contractId.value,
- nodeId: nodeIds.value,
- fileNumber: '',
- fileName: fileName,
- ossFileName: item?.name || '',
- fileTime: dayDate.value,
- fileUrl: item?.link || '',
- sheetType: sheet.length > 0 ? sheet[0]['dictKey'] || '' : '',
- sheetSource: source.length > 0 ? source[0]['dictKey'] || '' : '',
- drawingNo: '',
- citeChangeNumber: '',
- isApproval: 0,
- isNeedCertification: 0,
- dutyUser: '',
- pdfFileUrl: item?.pdfUrl || '',
- filePage: item?.page || '',
- })
- }
- tableUploadData.value = newArr
- }
- //上传进度
- const uploadsLoading = ref(false)
- const uploadsProgress = (val) => {
- uploadsLoading.value = val
- }
- //表单下拉数据
- const whetherData = ref([{label: "不需要", value: 0}, {label: "需要", value: 1}])
- //输入框验证
- const tableInput = (val, row, isv) => {
- if (val) {
- row[isv] = false
- } else {
- row[isv] = true
- }
- }
- //上传新文件
- const newUploadsChange = ({fileList}, row) => {
- if (fileList.length > 0) {
- const item = fileList[0]
- const name = item['originalName'] || ''
- const fileName = name.substring(0, name.lastIndexOf("."))
- //更新数据
- row.fileName = fileName;
- row.ossFileName = item?.name || ''
- row.fileUrl = item?.link || ''
- row.pdfFileUrl = item?.pdfUrl || ''
- row.filePage = item?.page || ''
- }
- }
- const newUploadsProgress = (val, row) => {
- row.newBtnLoading = val
- }
- //删除
- const delUploadData = async (row, index) => {
- if (row['ossFileName']) {
- row['delBtnLoading'] = true
- await ossApi.removeFile({fileName: row['ossFileName']})
- row['delBtnLoading'] = false
- tableUploadData.value.splice(index, 1);
- } else {
- tableUploadData.value.splice(index, 1);
- }
- }
- //批量上传保存
- const uploadSaveLoading = ref(false)
- const batchUploadSave = async () => {
- const rows = tableUploadData.value
- if (rows.length > 0) {
- //验证表单数据
- uploadSaveLoading.value = true
- let isTableRows = false;
- for (let i = 0; i < rows.length; i++) {
- if (!rows[i]['fileNumber']) {
- rows[i]['isFileNumber'] = true
- isTableRows = true
- } else if (!rows[i]['fileName']) {
- rows[i]['isFileName'] = true
- isTableRows = true
- }
- }
- //判断数据
- if (isTableRows) {
- uploadSaveLoading.value = false
- window.$message?.warning('请先完善表单信息')
- } else {
- if (tableUploadType.value === 'add') {
- await batchUploadSaveApi(rows)
- } else {
- await batchEditSaveApi(rows)
- }
- }
- } else {
- window.$message?.warning('请先上传文件')
- }
- }
- //确认上传保存
- const batchUploadSaveApi = async (rows) => {
- uploadSaveLoading.value = true
- const {error, code} = await projectScanningApi.batchUploadSave({
- list: rows
- }, false)
- //判断状态
- uploadSaveLoading.value = false
- if (!error && code === 200) {
- window.$message?.success('保存成功')
- batchUploadCancel()
- getTableData()
- } else {
- window.$message?.error('保存失败')
- }
- }
- //取消上传
- const batchUploadCancel = () => {
- tableUploadData.value = []
- uploadSaveLoading.value = false
- uploadsLoading.value = false
- showUploadModal.value = false
- }
- //批量编辑
- const batchEditClick = () => {
- const rows = deepClone(tableCheckedKeys.value)
- //判断是否满足条件
- const result = rows.every(({status}) => {
- return status !== 1 && status !== 2
- })
- console.log(rows)
- //判断状态
- if (result) {
- tableUploadType.value = 'edit'
- setTableUploadColumn()
- uploadSaveLoading.value = false
- tableUploadData.value = rows
- showUploadModal.value = true
- } else {
- window.$message?.warning('已上报或已审批的文件不能编辑')
- }
- }
- //确认编辑上传保存
- const batchEditSaveApi = async (rows) => {
- uploadSaveLoading.value = true
- const {error, code} = await projectScanningApi.batchEditSave({
- list: rows
- }, false)
- //判断状态
- uploadSaveLoading.value = false
- if (!error && code === 200) {
- window.$message?.success('保存成功')
- batchUploadCancel()
- getTableData()
- } else {
- window.$message?.error('保存失败')
- }
- }
- //批量下载
- const batchDownloadLoading = ref(false)
- const batchDownload = async () => {
- const rows = deepClone(tableCheckedKeys.value)
- const ids = rowsToId(rows)
- //批量下载
- batchDownloadLoading.value = true
- const {error, disposition, res} = await projectScanningApi.batchDownloadFileToZip({ids: ids})
- //处理数据
- batchDownloadLoading.value = false
- if (!error) {
- if (disposition) {
- downloadBlob(res, disposition)
- } else {
- window.$message?.error('数据异常')
- }
- }
- }
- //批量上报
- const reportIds = ref('')
- const reportTaskName = ref('')
- const reportDatas = ref([])
- const showReportModal = ref(false)
- const reportLoading = ref(false)
- const reportModalClick = async () => {
- const rows = tableCheckedKeys.value;
- const result = rows.every(({status}) => {
- return status === 0 //isApproval !== 1 && status !== 0 || isApproval === 1 && status !== 0
- })
- if (result) {
- reportLoading.value = true
- const taskCheck = await eVisaTaskCheckApi({
- projectId: projectId.value,
- contractId: contractId.value
- })
- if (taskCheck) {
- reportIds.value = rowsToId(rows)
- //设置任务数据
- let reportDataArr = []
- rows.forEach(item => {
- reportDataArr.push({
- id: item?.id,
- name: item?.fileName
- })
- })
- reportDatas.value = reportDataArr
- //设置任务名称
- reportTaskName.value = rows.length > 1 ? `${rows[0].fileName}等${rows.length}个文件` : rows[0].fileName
- reportLoading.value = false
- showReportModal.value = true
- } else {
- reportLoading.value = false
- }
- } else {
- window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
- }
- }
- //上报的审批内容移除
- const reportTaskTagClose = (index) => {
- const row = tableCheckedKeys.value[index];
- tableListRef.value?.toggleRowSelection(row, false)
- }
- //上报完成
- const showReportFinish = () => {
- showReportModal.value = false
- getTableData()
- }
- //批量认证
- const CertData = ref([])
- const CertIds = ref([])
- const CertPdf = ref('')
- const CertColumns = [
- {key: 'fileName', name: '文件名称'},
- {key: 'action', name: '操作', width: 100}
- ]
- //批量认证弹窗
- const showCertificationModal = ref(false)
- const certificationModalClick = () => {
- const rows = tableCheckedKeys.value;
- const result = rows.every(({isCertification}) => {
- return isCertification === 0
- })
- if (result) {
- CertData.value = rows
- CertIds.value = rowsToId(rows)
- CertPdf.value = rows[0]?.pdfFileUrl || ''
- showCertificationModal.value = true
- } else {
- window.$message?.warning('已认证的文件不能再认证')
- }
- }
- //认证行被点击
- const CertRowClick = ({row}) => {
- const pdfFileUrl = row?.pdfFileUrl || ''
- if (CertPdf.value !== pdfFileUrl) {
- CertPdf.value = pdfFileUrl
- }
- }
- //认证预览被点击
- const CertRowClick2 = ({pdfFileUrl}) => {
- const pdfUrl = pdfFileUrl || ''
- if (CertPdf.value !== pdfUrl) {
- CertPdf.value = pdfUrl
- }
- }
- //确认认证
- const CertLoading = ref(false)
- const CertClick = async () => {
- CertLoading.value = true
- const {error, code} = await projectScanningApi.batchCertification({
- ids: CertIds.value
- }, false)
- //判断状态
- CertLoading.value = false
- if (!error && code === 200) {
- window.$message?.success('认证成功')
- showCertificationModal.value = false
- getTableData()
- } else {
- window.$message?.error('认证失败')
- }
- }
- //批量删除
- const batchDel = () => {
- const rows = tableCheckedKeys.value;
- const result = rows.every(({status}) => {
- return status === 0
- })
- if (result) {
- const ids = rowsToId(rows)
- window?.$messageBox?.alert('请谨慎考虑是否要 批量删除文件?', '删除文件', {
- type: 'error',
- showCancelButton: true,
- confirmButtonText: '确定删除',
- cancelButtonText: '取消',
- callback: (action) => {
- if (action === 'confirm') {
- removeArchiveFile(ids)
- }
- }
- })
- } else {
- window.$message?.warning('已上报的文件需要先废除,才能执行删除')
- }
- }
- //确认批量删除
- const removeArchiveFile = async (ids) => {
- const {error, code} = await projectScanningApi.removeArchiveFile({
- ids: ids
- }, false)
- //判断状态
- CertLoading.value = false
- if (!error && code === 200) {
- window.$message?.success('删除成功')
- getTableData()
- } else {
- window.$message?.error('删除失败')
- }
- }
- //批量废除
- const batchAbolishClick = () => {
- const rows = tableCheckedKeys.value;
- const result = rows.every(({status}) => {
- return status > 0
- })
- if (result) {
- const ids = rowsToId(rows)
- window?.$messageBox?.alert('是否废除勾选的已上报文件?', '确认操作', {
- type: 'warning',
- showCancelButton: true,
- confirmButtonText: '确定废除',
- cancelButtonText: '取消',
- callback: (action) => {
- if (action === 'confirm') {
- batchAbolishSave(ids)
- }
- }
- })
- } else {
- window.$message?.warning('未上报的文件不能废除')
- }
- }
- //确认批量废除
- const batchAbolishSave = async (ids) => {
- const {error, code} = await projectScanningApi.batchAbolishSave({
- ids: ids
- }, false)
- //判断状态
- if (!error && code === 200) {
- window.$message?.success('批量废除成功')
- getTableData()
- } else {
- window.$message?.error('批量废除失败')
- }
- }
- //拼接ID
- const rowsToId = (rows) => {
- return rows.map((obj) => {
- return obj.id;
- }).join(",")
- }
- //左右拖动,改变树形结构宽度
- const leftWidth = ref(382)
- const onmousedown = () => {
- const leftNum = isCollapse.value ? 142 : 272
- document.onmousemove = (ve) => {
- const diffVal = ve.clientX - leftNum;
- if (diffVal >= 310 && diffVal <= 900) {
- leftWidth.value = diffVal;
- }
- }
- document.onmouseup = () => {
- document.onmousemove = null;
- document.onmouseup = null;
- }
- }
- </script>
- <style lang="scss" scoped>
- @import '../../styles/other-file/project-scanning.scss';
- </style>
- <style lang="scss">
- .el-table td.el-table__cell .hc-file-upload-box {
- display: inline-block;
- margin-right: 12px;
- }
- </style>
|