definition.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <seek-page :seekList="seekList" @search="search"></seek-page>
  5. <ele-pro-table
  6. ref="table"
  7. row-key="id"
  8. :columns="columns"
  9. :datasource="datasource"
  10. :cache-key="cacheKeyUrl"
  11. autoAmendPage
  12. >
  13. <!-- <template v-slot:toolbar>
  14. <el-button type="primary" size="mini">新建</el-button>
  15. </template> -->
  16. <template v-slot:action="{ row }">
  17. <el-button type="text" size="mini" @click="openDetails(row)"
  18. >查看条件</el-button
  19. >
  20. </template>
  21. </ele-pro-table>
  22. </el-card>
  23. <definitionDetials ref="detailsRef"></definitionDetials>
  24. </div>
  25. </template>
  26. <script>
  27. import dictMixins from '@/mixins/dictMixins';
  28. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  29. import { getIndicatorDefinitionPage } from '@/api/indicator';
  30. import { getAllEnable } from '@/api/indicator/index.js';
  31. import definitionDetials from './components/definitionDetials.vue';
  32. import list from '@/i18n/lang/zh_CN/list';
  33. export default {
  34. mixins: [dictMixins, tableColumnsMixin],
  35. components: { definitionDetials },
  36. data() {
  37. return {
  38. columns: [
  39. {
  40. width: 50,
  41. type: 'index',
  42. columnKey: 'index',
  43. align: 'center',
  44. label: '序号'
  45. },
  46. {
  47. prop: 'businessName',
  48. label: '业务类型',
  49. align: 'center',
  50. minWidth: 110,
  51. showOverflowTooltip: true,
  52. formatter: (row) => {
  53. return row.businessName + '-' + row.indicatorName;
  54. }
  55. },
  56. {
  57. prop: 'enable',
  58. label: '状态',
  59. align: 'center',
  60. showOverflowTooltip: true,
  61. minWidth: 150,
  62. formatter: (row) => {
  63. return row.enable == 1 ? '启用' : '禁用';
  64. }
  65. },
  66. {
  67. prop: 'createTime',
  68. label: '创建时间',
  69. align: 'center',
  70. minWidth: 110,
  71. showOverflowTooltip: true
  72. },
  73. {
  74. columnKey: 'action',
  75. label: '操作',
  76. width: 220,
  77. align: 'center',
  78. resizable: false,
  79. fixed: 'right',
  80. slot: 'action',
  81. showOverflowTooltip: true
  82. }
  83. ],
  84. cacheKeyUrl: 'main-259271505-definition-table',
  85. allEnable: []
  86. };
  87. },
  88. computed: {
  89. seekList() {
  90. return [
  91. {
  92. label: '业务类型',
  93. value: 'businessType',
  94. type: 'select',
  95. placeholder: '请输入',
  96. planList: this.allEnable.map((item) => ({
  97. label: item.businessName,
  98. value: item.businessType
  99. }))
  100. },
  101. {
  102. label: '考核指标',
  103. value: 'indicatorName',
  104. type: 'input',
  105. placeholder: '请输入'
  106. }
  107. ];
  108. }
  109. },
  110. created() {
  111. this.getAllEnable();
  112. },
  113. methods: {
  114. // 刷新表格
  115. reload(where = {}) {
  116. this.$refs.table.reload({
  117. where
  118. });
  119. },
  120. /* 表格数据源 */
  121. datasource({ page, limit, where, order }) {
  122. // 参数
  123. const body = {
  124. ...where,
  125. ...order,
  126. pageNum: page,
  127. size: limit
  128. };
  129. return getIndicatorDefinitionPage(body);
  130. },
  131. search(where) {
  132. this.reload(where);
  133. },
  134. // 查看详情
  135. openDetails(row) {
  136. console.log('row', row);
  137. const businessTypeItem = this.allEnable.find(
  138. (item) => item.businessType == row.businessType
  139. );
  140. const indicatorDefinitions =
  141. businessTypeItem?.indicatorDefinitions.find(
  142. (item) => item.indicator == row.indicator
  143. );
  144. this.$refs.detailsRef?.open(
  145. indicatorDefinitions?.indicatorConditionDefinitions || []
  146. );
  147. },
  148. // 获取所有启用的业务类型
  149. async getAllEnable() {
  150. const data = await getAllEnable();
  151. this.allEnable = data;
  152. console.log('this.allEnable', this.allEnable);
  153. }
  154. }
  155. };
  156. </script>
  157. <style></style>