排班日历自动生成

This commit is contained in:
JinLu.Yin 2022-06-12 22:50:34 +08:00
parent b52d7118d2
commit 43a9575420
4 changed files with 67 additions and 82 deletions

View File

@ -62,22 +62,11 @@ export default {
workdayList:[],// workdayList:[],//
selectedType:null, selectedType:null,
calendarDayList:[ calendarDayList:[
{
theDay:'2022-06-04',
shiftType: 'SHIFT_TWO',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
},
{
theDay:'2022-06-13',
shiftType: 'SHIFT_TWO',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
},
{
theDay:'2022-06-14',
shiftType: 'SHIFT_THREE',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
}
], ],
teamShiftQueryParams:{
queryType:'TYPE',
calendarType: null
},
queryParams: { queryParams: {
theDay: null, theDay: null,
holidayType: null, holidayType: null,
@ -90,6 +79,12 @@ export default {
date:{ date:{
handler(newVal,oldVal){ handler(newVal,oldVal){
console.log(newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate()); console.log(newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate());
this.teamShiftQueryParams.date = newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate();
this.loading = true;
listCalendars(this.teamShiftQueryParams).then(response =>{
this.calendarDayList = response.data;
this.loading = false;
});
} }
} }
}, },
@ -119,11 +114,9 @@ export default {
// //
onSelected(calType){ onSelected(calType){
this.loading = true; this.loading = true;
var param = { this.teamShiftQueryParams.calendarType = calType;
queryType: 'TYPE', this.teamShiftQueryParams.date = this.date;
calendarType: calType listCalendars(this.teamShiftQueryParams).then(response =>{
}
listCalendars(param).then(response =>{
this.calendarDayList = response.data; this.calendarDayList = response.data;
this.loading = false; this.loading = false;
}); });

View File

@ -71,22 +71,11 @@ export default {
selectedType:null, selectedType:null,
form:{}, form:{},
calendarDayList:[ calendarDayList:[
{
theDay:'2022-06-04',
shiftType: 'SHIFT_TWO',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
},
{
theDay:'2022-06-13',
shiftType: 'SHIFT_TWO',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
},
{
theDay:'2022-06-14',
shiftType: 'SHIFT_THREE',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
}
], ],
teamShiftQueryParams:{
queryType:'USER',
},
queryParams: { queryParams: {
theDay: null, theDay: null,
holidayType: null, holidayType: null,
@ -99,6 +88,12 @@ export default {
date:{ date:{
handler(newVal,oldVal){ handler(newVal,oldVal){
console.log(newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate()); console.log(newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate());
this.teamShiftQueryParams.date = newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate();
this.loading = true;
listCalendars(this.teamShiftQueryParams).then(response =>{
this.calendarDayList = response.data;
this.loading = false;
});
} }
} }
}, },
@ -133,11 +128,9 @@ export default {
onUserSelected(row){ onUserSelected(row){
this.form.nickName = row.nickName; this.form.nickName = row.nickName;
this.loading = true; this.loading = true;
var param = { this.teamShiftQueryParams.userId = row.userId;
queryType: 'USER', this.teamShiftQueryParams.date = this.date;
userId: row.userId listCalendars(this.teamShiftQueryParams).then(response =>{
}
listCalendars(param).then(response =>{
this.calendarDayList = response.data; this.calendarDayList = response.data;
this.loading = false; this.loading = false;
}); });

View File

@ -64,22 +64,10 @@ export default {
workdayList:[],// workdayList:[],//
selectedType:null, selectedType:null,
calendarDayList:[ calendarDayList:[
{
theDay:'2022-06-04',
shiftType: 'SHIFT_TWO',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
},
{
theDay:'2022-06-13',
shiftType: 'SHIFT_TWO',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
},
{
theDay:'2022-06-14',
shiftType: 'SHIFT_THREE',
teamShifts:[{teamName: '注塑1组',shiftName:'白班',orderNum: 1},{teamName: '注塑2组',shiftName:'中班',orderNum: 2},{teamName: '注塑3组',shiftName:'晚班',orderNum: 3}]
}
], ],
teamShiftQueryParams: {
queryType:'TEAM'
},
queryParams: { queryParams: {
theDay: null, theDay: null,
holidayType: null, holidayType: null,
@ -92,6 +80,12 @@ export default {
date:{ date:{
handler(newVal,oldVal){ handler(newVal,oldVal){
console.log(newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate()); console.log(newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate());
this.teamShiftQueryParams.date = newVal.getFullYear()+'-'+(newVal.getMonth()+1)+'-'+newVal.getDate();
this.loading = true;
listCalendars(this.teamShiftQueryParams).then(response =>{
this.calendarDayList = response.data;
this.loading = false;
});
} }
} }
}, },
@ -127,11 +121,9 @@ export default {
// //
onSelected(teamId){ onSelected(teamId){
this.loading = true; this.loading = true;
var param = { this.teamShiftQueryParams.teamId = teamId;
queryType: 'TEAM', this.teamShiftQueryParams.date = this.date;
teamId: teamId listCalendars(this.teamShiftQueryParams).then(response =>{
}
listCalendars(param).then(response =>{
this.calendarDayList = response.data; this.calendarDayList = response.data;
this.loading = false; this.loading = false;
}); });

View File

@ -57,20 +57,9 @@
icon="el-icon-plus" icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['cal:calplan:add']" v-hasPermi="['mes:cal:calplan:add']"
>新增</el-button> >新增</el-button>
</el-col> </el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['cal:calplan:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
@ -79,7 +68,7 @@
size="mini" size="mini"
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['cal:calplan:remove']" v-hasPermi="['mes:cal:calplan:remove']"
>删除</el-button> >删除</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
@ -89,7 +78,7 @@
icon="el-icon-download" icon="el-icon-download"
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['cal:calplan:export']" v-hasPermi="['mes:cal:calplan:export']"
>导出</el-button> >导出</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@ -132,13 +121,18 @@
<dict-tag :options="dict.type.mes_shift_method" :value="scope.row.shiftMethod"/> <dict-tag :options="dict.type.mes_shift_method" :value="scope.row.shiftMethod"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/> <el-table-column label="单据状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :options="dict.type.mes_order_status" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" > <el-table-column label="操作" align="center" class-name="small-padding fixed-width" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
v-if="scope.row.status =='PREPARE'"
@click="handleUpdate(scope.row)" @click="handleUpdate(scope.row)"
v-hasPermi="['mes:cal:calplan:edit']" v-hasPermi="['mes:cal:calplan:edit']"
>修改</el-button> >修改</el-button>
@ -146,6 +140,7 @@
size="mini" size="mini"
type="text" type="text"
icon="el-icon-delete" icon="el-icon-delete"
v-if="scope.row.status =='PREPARE'"
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['mes:cal:calplan:remove']" v-hasPermi="['mes:cal:calplan:remove']"
>删除</el-button> >删除</el-button>
@ -162,7 +157,7 @@
/> />
<!-- 添加或修改排班计划对话框 --> <!-- 添加或修改排班计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="960px" append-to-body> <el-dialog :title="title" v-loading="formLoading" :visible.sync="open" width="960px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px"> <el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-row> <el-row>
<el-col :span="8"> <el-col :span="8">
@ -243,8 +238,8 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-if="form.shiftType !='SINGLE'" :span="6"> <el-col v-if="form.shiftMethod =='DAY' && form.shiftType !='SINGLE'" :span="6">
<el-form-item label-width="80" prop="shiftCount"> <el-form-item label-width="20" prop="shiftCount">
<el-input-number :min="1" controls-position="right" v-model="form.shiftCount" > <el-input-number :min="1" controls-position="right" v-model="form.shiftCount" >
</el-input-number> </el-input-number>
</el-form-item> </el-form-item>
@ -267,8 +262,9 @@
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view'">返回</el-button> <el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE'">返回</el-button>
<el-button type="primary" @click="submitForm" v-else> </el-button> <el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </el-button>
<el-button type="success" @click="handleFinish" v-if="form.status =='PREPARE' && optType !='view' && form.planId !=null">完成</el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
@ -282,7 +278,7 @@ import Team from "./team";
import {genCode} from "@/api/system/autocode/rule" import {genCode} from "@/api/system/autocode/rule"
export default { export default {
name: "Calplan", name: "Calplan",
dicts: ['mes_shift_method','mes_shift_type','mes_calendar_type'], dicts: ['mes_shift_method','mes_shift_type','mes_calendar_type','mes_order_status'],
components: {Shift,Team}, components: {Shift,Team},
data() { data() {
return { return {
@ -291,6 +287,7 @@ export default {
optType: undefined, optType: undefined,
// //
loading: true, loading: true,
formLoading: false,
// //
ids: [], ids: [],
// //
@ -371,6 +368,7 @@ export default {
shiftType: 'SHIFT_TWO', shiftType: 'SHIFT_TWO',
shiftMethod: 'MONTH', shiftMethod: 'MONTH',
shiftCount: 1, shiftCount: 1,
status: "PREPARE",
remark: null, remark: null,
attr1: null, attr1: null,
attr2: null, attr2: null,
@ -430,6 +428,7 @@ export default {
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.formLoading = true;
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.planId != null) { if (this.form.planId != null) {
@ -437,6 +436,7 @@ export default {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.open = false; this.open = false;
this.getList(); this.getList();
this.formLoading = false;
}); });
} else { } else {
addCalplan(this.form).then(response => { addCalplan(this.form).then(response => {
@ -458,6 +458,13 @@ export default {
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); }).catch(() => {});
}, },
handleFinish(){
let that = this;
this.$modal.confirm('是否完成计划编制?【完成后将不能更改】').then(function(){
that.form.status = 'CONFIRMED';
that.submitForm();
});
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.download('cal/calplan/export', { this.download('cal/calplan/export', {