Commit 80817fc7 authored by 沈翠玲's avatar 沈翠玲

排班计划

parent 1093605f
...@@ -60,6 +60,16 @@ ...@@ -60,6 +60,16 @@
v-hasPermi="['mes: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="primary"
plain
size="mini"
:disabled="single"
@click="handleCopy"
v-hasPermi="['mes:cal:calplan:copy']"
>复制</el-button>
</el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
type="danger" type="danger"
...@@ -253,7 +263,7 @@ ...@@ -253,7 +263,7 @@
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE'">返回</el-button> <el-button type="primary" @click="cancel" v-if="optType =='view' || form.status !='PREPARE'">返回</el-button>
<el-button type="primary" @click="submitForm" v-if="form.status =='PREPARE' && optType !='view' "> </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 type="success" @click="handleFinish" v-if="form.status =='PREPARE' && optType !='view' && optType !='copy' && form.planId !=null">完成</el-button>
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
...@@ -264,6 +274,7 @@ ...@@ -264,6 +274,7 @@
import { listCalplan, getCalplan, delCalplan, addCalplan, updateCalplan, finishCalplan } from "@/api/mes/cal/calplan"; import { listCalplan, getCalplan, delCalplan, addCalplan, updateCalplan, finishCalplan } from "@/api/mes/cal/calplan";
import Shift from "./shift"; import Shift from "./shift";
import Team from "./team"; import Team from "./team";
import dayjs from 'dayjs'
import {genCode} from "@/api/system/autocode/rule" import {genCode} from "@/api/system/autocode/rule"
export default { export default {
name: "Calplan", name: "Calplan",
...@@ -411,11 +422,27 @@ export default { ...@@ -411,11 +422,27 @@ export default {
this.optType = "edit"; this.optType = "edit";
}); });
}, },
// 复制
handleCopy(row) {
this.reset();
const planId = row.planId || this.ids
getCalplan(planId).then(response => {
this.form = response.data;
this.form.status = "PREPARE"
this.form.endDate = dayjs().add(1, 'month').endOf('month').format('YYYY-MM-DD')
this.form.startDate = dayjs().add(1, 'month').startOf('month').format('YYYY-MM-DD')
this.handleAutoGenChange()
this.open = true;
this.title = "添加排班计划";
this.optType = "copy";
});
},
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
console.log('this.form', this.form)
this.$refs["form"].validate(valid => { this.$refs["form"].validate(valid => {
if (valid) { if (valid) {
if (this.form.planId != null) { if (this.form.planId != null && this.optType !== "copy") {
let params = Object.assign({}, this.form) let params = Object.assign({}, this.form)
params.calShifts = this.$refs.shiftTab.shiftList params.calShifts = this.$refs.shiftTab.shiftList
params.calWorkunits = this.$refs.teamTab.teamList params.calWorkunits = this.$refs.teamTab.teamList
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0&&planId" v-show="total>0&&planId&&optType != 'copy'"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
...@@ -71,7 +71,11 @@ export default { ...@@ -71,7 +71,11 @@ export default {
return return
} }
this.loading = true; this.loading = true;
listPlanteam(this.queryParams).then(response => { const param = JSON.parse(JSON.stringify(this.queryParams))
if (this.optType == 'copy') {
param['pageSize'] = 999999
}
listPlanteam(param).then(response => {
this.teamList = response.rows; this.teamList = response.rows;
this.total = response.total this.total = response.total
this.loading = false; this.loading = false;
...@@ -87,11 +91,11 @@ export default { ...@@ -87,11 +91,11 @@ export default {
const data = rows.map(team => { const data = rows.map(team => {
return { return {
...team, ...team,
planId: this.planId, planId: this.optType === 'copy' ? null : this.planId,
planCode: this.form.planCode, planCode: this.form.planCode,
} }
}); });
if(!this.planId) { if(!this.planId || this.optType === 'copy') {
this.teamList.push(...rows) this.teamList.push(...rows)
return return
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment