records.vue 45 KB

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