index.vue 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <search ref="search" @search="search"></search>
  5. <ele-pro-table
  6. ref="table"
  7. :columns="columns"
  8. :datasource="datasource"
  9. >
  10. <!-- 表头工具栏 -->
  11. <template v-slot:toolbar>
  12. <el-button
  13. size="small"
  14. type="primary"
  15. icon="el-icon-plus"
  16. class="ele-btn-icon"
  17. @click="openEdit('add')"
  18. >
  19. 添加
  20. </el-button>
  21. </template>
  22. <!-- 操作列 -->
  23. <template v-slot:action="{ row }">
  24. <el-link
  25. type="primary"
  26. :underline="false"
  27. icon="el-icon-edit"
  28. @click="openEdit('edit', row)"
  29. >
  30. 修改
  31. </el-link>
  32. <el-popconfirm
  33. class="ele-action"
  34. title="确定要删除吗?"
  35. @confirm="remove(row)"
  36. >
  37. <template v-slot:reference>
  38. <el-link type="danger" :underline="false" icon="el-icon-delete">
  39. 删除
  40. </el-link>
  41. </template>
  42. </el-popconfirm>
  43. </template>
  44. </ele-pro-table>
  45. </el-card>
  46. <edit ref="edit" @done="done"></edit>
  47. </div>
  48. </template>
  49. <script>
  50. import search from './components/search.vue';
  51. import edit from './components/edit.vue';
  52. import { getList, removeItem } from '@/api/inspectionProject';
  53. import dictMixins from '@/mixins/dictMixins';
  54. export default {
  55. mixins: [dictMixins],
  56. components: {
  57. search,
  58. edit
  59. },
  60. data() {
  61. return {
  62. columns: [
  63. {
  64. width: 45,
  65. type: 'index',
  66. columnKey: 'index',
  67. align: 'center'
  68. },
  69. {
  70. prop: 'inspectionCode',
  71. label: '编码'
  72. },
  73. {
  74. label: '名称',
  75. prop: 'inspectionName'
  76. },
  77. {
  78. label: '是否生成过程',
  79. prop: 'isCreateCourse',
  80. formatter: (row, column, cellValue) => {
  81. return cellValue==1?'是': cellValue===0?'否':''
  82. }
  83. },
  84. {
  85. label: '质检标准',
  86. prop: 'inspectionStandard'
  87. },
  88. {
  89. label: '质检工具',
  90. prop: 'inspectionTool'
  91. },
  92. {
  93. label: '状态',
  94. prop: 'status',
  95. formatter: (row, column, cellValue) => {
  96. return cellValue==1?'启用': cellValue===0?'停用':''
  97. }
  98. },
  99. {
  100. label: '描述',
  101. prop: 'description'
  102. },
  103. {
  104. label: '备注',
  105. prop: 'inspectionRemark'
  106. },
  107. {
  108. columnKey: 'action',
  109. label: '操作',
  110. width: 220,
  111. align: 'center',
  112. resizable: false,
  113. slot: 'action',
  114. showOverflowTooltip: true
  115. }
  116. ]
  117. };
  118. },
  119. created() {
  120. this.requestDict('质检标准类型');
  121. },
  122. methods: {
  123. datasource({ page, where, limit }) {
  124. return getList({
  125. ...where,
  126. pageNum: page,
  127. size: limit
  128. });
  129. },
  130. search(where) {
  131. this.$refs.table.reload({
  132. where: where,
  133. page: 1
  134. });
  135. },
  136. openEdit(type, row) {
  137. this.$refs.edit.open(type, row);
  138. },
  139. remove(row) {
  140. removeItem([row.id])
  141. .then((message) => {
  142. this.$message.success(message);
  143. this.done();
  144. })
  145. .catch((e) => {});
  146. },
  147. done() {
  148. this.$refs.search.search();
  149. }
  150. }
  151. };
  152. </script>