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

193 lines
5.5 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
  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" />
  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. },
  82. data() {
  83. return {
  84. isTitleType: 4,
  85. juanneiDrawer: false,
  86. junneiData: [],
  87. tableDisplayFields: [], // table-list-title字段
  88. getTableDisplayFieldsLoading: false, // table-loading
  89. selections: [],
  90. categoryId: 'CD135F6A77018CE04D4FDB',
  91. arcId: '256E752BC0280618840600',
  92. page: {
  93. page: 1,
  94. size: 10,
  95. total: 0
  96. },
  97. timer: null,
  98. test: ''
  99. }
  100. },
  101. watch: {
  102. selectedCategory: function(newValue, oldValue) {
  103. },
  104. tableDisplayFields(val) {
  105. this.doLayout()
  106. }
  107. },
  108. created() {
  109. this.tableDisplayFields = tableFields.data
  110. this.junneiData = tableData.data.list.content
  111. },
  112. mounted() {
  113. console.log('nei2', this.selectedCategory.arrangeType)
  114. },
  115. methods: {
  116. openFile(data) {
  117. // this.$emit('openFile', '这是来自卷内的通知')
  118. this.$emit('openFile', data)
  119. },
  120. closeDrawer() {
  121. this.juanneiDrawer = false
  122. },
  123. handleSelect(key, keyPath) {
  124. console.log(key, keyPath)
  125. },
  126. rowKey(row) {
  127. return row.id
  128. },
  129. // table选中加上选中状态
  130. tableRowClassName({ row, rowIndex }) {
  131. // console.log('添加类名', row, rowIndex)
  132. let color = ''
  133. this.selections.forEach(item => {
  134. if (item.id === row.id) {
  135. color = 'rowStyle'
  136. }
  137. })
  138. return color
  139. },
  140. // table - 全选
  141. selectAll(val) {
  142. this.selections = val
  143. },
  144. // table - 双击查看详情
  145. tableDoubleClick(row) {
  146. if (this.timer) {
  147. clearTimeout(this.timer)
  148. }
  149. console.log('tableDoubleClick', row)
  150. this.arcId = row.id
  151. this.$refs.archivesInfo.isHasFile = true
  152. this.$refs.archivesInfo.detailTitle = '卷内详情'
  153. this.$refs.archivesInfo.archivesInfoVisible = true
  154. this.$refs.archivesInfo.archivesTabIndex = 0
  155. // this.$refs.archivesInfo.getDetial(row.id)
  156. },
  157. // table - 当前选中得row
  158. clickRowHandler(row) {
  159. console.log('clickRowHandler', row)
  160. if (this.timer) {
  161. clearTimeout(this.timer)
  162. }
  163. this.timer = setTimeout(() => {
  164. this.openFile(row.archive_no)
  165. }, 300)
  166. this.selections = this.crud.selections
  167. },
  168. // 触发单选
  169. handleCurrentChange(selection, row) {
  170. console.log('触发单选', row)
  171. this.selections = selection
  172. },
  173. handleSizeChange(size) {
  174. this.page.size = size
  175. this.page.page = 1
  176. },
  177. handleCurrentPage(val) {
  178. this.page.page = val
  179. },
  180. /* 重新渲染table组件 防止table-fixed 错位 配合watch-table数据 */
  181. doLayout() {
  182. // this.$nextTick(() => {
  183. // this.$refs.table.doLayout()
  184. // })
  185. }
  186. }
  187. }
  188. </script>
  189. <style lang='scss' scoped>
  190. </style>