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

190 lines
5.4 KiB

1 year ago
1 year ago
1 year ago
1 year ago
  1. <template>
  2. <div>
  3. <el-table
  4. ref="table"
  5. v-loading="tableLoading"
  6. class="archives-table"
  7. :data="tableData"
  8. :height="isDetail ? 'calc(100vh - 382px)':'calc(100vh - 676px)'"
  9. highlight-current-row
  10. style="width: 100%;"
  11. :row-key="rowKey"
  12. @cell-dblclick="tableDoubleClick"
  13. >
  14. <el-table-column type="index" label="序号" width="55" align="center" />
  15. <el-table-column v-if="isCase" prop="child" label="子条数目" align="center" width="100" />
  16. <el-table-column v-else :label="selectedCategory.arrangeType === 1 ? '原文':'卷内'" prop="child" width="55" align="center">
  17. <template slot-scope="scope">
  18. {{ scope.row.child === '' ? 0 : scope.row.child }}
  19. </template>
  20. </el-table-column>
  21. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  22. <template slot="header">
  23. <el-tooltip
  24. class="item"
  25. effect="dark"
  26. :content="field.fieldCnName"
  27. placement="top-start"
  28. >
  29. <span>{{ field.fieldCnName }}</span>
  30. </el-tooltip>
  31. </template>
  32. <template slot-scope="scope">
  33. {{ scope.row[field.fieldName] }}
  34. </template>
  35. </el-table-column>
  36. </el-table>
  37. <!-- 档案详情 -->
  38. <ArchivesInfo ref="archivesInfo" :selected-category="selectedCategory" :arc-id="arcId" />
  39. </div>
  40. </template>
  41. <script>
  42. import ArchivesInfo from '@/views/collectReorganizi/collectionLibrary/module/archivesInfo/index'
  43. import { FetchInitCategoryViewTable, FetchInitCategoryView } from '@/api/collect/collect'
  44. import { FetchInitContorlView } from '@/api/archivesManage/library'
  45. export default {
  46. name: 'ArchivesListModule',
  47. components: { ArchivesInfo },
  48. props: {
  49. selectedCategory: {
  50. type: Object,
  51. default: function() {
  52. return {}
  53. }
  54. },
  55. collectLevel: {
  56. type: Number,
  57. default: function() {
  58. return null
  59. }
  60. },
  61. selections: {
  62. type: Array,
  63. default: () => []
  64. },
  65. isTitleType: {
  66. type: Number,
  67. default: 2
  68. },
  69. isCollect: {
  70. type: Boolean,
  71. default: true
  72. },
  73. isCase: {
  74. type: Boolean,
  75. default: false
  76. },
  77. categoryId: {
  78. type: String,
  79. default: function() {
  80. return ''
  81. }
  82. }
  83. },
  84. data() {
  85. return {
  86. tableLoading: false,
  87. tableDisplayFields: [],
  88. tableData: [],
  89. arrySort: [],
  90. arcId: null,
  91. isDetail: false,
  92. parentId: null,
  93. detailLevel: null,
  94. caseCategoryId: null
  95. }
  96. },
  97. watch: {
  98. isTitleType: function(newValue, oldValue) {
  99. console.log('newValue222', newValue)
  100. }
  101. },
  102. mounted() {
  103. },
  104. methods: {
  105. rowKey(row) {
  106. return row.id
  107. },
  108. // table - 双击查看详情
  109. tableDoubleClick(row) {
  110. this.arcId = row.id
  111. this.$nextTick(() => {
  112. })
  113. },
  114. getViewTable() {
  115. this.tableData = []
  116. this.tableLoading = true
  117. let params
  118. if (this.isDetail) {
  119. params = {
  120. categoryId: this.categoryId !== '' ? this.categoryId : this.selectedCategory.id,
  121. categoryLevel: this.detailLevel
  122. }
  123. } else if (this.isCase) {
  124. params = {
  125. categoryId: this.caseCategoryId,
  126. categoryLevel: this.collectLevel
  127. }
  128. } else {
  129. params = {
  130. categoryId: this.categoryId !== '' ? this.categoryId : this.selectedCategory.id,
  131. categoryLevel: this.collectLevel
  132. }
  133. }
  134. FetchInitCategoryViewTable(params).then((res) => {
  135. if (res) {
  136. this.arrySort = []
  137. this.tableDisplayFields = res
  138. const orderSortArry = this.tableDisplayFields.filter(item => item.displayOrder).sort((a, b) => a.displayOrder - b.displayOrder)
  139. orderSortArry.forEach(item => {
  140. if (item.displayOrderBy) {
  141. this.arrySort.push(item.fieldName + ',' + item.displayOrderBy)
  142. }
  143. })
  144. if (this.isDetail) {
  145. this.getViewTableList()
  146. } else {
  147. this.tableData = this.selections
  148. this.tableLoading = false
  149. }
  150. }
  151. })
  152. },
  153. getViewTableList() {
  154. const params = {
  155. 'parentId': this.parentId,
  156. 'categoryId': this.categoryId !== '' ? this.categoryId : this.selectedCategory.id,
  157. 'categoryLevel': this.detailLevel,
  158. 'ignore': false,
  159. 'page': 0,
  160. 'size': 100,
  161. 'sort': this.arrySort
  162. }
  163. if (this.isCollect) {
  164. FetchInitCategoryView(params).then((res) => {
  165. if (res.code !== 500) {
  166. this.tableData = res.list.content
  167. this.collectLevelList = res.categoryLevel
  168. }
  169. this.tableLoading = false
  170. })
  171. } else {
  172. FetchInitContorlView(params).then((res) => {
  173. if (res.code !== 500) {
  174. this.tableData = res.list.content
  175. this.collectLevelList = res.categoryLevel
  176. }
  177. this.tableLoading = false
  178. })
  179. }
  180. }
  181. }
  182. }
  183. </script>
  184. <style lang='scss' scoped>
  185. @import "~@/assets/styles/collect-reorganizi.scss";
  186. </style>