rolling.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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" @nodeLoading="treeNodeLoading" :autoExpandKeys="treeAutoExpandKeys" @menuTap="ElTreeMenuClick"/>
  16. <!--ProjectTree :datas="ElTreeData" :autoExpandKeys="TreeAutoExpandKeys" @nodeTap="nodeElTreeClick" :ischeck="false"/-->
  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 title="已形成的案卷">
  24. <!-- <template #header>
  25. <div class="hc-card-header-table-title">
  26. 已形成的案卷
  27. </div>
  28. </template> -->
  29. <template #extra>
  30. <div class="demo-progress">
  31. <el-progress
  32. :text-inside="true"
  33. :stroke-width="30"
  34. :percentage="88"
  35. status="success"
  36. />
  37. </div>
  38. <HcTooltip keys="archives_rolling_btn_update">
  39. <el-button type="primary" hc-btn @click="updateArchive" :loading="updateArchiveLoad">
  40. <HcIcon name="git-pull-request"/>
  41. <span>立即更新立卷</span>
  42. </el-button>
  43. </HcTooltip>
  44. </template>
  45. <HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck @selection-change="tableSelection">
  46. <template #name="{row}">
  47. <span class="text-link" @click="viewPdf(row.id)">{{row?.name}}</span>
  48. </template>
  49. </HcTable>
  50. <template #action>
  51. <HcPages :pages="searchForm" @change="pageChange"/>
  52. </template>
  53. </HcCard>
  54. </div>
  55. </div>
  56. </template>
  57. <script setup>
  58. import {ref, watch, onMounted} from "vue";
  59. import {useAppStore} from "~src/store";
  60. //import HcTree from "./components/hc-tree.vue"
  61. import HcTree from "~src/components/tree/hc-tree.vue"
  62. import ProjectTree from "./components/ProjectTree.vue"
  63. import projectScanningApi from "~api/other-file/projectScanning";
  64. import archiveFileApi from "~api/archiveFile/archiveFileAuto.js";
  65. import {getStoreValue, setStoreValue} from '~src/utils/storage'
  66. import {downloadBlob, getArrValue, deepClone} from "js-fast-way"
  67. //变量
  68. const useAppState = useAppStore()
  69. const projectId = ref(useAppState.getProjectId);
  70. const contractId = ref(useAppState.getContractId);
  71. const projectInfo = ref(useAppState.getProjectInfo);
  72. const isCollapse = ref(useAppState.getCollapse)
  73. import tuningApi from "~api/archiveConfig/tuning.js";
  74. //监听
  75. watch(() => [
  76. useAppState.getCollapse
  77. ], ([Collapse]) => {
  78. isCollapse.value = Collapse
  79. })
  80. //渲染完成
  81. onMounted(() => {
  82. getClassIfyList()
  83. })
  84. //树加载
  85. const treeLoading = ref(true)
  86. const treeNodeLoading = () => {
  87. treeLoading.value = false
  88. }
  89. //搜索表单
  90. const searchForm = ref({
  91. contractId: null, type: null, approval: null, betweenTime: null,
  92. current: 1, size: 20, total: 0
  93. })
  94. //树相关的变量
  95. const primaryKeyId = ref('')
  96. //日期时间被选择
  97. const betweenTime = ref(null)
  98. const betweenTimeUpdate = ({arr,query}) => {
  99. betweenTime.value = arr
  100. searchForm.value.betweenTime = query
  101. }
  102. //搜索
  103. const searchClick = () => {
  104. searchForm.value.current = 1;
  105. getTableData()
  106. }
  107. //分页被点击
  108. const pageChange = ({current, size}) => {
  109. searchForm.value.current = current
  110. searchForm.value.size = size
  111. getTableData()
  112. }
  113. //表格数据
  114. const tableRef = ref(null)
  115. const tableColumn = ref([
  116. {key:'fileNumber', name: '档号'},
  117. {key:'name', name: '案卷题名', width: 600},
  118. {key:'storageTimeValue', name: '保管期限'},
  119. {key:'pageN', name: '总页数'},
  120. ])
  121. const tableData = ref([])
  122. //获取数据
  123. const tableLoading = ref(false)
  124. const getTableData = async () => {
  125. tableLoading.value = true
  126. const { error, code, data } = await tuningApi.pageByArchive({
  127. ...searchForm.value,
  128. projectId: projectId.value,
  129. contractId: contractId.value,
  130. isArchive :1
  131. })
  132. tableLoading.value = false
  133. if (!error && code === 200) {
  134. tableData.value = getArrValue(data['records'])
  135. searchForm.value.total = data['total'] || 0
  136. } else {
  137. tableData.value = []
  138. searchForm.value.total = 0
  139. }
  140. }
  141. //多选
  142. const tableCheckedKeys = ref([]);
  143. const tableSelection = (rows) => {
  144. tableCheckedKeys.value = rows
  145. }
  146. //删除
  147. const delModalClick = () => {
  148. }
  149. //左右拖动,改变树形结构宽度
  150. const leftWidth = ref(382);
  151. const onmousedown = () => {
  152. const leftNum = isCollapse.value ? 142 : 272
  153. document.onmousemove = (ve) => {
  154. let diffVal = ve.clientX - leftNum;
  155. if(diffVal >= 310 && diffVal <= 900) {
  156. leftWidth.value = diffVal;
  157. }
  158. }
  159. document.onmouseup = () => {
  160. document.onmousemove = null;
  161. document.onmouseup = null;
  162. }
  163. }
  164. //获取树的数据
  165. const ElTreeData = ref([])
  166. let childtreedata = ref([])//子目录信息
  167. const getClassIfyList = async () => {
  168. const { error, code, data } = await projectScanningApi.getClassIfyList({
  169. projectId: projectId.value,
  170. contractId: contractId.value
  171. })
  172. //处理数据
  173. if (!error && code === 200) {
  174. ElTreeData.value = getArrValue(data)
  175. } else {
  176. ElTreeData.value = []
  177. }
  178. console.log(ElTreeData.value,'ElTreeData');
  179. }
  180. //自动展开缓存
  181. const TreeAutoExpandKeys = ref(getStoreValue('scanningTreeExpandKeys') || [])
  182. //项目树被点击
  183. const treeAutoExpandKeys = ref(getStoreValue('rollingExpandKeys') || [])
  184. const nodeElTreeClick = ({node, data, keys, key}) => {
  185. console.log('点击',data);
  186. searchForm.value.total = 0
  187. searchForm.value.current = 1
  188. searchForm.value.size = 20
  189. searchForm.value.nodeIds = data.id || '';
  190. getTableData()
  191. //缓存展开的节点
  192. setStoreValue('rollingExpandKeys', keys)
  193. treeAutoExpandKeys.value = keys || []
  194. }
  195. //树菜单被点击
  196. const ElTreeMenuClick = async ({key, node, data, keys}) => {
  197. setStoreValue('rollingExpandKeys', keys)
  198. treeAutoExpandKeys.value = keys || []
  199. }
  200. //预览pdf
  201. const viewPdf=async(id)=>{
  202. window.$message?.info('预览案卷需要合并pdf,需要一点时间')
  203. const { error, code, data,msg } = await tuningApi.printArchive({
  204. id:id
  205. })
  206. if (!error && code === 200) {
  207. if(data){
  208. window.open(data, '_blank')
  209. }else{
  210. window.$message?.warning('文件不存在')
  211. }
  212. } else {
  213. window.$message?.warning(msg)
  214. }
  215. }
  216. //更新立卷
  217. const updateArchiveLoad=ref(false)
  218. const updateArchive=async()=>{
  219. updateArchiveLoad.value=true
  220. const { error, code, data,msg } = await tuningApi.archiveAutoMethod({
  221. projectId:projectId.value,
  222. contractId:contractId.value
  223. })
  224. updateArchiveLoad.value=false
  225. if (!error && code === 200) {
  226. window.$message?.success(msg)
  227. }
  228. // else {
  229. // window.$message?.warning(msg)
  230. // }
  231. }
  232. </script>
  233. <style lang="scss" scoped>
  234. .hc-card-header-table-title{
  235. font-size: 1.125rem;
  236. line-height: 1.75rem;
  237. }
  238. .demo-progress .el-progress--line {
  239. margin-bottom: 15px;
  240. width: 350px;
  241. margin-top: 15px;
  242. margin-right: 15px;
  243. }
  244. </style>