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

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