阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

418 lines
17 KiB

1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 months ago
2 years ago
2 years ago
2 years ago
2 months ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 months ago
3 months ago
2 years ago
2 years ago
2 years ago
3 months ago
1 year ago
2 years ago
2 years ago
2 years ago
3 months ago
2 years ago
2 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 months ago
2 years ago
2 years ago
2 years ago
2 years ago
3 months ago
2 years ago
2 years ago
2 years ago
2 years ago
3 months ago
2 years ago
2 years ago
2 years ago
2 years ago
3 months ago
2 years ago
2 years ago
3 months ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
1 year ago
2 years ago
2 years ago
2 years ago
  1. import { FetchInitCategoryViewTable } from '@/api/collect/collect'
  2. import { FetchInitContorlView } from '@/api/archivesManage/library'
  3. import { FetchDictionaryTree } from '@/api/system/dict'
  4. import { crud } from '@crud/crud'
  5. export const manageLibraryCrud = {
  6. mixins: [crud()],
  7. // 组件共用属性
  8. data() {
  9. return {
  10. getTableDisplayFieldsLoading: false,
  11. tableDisplayFields: [],
  12. projectData: [],
  13. anjuanData: [],
  14. junneiData: [],
  15. fileData: [],
  16. arrySort: [],
  17. page: {
  18. page: localStorage.getItem('currentPage') ? parseInt(localStorage.getItem('currentPage')) : 0,
  19. size: 10,
  20. total: 0
  21. },
  22. timer: null,
  23. query: {
  24. search: null,
  25. project_class: null,
  26. archive_ctg_no: null
  27. },
  28. classifyTree: [],
  29. classifyLoading: false,
  30. parentsId: null
  31. }
  32. },
  33. // 组件挂载时的共用方法
  34. mounted() {
  35. },
  36. // 组件共用方法
  37. methods: {
  38. // 筛选可销毁/可开放文件
  39. handleFilterChange(val) {
  40. console.log('this.collectLevel:', this.collectLevel)
  41. console.log('选中的值为:', this.parentsData.checklist)
  42. this.handleSearch(this.collectLevel)
  43. },
  44. // 缓存用户对于固定栏操作习惯
  45. statusBarChecked(val) {
  46. this.fixedStatusBar = val
  47. localStorage.setItem('statusBarFixedType', val)
  48. },
  49. hasValue(obj) {
  50. for (const key in obj) {
  51. if (obj.hasOwnProperty(key) && obj[key] !== null && obj[key] !== '') {
  52. return true
  53. }
  54. }
  55. return false
  56. },
  57. handleSearch(categoryLevel) {
  58. const queryResult = this.hasValue(this.query)
  59. console.log(queryResult)
  60. if (localStorage.getItem('currentPage') && !queryResult && this.selectStatus.length === 0 && this.parentsData.checklist.length === 0) {
  61. this.page.page = parseInt(localStorage.getItem('currentPage'))
  62. } else {
  63. this.page.page = 0
  64. }
  65. this.parentsData.$refs.classifyTree.setCurrentKey(null)
  66. // this.smartQuery = {
  67. // 'retention': null,
  68. // 'security_class': null,
  69. // 'doc_type': null,
  70. // 'medium_type': null,
  71. // 'archive_year': null,
  72. // 'fonds_no': null
  73. // }
  74. this.smartQuery = this.parentsData.smartQuery
  75. // 2 项目 3 案卷 /文件 4 卷内 6 文件
  76. if (this.isTitleType === 2) {
  77. this.parentsId = null
  78. this.$parent.getTableDisplayFieldsLoading = true
  79. } else if (this.isTitleType === 3) {
  80. if (this.selectedCategory.arrangeType === 1) {
  81. this.parentsId = null
  82. } else {
  83. if (this.activeIndex === 1) {
  84. this.parentsId = null
  85. } else {
  86. this.parentsId = this.parentsData.parentsProjectId
  87. }
  88. }
  89. this.$parent.getTableDisplayFieldsLoading = true
  90. } else if (this.isTitleType === 4) {
  91. // 卷内
  92. this.$parent.$parent.getTableDisplayFieldsLoading = true
  93. this.parentsId = this.parentsData.parentsAnjuanId
  94. } else if (this.isTitleType === 6) {
  95. // 原文
  96. if (this.selectedCategory.arrangeType === 1) {
  97. this.parentsId = this.parentsData.parentsAnjuanId
  98. this.$parent.getTableDisplayFieldsLoading = true
  99. } else {
  100. this.$parent.$parent.getTableDisplayFieldsLoading = true
  101. if (this.parentsData.isTabFile) {
  102. this.parentsId = this.parentsData.parentsAnjuanId
  103. } else {
  104. this.parentsId = this.parentsData.parentsJuanneiId
  105. }
  106. }
  107. }
  108. setTimeout(() => {
  109. this.getViewTable(categoryLevel, this.parentsId, 'search')
  110. }, 200)
  111. },
  112. getViewTable(categoryLevel, parentsId, type) {
  113. this.getTableDisplayFieldsLoading = true
  114. this.tableDisplayFields = []
  115. FetchInitCategoryViewTable({ categoryId: this.selectedCategory.id, categoryLevel: categoryLevel }).then((res) => {
  116. if (res) {
  117. this.arrySort = []
  118. this.tableDisplayFields = res
  119. const orderSortArry = this.tableDisplayFields.filter(item => item.queue).sort((a, b) => a.queue - b.queue)
  120. orderSortArry.forEach(item => {
  121. if (item.displayOrderBy) {
  122. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  123. }
  124. })
  125. this.$nextTick(() => {
  126. this.getViewTableList(categoryLevel, parentsId, type)
  127. })
  128. }
  129. })
  130. },
  131. getViewTableList(categoryLevel, parentsId, type) {
  132. console.log('checklist', this.parentsData.checklist)
  133. const currentPageSize = localStorage.getItem('currentPageSize')
  134. if (currentPageSize) {
  135. this.page.size = parseInt(currentPageSize)
  136. } else {
  137. this.page.size = 10
  138. }
  139. const params = {
  140. 'parentId': parentsId,
  141. 'categoryId': this.selectedCategory.id,
  142. 'categoryLevel': categoryLevel,
  143. 'ignore': false,
  144. // 'isdel': (this.parentsData.isdel && this.selectedCategory.arrangeType === 2 && categoryLevel === 3) ? false : this.parentsData.isdel,
  145. 'isdel': this.parentsData.isdel === true ? this.parentsData.isdel : false,
  146. 'checkTypes': this.selectStatus && this.selectStatus.length !== 0 ? this.selectStatus.join(',') : null,
  147. 'search': this.query.search,
  148. 'retention': this.smartQuery.retention,
  149. 'security_class': this.smartQuery.security_class,
  150. 'medium_type': this.smartQuery.medium_type,
  151. 'doc_type': this.smartQuery.doc_type,
  152. 'archive_year': this.smartQuery.archive_year,
  153. 'organ_or_function': this.smartQuery.organ_or_function,
  154. 'fonds_no': this.smartQuery.fonds_no,
  155. 'project_class': this.query.project_class,
  156. 'archive_ctg_no': this.query.archive_ctg_no,
  157. 'page': this.page.page,
  158. 'size': this.page.size,
  159. 'sort': this.arrySort,
  160. 'canOpen': this.parentsData.checklist && this.parentsData.checklist.length === 0 ? null : (this.parentsData.checklist && this.parentsData.checklist.includes(1) ? true : null),
  161. 'canDestroy': this.parentsData.checklist && this.parentsData.checklist.length === 0 ? null : (this.parentsData.checklist && this.parentsData.checklist.includes(2) ? true : null)
  162. }
  163. FetchInitContorlView(params).then((res) => {
  164. if (res.code !== 500) {
  165. this.parentsData.listCategory = res.category
  166. const baseCategory = res.category.id
  167. if (categoryLevel === 1) {
  168. // 项目
  169. const projectObj = this.parentsData.$refs.projectEle
  170. // this.projectData = res.list.content
  171. this.projectData = res.list.content.map(item => {
  172. return {
  173. ...item,
  174. baseCategory: baseCategory
  175. }
  176. })
  177. this.page.total = res.list.totalElements
  178. this.yearData = res.yearGroup
  179. if (this.yearData && type !== 'quickFilter') {
  180. this.$emit('myYearEvent', this.yearData)
  181. }
  182. if (type === 'search') {
  183. // projectObj.projectData = res.list.content
  184. this.projectData = res.list.content.map(item => {
  185. return {
  186. ...item,
  187. baseCategory: baseCategory
  188. }
  189. })
  190. projectObj.currentPage = this.page.page + 1
  191. // projectObj.page.page = 1
  192. // projectObj.page.size = 10
  193. projectObj.page.total = res.list.totalElements
  194. projectObj.getTableDisplayFieldsLoading = false
  195. }
  196. } else if (categoryLevel === 2) {
  197. // 案卷
  198. const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  199. // this.anjuanData = res.list.content
  200. this.anjuanData = res.list.content.map(item => {
  201. return {
  202. ...item,
  203. baseCategory: baseCategory
  204. }
  205. })
  206. this.page.total = res.list.totalElements
  207. this.yearData = res.yearGroup
  208. if (this.yearData && type !== 'quickFilter') {
  209. this.$parent.$parent.$emit('myYearEvent', this.yearData)
  210. }
  211. // 搜索/新增/编辑 非 案卷是主页的时候
  212. if (type === 'search') {
  213. // anjuanObj.anjuanData = res.list.content
  214. anjuanObj.anjuanData = res.list.content.map(item => {
  215. return {
  216. ...item,
  217. baseCategory: baseCategory
  218. }
  219. })
  220. anjuanObj.currentPage = this.page.page + 1
  221. // anjuanObj.page.page = 1
  222. // anjuanObj.page.size = 10
  223. anjuanObj.page.total = res.list.totalElements
  224. anjuanObj.getTableDisplayFieldsLoading = false
  225. }
  226. } else if (categoryLevel === 3) {
  227. if (this.isTitleType === 3) {
  228. // 案卷下的未整理 / 文件为主页时
  229. const wjObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  230. // this.anjuanData = res.list.content
  231. this.anjuanData = res.list.content.map(item => {
  232. return {
  233. ...item,
  234. baseCategory: baseCategory
  235. }
  236. })
  237. this.page.total = res.list.totalElements
  238. this.yearData = res.yearGroup
  239. if (this.yearData && type !== 'quickFilter') {
  240. this.$parent.$parent.$emit('myYearEvent', this.yearData)
  241. }
  242. if (type === 'search') {
  243. console.log('wjObj', wjObj)
  244. // wjObj.anjuanData = res.list.content
  245. wjObj.anjuanData = res.list.content.map(item => {
  246. return {
  247. ...item,
  248. baseCategory: baseCategory
  249. }
  250. })
  251. wjObj.currentPage = this.page.page + 1
  252. // wjObj.page.page = 1
  253. // wjObj.page.size = 10
  254. wjObj.page.total = res.list.totalElements
  255. wjObj.getTableDisplayFieldsLoading = false
  256. }
  257. } else {
  258. // 卷内
  259. // this.junneiData = res.list.content
  260. this.junneiData = res.list.content.map(item => {
  261. return {
  262. ...item,
  263. baseCategory: baseCategory
  264. }
  265. })
  266. this.page.total = res.list.totalElements
  267. if (type === 'search') {
  268. this.parentsData.$refs.juanneiEle.junneiData = res.list.content
  269. this.parentsData.$refs.juanneiEle.currentPage = this.page.page + 1
  270. // this.parentsData.$refs.fileEle.page.page = 1
  271. // this.parentsData.$refs.fileEle.page.size = 10
  272. this.parentsData.$refs.juanneiEle.page.total = res.list.totalElements
  273. this.parentsData.$refs.juanneiEle.getTableDisplayFieldsLoading = false
  274. }
  275. }
  276. } else {
  277. // 原文
  278. // this.fileData = res.list.content
  279. this.fileData = res.list.content.map(item => {
  280. return {
  281. ...item,
  282. baseCategory: baseCategory
  283. }
  284. })
  285. this.page.total = res.list.totalElements
  286. if (type === 'search') {
  287. this.parentsData.$refs.fileEle.fileData = res.list.content
  288. this.parentsData.$refs.fileEle.currentPage = this.page.page + 1
  289. this.parentsData.$refs.fileEle.page.total = res.list.totalElements
  290. this.parentsData.$refs.fileEle.getTableDisplayFieldsLoading = false
  291. }
  292. }
  293. }
  294. this.getTableDisplayFieldsLoading = false
  295. this.crud.selections = []
  296. if (categoryLevel === 3) {
  297. // 按件
  298. if (this.isTitleType === 3) {
  299. const wjObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  300. wjObj.selections = []
  301. wjObj.$refs.table.clearSelection() // 清空选中
  302. wjObj.$refs.table.setCurrentRow(-1) // 清除高亮
  303. } else {
  304. const juanneiObj = this.parentsData.$refs.juanneiEle
  305. juanneiObj.selections = []
  306. juanneiObj.$refs.table.clearSelection()
  307. juanneiObj.$refs.table.setCurrentRow(-1)
  308. }
  309. } else if (categoryLevel === 2) {
  310. // 按卷
  311. const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  312. anjuanObj.selections = []
  313. anjuanObj.$refs.table.clearSelection()
  314. anjuanObj.$refs.table.setCurrentRow(-1)
  315. } else if (categoryLevel === 1) {
  316. // 项目
  317. const projectObj = this.parentsData.$refs.projectEle
  318. projectObj.selections = []
  319. projectObj.$refs.table.clearSelection()
  320. projectObj.$refs.table.setCurrentRow(-1)
  321. } else {
  322. const fileObj = this.parentsData.$refs.fileEle
  323. fileObj.selections = []
  324. fileObj.$refs.table.clearSelection()
  325. fileObj.$refs.table.setCurrentRow(-1)
  326. }
  327. })
  328. },
  329. // 项目级别 - 阶段分类
  330. getDictsList(type) {
  331. FetchDictionaryTree().then((res) => {
  332. const filterCodes = ['project_class']
  333. let filteredItems = JSON.parse(JSON.stringify(res)).filter(item => filterCodes.includes(item.dictionaryCode))
  334. filteredItems = this.addLevelToDictionaryList(filteredItems, 1)
  335. if (type === 1) {
  336. let fiterData = []
  337. fiterData = filteredItems.flatMap(item => {
  338. const level2Childs = item.childDictionarys.filter(child => {
  339. return child.dictionaryParents === item.id && child.level === 2
  340. })
  341. return level2Childs
  342. })
  343. if (this.parentsData.parentsProjectRow) {
  344. console.log(this.parentsData.parentsProjectRow.project_class)
  345. const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  346. anjuanObj.$refs.collectHeaderRef.projectOptions = []
  347. if (this.parentsData.parentsProjectRow.project_class !== '') {
  348. const findDic = fiterData.find(item => item.dictionaryName === this.parentsData.parentsProjectRow.project_class)
  349. anjuanObj.$refs.collectHeaderRef.projectOptions.push(findDic)
  350. } else {
  351. console.log(fiterData)
  352. anjuanObj.$refs.collectHeaderRef.projectOptions = fiterData
  353. }
  354. }
  355. } else {
  356. if (this.selectedCategory.arrangeType === 3) {
  357. const projectObj = this.$refs.projectEle
  358. // this.projectOptions = this.filterData(filteredItems, filteredItems[0].id)
  359. projectObj.$refs.collectHeaderRef.projectOptions = filteredItems.flatMap(item => {
  360. const level2Childs = item.childDictionarys.filter(child => {
  361. return child.dictionaryParents === item.id && child.level === 2
  362. })
  363. // 将满足条件的子项目的childDictionarys设置为空数组,因为项目页不需要
  364. level2Childs.forEach(child => {
  365. child.childDictionarys = []
  366. })
  367. return level2Childs
  368. })
  369. }
  370. }
  371. }).catch(err => {
  372. console.log(err)
  373. })
  374. },
  375. // 显示第一级和第二级
  376. // filterData(data, targetId) {
  377. // return data.filter(item => {
  378. // if (item.id === targetId || item.dictionaryParents === targetId) {
  379. // if (item.childDictionarys && item.childDictionarys.length > 0) {
  380. // item.childDictionarys = this.filterData(item.childDictionarys, targetId)
  381. // }
  382. // return true
  383. // }
  384. // return false
  385. // })
  386. // },
  387. // 给筛选出来的数据加level 方便后面是否可点击
  388. addLevelToDictionaryList(dictionaryList, level) {
  389. dictionaryList.forEach(dictionary => {
  390. dictionary.level = level
  391. if (dictionary.childDictionarys) {
  392. dictionary.childDictionarys = this.addLevelToDictionaryList(dictionary.childDictionarys, level + 1)
  393. }
  394. })
  395. return dictionaryList
  396. },
  397. normalizerProject(node) {
  398. if ((node.childDictionarys && !node.childDictionarys.length) || node.childDictionarys === null) {
  399. delete node.childDictionarys
  400. }
  401. return {
  402. id: node.dictionaryName,
  403. label: `${node.dictionaryName} - ${node.dictionaryCode}`,
  404. children: node.childDictionarys,
  405. isDisabled: this.isTitleType === 3 ? node.level !== 3 : node.level === 1
  406. }
  407. },
  408. /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
  409. doLayout() {
  410. this.$nextTick(() => {
  411. this.$refs.table.doLayout()
  412. })
  413. }
  414. }
  415. }