tuning.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  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="nodeElTreeClick" @menuTap="ElTreeMenuClick" :autoExpandKeys="treeAutoExpandKeys"
  16. @nodeLoading="treeNodeLoading"/>
  17. </el-scrollbar>
  18. </div>
  19. <!--左右拖动-->
  20. <div class="horizontal-drag-line" @mousedown="onmousedown"/>
  21. </div>
  22. <div class="hc-page-content-box">
  23. <HcCard>
  24. <template #header>
  25. <div class="hc-card-header-table-title">
  26. 已形成的案卷
  27. </div>
  28. </template>
  29. <template #extra>
  30. <!--transfer_initial_expert_btn_sampling-->
  31. <HcTooltip keys="archives_tuning_btn_num">
  32. <el-button hc-btn @click="refreshFileNumberClick" :loading="refreshFileNumberLoading">
  33. <HcIcon name="folder-shared"/>
  34. <span>档号整理</span>
  35. </el-button>
  36. </HcTooltip>
  37. <HcTooltip keys="archives_tuning_btn_lock">
  38. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="lockarchives"
  39. :loading="lockLoad">
  40. <HcIcon name="file-lock"/>
  41. <span>档案锁定</span>
  42. </el-button>
  43. </HcTooltip>
  44. <HcTooltip keys="archives_tuning_btn_unlock">
  45. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="unlockarchives"
  46. :loading="unlockLoad">
  47. <HcIcon name="lock-unlock"/>
  48. <span>档案解锁</span>
  49. </el-button>
  50. </HcTooltip>
  51. <HcTooltip keys="archives_tuning_btn_remove">
  52. <el-button hc-btn @click="movesClick" :disabled="tableCheckedKeys.length <= 0">
  53. <HcIcon name="git-pull-request"/>
  54. <span>跨目录移动</span>
  55. </el-button>
  56. </HcTooltip>
  57. <HcTooltip keys="archives_tuning_btn_edit">
  58. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="batchEditClick(1)">
  59. <HcIcon name="edit"/>
  60. <span>编辑</span>
  61. </el-button>
  62. </HcTooltip>
  63. <HcTooltip keys="archives_tuning_btn_disassemble">
  64. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="tunModalClick">
  65. <HcIcon name="archive-drawer"/>
  66. <span>拆卷</span>
  67. </el-button>
  68. </HcTooltip>
  69. <!-- <HcTooltip keys="archives_tuning_btn_del">
  70. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" @click="delModalClick">
  71. <HcIcon name="delete-bin"/>
  72. <span>删除</span>
  73. </el-button>
  74. </HcTooltip> -->
  75. </template>
  76. <div class="body" :class="tableFileShow?'file-table':''">
  77. <div class="hc-c-table-box">
  78. <HcTable ref="tableRef"
  79. :column="tableColumn"
  80. :datas="tableData"
  81. :loading="tableLoading"
  82. isCheck
  83. @selection-change="tableSelection"
  84. @row-click="tableRowClick"
  85. :ui="hoverHand?'hover-hand':''"
  86. :isArrIndex="false"
  87. isCurrentRow
  88. >
  89. <template #table-column-header-num>
  90. <HcTooltip keys="archives_tuning_btn_sort">
  91. <span class="text-link text-lg" @click="tableSortClick">
  92. <HcIcon name="arrow-up-down"
  93. />
  94. </span>
  95. </HcTooltip>
  96. </template>
  97. <template #name="{row}">
  98. <span class="text-link" @click="viewPdf(row.id)">{{ row?.name }}</span>
  99. </template>
  100. </HcTable>
  101. </div>
  102. <div class="hc-f-table-box" v-if="tableFileShow">
  103. <div class="header-box">
  104. <div class="header">卷内文件</div>
  105. <div>
  106. <HcIcon name="edit" @click="batchEditClick(2)" class="hc-icon-close text-hover"
  107. style=" color:rgb(64, 149, 229);"/>
  108. <!-- <HcIcon name="delete-bin" @click="delModalClick" class="hc-icon-close text-hover"
  109. style="margin-left:5px;margin-right:5px;color: rgb(189, 49, 36);"/> -->
  110. <HcIcon name="close" @click="closetableFile" class="hc-icon-close text-hover"
  111. style=" color:rgb(64, 149, 229);"/>
  112. </div>
  113. </div>
  114. <div class="hc-file-table-box">
  115. <HcTable
  116. :loading="intableLoading"
  117. ref="tableFileRef"
  118. :column="innertableColumn"
  119. :datas="intableData"
  120. isCheck
  121. @selection-change="intableSelection"
  122. >
  123. <template #table-column-header-num>
  124. <HcTooltip keys="archives_tuning_btn_sort">
  125. <span class="text-link text-lg" @click="intableSortClick">
  126. <HcIcon name="arrow-up-down"
  127. :class="text-hover"/>
  128. </span>
  129. </HcTooltip>
  130. </template>
  131. </HcTable>
  132. <!-- <HcPages :pages="insearchForm" @change="inpageChange"/> -->
  133. </div>
  134. </div>
  135. </div>
  136. <template #action>
  137. <HcPages :pages="searchForm" @change="pageChange"/>
  138. </template>
  139. </HcCard>
  140. </div>
  141. <!--跨目录移动-->
  142. <HcDialog :show="movesModal" title="跨目录移动" widths="990px" isTable @close="movesModalClose"
  143. @save="movesModalSave" :loading="movesModalLoading">
  144. <div class="hc-moves-transfer-box">
  145. <div class="hc-moves-transfer-panel">
  146. <div class="panel-header">
  147. <div class="panel-header-label">
  148. <el-checkbox class="size-xl space" v-model="movesCheckAll" :indeterminate="isIndeterminate"
  149. @change="handleCheckAllChange">选择需要迁移的文件
  150. </el-checkbox>
  151. </div>
  152. <div class="panel-header-extra">{{ checkedMoves.length }}/{{ tableCheckedKeys.length }}</div>
  153. </div>
  154. <div class="panel-body">
  155. <el-scrollbar>
  156. <el-checkbox-group v-model="checkedMoves" @change="handleCheckedMovesChange">
  157. <div class="hc-file-checkbox" v-for="item in tableCheckedKeys" :key="item.id">
  158. <el-checkbox class="size-xl space" :label="item.id">{{ item.name }}</el-checkbox>
  159. </div>
  160. </el-checkbox-group>
  161. </el-scrollbar>
  162. </div>
  163. </div>
  164. <div class="hc-moves-transfer-buttons">
  165. <!-- <el-button hc-btn _icon size="small"
  166. :type="tableCheckedKeys.length <= 0 || checkedMoves.length <= 0 ? '' : 'primary'"
  167. :disabled="tableCheckedKeys.length <= 0 || checkedMoves.length <= 0">
  168. <HcIcon name="arrow-right"/>
  169. </el-button> -->
  170. <HcIcon type="primary" name="arrow-right-double" style="font-size: 22px;"/>
  171. </div>
  172. <div class="hc-moves-transfer-panel">
  173. <div class="panel-header">选择移动目录</div>
  174. <div class="panel-body">
  175. <el-scrollbar>
  176. <HcTree idPrefix="hc-tree-moves-" :projectId="projectId" :contractId="contractId" isRadio
  177. @noderadio="nodeRadio" :isShowMenu="false"/>
  178. </el-scrollbar>
  179. </div>
  180. </div>
  181. </div>
  182. </HcDialog>
  183. <!--调整排序-->
  184. <HcDialog :show="sortModal" title="调整排序" widths="980px" isTable isRowFooter @close="sortModalClose">
  185. <el-alert title="可拖动排序,也可在后面点击图标,切换排序" type="error" :closable="false"/>
  186. <div class="hc-table-h">
  187. <HcTable ui="hc-table-row-drop" :column="sortTableColumn" :datas="sortTableData"
  188. :loading="sortTableLoading" isRowDrop @row-drop="sortTableRowDrop">
  189. <template #action="{index}">
  190. <span class="text-link text-xl" @click="upSortClick(index)">
  191. <HcIcon name="arrow-up" fill/>
  192. </span>
  193. <span class="text-link text-xl ml-2" @click="downSortClick(index)">
  194. <HcIcon name="arrow-down" fill/>
  195. </span>
  196. </template>
  197. </HcTable>
  198. </div>
  199. <template #leftRowFooter>
  200. <el-button hc-btn @click="sortModalClose">
  201. <HcIcon name="close"/>
  202. <span>取消</span>
  203. </el-button>
  204. <el-button type="primary" hc-btn :loading="sortModalLoading" @click="sortModalSave">
  205. <HcIcon name="check"/>
  206. <span>确认</span>
  207. </el-button>
  208. </template>
  209. <template #rightRowFooter>
  210. <HcPages :pages="sortSearchForm" :sizes="[10, 20, 50, 100, 200, 300, 400, 500, 600]"
  211. @change="sortPageChange"/>
  212. </template>
  213. </HcDialog>
  214. <!--编辑案卷信息-->
  215. <el-dialog v-model="showUploadModal" :title="editTitle" width="80vw" class="hc-modal-border hc-modal-table">
  216. <HcTable ui="hc-form-table" :column="tableUploadColumn" :datas="tableUploadData"
  217. :loading="uploadSaveLoading">
  218. <template #name="{row}">
  219. <el-input v-model="row.name" :class="row['isFileNumber'] ? 'is-error' : ''"
  220. @input="tableIsInput($event, row, 'name')"/>
  221. </template>
  222. <template #fileNumber="{row}">
  223. <el-input v-model="row.fileNumber" :class="row['isFileNumber'] ? 'is-error' : ''"
  224. @input="tableIsInput($event, row, 'isFileNumber')"/>
  225. </template>
  226. <template #fileName="{row}">
  227. <el-input v-model="row.fileName" :class="row['isFileName'] ? 'is-error' : ''"
  228. @input="tableIsInput($event, row, 'isFileName')"/>
  229. </template>
  230. <template #fileTime="{row}" v-if="editType === 2">
  231. <el-date-picker v-model="row.fileTime" type="date" format="YYYYMMDD" value-format="YYYYMMDD"
  232. :clearable="false"/>
  233. </template>
  234. <template #unit="{row}">
  235. <el-input v-model="row.unit"/>
  236. </template>
  237. <template #remark="{row}">
  238. <el-input v-model="row.remark" type="textarea"/>
  239. </template>
  240. </HcTable>
  241. <template #footer>
  242. <div class="lr-dialog-footer">
  243. <div class="left flex items-center">
  244. </div>
  245. <div class="right">
  246. <el-button size="large" @click="batchUploadCancel">
  247. <HcIcon name="close"/>
  248. <span>取消</span>
  249. </el-button>
  250. <el-button type="primary" hc-btn :disabled="uploadSaveLoading" :loading="uploadSaveLoading"
  251. @click="batchUploadSave">
  252. <HcIcon name="save"/>
  253. <span>保存</span>
  254. </el-button>
  255. </div>
  256. </div>
  257. </template>
  258. </el-dialog>
  259. </div>
  260. </template>
  261. <script setup>
  262. import {ref, watch, onMounted} from "vue";
  263. import {useAppStore} from "~src/store";
  264. import HcTree from "~src/components/tree/hc-tree.vue"
  265. import {downloadBlob, getArrValue, deepClone} from "js-fast-way"
  266. import {delMessage, rowsToId, rowsToIdNumArr} from "~uti/tools";
  267. import tuningApi from "~api/archiveConfig/tuning.js";
  268. import archiveFileApi from "~api/archiveFile/archiveFileAuto.js";
  269. import {getStoreValue, setStoreValue} from '~src/utils/storage'
  270. //变量
  271. const useAppState = useAppStore()
  272. const projectId = ref(useAppState.getProjectId);
  273. const contractId = ref(useAppState.getContractId);
  274. const projectInfo = ref(useAppState.getProjectInfo);
  275. const isCollapse = ref(useAppState.getCollapse)
  276. const hoverHand = ref(true)
  277. //监听
  278. watch(() => [
  279. useAppState.getCollapse
  280. ], ([Collapse]) => {
  281. isCollapse.value = Collapse
  282. })
  283. //渲染完成
  284. onMounted(() => {
  285. // getClassIfyList()
  286. setTableColumns()
  287. })
  288. //树加载
  289. const treeLoading = ref(true)
  290. const treeNodeLoading = () => {
  291. treeLoading.value = false
  292. }
  293. //项目树被点击
  294. const nodeIds = ref('')
  295. const isStorageNode = ref(0)
  296. // const isBuiltDrawing = ref(0)
  297. //自动展开缓存
  298. const treeAutoExpandKeys = ref(getStoreValue('turningExpandKeys') || [])
  299. const nodeElTreeClick = ({node, data, keys, key}) => {
  300. //缓存展开的节点
  301. setStoreValue('turningExpandKeys', keys)
  302. treeAutoExpandKeys.value = keys || []
  303. console.log('点击', data);
  304. searchForm.value.total = 0
  305. searchForm.value.current = 1
  306. searchForm.value.size = 20
  307. searchForm.value.nodeIds = data.id || '';
  308. getTableData()
  309. }
  310. //树菜单被点击
  311. const ElTreeMenuClick = async ({key, node, data, keys}) => {
  312. setStoreValue('turningExpandKeys', keys)
  313. treeAutoExpandKeys.value = keys || []
  314. }
  315. const nodeRadio = ({node, data, keys, key}) => {
  316. console.log(data, 'data33333');
  317. chnodeId.value = data.id || '';
  318. console.log(chnodeId.value, ' chnodeId.value');
  319. }
  320. //搜索表单
  321. const searchForm = ref({
  322. contractId: null, type: null, approval: null,
  323. current: 1, size: 20, total: 0
  324. })
  325. const insearchForm = ref({
  326. contractId: null, type: null, approval: null,
  327. current: 1, size: 1000, total: 0
  328. })
  329. //树相关的变量
  330. const primaryKeyId = ref('')
  331. //分页被点击
  332. const pageChange = ({current, size}) => {
  333. searchForm.value.current = current
  334. searchForm.value.size = size
  335. getTableData()
  336. }
  337. //分页被点击
  338. const inpageChange = ({current, size}) => {
  339. insearchForm.value.current = current
  340. insearchForm.value.size = size
  341. getintableData()
  342. }
  343. //表格数据
  344. const tableRef = ref(null)
  345. const tableColumn = ref([])
  346. //设置表头
  347. const setTableColumns = () => {
  348. tableColumn.value = [
  349. {key: 'fileNumber', name: '档号'},
  350. {key: 'name', name: '案卷题名', width: 500},
  351. {key: 'storageTimeValue', name: '保管期限'},
  352. {key: 'pageN', name: '总页数'},
  353. ]
  354. }
  355. const tableData = ref([])
  356. //获取数据
  357. const tableLoading = ref(false)
  358. const getTableData = async () => {
  359. tableFileShow.value = false
  360. tableLoading.value = true
  361. const {error, code, data} = await tuningApi.pageByArchive({
  362. ...searchForm.value,
  363. projectId: projectId.value,
  364. contractId: contractId.value,
  365. isArchive: 1
  366. })
  367. tableLoading.value = false
  368. if (!error && code === 200) {
  369. tableData.value = getArrValue(data?.records)
  370. searchForm.value.total = data?.total || 0
  371. } else {
  372. tableData.value = []
  373. searchForm.value.total = 0
  374. }
  375. }
  376. const innertableColumn = ref([])
  377. const intableData = ref([])
  378. //设置表头
  379. const setInnertableColumn = () => {
  380. innertableColumn.value = [
  381. {key: 'fileNumber', name: '文件编号'},
  382. {key: 'fileName', name: '文件题名', width: 500},
  383. {key: 'fileTime', name: '文件日期'},
  384. {key: 'dutyUser', name: '责任者'},
  385. {key: 'pageNum', name: '页数'},
  386. ]
  387. }
  388. const intableLoading = ref(false)
  389. //获取卷内文件
  390. const getintableData = async () => {
  391. intableLoading.value = true
  392. const {error, code, data} = await tuningApi.getarchiveFilePage({
  393. ...insearchForm.value,
  394. nodeIds: searchForm.value.nodeIds,
  395. archiveId: checkInid.value
  396. })
  397. intableLoading.value = false
  398. if (!error && code === 200) {
  399. intableData.value = getArrValue(data['records'])
  400. insearchForm.value.total = data['total'] || 0
  401. } else {
  402. intableData.value = []
  403. insearchForm.value.total = data['total'] || 0
  404. }
  405. }
  406. //多选
  407. const tableCheckedKeys = ref([]);
  408. const intableCheckedKeys = ref([]);
  409. const tableSelection = (rows) => {
  410. tableCheckedKeys.value = rows
  411. }
  412. const intableSelection = (rows) => {
  413. intableCheckedKeys.value = rows
  414. }
  415. //删除
  416. const delModalClick = () => {
  417. let ids = ''
  418. const rows = intableCheckedKeys.value;
  419. ids = rowsToId(rows)
  420. if(rows.length>0){
  421. window?.$messageBox?.alert('请谨慎考虑是否要批量删除卷内文件?', '删除文件', {
  422. showCancelButton: true,
  423. confirmButtonText: '确认删除',
  424. cancelButtonText: '取消',
  425. type: 'warning',
  426. callback: async (action, ctx, close) => {
  427. ctx.confirmButtonLoading = true;
  428. if (action === 'confirm') {
  429. const {error, code, data, msg} = await tuningApi.removeFiles({
  430. ids: ids,
  431. archiveId: checkInid.value
  432. })
  433. ctx.confirmButtonLoading = false;
  434. if (!error && code === 200) {
  435. window.$message?.success(msg)
  436. getintableData()
  437. } else {
  438. window.$message?.warning(msg)
  439. }
  440. }
  441. }
  442. })
  443. }else{
  444. window.$message.warning('请先选择文件')
  445. }
  446. }
  447. const splitLoad = ref(false)
  448. const tunModalClick = () => {
  449. splitLoad.value = true
  450. window?.$messageBox?.alert('请谨慎考虑是否要批量拆除已经案卷及卷内文件?', '拆除案卷', {
  451. showCancelButton: true,
  452. confirmButtonText: '确认拆卷',
  453. cancelButtonText: '取消',
  454. type: 'warning',
  455. callback: async (action, ctx, close) => {
  456. if (action === 'confirm') {
  457. console.log(1111);
  458. ctx.confirmButtonLoading = true;
  459. let ids = ''
  460. const rows = tableCheckedKeys.value;
  461. ids = rowsToId(rows)
  462. const {error, code, data, msg} = await tuningApi.splitArchive({
  463. ids: ids
  464. })
  465. ctx.confirmButtonLoading = true;
  466. if (!error && code === 200) {
  467. window.$message?.success(msg)
  468. getTableData()
  469. }
  470. // else {
  471. // window.$message?.warning(msg)
  472. // }
  473. }
  474. }
  475. })
  476. }
  477. //左右拖动,改变树形结构宽度
  478. const leftWidth = ref(382);
  479. const onmousedown = () => {
  480. const leftNum = isCollapse.value ? 142 : 272
  481. document.onmousemove = (ve) => {
  482. let diffVal = ve.clientX - leftNum;
  483. if (diffVal >= 310 && diffVal <= 900) {
  484. leftWidth.value = diffVal;
  485. }
  486. }
  487. document.onmouseup = () => {
  488. document.onmousemove = null;
  489. document.onmouseup = null;
  490. }
  491. }
  492. //跨目录移动
  493. const movesModal = ref(false)
  494. const movesClick = () => {
  495. movesModal.value = true
  496. }
  497. //选择需要迁移的文件
  498. const movesCheckAll = ref(false)
  499. const isIndeterminate = ref(true)
  500. const checkedMoves = ref([])
  501. //全选
  502. const handleCheckAllChange = (val) => {
  503. const checked = tableCheckedKeys.value
  504. const keys = rowsToIdNumArr(checked);
  505. checkedMoves.value = val ? keys : []
  506. isIndeterminate.value = false
  507. }
  508. //勾选
  509. const handleCheckedMovesChange = (value) => {
  510. const keys = tableCheckedKeys.value
  511. const checkedCount = value.length
  512. movesCheckAll.value = checkedCount === keys.length
  513. isIndeterminate.value = checkedCount > 0 && checkedCount < keys.length
  514. }
  515. //保存
  516. const movesModalLoading = ref(false)
  517. const chnodeId = ref('')
  518. const movesModalSave = async () => {
  519. movesModalLoading.value = true
  520. console.log(checkedMoves.value, 'checkedMoves.value');
  521. let ids = checkedMoves.value.join(',')
  522. const {error, code, data, msg} = await tuningApi.moveArchive({
  523. ids: ids,
  524. nodeId: chnodeId.value
  525. })
  526. movesModalLoading.value = false
  527. if (!error && code === 200) {
  528. console.log(msg, 'msg');
  529. window.$message?.success(msg)
  530. getTableData()
  531. } else {
  532. window.$message?.warning(msg)
  533. }
  534. movesModal.value = false
  535. }
  536. //关闭
  537. const movesModalClose = () => {
  538. movesModal.value = false
  539. }
  540. //表格排序
  541. const sortModal = ref(false)
  542. //显示
  543. const tableSortClick = () => {
  544. sortModal.value = true
  545. sortType.value = 1
  546. setsortTableColumn()
  547. getSortTableData()
  548. }
  549. const intableSortClick = () => {
  550. sortModal.value = true
  551. sortType.value = 2
  552. setsortTableColumn()
  553. getSortTableData()
  554. }
  555. //表格行被点击
  556. const tableFileShow = ref(false)
  557. const checkInid = ref('')
  558. const tableRowClick = ({row}) => {
  559. tableFileShow.value = true;
  560. checkInid.value = row.id
  561. setInnertableColumn()
  562. getintableData()
  563. }
  564. //收起卷内文件
  565. const closetableFile = () => {
  566. tableFileShow.value = false
  567. }
  568. //卷内文件点击
  569. //搜索表单
  570. const sortSearchForm = ref({
  571. current: 1, size: 20, total: 0
  572. })
  573. //分页被点击
  574. const sortPageChange = ({current, size}) => {
  575. searchForm.value.current = current
  576. searchForm.value.size = size
  577. getSortTableData()
  578. }
  579. const setsortTableColumn = () => {
  580. if (sortType.value === 1) {
  581. sortTableColumn.value = [
  582. {key: 'fileNumber', name: '档号', width: 160},
  583. {key: 'name', name: '案卷名称'},
  584. {key: 'action', name: '排序', width: 90},
  585. ]
  586. } else if (sortType.value === 2) {
  587. sortTableColumn.value = [
  588. {key: 'fileNumber', name: '文件编号', width: 160},
  589. {key: 'fileName', name: '文件名称'},
  590. {key: 'action', name: '排序', width: 90},
  591. ]
  592. }
  593. }
  594. //表格数据
  595. const sortTableColumn = ref([
  596. {key: 'fileNumber', name: '档号', width: 160},
  597. {key: 'name', name: '案卷名称'},
  598. {key: 'action', name: '排序', width: 90},
  599. ])
  600. const sortTableData = ref([])
  601. const sortTableLoading = ref(false)
  602. const sortType = ref()
  603. const getSortTableData = async() => {
  604. // if (sortType.value === 1) {
  605. // sortTableData.value = tableCheckedKeys.value
  606. // sortSearchForm.value.total = sortTableData.value.length
  607. // } else if (sortType.value === 2) {
  608. // sortTableData.value = intableCheckedKeys.value
  609. // sortSearchForm.value.total = intableCheckedKeys.value.length
  610. // }
  611. // sortSearchForm.value.current = 1
  612. if(sortType.value === 1){
  613. sortTableLoading.value = true
  614. const {error, code, data} = await tuningApi.pageByArchive({
  615. ...searchForm.value,
  616. projectId: projectId.value,
  617. contractId: contractId.value,
  618. isArchive: 0
  619. })
  620. sortTableLoading.value = false
  621. if (!error && code === 200) {
  622. sortTableData.value = getArrValue(data['records'])
  623. sortSearchForm.value.total = data['total'] || 0
  624. } else {
  625. sortTableData.value = []
  626. sortSearchForm.value.total = 0
  627. }
  628. }else if(sortType.value === 2){
  629. sortTableLoading.value = true
  630. const {error, code, data} = await tuningApi.getarchiveFilePage({
  631. ...insearchForm.value,
  632. nodeIds: searchForm.value.nodeIds,
  633. archiveId: checkInid.value
  634. })
  635. sortTableLoading.value = false
  636. if (!error && code === 200) {
  637. sortTableData.value = getArrValue(data['records'])
  638. sortSearchForm.value.total = data['total'] || 0
  639. } else {
  640. sortTableData.value = []
  641. sortSearchForm.value.total = 0
  642. }
  643. }
  644. sortSearchForm.value.current = 1
  645. }
  646. //拖动完成
  647. const sortTableRowDrop = (rows) => {
  648. sortTableData.value = rows
  649. }
  650. //向下
  651. const downSortClick = (index) => {
  652. const indexs = index + 1
  653. const data = sortTableData.value
  654. if (indexs !== data.length) {
  655. const tmp = data.splice(indexs, 1);
  656. sortTableData.value.splice(index, 0, tmp[0]);
  657. } else {
  658. window?.$message?.warning('已经处于置底,无法下移')
  659. }
  660. }
  661. //向上
  662. const upSortClick = (index) => {
  663. const data = sortTableData.value || []
  664. if (index !== 0) {
  665. const tmp = data.splice(index - 1, 1);
  666. sortTableData.value.splice(index, 0, tmp[0]);
  667. } else {
  668. window?.$message?.warning('已经处于置顶,无法上移')
  669. }
  670. }
  671. //保存
  672. const sortModalLoading = ref(false)
  673. const sortModalSave = () => {
  674. sortModal.value = false
  675. }
  676. //关闭
  677. const sortModalClose = () => {
  678. sortModal.value = false
  679. }
  680. //编辑
  681. const showUploadModal = ref(false)
  682. const isBuiltDrawing = ref(0)
  683. const editTitle = ref('')
  684. const editType = ref()
  685. //批量上传保存
  686. const uploadSaveLoading = ref(false)
  687. //批量编辑
  688. //批量编辑
  689. const batchEditClick = (type) => {
  690. let rows = []
  691. if (type === 1) {
  692. editTitle.value = '编辑案卷信息'
  693. editType.value = 1
  694. rows = deepClone(tableCheckedKeys.value)
  695. } else {
  696. editTitle.value = '编辑文件信息'
  697. editType.value = 2
  698. rows = deepClone(intableCheckedKeys.value)
  699. }
  700. //判断状态
  701. setTableUploadColumn(type)
  702. uploadSaveLoading.value = false
  703. tableUploadData.value = rows
  704. if(rows.length>0){
  705. showUploadModal.value = true
  706. }else{
  707. window.$message.warning('请先选择文件')
  708. }
  709. }
  710. //设置文件表头
  711. const tableUploadColumn = ref([])
  712. const setTableUploadColumn = (type) => {
  713. if (type === 1) {
  714. tableUploadColumn.value = [
  715. {key: 'fileNumber', name: '档号'},
  716. {key: 'name', name: '案卷题名'},
  717. {key: 'unit', name: '立卷单位'},
  718. {key: 'remark', name: '备注'},
  719. ]
  720. } else {
  721. tableUploadColumn.value = [
  722. {key: 'fileNumber', name: '文件编号'},
  723. {key: 'fileName', name: '文件题名'},
  724. {key: 'fileTime', name: '文件日期'},
  725. {key: 'dutyUser', name: '责任者'},
  726. ]
  727. }
  728. }
  729. const tableUploadData = ref([])
  730. const batchUploadCancel = () => {
  731. showUploadModal.value = false
  732. tableUploadData.value = []
  733. }
  734. //确认上传保存
  735. const batchUploadSaveApi = async (rows) => {
  736. uploadSaveLoading.value = true
  737. const {error, code} = await archiveFileApi.batchUploadSave({
  738. list: rows
  739. }, false)
  740. //判断状态
  741. uploadSaveLoading.value = false
  742. if (!error && code === 200) {
  743. window.$message?.success('保存成功')
  744. batchUploadCancel()
  745. getTableData()
  746. } else {
  747. window.$message?.error('保存失败')
  748. }
  749. }
  750. //确认上传保存
  751. const archiveFileBatchUpdate = async (rows) => {
  752. uploadSaveLoading.value = true
  753. const {error, code} = await tuningApi.archiveFileBatchUpdate({
  754. list: rows
  755. }, false)
  756. //判断状态
  757. uploadSaveLoading.value = false
  758. if (!error && code === 200) {
  759. window.$message?.success('保存成功')
  760. batchUploadCancel()
  761. getTableData()
  762. } else {
  763. window.$message?.error('保存失败')
  764. }
  765. }
  766. //批量新增编辑保存
  767. const batchUploadSave = async () => {
  768. const rows = tableUploadData.value
  769. if (rows.length > 0) {
  770. //验证表单数据
  771. uploadSaveLoading.value = true
  772. let isTableRows = false;
  773. //判断数据
  774. if (isTableRows) {
  775. uploadSaveLoading.value = false
  776. window.$message?.warning('请先完善表单信息')
  777. } else {
  778. console.log(rows, 'rows');
  779. if (editType.value === 2) {
  780. //数据处理
  781. rows.forEach((element, index) => {
  782. const {dates} = element
  783. element.startDate = dates ? dates[0] : null
  784. element.endDate = dates ? dates[1] : null
  785. element.autoFileSort = index + 1
  786. })
  787. await archiveFileBatchUpdate(rows)
  788. } else {
  789. await batchUploadSaveApi(rows)
  790. }
  791. // if (tableUploadType.value === 'add') {
  792. // await batchUploadSaveApi(rows)
  793. // } else {
  794. // await batchEditSaveApi(rows)
  795. // }
  796. }
  797. } else {
  798. window.$message?.warning('请先上传文件')
  799. }
  800. }
  801. const lockLoad = ref(false)
  802. const unlockLoad = ref(false)
  803. //档案锁定
  804. const lockarchives = async () => {
  805. lockLoad.value = true
  806. let ids = ''
  807. const rows = tableCheckedKeys.value;
  808. ids = rowsToId(rows)
  809. const {error, code, data, msg} = await tuningApi.archivesautoLock({
  810. ids: ids
  811. })
  812. lockLoad.value = false
  813. if (!error && code === 200) {
  814. console.log(msg, 'msg');
  815. window.$message?.success(msg)
  816. getTableData()
  817. } else {
  818. window.$message?.warning(msg)
  819. }
  820. }
  821. const unlockarchives = async () => {
  822. unlockLoad.value = true
  823. let ids = ''
  824. const rows = tableCheckedKeys.value;
  825. ids = rowsToId(rows)
  826. const {error, code, data, msg} = await tuningApi.archivesautoUnLock({
  827. ids: ids
  828. })
  829. unlockLoad.value = false
  830. if (!error && code === 200) {
  831. window.$message?.success(msg)
  832. getTableData()
  833. } else {
  834. window.$message?.warning(msg)
  835. }
  836. }
  837. const viewPdf = async (id) => {
  838. window.$message?.info('预览案卷需要合并pdf,需要一点时间')
  839. const {error, code, data, msg} = await tuningApi.printArchive({
  840. id: id
  841. })
  842. if (!error && code === 200) {
  843. if (data) {
  844. window.open(data, '_blank')
  845. } else {
  846. window.$message?.warning('文件不存在')
  847. }
  848. }
  849. // else {
  850. // window.$message?.warning(msg)
  851. // }
  852. }
  853. //档号整理
  854. const refreshFileNumberLoading = ref(false)
  855. const refreshFileNumberClick = async () => {
  856. const {error, code, msg} = await tuningApi.refreshFileNumber({
  857. projectId: projectId.value,
  858. contractId: contractId.value,
  859. nodeId: searchForm.value.nodeIds || '',
  860. })
  861. if (!error && code === 200) {
  862. window.$message?.success(msg)
  863. } else {
  864. window.$message?.warning(msg)
  865. }
  866. }
  867. </script>
  868. <style lang="scss" scoped>
  869. .hc-card-header-table-title {
  870. font-size: 1.125rem;
  871. line-height: 1.75rem;
  872. }
  873. .rowbox {
  874. text-align: center;
  875. }
  876. .body {
  877. position: relative;
  878. // height: calc(100% - 140px);
  879. height: calc(100% - 0px);
  880. padding: 16px;
  881. .hc-c-table-box {
  882. position: relative;
  883. height: 100%;
  884. }
  885. .hc-f-table-box {
  886. position: relative;
  887. height: 300px;
  888. margin-top: 24px;
  889. background: #f1f5f8;
  890. .header-box {
  891. border-bottom: initial;
  892. display: flex;
  893. justify-content: space-between;
  894. height: 60px;
  895. background-color: var(--el-fill-color-lighter);
  896. line-height: 60px;
  897. padding-left: 15px;
  898. padding-right: 15px;
  899. .hc-icon-close {
  900. font-size: 18px;
  901. }
  902. }
  903. .hc-file-table-box {
  904. position: relative;
  905. height: calc(100% - 55px);
  906. }
  907. }
  908. &.file-table .hc-c-table-box {
  909. height: calc(100% - 324px);
  910. }
  911. }
  912. @import '~style/file/scoped/collection.scss';
  913. </style>
  914. <style lang="scss">
  915. @import '~style/file/collection.scss';
  916. .text-disable {
  917. cursor: not-allowed
  918. }
  919. .hover-hand {
  920. cursor: pointer;
  921. }
  922. </style>