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

237 lines
9.0 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
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. import { FetchInitCategoryViewTable, FetchInitCategoryView } from '@/api/collect/collect'
  2. import { crud } from '@crud/crud'
  3. export const collectionLibraryCrud = {
  4. mixins: [crud()],
  5. // 组件共用属性
  6. data() {
  7. return {
  8. getTableDisplayFieldsLoading: false,
  9. tableDisplayFields: [],
  10. projectData: [],
  11. anjuanData: [],
  12. junneiData: [],
  13. fileData: [],
  14. arrySort: [],
  15. page: {
  16. page: 1,
  17. size: 10,
  18. total: 0
  19. },
  20. timer: null,
  21. query: {
  22. search: null,
  23. project_class: null,
  24. archive_ctg_no: null
  25. },
  26. classifyTree: [],
  27. classifyLoading: false,
  28. parentsId: null
  29. }
  30. },
  31. // 组件挂载时的共用方法
  32. mounted() {
  33. },
  34. // 组件共用方法
  35. methods: {
  36. // 缓存用户对于固定栏操作习惯
  37. statusBarChecked(val) {
  38. this.fixedStatusBar = val
  39. localStorage.setItem('statusBarFixedType', val)
  40. },
  41. handleSearch(categoryLevel) {
  42. this.parentsData.$refs.classifyTree.setCurrentKey(null)
  43. this.smartQuery = {
  44. 'retention': null,
  45. 'security_class': null,
  46. 'doc_type': null,
  47. 'medium_type': null,
  48. 'archive_year': null,
  49. 'fonds_no': null
  50. }
  51. // 2 项目 3 案卷 /文件 4 卷内 6 文件
  52. if (this.isTitleType === 2) {
  53. this.parentsId = null
  54. this.$parent.getTableDisplayFieldsLoading = true
  55. } else if (this.isTitleType === 3) {
  56. if (this.selectedCategory.arrangeType === 1) {
  57. this.parentsId = null
  58. } else {
  59. if (this.activeIndex === 1) {
  60. this.parentsId = null
  61. } else {
  62. this.parentsId = this.parentsData.parentsProjectId
  63. }
  64. }
  65. this.$parent.getTableDisplayFieldsLoading = true
  66. } else if (this.isTitleType === 4) {
  67. // 卷内
  68. this.$parent.$parent.getTableDisplayFieldsLoading = true
  69. this.parentsId = this.parentsData.parentsAnjuanId
  70. } else if (this.isTitleType === 6) {
  71. // 原文
  72. if (this.selectedCategory.arrangeType === 1) {
  73. this.parentsId = this.parentsData.parentsAnjuanId
  74. this.$parent.getTableDisplayFieldsLoading = true
  75. } else {
  76. this.$parent.$parent.getTableDisplayFieldsLoading = true
  77. if (this.parentsData.isTabFile) {
  78. this.parentsId = this.parentsData.parentsAnjuanId
  79. } else {
  80. this.parentsId = this.parentsData.parentsJuanneiId
  81. }
  82. }
  83. }
  84. setTimeout(() => {
  85. this.getViewTable(categoryLevel, this.parentsId, 'search')
  86. }, 200)
  87. },
  88. getViewTable(categoryLevel, parentsId, type) {
  89. this.getTableDisplayFieldsLoading = true
  90. this.tableDisplayFields = []
  91. FetchInitCategoryViewTable({ categoryId: this.selectedCategory.id, categoryLevel: categoryLevel }).then((res) => {
  92. if (res) {
  93. this.arrySort = []
  94. this.tableDisplayFields = res
  95. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  96. orderSortArry.forEach(item => {
  97. if (item.displayOrderBy) {
  98. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  99. }
  100. })
  101. this.$nextTick(() => {
  102. this.getViewTableList(categoryLevel, parentsId, type)
  103. })
  104. }
  105. })
  106. },
  107. getViewTableList(categoryLevel, parentsId, type) {
  108. const params = {
  109. 'parentId': parentsId,
  110. 'categoryId': this.selectedCategory.id,
  111. 'categoryLevel': categoryLevel,
  112. 'isdel': this.parentsData.isdel,
  113. 'search': this.query.search,
  114. 'retention': this.smartQuery.retention,
  115. 'security_class': this.smartQuery.security_class,
  116. 'medium_type': this.smartQuery.medium_type,
  117. 'doc_type': this.smartQuery.doc_type,
  118. 'archive_year': this.smartQuery.archive_year,
  119. 'fonds_no': this.smartQuery.fonds_no,
  120. 'project_class': this.query.project_class,
  121. 'archive_ctg_no': this.query.archive_ctg_no,
  122. 'page': this.page.page - 1,
  123. 'size': this.page.size,
  124. 'sort': this.arrySort
  125. }
  126. FetchInitCategoryView(params).then((res) => {
  127. if (res.code !== 500) {
  128. if (categoryLevel === 1) {
  129. // 项目
  130. const projectObj = this.parentsData.$refs.projectEle
  131. this.projectData = res.list.content
  132. this.page.total = res.list.totalElements
  133. this.yearData = res.yearGroup
  134. if (this.yearData && type !== 'quickFilter') {
  135. this.$emit('myYearEvent', this.yearData)
  136. }
  137. if (type === 'search') {
  138. projectObj.projectData = res.list.content
  139. projectObj.page.total = res.list.totalElements
  140. projectObj.getTableDisplayFieldsLoading = false
  141. }
  142. } else if (categoryLevel === 2) {
  143. // 案卷
  144. const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  145. this.anjuanData = res.list.content
  146. this.page.total = res.list.totalElements
  147. this.yearData = res.yearGroup
  148. if (this.yearData && type !== 'quickFilter') {
  149. this.$parent.$parent.$emit('myYearEvent', this.yearData)
  150. }
  151. // 搜索/新增/编辑 非 案卷是主页的时候
  152. if (type === 'search') {
  153. anjuanObj.anjuanData = res.list.content
  154. anjuanObj.page.total = res.list.totalElements
  155. anjuanObj.getTableDisplayFieldsLoading = false
  156. }
  157. } else if (categoryLevel === 3) {
  158. if (this.isTitleType === 3) {
  159. // 案卷下的未整理 / 文件为主页时
  160. const wjObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  161. this.anjuanData = res.list.content
  162. this.page.total = res.list.totalElements
  163. this.yearData = res.yearGroup
  164. if (this.yearData && type !== 'quickFilter') {
  165. this.$parent.$parent.$emit('myYearEvent', this.yearData)
  166. }
  167. if (type === 'search') {
  168. wjObj.anjuanData = res.list.content
  169. wjObj.page.total = res.list.totalElements
  170. wjObj.getTableDisplayFieldsLoading = false
  171. }
  172. } else {
  173. // 卷内
  174. this.junneiData = res.list.content
  175. this.page.total = res.list.totalElements
  176. if (type === 'search') {
  177. this.parentsData.$refs.juanneiEle.junneiData = res.list.content
  178. this.parentsData.$refs.juanneiEle.page.total = res.list.totalElements
  179. this.parentsData.$refs.juanneiEle.getTableDisplayFieldsLoading = false
  180. }
  181. }
  182. } else {
  183. // 原文
  184. this.fileData = res.list.content
  185. this.page.total = res.list.totalElements
  186. if (type === 'search') {
  187. this.parentsData.$refs.fileEle.fileData = res.list.content
  188. this.parentsData.$refs.fileEle.page.total = res.list.totalElements
  189. this.parentsData.$refs.fileEle.getTableDisplayFieldsLoading = false
  190. }
  191. }
  192. }
  193. this.getTableDisplayFieldsLoading = false
  194. this.crud.selections = []
  195. if (categoryLevel === 3) {
  196. // 按件
  197. if (this.isTitleType === 3) {
  198. const wjObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  199. wjObj.selections = []
  200. wjObj.$refs.table.clearSelection() // 清空选中
  201. wjObj.$refs.table.setCurrentRow(-1) // 清除高亮
  202. } else {
  203. const juanneiObj = this.parentsData.$refs.juanneiEle
  204. juanneiObj.selections = []
  205. juanneiObj.$refs.table.clearSelection()
  206. juanneiObj.$refs.table.setCurrentRow(-1)
  207. }
  208. } else if (categoryLevel === 2) {
  209. // 按卷
  210. const anjuanObj = this.parentsData.$refs.anjuanEle.$refs.ajContent.$refs.tableList
  211. anjuanObj.selections = []
  212. anjuanObj.$refs.table.clearSelection()
  213. anjuanObj.$refs.table.setCurrentRow(-1)
  214. } else if (categoryLevel === 1) {
  215. // 项目
  216. const projectObj = this.parentsData.$refs.projectEle
  217. projectObj.selections = []
  218. projectObj.$refs.table.clearSelection()
  219. projectObj.$refs.table.setCurrentRow(-1)
  220. } else {
  221. const fileObj = this.parentsData.$refs.fileEle
  222. fileObj.selections = []
  223. fileObj.$refs.table.clearSelection()
  224. fileObj.$refs.table.setCurrentRow(-1)
  225. }
  226. })
  227. },
  228. /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
  229. doLayout() {
  230. this.$nextTick(() => {
  231. this.$refs.table.doLayout()
  232. })
  233. }
  234. }
  235. }