index.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <IndexSearch @search="reload" />
  5. <!-- <div style="margin: 5px 0; padding-left: 262px">
  6. <el-button
  7. size="small"
  8. type="primary"
  9. icon="el-icon-plus"
  10. class="ele-btn-icon"
  11. @click="openEdit()"
  12. >
  13. 添加
  14. </el-button>
  15. </div> -->
  16. <ele-split-layout
  17. width="244px"
  18. allow-collapse
  19. :right-style="{ overflow: 'hidden' }"
  20. >
  21. <!-- 表格 -->
  22. <ele-pro-table
  23. ref="table"
  24. :columns="columns"
  25. :datasource="datasource"
  26. height="calc(100vh - 350px)"
  27. :need-page="false"
  28. :toolkit="[]"
  29. :current.sync="current"
  30. highlight-current-row
  31. class="dict-table"
  32. tool-class="ele-toolbar-actions"
  33. @done="done"
  34. >
  35. <!-- 表头工具栏 -->
  36. <template v-slot:toolbar> </template>
  37. </ele-pro-table>
  38. <template v-slot:content>
  39. <!-- 物料列表 -->
  40. <IndexData ref="listData" v-if="current" :current-id="current.id" :data="current"/>
  41. </template>
  42. </ele-split-layout>
  43. </el-card>
  44. </div>
  45. </template>
  46. <script>
  47. import IndexData from './components/index-data.vue';
  48. import IndexSearch from './components/index-search.vue';
  49. import { listDictionaries, removeDictionary } from '@/api/system/dictionary';
  50. import { getGroupPage } from '@/api/material/list';
  51. export default {
  52. name: 'SystemDictionary',
  53. components: { IndexData , IndexSearch },
  54. data() {
  55. return {
  56. // 表格列配置
  57. columns: [
  58. {
  59. columnKey: 'index',
  60. type: 'index',
  61. width: 45,
  62. align: 'center',
  63. showOverflowTooltip: true
  64. },
  65. {
  66. prop: 'name',
  67. label: '物料组名称',
  68. showOverflowTooltip: true
  69. }
  70. ],
  71. // 当前编辑数据
  72. current: null,
  73. // 是否显示编辑弹窗
  74. showEdit: false,
  75. // 编辑回显数据
  76. editData: null
  77. };
  78. },
  79. created() {
  80. },
  81. methods: {
  82. /* 表格数据源 */
  83. datasource() {
  84. return getGroupPage({pageNum:1,size:-1});
  85. },
  86. /* 表格渲染完成回调 */
  87. done(res) {
  88. if (res.data?.length) {
  89. this.$refs.table.setCurrentRow(res.data[0]);
  90. }
  91. },
  92. /* 刷新表格 */
  93. reload(where) {
  94. this.$refs.table.reload();
  95. this.$refs.listData.reload(where);
  96. },
  97. }
  98. };
  99. </script>
  100. <style lang="scss" scoped>
  101. .dict-table {
  102. :deep(.el-table__row) {
  103. cursor: pointer;
  104. }
  105. :deep(.el-table__row > td:last-child:after) {
  106. content: '\e6e0';
  107. font-family: element-icons !important;
  108. font-style: normal;
  109. font-variant: normal;
  110. text-transform: none;
  111. -webkit-font-smoothing: antialiased;
  112. -moz-osx-font-smoothing: grayscale;
  113. line-height: 1;
  114. position: absolute;
  115. right: 10px;
  116. top: 50%;
  117. margin-top: -7px;
  118. }
  119. :deep(.el-table__row > td:last-child .cell) {
  120. padding-right: 20px;
  121. }
  122. }
  123. </style>