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

156 lines
5.4 KiB

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. // import qs from 'qs'
  2. // import { exportFile } from '@/utils/index'
  3. import { FetchInitCategoryViewTable, FetchInitCategoryView } from '@/api/collect/collect'
  4. import { crud } from '@crud/crud'
  5. export const collectionLibraryCrud = {
  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. },
  26. classifyTree: [],
  27. classifyLoading: false,
  28. parentsId: null
  29. }
  30. },
  31. // 组件挂载时的共用方法
  32. mounted() {
  33. },
  34. // 组件共用方法
  35. methods: {
  36. handleSearch(categoryLevel) {
  37. let parentsId = null
  38. // 2 项目 3 案卷 /文件 4 卷内 6 文件
  39. if (this.isTitleType === 2) {
  40. parentsId = null
  41. } else if (this.isTitleType === 3) {
  42. console.log('this.isTitleType', this.isTitleType)
  43. if (this.selectedCategory.arrangeType === 1) {
  44. parentsId = null
  45. } else {
  46. parentsId = this.parentsData.parentsProjectId
  47. this.$parent.getTableDisplayFieldsLoading = true
  48. }
  49. } else if (this.isTitleType === 4) {
  50. // 卷内
  51. this.$parent.$parent.getTableDisplayFieldsLoading = true
  52. parentsId = this.parentsData.parentsAnjuanId
  53. } else if (this.isTitleType === 6) {
  54. // 原文
  55. this.$parent.$parent.getTableDisplayFieldsLoading = true
  56. parentsId = this.parentsData.parentsJuanneiId
  57. }
  58. setTimeout(() => {
  59. this.getViewTableList(categoryLevel, 'search', parentsId)
  60. }, 200)
  61. },
  62. getViewTable(categoryLevel, parentsId) {
  63. this.getTableDisplayFieldsLoading = true
  64. this.tableDisplayFields = []
  65. FetchInitCategoryViewTable({ categoryId: this.selectedCategory.id, categoryLevel: categoryLevel }).then((res) => {
  66. if (res) {
  67. this.arrySort = []
  68. this.tableDisplayFields = res
  69. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  70. orderSortArry.forEach(item => {
  71. if (item.displayOrderBy) {
  72. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  73. }
  74. })
  75. this.$nextTick(() => {
  76. this.getViewTableList(categoryLevel, null, parentsId)
  77. })
  78. }
  79. })
  80. },
  81. getViewTableList(categoryLevel, type, parentsId) {
  82. console.log('list', parentsId)
  83. const params = {
  84. 'parentId': parentsId,
  85. 'categoryId': this.selectedCategory.id,
  86. 'categoryLevel': categoryLevel,
  87. 'search': this.query.search,
  88. 'page': this.page.page - 1,
  89. 'size': this.page.size
  90. }
  91. FetchInitCategoryView(params).then((res) => {
  92. if (res.code !== 500) {
  93. if (categoryLevel === 1) {
  94. this.projectData = res.list.content
  95. this.yearData = res.yearGroup
  96. if (this.yearData) {
  97. this.$emit('myYearEvent', this.yearData)
  98. }
  99. if (type === 'search') {
  100. this.$parent.projectData = res.list.content
  101. this.$parent.getTableDisplayFieldsLoading = false
  102. }
  103. } else if (categoryLevel === 2) {
  104. this.anjuanData = res.list.content
  105. this.yearData = res.yearGroup
  106. if (this.yearData) {
  107. this.$parent.$parent.$emit('myYearEvent', this.yearData)
  108. }
  109. if (type === 'search') {
  110. this.$parent.anjuanData = res.list.content
  111. this.$parent.getTableDisplayFieldsLoading = false
  112. }
  113. } else if (categoryLevel === 3) {
  114. if (this.isTitleType === 6) {
  115. this.fileData = res.list.content
  116. } else if (this.isTitleType === 3) {
  117. this.anjuanData = res.list.content
  118. this.yearData = res.yearGroup
  119. if (this.yearData) {
  120. this.$parent.$parent.$emit('myYearEvent', this.yearData)
  121. }
  122. } else {
  123. if (this.selectedCategory.arrangeType === 1) {
  124. this.anjuanData = res.list.content
  125. this.yearData = res.yearGroup
  126. if (this.yearData) {
  127. this.$parent.$parent.$emit('myYearEvent', this.yearData)
  128. }
  129. if (type === 'search') {
  130. this.$parent.anjuanData = res.list.content
  131. this.$parent.getTableDisplayFieldsLoading = false
  132. }
  133. } else {
  134. this.junneiData = res.list.content
  135. if (type === 'search') {
  136. this.$parent.$parent.junneiData = res.list.content
  137. this.$parent.$parent.getTableDisplayFieldsLoading = false
  138. }
  139. }
  140. }
  141. }
  142. this.page.total = res.list.totalElements
  143. }
  144. this.getTableDisplayFieldsLoading = false
  145. this.$parent.$parent.$refs.table.clearSelection()
  146. })
  147. },
  148. /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
  149. doLayout() {
  150. this.$nextTick(() => {
  151. this.$refs.table.doLayout()
  152. })
  153. }
  154. }
  155. }