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

424 lines
17 KiB

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