records.vue 45 KB

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