collection.vue 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777
  1. <template>
  2. <hc-body :loading="treeLoading" :project-nmae="projectInfo.name" class="hc-file-collection-page" split>
  3. <template #tree>
  4. <HcTree
  5. ref="treeRef" :auto-expand-keys="treeAutoExpandKeys" :contract-id="contractId" :menus="ElTreeMenu"
  6. :project-id="projectId"
  7. @node-tap="projectTreeClick" @node-loading="treeNodeLoading" @menu-tap="ElTreeMenuClick"
  8. />
  9. </template>
  10. <hc-new-card>
  11. <template #header>
  12. <HcTooltip keys="file_collection_btn_upload_scanned_files">
  13. <el-button hc-btn type="primary" @click="uploadModalClick">上传扫描文件</el-button>
  14. </HcTooltip>
  15. <HcTooltip keys="file_collection_btn_sorting">
  16. <el-button hc-btn type="success" @click="sortingClick">分盒整理</el-button>
  17. </HcTooltip>
  18. <HcTooltip keys="file_collection_btn_download">
  19. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn>下载</el-button>
  20. </HcTooltip>
  21. <HcTooltip keys="file_collection_btn_certified">
  22. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="certificationModalClick">认证</el-button>
  23. </HcTooltip>
  24. <HcTooltip keys="file_collection_btn_report">
  25. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn type="warning" @click="reportModalClick">上报</el-button>
  26. </HcTooltip>
  27. <HcTooltip keys="file_collection_btn_edit">
  28. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="batchEditClick">编辑</el-button>
  29. </HcTooltip>
  30. <HcTooltip keys="file_collection_btn_repeal">
  31. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="repealModalClick">废除</el-button>
  32. </HcTooltip>
  33. <HcTooltip keys="file_collection_btn_del">
  34. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn type="danger" @click="delModalClick">删除</el-button>
  35. </HcTooltip>
  36. <el-button :disabled="tableCheckedKeys.length <= 0" :loading="onlineLoading" color="#e03997" hc-btn @click="batchOnline">在线验签</el-button>
  37. </template>
  38. <template #extra>
  39. <HcTooltip keys="file_collection_btn_moves">
  40. <el-button color="#626aef" hc-btn @click="movesClick">跨目录移动</el-button>
  41. </HcTooltip>
  42. </template>
  43. <template #search>
  44. <div class="w-40">
  45. <el-select v-model="searchForm.isApprovalValue" clearable placeholder="审批状态">
  46. <el-option v-for="item in approvalStatus" :key="item.value" :label="item.label" :value="item.value" />
  47. </el-select>
  48. </div>
  49. <div class="ml-2 w-40">
  50. <el-select v-model="searchForm.isCertificationValue" clearable placeholder="认证状态">
  51. <el-option v-for="item in certifiedStatus" :key="item.value" :label="item.label" :value="item.value" />
  52. </el-select>
  53. </div>
  54. <div class="ml-2 w-64">
  55. <el-input v-model="searchForm.queryValue" clearable placeholder="请输入名称关键词检索" @keyup="keyUpEvent" />
  56. </div>
  57. <div class="ml-2">
  58. <el-button type="primary" @click="searchClick">搜索</el-button>
  59. </div>
  60. </template>
  61. <HcTable
  62. ref="tableRef" :check-style="{ width: 29 }" :column="tableColumn" :datas="tableData"
  63. :index-style="{ width: 80 }" :loading="tableLoading" is-check is-new
  64. @selection-change="tableSelection"
  65. >
  66. <template #table-column-header-num>
  67. <HcTooltip keys="file_collection_btn_sort">
  68. <span class="text-link text-lg" @click="tableSortClick">
  69. <HcIcon name="arrow-up-down" />
  70. </span>
  71. </HcTooltip>
  72. </template>
  73. <template #isApprovalValue="{ row }">
  74. <el-tag v-if="row?.isApprovalValue" :type="`${row.isApprovalValue === '已审批' ? 'success' : row.isApprovalValue === '待审批' ? 'warning' : row.isApprovalValue === '已废除' ? 'danger' : 'info'}`" class="mx-1" effect="dark">
  75. {{ row.isApprovalValue }}
  76. </el-tag>
  77. </template>
  78. <template #fileName="{ row }">
  79. <span class="text-link" @click="tableRowName(row)">{{ row?.fileName }}</span>
  80. </template>
  81. <template #sourceType="{ row }">
  82. <span>{{ row?.sourceType === 1 ? '原生' : '数字化' }}</span>
  83. </template>
  84. </HcTable>
  85. <template #action>
  86. <HcPages :pages="searchForm" @change="pageChange" />
  87. </template>
  88. </hc-new-card>
  89. <!-- 预组卷整理 -->
  90. <hc-new-dialog v-model="sortingModal" is-row-footer is-table title="预组卷整理" widths="850px" @close="sortingModalClose">
  91. <div class="hc-sorting-modal-collapse">
  92. <el-collapse v-model="sortingActiveKey">
  93. <template v-for="(item, index) in sortingItemData" :key="index">
  94. <el-collapse-item :id="`item-${index}`" :name="`item-${index}`" disabled>
  95. <template #title>
  96. <div class="hc-collapse-item-header">
  97. <div class="item-index">盒{{ index + 1 }}</div>
  98. <el-divider direction="vertical" />
  99. <div class="item-input">
  100. <el-input
  101. v-model="item.boxName" :class="item.isName ? 'is-error' : ''"
  102. placeholder="请输入案卷题名"
  103. @change="tableIsInput($event, item, 'isName')"
  104. @input="tableIsInput($event, item, 'isName')"
  105. />
  106. </div>
  107. <el-divider direction="vertical" />
  108. <div class="item-action">
  109. <el-button type="primary" @click="sortingSelectFile(item, index)">选择文件</el-button>
  110. <el-button type="danger" @click="sortingDelData(item, index)">删除</el-button>
  111. </div>
  112. </div>
  113. </template>
  114. <HcTable
  115. ref="sorTableRef" :check-style="{ width: 29 }" :column="sortingTableColumn" :datas="item.list"
  116. :index-style="{ width: 60 }" :loading="sortingTableLoading" is-check is-new
  117. @selection-change="rows => sortingTableSelection(rows, item.list, index)"
  118. @single-select="singleCheck"
  119. >
  120. <template #name="{ row }">
  121. <span class="text-link">{{ row?.fileName }}</span>
  122. </template>
  123. </HcTable>
  124. </el-collapse-item>
  125. </template>
  126. </el-collapse>
  127. </div>
  128. <template #leftRowFooter>
  129. <el-button hc-btn type="primary" @click="addSortingModalClick">
  130. <HcIcon name="add" />
  131. <span>添加分盒</span>
  132. </el-button>
  133. </template>
  134. <template #rightRowFooter>
  135. <el-button hc-btn @click="sortingModalClose">
  136. <HcIcon name="close" />
  137. <span>取消</span>
  138. </el-button>
  139. <el-button :loading="sortingModalLoading" hc-btn type="primary" @click="sortingModalSave">
  140. <HcIcon name="check" />
  141. <span>确认</span>
  142. </el-button>
  143. </template>
  144. </hc-new-dialog>
  145. <!-- 预组卷整理 无数据 -->
  146. <hc-new-dialog v-model="sortingNoneModal" is-row-footer is-table title="预组卷整理" widths="850px" @close="sortingNoneModalClose">
  147. <div class="flex-center">
  148. <i class="el-icon" data-v-029747aa="" style="font-size: 200px;color:#81b337;cursor: pointer;" @click="toSortingModal">
  149. <svg data-v-029747aa="" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg">
  150. <path d="M512 64a448 448 0 1 1 0 896 448 448 0 0 1 0-896zm-38.4 409.6H326.4a38.4 38.4 0 1 0 0 76.8h147.2v147.2a38.4 38.4 0 0 0 76.8 0V550.4h147.2a38.4 38.4 0 0 0 0-76.8H550.4V326.4a38.4 38.4 0 1 0-76.8 0v147.2z" fill="currentColor" />
  151. </svg>
  152. </i>
  153. <span>添加分盒</span>
  154. </div>
  155. </hc-new-dialog>
  156. <!-- 跨目录移动 -->
  157. <hc-new-dialog v-model="movesModal" :loading="movesModalLoading" is-table title="跨目录移动" widths="990px" @close="movesModalClose" @save="movesModalSave">
  158. <div class="hc-moves-transfer-box">
  159. <div class="hc-moves-transfer-panel">
  160. <div class="panel-header">
  161. <div class="panel-header-label">
  162. <el-checkbox v-model="movesCheckAll" :indeterminate="isIndeterminate" class="space size-xl" @change="handleCheckAllChange">
  163. 选择需要迁移的文件
  164. </el-checkbox>
  165. </div>
  166. <div class="panel-header-extra">{{ checkedMoves.length }}/{{ fileDatasList.length }}</div>
  167. </div>
  168. <div class="panel-body">
  169. <el-scrollbar v-loading="fileDatasListLoading">
  170. <el-checkbox-group v-model="checkedMoves" @change="handleCheckedMovesChange">
  171. <!-- <div v-for="item in fileDatasList" :key="item.id" class="hc-file-checkbox">
  172. <el-checkbox class="size-xl space" :label="item">
  173. {{ item.fileName }}
  174. </el-checkbox>
  175. </div> -->
  176. <recycle-scroller
  177. :buffer="1000" :item-size="110" :items="fileDatasList"
  178. :prerender="200" class="virtual-list" key-field="id"
  179. style="height: 900px"
  180. >
  181. <template #default="{ item, index }">
  182. <div :key="index">
  183. <el-checkbox :value="item" class="space mt-5 size-xl">{{ item.fileName }}</el-checkbox>
  184. </div>
  185. </template>
  186. </recycle-scroller>
  187. </el-checkbox-group>
  188. </el-scrollbar>
  189. </div>
  190. </div>
  191. <div class="hc-moves-transfer-buttons">
  192. <HcIcon name="arrow-right-double" style="font-size: 22px;" type="primary" />
  193. </div>
  194. <div class="hc-moves-transfer-panel">
  195. <div class="panel-header">选择移动目录</div>
  196. <div v-loading="treePanelLoading" class="panel-body">
  197. <el-scrollbar>
  198. <HcTree
  199. :contract-id="contractId" :is-show-menu="false" :project-id="projectId"
  200. :show-radio-fun="showRadioFun" id-prefix="hc-tree-moves-" is-radio
  201. @radio-change="radioChange" @node-loading="panelTreeLoading"
  202. />
  203. </el-scrollbar>
  204. </div>
  205. </div>
  206. </div>
  207. </hc-new-dialog>
  208. <!-- 调整排序 -->
  209. <hc-new-dialog v-model="sortModal" is-row-footer is-table title="调整排序" widths="80vw" @close="sortModalClose">
  210. <el-alert :closable="false" title="可拖动排序,也可在后面点击图标,切换排序" type="error" />
  211. <div class="hc-table-h">
  212. <HcTable
  213. :column="sortTableColumn" :datas="sortTableData" :index-style="{ width: 80 }"
  214. :loading="sortTableLoading"
  215. is-new is-row-drop quick-sort ui="hc-table-row-drop"
  216. @row-drop="sortTableRowDrop" @row-sort="sortTableRowDrop"
  217. >
  218. <template #key2="{ row }">
  219. <span class="text-link">{{ row?.key2 }}</span>
  220. </template>
  221. <template #action="{ index }">
  222. <span class="text-link text-xl" @click="upSortClick(index)">
  223. <HcIcon fill name="arrow-up" />
  224. </span>
  225. <span class="text-link ml-2 text-xl" @click="downSortClick(index)">
  226. <HcIcon fill name="arrow-down" />
  227. </span>
  228. </template>
  229. </HcTable>
  230. </div>
  231. <template #leftRowFooter>
  232. <el-button hc-btn @click="sortModalClose">
  233. <HcIcon name="close" />
  234. <span>取消</span>
  235. </el-button>
  236. <el-button :loading="sortModalLoading" hc-btn type="primary" @click="sortModalSave">
  237. <HcIcon name="check" />
  238. <span>确认</span>
  239. </el-button>
  240. </template>
  241. <template #rightRowFooter>
  242. <HcPages :pages="sortSearchForm" :sizes="[10, 20, 50, 100, 200, 300, 400, 500, 600]" @change="sortPageChange" />
  243. </template>
  244. </hc-new-dialog>
  245. <!-- 新增编辑文件 -->
  246. <hc-new-dialog v-model="showUploadModal" is-table title="上传工程文件" widths="90vw" @close="uploadModalClose">
  247. <HcTable
  248. :column="tableUploadColumn" :datas="tableUploadData" :index-style="{ width: 80 }"
  249. :loading="uploadSaveLoading"
  250. is-new is-sort ui="hc-form-table" @row-sort="tableUploadRowSort"
  251. >
  252. <template #fileNumber="{ row }">
  253. <!-- <el-input v-model="row.fileNumber" :class="row['isFileNumber'] ? 'is-error' : ''" @input="tableIsInput($event, row, 'isFileNumber')"/> -->
  254. <el-input v-model="row.fileNumber" />
  255. </template>
  256. <template #fileName="{ row }">
  257. <el-input v-model="row.fileName" :class="row.isFileName ? 'is-error' : ''" @input="tableIsInput($event, row, 'isFileName')" />
  258. </template>
  259. <template #fileTime="{ row }">
  260. <el-date-picker v-model="row.fileTime" :clearable="false" format="YYYYMMDD" type="date" value-format="YYYYMMDD" />
  261. <!-- <el-input v-model="row.fileTime" :class="row['isFileTime'] ? 'is-error' : ''" @input="tableIsInput($event, row, 'isFileTime')"/> -->
  262. </template>
  263. <template v-if="isBuiltDrawing === 2" #sheetType="{ row }">
  264. <el-select v-model="row.sheetType">
  265. <el-option v-for="item in sheetType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  266. </el-select>
  267. </template>
  268. <template v-if="isBuiltDrawing === 2" #sheetSource="{ row }">
  269. <el-select v-model="row.sheetSource">
  270. <el-option v-for="item in sheetSourceType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  271. </el-select>
  272. </template>
  273. <template v-if="isBuiltDrawing === 2" #drawingNo="{ row }">
  274. <el-input v-model="row.drawingNo" />
  275. </template>
  276. <template v-if="isBuiltDrawing === 2" #citeChangeNumber="{ row }">
  277. <el-input v-model="row.citeChangeNumber" />
  278. </template>
  279. <template #isApproval="{ row }">
  280. <el-select v-model="row.isApproval">
  281. <el-option v-for="item in whetherData" :key="item.value" :label="item.label" :value="item.value" />
  282. </el-select>
  283. </template>
  284. <template #isNeedCertification="{ row }">
  285. <el-select v-model="row.isNeedCertification">
  286. <el-option v-for="item in whetherData" :key="item.value" :label="item.label" :value="item.value" />
  287. </el-select>
  288. </template>
  289. <template #dutyUser="{ row }">
  290. <el-input v-model="row.dutyUser" />
  291. </template>
  292. <template #isElement="{ row }">
  293. <el-select v-model="row.isElement">
  294. <el-option :value="1" label="是" />
  295. <el-option :value="0" label="否" />
  296. </el-select>
  297. </template>
  298. <template #action="{ row, index }">
  299. <el-button v-if="tableUploadType === 'edit'" :loading="row.newBtnLoading" plain size="small" type="primary" @click="substitutionClick(row)">替换</el-button>
  300. <el-button :loading="row.delBtnLoading" class="ml-2" plain size="small" type="danger" @click="delUploadData(row, index)">删除</el-button>
  301. </template>
  302. </HcTable>
  303. <template #footer>
  304. <div class="lr-dialog-footer">
  305. <div class="left flex items-center">
  306. <el-button v-if="tableUploadType === 'add'" hc-btn type="primary" @click="uploadFileClick">
  307. <HcIcon name="add-circle" />
  308. <span>新增上传</span>
  309. </el-button>
  310. </div>
  311. <div class="right">
  312. <el-button size="large" :loading="uploadSaveLoading" @click="batchUploadCancel">
  313. <HcIcon name="close" />
  314. <span>取消</span>
  315. </el-button>
  316. <el-button :loading="uploadSaveLoading" hc-btn type="primary" @click="batchUploadSave">
  317. <HcIcon name="save" />
  318. <span>提交保存</span>
  319. </el-button>
  320. </div>
  321. </div>
  322. </template>
  323. </hc-new-dialog>
  324. <!-- 批量认证 -->
  325. <hc-new-dialog v-model="showCertificationModal" is-table title="批量认证" widths="80vw">
  326. <div class="hc-card-body-flex">
  327. <div class="flex-table">
  328. <HcTable
  329. :column="CertColumns" :datas="CertData" :index-style="{ width: 80 }"
  330. is-new ui="hc-form-table"
  331. @row-click="CertRowClick"
  332. >
  333. <template #action="{ row, index }">
  334. <el-button plain size="small" type="primary" @click.stop="CertRowClick2(row)">预览</el-button>
  335. </template>
  336. </HcTable>
  337. </div>
  338. <div v-if="CertPdf" class="flex-iframe">
  339. <iframe :src="CertPdf" allow="display-capture" frameborder="1" height="100%" width="100%" />
  340. </div>
  341. <div v-else class="flex-iframe hc-no-table-form">
  342. <div class="table-form-no">
  343. <img :src="notableform" alt="">
  344. <div class="desc">暂无 PDF 数据</div>
  345. </div>
  346. </div>
  347. </div>
  348. <template #footer>
  349. <div class="dialog-footer">
  350. <el-button size="large" @click="showCertificationModal = false">
  351. <HcIcon name="close" />
  352. <span>取消</span>
  353. </el-button>
  354. <el-button :loading="CertLoading" hc-btn type="primary" @click="CertClick">
  355. <HcIcon name="save" />
  356. <span>确认认证</span>
  357. </el-button>
  358. </div>
  359. </template>
  360. </hc-new-dialog>
  361. <!-- 批量编辑 -->
  362. <HcReport :data="reportData" :show="isReport" @finish="reportFinish" @hide="isReport = false" />
  363. <!-- 在线验签 -->
  364. <hc-new-drawer v-model="isOnlineVerifyDrawer" modal-class="hc-online-verify-drawer" to-id="app" @close="onlineVerifyDrawerClose">
  365. <hc-new-card>
  366. <template #header>
  367. <div class="online-verify-title">这是标题名称</div>
  368. </template>
  369. <template #extra>
  370. <div class="online-verify-icon" @click="onlineVerifyDrawerClose">
  371. <HcIcon name="close-circle" />
  372. <span class="ml-1">关闭</span>
  373. </div>
  374. </template>
  375. <hc-body :options="onlineVerifyOptions" padding="0px" split>
  376. <template #left>
  377. <hc-new-card>
  378. <HcPdf :src="onlineVerifyData.pdfUrl" />
  379. </hc-new-card>
  380. </template>
  381. <hc-new-card>
  382. <HcTable :column="cscTableColumn" :datas="cscTableData" :index-style="{ width: 60 }" is-new />
  383. </hc-new-card>
  384. </hc-body>
  385. </hc-new-card>
  386. </hc-new-drawer>
  387. </hc-body>
  388. </template>
  389. <script setup>
  390. import { useAppStore } from '~src/store'
  391. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  392. import { nextTick, onMounted, ref, watch } from 'vue'
  393. import HcTree from '~src/components/tree/hc-tree.vue'
  394. import HcReport from './components/HcReport.vue'
  395. import notableform from '~src/assets/view/notableform.svg'
  396. import { rowsToId } from '~uti/tools'
  397. import { HcDelMsg, HcUploadFileApi } from 'hc-vue3-ui'
  398. import archiveFileApi from '~api/archiveFile/archiveFile'
  399. import tasksFlowApi from '~api/tasks/flow'
  400. import { arrKeySort, arrToId, deepClone, getArrValue, getObjVal } from 'js-fast-way'
  401. import tasksApi from '~api/tasks/data'
  402. import ossApi from '~api/oss'
  403. import { toPdfPage } from '~uti/btn-auth'
  404. //变量
  405. const useAppState = useAppStore()
  406. const projectId = ref(useAppState.getProjectId)
  407. const contractId = ref(useAppState.getContractId)
  408. const projectInfo = ref(useAppState.getProjectInfo)
  409. const isCollapse = ref(useAppState.getCollapse)
  410. //上传进度
  411. const uploadsLoading = ref(false)
  412. const treeRef = ref(null)
  413. //监听
  414. watch(() => [
  415. useAppState.getCollapse,
  416. ], ([Collapse]) => {
  417. isCollapse.value = Collapse
  418. })
  419. //渲染完成
  420. onMounted(() => {
  421. treeLoading.value = true
  422. setTableColumns()
  423. })
  424. //设置树菜单数据
  425. const ElTreeMenu = ref([
  426. { icon: 'add-circle', label: '新增', key: 'add' },
  427. { icon: 'draft', label: '编辑', key: 'edit' },
  428. { icon: 'delete-bin', label: '删除', key: 'del' },
  429. { icon: 'refresh', label: '目录同步', key: 'sync' },
  430. { icon: 'sort-asc', label: '排序', key: 'sort' },
  431. ])
  432. const dutyUser = ref('')
  433. //设置责任者
  434. const setdutyUser = async () => {
  435. const { error, code, data } = await archiveFileApi.getDutyUser({
  436. contractId: treecontractId.value,
  437. projectId: projectId.value,
  438. })
  439. if (!error && code === 200) {
  440. if (data?.contractType === 1) {
  441. dutyUser.value = data?.constructionUnitName || ''
  442. } else if (data?.contractType === 2) {
  443. dutyUser.value = data?.supervisionUnitName || ''
  444. } else if (data?.contractType === 3) {
  445. dutyUser.value = data?.contractorUnitName || ''
  446. }
  447. }
  448. }
  449. //打开文件选择框
  450. const uploadFileClick = () => {
  451. HcUploadFileApi({
  452. multiple: true,
  453. progress: () => {
  454. uploadsLoading.value = true
  455. },
  456. success: (file, res) => {
  457. uploadsChange(file.id, res.data)
  458. },
  459. error: (file) => {
  460. uploadsLoading.value = false
  461. window.$message.error(`${file.name} 上传失败`)
  462. },
  463. finish: () => {
  464. uploadsLoading.value = false
  465. window.$message.success('全部上传完成')
  466. },
  467. })
  468. }
  469. //替换文件
  470. const substitutionClick = (row) => {
  471. HcUploadFileApi({
  472. multiple: false,
  473. progress: () => {
  474. uploadsLoading.value = true
  475. },
  476. success: (_, { data }) => {
  477. //更新数据
  478. row.fileName = data?.originalName
  479. row.ossFileName = data?.name || ''
  480. row.fileUrl = data?.link || ''
  481. row.pdfFileUrl = data?.pdfUrl || ''
  482. row.filePage = data?.page || ''
  483. row.isUpdateUrl = 1
  484. uploadsLoading.value = false
  485. window.$message.success('上传成功')
  486. },
  487. error: (file) => {
  488. uploadsLoading.value = false
  489. window.$message.error(`${file.name} 上传失败`)
  490. },
  491. })
  492. }
  493. //树加载
  494. const treeLoading = ref(false)
  495. const treeNodeLoading = () => {
  496. treeLoading.value = false
  497. }
  498. const treePanelLoading = ref(false)
  499. const panelTreeLoading = () => {
  500. treePanelLoading.value = false
  501. }
  502. //审批状态
  503. const approvalStatus = ref([
  504. { label: '未上报', value: '0' },
  505. { label: '待审批', value: '1' },
  506. { label: '已审批', value: '2' },
  507. ])
  508. //认证状态
  509. const certifiedStatus = ref([
  510. { label: '已认证', value: '1' },
  511. { label: '未认证', value: '0' },
  512. ])
  513. //搜索表单
  514. const searchForm = ref({
  515. nodeIds: '',
  516. approval: null, certified: null, queryValue: null,
  517. current: 1, size: 20, total: 0,
  518. })
  519. //树相关的变量
  520. const isBuiltDrawing = ref(0)
  521. const isStorageNode = ref(0)
  522. const nodeIds = ref('')
  523. const treecontractId = ref('')
  524. //自动展开缓存
  525. const treeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
  526. const projectTreeClick = ({ data, keys }) => {
  527. setStoreValue('wbsTreeExpandKeys', keys)
  528. treeAutoExpandKeys.value = keys || []
  529. nodeIds.value = data.id || ''
  530. isStorageNode.value = data['isStorageNode'] || 0
  531. treecontractId.value = data?.contractId || ''
  532. //设置搜索数据
  533. searchForm.value.current = 1
  534. searchForm.value.nodeIds = data.id || ''
  535. sortSearchForm.value.nodeIds = data.id || ''
  536. isBuiltDrawing.value = data.storageType
  537. getTableData()
  538. }
  539. //树菜单被点击
  540. const ElTreeMenuClick = async ({ data, keys }) => {
  541. setStoreValue('wbsTreeExpandKeys', keys)
  542. treeAutoExpandKeys.value = keys || []
  543. if (data?.extType === 2) {
  544. // 声像节点显示声像文件同步菜单
  545. // if (data?.storageType === 5 && data?.associationType === 3) {
  546. // ElTreeMenu.value = [
  547. // { icon: 'add-circle', label: '新增', key: 'add' },
  548. // { icon: 'draft', label: '编辑', key: 'edit' },
  549. // { icon: 'delete-bin', label: '删除', key: 'del' },
  550. // { icon: 'refresh', label: '目录同步', key: 'sync' },
  551. // { icon: 'refresh', label: '文件同步', key: 'fileSync' },
  552. // { icon: 'sort-asc', label: '排序', key: 'sort' },
  553. // { icon: 'refresh', label: '声像文件同步', key: 'syncVocie' },
  554. // ]
  555. // } else {
  556. // ElTreeMenu.value = [
  557. // { icon: 'add-circle', label: '新增', key: 'add' },
  558. // { icon: 'draft', label: '编辑', key: 'edit' },
  559. // { icon: 'delete-bin', label: '删除', key: 'del' },
  560. // { icon: 'refresh', label: '目录同步', key: 'sync' },
  561. // { icon: 'refresh', label: '文件同步', key: 'fileSync' },
  562. // { icon: 'sort-asc', label: '排序', key: 'sort' },
  563. // ]
  564. // }
  565. ElTreeMenu.value = [
  566. { icon: 'add-circle', label: '新增', key: 'add' },
  567. { icon: 'draft', label: '编辑', key: 'edit' },
  568. { icon: 'delete-bin', label: '删除', key: 'del' },
  569. { icon: 'refresh', label: '目录同步', key: 'sync' },
  570. { icon: 'refresh', label: '文件同步', key: 'fileSync' },
  571. { icon: 'sort-asc', label: '排序', key: 'sort' },
  572. ]
  573. } else {
  574. // 声像节点显示声像文件同步菜单
  575. // if (data?.storageType === 5 && data?.associationType === 3) {
  576. // ElTreeMenu.value = [
  577. // { icon: 'add-circle', label: '新增', key: 'add' },
  578. // { icon: 'draft', label: '编辑', key: 'edit' },
  579. // { icon: 'delete-bin', label: '删除', key: 'del' },
  580. // { icon: 'refresh', label: '目录同步', key: 'sync' },
  581. // { icon: 'sort-asc', label: '排序', key: 'sort' },
  582. // { icon: 'refresh', label: '声像文件同步', key: 'syncVocie' },
  583. // ]
  584. // } else {
  585. // ElTreeMenu.value = [
  586. // { icon: 'add-circle', label: '新增', key: 'add' },
  587. // { icon: 'draft', label: '编辑', key: 'edit' },
  588. // { icon: 'delete-bin', label: '删除', key: 'del' },
  589. // { icon: 'refresh', label: '目录同步', key: 'sync' },
  590. // { icon: 'sort-asc', label: '排序', key: 'sort' },
  591. // ]
  592. // }
  593. ElTreeMenu.value = [
  594. { icon: 'add-circle', label: '新增', key: 'add' },
  595. { icon: 'draft', label: '编辑', key: 'edit' },
  596. { icon: 'delete-bin', label: '删除', key: 'del' },
  597. { icon: 'refresh', label: '目录同步', key: 'sync' },
  598. { icon: 'sort-asc', label: '排序', key: 'sort' },
  599. ]
  600. }
  601. }
  602. //回车搜索
  603. const keyUpEvent = (e) => {
  604. if (e.key === 'Enter') {
  605. searchForm.value.current = 1
  606. getTableData()
  607. }
  608. }
  609. //搜索
  610. const searchClick = () => {
  611. searchForm.value.current = 1
  612. getTableData()
  613. }
  614. //分页被点击
  615. const pageChange = ({ current, size }) => {
  616. searchForm.value.current = current
  617. searchForm.value.size = size
  618. getTableData()
  619. }
  620. //表格数据
  621. const tableRef = ref(null)
  622. const tableColumn = ref([])
  623. //设置表头
  624. const setTableColumns = () => {
  625. if (isBuiltDrawing.value === 1) {
  626. tableColumn.value = [
  627. { key: 'sourceType', name: '文件来源', width: 100 },
  628. { key: 'fileNumber', name: '文件编号', width: 100, autoWidth: true },
  629. { key: 'fileName', name: '文件名称' },
  630. { key: 'filePage', name: '文件页数', width: 120 },
  631. { key: 'sheetType', name: '图幅', width: 110 },
  632. { key: 'sheetSourceValue', name: '图表来源', width: 110 },
  633. { key: 'drawingNo', name: '图号', width: 110 },
  634. { key: 'citeChangeNumber', name: '引用变更令编号', width: 110 },
  635. { key: 'isCertificationValue', name: '认证状态', width: 100 },
  636. { key: 'isApprovalValue', name: '状态', width: 100 },
  637. { key: 'fileTime', name: '文件时间', width: 120, autoWidth: true },
  638. { key: 'dutyUser', name: '责任者', width: 140 },
  639. ]
  640. sheetTypeStatus()
  641. sheetSourceStatus()
  642. } else {
  643. tableColumn.value = [
  644. { key: 'sourceType', name: '文件来源', width: 100 },
  645. { key: 'fileNumber', name: '文件编号', width: 100, autoWidth: true },
  646. { key: 'fileName', name: '文件名称' },
  647. { key: 'filePage', name: '文件页数', width: 100 },
  648. { key: 'isCertificationValue', name: '认证状态', width: 100 },
  649. { key: 'isApprovalValue', name: '状态', width: 100 },
  650. { key: 'fileTime', name: '文件时间', width: 120, autoWidth: true },
  651. { key: 'dutyUser', name: '责任者', width: 140 },
  652. ]
  653. }
  654. }
  655. const tableData = ref([])
  656. //获取数据
  657. const tableLoading = ref(false)
  658. const getTableData = async () => {
  659. tableLoading.value = true
  660. const { error, code, data } = await archiveFileApi.getarchiveFilePage({
  661. ...searchForm.value,
  662. projectId: projectId.value,
  663. contractId: contractId.value,
  664. })
  665. tableLoading.value = false
  666. if (!error && code === 200) {
  667. tableData.value = getArrValue(data['records'])
  668. searchForm.value.total = data['total'] || 0
  669. } else {
  670. tableData.value = []
  671. searchForm.value.total = 0
  672. }
  673. }
  674. //多选
  675. const tableCheckedKeys = ref([])
  676. const tableSelection = (rows) => {
  677. tableCheckedKeys.value = rows
  678. }
  679. //分盒整理
  680. const sortingModal = ref(false)
  681. const sortingClick = async () => {
  682. if (nodeIds.value && isStorageNode.value === 1) {
  683. const { error, code, data } = await archiveFileApi.getBoxNameAndBoxNumber({
  684. nodeId: nodeIds.value,
  685. })
  686. if (!error && code === 200) {
  687. if (data.length > 0) {
  688. sortingActiveKey.value = []
  689. sortingModal.value = true
  690. sortingItemData.value = getArrValue(data)
  691. sortingOldData.value = deepClone(sortingItemData.value)
  692. } else {
  693. console.log(1111111)
  694. sortingNoneModal.value = true
  695. }
  696. }
  697. } else {
  698. window?.$message?.warning('请先选择一个子节点')
  699. }
  700. }
  701. const sortingNoneModal = ref(false)//无数据显示的弹窗
  702. const toSortingModal = () => {
  703. sortingNoneModal.value = false
  704. sortingActiveKey.value = []
  705. sortingItemData.value = []
  706. sortingModal.value = true
  707. }
  708. const sortingNoneModalClose = () => {
  709. sortingNoneModal.value = false
  710. }
  711. const sortingItemData = ref([])
  712. const sortingOldData = ref([])//旧数据,用来对比是否修改名字
  713. //校验
  714. const tableIsInput = (val, row, key) => {
  715. //检测是否改过案卷名字
  716. if (key === 'isName') {
  717. row.isChange = true
  718. }
  719. row[key] = !val
  720. }
  721. const sortingActiveKey = ref([])
  722. const tableIndex = ref('')
  723. const sortingSelectFile = (row, index) => {
  724. tableIndex.value = index
  725. const key = `item-${index}`
  726. const indexNum = sortingActiveKey.value.indexOf(key)
  727. if (indexNum > -1) {
  728. sortingActiveKey.value.splice(indexNum, 1)
  729. } else {
  730. sortingActiveKey.value.push(key)
  731. if (!(row.list && row.list.length > 0)) {
  732. getSortingTableData(row, index)
  733. }
  734. }
  735. }
  736. //表格
  737. const sortingTableColumn = [
  738. { key: 'name', name: '文件名称' },
  739. ]
  740. //获取数据
  741. const sortingTableLoading = ref(false)
  742. const getSortingTableData = async (row, index) => {
  743. sortingTableLoading.value = true
  744. tableindex.value = index
  745. const { error, code, data } = await archiveFileApi.pageByBoxName({
  746. size: 99999,
  747. current: 1,
  748. projectId: projectId.value,
  749. contractId: contractId.value,
  750. nodeIds: nodeIds.value,
  751. boxName: row.boxName ? row.boxName : '',
  752. })
  753. sortingTableLoading.value = false
  754. if (!error && code === 200) {
  755. row.list = getArrValue(data['records'])
  756. setTableCheck(row, index).then()
  757. } else {
  758. row.list = []
  759. }
  760. }
  761. //表格ref
  762. const sorTableRef = ref([])
  763. const tableindex = ref('')
  764. //回显勾选
  765. const setTableCheck = async (row, index) => {
  766. if (row.ids) {
  767. const keys = row.ids.split(','), list = row.list
  768. for (let i = 0; i < list.length; i++) {
  769. const item = list[i]
  770. if (keys.indexOf(item.id) > -1) {
  771. item.checked = true
  772. await nextTick()
  773. // console.log(sorTableRef.value[index], 'sorTableRef.value[index]')
  774. sorTableRef.value[index].toggleRowSelection(item, true)
  775. }
  776. }
  777. }
  778. }
  779. //多选
  780. const checkList = ref([])
  781. const arrfliter = ref([])
  782. const singleCheck = async ({ row }) => {
  783. let isCheck = false
  784. let checkrow = JSON.parse(JSON.stringify(row))
  785. if (checkrow.checked === false || checkrow.checked === undefined) {
  786. if (checkList.value.length > 0) {
  787. let arr = checkList.value.filter(e => e.id === checkrow.id)
  788. if (arr.length > 0) {
  789. window.$message.warning('多个盒子不能选择同一份文件')
  790. await nextTick()
  791. sorTableRef.value[tableindex.value].toggleRowSelection(row, false)
  792. isCheck = true
  793. } else {
  794. isCheck = false
  795. row.tableindex = tableindex.value
  796. checkList.value.push(row)
  797. }
  798. } else {
  799. row.tableindex = tableindex.value
  800. checkList.value.push(row)
  801. }
  802. } else {
  803. let arr = checkList.value.filter(e => e.id === checkrow.id)
  804. if (isCheck === false && arr[0]?.checked === true || isCheck) {
  805. arrfliter.value = checkList.value.filter(e => e.id !== checkrow.id)
  806. } else {
  807. arrfliter.value = checkList.value
  808. }
  809. let newarr = []
  810. arrfliter.value.forEach((item) => {
  811. newarr.push(JSON.parse(JSON.stringify(item)))
  812. })
  813. checkList.value = newarr
  814. }
  815. }
  816. const sortingTableSelection = (rows, list, index) => {
  817. tableindex.value = index
  818. if (list) {
  819. list.forEach(element => {
  820. element.checked = false
  821. })
  822. }
  823. rows.forEach((element) => {
  824. element.checked = true
  825. })
  826. }
  827. //删除
  828. const sortingDelData = (row, index) => {
  829. sortingItemData.value.splice(index, 1)
  830. console.log(checkList.value, 'checkList.value')
  831. // checkList.value=[]
  832. //过滤掉当前选择的文件
  833. checkList.value = checkList.value.filter(e => e.tableindex !== index)
  834. if (row.boxNumber) {
  835. HcDelMsg(async (resolve) => {
  836. const { error, code } = await archiveFileApi.removeAllocation({
  837. boxName: row.boxName,
  838. boxNumber: row.boxNumber,
  839. })
  840. if (!error && code === 200) {
  841. window.$message?.success('删除成功!')
  842. sortingClick()
  843. }
  844. resolve() //关闭弹窗的回调
  845. })
  846. }
  847. }
  848. //添加分盒
  849. const addSortingModalClick = () => {
  850. console.log('添加分盒')
  851. sortingItemData.value.push({
  852. boxName: '',
  853. })
  854. }
  855. //确认保存
  856. const sortingModalLoading = ref(false)
  857. const sortingModalSave = async () => {
  858. sortingModalLoading.value = true
  859. //检测案卷名是否重复
  860. let nameRes = await checkNames()
  861. //console.log(nameRes)
  862. //return;
  863. for (let i = 0; i < nameRes.length; i++) {
  864. if (typeof nameRes[i].data == 'string') {
  865. window.$message?.error(nameRes[i].data + ',案卷名重复')
  866. sortingModalLoading.value = false
  867. return
  868. }
  869. }
  870. //组装数据
  871. let rows = []
  872. sortingItemData.value.forEach((item, index) => {
  873. let obj = {
  874. ids: '',
  875. boxName: item.boxName,
  876. boxNumber: index + 1,
  877. }
  878. let list = []
  879. if (item.list) {
  880. item.list.forEach((item2) => {
  881. if (item2.checked) {
  882. list.push(item2.id)
  883. }
  884. })
  885. obj.ids = list.join(',')
  886. } else {
  887. obj.ids = item.ids
  888. }
  889. rows.push(obj)
  890. })
  891. console.log(rows, 'rows')
  892. if (rows[0]?.ids) {
  893. const { error, code, data } = await archiveFileApi.allocation({
  894. list: rows,
  895. })
  896. if (!error && code === 200) {
  897. window.$message?.success('保存成功')
  898. sortingModal.value = false
  899. } else {
  900. window.$message?.error('保存失败')
  901. }
  902. } else {
  903. window.$message?.warning('空数据不能提交')
  904. }
  905. sortingModalLoading.value = false
  906. }
  907. const checkNames = () => {
  908. const arr = []
  909. sortingItemData.value.forEach((item) => {
  910. if (item.boxNumber) {
  911. if (item.isChange) {
  912. //是否修改过
  913. //对比旧的数据,是否相同
  914. for (let i = 0; i < sortingOldData.value.length; i++) {
  915. if (sortingOldData.value[i].boxNumber == item.boxNumber) {
  916. if (sortingOldData.value[i].boxName != item.boxName) {
  917. arr.push(
  918. archiveFileApi.getIsBoxName({
  919. boxName: item.boxName,
  920. }),
  921. )
  922. }
  923. return
  924. }
  925. }
  926. }
  927. } else {
  928. arr.push(
  929. archiveFileApi.getIsBoxName({
  930. boxName: item.boxName,
  931. }),
  932. )
  933. }
  934. })
  935. return Promise.all(arr)
  936. }
  937. //关闭
  938. const sortingModalClose = () => {
  939. sortingModal.value = false
  940. }
  941. //删除
  942. const delModalClick = () => {
  943. const rows = tableCheckedKeys.value
  944. //待审批,已审批都不能删除 豆海涛说,先取消限制
  945. /*const result = rows.some(({ isApprovalValue }) => {
  946. return isApprovalValue === '待审批' || isApprovalValue === '已审批'
  947. })
  948. if (result) {
  949. window.$message.warning('待审批或者已审批的文件都不能删除')
  950. return
  951. }
  952. if (rows.length <= 0) {
  953. window.$message?.error('请选择需要删除的数据')
  954. } else {
  955. HcDelMsg(async (resolve) => {
  956. const keys = arrToId(rows)
  957. const { error, code } = await archiveFileApi.removeFile({
  958. ids: keys,
  959. })
  960. if (!error && code === 200) {
  961. window.$message?.success('删除成功!')
  962. searchClick()
  963. }
  964. resolve() //关闭弹窗的回调
  965. })
  966. }*/
  967. HcDelMsg(async (resolve) => {
  968. const keys = arrToId(rows)
  969. const { error, code } = await archiveFileApi.removeFile({
  970. ids: keys,
  971. })
  972. if (!error && code === 200) {
  973. window.$message?.success('删除成功!')
  974. searchClick()
  975. }
  976. resolve() //关闭弹窗的回调
  977. })
  978. }
  979. //废除
  980. const repealModalClick = async () => {
  981. const rows = tableCheckedKeys.value
  982. if (rows.length <= 0) {
  983. window.$message?.error('请选择需要废除的数据')
  984. } else {
  985. window?.$messageBox?.alert('请谨慎考虑后,确认是否需要废除?', '废除提醒', {
  986. showCancelButton: true,
  987. confirmButtonText: '确认废除',
  988. cancelButtonText: '取消',
  989. type: 'warning',
  990. callback: async (action, instance, done) => {
  991. if (action === 'confirm') {
  992. instance.confirmButtonLoading = true
  993. const keys = arrToId(rows)
  994. const { error, code } = await tasksFlowApi.batchRepealTaskArchive({
  995. ids: keys,
  996. type: 1,
  997. projectId: projectId.value,
  998. contractId: contractId.value,
  999. })
  1000. if (!error && code === 200) {
  1001. window.$message?.success('废除成功!')
  1002. searchClick()
  1003. }
  1004. instance.confirmButtonLoading = false
  1005. done()
  1006. } else {
  1007. done()
  1008. }
  1009. },
  1010. })
  1011. }
  1012. }
  1013. //跨目录移动
  1014. const movesModal = ref(false)
  1015. const movesClick = async () => {
  1016. movesModal.value = true
  1017. checkedMoves.value = []
  1018. movesCheckAll.value = false
  1019. treePanelLoading.value = true
  1020. fileDatasListLoading.value = true
  1021. const { error, code, data } = await archiveFileApi.getarchiveFilePage({
  1022. ...searchForm.value,
  1023. current: 1,
  1024. size: 50000,
  1025. projectId: projectId.value,
  1026. contractId: contractId.value,
  1027. })
  1028. fileDatasListLoading.value = false
  1029. if (!error && code === 200) {
  1030. fileDatasList.value = getArrValue(data['records'])
  1031. } else {
  1032. fileDatasList.value = []
  1033. }
  1034. }
  1035. //选择需要迁移的文件
  1036. const movesCheckAll = ref(false)
  1037. const isIndeterminate = ref(true)
  1038. const checkedMoves = ref([])
  1039. //左侧待迁移文件
  1040. const fileDatasList = ref([])
  1041. const fileDatasListLoading = ref(false)
  1042. //全选
  1043. const handleCheckAllChange = (val) => {
  1044. console.log(val, 'val')
  1045. const checked = fileDatasList.value
  1046. checkedMoves.value = val ? checked : []
  1047. isIndeterminate.value = false
  1048. }
  1049. //勾选
  1050. const handleCheckedMovesChange = (value) => {
  1051. const keys = fileDatasList.value
  1052. const checkedCount = value.length
  1053. movesCheckAll.value = checkedCount === keys.length
  1054. isIndeterminate.value = checkedCount > 0 && checkedCount < keys.length
  1055. }
  1056. //右侧radio
  1057. let radioNodeId = ''
  1058. const radioChange = (id) => {
  1059. //console.log(id)
  1060. radioNodeId = id
  1061. }
  1062. //只显示储存节点的单选
  1063. const showRadioFun = (data) => {
  1064. if (data.isStorageNode == 1) {
  1065. return true
  1066. } else {
  1067. return false
  1068. }
  1069. }
  1070. //保存
  1071. const movesModalLoading = ref(false)
  1072. const movesModalSave = async () => {
  1073. const keys = rowsToId(checkedMoves.value)
  1074. let ids = keys
  1075. if (checkedMoves.value.length < 1) {
  1076. window.$message?.warning('请勾选需要迁移的文件')
  1077. return
  1078. }
  1079. if (radioNodeId == '') {
  1080. window.$message?.warning('请选择要移动到的节点')
  1081. return
  1082. }
  1083. movesModalLoading.value = true
  1084. const { error, code, data } = await archiveFileApi.migrateFile({
  1085. ids: ids,
  1086. nodeId: radioNodeId,
  1087. })
  1088. movesModalLoading.value = false
  1089. if (!error && code === 200) {
  1090. window.$message?.success('保存成功')
  1091. movesModal.value = false
  1092. getTableData()
  1093. } else {
  1094. window.$message?.error('保存失败')
  1095. }
  1096. }
  1097. //关闭
  1098. const movesModalClose = () => {
  1099. movesModal.value = false
  1100. }
  1101. //表格排序
  1102. const sortModal = ref(false)
  1103. //显示
  1104. const tableSortClick = () => {
  1105. sortModal.value = true
  1106. getSortTableData()
  1107. }
  1108. //搜索表单
  1109. const sortSearchForm = ref({
  1110. nodeIds: '',
  1111. current: 1, size: 20, total: 0,
  1112. })
  1113. //分页被点击
  1114. const sortPageChange = ({ current, size }) => {
  1115. sortSearchForm.value.current = current
  1116. sortSearchForm.value.size = size
  1117. getSortTableData()
  1118. }
  1119. //表格数据
  1120. const sortTableColumn = ref([
  1121. { key: 'fileNumber', name: '文件编号', width: 160 },
  1122. { key: 'fileName', name: '文件名称' },
  1123. { key: 'action', name: '排序', width: 90 },
  1124. ])
  1125. const sortTableData = ref([])
  1126. const sortTableLoading = ref(false)
  1127. const getSortTableData = async () => {
  1128. sortTableLoading.value = true
  1129. const { error, code, data } = await archiveFileApi.getarchiveFilePage({
  1130. ...sortSearchForm.value,
  1131. projectId: projectId.value,
  1132. contractId: contractId.value,
  1133. })
  1134. sortTableLoading.value = false
  1135. if (!error && code === 200) {
  1136. sortTableData.value = getArrValue(data['records'])
  1137. sortSearchForm.value.total = data['total'] || 0
  1138. } else {
  1139. sortTableData.value = []
  1140. sortSearchForm.value.total = 0
  1141. }
  1142. }
  1143. //拖动完成
  1144. const sortTableRowDrop = (rows) => {
  1145. sortTableData.value = [] // 先清空,否则排序会异常
  1146. nextTick(() => {
  1147. sortTableData.value = rows
  1148. })
  1149. }
  1150. //向下
  1151. const downSortClick = (index) => {
  1152. const indexs = index + 1
  1153. const data = sortTableData.value
  1154. if (indexs !== data.length) {
  1155. const tmp = data.splice(indexs, 1)
  1156. sortTableData.value.splice(index, 0, tmp[0])
  1157. } else {
  1158. window?.$message?.warning('已经处于置底,无法下移')
  1159. }
  1160. }
  1161. //向上
  1162. const upSortClick = (index) => {
  1163. const data = sortTableData.value || []
  1164. if (index !== 0) {
  1165. const tmp = data.splice(index - 1, 1)
  1166. sortTableData.value.splice(index, 0, tmp[0])
  1167. } else {
  1168. window?.$message?.warning('已经处于置顶,无法上移')
  1169. }
  1170. }
  1171. //保存
  1172. const sortModalLoading = ref(false)
  1173. const sortModalSave = async () => {
  1174. await batchEditSaveApi(sortTableData.value)
  1175. sortModal.value = false
  1176. }
  1177. //关闭
  1178. const sortModalClose = () => {
  1179. sortModal.value = false
  1180. }
  1181. //获取认证状态
  1182. const certificationType = ref([])
  1183. const certificationStatus = async () => {
  1184. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  1185. typeOrStatus: 'certification_status',
  1186. })
  1187. //处理数据
  1188. if (!error && code === 200) {
  1189. certificationType.value = getArrValue(data)
  1190. } else {
  1191. certificationType.value = []
  1192. }
  1193. }
  1194. //获取图幅类型
  1195. const sheetType = ref([])
  1196. const sheetTypeStatus = async () => {
  1197. console.log(1111111)
  1198. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  1199. typeOrStatus: 'sheet_type',
  1200. })
  1201. //处理数据
  1202. if (!error && code === 200) {
  1203. sheetType.value = getArrValue(data)
  1204. } else {
  1205. sheetType.value = []
  1206. }
  1207. }
  1208. //获取图表来源
  1209. const sheetSourceType = ref([])
  1210. const sheetSourceStatus = async () => {
  1211. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  1212. typeOrStatus: 'sheet_source',
  1213. })
  1214. //处理数据
  1215. if (!error && code === 200) {
  1216. sheetSourceType.value = getArrValue(data)
  1217. } else {
  1218. sheetSourceType.value = []
  1219. }
  1220. }
  1221. //新增文件
  1222. const tableUploadType = ref('add')
  1223. const showUploadModal = ref(false)
  1224. const uploadModalClick = () => {
  1225. if (nodeIds.value && isStorageNode.value === 1) {
  1226. tableUploadType.value = 'add'
  1227. setTableUploadColumn()
  1228. uploadSaveLoading.value = false
  1229. tableUploadData.value = []
  1230. showUploadModal.value = true
  1231. setdutyUser()
  1232. } else {
  1233. window?.$message?.warning('请先选择一个子节点')
  1234. }
  1235. }
  1236. const uploadModalClose = () => {
  1237. batchUploadCancel()
  1238. }
  1239. //设置文件表头
  1240. const tableUploadColumn = ref([
  1241. { key: 'fileNumber', name: '文件编号' },
  1242. { key: 'fileName', name: '文件名称' },
  1243. { key: 'fileTime', name: '文件时间' },
  1244. { key: 'isApproval', name: '是否需要审批' },
  1245. { key: 'isNeedCertification', name: '是否需要认证' },
  1246. { key: 'dutyUser', name: '责任者' },
  1247. { key: 'isElement', name: '是否四要素' },
  1248. { key: 'action', name: '操作', width: 180 },
  1249. ])
  1250. const setTableUploadColumn = () => {
  1251. if (isBuiltDrawing.value === 2) {
  1252. tableUploadColumn.value = [
  1253. { key: 'fileNumber', name: '文件编号' },
  1254. { key: 'fileName', name: '文件名称' },
  1255. { key: 'fileTime', name: '文件时间' },
  1256. { key: 'sheetType', name: '图幅' },
  1257. { key: 'sheetSource', name: '图表来源' },
  1258. { key: 'drawingNo', name: '图号' },
  1259. { key: 'citeChangeNumber', name: '引用变更令编号' },
  1260. { key: 'isApproval', name: '是否需要审批' },
  1261. { key: 'isNeedCertification', name: '是否需要认证' },
  1262. { key: 'dutyUser', name: '责任者' },
  1263. { key: 'isElement', name: '是否四要素' },
  1264. { key: 'action', name: '操作', width: 180 },
  1265. ]
  1266. sheetTypeStatus()
  1267. sheetSourceStatus()
  1268. } else {
  1269. tableUploadColumn.value = [
  1270. { key: 'fileNumber', name: '文件编号' },
  1271. { key: 'fileName', name: '文件名称' },
  1272. { key: 'fileTime', name: '文件时间' },
  1273. { key: 'isApproval', name: '是否需要审批' },
  1274. { key: 'isNeedCertification', name: '是否需要认证' },
  1275. { key: 'dutyUser', name: '责任者' },
  1276. { key: 'isElement', name: '是否四要素' },
  1277. { key: 'action', name: '操作', width: 180 },
  1278. ]
  1279. }
  1280. }
  1281. const tableUploadData = ref([])
  1282. //上传的文件结果
  1283. const uploadsChange = (fileId, item) => {
  1284. if (getObjVal(item)) {
  1285. let newArr = tableUploadData.value
  1286. const sheet = sheetType.value, source = sheetSourceType.value
  1287. let name = item['originalName'] || ''
  1288. let fileName = name.substring(0, name.lastIndexOf('.'))
  1289. newArr.push({
  1290. fileUploadId: fileId,
  1291. projectId: projectId.value,
  1292. contractId: contractId.value,
  1293. nodeId: nodeIds.value,
  1294. fileNumber: '',
  1295. fileName: fileName,
  1296. ossFileName: item?.name || '',
  1297. fileTime: null,
  1298. fileUrl: item?.link || '',
  1299. sheetType: sheet.length > 0 ? sheet[0]['dictKey'] || '' : '',
  1300. sheetSource: source.length > 0 ? source[0]['dictKey'] || '' : '',
  1301. drawingNo: '',
  1302. citeChangeNumber: '',
  1303. isApproval: 1,
  1304. isNeedCertification: 1,
  1305. dutyUser: dutyUser.value,
  1306. pdfFileUrl: item?.pdfUrl || '',
  1307. filePage: item?.page || '',
  1308. isElement: 0,
  1309. isUpdateUrl: 0,
  1310. fileSize: item?.fileSize,
  1311. })
  1312. //tableUploadData.value = newArr
  1313. tableUploadData.value = arrKeySort(newArr, 'fileUploadId')
  1314. } else {
  1315. console.log(item)
  1316. }
  1317. }
  1318. //表单下拉数据
  1319. const whetherData = ref([
  1320. { label: '不需要', value: 0 },
  1321. { label: '需要', value: 1 },
  1322. ])
  1323. //表格数据排序
  1324. const tableUploadRowSort = (arr) => {
  1325. tableUploadData.value = arr
  1326. }
  1327. //删除
  1328. const delUploadData = async (row, index) => {
  1329. if (row['ossFileName']) {
  1330. row['delBtnLoading'] = true
  1331. await ossApi.removeFile({ fileName: row['ossFileName'] })
  1332. row['delBtnLoading'] = false
  1333. tableUploadData.value.splice(index, 1)
  1334. } else {
  1335. tableUploadData.value.splice(index, 1)
  1336. }
  1337. }
  1338. //批量上传保存
  1339. const uploadSaveLoading = ref(false)
  1340. const batchUploadSave = async () => {
  1341. const rows = tableUploadData.value
  1342. if (rows.length > 0) {
  1343. //验证表单数据
  1344. uploadSaveLoading.value = true
  1345. let isTableRows = false
  1346. for (let i = 0; i < rows.length; i++) {
  1347. // if (!rows[i]['fileNumber']) {
  1348. // rows[i]['isFileNumber'] = true
  1349. // isTableRows = true
  1350. // } else if (!rows[i]['fileName']) {
  1351. // rows[i]['isFileName'] = true
  1352. // isTableRows = true
  1353. // }
  1354. // if (!rows[i]['fileTime']) {
  1355. // rows[i]['isFileTime'] = true
  1356. // isTableRows = true
  1357. // }
  1358. // else
  1359. if (!rows[i]['fileName']) {
  1360. rows[i]['isFileName'] = true
  1361. isTableRows = true
  1362. }
  1363. }
  1364. //判断数据
  1365. if (isTableRows) {
  1366. uploadSaveLoading.value = false
  1367. window.$message?.warning('请先完善表单信息')
  1368. } else {
  1369. if (tableUploadType.value === 'add') {
  1370. await batchUploadSaveApi(rows)
  1371. } else {
  1372. await batchEditSaveApi(rows)
  1373. }
  1374. }
  1375. } else {
  1376. window.$message?.warning('请先上传文件')
  1377. }
  1378. }
  1379. //确认上传保存
  1380. const batchUploadSaveApi = async (rows) => {
  1381. uploadSaveLoading.value = true
  1382. const { error, code } = await archiveFileApi.batchUploadSave({
  1383. list: rows,
  1384. }, false)
  1385. //判断状态
  1386. uploadSaveLoading.value = false
  1387. if (!error && code === 200) {
  1388. window.$message?.success('保存成功')
  1389. batchUploadCancel()
  1390. getTableData()
  1391. } else {
  1392. window.$message?.error('保存失败')
  1393. }
  1394. }
  1395. //取消上传
  1396. const batchUploadCancel = () => {
  1397. tableUploadData.value = []
  1398. uploadSaveLoading.value = false
  1399. uploadsLoading.value = false
  1400. showUploadModal.value = false
  1401. }
  1402. //上传新文件
  1403. // const newUploadsChange = ({fileList}, row) => {
  1404. // if (fileList.length > 0) {
  1405. // tableUploadType.value = 'edit'
  1406. // const item = fileList[0]
  1407. // const name = item['originalName'] || ''
  1408. // const fileName = name.substring(0, name.lastIndexOf("."))
  1409. // //更新数据
  1410. // row.fileName = fileName;
  1411. // row.ossFileName = item?.name || ''
  1412. // row.fileUrl = item?.link || ''
  1413. // row.pdfFileUrl = item?.pdfUrl || ''
  1414. // row.filePage = item?.page || ''
  1415. // row.isUpdateUrl=1
  1416. // }
  1417. // }
  1418. // const newUploadsProgress = (val, row) => {
  1419. // row.newBtnLoading = val
  1420. // }
  1421. //批量编辑
  1422. const batchEditClick = () => {
  1423. const rows = deepClone(tableCheckedKeys.value)
  1424. //判断是否满足条件 豆海涛说,先取消限制
  1425. /*const result = rows.every(({ status }) => {
  1426. return status !== 1 && status !== 2
  1427. })
  1428. //判断状态
  1429. if (result) {
  1430. tableUploadType.value = 'edit'
  1431. setTableUploadColumn()
  1432. uploadSaveLoading.value = false
  1433. tableUploadData.value = rows
  1434. showUploadModal.value = true
  1435. } else {
  1436. window.$message?.warning('已上报或已审批的文件不能编辑')
  1437. }*/
  1438. tableUploadType.value = 'edit'
  1439. setTableUploadColumn()
  1440. uploadSaveLoading.value = false
  1441. tableUploadData.value = rows
  1442. showUploadModal.value = true
  1443. }
  1444. //确认编辑上传保存
  1445. const batchEditSaveApi = async (rows) => {
  1446. uploadSaveLoading.value = true
  1447. const { error, code } = await archiveFileApi.batchUpdateSort({
  1448. list: rows,
  1449. }, false)
  1450. //判断状态
  1451. uploadSaveLoading.value = false
  1452. if (!error && code === 200) {
  1453. window.$message?.success('保存成功')
  1454. batchUploadCancel()
  1455. getTableData()
  1456. } else {
  1457. window.$message?.error('保存失败')
  1458. }
  1459. }
  1460. //批量认证
  1461. const CertData = ref([])
  1462. const CertIds = ref([])
  1463. const CertPdf = ref('')
  1464. const CertColumns = [
  1465. { key: 'fileName', name: '文件名称' },
  1466. { key: 'action', name: '操作', width: 100 },
  1467. ]
  1468. //批量认证弹窗
  1469. const showCertificationModal = ref(false)
  1470. const certificationModalClick = () => {
  1471. const rows = tableCheckedKeys.value
  1472. CertData.value = rows
  1473. CertIds.value = rowsToId(rows)
  1474. CertPdf.value = rows[0]?.pdfFileUrl || ''
  1475. const result = rows.every(({ isCertification }) => {
  1476. return isCertification === 0
  1477. })
  1478. const result1 = rows.every(({ status }) => {
  1479. return status === 0 || status === 3
  1480. })//已上报不能认证
  1481. if (!result1) {
  1482. window.$message.warning('已上报的文件不能进行认证')
  1483. } else {
  1484. if (result) {
  1485. CertData.value = rows
  1486. CertIds.value = rowsToId(rows)
  1487. CertPdf.value = rows[0]?.pdfFileUrl || ''
  1488. showCertificationModal.value = true
  1489. } else {
  1490. window.$message?.warning('已认证的文件不能再认证')
  1491. }
  1492. }
  1493. }
  1494. //认证行被点击
  1495. const CertRowClick = ({ row }) => {
  1496. const pdfFileUrl = row?.pdfFileUrl || ''
  1497. if (CertPdf.value !== pdfFileUrl) {
  1498. CertPdf.value = pdfFileUrl
  1499. }
  1500. }
  1501. //认证预览被点击
  1502. const CertRowClick2 = ({ pdfFileUrl }) => {
  1503. const pdfUrl = pdfFileUrl || ''
  1504. if (CertPdf.value !== pdfUrl) {
  1505. CertPdf.value = pdfUrl
  1506. }
  1507. }
  1508. //确认认证
  1509. const CertLoading = ref(false)
  1510. const CertClick = async () => {
  1511. CertLoading.value = true
  1512. const { error, code, msg } = await tasksFlowApi.batchCertification({
  1513. ids: CertIds.value,
  1514. }, false)
  1515. //判断状态
  1516. CertLoading.value = false
  1517. if (!error && code === 200) {
  1518. window.$message?.success('认证成功')
  1519. showCertificationModal.value = false
  1520. searchClick()
  1521. } else {
  1522. window.$message?.error(msg)
  1523. }
  1524. }
  1525. //名称被点击
  1526. const tableRowName = (row) => {
  1527. console.log(row, 'row')
  1528. if (row?.isCertificationValue === '已认证' || row?.isApprovalValue === '已审批') {
  1529. if (row['eVisaFile']) {
  1530. toPdfPage(row['eVisaFile'])
  1531. //window.open(row['eVisaFile'], '_blank')
  1532. } else if (row['pdfFileUrl']) {
  1533. toPdfPage(row['pdfFileUrl'])
  1534. //window.open(row['pdfFileUrl'], '_blank')
  1535. } else {
  1536. window.$message?.warning('文件不存在')
  1537. }
  1538. } else {
  1539. if (row['pdfFileUrl']) {
  1540. toPdfPage(row['pdfFileUrl'])
  1541. //window.open(row['pdfFileUrl'], '_blank')
  1542. } else {
  1543. window.$message?.warning('文件不存在')
  1544. }
  1545. }
  1546. }
  1547. //上报
  1548. const isReport = ref(false)
  1549. const reportData = ref([])
  1550. const reportModalClick = () => {
  1551. reportData.value = []
  1552. const rows = tableCheckedKeys.value
  1553. //判断是否满足条件
  1554. const result = rows.every(({ status }) => {
  1555. return status === 0 || status === 3
  1556. })
  1557. const result1 = rows.every(({ isCertification }) => {
  1558. return isCertification === 1
  1559. })
  1560. if (result1) {
  1561. window.$message?.warning('已认证的文件不能进行上报')
  1562. return false
  1563. } else {
  1564. if (!result) {
  1565. window.$message?.warning('已上报的文件不能进行再次上报')
  1566. return false
  1567. }
  1568. }
  1569. rows.sort((a, b) => a.sort - b.sort)
  1570. //展示上报弹窗
  1571. reportData.value = rows
  1572. console.log(reportData.value, ' reportData.valu')
  1573. isReport.value = true
  1574. }
  1575. //上报完成
  1576. const reportFinish = () => {
  1577. searchClick()
  1578. }
  1579. //在线验签
  1580. const onlineLoading = ref(false)
  1581. const onlineVerifyData = ref({})
  1582. const isOnlineVerifyDrawer = ref(false)
  1583. const onlineVerifyOptions = {
  1584. sizes: [50, 50],
  1585. snapOffset: 0,
  1586. minSize: ['10%', '80%'],
  1587. }
  1588. const batchOnline = async () => {
  1589. const rows = tableCheckedKeys.value
  1590. if (rows.length > 1) {
  1591. window.$message?.warning('在线验签只能勾选一条数据进行验签')
  1592. return
  1593. }
  1594. //判断是否满足条件
  1595. const result = rows.every(({ status }) => {
  1596. return status === 2
  1597. })
  1598. //判断状态
  1599. if (!result) {
  1600. window.$message?.warning('存在未审批或未上报数据')
  1601. return
  1602. }
  1603. //发起请求
  1604. //const ids = arrToId(rows)
  1605. onlineLoading.value = true
  1606. /*const { error, code, msg, data } = await queryApi.onlineVerify({
  1607. ids: ids,
  1608. })
  1609. //处理数据
  1610. onlineLoading.value = false
  1611. if (!error && code === 200) {
  1612. onlineVerifyData.value = getObjValue(data)
  1613. //cscTableData.value = getArrValue(data['certBeanVOList'])
  1614. isOnlineVerifyDrawer.value = true
  1615. } else {
  1616. onlineVerifyData.value = {}
  1617. window.$message?.error(msg ?? '操作失败')
  1618. }*/
  1619. onlineVerifyData.value = {}
  1620. isOnlineVerifyDrawer.value = true
  1621. }
  1622. //签名信息
  1623. const cscTableColumn = [
  1624. { key: 'user', name: '签名者', width: 300 },
  1625. { key: 'time', name: '签名时间', width: 200 },
  1626. { key: 'val', name: '摘要' },
  1627. ]
  1628. const cscTableData = ref([])
  1629. //在线验签抽屉被关闭
  1630. const onlineVerifyDrawerClose = () => {
  1631. isOnlineVerifyDrawer.value = false
  1632. onlineLoading.value = false
  1633. }
  1634. </script>
  1635. <style lang="scss">
  1636. @import '~style/file/collection.scss';
  1637. //在线验签
  1638. .hc-online-verify-drawer .el-card.hc-new-card-box {
  1639. .hc-card-header-box {
  1640. .online-verify-title {
  1641. font-size: 20px;
  1642. }
  1643. .online-verify-icon {
  1644. display: flex;
  1645. align-items: center;
  1646. cursor: pointer;
  1647. color: #5a5959;
  1648. i {
  1649. font-size: 18px;
  1650. }
  1651. &:hover {
  1652. color: var(--el-color-primary);
  1653. }
  1654. }
  1655. }
  1656. }
  1657. html.dark .hc-online-verify-drawer .el-card.hc-new-card-box {
  1658. background-color: var(--hc-bg-color);
  1659. .hc-card-header-box {
  1660. .online-verify-icon {
  1661. color: var(--el-color-primary);
  1662. }
  1663. }
  1664. }
  1665. </style>