阅行客电子档案
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.

329 lines
13 KiB

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