records.vue 46 KB

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