records.vue 46 KB

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