<template>
|
<div class="shift_info">
|
<!-- 操作按钮区域 -->
|
<div class="table-operator">
|
<a-button type="primary" v-if="Object.keys(shiftSystemRow).length>0" @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" :loading="loading">
|
<span
|
slot="shiftSubStatus"
|
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="isDaySpan"
|
slot-scope="text, record"
|
>
|
<span v-if="text == 'true'">是</span>
|
<span v-if="text == 'false'">否</span>
|
</span>
|
<span
|
slot="action"
|
slot-scope="text, record"
|
>
|
<a-dropdown>
|
<a class="ant-dropdown-link">
|
<a-icon type="down"/>
|
</a>
|
<a-menu slot="overlay">
|
<a-menu-item v-if="record.shiftSubStatus == 1">
|
<a key="1" @click="handleEdit(record)">编辑</a>
|
</a-menu-item>
|
<a-menu-item v-if="record.shiftSubStatus == 0">
|
<a key="2" @click="handleStatus(record.id,1)">启用</a>
|
</a-menu-item>
|
<a-menu-item v-if="record.shiftSubStatus == 1">
|
<a key="3" @click="handleStatus(record.id,0)">停用</a>
|
</a-menu-item>
|
<a-menu-item >
|
<a key="4" @click="handleDelete(record.id)">删除</a>
|
</a-menu-item>
|
</a-menu>
|
</a-dropdown>
|
</span>
|
</a-table>
|
</div>
|
|
<shift-info-model ref="modalForm" @ok="modalFormOk"></shift-info-model>
|
</div>
|
</template>
|
|
<script>
|
import {
|
requestPut, putAction, deleteAction
|
} from '@/api/manage'
|
import {
|
JeecgListMixin
|
} from '@/mixins/JeecgListMixin'
|
import ShiftInfoModel from './ShiftInfoModel'
|
|
export default {
|
name: 'ShiftInfo',
|
mixins: [JeecgListMixin],
|
components: {
|
ShiftInfoModel
|
},
|
props: {
|
shiftSystemRow: {
|
type: Object,
|
required: true,
|
default: {}
|
}
|
},
|
data() {
|
return {
|
statusName: '',
|
disabled: true,
|
disableMixinCreated: true,
|
url: {
|
list: '/mdc/mdcShiftSub/queryPageList',
|
changeStatus: '/mdc/mdcShiftSub/updateSubStatusById',
|
deleteBatch: '/mdc/mdcShiftSub/deleteMdcShiftSub'
|
},
|
columns: [
|
{
|
title: '班次',
|
align: 'center',
|
dataIndex: 'shiftSubName'
|
},
|
{
|
title: '开始时间',
|
align: 'center',
|
dataIndex: 'startDate'
|
},
|
{
|
title: '结束时间',
|
align: 'center',
|
dataIndex: 'endDate'
|
},
|
{
|
title: '是否跨天',
|
align: 'center',
|
dataIndex: 'isDaySpan',
|
scopedSlots: { customRender: 'isDaySpan' }
|
},
|
{
|
title: '开始休息时间',
|
align: 'center',
|
dataIndex: 'sleepStartDate'
|
},
|
{
|
title: '结束休息时间',
|
align: 'center',
|
dataIndex: 'sleepEndDate'
|
},
|
{
|
title: '状态',
|
align: 'center',
|
dataIndex: 'shiftSubStatus',
|
scopedSlots: { customRender: 'shiftSubStatus' }
|
},
|
{
|
title: '操作',
|
align: 'center',
|
dataIndex: 'action',
|
scopedSlots: { customRender: 'action' }
|
}
|
]
|
}
|
},
|
methods: {
|
handleAdd() {
|
this.$refs.modalForm.add(this.shiftSystemRow)
|
this.$refs.modalForm.title = '班次配置'
|
this.$refs.modalForm.disableSubmit = false
|
},
|
handleEdit(record) {
|
record.shiftId = this.shiftSystemRow.id
|
record.shiftName = this.shiftSystemRow.shiftName
|
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.$message.success(res.message);
|
that.$notification.success({
|
message:'消息',
|
description:res.message
|
});
|
that.loadData();
|
} else {
|
// that.$message.warning(res.message);
|
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.$message.success('操作成功!')
|
_this.$notification.success({
|
message:'消息',
|
description:"操作成功"
|
});
|
_this.loadData()
|
} else {
|
// _this.$message.warning('操作失败!')
|
_this.$notification.warning({
|
message:'消息',
|
description:"操作失败"
|
});
|
}
|
})
|
},
|
},
|
created() {
|
},
|
watch: {
|
shiftSystemRow(val) { // 监听currSelected 变化,将变化后的数值传递给 getCurrSelected 事件
|
this.queryParam.shiftId = val.id
|
this.loadData()
|
}
|
}
|
|
}
|
</script>
|
|
<style lang="less" scoped>
|
.shift_info{
|
overflow: hidden;
|
display: flex;
|
flex-direction: column;
|
}
|
|
@media screen and (min-width: 1920px){
|
.shift_info{
|
height: 748px!important;
|
}
|
}
|
@media screen and (min-width: 1680px) and (max-width: 1920px){
|
.shift_info{
|
height: 748px!important;
|
}
|
}
|
@media screen and (min-width: 1400px) and (max-width: 1680px){
|
.shift_info{
|
height: 600px!important;
|
}
|
}
|
@media screen and (min-width: 1280px) and (max-width: 1400px){
|
.shift_info{
|
height: 501px!important;
|
}
|
}
|
@media screen and (max-width: 1280px){
|
.shift_info{
|
height: 501px!important;
|
}
|
}
|
</style>
|