templatelist.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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" @click="openAddDialog('add')"
  15. >新建</el-button
  16. >
  17. <el-button type="primary" size="mini">导入</el-button>
  18. <el-button size="mini">导出</el-button>
  19. </template>
  20. <template v-slot:action="{ row }">
  21. <el-link type="text" @click="openAddDialog('clone', row)">克隆</el-link>
  22. <el-link
  23. type="text"
  24. @click="openAddDialog('edit', row)"
  25. style="margin-right: 10px"
  26. >修改</el-link
  27. >
  28. <el-popconfirm
  29. v-if="row.enable == 0"
  30. title="这是一段内容确定删除吗?"
  31. @confirm="deleteRow(row)"
  32. >
  33. <el-link slot="reference" type="danger">删除</el-link>
  34. </el-popconfirm>
  35. </template>
  36. </ele-pro-table>
  37. </el-card>
  38. <templateAdd ref="templateAddRef" @reload="reload"></templateAdd>
  39. </div>
  40. </template>
  41. <script>
  42. import dictMixins from '@/mixins/dictMixins';
  43. import tableColumnsMixin from '@/mixins/tableColumnsMixin';
  44. import {
  45. checklisttemplatePage,
  46. checklisttemplateLogicDeleteByIds
  47. } from '@/api/checklisttemplate/index';
  48. import templateAdd from './components/templateAdd.vue';
  49. export default {
  50. mixins: [dictMixins, tableColumnsMixin],
  51. components: { templateAdd },
  52. data() {
  53. return {
  54. columns: [
  55. {
  56. width: 50,
  57. type: 'index',
  58. columnKey: 'index',
  59. align: 'center',
  60. label: '序号'
  61. },
  62. {
  63. prop: 'checklistType',
  64. label: '放行类型',
  65. align: 'center',
  66. minWidth: 110,
  67. showOverflowTooltip: true,
  68. formatter: (row) => {
  69. return this.getDictValue('放行类型', row.checklistType);
  70. }
  71. },
  72. {
  73. prop: 'templateCode',
  74. label: '放行单编码',
  75. align: 'center',
  76. minWidth: 110,
  77. showOverflowTooltip: true
  78. },
  79. {
  80. prop: 'templateName',
  81. label: '放行单名称',
  82. align: 'center',
  83. minWidth: 110,
  84. showOverflowTooltip: true
  85. },
  86. {
  87. prop: 'remark',
  88. label: '备注',
  89. align: 'center',
  90. minWidth: 110,
  91. showOverflowTooltip: true
  92. },
  93. {
  94. prop: 'enable',
  95. label: '状态',
  96. align: 'center',
  97. showOverflowTooltip: true,
  98. minWidth: 150,
  99. formatter: (row) => {
  100. return row.enable ? '启用' : '停用';
  101. }
  102. },
  103. {
  104. prop: 'createUserName',
  105. label: '创建人',
  106. align: 'center',
  107. minWidth: 110,
  108. showOverflowTooltip: true
  109. },
  110. {
  111. prop: 'updateTime',
  112. label: '修改时间',
  113. align: 'center',
  114. minWidth: 110,
  115. showOverflowTooltip: true
  116. },
  117. {
  118. columnKey: 'action',
  119. label: '操作',
  120. width: 220,
  121. align: 'center',
  122. resizable: false,
  123. fixed: 'right',
  124. slot: 'action',
  125. showOverflowTooltip: true
  126. }
  127. ],
  128. cacheKeyUrl: 'mes-259251647-template-list-table'
  129. };
  130. },
  131. computed: {
  132. seekList() {
  133. return [
  134. {
  135. label: '编码:',
  136. value: 'releaseOrderCode',
  137. type: 'input',
  138. placeholder: '请输入'
  139. },
  140. {
  141. label: '名称:',
  142. value: 'releaseOrderName',
  143. type: 'input',
  144. placeholder: '请输入'
  145. },
  146. {
  147. label: '放行类型:',
  148. value: 'releaseOrderStatus',
  149. type: 'input',
  150. placeholder: '请输入'
  151. }
  152. ];
  153. }
  154. },
  155. methods: {
  156. // 刷新表格
  157. reload(where = {}) {
  158. this.$refs.table.reload({
  159. where
  160. });
  161. },
  162. /* 表格数据源 */
  163. datasource({ page, limit, where, order }) {
  164. // 参数
  165. const body = {
  166. ...where,
  167. ...order,
  168. pageNum: page,
  169. size: limit
  170. };
  171. return checklisttemplatePage(body);
  172. },
  173. search(where) {
  174. this.reload(where);
  175. },
  176. openAddDialog(type, row) {
  177. this.$refs.templateAddRef?.open(type, row);
  178. },
  179. // 删除
  180. async deleteRow(row) {
  181. await checklisttemplateLogicDeleteByIds([row.id]);
  182. this.$message.success('删除成功');
  183. this.reload();
  184. }
  185. }
  186. };
  187. </script>
  188. <style></style>