inspectionTemplateDialog.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <el-dialog
  3. :visible.sync="equipmentdialog"
  4. :before-close="handleClose"
  5. :close-on-click-modal="true"
  6. :close-on-press-escape="false"
  7. append-to-body
  8. width="60%"
  9. >
  10. <search ref="search" @search="search"></search>
  11. <ele-pro-table
  12. ref="table"
  13. :columns="columns"
  14. :datasource="datasource"
  15. height="calc(100vh - 605px)"
  16. tool-class="ele-toolbar-form"
  17. row-key="qualityLevelId"
  18. v-if="equipmentdialog"
  19. :selection.sync="selection"
  20. >
  21. <template v-slot:status="{ row }">
  22. {{ row.status ? '启用' : '停用' }}
  23. </template>
  24. </ele-pro-table>
  25. <template v-slot:footer>
  26. <el-button type="primary" size="small" @click="selected">选择</el-button>
  27. <el-button size="small" @click="handleClose">关闭</el-button>
  28. </template>
  29. </el-dialog>
  30. </template>
  31. <script>
  32. import search from './search.vue';
  33. import { getList } from '@/api/inspectionTemplate';
  34. export default {
  35. components: { search },
  36. data() {
  37. return {
  38. type: '',
  39. equipmentdialog: false,
  40. selection: [],
  41. columns: [
  42. {
  43. width: 45,
  44. type: 'selection',
  45. columnKey: 'selection',
  46. align: 'center',
  47. reserveSelection: true
  48. },
  49. {
  50. columnKey: 'index',
  51. label: '序号',
  52. type: 'index',
  53. width: 55,
  54. align: 'center',
  55. showOverflowTooltip: true,
  56. fixed: 'left'
  57. },
  58. {
  59. prop: 'qualitySchemeTemplateCode',
  60. label: '质检方案编码',
  61. showOverflowTooltip: true,
  62. align: 'center',
  63. minWidth: 110
  64. },
  65. {
  66. prop: 'qualitySchemeTemplateName',
  67. label: '质检方案名称',
  68. align: 'center',
  69. minWidth: 150
  70. },
  71. {
  72. label: '状态',
  73. prop: 'status',
  74. slot: 'status',
  75. align: 'center'
  76. },
  77. {
  78. prop: 'templateRemark',
  79. label: '备注',
  80. showOverflowTooltip: true,
  81. align: 'center',
  82. minWidth: 110
  83. },
  84. {
  85. columnKey: 'action',
  86. label: '操作',
  87. width: 150,
  88. align: 'center',
  89. resizable: false,
  90. slot: 'action',
  91. fixed: 'right'
  92. }
  93. ]
  94. };
  95. },
  96. watch: {},
  97. methods: {
  98. datasource({ page, where, limit }) {
  99. return getList({
  100. ...where,
  101. pageNum: page,
  102. size: limit,
  103. type: this.type
  104. });
  105. },
  106. open(type) {
  107. this.type = type;
  108. this.equipmentdialog = true;
  109. },
  110. handleClose() {
  111. this.equipmentdialog = false;
  112. },
  113. // 选择
  114. selected() {
  115. if (!this.selection.length) {
  116. this.$message.error('至少选择一条数据');
  117. return;
  118. }
  119. this.$emit('choose', this.selection);
  120. this.handleClose();
  121. },
  122. search(where) {
  123. this.$refs.table.reload({ page: 1, where });
  124. }
  125. }
  126. };
  127. </script>
  128. <style lang="scss" scoped></style>