records.vue 41 KB

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