project-scanning.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948
  1. <template>
  2. <div class="hc-layout-box">
  3. <div class="hc-layout-left-box" :style="'width:' + leftWidth + 'px;'">
  4. <div class="hc-project-box">
  5. <div class="hc-project-icon-box">
  6. <HcIcon name="stack"/>
  7. </div>
  8. <div class="ml-2 project-name-box">
  9. <span class="text-xl text-cut project-alias">{{projectInfo['projectAlias']}}</span>
  10. <div class="text-xs text-cut project-name">{{projectInfo['name']}}</div>
  11. </div>
  12. </div>
  13. <div class="hc-tree-box">
  14. <el-scrollbar>
  15. <ProjectTree :datas="ElTreeData" :autoExpandKeys="TreeAutoExpandKeys" @nodeTap="nodeElTreeClick"/>
  16. </el-scrollbar>
  17. </div>
  18. <!--左右拖动-->
  19. <div class="horizontal-drag-line" @mousedown="onmousedown"/>
  20. </div>
  21. <div class="hc-layout-content-box">
  22. <HcCard :scrollbar="false" actionSize="lg">
  23. <template #header>
  24. <HcTooltip keys="project-scanning-upload">
  25. <el-button type="primary" :disabled="!nodeIds" hc-btn @click="uploadModalClick">
  26. <HcIcon name="add-circle"/>
  27. <span>上传文件</span>
  28. </el-button>
  29. </HcTooltip>
  30. <HcTooltip keys="project-scanning-download">
  31. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="batchDownloadLoading" @click="batchDownload">
  32. <HcIcon name="download"/>
  33. <span>批量下载</span>
  34. </el-button>
  35. </HcTooltip>
  36. <HcTooltip keys="project-scanning-report">
  37. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="reportLoading" @click="reportModalClick">
  38. <HcIcon name="send-plane-2"/>
  39. <span>批量上报</span>
  40. </el-button>
  41. </HcTooltip>
  42. <HcTooltip keys="project-scanning-attest">
  43. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="certificationModalClick">
  44. <HcIcon name="vip-diamond"/>
  45. <span>批量认证</span>
  46. </el-button>
  47. </HcTooltip>
  48. <HcTooltip keys="project-scanning-del">
  49. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="batchDel">
  50. <HcIcon name="delete-bin-2"/>
  51. <span>批量删除</span>
  52. </el-button>
  53. </HcTooltip>
  54. <HcTooltip keys="project-scanning-edit">
  55. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="batchEditClick">
  56. <HcIcon name="draft"/>
  57. <span>批量编辑</span>
  58. </el-button>
  59. </HcTooltip>
  60. <HcTooltip keys="project-scanning-abolish">
  61. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="batchAbolishClick">
  62. <HcIcon name="delete-bin-3"/>
  63. <span>批量废除</span>
  64. </el-button>
  65. </HcTooltip>
  66. </template>
  67. <template #search>
  68. <div class="w-32">
  69. <el-select v-model="searchForm.isApprovalValue" placeholder="审批状态" clearable>
  70. <el-option v-for="item in approvalData" :label="item['dictValue']" :value="item['dictKey']"/>
  71. </el-select>
  72. </div>
  73. <div class="w-32 ml-4">
  74. <el-select v-model="searchForm.isCertificationValue" placeholder="认证状态" clearable>
  75. <el-option v-for="item in certificationType" :label="item['dictValue']" :value="item['dictKey']"/>
  76. </el-select>
  77. </div>
  78. <div class="w-64 ml-3">
  79. <el-input v-model="searchForm.queryValue" placeholder="请输入文件名、责任者进行搜索" clearable @keyup="keyUpEvent"/>
  80. </div>
  81. <div class="ml-2">
  82. <el-button type="primary" @click="searchClick">
  83. <HcIcon name="search-2"/>
  84. <span>搜索</span>
  85. </el-button>
  86. </div>
  87. </template>
  88. <HcTable ref="tableListRef" :column="tableListColumn" :datas="tableListData" :loading="tableLoading" isCheck @selection-change="tableSelectionChange">
  89. <template #fileName="{row}">
  90. <span class="text-link" @click="tablePreview(row)">{{row?.fileName}}</span>
  91. </template>
  92. <template #isApprovalValue="{row}">
  93. <el-tag :type="`${row.status === 2 ? 'success' : row.status === 0 ? 'warning' : row.status === 1 ? 'danger' : 'info'}`"
  94. class="mx-1" effect="dark" v-if="row['isApprovalValue']">{{row['isApprovalValue']}}</el-tag>
  95. </template>
  96. </HcTable>
  97. <template #action>
  98. <HcPages :pages="searchForm" @change="pageChange"/>
  99. </template>
  100. </HcCard>
  101. </div>
  102. <!--新增编辑文件-->
  103. <el-dialog v-model="showUploadModal" title="上传工程文件" width="80vw" class="hc-modal-border hc-modal-table">
  104. <HcTable ui="hc-form-table" :column="tableUploadColumn" :datas="tableUploadData" :loading="uploadSaveLoading">
  105. <template #fileNumber="{row}">
  106. <el-input v-model="row.fileNumber" :class="row['isFileNumber'] ? 'is-error' : ''" @input="tableInput($event, row, 'isFileNumber')"/>
  107. </template>
  108. <template #fileName="{row}">
  109. <el-input v-model="row.fileName" :class="row['isFileName'] ? 'is-error' : ''" @input="tableInput($event, row, 'isFileName')"/>
  110. </template>
  111. <template #fileTime="{row}">
  112. <el-date-picker v-model="row.fileTime" type="date" format="YYYY/MM/DD" value-format="YYYY-MM-DD" :clearable="false"/>
  113. </template>
  114. <template #sheetType="{row}" v-if="isBuiltDrawing === 1">
  115. <el-select v-model="row.sheetType">
  116. <el-option v-for="item in sheetType" :key="item['dictKey']" :label="item['dictValue']" :value="item['dictKey']"/>
  117. </el-select>
  118. </template>
  119. <template #sheetSource="{row}" v-if="isBuiltDrawing === 1">
  120. <el-select v-model="row.sheetSource">
  121. <el-option v-for="item in sheetSourceType" :key="item['dictKey']" :label="item['dictValue']" :value="item['dictKey']"/>
  122. </el-select>
  123. </template>
  124. <template #drawingNo="{row}" v-if="isBuiltDrawing === 1">
  125. <el-input v-model="row.drawingNo"/>
  126. </template>
  127. <template #citeChangeNumber="{row}" v-if="isBuiltDrawing === 1">
  128. <el-input v-model="row.citeChangeNumber"/>
  129. </template>
  130. <template #isApproval="{row}">
  131. <el-select v-model="row.isApproval">
  132. <el-option v-for="item in whetherData" :key="item.value" :label="item.label" :value="item.value"/>
  133. </el-select>
  134. </template>
  135. <template #isNeedCertification="{row}">
  136. <el-select v-model="row.isNeedCertification">
  137. <el-option v-for="item in whetherData" :key="item.value" :label="item.label" :value="item.value"/>
  138. </el-select>
  139. </template>
  140. <template #dutyUser="{row}">
  141. <el-input v-model="row.dutyUser"/>
  142. </template>
  143. <template #action="{row,index}">
  144. <HcFileUpload1 @change="newUploadsChange($event, row)" @progress="newUploadsProgress($event, row)" v-if="row.id">
  145. <el-button type="primary" plain size="small" :loading="row['newBtnLoading']">上传新文件</el-button>
  146. </HcFileUpload1>
  147. <el-button type="danger" plain size="small" :loading="row['delBtnLoading']" @click="delUploadData(row,index)">删除</el-button>
  148. </template>
  149. </HcTable>
  150. <template #footer>
  151. <div class="lr-dialog-footer">
  152. <div class="left flex items-center">
  153. <HcFileUpload @change="uploadsChange" @progress="uploadsProgress">
  154. <el-button type="primary" hc-btn :loading="uploadsLoading" :disabled="uploadSaveLoading">
  155. <HcIcon name="add-circle"/>
  156. <span>新增上传</span>
  157. </el-button>
  158. </HcFileUpload>
  159. </div>
  160. <div class="right">
  161. <el-button size="large" @click="batchUploadCancel">
  162. <HcIcon name="close"/>
  163. <span>取消</span>
  164. </el-button>
  165. <el-button type="primary" hc-btn :disabled="uploadsLoading" :loading="uploadSaveLoading" @click="batchUploadSave">
  166. <HcIcon name="save"/>
  167. <span>提交保存</span>
  168. </el-button>
  169. </div>
  170. </div>
  171. </template>
  172. </el-dialog>
  173. <!--批量上报审批-->
  174. <HcReportModal
  175. title="批量上报审批"
  176. url="archiveFile/batchApproval"
  177. :show="showReportModal"
  178. :projectId="projectId"
  179. :contractId="contractId"
  180. :taskName="reportTaskName"
  181. :ids="reportIds"
  182. isDatas
  183. :datas="reportDatas"
  184. @hide="showReportModal = false"
  185. @finish="showReportFinish"
  186. @tagClose="reportTaskTagClose"
  187. />
  188. <!--批量认证-->
  189. <el-dialog v-model="showCertificationModal" title="批量认证" width="80vw" class="hc-modal-border hc-modal-table">
  190. <div class="hc-card-body-flex">
  191. <div class="flex-table">
  192. <HcTable ui="hc-form-table" :column="CertColumns" :datas="CertData" @row-click="CertRowClick">
  193. <template #action="{row,index}">
  194. <el-button type="primary" plain size="small" @click.stop="CertRowClick2(row)">预览</el-button>
  195. </template>
  196. </HcTable>
  197. </div>
  198. <div class="flex-iframe" v-if="CertPdf">
  199. <iframe allow="display-capture" width='100%' height='100%' frameborder='1' :src="CertPdf"></iframe>
  200. </div>
  201. <div class="flex-iframe hc-no-table-form" v-else>
  202. <div class="table-form-no">
  203. <img :src="notableform" alt=""/>
  204. <div class="desc">暂无 PDF 数据</div>
  205. </div>
  206. </div>
  207. </div>
  208. <template #footer>
  209. <div class="dialog-footer">
  210. <el-button size="large" @click="showCertificationModal = false">
  211. <HcIcon name="close"/>
  212. <span>取消</span>
  213. </el-button>
  214. <el-button type="primary" hc-btn :loading="CertLoading" @click="CertClick">
  215. <HcIcon name="save"/>
  216. <span>确认认证</span>
  217. </el-button>
  218. </div>
  219. </template>
  220. </el-dialog>
  221. </div>
  222. </template>
  223. <script setup>
  224. import {onMounted, ref, watch} from 'vue'
  225. import {useAppStore} from "~src/store";
  226. import {useRouter, useRoute} from 'vue-router'
  227. import ProjectTree from "./components/ProjectTree.vue"
  228. import HcFileUpload from "./components/HcFileUpload.vue"
  229. import HcFileUpload1 from "./components/HcFileUpload1.vue"
  230. import {getStoreData, setStoreData} from '~src/utils/storage'
  231. import projectScanningApi from "~api/other-file/projectScanning";
  232. import {downloadBlob, getArrValue, deepClone} from "vue-utils-plus"
  233. import notableform from '~src/assets/view/notableform.svg';
  234. import {eVisaTaskCheckApi} from "~api/other"
  235. import tasksDataApi from '~api/tasks/data';
  236. import ossApi from "~api/oss";
  237. import dayjs from "dayjs"
  238. //变量
  239. const router = useRouter()
  240. const useRoutes = useRoute()
  241. const useAppState = useAppStore()
  242. const projectId = ref(useAppState.getProjectId);
  243. const contractId = ref(useAppState.getContractId);
  244. const projectInfo = ref(useAppState.getProjectInfo);
  245. const isCollapse = ref(useAppState.getCollapse)
  246. //监听
  247. watch(() => [
  248. useAppState.getCollapse
  249. ], ([Collapse]) => {
  250. isCollapse.value = Collapse
  251. })
  252. //自动展开缓存
  253. const TreeAutoExpandKeys = ref(getStoreData('scanningTreeExpandKeys') || [])
  254. const dayDate = ref('')
  255. //渲染完成
  256. onMounted(() => {
  257. getClassIfyList()
  258. firstTaskStatus()
  259. certificationStatus()
  260. dayDate.value = dayjs(new Date()).format('YYYY-MM-DD')
  261. })
  262. //获取树的数据
  263. const ElTreeData = ref([])
  264. const getClassIfyList = async () => {
  265. const { error, code, data } = await projectScanningApi.getClassIfyList({
  266. projectId: projectId.value,
  267. contractId: contractId.value
  268. })
  269. //处理数据
  270. if (!error && code === 200) {
  271. ElTreeData.value = getArrValue(data)
  272. } else {
  273. ElTreeData.value = []
  274. }
  275. }
  276. //项目树被点击
  277. const treeNodeInfo = ref({})
  278. const treeDataInfo = ref({})
  279. const nodeIds = ref('')
  280. const isStorageNode = ref(0)
  281. const isBuiltDrawing = ref(0)
  282. const nodeElTreeClick = ({node, data, keys, key}) => {
  283. treeNodeInfo.value = node
  284. treeDataInfo.value = data
  285. //设置变量
  286. nodeIds.value = key || ''
  287. isStorageNode.value = data['isStorageNode'] || 0
  288. isBuiltDrawing.value = data['isBuiltDrawing'] || 0
  289. //设置搜索数据
  290. searchForm.value.current = 1;
  291. searchForm.value.nodeIds = key || ''
  292. setTableColumns()
  293. getTableData()
  294. //缓存展开的节点
  295. setStoreData('scanningTreeExpandKeys', keys)
  296. }
  297. //获取任务类型
  298. const approvalData = ref([])
  299. const firstTaskStatus = async () => {
  300. const { error, code, data } = await tasksDataApi.queryTaskTypeStatus({
  301. typeOrStatus: 'first_task_status'
  302. })
  303. //处理数据
  304. if (!error && code === 200) {
  305. approvalData.value = getArrValue(data)
  306. } else {
  307. approvalData.value = []
  308. }
  309. }
  310. //获取认证状态
  311. const certificationType = ref([])
  312. const certificationStatus = async () => {
  313. const { error, code, data } = await tasksDataApi.queryTaskTypeStatus({
  314. typeOrStatus: 'certification_status'
  315. })
  316. //处理数据
  317. if (!error && code === 200) {
  318. certificationType.value = getArrValue(data)
  319. } else {
  320. certificationType.value = []
  321. }
  322. }
  323. //获取图幅类型
  324. const sheetType = ref([])
  325. const sheetTypeStatus = async () => {
  326. const { error, code, data } = await tasksDataApi.queryTaskTypeStatus({
  327. typeOrStatus: 'sheet_type'
  328. })
  329. //处理数据
  330. if (!error && code === 200) {
  331. sheetType.value = getArrValue(data)
  332. } else {
  333. sheetType.value = []
  334. }
  335. }
  336. //获取图表来源
  337. const sheetSourceType = ref([])
  338. const sheetSourceStatus = async () => {
  339. const { error, code, data } = await tasksDataApi.queryTaskTypeStatus({
  340. typeOrStatus: 'sheet_source'
  341. })
  342. //处理数据
  343. if (!error && code === 200) {
  344. sheetSourceType.value = getArrValue(data)
  345. } else {
  346. sheetSourceType.value = []
  347. }
  348. }
  349. //搜索表单
  350. const searchForm = ref({
  351. nodeIds: '', isApprovalValue: null, isCertificationValue: null, queryValue: null,
  352. current: 1, size: 20, total: 0
  353. })
  354. //回车搜索
  355. const keyUpEvent = (e) => {
  356. if (e.key === "Enter") {
  357. searchClick()
  358. }
  359. }
  360. //搜索
  361. const searchClick = () => {
  362. if (nodeIds.value) {
  363. searchForm.value.current = 1;
  364. getTableData()
  365. } else {
  366. window?.$message?.warning('请先在左边选择一个树节点')
  367. }
  368. }
  369. //分页被点击
  370. const pageChange = ({current, size}) => {
  371. searchForm.value.current = current
  372. searchForm.value.size = size
  373. getTableData()
  374. }
  375. //设置表头
  376. const tableListColumn = ref([
  377. {key:'fileNumber', name: '文件编号', width: 160},
  378. {key:'fileName', name: '文件名称'},
  379. {key:'filePage', name: '文件页数', width: 120},
  380. {key:'isCertificationValue', name: '认证状态', width: 160},
  381. {key:'isApprovalValue', name: '状态', width: 160},
  382. {key:'fileTime', name: '文件时间', width: 160},
  383. {key:'dutyUser', name: '责任者', width: 160}
  384. ])
  385. const setTableColumns = () => {
  386. if (isBuiltDrawing.value === 1) {
  387. tableListColumn.value = [
  388. {key:'fileNumber', name: '文件编号', width: 160},
  389. {key:'fileName', name: '文件名称'},
  390. {key:'filePage', name: '文件页数', width: 120},
  391. {key:'sheetType', name: '图幅'},
  392. {key:'sheetSourceValue', name: '图表来源'},
  393. {key:'drawingNo', name: '图号'},
  394. {key:'citeChangeNumber', name: '引用变更令编号'},
  395. {key:'isCertificationValue', name: '认证状态', width: 160},
  396. {key:'isApprovalValue', name: '状态', width: 160},
  397. {key:'fileTime', name: '文件时间', width: 160},
  398. {key:'dutyUser', name: '责任者', width: 160}
  399. ]
  400. sheetTypeStatus()
  401. sheetSourceStatus()
  402. } else {
  403. tableListColumn.value = [
  404. {key:'fileNumber', name: '文件编号', width: 160},
  405. {key:'fileName', name: '文件名称'},
  406. {key:'filePage', name: '文件页数', width: 120},
  407. {key:'isCertificationValue', name: '认证状态', width: 160},
  408. {key:'isApprovalValue', name: '状态', width: 160},
  409. {key:'fileTime', name: '文件时间', width: 160},
  410. {key:'dutyUser', name: '责任者', width: 160}
  411. ]
  412. }
  413. }
  414. //获取数据
  415. const tableLoading = ref(false)
  416. const tableListData = ref([])
  417. const getTableData = async () => {
  418. tableLoading.value = true
  419. const {error, code, data} = await projectScanningApi.getarchiveFilePage({
  420. ...searchForm.value,
  421. projectId: projectId.value,
  422. contractId: contractId.value
  423. })
  424. //判断状态
  425. tableLoading.value = false
  426. if (!error && code === 200) {
  427. tableListData.value = getArrValue(data['records'])
  428. searchForm.value.total = data['total'] || 0
  429. } else {
  430. tableListData.value = []
  431. searchForm.value.total = 0
  432. }
  433. }
  434. //多选
  435. const tableListRef = ref(null)
  436. const tableCheckedKeys = ref([]);
  437. const tableSelectionChange = (rows) => {
  438. tableCheckedKeys.value = rows.filter((item) => {
  439. return (item??'') !== '';
  440. })
  441. }
  442. //文件名称被点击
  443. const tablePreview = (row) => {
  444. const pdfUrl = row['pdfFileUrl'] || ''
  445. const evisaFile = row['evisaFile'] || ''
  446. if (evisaFile) {
  447. window.open(evisaFile,'_blank')
  448. } else if (pdfUrl) {
  449. window.open(pdfUrl,'_blank')
  450. } else {
  451. window.$message?.warning('该数据暂无PDF')
  452. }
  453. }
  454. //新增文件
  455. const tableUploadType = ref('add')
  456. const showUploadModal = ref(false)
  457. const uploadModalClick = () => {
  458. if (nodeIds.value && isStorageNode.value === 1) {
  459. tableUploadType.value = 'add'
  460. setTableUploadColumn()
  461. uploadSaveLoading.value = false
  462. tableUploadData.value = []
  463. showUploadModal.value = true
  464. } else {
  465. window?.$message?.warning('请先选择一个子节点')
  466. }
  467. }
  468. //设置文件表头
  469. const tableUploadColumn = ref([
  470. {key:'fileNumber', name: '文件编号'},
  471. {key:'fileName', name: '文件名称'},
  472. {key:'fileTime', name: '文件时间'},
  473. {key:'isApproval', name: '是否需要审批'},
  474. {key:'isNeedCertification', name: '是否需要认证'},
  475. {key:'dutyUser', name: '责任者'},
  476. {key:'action', name: '操作', width: 180}
  477. ])
  478. const setTableUploadColumn = () => {
  479. if (isBuiltDrawing.value === 1) {
  480. tableUploadColumn.value = [
  481. {key:'fileNumber', name: '文件编号'},
  482. {key:'fileName', name: '文件名称'},
  483. {key:'fileTime', name: '文件时间'},
  484. {key:'sheetType', name: '图幅'},
  485. {key:'sheetSource', name: '图表来源'},
  486. {key:'drawingNo', name: '图号'},
  487. {key:'citeChangeNumber', name: '引用变更令编号'},
  488. {key:'isApproval', name: '是否需要审批'},
  489. {key:'isNeedCertification', name: '是否需要认证'},
  490. {key:'dutyUser', name: '责任者'},
  491. {key:'action', name: '操作', width: 180}
  492. ]
  493. } else {
  494. tableUploadColumn.value = [
  495. {key:'fileNumber', name: '文件编号'},
  496. {key:'fileName', name: '文件名称'},
  497. {key:'fileTime', name: '文件时间'},
  498. {key:'isApproval', name: '是否需要审批'},
  499. {key:'isNeedCertification', name: '是否需要认证'},
  500. {key:'dutyUser', name: '责任者'},
  501. {key:'action', name: '操作', width: 180}
  502. ]
  503. }
  504. }
  505. const tableUploadData = ref([])
  506. //上传的文件结果
  507. const uploadsChange = ({fileList}) => {
  508. let newArr = []
  509. const sheet = sheetType.value, source = sheetSourceType.value
  510. for (let i = 0; i < fileList.length; i++) {
  511. const item = fileList[i]
  512. let name = item['originalName'] || ''
  513. let fileName = name.substring(0, name.lastIndexOf("."))
  514. newArr.push({
  515. projectId: projectId.value,
  516. contractId: contractId.value,
  517. nodeId: nodeIds.value,
  518. fileNumber: '',
  519. fileName: fileName,
  520. ossFileName: item?.name || '',
  521. fileTime: dayDate.value,
  522. fileUrl: item?.link || '',
  523. sheetType: sheet.length > 0 ? sheet[0]['dictKey'] || '': '',
  524. sheetSource: source.length > 0 ? source[0]['dictKey'] || '': '',
  525. drawingNo: '',
  526. citeChangeNumber: '',
  527. isApproval: 0,
  528. isNeedCertification: 0,
  529. dutyUser: '',
  530. pdfFileUrl: item?.pdfUrl || '',
  531. filePage: item?.page || '',
  532. })
  533. }
  534. tableUploadData.value = newArr
  535. }
  536. //上传进度
  537. const uploadsLoading = ref(false)
  538. const uploadsProgress = (val) => {
  539. uploadsLoading.value = val
  540. }
  541. //表单下拉数据
  542. const whetherData = ref([{label: "不需要", value: 0}, {label: "需要", value: 1}])
  543. //输入框验证
  544. const tableInput = (val,row,isv) => {
  545. if (val) {
  546. row[isv] = false
  547. } else {
  548. row[isv] = true
  549. }
  550. }
  551. //上传新文件
  552. const newUploadsChange = ({fileList}, row) => {
  553. if (fileList.length > 0) {
  554. const item = fileList[0]
  555. const name = item['originalName'] || ''
  556. const fileName = name.substring(0, name.lastIndexOf("."))
  557. //更新数据
  558. row.fileName = fileName;
  559. row.ossFileName = item?.name || ''
  560. row.fileUrl = item?.link || ''
  561. row.pdfFileUrl = item?.pdfUrl || ''
  562. row.filePage = item?.page || ''
  563. }
  564. }
  565. const newUploadsProgress = (val, row) => {
  566. row.newBtnLoading = val
  567. }
  568. //删除
  569. const delUploadData = async (row,index) => {
  570. if (row['ossFileName']) {
  571. row['delBtnLoading'] = true
  572. await ossApi.removeFile({fileName: row['ossFileName']})
  573. row['delBtnLoading'] = false
  574. tableUploadData.value.splice(index,1);
  575. } else {
  576. tableUploadData.value.splice(index,1);
  577. }
  578. }
  579. //批量上传保存
  580. const uploadSaveLoading = ref(false)
  581. const batchUploadSave = async () => {
  582. const rows = tableUploadData.value
  583. if (rows.length > 0) {
  584. //验证表单数据
  585. uploadSaveLoading.value = true
  586. let isTableRows = false;
  587. for (let i = 0; i < rows.length; i++) {
  588. if (!rows[i]['fileNumber']) {
  589. rows[i]['isFileNumber'] = true
  590. isTableRows = true
  591. } else if (!rows[i]['fileName']) {
  592. rows[i]['isFileName'] = true
  593. isTableRows = true
  594. }
  595. }
  596. //判断数据
  597. if (isTableRows) {
  598. uploadSaveLoading.value = false
  599. window.$message?.warning('请先完善表单信息')
  600. } else {
  601. if (tableUploadType.value === 'add') {
  602. await batchUploadSaveApi(rows)
  603. } else {
  604. await batchEditSaveApi(rows)
  605. }
  606. }
  607. } else {
  608. window.$message?.warning('请先上传文件')
  609. }
  610. }
  611. //确认上传保存
  612. const batchUploadSaveApi = async (rows) => {
  613. uploadSaveLoading.value = true
  614. const {error, code} = await projectScanningApi.batchUploadSave({
  615. list: rows
  616. },false)
  617. //判断状态
  618. uploadSaveLoading.value = false
  619. if (!error && code === 200) {
  620. window.$message?.success('保存成功')
  621. batchUploadCancel()
  622. getTableData()
  623. } else {
  624. window.$message?.error('保存失败')
  625. }
  626. }
  627. //取消上传
  628. const batchUploadCancel = () => {
  629. tableUploadData.value = []
  630. uploadSaveLoading.value = false
  631. uploadsLoading.value = false
  632. showUploadModal.value = false
  633. }
  634. //批量编辑
  635. const batchEditClick = () => {
  636. const rows = deepClone(tableCheckedKeys.value)
  637. //判断是否满足条件
  638. const result = rows.every(({status})=> {
  639. return status !== 1 && status !== 2
  640. })
  641. console.log(rows)
  642. //判断状态
  643. if (result) {
  644. tableUploadType.value = 'edit'
  645. setTableUploadColumn()
  646. uploadSaveLoading.value = false
  647. tableUploadData.value = rows
  648. showUploadModal.value = true
  649. } else {
  650. window.$message?.warning('已上报或已审批的文件不能编辑')
  651. }
  652. }
  653. //确认编辑上传保存
  654. const batchEditSaveApi = async (rows) => {
  655. uploadSaveLoading.value = true
  656. const {error, code} = await projectScanningApi.batchEditSave({
  657. list: rows
  658. },false)
  659. //判断状态
  660. uploadSaveLoading.value = false
  661. if (!error && code === 200) {
  662. window.$message?.success('保存成功')
  663. batchUploadCancel()
  664. getTableData()
  665. } else {
  666. window.$message?.error('保存失败')
  667. }
  668. }
  669. //批量下载
  670. const batchDownloadLoading = ref(false)
  671. const batchDownload = async () => {
  672. const rows = deepClone(tableCheckedKeys.value)
  673. const ids = rowsToId(rows)
  674. //批量下载
  675. batchDownloadLoading.value = true
  676. const { error, disposition, res } = await projectScanningApi.batchDownloadFileToZip({ids: ids})
  677. //处理数据
  678. batchDownloadLoading.value = false
  679. if (!error) {
  680. if (disposition) {
  681. downloadBlob(res,disposition)
  682. } else {
  683. window.$message?.error('数据异常')
  684. }
  685. }
  686. }
  687. //批量上报
  688. const reportIds = ref('')
  689. const reportTaskName = ref('')
  690. const reportDatas = ref([])
  691. const showReportModal = ref(false)
  692. const reportLoading = ref(false)
  693. const reportModalClick = async () => {
  694. const rows = tableCheckedKeys.value;
  695. const result = rows.every(({status})=> {
  696. return status === 0 //isApproval !== 1 && status !== 0 || isApproval === 1 && status !== 0
  697. })
  698. if (result) {
  699. reportLoading.value = true
  700. const taskCheck = await eVisaTaskCheckApi({
  701. projectId: projectId.value,
  702. contractId: contractId.value
  703. })
  704. if (taskCheck) {
  705. reportIds.value = rowsToId(rows)
  706. //设置任务数据
  707. let reportDataArr = []
  708. rows.forEach(item => {
  709. reportDataArr.push({
  710. id: item?.id,
  711. name: item?.fileName
  712. })
  713. })
  714. reportDatas.value = reportDataArr
  715. //设置任务名称
  716. reportTaskName.value = rows.length > 1?`${rows[0].fileName}等${rows.length}个文件`:rows[0].fileName
  717. reportLoading.value = false
  718. showReportModal.value = true
  719. } else {
  720. reportLoading.value = false
  721. }
  722. } else {
  723. window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
  724. }
  725. }
  726. //上报的审批内容移除
  727. const reportTaskTagClose = (index) => {
  728. const row = tableCheckedKeys.value[index];
  729. tableListRef.value?.toggleRowSelection(row,false)
  730. }
  731. //上报完成
  732. const showReportFinish = () => {
  733. showReportModal.value = false
  734. getTableData()
  735. }
  736. //批量认证
  737. const CertData = ref([])
  738. const CertIds = ref([])
  739. const CertPdf = ref('')
  740. const CertColumns = [
  741. {key:'fileName', name: '文件名称'},
  742. {key:'action', name: '操作', width: 100}
  743. ]
  744. //批量认证弹窗
  745. const showCertificationModal = ref(false)
  746. const certificationModalClick = () => {
  747. const rows = tableCheckedKeys.value;
  748. const result = rows.every(({isCertification})=> {
  749. return isCertification === 0
  750. })
  751. if (result) {
  752. CertData.value = rows
  753. CertIds.value = rowsToId(rows)
  754. CertPdf.value = rows[0]?.pdfFileUrl || ''
  755. showCertificationModal.value = true
  756. } else {
  757. window.$message?.warning('已认证的文件不能再认证')
  758. }
  759. }
  760. //认证行被点击
  761. const CertRowClick = ({row}) => {
  762. const pdfFileUrl = row?.pdfFileUrl || ''
  763. if (CertPdf.value !== pdfFileUrl) {
  764. CertPdf.value = pdfFileUrl
  765. }
  766. }
  767. //认证预览被点击
  768. const CertRowClick2 = ({pdfFileUrl}) => {
  769. const pdfUrl = pdfFileUrl || ''
  770. if (CertPdf.value !== pdfUrl) {
  771. CertPdf.value = pdfUrl
  772. }
  773. }
  774. //确认认证
  775. const CertLoading = ref(false)
  776. const CertClick = async () => {
  777. CertLoading.value = true
  778. const {error, code} = await projectScanningApi.batchCertification({
  779. ids: CertIds.value
  780. }, false)
  781. //判断状态
  782. CertLoading.value = false
  783. if (!error && code === 200) {
  784. window.$message?.success('认证成功')
  785. showCertificationModal.value = false
  786. getTableData()
  787. } else {
  788. window.$message?.error('认证失败')
  789. }
  790. }
  791. //批量删除
  792. const batchDel = () => {
  793. const rows = tableCheckedKeys.value;
  794. const result = rows.every(({status})=> {
  795. return status === 0
  796. })
  797. if (result) {
  798. const ids = rowsToId(rows)
  799. window?.$messageBox?.alert('请谨慎考虑是否要 批量删除文件?', '删除文件', {
  800. type: 'error',
  801. showCancelButton: true,
  802. confirmButtonText: '确定删除',
  803. cancelButtonText: '取消',
  804. callback: (action) => {
  805. if (action === 'confirm') {
  806. removeArchiveFile(ids)
  807. }
  808. }
  809. })
  810. } else {
  811. window.$message?.warning('已上报的文件需要先废除,才能执行删除')
  812. }
  813. }
  814. //确认批量删除
  815. const removeArchiveFile = async (ids) => {
  816. const {error, code} = await projectScanningApi.removeArchiveFile({
  817. ids: ids
  818. }, false)
  819. //判断状态
  820. CertLoading.value = false
  821. if (!error && code === 200) {
  822. window.$message?.success('删除成功')
  823. getTableData()
  824. } else {
  825. window.$message?.error('删除失败')
  826. }
  827. }
  828. //批量废除
  829. const batchAbolishClick = () => {
  830. const rows = tableCheckedKeys.value;
  831. const result = rows.every(({status})=> {
  832. return status > 0
  833. })
  834. if (result) {
  835. const ids = rowsToId(rows)
  836. window?.$messageBox?.alert('是否废除勾选的已上报文件?', '确认操作', {
  837. type: 'warning',
  838. showCancelButton: true,
  839. confirmButtonText: '确定废除',
  840. cancelButtonText: '取消',
  841. callback: (action) => {
  842. if (action === 'confirm') {
  843. batchAbolishSave(ids)
  844. }
  845. }
  846. })
  847. } else {
  848. window.$message?.warning('未上报的文件不能废除')
  849. }
  850. }
  851. //确认批量废除
  852. const batchAbolishSave = async (ids) => {
  853. const {error, code} = await projectScanningApi.batchAbolishSave({
  854. ids: ids
  855. }, false)
  856. //判断状态
  857. if (!error && code === 200) {
  858. window.$message?.success('批量废除成功')
  859. getTableData()
  860. } else {
  861. window.$message?.error('批量废除失败')
  862. }
  863. }
  864. //拼接ID
  865. const rowsToId = (rows) => {
  866. return rows.map((obj) => {
  867. return obj.id;
  868. }).join(",")
  869. }
  870. //左右拖动,改变树形结构宽度
  871. const leftWidth = ref(382)
  872. const onmousedown = () => {
  873. const leftNum = isCollapse.value ? 142 : 272
  874. document.onmousemove = (ve) => {
  875. const diffVal = ve.clientX - leftNum;
  876. if(diffVal >= 310 && diffVal <= 900) {
  877. leftWidth.value = diffVal;
  878. }
  879. }
  880. document.onmouseup = () => {
  881. document.onmousemove = null;
  882. document.onmouseup = null;
  883. }
  884. }
  885. </script>
  886. <style lang="scss" scoped>
  887. @import '../../styles/other-file/project-scanning.scss';
  888. </style>
  889. <style lang="scss">
  890. .el-table td.el-table__cell .hc-file-upload-box {
  891. display: inline-block;
  892. margin-right: 12px;
  893. }
  894. </style>