records.vue 42 KB

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