records.vue 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301
  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}}
  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/HcFileUpload.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. approvalFileList:[{
  883. projectId: projectId.value,
  884. contractId: contractId.value,
  885. nodeId: nodeIds.value,
  886. fileName: fileName,
  887. fileNumber:'',
  888. ossFileName: item?.name || '',
  889. fileUrl: item?.link || '',
  890. pdfFileUrl: item?.pdfUrl || '',
  891. filePage: item?.page || '',
  892. isApproval:0,
  893. isNeedCertification:0,
  894. dutyUser:userInfo.value.real_name
  895. }]
  896. })
  897. }
  898. }
  899. //上传进度
  900. const uploadsLoading = ref(false)
  901. const uploadsProgress = (val) => {
  902. uploadsLoading.value = val
  903. }
  904. //表单下拉数据
  905. const whetherData = ref([
  906. {label: "不需要", value: 0},
  907. {label: "需要", value: 1}
  908. ])
  909. //删除
  910. const delUploadData = async (row,index) => {
  911. if (row['ossFileName']) {
  912. row['delBtnLoading'] = true
  913. await ossApi.removeFile({fileName: row['ossFileName']})
  914. row['delBtnLoading'] = false
  915. tableUploadData.value.splice(index,1);
  916. } else {
  917. tableUploadData.value.splice(index,1);
  918. }
  919. }
  920. //批量上传保存
  921. const uploadSaveLoading = ref(false)
  922. const batchUploadSave = async () => {
  923. const rows = tableUploadData.value
  924. if (rows.length > 0) {
  925. //验证表单数据
  926. uploadSaveLoading.value = true
  927. let isTableRows = false;
  928. //判断数据
  929. if (isTableRows) {
  930. uploadSaveLoading.value = false
  931. window.$message?.warning('请先完善表单信息')
  932. } else {
  933. //数据处理
  934. rows.forEach((element,index)=>{
  935. element.startDate = element.dates[0]
  936. element.endDate = element.dates[1]
  937. element.autoFileSort = index+1
  938. })
  939. if (tableUploadType.value === 'add') {
  940. await batchUploadSaveApi(rows)
  941. } else {
  942. await batchEditSaveApi(rows)
  943. }
  944. }
  945. } else {
  946. window.$message?.warning('请先上传文件')
  947. }
  948. }
  949. //确认上传保存
  950. const batchUploadSaveApi = async (rows) => {
  951. uploadSaveLoading.value = true
  952. const {error, code} = await archiveFileApi.batchUploadSave({
  953. list: rows
  954. },false)
  955. //判断状态
  956. uploadSaveLoading.value = false
  957. if (!error && code === 200) {
  958. window.$message?.success('保存成功')
  959. batchUploadCancel()
  960. getTableData()
  961. } else {
  962. window.$message?.error('保存失败')
  963. }
  964. }
  965. //取消上传
  966. const batchUploadCancel = () => {
  967. tableUploadData.value = []
  968. uploadSaveLoading.value = false
  969. uploadsLoading.value = false
  970. showUploadModal.value = false
  971. }
  972. //批量编辑
  973. const batchEditClick = () => {
  974. const rows = deepClone(tableCheckedKeys.value)
  975. //判断是否满足条件
  976. tableUploadType.value = 'edit'
  977. setTableUploadColumn()
  978. uploadSaveLoading.value = false
  979. tableUploadData.value = rows
  980. showUploadModal.value = true
  981. }
  982. //确认编辑上传保存
  983. const batchEditSaveApi = async (rows) => {
  984. uploadSaveLoading.value = true
  985. const {error, code} = await archiveFileApi.batchUploadSave({
  986. list: rows
  987. },false)
  988. //判断状态
  989. uploadSaveLoading.value = false
  990. if (!error && code === 200) {
  991. window.$message?.success('保存成功')
  992. batchUploadCancel()
  993. getTableData()
  994. } else {
  995. window.$message?.error('保存失败')
  996. }
  997. }
  998. //上传文件向下
  999. const downUpSortClick = (index) => {
  1000. const indexs = index + 1
  1001. const data = tableUploadData.value
  1002. if(indexs !== data.length) {
  1003. const tmp = data.splice(indexs,1);
  1004. tableUploadData.value.splice(index,0,tmp[0]);
  1005. } else {
  1006. window?.$message?.warning('已经处于置底,无法下移')
  1007. }
  1008. }
  1009. //上传文件向上
  1010. const upUpSortClick = (index) => {
  1011. const data = tableUploadData.value || []
  1012. if(index !== 0) {
  1013. const tmp = data.splice(index - 1,1);
  1014. tableUploadData.value.splice(index,0,tmp[0]);
  1015. } else {
  1016. window?.$message?.warning('已经处于置顶,无法上移')
  1017. }
  1018. }
  1019. //批量设置
  1020. const batchSet = ref({
  1021. prefix:'',
  1022. numberStart:'',
  1023. numberEnd:'',
  1024. securityLevel:'',
  1025. storagePeriod:''
  1026. })
  1027. //批量设置
  1028. const batchSetHandle = () => {
  1029. setSecurityLevel()
  1030. setStoragePeriod()
  1031. setFileNumber()
  1032. }
  1033. //批量设置密级
  1034. const setSecurityLevel = () => {
  1035. if(batchSet.value.securityLevel){
  1036. let isSet = true;
  1037. for (let i = 0; i < tableUploadData.value.length; i++) {
  1038. if(tableUploadData.value[i].secretLevel!=='0' && tableUploadData.value[i].secretLevel){
  1039. isSet = false;
  1040. return;
  1041. }
  1042. }
  1043. //如果有一条数据选了,其他的都不进行设置
  1044. if(isSet){
  1045. tableUploadData.value.forEach((element)=>{
  1046. element.secretLevel = batchSet.value.securityLevel
  1047. })
  1048. }
  1049. }
  1050. }
  1051. //批量设置保管期限
  1052. const setStoragePeriod = () => {
  1053. if(batchSet.value.storagePeriod){
  1054. let isSet = true;
  1055. for (let i = 0; i < tableUploadData.value.length; i++) {
  1056. if(tableUploadData.value[i].storageTime!=='0' && tableUploadData.value[i].storageTime){
  1057. isSet = false;
  1058. return;
  1059. }
  1060. }
  1061. //如果有一条数据选了,其他的都不进行设置
  1062. if(isSet){
  1063. tableUploadData.value.forEach((element)=>{
  1064. element.storageTime = batchSet.value.storagePeriod
  1065. })
  1066. }
  1067. }
  1068. }
  1069. const setFileNumber = () => {
  1070. let isSet = true;
  1071. for (let i = 0; i < tableUploadData.value.length; i++) {
  1072. if(tableUploadData.value[i].fileNumber){
  1073. isSet = false;
  1074. return;
  1075. }
  1076. }
  1077. if(!isSet){
  1078. return;
  1079. }
  1080. if(batchSet.value.prefix && batchSet.value.numberStart && batchSet.value.numberEnd){
  1081. const regPos = /^[0-9]+.?[0-9]*/; //判断是否是数字。
  1082. if(!regPos.test(batchSet.value.numberStart)){
  1083. window.$message?.warning('流水号 起号 存在非数字,请修改')
  1084. return;
  1085. }
  1086. if(!regPos.test(batchSet.value.numberEnd)){
  1087. window.$message?.warning('流水号 止号 存在非数字,请修改')
  1088. return;
  1089. }
  1090. const startNum = Number(batchSet.value.numberStart);
  1091. const endNum = Number(batchSet.value.numberEnd);
  1092. if(startNum > endNum){
  1093. window.$message?.warning('起号需要小于止号')
  1094. return;
  1095. }
  1096. //获取最长的字符串长度
  1097. let numL = 0;
  1098. if(batchSet.value.numberStart.length > batchSet.value.numberEnd.length){
  1099. numL = batchSet.value.numberStart.length
  1100. }else{
  1101. numL = batchSet.value.numberEnd.length
  1102. }
  1103. //检测前缀最后是否有-
  1104. let prefix = batchSet.value.prefix;
  1105. if(prefix.charAt(prefix.length - 1) !== '-'){
  1106. //没有就加上
  1107. prefix = prefix + '-';
  1108. }
  1109. //遍历赋值
  1110. let index = 0;
  1111. for (let i = startNum; i <= endNum; i++) {
  1112. //超出就终止
  1113. if(tableUploadData.value[index] === undefined){
  1114. return;
  1115. }
  1116. //前面补零
  1117. const numStr = i.toString().padStart(numL,'0');
  1118. tableUploadData.value[index].fileNumber = prefix + numStr;
  1119. index++;
  1120. }
  1121. }else{
  1122. window.$message?.warning('档号由前缀和流水号组成,请填写完整再进行批量设置档号')
  1123. }
  1124. }
  1125. //批量下载
  1126. const downloadLoading = ref(false)
  1127. const batchDownload = async () => {
  1128. let ids = [];
  1129. tableCheckedKeys.value.forEach((element)=>{
  1130. ids.push(element.id)
  1131. })
  1132. downloadLoading.value = true
  1133. const { error,response, res} = await archiveFileApi.batchDownloadFileToZip({
  1134. ids:ids.join(',')
  1135. })
  1136. downloadLoading.value = false
  1137. if (!error) {
  1138. downloadBlob(res, response.headers['content-disposition'])
  1139. }
  1140. }
  1141. //名称被点击
  1142. const tableRowName = async (row) => {
  1143. const { error, code, data } = await archiveFileApi.mergePdf({
  1144. ids: row.id
  1145. })
  1146. //处理数据
  1147. if (!error && code === 200) {
  1148. window.open(data, '_blank')
  1149. }
  1150. }
  1151. //左右拖动,改变树形结构宽度
  1152. const leftWidth = ref(382);
  1153. const onmousedown = () => {
  1154. const leftNum = isCollapse.value ? 142 : 272
  1155. document.onmousemove = (ve) => {
  1156. let diffVal = ve.clientX - leftNum;
  1157. if(diffVal >= 310 && diffVal <= 900) {
  1158. leftWidth.value = diffVal;
  1159. }
  1160. }
  1161. document.onmouseup = () => {
  1162. document.onmousemove = null;
  1163. document.onmouseup = null;
  1164. }
  1165. }
  1166. </script>
  1167. <style lang="scss" scoped>
  1168. @import '~style/file/scoped/collection.scss';
  1169. .batch-set{
  1170. display: flex;
  1171. align-items: center;
  1172. margin-bottom: 10px;
  1173. .batch-set-input{
  1174. width: 80px;
  1175. }
  1176. }
  1177. .set-table{
  1178. height: calc(100% - 42px);
  1179. }
  1180. </style>
  1181. <style lang="scss">
  1182. @import '~style/file/collection.scss';
  1183. </style>