index.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <ele-pro-table
  5. ref="table"
  6. :columns="columns"
  7. :datasource="datasource"
  8. :selection.sync="selection"
  9. cache-key="systemRoleTable"
  10. >
  11. <!-- 表头工具栏 -->
  12. <template v-slot:toolbar>
  13. <el-button
  14. size="small"
  15. type="primary"
  16. icon="el-icon-plus"
  17. class="ele-btn-icon"
  18. @click="openEdit('add')"
  19. >
  20. 新建
  21. </el-button>
  22. <!-- <el-button
  23. size="small"
  24. type="primary"
  25. class="ele-btn-icon"
  26. @click="openclass"
  27. >
  28. 设置班次
  29. </el-button> -->
  30. </template>
  31. <!-- 操作列 -->
  32. <template v-slot:action="{ row }">
  33. <el-link
  34. type="primary"
  35. :underline="false"
  36. icon="el-icon-edit"
  37. @click="openEdit('edit', row)"
  38. >
  39. 修改
  40. </el-link>
  41. <el-popconfirm
  42. class="ele-action"
  43. title="确定要删除此角色吗?"
  44. @confirm="remove(row)"
  45. >
  46. <template v-slot:reference>
  47. <el-link type="danger" :underline="false" icon="el-icon-delete">
  48. 删除
  49. </el-link>
  50. </template>
  51. </el-popconfirm>
  52. </template>
  53. </ele-pro-table>
  54. </el-card>
  55. <edit ref="edit" @done="done"></edit>
  56. <setclasses ref="setclasses" @done="done"></setclasses>
  57. </div>
  58. </template>
  59. <script>
  60. import edit from './components/edit.vue';
  61. import setclasses from './components/setclasses.vue';
  62. import { getteampage, deleteteam } from '@/api/workforceManagement/team';
  63. export default {
  64. components: {
  65. edit,
  66. setclasses
  67. },
  68. data() {
  69. return {
  70. selection: [],
  71. columns: [
  72. {
  73. width: 45,
  74. type: 'selection',
  75. columnKey: 'selection',
  76. align: 'center'
  77. },
  78. {
  79. width: 45,
  80. type: 'index',
  81. columnKey: 'index',
  82. align: 'center'
  83. },
  84. {
  85. prop: 'code',
  86. label: '编码'
  87. },
  88. {
  89. label: '名称',
  90. prop: 'name'
  91. },
  92. {
  93. label: '所属产线',
  94. prop: 'productionLineName'
  95. },
  96. {
  97. label: '关联工站',
  98. prop: 'workStationNames'
  99. },
  100. {
  101. label: '人数',
  102. prop: 'userNumber'
  103. },
  104. {
  105. columnKey: 'action',
  106. label: '操作',
  107. width: 220,
  108. align: 'center',
  109. resizable: false,
  110. slot: 'action',
  111. showOverflowTooltip: true
  112. }
  113. ],
  114. dict: {
  115. enabled: {
  116. 1: '生效',
  117. 0: '未生效'
  118. },
  119. groupId: []
  120. }
  121. };
  122. },
  123. methods: {
  124. datasource({ page, where, limit }) {
  125. let data = getteampage({
  126. ...where,
  127. pageNum: page,
  128. size: limit
  129. });
  130. return data;
  131. },
  132. openEdit(type, row) {
  133. this.$refs.edit.open(type, row);
  134. },
  135. remove(row) {
  136. let par = [row.id];
  137. deleteteam(par)
  138. .then((message) => {
  139. this.$message.success(message);
  140. this.done();
  141. })
  142. .catch((e) => {
  143. this.$message.error(e.message);
  144. });
  145. },
  146. done() {
  147. this.$refs.table.reload({
  148. page: 1
  149. });
  150. },
  151. openclass() {
  152. if (this.selection.length <= 0) {
  153. this.$message.error('请选择班组');
  154. return;
  155. }
  156. let list = this.selection.map((n) => n.id);
  157. this.$refs.setclasses.open(list);
  158. }
  159. }
  160. };
  161. </script>