records.vue 42 KB

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