index.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never">
  4. <useSearch @search="reload"></useSearch>
  5. <ele-pro-table
  6. ref="table"
  7. :columns="columns"
  8. :datasource="datasource"
  9. :page-size="pageSize"
  10. @columns-change="handleColumnChange"
  11. :cache-key="cacheKeyUrl"
  12. @filter-change="selectType"
  13. >
  14. <!-- 表头工具栏 -->
  15. <template v-slot:toolbar>
  16. <el-button
  17. size="small"
  18. type="primary"
  19. icon="el-icon-plus"
  20. class="ele-btn-icon"
  21. v-if="$hasPermission('main:teamqueue:save')"
  22. @click="openAdd('add')"
  23. >
  24. 新建
  25. </el-button>
  26. </template>
  27. <template v-slot:status="{ row }">
  28. {{ dict.enabled[row.status] }}
  29. </template>
  30. <!-- 操作列 -->
  31. <template v-slot:action="{ row }">
  32. <el-link
  33. type="primary"
  34. :underline="false"
  35. icon="el-icon-edit"
  36. v-if="$hasPermission('main:teamqueue:save')"
  37. @click="SchedulingGroupPeople(row)"
  38. >
  39. 按人排班
  40. </el-link>
  41. <el-link
  42. type="primary"
  43. :underline="false"
  44. icon="el-icon-edit"
  45. v-if="$hasPermission('main:teamqueue:save')"
  46. @click="bpb(row)"
  47. >
  48. 按班排班
  49. </el-link>
  50. <el-popconfirm
  51. class="ele-action"
  52. title="确定要删除此排班吗?"
  53. v-if="row.status == 0 && $hasPermission('main:teamqueue:delete')"
  54. @confirm="remove(row)"
  55. >
  56. <template v-slot:reference>
  57. <el-link type="danger" :underline="false" icon="el-icon-delete">
  58. 删除
  59. </el-link>
  60. </template>
  61. </el-popconfirm>
  62. <el-popconfirm
  63. class="ele-action"
  64. title="确定要发布此排班?"
  65. @confirm="issue(row)"
  66. v-if="row.status == 0 && $hasPermission('main:teamqueue:update')"
  67. >
  68. <template v-slot:reference>
  69. <el-link type="primary" :underline="false"> 发布 </el-link>
  70. </template>
  71. </el-popconfirm>
  72. </template>
  73. </ele-pro-table>
  74. </el-card>
  75. <SchedulingGroup ref="SchedulingGroup"></SchedulingGroup>
  76. </div>
  77. </template>
  78. <script>
  79. import tabMixins from '@/mixins/tableColumnsMixin';
  80. import SchedulingGroup from './components/SchedulingGroup.vue';
  81. import {
  82. teamqueuepage,
  83. deleteteamtime,
  84. teamqueueUpdate
  85. } from '@/api/workforceManagement/schedule';
  86. import useSearch from './components/use-search';
  87. export default {
  88. mixins: [tabMixins],
  89. components: {
  90. SchedulingGroup,
  91. useSearch
  92. },
  93. data() {
  94. return {
  95. columns: [
  96. {
  97. width: 45,
  98. type: 'index',
  99. columnKey: 'index',
  100. align: 'center',
  101. fixed: 'left'
  102. },
  103. {
  104. prop: 'name',
  105. label: '排班组名称'
  106. },
  107. {
  108. label: '总人数',
  109. prop: 'totalPersonNumber'
  110. },
  111. {
  112. label: '创建人',
  113. prop: 'createUserName'
  114. },
  115. {
  116. //修改此prop名称时,请同步修改columnKey属性和下方selectType方法
  117. label: '状态',
  118. prop: 'status',
  119. slot: 'status',
  120. filters: [
  121. { value: 1, text: '发布' },
  122. { value: 0, text: '草稿' }
  123. ],
  124. filterMultiple: false,
  125. columnKey: 'status'
  126. },
  127. {
  128. label: '创建时间',
  129. prop: 'createTime'
  130. },
  131. {
  132. columnKey: 'action',
  133. label: '操作',
  134. width: 300,
  135. align: 'center',
  136. resizable: false,
  137. slot: 'action',
  138. showOverflowTooltip: true,
  139. fixed: 'right'
  140. }
  141. ],
  142. dict: {
  143. enabled: {
  144. 1: '发布',
  145. 0: '草稿'
  146. }
  147. },
  148. pageSize: this.$store.state.tablePageSize,
  149. cacheKeyUrl: '7b18d31c-workforceManagement-schedule'
  150. };
  151. },
  152. methods: {
  153. selectType(value) {
  154. let where = {};
  155. if (value.status.length > 0) {
  156. where['status'] = value.status[0];
  157. }
  158. this.reload(where);
  159. },
  160. datasource({ page, where, limit }) {
  161. let data = teamqueuepage({
  162. ...where,
  163. pageNum: page,
  164. size: limit
  165. });
  166. console.log(data);
  167. return data;
  168. },
  169. /* 刷新表格 */
  170. reload(where) {
  171. this.$refs.table.reload({ where: where });
  172. },
  173. // 按人排班
  174. SchedulingGroupPeople(row) {
  175. this.$router.push({
  176. path: '/workforceManagement/schedule/detail',
  177. query: {
  178. type: 'edit',
  179. id: row.id
  180. }
  181. });
  182. },
  183. // 按班排班
  184. bpb(row) {
  185. this.$router.push({
  186. path: '/workforceManagement/schedule/detail',
  187. query: {
  188. type: 'edit',
  189. id: row.id,
  190. isSchedule: '1'
  191. }
  192. });
  193. },
  194. // 排版组
  195. openAdd() {
  196. this.$refs.SchedulingGroup.open();
  197. },
  198. remove(row) {
  199. let par = [row.id];
  200. deleteteamtime(par).then((message) => {
  201. this.$message.success(message);
  202. this.done();
  203. });
  204. },
  205. done() {
  206. this.$refs.table.reload({
  207. page: 1
  208. });
  209. },
  210. openclass() {
  211. this.$refs.setclasses.open();
  212. },
  213. issue(row) {
  214. let param = {
  215. id: row.id,
  216. status: 1
  217. };
  218. teamqueueUpdate(param)
  219. .then((msg) => {
  220. this.$message.success(message);
  221. this.done();
  222. })
  223. .catch((e) => {
  224. this.$message.error(e.message);
  225. });
  226. }
  227. }
  228. };
  229. </script>