<template>
|
<a-card :bordered="false">
|
|
<!-- 查询区域 -->
|
<div class="table-page-search-wrapper">
|
<a-form layout="inline" @keyup.enter.native="searchQuery">
|
<a-row :gutter="24">
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-form-item label="班次编号">
|
<j-input placeholder="请输入班次编号" v-model="queryParam.shiftCode"></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-form-item label="班次名称">
|
<j-input placeholder="请输入班次名称" v-model="queryParam.shiftName"></j-input>
|
</a-form-item>
|
</a-col>
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
|
<a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
|
<a-button type="info" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
<!-- 操作按钮区域 -->
|
<div class="table-operator">
|
<a-button type="primary" @click="handleAdd" icon="plus">新增</a-button>
|
</div>
|
<!-- table区域-begin -->
|
<div style="width: 100%;flex: 1;overflow: auto">
|
<a-table ref="table" bordered size="middle" rowKey="id" :columns="columns"
|
:dataSource="dataSource" :pagination="false" class="j-table-force-nowrap" :loading="loading">
|
<span
|
slot="shiftStatus"
|
slot-scope="text, record"
|
>
|
<span v-if="text == 0" style="color:red;">禁用</span>
|
<span v-if="text == 1" style="color:green;">启用</span>
|
</span>
|
<span
|
slot="crossDayFlag"
|
slot-scope="text, record"
|
>
|
<span v-if="text == '1'">是</span>
|
<span v-if="text == '0'">否</span>
|
</span>
|
|
<span
|
slot="action"
|
slot-scope="text, record"
|
>
|
<a
|
href="javascript:;"
|
@click="handleDetail(record)"
|
>详情</a>
|
|
<a-divider type="vertical" />
|
<a-dropdown>
|
<a class="ant-dropdown-link">更多
|
<a-icon type="down" />
|
</a>
|
<a-menu slot="overlay">
|
<a-menu-item>
|
<a v-if="record.shiftStatus == 1" @click="handleEdit(record)">编辑</a>
|
</a-menu-item>
|
<a-menu-item>
|
<a-popconfirm
|
title="确定删除吗?"
|
@confirm="() => handleDelete(record.id)"
|
>
|
<a>删除</a>
|
</a-popconfirm>
|
|
</a-menu-item>
|
<a-menu-item v-if="record.shiftStatus == 0">
|
<a-popconfirm
|
title="确定启用吗?"
|
@confirm="() => handleStatus(record.id,1)"
|
>
|
<a>启用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
<a-menu-item v-if="record.shiftStatus == 1">
|
<a-popconfirm
|
title="确定禁用吗?"
|
@confirm="() => handleStatus(record.id,0)"
|
>
|
<a>禁用</a>
|
</a-popconfirm>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
</a-table>
|
</div>
|
|
<shift-model ref="modalForm" @ok="modalFormOk"></shift-model>
|
</a-card>
|
</template>
|
|
<script>
|
import {
|
requestPut, putAction, deleteAction
|
} from '@/api/manage'
|
import {
|
JeecgListMixin
|
} from '@/mixins/JeecgListMixin'
|
import ShiftModel from './modules/shift/ShiftModel'
|
|
export default {
|
name: 'ShiftManager',
|
mixins: [JeecgListMixin],
|
components: {
|
ShiftModel
|
},
|
props: {},
|
data() {
|
return {
|
url: {
|
list: '/base/shift/list',
|
changeStatus: '/base/shift/updateStatusById',
|
deleteBatch: '/base/shift/delete'
|
},
|
columns: [
|
{
|
title: '班次编号',
|
align: 'center',
|
dataIndex: 'shiftCode'
|
},
|
{
|
title: '班次名称',
|
align: 'center',
|
dataIndex: 'shiftName'
|
},
|
{
|
title: '开始时间',
|
align: 'center',
|
dataIndex: 'startTime'
|
},
|
{
|
title: '结束时间',
|
align: 'center',
|
dataIndex: 'endTime'
|
},
|
{
|
title: '工作时长',
|
align: 'center',
|
dataIndex: 'workHours'
|
},
|
{
|
title: '是否跨天',
|
align: 'center',
|
dataIndex: 'crossDayFlag',
|
scopedSlots: { customRender: 'crossDayFlag' }
|
},
|
{
|
title: '状态',
|
align: 'center',
|
dataIndex: 'shiftStatus',
|
scopedSlots: { customRender: 'shiftStatus' }
|
},
|
{
|
title: '操作',
|
align: 'center',
|
dataIndex: 'action',
|
scopedSlots: { customRender: 'action' }
|
}
|
]
|
}
|
},
|
methods: {
|
handleAdd() {
|
this.$refs.modalForm.add()
|
this.$refs.modalForm.title = '新增班次'
|
this.$refs.modalForm.disableSubmit = false
|
},
|
handleEdit(record) {
|
this.$refs.modalForm.edit(record)
|
this.$refs.modalForm.title = '编辑班次'
|
this.$refs.modalForm.disableSubmit = true
|
},
|
handleDelete: function(record){
|
if(!this.url.deleteBatch){
|
this.$message.error("请设置url.delete属性!")
|
return
|
}
|
var that = this;
|
deleteAction(that.url.deleteBatch, {id: record}).then((res) => {
|
if (res.success) {
|
that.$notification.success({
|
message:'消息',
|
description:res.message
|
});
|
that.loadData();
|
} else {
|
that.$notification.warning({
|
message:'消息',
|
description:res.message
|
});
|
}
|
});
|
},
|
handleStatus(id, status) {
|
let _this = this
|
putAction(this.url.changeStatus, { id: id, status: status }).then((res) => {
|
if (res.success) {
|
_this.$notification.success({
|
message:'消息',
|
description:"操作成功"
|
});
|
_this.loadData()
|
} else {
|
_this.$notification.warning({
|
message:'消息',
|
description:"操作失败"
|
});
|
}
|
})
|
},
|
},
|
created() {
|
}
|
|
}
|
</script>
|
|
<style lang="less" scoped>
|
@import '~@assets/less/common.less';
|
</style>
|