inspectionTemplateDialog.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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. equipmentdialog: false,
  39. selection: [],
  40. columns: [
  41. {
  42. width: 45,
  43. type: 'selection',
  44. columnKey: 'selection',
  45. align: 'center',
  46. reserveSelection: true
  47. },
  48. {
  49. columnKey: 'index',
  50. label: '序号',
  51. type: 'index',
  52. width: 55,
  53. align: 'center',
  54. showOverflowTooltip: true,
  55. fixed: 'left'
  56. },
  57. {
  58. prop: 'qualitySchemeTemplateCode',
  59. label: '质检方案编码',
  60. showOverflowTooltip: true,
  61. align: 'center',
  62. minWidth: 110
  63. },
  64. {
  65. prop: 'qualitySchemeTemplateName',
  66. label: '质检方案名称',
  67. align: 'center',
  68. minWidth: 150
  69. },
  70. {
  71. label: '状态',
  72. prop: 'status',
  73. slot: 'status',
  74. align: 'center'
  75. },
  76. {
  77. prop: 'templateRemark',
  78. label: '备注',
  79. showOverflowTooltip: true,
  80. align: 'center',
  81. minWidth: 110
  82. },
  83. {
  84. columnKey: 'action',
  85. label: '操作',
  86. width: 150,
  87. align: 'center',
  88. resizable: false,
  89. slot: 'action',
  90. fixed: 'right'
  91. }
  92. ]
  93. };
  94. },
  95. watch: {},
  96. methods: {
  97. datasource({ page, where, limit }) {
  98. return getList({
  99. ...where,
  100. pageNum: page,
  101. size: limit
  102. });
  103. },
  104. open() {
  105. this.equipmentdialog = true;
  106. },
  107. handleClose() {
  108. this.equipmentdialog = false;
  109. },
  110. // 选择
  111. selected() {
  112. if (!this.selection.length) {
  113. this.$message.error('至少选择一条数据');
  114. return;
  115. }
  116. this.$emit('choose', this.selection);
  117. this.handleClose();
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss" scoped></style>