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

324 lines
13 KiB

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