rolling.vue 8.8 KB

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