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

排班计划

parent 1093605f
......@@ -60,6 +60,16 @@
v-hasPermi="['mes:cal:calplan:add']"
>新增</el-button>
</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-button
type="danger"
......@@ -253,7 +263,7 @@
<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="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>
</div>
</el-dialog>
......@@ -264,6 +274,7 @@
import { listCalplan, getCalplan, delCalplan, addCalplan, updateCalplan, finishCalplan } from "@/api/mes/cal/calplan";
import Shift from "./shift";
import Team from "./team";
import dayjs from 'dayjs'
import {genCode} from "@/api/system/autocode/rule"
export default {
name: "Calplan",
......@@ -411,11 +422,27 @@ export default {
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() {
console.log('this.form', this.form)
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planId != null) {
if (this.form.planId != null && this.optType !== "copy") {
let params = Object.assign({}, this.form)
params.calShifts = this.$refs.shiftTab.shiftList
params.calWorkunits = this.$refs.teamTab.teamList
......
......@@ -22,7 +22,7 @@
</el-table-column>
</el-table>
<pagination
v-show="total>0&&planId"
v-show="total>0&&planId&&optType != 'copy'"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
......@@ -71,7 +71,11 @@ export default {
return
}
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.total = response.total
this.loading = false;
......@@ -87,11 +91,11 @@ export default {
const data = rows.map(team => {
return {
...team,
planId: this.planId,
planId: this.optType === 'copy' ? null : this.planId,
planCode: this.form.planCode,
}
});
if(!this.planId) {
if(!this.planId || this.optType === 'copy') {
this.teamList.push(...rows)
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