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

224 lines
6.6 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
  1. <template>
  2. <div>
  3. <CollectHeader :is-title-type="isTitleType" :selected-category="selectedCategory" :arc-id="arcId" :selections="selections" :active-index="activeIndex" :test="test" :is-recycle="isRecycle" />
  4. <el-table
  5. ref="table"
  6. v-loading="crud.loading || getTableDisplayFieldsLoading"
  7. class="archives-table"
  8. :data="anjuanData"
  9. highlight-current-row
  10. style="width: 100%;"
  11. :row-class-name="tableRowClassName"
  12. :row-key="rowKey"
  13. @select-all="selectAll"
  14. @selection-change="crud.selectionChangeHandler"
  15. @row-click="clickRowHandler"
  16. @cell-dblclick="tableDoubleClick"
  17. @select="handleCurrentChange"
  18. >
  19. <el-table-column type="selection" :reserve-selection="true" width="55" align="center" />
  20. <el-table-column type="index" label="序号" width="55" align="center" />
  21. <el-table-column :label="selectedCategory.arrangeType === 1 || (selectedCategory.arrangeType !==1 && activeIndex===1) ? '原文':'卷内'" prop="children_num" width="55" align="center" />
  22. <el-table-column v-for="field in tableDisplayFields" :key="field.id" :label="field.fieldCnName" :align="field.displayformatType" :width="field.displayLength" show-overflow-tooltip>
  23. <template slot="header">
  24. <el-tooltip
  25. class="item"
  26. effect="dark"
  27. :content="field.fieldCnName"
  28. placement="top-start"
  29. >
  30. <span>{{ field.fieldCnName }}</span>
  31. </el-tooltip>
  32. </template>
  33. <template slot-scope="scope">
  34. {{ scope.row[field.fieldName] }}
  35. </template>
  36. </el-table-column>
  37. </el-table>
  38. <!--分页组件-->
  39. <el-pagination
  40. :current-page="page.page"
  41. :total="page.total"
  42. :page-size="page.size"
  43. :pager-count="5"
  44. layout="total, prev, pager, next, sizes"
  45. @size-change="handleSizeChange"
  46. @current-change="handleCurrentPage"
  47. />
  48. <!-- 档案详情 -->
  49. <ArchivesInfo ref="archivesInfo" :category-id="categoryId" :arc-id="arcId" />
  50. </div>
  51. </template>
  52. <script>
  53. import { header, form } from '@crud/crud'
  54. import ArchivesInfo from '../module/archivesInfo/index'
  55. import CollectHeader from '../module/collectHeader.vue'
  56. import tableFields from './tableFields.json'
  57. import tableData from './tableData.json'
  58. export default {
  59. name: 'Sorted',
  60. components: { ArchivesInfo, CollectHeader },
  61. mixins: [
  62. header(),
  63. form({})
  64. ],
  65. props: {
  66. isTitleType: {
  67. type: Number,
  68. default: 3
  69. },
  70. selectedCategory: {
  71. type: Object,
  72. default: function() {
  73. return {}
  74. }
  75. },
  76. activeIndex: {
  77. type: Number,
  78. default: 0
  79. },
  80. test: {
  81. type: String,
  82. default: ''
  83. },
  84. isRecycle: {
  85. type: Boolean,
  86. default: false
  87. }
  88. },
  89. data() {
  90. return {
  91. anjuanData: [],
  92. tableDisplayFields: [], // table-list-title字段
  93. getTableDisplayFieldsLoading: false, // table-loading
  94. selections: [],
  95. categoryId: 'F0F59CC713C83AE4BAB99B',
  96. arcId: '256E752BC0280618840600',
  97. page: {
  98. page: 1,
  99. size: 10,
  100. total: 0
  101. },
  102. timer: null
  103. }
  104. },
  105. watch: {
  106. selectedCategory: function(newValue, oldValue) {
  107. this.selections = []
  108. this.$refs.table.clearSelection()
  109. },
  110. tableDisplayFields(val) {
  111. this.doLayout()
  112. },
  113. activeIndex(newValue) {
  114. this.selections = []
  115. this.$refs.table.clearSelection()
  116. }
  117. },
  118. created() {
  119. this.tableDisplayFields = tableFields.data
  120. this.anjuanData = tableData.data.list.content
  121. },
  122. mounted() {
  123. },
  124. methods: {
  125. openJuannei(data) {
  126. // this.$emit('openJuannei', '这是来自案卷的通知')
  127. if (this.selectedCategory.arrangeType === 3) {
  128. this.$parent.$parent.$parent.$emit('openJuannei', data)
  129. } else {
  130. this.$parent.$parent.$emit('openJuannei', data)
  131. }
  132. },
  133. handleSelect(key, keyPath) {
  134. console.log(key, keyPath)
  135. },
  136. rowKey(row) {
  137. return row.id
  138. },
  139. // table选中加上选中状态
  140. tableRowClassName({ row, rowIndex }) {
  141. // console.log('添加类名', row, rowIndex)
  142. let color = ''
  143. this.selections.forEach(item => {
  144. if (item.id === row.id) {
  145. color = 'rowStyle'
  146. }
  147. })
  148. return color
  149. },
  150. // table - 全选
  151. selectAll(val) {
  152. this.selections = val
  153. },
  154. // table - 双击查看详情
  155. tableDoubleClick(row) {
  156. if (this.timer) {
  157. clearTimeout(this.timer)
  158. }
  159. console.log('tableDoubleClick', row)
  160. this.arcId = row.id
  161. if (this.selectedCategory.arrangeType !== 1) {
  162. this.$refs.archivesInfo.isHasFile = false
  163. if (this.activeIndex === 1) {
  164. this.$refs.archivesInfo.detailTitle = '文件详情'
  165. this.$refs.archivesInfo.isHasFile = true
  166. } else {
  167. this.$refs.archivesInfo.detailTitle = '案卷详情'
  168. }
  169. } else {
  170. this.$refs.archivesInfo.isHasFile = true
  171. this.$refs.archivesInfo.detailTitle = '文件详情'
  172. }
  173. // if (this.selectedCategory.arrangeType === 2) {
  174. // if (this.activeIndex === 1) {
  175. // this.$refs.archivesInfo.detailTitle = '文件详情'
  176. // this.$refs.archivesInfo.isHasFile = true
  177. // } else {
  178. // this.$refs.archivesInfo.detailTitle = '案卷详情'
  179. // }
  180. // } else {
  181. // this.$refs.archivesInfo.detailTitle = '文件详情'
  182. // }
  183. this.$refs.archivesInfo.archivesInfoVisible = true
  184. this.$refs.archivesInfo.archivesTabIndex = 0
  185. // this.$refs.archivesInfo.getDetial(row.id)
  186. },
  187. // table - 当前选中得row
  188. clickRowHandler(row) {
  189. console.log('clickRowHandler', row)
  190. if (this.timer) {
  191. clearTimeout(this.timer)
  192. }
  193. this.timer = setTimeout(() => {
  194. this.openJuannei(row.archive_no)
  195. }, 300)
  196. this.selections = this.crud.selections
  197. },
  198. // 触发单选
  199. handleCurrentChange(selection, row) {
  200. console.log('触发单选', row)
  201. this.selections = selection
  202. },
  203. handleSizeChange(size) {
  204. this.page.size = size
  205. this.page.page = 1
  206. },
  207. handleCurrentPage(val) {
  208. this.page.page = val
  209. },
  210. /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
  211. doLayout() {
  212. this.$nextTick(() => {
  213. this.$refs.table.doLayout()
  214. })
  215. }
  216. }
  217. }
  218. </script>
  219. <style lang='scss' scoped>
  220. </style>