records.vue 45 KB

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