records.vue 42 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361
  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" @close="uploadModalClose">
  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. isArchive:1,
  649. isAutoFile:1
  650. })
  651. if (!error && code === 200) {
  652. fileDatasList.value = getArrValue(data['records'])
  653. } else {
  654. fileDatasList.value = []
  655. }
  656. }
  657. //选择需要迁移的文件
  658. const movesCheckAll = ref(false)
  659. const isIndeterminate = ref(true)
  660. const checkedMoves = ref([])
  661. //左侧待迁移文件
  662. const fileDatasList = ref([])
  663. //全选
  664. const handleCheckAllChange = (val) => {
  665. const checked = fileDatasList.value
  666. const keys = rowsToIdNumArr(checked);
  667. checkedMoves.value = val ? keys : []
  668. isIndeterminate.value = false
  669. }
  670. //勾选
  671. const handleCheckedMovesChange = (value) => {
  672. const keys = fileDatasList.value
  673. const checkedCount = value.length
  674. movesCheckAll.value = checkedCount === keys.length
  675. isIndeterminate.value = checkedCount > 0 && checkedCount < keys.length
  676. }
  677. //右侧radio
  678. const movesTreeRef = ref(null)
  679. let radioNode = ref(null)
  680. const radioChange = (id)=>{
  681. //console.log(id)
  682. //radioNodeId = id;
  683. radioNode.value = movesTreeRef.value.ElTreeRef.getNode(id);
  684. }
  685. //只显示储存节点的单选
  686. const showRadioFun = (data)=>{
  687. if(data.isStorageNode == 1){
  688. return true;
  689. }else{
  690. return false;
  691. }
  692. }
  693. //保存
  694. const movesModalLoading = ref(false)
  695. const movesModalSave = async() => {
  696. let ids = checkedMoves.value.join(',')
  697. if(checkedMoves.value.length < 1){
  698. window.$message?.warning('请勾选需要迁移的文件')
  699. return;
  700. }
  701. if(!radioNode.value){
  702. window.$message?.warning('请选择要移动到的节点')
  703. return;
  704. }
  705. movesModalLoading.value = true;
  706. const { error, code, data } = await archiveFileApi.migrateFile({
  707. ids:ids,
  708. nodeId:radioNode.value.data.id,
  709. nodeSort:radioNode.value.data.treeSort,
  710. })
  711. movesModalLoading.value = false
  712. if (!error && code === 200) {
  713. window.$message?.success('保存成功')
  714. movesModal.value = false
  715. getTableData()
  716. } else {
  717. window.$message?.error('保存失败')
  718. }
  719. }
  720. //关闭
  721. const movesModalClose = () => {
  722. movesModal.value = false
  723. }
  724. //表格排序
  725. const sortModal = ref(false)
  726. //显示
  727. const tableSortClick = () => {
  728. sortModal.value = true
  729. getSortTableData()
  730. }
  731. //搜索表单
  732. const sortSearchForm = ref({
  733. nodeIds:'',
  734. current: 1, size: 20, total: 0
  735. })
  736. //分页被点击
  737. const sortPageChange = ({current, size}) => {
  738. sortSearchForm.value.current = current
  739. sortSearchForm.value.size = size
  740. getSortTableData()
  741. }
  742. //表格数据
  743. const sortTableColumn = ref([
  744. {key:'fileNumber', name: '档号', width: 160},
  745. {key:'name', name: '案卷题名'},
  746. {key:'action', name: '排序', width: 90},
  747. ])
  748. const sortTableData = ref([])
  749. const sortTableLoading = ref(false)
  750. const getSortTableData = async () => {
  751. sortTableLoading.value = true
  752. const { error, code, data } = await archiveFileApi.getarchiveFilePage({
  753. ...sortSearchForm.value,
  754. projectId: projectId.value,
  755. contractId: contractId.value,
  756. })
  757. sortTableLoading.value = false
  758. if (!error && code === 200) {
  759. sortTableData.value = getArrValue(data['records'])
  760. sortSearchForm.value.total = data['total'] || 0
  761. } else {
  762. sortTableData.value = []
  763. sortSearchForm.value.total = 0
  764. }
  765. }
  766. //拖动完成
  767. const sortTableRowDrop = (rows) => {
  768. sortTableData.value = rows
  769. }
  770. //向下
  771. const downSortClick = (index) => {
  772. const indexs = index + 1
  773. const data = sortTableData.value
  774. if(indexs !== data.length) {
  775. const tmp = data.splice(indexs,1);
  776. sortTableData.value.splice(index,0,tmp[0]);
  777. } else {
  778. window?.$message?.warning('已经处于置底,无法下移')
  779. }
  780. }
  781. //向上
  782. const upSortClick = (index) => {
  783. const data = sortTableData.value || []
  784. if(index !== 0) {
  785. const tmp = data.splice(index - 1,1);
  786. sortTableData.value.splice(index,0,tmp[0]);
  787. } else {
  788. window?.$message?.warning('已经处于置顶,无法上移')
  789. }
  790. }
  791. //保存
  792. const sortModalLoading = ref(false)
  793. const sortModalSave = async() => {
  794. let rows = sortTableData.value;
  795. rows.forEach((element,index)=>{
  796. element.autoFileSort = index+1
  797. })
  798. await batchEditSaveApi(rows)
  799. sortModal.value = false
  800. }
  801. //关闭
  802. const sortModalClose = () => {
  803. sortModal.value = false
  804. }
  805. //获取认证状态
  806. const certificationType = ref([])
  807. const certificationStatus = async () => {
  808. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  809. typeOrStatus: 'certification_status'
  810. })
  811. //处理数据
  812. if (!error && code === 200) {
  813. certificationType.value = getArrValue(data)
  814. } else {
  815. certificationType.value = []
  816. }
  817. }
  818. //获取图幅类型
  819. const sheetType = ref([])
  820. const sheetTypeStatus = async () => {
  821. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  822. typeOrStatus: 'sheet_type'
  823. })
  824. //处理数据
  825. if (!error && code === 200) {
  826. sheetType.value = getArrValue(data)
  827. } else {
  828. sheetType.value = []
  829. }
  830. }
  831. //获取图表来源
  832. const sheetSourceType = ref([])
  833. const sheetSourceStatus = async () => {
  834. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  835. typeOrStatus: 'sheet_source'
  836. })
  837. //处理数据
  838. if (!error && code === 200) {
  839. sheetSourceType.value = getArrValue(data)
  840. } else {
  841. sheetSourceType.value = []
  842. }
  843. }
  844. //获取密级
  845. const securityLevel = ref([])
  846. const getSecurityLevel = async () => {
  847. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  848. typeOrStatus: 'security_level'
  849. })
  850. //处理数据
  851. if (!error && code === 200) {
  852. securityLevel.value = getArrValue(data)
  853. } else {
  854. securityLevel.value = []
  855. }
  856. }
  857. //获取保管期限
  858. const storagePeriod = ref([])
  859. const getStoragePeriod = async () => {
  860. const { error, code, data } = await tasksApi.queryTaskTypeStatus({
  861. typeOrStatus: 'storage_period'
  862. })
  863. //处理数据
  864. if (!error && code === 200) {
  865. storagePeriod.value = getArrValue(data)
  866. } else {
  867. storagePeriod.value = []
  868. }
  869. }
  870. //新增文件
  871. const tableUploadType = ref('add')
  872. const showUploadModal = ref(false)
  873. const uploadModalClick = () => {
  874. if (nodeIds.value && isStorageNode.value === 1) {
  875. tableUploadType.value = 'add'
  876. setTableUploadColumn()
  877. uploadSaveLoading.value = false
  878. tableUploadData.value = []
  879. showUploadModal.value = true
  880. } else {
  881. window?.$message?.warning('请先选择一个子节点')
  882. }
  883. }
  884. const uploadModalClose=()=>{
  885. batchUploadCancel()
  886. HcUploadFileRef?.value.cancel()
  887. HcUploadFileRef?.value.isShow(false)
  888. }
  889. //设置文件表头
  890. const tableUploadColumn = ref([
  891. {key:'no', name: '序号', width: 100},
  892. {key:'fileNumber', name: '档号', width: 160},
  893. {key:'name', name: '案卷题名'},
  894. {key:'secretLevel', name: '密级', width: 100},
  895. {key:'storageTime', name: '保管期限', width: 100},
  896. {key:'filingUnit', name: '立卷单位'},
  897. {key:'dates', name: '起止日期', width: 380},
  898. {key:'action', name: '操作', width: 100}
  899. ])
  900. const setTableUploadColumn = () => {
  901. }
  902. const tableUploadData = ref([])
  903. //上传的文件结果
  904. const uploadsChange = (item) => {
  905. if (getObjVal(item)) {
  906. let newArr = tableUploadData.value
  907. let name = item['originalName'] || ''
  908. let fileName = name.substring(0, name.lastIndexOf("."))
  909. newArr.push({
  910. projectId: projectId.value,
  911. contractId: contractId.value,
  912. nodeId: nodeIds.value,
  913. name:fileName,
  914. approvalFileList:[{
  915. projectId: projectId.value,
  916. contractId: contractId.value,
  917. nodeId: nodeIds.value,
  918. fileName: fileName,
  919. fileNumber:'',
  920. ossFileName: item?.name || '',
  921. fileUrl: item?.link || '',
  922. pdfFileUrl: item?.pdfUrl || '',
  923. filePage: item?.page || '',
  924. isApproval:0,
  925. isNeedCertification:0,
  926. dutyUser: userInfo.value.real_name
  927. }]
  928. })
  929. tableUploadData.value = newArr
  930. } else {
  931. console.log(item)
  932. }
  933. }
  934. //表单下拉数据
  935. const whetherData = ref([
  936. {label: "不需要", value: 0},
  937. {label: "需要", value: 1}
  938. ])
  939. //删除
  940. const delUploadData = async (row,index) => {
  941. if (row['ossFileName']) {
  942. row['delBtnLoading'] = true
  943. await ossApi.removeFile({fileName: row['ossFileName']})
  944. row['delBtnLoading'] = false
  945. tableUploadData.value.splice(index,1);
  946. } else {
  947. tableUploadData.value.splice(index,1);
  948. }
  949. }
  950. //批量上传保存
  951. const uploadSaveLoading = ref(false)
  952. const batchUploadSave = async () => {
  953. const rows = tableUploadData.value
  954. if (rows.length > 0) {
  955. //验证表单数据
  956. uploadSaveLoading.value = true
  957. let isTableRows = false;
  958. //判断数据
  959. if (isTableRows) {
  960. uploadSaveLoading.value = false
  961. window.$message?.warning('请先完善表单信息')
  962. } else {
  963. //数据处理
  964. rows.forEach((element,index)=>{
  965. if(element.dates){
  966. element.startDate = element.dates[0]
  967. element.endDate = element.dates[1]
  968. }
  969. element.autoFileSort = index+1
  970. })
  971. if (tableUploadType.value === 'add') {
  972. await batchUploadSaveApi(rows)
  973. } else {
  974. await batchEditSaveApi(rows)
  975. }
  976. }
  977. } else {
  978. window.$message?.warning('请先上传文件')
  979. }
  980. }
  981. //确认上传保存
  982. const batchUploadSaveApi = async (rows) => {
  983. uploadSaveLoading.value = true
  984. const {error, code} = await archiveFileApi.batchUploadSave({
  985. list: rows
  986. },false)
  987. //判断状态
  988. uploadSaveLoading.value = false
  989. if (!error && code === 200) {
  990. window.$message?.success('保存成功')
  991. batchUploadCancel()
  992. getTableData()
  993. } else {
  994. window.$message?.error('保存失败')
  995. }
  996. }
  997. //取消上传
  998. const batchUploadCancel = () => {
  999. tableUploadData.value = []
  1000. uploadSaveLoading.value = false
  1001. uploadsLoading.value = false
  1002. showUploadModal.value = false
  1003. }
  1004. //批量编辑
  1005. const batchEditClick = () => {
  1006. const rows = deepClone(tableCheckedKeys.value)
  1007. //判断是否满足条件
  1008. tableUploadType.value = 'edit'
  1009. setTableUploadColumn()
  1010. uploadSaveLoading.value = false
  1011. tableUploadData.value = rows
  1012. showUploadModal.value = true
  1013. }
  1014. //确认编辑上传保存
  1015. const batchEditSaveApi = async (rows) => {
  1016. uploadSaveLoading.value = true
  1017. const {error, code} = await archiveFileApi.batchUploadSave({
  1018. list: rows
  1019. },false)
  1020. //判断状态
  1021. uploadSaveLoading.value = false
  1022. if (!error && code === 200) {
  1023. window.$message?.success('保存成功')
  1024. batchUploadCancel()
  1025. getTableData()
  1026. } else {
  1027. window.$message?.error('保存失败')
  1028. }
  1029. }
  1030. //上传文件向下
  1031. const downUpSortClick = (index) => {
  1032. const indexs = index + 1
  1033. const data = tableUploadData.value
  1034. if(indexs !== data.length) {
  1035. const tmp = data.splice(indexs,1);
  1036. tableUploadData.value.splice(index,0,tmp[0]);
  1037. } else {
  1038. window?.$message?.warning('已经处于置底,无法下移')
  1039. }
  1040. }
  1041. //上传文件向上
  1042. const upUpSortClick = (index) => {
  1043. const data = tableUploadData.value || []
  1044. if(index !== 0) {
  1045. const tmp = data.splice(index - 1,1);
  1046. tableUploadData.value.splice(index,0,tmp[0]);
  1047. } else {
  1048. window?.$message?.warning('已经处于置顶,无法上移')
  1049. }
  1050. }
  1051. //批量设置
  1052. const batchSet = ref({
  1053. prefix:'',
  1054. numberStart:'',
  1055. numberEnd:'',
  1056. securityLevel:'',
  1057. storagePeriod:'',
  1058. filingUnit:'',
  1059. })
  1060. //批量设置
  1061. const batchSetHandle = () => {
  1062. setSecurityLevel()
  1063. setStoragePeriod()
  1064. setFileNumber()
  1065. setFilingUnit()
  1066. }
  1067. //批量设置密级
  1068. const setSecurityLevel = () => {
  1069. if(batchSet.value.securityLevel){
  1070. let isSet = true;
  1071. for (let i = 0; i < tableUploadData.value.length; i++) {
  1072. if(tableUploadData.value[i].secretLevel!=='0' && tableUploadData.value[i].secretLevel){
  1073. isSet = false;
  1074. return;
  1075. }
  1076. }
  1077. //如果有一条数据选了,其他的都不进行设置
  1078. if(isSet){
  1079. tableUploadData.value.forEach((element)=>{
  1080. element.secretLevel = batchSet.value.securityLevel
  1081. })
  1082. }
  1083. }
  1084. }
  1085. //批量设置保管期限
  1086. const setStoragePeriod = () => {
  1087. if(batchSet.value.storagePeriod){
  1088. let isSet = true;
  1089. for (let i = 0; i < tableUploadData.value.length; i++) {
  1090. if(tableUploadData.value[i].storageTime!=='0' && tableUploadData.value[i].storageTime){
  1091. isSet = false;
  1092. return;
  1093. }
  1094. }
  1095. //如果有一条数据选了,其他的都不进行设置
  1096. if(isSet){
  1097. tableUploadData.value.forEach((element)=>{
  1098. element.storageTime = batchSet.value.storagePeriod
  1099. })
  1100. }
  1101. }
  1102. }
  1103. const setFileNumber = () => {
  1104. let isSet = true;
  1105. for (let i = 0; i < tableUploadData.value.length; i++) {
  1106. if(tableUploadData.value[i].fileNumber){
  1107. isSet = false;
  1108. return;
  1109. }
  1110. }
  1111. if(!isSet){
  1112. return;
  1113. }
  1114. if(batchSet.value.prefix && batchSet.value.numberStart && batchSet.value.numberEnd){
  1115. const regPos = /^[0-9]+.?[0-9]*/; //判断是否是数字。
  1116. if(!regPos.test(batchSet.value.numberStart)){
  1117. window.$message?.warning('流水号 起号 存在非数字,请修改')
  1118. return;
  1119. }
  1120. if(!regPos.test(batchSet.value.numberEnd)){
  1121. window.$message?.warning('流水号 止号 存在非数字,请修改')
  1122. return;
  1123. }
  1124. const startNum = Number(batchSet.value.numberStart);
  1125. const endNum = Number(batchSet.value.numberEnd);
  1126. if(startNum > endNum){
  1127. window.$message?.warning('起号需要小于止号')
  1128. return;
  1129. }
  1130. //获取最长的字符串长度
  1131. let numL = 0;
  1132. if(batchSet.value.numberStart.length > batchSet.value.numberEnd.length){
  1133. numL = batchSet.value.numberStart.length
  1134. }else{
  1135. numL = batchSet.value.numberEnd.length
  1136. }
  1137. //检测前缀最后是否有-
  1138. let prefix = batchSet.value.prefix;
  1139. if(prefix.charAt(prefix.length - 1) !== '-'){
  1140. //没有就加上
  1141. prefix = prefix + '-';
  1142. }
  1143. //遍历赋值
  1144. let index = 0;
  1145. for (let i = startNum; i <= endNum; i++) {
  1146. //超出就终止
  1147. if(tableUploadData.value[index] === undefined){
  1148. return;
  1149. }
  1150. //前面补零
  1151. const numStr = i.toString().padStart(numL,'0');
  1152. tableUploadData.value[index].fileNumber = prefix + numStr;
  1153. index++;
  1154. }
  1155. }else{
  1156. window.$message?.warning('档号由前缀和流水号组成,请填写完整再进行批量设置档号')
  1157. }
  1158. }
  1159. //立卷单位
  1160. const setFilingUnit = ()=>{
  1161. if(batchSet.value.filingUnit){
  1162. let isSet = true;
  1163. for (let i = 0; i < tableUploadData.value.length; i++) {
  1164. if(tableUploadData.value[i].filingUnit){
  1165. isSet = false;
  1166. return;
  1167. }
  1168. }
  1169. //如果有一条数据选了,其他的都不进行设置
  1170. if(isSet){
  1171. tableUploadData.value.forEach((element)=>{
  1172. element.filingUnit = batchSet.value.filingUnit
  1173. })
  1174. }
  1175. }
  1176. }
  1177. //批量下载
  1178. const downloadLoading = ref(false)
  1179. const batchDownload = async () => {
  1180. let ids = [];
  1181. tableCheckedKeys.value.forEach((element)=>{
  1182. ids.push(element.id)
  1183. })
  1184. downloadLoading.value = true
  1185. const { error,response, res} = await archiveFileApi.batchDownloadFileToZip({
  1186. ids:ids.join(',')
  1187. })
  1188. downloadLoading.value = false
  1189. if (!error) {
  1190. downloadBlob(res, response.headers['content-disposition'])
  1191. }
  1192. }
  1193. //名称被点击
  1194. const tableRowName = async (row) => {
  1195. const { error, code, data } = await archiveFileApi.mergePdf({
  1196. ids: row.id
  1197. })
  1198. //处理数据
  1199. if (!error && code === 200) {
  1200. window.open(data, '_blank')
  1201. }
  1202. }
  1203. //左右拖动,改变树形结构宽度
  1204. const leftWidth = ref(382);
  1205. const onmousedown = () => {
  1206. const leftNum = isCollapse.value ? 142 : 272
  1207. document.onmousemove = (ve) => {
  1208. let diffVal = ve.clientX - leftNum;
  1209. if(diffVal >= 310 && diffVal <= 900) {
  1210. leftWidth.value = diffVal;
  1211. }
  1212. }
  1213. document.onmouseup = () => {
  1214. document.onmousemove = null;
  1215. document.onmouseup = null;
  1216. }
  1217. }
  1218. </script>
  1219. <style lang="scss" scoped>
  1220. @import '~style/file/scoped/collection.scss';
  1221. .batch-set{
  1222. display: flex;
  1223. align-items: center;
  1224. margin-bottom: 10px;
  1225. .batch-set-input{
  1226. width: 80px;
  1227. }
  1228. }
  1229. .set-table{
  1230. height: calc(100% - 42px);
  1231. }
  1232. </style>
  1233. <style lang="scss">
  1234. @import '~style/file/collection.scss';
  1235. </style>