| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <template>
- <div class="ele-body">
- <el-card shadow="never">
- <useSearch @search="reload"></useSearch>
- <ele-pro-table
- ref="table"
- :columns="columns"
- :datasource="datasource"
- :page-size="pageSize"
- @columns-change="handleColumnChange"
- :cache-key="cacheKeyUrl"
- @filter-change="selectType"
- >
- <!-- 表头工具栏 -->
- <template v-slot:toolbar>
- <el-button
- size="small"
- type="primary"
- icon="el-icon-plus"
- class="ele-btn-icon"
- v-if="$hasPermission('main:teamqueue:save')"
- @click="openAdd('add')"
- >
- 新建
- </el-button>
- </template>
- <template v-slot:status="{ row }">
- {{ dict.enabled[row.status] }}
- </template>
- <!-- 操作列 -->
- <template v-slot:action="{ row }">
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- v-if="$hasPermission('main:teamqueue:save')"
- @click="SchedulingGroupPeople(row)"
- >
- 按人排班
- </el-link>
- <el-link
- type="primary"
- :underline="false"
- icon="el-icon-edit"
- v-if="$hasPermission('main:teamqueue:save')"
- @click="bpb(row)"
- >
- 按班排班
- </el-link>
- <el-popconfirm
- class="ele-action"
- title="确定要删除此排班吗?"
- v-if="row.status == 0 && $hasPermission('main:teamqueue:delete')"
- @confirm="remove(row)"
- >
- <template v-slot:reference>
- <el-link type="danger" :underline="false" icon="el-icon-delete">
- 删除
- </el-link>
- </template>
- </el-popconfirm>
- <el-popconfirm
- class="ele-action"
- title="确定要发布此排班?"
- @confirm="issue(row)"
- v-if="row.status == 0 && $hasPermission('main:teamqueue:update')"
- >
- <template v-slot:reference>
- <el-link type="primary" :underline="false"> 发布 </el-link>
- </template>
- </el-popconfirm>
- </template>
- </ele-pro-table>
- </el-card>
- <SchedulingGroup ref="SchedulingGroup"></SchedulingGroup>
- </div>
- </template>
- <script>
- import tabMixins from '@/mixins/tableColumnsMixin';
- import SchedulingGroup from './components/SchedulingGroup.vue';
- import {
- teamqueuepage,
- deleteteamtime,
- teamqueueUpdate
- } from '@/api/workforceManagement/schedule';
- import useSearch from './components/use-search';
- export default {
- mixins: [tabMixins],
- components: {
- SchedulingGroup,
- useSearch
- },
- data() {
- return {
- columns: [
- {
- width: 45,
- type: 'index',
- columnKey: 'index',
- align: 'center',
- fixed: 'left'
- },
- {
- prop: 'name',
- label: '排班组名称'
- },
- {
- label: '总人数',
- prop: 'totalPersonNumber'
- },
- {
- label: '创建人',
- prop: 'createUserName'
- },
- {
- //修改此prop名称时,请同步修改columnKey属性和下方selectType方法
- label: '状态',
- prop: 'status',
- slot: 'status',
- filters: [
- { value: 1, text: '发布' },
- { value: 0, text: '草稿' }
- ],
- filterMultiple: false,
- columnKey: 'status'
- },
- {
- label: '创建时间',
- prop: 'createTime'
- },
- {
- columnKey: 'action',
- label: '操作',
- width: 300,
- align: 'center',
- resizable: false,
- slot: 'action',
- showOverflowTooltip: true,
- fixed: 'right'
- }
- ],
- dict: {
- enabled: {
- 1: '发布',
- 0: '草稿'
- }
- },
- pageSize: this.$store.state.tablePageSize,
- cacheKeyUrl: '7b18d31c-workforceManagement-schedule'
- };
- },
- methods: {
- selectType(value) {
- let where = {};
- if (value.status.length > 0) {
- where['status'] = value.status[0];
- }
- this.reload(where);
- },
- datasource({ page, where, limit }) {
- let data = teamqueuepage({
- ...where,
- pageNum: page,
- size: limit
- });
- console.log(data);
- return data;
- },
- /* 刷新表格 */
- reload(where) {
- this.$refs.table.reload({ where: where });
- },
- // 按人排班
- SchedulingGroupPeople(row) {
- this.$router.push({
- path: '/workforceManagement/schedule/detail',
- query: {
- type: 'edit',
- id: row.id
- }
- });
- },
- // 按班排班
- bpb(row) {
- this.$router.push({
- path: '/workforceManagement/schedule/detail',
- query: {
- type: 'edit',
- id: row.id,
- isSchedule: '1'
- }
- });
- },
- // 排版组
- openAdd() {
- this.$refs.SchedulingGroup.open();
- },
- remove(row) {
- let par = [row.id];
- deleteteamtime(par).then((message) => {
- this.$message.success(message);
- this.done();
- });
- },
- done() {
- this.$refs.table.reload({
- page: 1
- });
- },
- openclass() {
- this.$refs.setclasses.open();
- },
- issue(row) {
- let param = {
- id: row.id,
- status: 1
- };
- teamqueueUpdate(param)
- .then((msg) => {
- this.$message.success(message);
- this.done();
- })
- .catch((e) => {
- this.$message.error(e.message);
- });
- }
- }
- };
- </script>
|