records.vue 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559
  1. <template>
  2. <hc-body class="hc-file-records-page" split :loading="treeLoading" :project-nmae="projectInfo?.name">
  3. <template #tree>
  4. <HcTree :project-id="projectId" :contract-id="contractId" :auto-expand-keys="treeAutoExpandKeys" @node-tap="projectTreeClick" @node-loading="treeNodeLoading" @menu-tap="ElTreeMenuClick" />
  5. </template>
  6. <hc-new-card>
  7. <template #header>
  8. <div class="w-64">
  9. <el-input v-model="searchForm.queryValue" placeholder="请输入案卷题名、档号进行搜索" clearable @keyup="keyUpEvent" />
  10. </div>
  11. <div class="ml-2 mr-5">
  12. <el-button type="primary" hc-btn @click="searchClick">搜索</el-button>
  13. </div>
  14. <HcTooltip keys="file_records_btn_download">
  15. <el-button hc-btn type="success" :disabled="tableCheckedKeys.length <= 0" :loading="downloadLoading" @click="batchDownload">下载</el-button>
  16. </HcTooltip>
  17. <HcTooltip keys="file_records_btn_edit">
  18. <el-button hc-btn type="warning" :disabled="tableCheckedKeys.length <= 0" @click="batchEditClick">编辑</el-button>
  19. </HcTooltip>
  20. <HcTooltip keys="file_records_btn_del">
  21. <el-button v-del-com:[delModalClick] hc-btn type="danger" :disabled="tableCheckedKeys.length <= 0">删除</el-button>
  22. </HcTooltip>
  23. </template>
  24. <template #extra>
  25. <HcTooltip keys="file_records_btn_upload_scanned_files">
  26. <el-button type="primary" hc-btn @click="uploadModalClick">上传案卷</el-button>
  27. </HcTooltip>
  28. <HcTooltip keys="file_records_btn_split">
  29. <el-badge :value="taskMount" class="ml-1 mr-4 cursor-pointer" :offset="[5, 5]" @click.native.stop="taskCountClick">
  30. <el-button hc-btn style="background-color: #8B5CF6; border-color: #8B5CF6; color:white" @click.native.stop="splitClick">分解文件</el-button>
  31. <template #content="{ value }">
  32. <div class="custom-content">
  33. <span>{{ value }}</span>
  34. </div>
  35. </template>
  36. </el-badge>
  37. </HcTooltip>
  38. <HcTooltip keys="file_records_btn_moves">
  39. <el-button type="primary" hc-btn @click="movesClick">跨目录移动</el-button>
  40. </HcTooltip>
  41. </template>
  42. <HcTable
  43. ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading"
  44. is-new :index-style="{ width: 70 }" is-check :check-style="{ width: 29 }"
  45. @selection-change="tableSelection"
  46. >
  47. <template #table-column-header-num>
  48. <HcTooltip keys="file_records_btn_sort">
  49. <span class="text-link text-lg" @click="tableSortClick">
  50. <HcIcon name="arrow-up-down" />
  51. </span>
  52. </HcTooltip>
  53. </template>
  54. <template #splitStatus="{ row, index }">
  55. <span v-if="row?.splitStatus === 1"> <HcIcon name="checkbox-circle" /></span>
  56. <span v-else> <HcIcon name="close-circle" /></span>
  57. </template>
  58. <template #name="{ row }">
  59. <span class="text-link" @click="tableRowName(row)">{{ row?.name }}</span>
  60. </template>
  61. <template #secretLevel="{ row }">{{ row.secretLevelValue }}</template>
  62. <template #storageTime="{ row }">{{ row.storageTimeValue }}</template>
  63. <template #dates="{ row }">
  64. <div v-if="row?.endDate !== '' || row?.startDate !== ''" class="content">
  65. {{ `${splitDate(row?.startDate)}~${splitDate(row?.endDate)}` }}
  66. </div>
  67. <div v-else class="content" />
  68. </template>
  69. </HcTable>
  70. <template #action>
  71. <HcPages :pages="searchForm" :sizes="[20, 50, 100, 200, 300, 500]" @change="pageChange" />
  72. </template>
  73. </hc-new-card>
  74. <!-- 跨目录移动 -->
  75. <hc-new-dialog v-model="movesModal" title="跨目录移动" widths="990px" is-table :loading="movesModalLoading" @close="movesModalClose" @save="movesModalSave">
  76. <div class="hc-moves-transfer-box">
  77. <div class="hc-moves-transfer-panel">
  78. <div class="panel-header">
  79. <div class="panel-header-label">
  80. <el-checkbox v-model="movesCheckAll" class="space size-xl" :indeterminate="isIndeterminate" @change="handleCheckAllChange">选择需要迁移的文件</el-checkbox>
  81. </div>
  82. <div class="panel-header-extra">{{ checkedMoves.length }}/{{ fileDatasList.length }}</div>
  83. </div>
  84. <div class="panel-body">
  85. <el-scrollbar v-loading="treePanelLoading">
  86. <el-checkbox-group v-model="checkedMoves" @change="handleCheckedMovesChange">
  87. <!-- <div v-for="item in fileDatasList" :key="item.id" class="hc-file-checkbox">
  88. <el-checkbox class="size-xl space mt-5 " :label="item">
  89. {{ `${item.fileNumber}--${item.name}` }}
  90. </el-checkbox>
  91. </div> -->
  92. <recycle-scroller
  93. class="virtual-list"
  94. :buffer="1000"
  95. :prerender="200"
  96. style="height: 900px"
  97. :item-size="110"
  98. key-field="id"
  99. :items="fileDatasList"
  100. >
  101. <template #default="{ item, index }">
  102. <div :key="index" class="list-item">
  103. <el-checkbox class="space mt-5 size-xl" :label="item">{{ `${item.fileNumber}--${item.name}` }}</el-checkbox>
  104. </div>
  105. </template>
  106. </recycle-scroller>
  107. </el-checkbox-group>
  108. </el-scrollbar>
  109. </div>
  110. </div>
  111. <div class="hc-moves-transfer-buttons">
  112. <!-- <el-button hc-btn _icon size="small"
  113. :type="fileDatasList.length <= 0 || checkedMoves.length <= 0 ? '' : 'primary'"
  114. :disabled="fileDatasList.length <= 0 || checkedMoves.length <= 0">
  115. <HcIcon name="arrow-right"/>
  116. </el-button> -->
  117. <HcIcon type="primary" name="arrow-right-double" style="font-size: 22px;" />
  118. </div>
  119. <div class="hc-moves-transfer-panel">
  120. <div class="panel-header">选择移动目录</div>
  121. <div class="panel-body">
  122. <el-scrollbar>
  123. <HcTree
  124. ref="movesTreeRef" id-prefix="hc-tree-moves-" :project-id="projectId" :contract-id="contractId" is-radio
  125. :show-radio-fun="showRadioFun" @radio-change="radioChange"
  126. />
  127. </el-scrollbar>
  128. </div>
  129. </div>
  130. </div>
  131. </hc-new-dialog>
  132. <!-- 调整排序 -->
  133. <hc-new-dialog v-model="sortModal" title="调整排序" widths="80vw" is-table is-row-footer @close="sortModalClose">
  134. <el-alert title="可拖动排序,也可在后面点击图标,切换排序" type="error" :closable="false" />
  135. <div class="hc-table-h">
  136. <HcTable
  137. ui="hc-table-row-drop" is-row-drop quick-sort is-new :index-style="{ width: 60 }"
  138. :column="sortTableColumn" :datas="sortTableData" :loading="sortTableLoading"
  139. @row-drop="sortTableRowDrop" @row-sort="sortTableRowDrop"
  140. >
  141. <template #key2="{ row }">
  142. <span class="text-link">{{ row?.key2 }}</span>
  143. </template>
  144. <template #action="{ index }">
  145. <span class="text-link text-xl" @click="upSortClick(index)">
  146. <HcIcon name="arrow-up" fill />
  147. </span>
  148. <span class="text-link ml-2 text-xl" @click="downSortClick(index)">
  149. <HcIcon name="arrow-down" fill />
  150. </span>
  151. </template>
  152. </HcTable>
  153. </div>
  154. <template #leftRowFooter>
  155. <el-button hc-btn @click="sortModalClose">
  156. <HcIcon name="close" />
  157. <span>取消</span>
  158. </el-button>
  159. <el-button type="primary" hc-btn :loading="sortModalLoading" @click="sortModalSave">
  160. <HcIcon name="check" />
  161. <span>确认</span>
  162. </el-button>
  163. </template>
  164. <template #rightRowFooter>
  165. <HcPages :pages="sortSearchForm" :sizes="[10, 20, 50, 100, 200, 300, 400, 500, 600, 3000, 5000, 8000, 10000]" @change="sortPageChange" />
  166. </template>
  167. </hc-new-dialog>
  168. <!-- 新增编辑文件 -->
  169. <hc-new-dialog v-model="showUploadModal" :title="tableUploadType === 'add' ? '上传文件' : '修改案卷基础信息'" widths="90vw" is-table @close="uploadModalClose">
  170. <div v-if="tableUploadType === 'add'" class="batch-set">
  171. <span>批量设置</span>
  172. <span class="ml-10">档号:</span>
  173. <span>前缀:</span>
  174. <span><el-input v-model="batchSet.prefix" placeholder="输入档号前缀" /></span>
  175. <span class="ml-5">流水号:</span>
  176. <span><el-input v-model="batchSet.numberStart" placeholder="起号" class="batch-set-input" /></span>
  177. <span>~</span>
  178. <span><el-input v-model="batchSet.numberEnd" placeholder="止号" class="batch-set-input" /></span>
  179. <span class="ml-5">密级:</span>
  180. <span>
  181. <el-select v-model="batchSet.securityLevel">
  182. <el-option v-for="item in securityLevel" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  183. </el-select>
  184. </span>
  185. <span class="ml-5">保管期限:</span>
  186. <span>
  187. <el-select v-model="batchSet.storagePeriod">
  188. <el-option v-for="item in storagePeriod" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  189. </el-select>
  190. </span>
  191. <span class="ml-5">立卷单位:</span>
  192. <span><el-input v-model="batchSet.unit" placeholder="输入立卷单位" /></span>
  193. <span class="ml-5">
  194. <el-button type="primary" @click="batchSetHandle">设置</el-button>
  195. </span>
  196. </div>
  197. <HcTable
  198. ui="hc-form-table" is-new :is-index="false" :class="{ 'set-table': tableUploadType === 'add' }"
  199. :column="tableUploadColumn" :datas="tableUploadData" :loading="uploadSaveLoading"
  200. >
  201. <template #no="{ index }">
  202. {{ index + 1 }}
  203. <template v-if="tableUploadType === 'add'">
  204. <span class="text-link text-lg">
  205. <HcIcon name="arrow-up" @click="upUpSortClick(index)" />
  206. </span>
  207. <span class="text-link text-lg">
  208. <HcIcon name="arrow-down" @click="downUpSortClick(index)" />
  209. </span>
  210. </template>
  211. </template>
  212. <template #fileNumber="{ row }">
  213. <el-input v-model="row.fileNumber" type="textarea" />
  214. </template>
  215. <template #name="{ row }">
  216. <el-input v-model="row.name" type="textarea" />
  217. </template>
  218. <template #secretLevel="{ row }">
  219. <el-select v-model="row.secretLevel">
  220. <el-option v-for="item in securityLevel" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  221. </el-select>
  222. </template>
  223. <template #storageTime="{ row }">
  224. <el-select v-model="row.storageTime">
  225. <el-option v-for="item in storagePeriod" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  226. </el-select>
  227. </template>
  228. <template #unit="{ row }">
  229. <el-input v-model="row.unit" type="textarea" />
  230. </template>
  231. <template #dates="{ row }">
  232. <el-date-picker v-model="row.dates" value-format="YYYY-MM-DD HH:mm:ss" type="daterange" />
  233. </template>
  234. <template #action="{ row, index }">
  235. <el-button v-if="tableUploadType === 'edit'" :loading="row.newBtnLoading" plain size="small" type="primary" @click="substitutionClick(row)">替换</el-button>
  236. <el-button v-if="tableUploadType === 'add'" type="danger" plain size="small" :loading="row.delBtnLoading" @click="delUploadData(row, index)">删除</el-button>
  237. </template>
  238. </HcTable>
  239. <template #footer>
  240. <div class="lr-dialog-footer">
  241. <div class="left flex items-center">
  242. <el-button type="primary" hc-btn @click="uploadFileClick">
  243. <HcIcon name="add-circle" />
  244. <span>新增上传</span>
  245. </el-button>
  246. <el-alert title="提示:每次不超过10份,文件量越多,响应容易超时" type="error" :closable="false" />
  247. </div>
  248. <div class="right">
  249. <el-button size="large" :loading="uploadSaveLoading" @click="batchUploadCancel">
  250. <HcIcon name="close" />
  251. <span>取消</span>
  252. </el-button>
  253. <el-button type="primary" hc-btn :loading="uploadSaveLoading" @click="batchUploadSave">
  254. <HcIcon name="save" />
  255. <span>提交保存</span>
  256. </el-button>
  257. </div>
  258. </div>
  259. </template>
  260. </hc-new-dialog>
  261. <!-- 分解文件 -->
  262. <hc-new-dialog v-model="splitModal" title="案卷分解" widths="40vw" is-row-footer @close="splitModalClose">
  263. <div class="split-modal-content">
  264. <div class="mb-6 text-4 font-bold">
  265. 本次分解共
  266. <span class="text-red">【{{ splitInfo?.fileCount }}】</span>
  267. 卷,预计耗费时长
  268. <span class="text-red">【{{ splitInfo?.taskTime }}】</span>
  269. 分钟,分解完成之后,序号图标会变成 <HcIcon name="checkbox-circle" style="color:lightgreen" />
  270. </div>
  271. <div class="mb-6 text-orange">请不要重复提交,过会儿再来查看,分解好的文件在文件收集对应节点可查看</div>
  272. <el-button type="primary" size="large" class="split-confirm-btn" hc-btn @click="splitModalClose">好的,我知道了</el-button>
  273. </div>
  274. </hc-new-dialog>
  275. <!-- 分解列表信息 -->
  276. <hc-new-dialog v-model="splitListModal" title="分解列表信息" widths="50vw" :footer="false" height="500px" @close="splitListModalClose">
  277. <HcTable
  278. heights="calc(100% - 50px)"
  279. :column="splitListColumn"
  280. :datas="splitList"
  281. :loading="splitListLoading"
  282. is-new
  283. :index-style="{ width: 70 }"
  284. >
  285. <template #fileNumber="{ row }">
  286. <span>{{ row.fileNumber }}</span>
  287. </template>
  288. <template #name="{ row }">
  289. <span>{{ row.name }}</span>
  290. </template>
  291. <template #status="{ row }">
  292. <span>{{ row.status }}</span>
  293. </template>
  294. <template #createTime="{ row }">
  295. <span>{{ row.createTime }}</span>
  296. </template>
  297. </HcTable>
  298. </hc-new-dialog>
  299. </hc-body>
  300. </template>
  301. <script setup>
  302. import { nextTick, onMounted, ref, watch } from 'vue'
  303. import { useAppStore } from '~src/store'
  304. import HcTree from '~src/components/tree/hc-tree.vue'
  305. import { rowsToId } from '~uti/tools'
  306. import { HcDelMsg, HcUploadFileApi } from 'hc-vue3-ui'
  307. import archiveFileApi from '~api/archiveFile/archiveFileAuto.js'
  308. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  309. import tasksApi from '~api/tasks/data'
  310. import ossApi from '~api/oss'
  311. import { arrKeySort, deepClone, downloadBlob, getArrValue, getObjVal, getObjValue } from 'js-fast-way'
  312. import { toPdfPage } from '~uti/btn-auth'
  313. //变量
  314. const useAppState = useAppStore()
  315. const projectId = ref(useAppState.getProjectId)
  316. const contractId = ref(useAppState.getContractId)
  317. const projectInfo = ref(useAppState.getProjectInfo)
  318. const isCollapse = ref(useAppState.getCollapse)
  319. const userInfo = ref(useAppState.getUserInfo)
  320. //上传变量
  321. const HcUploadFileRef = ref(null)
  322. const uploadsLoading = ref(false)
  323. //监听
  324. watch(() => [
  325. useAppState.getCollapse,
  326. ], ([Collapse]) => {
  327. isCollapse.value = Collapse
  328. })
  329. //渲染完成
  330. onMounted(() => {
  331. treeLoading.value = true
  332. setTableColumns()
  333. getStoragePeriod()
  334. getSecurityLevel()
  335. getSplitInfo()
  336. })
  337. //替换文件
  338. const substitutionClick = (row) => {
  339. HcUploadFileApi({
  340. multiple: false,
  341. progress: () => {
  342. uploadsLoading.value = true
  343. },
  344. success: (_, { data }) => {
  345. //更新数据
  346. row.name = data?.originalName
  347. row.fileName = data?.originalName
  348. row.ossFileName = data?.name || ''
  349. row.fileUrl = data?.link || ''
  350. row.pdfFileUrl = data?.pdfUrl || ''
  351. row.filePage = data?.page || ''
  352. row.isUpdateUrl = 1
  353. row.approvalFileList = [{
  354. projectId: projectId.value,
  355. contractId: contractId.value,
  356. nodeId: nodeIds.value,
  357. fileName: data?.originalName,
  358. fileNumber:data.fileNumber,
  359. ossFileName: data?.name || '',
  360. fileUrl: data?.link || '',
  361. pdfFileUrl: data?.pdfUrl || '',
  362. filePage: data?.page || '',
  363. isApproval:0,
  364. isNeedCertification:0,
  365. dutyUser: userInfo.value.real_name,
  366. }]
  367. uploadsLoading.value = false
  368. window.$message.success('上传成功')
  369. },
  370. error: (file) => {
  371. uploadsLoading.value = false
  372. window.$message.error(`${file.name} 上传失败`)
  373. },
  374. })
  375. }
  376. //截取日期
  377. const splitDate = (val)=>{
  378. if (val) {
  379. return val?.substring(0, 10)
  380. } else {
  381. return ''
  382. }
  383. }
  384. //打开文件选择框
  385. const uploadFileClick = () => {
  386. HcUploadFileApi({
  387. multiple: true,
  388. progress: () => {
  389. uploadsLoading.value = true
  390. },
  391. success: (file, res) => {
  392. uploadsChange(file.id, res.data)
  393. },
  394. error: (file) => {
  395. uploadsLoading.value = false
  396. window.$message.error(`${file.name} 上传失败`)
  397. },
  398. finish: () => {
  399. uploadsLoading.value = false
  400. window.$message.success('全部上传完成')
  401. },
  402. })
  403. }
  404. //树加载
  405. const treeLoading = ref(false)
  406. const treeNodeLoading = () => {
  407. treeLoading.value = false
  408. }
  409. const treePanelLoading = ref(false)
  410. //搜索表单
  411. const searchForm = ref({
  412. nodeIds:'',
  413. approval: null, certified: null, queryValue: null,
  414. current: 1, size: 20, total: 0,
  415. })
  416. //树相关的变量
  417. const isStorageNode = ref(0)
  418. const nodeIds = ref('')
  419. const treeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
  420. const projectTreeClick = ({ data, keys }) => {
  421. setStoreValue('wbsTreeExpandKeys', keys)
  422. treeAutoExpandKeys.value = keys || []
  423. nodeIds.value = data.id || ''
  424. isStorageNode.value = data['isStorageNode'] || 0
  425. //设置搜索数据
  426. searchForm.value.current = 1
  427. searchForm.value.nodeIds = data.id || ''
  428. sortSearchForm.value.nodeIds = data.id || ''
  429. getTableData()
  430. }
  431. //树菜单被点击
  432. const ElTreeMenuClick = async ({ keys }) => {
  433. setStoreValue('wbsTreeExpandKeys', keys)
  434. treeAutoExpandKeys.value = keys || []
  435. }
  436. //回车搜索
  437. const keyUpEvent = (e) => {
  438. if (e.key === 'Enter') {
  439. searchForm.value.current = 1
  440. getTableData()
  441. }
  442. }
  443. //搜索
  444. const searchClick = () => {
  445. searchForm.value.current = 1
  446. getTableData()
  447. }
  448. //分页被点击
  449. const pageChange = ({ current, size }) => {
  450. searchForm.value.current = current
  451. searchForm.value.size = size
  452. getTableData()
  453. }
  454. //表格数据
  455. const tableRef = ref(null)
  456. const tableColumn = ref([])
  457. //设置表头
  458. const setTableColumns = () => {
  459. tableColumn.value = [
  460. { key:'splitStatus', name: '分解状态', width: 80, align: 'center' },
  461. { key:'fileNumber', name: '档号', width: 160, align: 'center' },
  462. { key:'name', name: '案卷题名' },
  463. { key:'secretLevel', name: '密级', width: 80, align: 'center' },
  464. { key:'storageTime', name: '保管期限', width: 80, align: 'center' },
  465. { key:'pageN', name: '页数', width: 80, align: 'center' },
  466. { key:'unit', name: '立卷单位', width: 150, align: 'center' },
  467. { key:'dates', name: '起止日期', width: 190, align: 'center' },
  468. ]
  469. }
  470. const tableData = ref([])
  471. //获取数据
  472. const tableLoading = ref(false)
  473. const getTableData = async () => {
  474. tableLoading.value = true
  475. const { error, code, data } = await archiveFileApi.getarchiveFilePage({
  476. ...searchForm.value,
  477. projectId: projectId.value,
  478. contractId: contractId.value,
  479. isAutoFile:1,
  480. isArchive : 1,
  481. })
  482. tableLoading.value = false
  483. if (!error && code === 200) {
  484. tableData.value = getArrValue(data['records'])
  485. tableData.value.forEach((element)=>{
  486. element.dates = [element.startDate, element.endDate]
  487. })
  488. searchForm.value.total = data['total'] || 0
  489. } else {
  490. tableData.value = []
  491. searchForm.value.total = 0
  492. }
  493. }
  494. //多选
  495. const tableCheckedKeys = ref([])
  496. const tableSelection = (rows) => {
  497. tableCheckedKeys.value = rows
  498. }
  499. //分盒整理
  500. const sortingModal = ref(false)
  501. const sortingClick = async () => {
  502. if (nodeIds.value && isStorageNode.value === 1) {
  503. const { error, code, data } = await archiveFileApi.getBoxNameAndBoxNumber({
  504. nodeId:nodeIds.value,
  505. })
  506. if (!error && code === 200) {
  507. if (data.length > 0) {
  508. sortingActiveKey.value = []
  509. sortingModal.value = true
  510. sortingItemData.value = getArrValue(data)
  511. sortingOldData.value = deepClone(sortingItemData.value)
  512. } else {
  513. sortingNoneModal.value = true
  514. }
  515. }
  516. } else {
  517. window?.$message?.warning('请先选择一个子节点')
  518. }
  519. }
  520. const sortingNoneModal = ref(false)//无数据显示的弹窗
  521. const toSortingModal = ()=>{
  522. sortingNoneModal.value = false
  523. sortingActiveKey.value = []
  524. sortingModal.value = true
  525. }
  526. const sortingItemData = ref([])
  527. const sortingOldData = ref([])//旧数据,用来对比是否修改名字
  528. //获取数据
  529. const sortingItemLoading = ref(false)
  530. const getSortingItemData = () => {
  531. }
  532. //校验
  533. const tableIsInput = (val, row, key) => {
  534. //console.log(!val);
  535. //检测是否改过案卷名字
  536. if (key == 'isName') {
  537. row.isChange = true
  538. }
  539. row[key] = !val
  540. }
  541. //选择文件
  542. // const sortingActiveKey = ref('')
  543. // const sortingSelectFile = (row, index) => {
  544. // //取当前展开组的key
  545. // const key = sortingActiveKey.value;
  546. // const keys = key ? key.split('-') : [];
  547. // const active = keys.length > 0 ? keys[1]: -1;
  548. // if (Number(active) === index) {
  549. // sortingActiveKey.value = null;
  550. // } else {
  551. // sortingActiveKey.value = `item-${index}`;
  552. // }
  553. // }
  554. const sortingActiveKey = ref([])
  555. const sortingSelectFile = (row, index) => {
  556. const key = `item-${index}`
  557. const indexNum = sortingActiveKey.value.indexOf(key)
  558. if (indexNum > -1) {
  559. sortingActiveKey.value.splice(indexNum, 1)
  560. } else {
  561. sortingActiveKey.value.push(key)
  562. if (!(row.list && row.list.length > 0)) {
  563. getSortingTableData(row, index)
  564. }
  565. }
  566. }
  567. //表格
  568. const sortingTableColumn = [
  569. { key:'name', name: '文件名称' },
  570. ]
  571. const sortingTableData = ref([])
  572. //获取数据
  573. const sortingTableLoading = ref(false)
  574. const getSortingTableData = async (row, index) => {
  575. sortingTableLoading.value = true
  576. const { error, code, data } = await archiveFileApi.pageByBoxName({
  577. size: 99999,
  578. current: 1,
  579. projectId: projectId.value,
  580. contractId: contractId.value,
  581. nodeIds:nodeIds.value,
  582. boxName:row.boxName ? row.boxName : '',
  583. })
  584. sortingTableLoading.value = false
  585. if (!error && code === 200) {
  586. row.list = getArrValue(data['records'])
  587. setTableCheck(row, index)
  588. } else {
  589. row.list = []
  590. }
  591. }
  592. //表格ref
  593. const sorTableRef = ref([])
  594. //回显勾选
  595. const setTableCheck = async (row, index) => {
  596. //console.log(row)
  597. if (row.ids) {
  598. const keys = row.ids.split(',')
  599. for (const item of row.list) {
  600. if (keys.indexOf(item.id) > -1) {
  601. item.checked = true
  602. await nextTick()
  603. sorTableRef.value[index].toggleRowSelection(item, true)
  604. }
  605. }
  606. }
  607. }
  608. //多选
  609. const sortingTableKeys = ref([])
  610. const sortingTableSelection = (rows, list, event) => {
  611. //console.log(event)
  612. list.forEach(element => {
  613. element.checked = false
  614. })
  615. rows.forEach((element)=>{
  616. element.checked = true
  617. })
  618. }
  619. //删除
  620. const sortingDelData = (row, index) => {
  621. sortingItemData.value.splice(index, 1)
  622. }
  623. //添加分盒
  624. const addSortingModalClick = () => {
  625. sortingItemData.value.push({
  626. boxName: '',
  627. })
  628. }
  629. //确认保存
  630. const sortingModalLoading = ref(false)
  631. const sortingModalSave = async () => {
  632. sortingModalLoading.value = true
  633. //检测案卷名是否重复
  634. let nameRes = await checkNames()
  635. //console.log(nameRes)
  636. //return;
  637. for (let i = 0; i < nameRes.length; i++) {
  638. if (typeof nameRes[i].data == 'string') {
  639. window.$message?.error(nameRes[i].data + ',案卷名重复')
  640. sortingModalLoading.value = false
  641. return
  642. }
  643. }
  644. //组装数据
  645. let rows = []
  646. sortingItemData.value.forEach((item, index)=>{
  647. let obj = {
  648. ids:'',
  649. boxName:item.boxName,
  650. boxNumber:index + 1,
  651. }
  652. let list = []
  653. if (item.list) {
  654. item.list.forEach((item2)=>{
  655. if (item2.checked) {
  656. list.push(item2.id)
  657. }
  658. })
  659. obj.ids = list.join(',')
  660. } else {
  661. obj.ids = item.ids
  662. }
  663. rows.push(obj)
  664. })
  665. const { error, code, data } = await archiveFileApi.allocation({
  666. list: rows,
  667. })
  668. if (!error && code === 200) {
  669. window.$message?.success('保存成功')
  670. sortingModal.value = false
  671. } else {
  672. window.$message?.error('保存失败')
  673. }
  674. sortingModalLoading.value = false
  675. }
  676. const checkNames = () =>{
  677. const arr = []
  678. sortingItemData.value.forEach((item)=>{
  679. if (item.boxNumber) {
  680. if (item.isChange) {
  681. //是否修改过
  682. //对比旧的数据,是否相同
  683. for (let i = 0; i < sortingOldData.value.length; i++) {
  684. if (sortingOldData.value[i].boxNumber == item.boxNumber) {
  685. if (sortingOldData.value[i].boxName != item.boxName) {
  686. arr.push(
  687. archiveFileApi.getIsBoxName({
  688. boxName:item.boxName,
  689. }),
  690. )
  691. }
  692. return
  693. }
  694. }
  695. }
  696. } else {
  697. arr.push(
  698. archiveFileApi.getIsBoxName({
  699. boxName:item.boxName,
  700. }),
  701. )
  702. }
  703. })
  704. return Promise.all(arr)
  705. }
  706. //关闭
  707. const sortingModalClose = () => {
  708. sortingModal.value = false
  709. }
  710. //删除
  711. const delModalClick = async (_, resolve) => {
  712. let ids = []
  713. tableCheckedKeys.value.forEach((element)=>{
  714. ids.push(element.id)
  715. })
  716. const { error, code } = await archiveFileApi.remove({
  717. ids: ids.join(','),
  718. })
  719. //处理数据
  720. if (!error && code === 200) {
  721. window.$message?.success('操作成功')
  722. getTableData()
  723. }
  724. resolve()
  725. }
  726. //跨目录移动
  727. const movesModal = ref(false)
  728. const movesClick = async () => {
  729. movesModal.value = true
  730. treePanelLoading.value = true
  731. checkedMoves.value = []
  732. const { error, code, data } = await archiveFileApi.getarchiveFilePage({
  733. ...searchForm.value,
  734. current:1,
  735. size:50000,
  736. projectId: projectId.value,
  737. contractId: contractId.value,
  738. isArchive:1,
  739. isAutoFile:1,
  740. })
  741. treePanelLoading.value = false
  742. if (!error && code === 200) {
  743. fileDatasList.value = getArrValue(data['records'])
  744. } else {
  745. fileDatasList.value = []
  746. }
  747. }
  748. //选择需要迁移的文件
  749. const movesCheckAll = ref(false)
  750. const isIndeterminate = ref(true)
  751. const checkedMoves = ref([])
  752. //左侧待迁移文件
  753. const fileDatasList = ref([])
  754. //全选
  755. const handleCheckAllChange = (val) => {
  756. const checked = fileDatasList.value
  757. // checkedMoves.value = val ? keys : []
  758. checkedMoves.value = val ? checked : []
  759. isIndeterminate.value = false
  760. }
  761. //勾选
  762. const handleCheckedMovesChange = (value) => {
  763. const keys = fileDatasList.value
  764. const checkedCount = value.length
  765. movesCheckAll.value = checkedCount === keys.length
  766. isIndeterminate.value = checkedCount > 0 && checkedCount < keys.length
  767. }
  768. //右侧radio
  769. const movesTreeRef = ref(null)
  770. let radioNode = ref(null)
  771. const radioChange = (id)=>{
  772. //console.log(id)
  773. //radioNodeId = id;
  774. radioNode.value = movesTreeRef.value.ElTreeRef.getNode(id)
  775. }
  776. //只显示储存节点的单选
  777. const showRadioFun = (data)=>{
  778. if (data.isStorageNode == 1) {
  779. return true
  780. } else {
  781. return false
  782. }
  783. }
  784. //保存
  785. const movesModalLoading = ref(false)
  786. const movesModalSave = async () => {
  787. // let ids = checkedMoves.value.join(',')
  788. const keys = rowsToId(checkedMoves.value)
  789. let ids = keys
  790. if (checkedMoves.value.length < 1) {
  791. window.$message?.warning('请勾选需要迁移的文件')
  792. return
  793. }
  794. if (!radioNode.value) {
  795. window.$message?.warning('请选择要移动到的节点')
  796. return
  797. }
  798. movesModalLoading.value = true
  799. const { error, code, data } = await archiveFileApi.migrateFile({
  800. ids:ids,
  801. nodeId:radioNode.value.data.id,
  802. nodeSort:radioNode.value.data.treeSort,
  803. })
  804. movesModalLoading.value = false
  805. if (!error && code === 200) {
  806. window.$message?.success('保存成功')
  807. movesModal.value = false
  808. getTableData()
  809. } else {
  810. window.$message?.error('保存失败')
  811. }
  812. }
  813. //关闭
  814. const movesModalClose = () => {
  815. movesModal.value = false
  816. }
  817. //表格排序
  818. const sortModal = ref(false)
  819. //显示
  820. const tableSortClick = () => {
  821. sortModal.value = true
  822. getSortTableData()
  823. }
  824. //搜索表单
  825. const sortSearchForm = ref({
  826. nodeIds:'',
  827. current: 1, size: 20, total: 0,
  828. })
  829. //分页被点击
  830. const sortPageChange = ({ current, size }) => {
  831. sortSearchForm.value.current = current
  832. sortSearchForm.value.size = size
  833. getSortTableData()
  834. }
  835. //表格数据
  836. const sortTableColumn = ref([
  837. { key:'fileNumber', name: '档号', width: 160 },
  838. { key:'name', name: '案卷题名' },
  839. { key:'action', name: '排序', width: 90 },
  840. ])
  841. const sortTableData = ref([])
  842. const sortTableLoading = ref(false)
  843. const getSortTableData = async () => {
  844. sortTableLoading.value = true
  845. const { error, code, data } = await archiveFileApi.getarchiveFilePage({
  846. ...sortSearchForm.value,
  847. projectId: projectId.value,
  848. contractId: contractId.value,
  849. isAutoFile:1,
  850. isArchive:1,
  851. })
  852. sortTableLoading.value = false
  853. if (!error && code === 200) {
  854. sortTableData.value = getArrValue(data['records'])
  855. sortSearchForm.value.total = data['total'] || 0
  856. } else {
  857. sortTableData.value = []
  858. sortSearchForm.value.total = 0
  859. }
  860. }
  861. //拖动完成
  862. const sortTableRowDrop = (rows) => {
  863. sortTableData.value = [] // 先清空,否则排序会异常
  864. nextTick(() => {
  865. sortTableData.value = rows
  866. })
  867. }
  868. //向下
  869. const downSortClick = (index) => {
  870. const indexs = index + 1
  871. const data = sortTableData.value
  872. if (indexs !== data.length) {
  873. const tmp = data.splice(indexs, 1)
  874. sortTableData.value.splice(index, 0, tmp[0])
  875. } else {
  876. window?.$message?.warning('已经处于置底,无法下移')
  877. }
  878. }
  879. //向上
  880. const upSortClick = (index) => {
  881. const data = sortTableData.value || []
  882. if (index !== 0) {
  883. const tmp = data.splice(index - 1, 1)
  884. sortTableData.value.splice(index, 0, tmp[0])
  885. } else {
  886. window?.$message?.warning('已经处于置顶,无法上移')
  887. }
  888. }
  889. //保存
  890. const sortModalLoading = ref(false)
  891. const sortModalSave = async () => {
  892. let rows = sortTableData.value
  893. rows.forEach((element, index)=>{
  894. element.autoFileSort = index + 1
  895. })
  896. await batchUpdateSortApi(rows)
  897. sortModal.value = false
  898. }
  899. //关闭
  900. const sortModalClose = () => {
  901. sortModal.value = false
  902. }
  903. //获取认证状态
  904. const certificationType = ref([])
  905. const certificationStatus = async () => {
  906. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  907. typeOrStatus: 'certification_status',
  908. })
  909. //处理数据
  910. if (!error && code === 200) {
  911. certificationType.value = getArrValue(data)
  912. } else {
  913. certificationType.value = []
  914. }
  915. }
  916. //获取图幅类型
  917. const sheetType = ref([])
  918. const sheetTypeStatus = async () => {
  919. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  920. typeOrStatus: 'sheet_type',
  921. })
  922. //处理数据
  923. if (!error && code === 200) {
  924. sheetType.value = getArrValue(data)
  925. } else {
  926. sheetType.value = []
  927. }
  928. }
  929. //获取图表来源
  930. const sheetSourceType = ref([])
  931. const sheetSourceStatus = async () => {
  932. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  933. typeOrStatus: 'sheet_source',
  934. })
  935. //处理数据
  936. if (!error && code === 200) {
  937. sheetSourceType.value = getArrValue(data)
  938. } else {
  939. sheetSourceType.value = []
  940. }
  941. }
  942. //获取密级
  943. const securityLevel = ref([])
  944. const getSecurityLevel = async () => {
  945. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  946. typeOrStatus: 'security_level',
  947. })
  948. //处理数据
  949. if (!error && code === 200) {
  950. securityLevel.value = getArrValue(data)
  951. } else {
  952. securityLevel.value = []
  953. }
  954. }
  955. //获取保管期限
  956. const storagePeriod = ref([])
  957. const getStoragePeriod = async () => {
  958. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  959. typeOrStatus: 'storage_period',
  960. })
  961. //处理数据
  962. if (!error && code === 200) {
  963. storagePeriod.value = getArrValue(data)
  964. } else {
  965. storagePeriod.value = []
  966. }
  967. }
  968. //新增文件
  969. const tableUploadType = ref('add')
  970. const showUploadModal = ref(false)
  971. const uploadModalClick = () => {
  972. if (nodeIds.value && isStorageNode.value === 1) {
  973. tableUploadType.value = 'add'
  974. setTableUploadColumn()
  975. uploadSaveLoading.value = false
  976. tableUploadData.value = []
  977. showUploadModal.value = true
  978. } else {
  979. window?.$message?.warning('请先选择一个子节点')
  980. }
  981. }
  982. const uploadModalClose = ()=>{
  983. batchUploadCancel()
  984. }
  985. //设置文件表头
  986. const tableUploadColumn = ref([
  987. { key:'no', name: '序号', width: 100 },
  988. { key:'fileNumber', name: '档号', width: 160 },
  989. { key:'name', name: '案卷题名' },
  990. { key:'secretLevel', name: '密级', width: 100 },
  991. { key:'storageTime', name: '保管期限', width: 100 },
  992. { key:'unit', name: '立卷单位' },
  993. { key:'dates', name: '起止日期', width: 380 },
  994. { key:'action', name: '操作', width: 100 },
  995. ])
  996. const setTableUploadColumn = () => {
  997. }
  998. const tableUploadData = ref([])
  999. //上传的文件结果
  1000. const uploadsChange = (fileId, item) => {
  1001. if (getObjVal(item)) {
  1002. let newArr = tableUploadData.value
  1003. let name = item['originalName'] || ''
  1004. let fileName = name.substring(0, name.lastIndexOf('.'))
  1005. newArr.push({
  1006. fileUploadId: fileId,
  1007. projectId: projectId.value,
  1008. contractId: contractId.value,
  1009. nodeId: nodeIds.value,
  1010. name:fileName,
  1011. approvalFileList:[{
  1012. projectId: projectId.value,
  1013. contractId: contractId.value,
  1014. nodeId: nodeIds.value,
  1015. fileName: fileName,
  1016. fileNumber:'',
  1017. ossFileName: item?.name || '',
  1018. fileUrl: item?.link || '',
  1019. pdfFileUrl: item?.pdfUrl || '',
  1020. filePage: item?.page || '',
  1021. isApproval:0,
  1022. isNeedCertification:0,
  1023. dutyUser: userInfo.value.real_name,
  1024. fileSize:item['fileSize'],
  1025. }],
  1026. })
  1027. //tableUploadData.value = newArr
  1028. tableUploadData.value = arrKeySort(newArr, 'fileUploadId')
  1029. } else {
  1030. console.log(item)
  1031. }
  1032. }
  1033. //表单下拉数据
  1034. const whetherData = ref([
  1035. { label: '不需要', value: 0 },
  1036. { label: '需要', value: 1 },
  1037. ])
  1038. //删除
  1039. const delUploadData = async (row, index) => {
  1040. if (row['ossFileName']) {
  1041. row['delBtnLoading'] = true
  1042. await ossApi.removeFile({ fileName: row['ossFileName'] })
  1043. row['delBtnLoading'] = false
  1044. tableUploadData.value.splice(index, 1)
  1045. } else {
  1046. tableUploadData.value.splice(index, 1)
  1047. }
  1048. }
  1049. //批量上传保存
  1050. const uploadSaveLoading = ref(false)
  1051. const batchUploadSave = async () => {
  1052. const rows = tableUploadData.value
  1053. if (rows.length > 0) {
  1054. //验证表单数据
  1055. uploadSaveLoading.value = true
  1056. let isTableRows = false
  1057. //判断数据
  1058. if (isTableRows) {
  1059. uploadSaveLoading.value = false
  1060. window.$message?.warning('请先完善表单信息')
  1061. } else {
  1062. //数据处理
  1063. rows.forEach((element, index)=>{
  1064. if (element.dates) {
  1065. element.startDate = element.dates[0]
  1066. element.endDate = element.dates[1]
  1067. }
  1068. if (tableUploadType.value === 'add') {
  1069. element.autoFileSort = index + 1
  1070. }
  1071. })
  1072. if (tableUploadType.value === 'add') {
  1073. await batchUploadSaveApi(rows)
  1074. } else {
  1075. await batchEditSaveApi(rows)
  1076. }
  1077. }
  1078. } else {
  1079. window.$message?.warning('请先上传文件')
  1080. }
  1081. }
  1082. //确认上传保存
  1083. const batchUploadSaveApi = async (rows) => {
  1084. uploadSaveLoading.value = true
  1085. const { error, code } = await archiveFileApi.batchUploadSave({
  1086. list: rows,
  1087. }, false)
  1088. //判断状态
  1089. uploadSaveLoading.value = false
  1090. if (!error && code === 200) {
  1091. window.$message?.success('保存成功')
  1092. batchUploadCancel()
  1093. getTableData()
  1094. } else {
  1095. window.$message?.error('保存失败')
  1096. }
  1097. }
  1098. //取消上传
  1099. const batchUploadCancel = () => {
  1100. tableUploadData.value = []
  1101. uploadSaveLoading.value = false
  1102. uploadsLoading.value = false
  1103. showUploadModal.value = false
  1104. }
  1105. //批量编辑
  1106. const batchEditClick = () => {
  1107. const rows = deepClone(tableCheckedKeys.value)
  1108. //判断是否满足条件
  1109. tableUploadType.value = 'edit'
  1110. setTableUploadColumn()
  1111. uploadSaveLoading.value = false
  1112. tableUploadData.value = rows
  1113. showUploadModal.value = true
  1114. }
  1115. //确认编辑上传保存
  1116. const batchEditSaveApi = async (rows) => {
  1117. uploadSaveLoading.value = true
  1118. const { error, code } = await archiveFileApi.batchUploadSave({
  1119. list: rows,
  1120. }, false)
  1121. //判断状态
  1122. uploadSaveLoading.value = false
  1123. if (!error && code === 200) {
  1124. window.$message?.success('保存成功')
  1125. batchUploadCancel()
  1126. getTableData()
  1127. } else {
  1128. window.$message?.error('保存失败')
  1129. }
  1130. }
  1131. //确认排序
  1132. const batchUpdateSortApi = async (rows) => {
  1133. uploadSaveLoading.value = true
  1134. const { error, code } = await archiveFileApi.batchUpdateSort({
  1135. list: rows,
  1136. }, false)
  1137. //判断状态
  1138. uploadSaveLoading.value = false
  1139. if (!error && code === 200) {
  1140. window.$message?.success('保存成功')
  1141. batchUploadCancel()
  1142. getTableData()
  1143. } else {
  1144. window.$message?.error('保存失败')
  1145. }
  1146. }
  1147. //上传文件向下
  1148. const downUpSortClick = (index) => {
  1149. const indexs = index + 1
  1150. const data = tableUploadData.value
  1151. if (indexs !== data.length) {
  1152. const tmp = data.splice(indexs, 1)
  1153. tableUploadData.value.splice(index, 0, tmp[0])
  1154. } else {
  1155. window?.$message?.warning('已经处于置底,无法下移')
  1156. }
  1157. }
  1158. //上传文件向上
  1159. const upUpSortClick = (index) => {
  1160. const data = tableUploadData.value || []
  1161. if (index !== 0) {
  1162. const tmp = data.splice(index - 1, 1)
  1163. tableUploadData.value.splice(index, 0, tmp[0])
  1164. } else {
  1165. window?.$message?.warning('已经处于置顶,无法上移')
  1166. }
  1167. }
  1168. //批量设置
  1169. const batchSet = ref({
  1170. prefix:'',
  1171. numberStart:'',
  1172. numberEnd:'',
  1173. securityLevel:'',
  1174. storagePeriod:'',
  1175. unit:'',
  1176. })
  1177. //批量设置
  1178. const batchSetHandle = () => {
  1179. setSecurityLevel()
  1180. setStoragePeriod()
  1181. setFileNumber()
  1182. setFilingUnit()
  1183. }
  1184. //批量设置密级
  1185. const setSecurityLevel = () => {
  1186. if (batchSet.value.securityLevel) {
  1187. let isSet = true
  1188. // for (let i = 0; i < tableUploadData.value.length; i++) {
  1189. // if(tableUploadData.value[i].secretLevel!=='0' && tableUploadData.value[i].secretLevel){
  1190. // isSet = false;
  1191. // return;
  1192. // }
  1193. // }
  1194. //如果有一条数据选了,其他的都不进行设置
  1195. if (isSet) {
  1196. tableUploadData.value.forEach((element)=>{
  1197. element.secretLevel = batchSet.value.securityLevel
  1198. })
  1199. }
  1200. }
  1201. }
  1202. //批量设置保管期限
  1203. const setStoragePeriod = () => {
  1204. if (batchSet.value.storagePeriod) {
  1205. let isSet = true
  1206. // for (let i = 0; i < tableUploadData.value.length; i++) {
  1207. // if(tableUploadData.value[i].storageTime!=='0' && tableUploadData.value[i].storageTime){
  1208. // isSet = false;
  1209. // return;
  1210. // }
  1211. // }
  1212. //如果有一条数据选了,其他的都不进行设置
  1213. if (isSet) {
  1214. tableUploadData.value.forEach((element)=>{
  1215. element.storageTime = batchSet.value.storagePeriod
  1216. })
  1217. }
  1218. }
  1219. }
  1220. const setFileNumber = () => {
  1221. let isSet = true
  1222. // for (let i = 0; i < tableUploadData.value.length; i++) {
  1223. // if(tableUploadData.value[i].fileNumber){
  1224. // isSet = false;
  1225. // return;
  1226. // }
  1227. // }
  1228. if (!isSet) {
  1229. return
  1230. }
  1231. if (batchSet.value.prefix && batchSet.value.numberStart && batchSet.value.numberEnd) {
  1232. const regPos = /^[0-9]+.?[0-9]*/ //判断是否是数字。
  1233. if (!regPos.test(batchSet.value.numberStart)) {
  1234. window.$message?.warning('流水号 起号 存在非数字,请修改')
  1235. return
  1236. }
  1237. if (!regPos.test(batchSet.value.numberEnd)) {
  1238. window.$message?.warning('流水号 止号 存在非数字,请修改')
  1239. return
  1240. }
  1241. const startNum = Number(batchSet.value.numberStart)
  1242. const endNum = Number(batchSet.value.numberEnd)
  1243. if (startNum > endNum) {
  1244. window.$message?.warning('起号需要小于止号')
  1245. return
  1246. }
  1247. //获取最长的字符串长度
  1248. let numL = 0
  1249. if (batchSet.value.numberStart.length > batchSet.value.numberEnd.length) {
  1250. numL = batchSet.value.numberStart.length
  1251. } else {
  1252. numL = batchSet.value.numberEnd.length
  1253. }
  1254. let prefix = batchSet.value.prefix
  1255. //遍历赋值
  1256. let index = 0
  1257. for (let i = startNum; i <= endNum; i++) {
  1258. //超出就终止
  1259. if (tableUploadData.value[index] === undefined) {
  1260. return
  1261. }
  1262. //前面补零
  1263. const numStr = i.toString().padStart(numL, '0')
  1264. tableUploadData.value[index].fileNumber = prefix + numStr
  1265. index++
  1266. }
  1267. } else {
  1268. window.$message?.warning('档号由前缀和流水号组成,请填写完整再进行批量设置档号')
  1269. }
  1270. }
  1271. //立卷单位
  1272. const setFilingUnit = ()=>{
  1273. if (batchSet.value.unit) {
  1274. let isSet = true
  1275. // for (let i = 0; i < tableUploadData.value.length; i++) {
  1276. // if(tableUploadData.value[i].unit){
  1277. // isSet = false;
  1278. // return;
  1279. // }
  1280. // }
  1281. //如果有一条数据选了,其他的都不进行设置
  1282. if (isSet) {
  1283. tableUploadData.value.forEach((element)=>{
  1284. element.unit = batchSet.value.unit
  1285. })
  1286. }
  1287. }
  1288. }
  1289. //批量下载
  1290. const downloadLoading = ref(false)
  1291. const batchDownload = async () => {
  1292. let ids = []
  1293. tableCheckedKeys.value.forEach((element)=>{
  1294. ids.push(element.id)
  1295. })
  1296. downloadLoading.value = true
  1297. const { error, response, res } = await archiveFileApi.batchDownloadFileToZip({
  1298. ids:ids.join(','),
  1299. })
  1300. downloadLoading.value = false
  1301. if (!error) {
  1302. downloadBlob(res, response.headers['content-disposition'])
  1303. }
  1304. }
  1305. //名称被点击
  1306. const tableRowName = async (row) => {
  1307. const { error, code, data } = await archiveFileApi.mergePdf({
  1308. ids: row.id,
  1309. })
  1310. //处理数据
  1311. if (!error && code === 200) {
  1312. toPdfPage(data)
  1313. //window.open(data, '_blank')
  1314. }
  1315. }
  1316. //左右拖动,改变树形结构宽度
  1317. const leftWidth = ref(382)
  1318. const onmousedown = () => {
  1319. const leftNum = isCollapse.value ? 142 : 272
  1320. document.onmousemove = (ve) => {
  1321. let diffVal = ve.clientX - leftNum
  1322. if (diffVal >= 310 && diffVal <= 900) {
  1323. leftWidth.value = diffVal
  1324. }
  1325. }
  1326. document.onmouseup = () => {
  1327. document.onmousemove = null
  1328. document.onmouseup = null
  1329. }
  1330. }
  1331. const taskMount = ref('')
  1332. const splitLoad = ref(false)
  1333. const splitClick = async ()=>{
  1334. console.log('分解文件')
  1335. splitLoad.value = true
  1336. const rows = tableCheckedKeys.value
  1337. if (rows.length < 1) {
  1338. await window.$message.warning('没有选择案卷时,将会对该合同段下所有案卷进行分解')
  1339. }
  1340. const { error, code, data, msg } = await tasksApi.saveSplit({
  1341. contractId:contractId.value,
  1342. projectId:projectId.value,
  1343. ids:rows.map(item=>item.id).join(','),
  1344. })
  1345. splitLoad.value = false
  1346. //处理数据
  1347. if (!error && code === 200) {
  1348. splitInfo.value = data
  1349. console.log(data, 'data')
  1350. splitModal.value = true
  1351. splitInfo.value = getObjValue(data) || {}
  1352. } else {
  1353. window.$message.error(msg)
  1354. }
  1355. // splitModal.value = true
  1356. }
  1357. const splitInfo = ref({})
  1358. const splitList = ref([
  1359. ])
  1360. // 在script setup中添加
  1361. const splitListModal = ref(false)
  1362. const splitListLoading = ref(false)
  1363. const splitListColumn = ref([
  1364. { key: 'taskName', name: '任务名称' },
  1365. { key: 'finished', name: '完成数量', width: 100 },
  1366. { key: 'toolCount', name: '总条数', width: 100 },
  1367. ])
  1368. const splitListModalClose = () => {
  1369. splitListModal.value = false
  1370. }
  1371. // 修改taskCountClick方法
  1372. const taskCountClick = async () => {
  1373. await getSplitInfo()
  1374. splitListModal.value = true
  1375. }//查询任务信息
  1376. const getSplitInfo = async ()=>{
  1377. const { error, code, data } = await tasksApi.selectTaskSplit({
  1378. contractId:contractId.value,
  1379. projectId:projectId.value,
  1380. })
  1381. //处理数据
  1382. if (!error && code === 200) {
  1383. splitList.value = data['records']
  1384. if (data['records'].length > 0) {
  1385. taskMount.value = data['total']
  1386. }
  1387. } else {
  1388. splitList.value = []
  1389. taskMount.value = ''
  1390. }
  1391. }
  1392. const splitModal = ref(false)
  1393. const splitModalClose = ()=>{
  1394. splitModal.value = false
  1395. }
  1396. </script>
  1397. <style lang="scss">
  1398. @import '~style/file/records.scss';
  1399. .split-modal-content {
  1400. display: flex;
  1401. flex-direction: column;
  1402. align-items: center;
  1403. justify-content: center;
  1404. text-align: center;
  1405. padding: 20px;
  1406. }
  1407. /* 添加按钮样式 */
  1408. .split-confirm-btn {
  1409. padding: 12px 30px !important;
  1410. font-size: 16px !important;
  1411. }
  1412. </style>
  1413. <style scoped>
  1414. .item {
  1415. margin-top: 10px;
  1416. margin-right: 40px;
  1417. }
  1418. .custom-content {
  1419. display: flex;
  1420. align-items: center;
  1421. justify-content: center;
  1422. gap: 4px;
  1423. }
  1424. </style>