templatelist.vue 6.1 KB

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