index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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. cache-key="systemRoleTable1"
  10. :page-size="20"
  11. >
  12. <!-- 表头工具栏 -->
  13. <template v-slot:toolbar>
  14. <el-button
  15. size="small"
  16. type="primary"
  17. icon="el-icon-plus"
  18. class="ele-btn-icon"
  19. @click="openEdit('add')"
  20. >
  21. 添加
  22. </el-button>
  23. </template>
  24. <template v-slot:status="{ row }">
  25. {{ row.status ? '启用' : '停用' }}
  26. </template>
  27. <template v-slot:type="{ row }">
  28. {{ getDictValue('质检标准类型', row.type) }}
  29. </template>
  30. <template v-slot:code="{ row }">
  31. <el-link
  32. type="primary"
  33. :underline="false"
  34. @click="openEdit('detail', row)"
  35. >
  36. {{ row.code }}
  37. </el-link>
  38. </template>
  39. <!-- 操作列 -->
  40. <template v-slot:action="{ row }">
  41. <el-link
  42. type="primary"
  43. :underline="false"
  44. icon="el-icon-edit"
  45. @click="openEdit('edit', row)"
  46. >
  47. 修改
  48. </el-link>
  49. <el-popconfirm
  50. class="ele-action"
  51. title="确定要删除此质检标准吗?"
  52. @confirm="remove(row)"
  53. >
  54. <template v-slot:reference>
  55. <el-link type="danger" :underline="false" icon="el-icon-delete">
  56. 删除
  57. </el-link>
  58. </template>
  59. </el-popconfirm>
  60. </template>
  61. </ele-pro-table>
  62. </el-card>
  63. <edit ref="edit" @done="done"></edit>
  64. </div>
  65. </template>
  66. <script>
  67. import search from './components/search.vue';
  68. import edit from './components/edit.vue';
  69. import { getList, removeItem } from '@/api/inspectionStandard';
  70. import dictMixins from '@/mixins/dictMixins';
  71. export default {
  72. mixins: [dictMixins],
  73. components: {
  74. search,
  75. edit
  76. },
  77. data() {
  78. return {
  79. columns: [
  80. {
  81. width: 55,
  82. type: 'index',
  83. label: '序号',
  84. columnKey: 'index',
  85. align: 'center'
  86. },
  87. {
  88. width: 70,
  89. prop: 'sort',
  90. label: '排序',
  91. align: 'center'
  92. },
  93. {
  94. prop: 'code',
  95. label: '标准编码',
  96. slot: 'code',
  97. align: 'center'
  98. },
  99. {
  100. label: '标准名称',
  101. prop: 'name',
  102. align: 'center'
  103. },
  104. {
  105. label: '标准类型',
  106. prop: 'type',
  107. slot: 'type',
  108. align: 'center'
  109. },
  110. {
  111. label: '标准代码',
  112. prop: 'standardCode',
  113. align: 'center'
  114. },
  115. {
  116. label: '状态',
  117. prop: 'status',
  118. slot: 'status',
  119. align: 'center'
  120. },
  121. {
  122. label: '版本号',
  123. prop: 'version',
  124. align: 'center'
  125. },
  126. {
  127. label: '创建时间',
  128. prop: 'createTime',
  129. align: 'center'
  130. },
  131. {
  132. label: '创建人',
  133. prop: 'createUserName',
  134. align: 'center'
  135. },
  136. {
  137. columnKey: 'action',
  138. label: '操作',
  139. width: 220,
  140. align: 'center',
  141. resizable: false,
  142. slot: 'action',
  143. showOverflowTooltip: true
  144. }
  145. ]
  146. };
  147. },
  148. created() {
  149. this.requestDict('质检标准类型');
  150. },
  151. methods: {
  152. datasource({ page, where, limit }) {
  153. return getList({
  154. ...where,
  155. pageNum: page,
  156. size: limit
  157. });
  158. },
  159. search(where) {
  160. this.$refs.table.reload({
  161. where: where,
  162. page: 1
  163. });
  164. },
  165. openEdit(type, row) {
  166. this.$refs.edit.open(type, row);
  167. },
  168. remove(row) {
  169. removeItem([row.id])
  170. .then((message) => {
  171. this.$message.success(message);
  172. this.done();
  173. })
  174. .catch((e) => {});
  175. },
  176. done() {
  177. this.$refs.search.search();
  178. }
  179. }
  180. };
  181. </script>