Commit e8758b38 authored by renjintao's avatar renjintao

mesplan plan

parent 36095936
...@@ -150,9 +150,9 @@ export default { ...@@ -150,9 +150,9 @@ export default {
modalAccessory: false, modalAccessory: false,
columns: [{ columns: [{
key: "selection", key: "selection",
title: "#", title: '多选',
type: "selection", type: "selection",
width: 70, width: 50,
align: "center", align: "center",
}, },
{ {
...@@ -259,13 +259,13 @@ export default { ...@@ -259,13 +259,13 @@ export default {
high: true, high: true,
hide: true, hide: true,
}, },
{ // {
key: "spareQty", // key: "spareQty",
title: this.l("spareQty"), // title: this.l("spareQty"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ {
key: "isPreschedule", key: "isPreschedule",
title: this.l("isPreschedule"), title: this.l("isPreschedule"),
...@@ -274,28 +274,28 @@ export default { ...@@ -274,28 +274,28 @@ export default {
high: true, high: true,
code: "aps.plan.ispreschedule", code: "aps.plan.ispreschedule",
}, },
{ // {
key: "demandStart", // key: "demandStart",
title: this.l("demandStart"), // title: this.l("demandStart"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ // {
key: "demandFinish", // key: "demandFinish",
title: this.l("demandFinish"), // title: this.l("demandFinish"),
align: "left", // align: "left",
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ // {
key: "partNamePro", // key: "partNamePro",
title: this.l("partNamePro"), // title: this.l("partNamePro"),
align: "left", // align: "left",
easy: true, // easy: true,
high: true, // high: true,
hide: true, // hide: true,
}, // },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
......
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
productId: null, //产品id productId: null, //产品id
productName: "", //产品名称 productName: "", //产品名称
drawnNumber: null, //图号 drawnNumber: null, //图号
taskType: null, //任务类型 taskType: 1, //任务类型
quantity: 1, //数量 quantity: 1, //数量
taskRequire: "", //任务接点要求 taskRequire: "", //任务接点要求
demandStartDate: this.getFormatDate(nowDate), //开始时间 demandStartDate: this.getFormatDate(nowDate), //开始时间
...@@ -114,7 +114,7 @@ export default { ...@@ -114,7 +114,7 @@ export default {
remark: "", //备注 remark: "", //备注
projectNumber: "", //项目号 projectNumber: "", //项目号
batchNumber: "", //批次号 batchNumber: "", //批次号
urgencyLevel: null, //紧急程度 urgencyLevel: 1, //紧急程度
bomId: null, bomId: null,
}, },
ruleValidate: { ruleValidate: {
...@@ -147,7 +147,9 @@ export default { ...@@ -147,7 +147,9 @@ export default {
wfstatu: 1, wfstatu: 1,
}; };
}, },
created() {},
mounted() { mounted() {
let params = { let params = {
id: "123327da-42b3-41f6-b785-cf933f137a95", id: "123327da-42b3-41f6-b785-cf933f137a95",
}; };
...@@ -161,8 +163,8 @@ export default { ...@@ -161,8 +163,8 @@ export default {
} }
} }
}); });
this.loadTree(); this.loadTree();
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
...@@ -173,6 +175,7 @@ export default { ...@@ -173,6 +175,7 @@ export default {
.then((r) => { .then((r) => {
if (r.success) { if (r.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
this.resetFields();
this.$emit("on-ok"); this.$emit("on-ok");
} else { } else {
this.$Message.error("保存失败"); this.$Message.error("保存失败");
...@@ -215,10 +218,11 @@ export default { ...@@ -215,10 +218,11 @@ export default {
}, },
resetFields() { resetFields() {
this.orderSearchForm = { this.orderSearchForm = {
productId: null, //产品id productId: null, //产品id
productName: "", //产品名称 productName: "", //产品名称
drawnNumber: null, //图号 drawnNumber: null, //图号
taskType: null, //任务类型 taskType: 1, //任务类型
quantity: 1, //数量 quantity: 1, //数量
taskRequire: "", //任务接点要求 taskRequire: "", //任务接点要求
demandStartDate: this.getFormatDate(nowDate), //开始时间 demandStartDate: this.getFormatDate(nowDate), //开始时间
...@@ -226,7 +230,7 @@ export default { ...@@ -226,7 +230,7 @@ export default {
remark: "", //备注 remark: "", //备注
projectNumber: "", //项目号 projectNumber: "", //项目号
batchNumber: "", //批次号 batchNumber: "", //批次号
urgencyLevel: null, //紧急程度 urgencyLevel: 1, //紧急程度
}; };
}, },
loadTree() { loadTree() {
......
...@@ -163,15 +163,16 @@ export default { ...@@ -163,15 +163,16 @@ export default {
.then((r) => { .then((r) => {
if (r.success) { if (r.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
//this.resetFields()
this.$emit("on-ok"); this.$emit("on-ok");
} else { } else {
this.$Message.error("保存失败"); this.$Message.error("保存失败");
} }
}) })
.catch((err) => { // .catch((err) => {
this.$Message.error("保存失败"); // this.$Message.error("保存失败");
console.warn(err); // console.warn(err);
}); // });
} }
}); });
}, },
......
...@@ -141,6 +141,7 @@ export default { ...@@ -141,6 +141,7 @@ export default {
id: "id", id: "id",
columns: [{ columns: [{
key: "selection", key: "selection",
title: '多选',
type: "selection", type: "selection",
width: 50, width: 50,
align: "center" align: "center"
......
<template> <template>
<div style="width:100%;overflow:auto" :style="{height:divHeight}"> <div style="width:100%;overflow:auto" :style="{height:divHeight}">
<Form <Form :model="orderForm" :label-width="80" class="margin-top-20 margin-bottom-50" :rules="ruleValidate" ref="formValidate">
:model="orderForm" <Row>
:label-width="80" <Col span="12">
class="margin-top-20 margin-bottom-50" <FormItem label="订单编号" style="width:100%">
:rules="ruleValidate" <Input v-model="orderForm.mesCode" disabled style="width:240px" />
ref="formValidate" </FormItem>
> </Col>
<Row> <Col span="12">
<Col span="12"> <FormItem label="产品名称" style="width:100%">
<FormItem label="订单编号" style="width:100%"> <Input v-model="orderForm.productName" disabled style="width:240px" />
<Input v-model="orderForm.mesCode" disabled style="width:240px" /> </FormItem>
</FormItem> </Col>
</Col> </Row>
<Col span="12"> <Row>
<FormItem label="产品名称" style="width:100%"> <Col span="12">
<Input v-model="orderForm.productName" disabled style="width:240px" /> <FormItem label="开始时间" style="width:100%">
</FormItem> <Input v-model="orderForm.planStartTime" disabled style="width:240px" />
</Col> </FormItem>
</Row> </Col>
<Row> <Col span="12">
<Col span="12"> <FormItem label="完成时间" style="width:100%">
<FormItem label="开始时间" style="width:100%"> <Input v-model="orderForm.planEndTime" disabled style="width:240px" />
<Input v-model="orderForm.planStartTime" disabled style="width:240px" /> </FormItem>
</FormItem> </Col>
</Col> </Row>
<Col span="12"> <Row>
<FormItem label="完成时间" style="width:100%"> <Col span="12">
<Input v-model="orderForm.planEndTime" disabled style="width:240px" /> <FormItem label="数量" style="width:100%">
</FormItem> <Input v-model="orderForm.quantity" disabled style="width:240px" />
</Col> </FormItem>
</Row> </Col>
<Row> <Col span="12">
<Col span="12"> <FormItem label="分解数量" style="width:100%" prop="splitQuantity">
<FormItem label="数量" style="width:100%"> <InputNumber :min="0" v-model="orderForm.splitQuantity" style="width:180px"></InputNumber>
<Input v-model="orderForm.quantity" disabled style="width:240px" /> <Button type="primary" @click="addSplitOrder" v-noClick>确定</Button>
</FormItem> </FormItem>
</Col> </Col>
<Col span="12"> </Row>
<FormItem label="分解数量" style="width:100%" prop="splitQuantity">
<InputNumber :min="0" v-model="orderForm.splitQuantity" style="width:180px"></InputNumber>
<Button type="primary" @click="addSplitOrder" v-noClick>确定</Button>
</FormItem>
</Col>
</Row>
</Form> </Form>
<Table :loading="loading" border :columns="columns1" :data="dataList" class="tableCommon"> <Table :loading="loading" border :columns="columns1" :data="dataList" class="tableCommon">
<template slot-scope="{ row, index }" slot="slotPlanQ"> <template slot-scope="{ row, index }" slot="slotPlanQ">
<Input type="text" v-model="row.quantity" @on-change="inputOrderCat(row,index)" /> <Input type="text" v-model="row.quantity" @on-change="inputOrderCat(row,index)" />
</template> </template>
<template slot-scope="{ row, index }" slot="slotTime"> <template slot-scope="{ row, index }" slot="slotTime">
<DatePicker <DatePicker v-model="row.demandDate" type="daterange" placeholder="请选择日期" style="width:240px" :transfer="true" :options="optionsDate" @on-change="inputOrderCat(row,index)"></DatePicker>
v-model="row.demandDate" </template>
type="daterange"
placeholder="请选择日期"
style="width:240px"
:transfer="true"
:options="optionsDate"
@on-change="inputOrderCat(row,index)"
></DatePicker>
</template>
</Table> </Table>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: "split", name: "split",
data() { data() {
return { return {
optionsDate: { optionsDate: {
disabledDate: date => { disabledDate: date => {
let beginDateVal = new Date(this.orderForm.planStartTime); let beginDateVal = new Date(this.orderForm.planStartTime);
let endDateVal = new Date(this.orderForm.planEndTime); let endDateVal = new Date(this.orderForm.planEndTime);
if (beginDateVal) { if (beginDateVal) {
return ( return (
(date && date.valueOf() < beginDateVal.getTime() - 86400000) || (date && date.valueOf() < beginDateVal.getTime() - 86400000) ||
date.valueOf() > endDateVal.getTime() date.valueOf() > endDateVal.getTime()
); );
} }
}
},
divHeight: "260px",
osrOneList: false, //一条数据显示详细
osrMoreList: false, //多条数据只显示列表
loading: false,
orderInfo: {
id: "", //订单id
mesCode: "", //订单编号
productName: "", //产品名称
drawingNo: "", //图号
orderCat: "", //任务类型
quantity: "", //数量
remark: "" //备注
},
orderForm: {
mesCode: "", //订单编号
productName: "", //产品名称
stage: "", //阶段
quantity: "", //数量
planStartTime: "", //计划开始时间
planEndTime: "", //计划结束时间
splitQuantity: 2, //分解数量
splitList: [] //分解后产生的列表
},
columns1: [{
title: "序号",
type: "index",
width: 80,
align: "right",
tooltip: true
},
{
title: "计划编号",
key: "mesCode",
tooltip: true
},
{
title: "计划数量",
key: "quantity",
align: "right",
width: 100,
slot: "slotPlanQ"
},
{
title: "开始--完成时间",
key: "demandDate",
width: 320,
align: "center",
slot: "slotTime"
}
],
dataList: [],
dataListRetrun: {
id: null,
quantity: null,
mesCode: "",
items: []
}, //确定后返回数据
ruleValidate: {
splitQuantity: [{
required: true,
message: "请输入数量",
type: "number",
trigger: "change"
}]
}
};
},
props: {
row: {
type: Object,
default: () => {
return null;
}
} }
}, },
divHeight: "260px", methods: {
osrOneList: false, //一条数据显示详细 intData(data) {
osrMoreList: false, //多条数据只显示列表 //打开modal层时给订单list赋值
loading: false, //alert(JSON.stringify(data))
orderInfo: { this.dataListRetrun.id = data[0].id;
id: "", //订单id this.dataListRetrun.quantity = data[0].quantity;
mesCode: "", //订单编号 this.dataListRetrun.mesCode = data[0].mesCode;
productName: "", //产品名称 this.orderInfo = [];
drawingNo: "", //图号 this.dataList = [];
orderCat: "", //任务类型 this.orderInfo = data[0];
quantity: "", //数量 this.orderForm = {
remark: "" //备注 mesCode: this.orderInfo.mesCode, //订单编号
}, productName: this.orderInfo.productName, //产品名称
orderForm: { stage: this.orderInfo.stage, //阶段
mesCode: "", //订单编号 quantity: this.orderInfo.quantity, //数量
productName: "", //产品名称 planStartTime: this.orderInfo.demandStartDate, //计划开始时间
stage: "", //阶段 planEndTime: this.orderInfo.demandFinishDate, //计划结束时间
quantity: "", //数量 splitQuantity: 2, //分解数量
planStartTime: "", //计划开始时间 splitList: [] //分解后产生的列表
planEndTime: "", //计划结束时间 };
splitQuantity: 2, //分解数量 },
splitList: [] //分解后产生的列表 //确定增加数量
}, addSplitOrder() {
columns1: [
{ if (this.orderForm.splitQuantity < 2 || this.orderForm.splitQuantity == undefined) {
title: "序号", this.dataList = [];
type: "index", return;
width: 80, }
align: "right", if (this.orderForm.quantity >= this.orderForm.splitQuantity) {
tooltip: true this.dataListRetrun.items = [];
this.$refs["formValidate"].validate(valid => {
if (valid) {
this.dataList = [];
let demandDate = [];
let splitQuantity = this.orderForm.splitQuantity;
let mesCodeSon = this.orderForm.mesCode;
let planStartTime = this.orderForm.planStartTime;
let planEndTime = this.orderForm.planEndTime;
for (var i = 0; i < splitQuantity; i++) {
this.dataList.push({
mesCode: i + 1 < 10 ?
mesCodeSon + "0" + (i + 1) : mesCodeSon + "" + (i + 1),
quantity: "",
demandDate: [planStartTime, planEndTime],
demandStartDate: planStartTime,
demandFinishDate: planEndTime
});
}
this.dataListRetrun.items = this.dataListRetrun.items.concat(
this.dataList
);
}
});
} else {
this.$Message.error("分解数量大于订单数量");
}
}, },
{ inputOrderCat(row, index) {
title: "计划编号", let forDemandStartDate = this.getFormatDate(row.demandDate[0]);
key: "mesCode", let forDemandFinishDate = this.getFormatDate(row.demandDate[1]);
tooltip: true this.dataListRetrun.items[index].mesCode = row.mesCode;
this.dataListRetrun.items[index].quantity = row.quantity;
this.dataListRetrun.items[index].demandStartDate = forDemandStartDate;
this.dataListRetrun.items[index].demandFinishDate = forDemandFinishDate;
this.dataList[index].demandDate = [
forDemandStartDate,
forDemandFinishDate
];
}, },
{ getFormatDate(dates) {
title: "计划数量", const d = new Date(dates);
key: "quantity", const resDate =
align: "right", d.getFullYear() +
width: 100, "-" +
slot: "slotPlanQ" this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate());
return resDate;
}, },
{ p(s) {
title: "开始--完成时间", return s < 10 ? "0" + s : s;
key: "demandDate", },
width: 320, returnDataList() {
align: "center", //返回审批数据
slot: "slotTime" return this.dataListRetrun;
} }
],
dataList: [],
dataListRetrun: { id: null, quantity: null, mesCode: "", items: [] }, //确定后返回数据
ruleValidate: {
splitQuantity: [
{
required: true,
message: "请输入数量",
type: "number",
trigger: "change"
}
]
}
};
},
props: {
row: {
type: Object,
default: () => {
return null;
}
}
},
methods: {
intData(data) {
//打开modal层时给订单list赋值
//alert(JSON.stringify(data))
this.dataListRetrun.id = data[0].id;
this.dataListRetrun.quantity = data[0].quantity;
this.dataListRetrun.mesCode = data[0].mesCode;
this.orderInfo = [];
this.dataList = [];
this.orderInfo = data[0];
this.orderForm = {
mesCode: this.orderInfo.mesCode, //订单编号
productName: this.orderInfo.productName, //产品名称
stage: this.orderInfo.stage, //阶段
quantity: this.orderInfo.quantity, //数量
planStartTime: this.orderInfo.demandStartDate, //计划开始时间
planEndTime: this.orderInfo.demandFinishDate, //计划结束时间
splitQuantity: 2, //分解数量
splitList: [] //分解后产生的列表
};
},
//确定增加数量
addSplitOrder() {
if (this.orderForm.splitQuantity < 2||this.orderForm.splitQuantity==undefined) {
this.dataList = [];
return;
}
if (this.orderForm.quantity >= this.orderForm.splitQuantity) {
this.dataListRetrun.items = [];
this.$refs["formValidate"].validate(valid => {
if (valid) {
this.dataList = [];
let demandDate = [];
let splitQuantity = this.orderForm.splitQuantity;
let mesCodeSon = this.orderForm.mesCode;
let planStartTime = this.orderForm.planStartTime;
let planEndTime = this.orderForm.planEndTime;
for (var i = 0; i < splitQuantity; i++) {
this.dataList.push({
mesCode:
i + 1 < 10
? mesCodeSon + "0" + (i + 1)
: mesCodeSon + "" + (i + 1),
quantity: "",
demandDate: [planStartTime, planEndTime],
demandStartDate: planStartTime,
demandFinishDate: planEndTime
});
}
this.dataListRetrun.items = this.dataListRetrun.items.concat(
this.dataList
);
}
});
} else {
this.$Message.error("分解数量大于订单数量");
}
}, },
inputOrderCat(row, index) { created() {
let forDemandStartDate = this.getFormatDate(row.demandDate[0]); var theight = window.innerHeight - 400 + "px";
let forDemandFinishDate = this.getFormatDate(row.demandDate[1]); this.divHeight = theight;
this.dataListRetrun.items[index].mesCode = row.mesCode;
this.dataListRetrun.items[index].quantity = row.quantity;
this.dataListRetrun.items[index].demandStartDate = forDemandStartDate;
this.dataListRetrun.items[index].demandFinishDate = forDemandFinishDate;
this.dataList[index].demandDate = [
forDemandStartDate,
forDemandFinishDate
];
}, },
getFormatDate(dates) { mounted() {
const d = new Date(dates); window.onresize = () => {
const resDate = ///浏览器窗口大小变化
d.getFullYear() + return (() => {
"-" + window.screenHeight = window.innerHeight;
this.p(d.getMonth() + 1) + this.divHeight = window.screenHeight - 400 + "px";
"-" + })();
this.p(d.getDate()); };
return resDate; this.orderForm = {
mesCode: this.orderInfo.mesCode, //订单编号
productName: "", //产品名称
stage: "", //阶段
quantity: "", //数量
planStartTime: "", //计划开始时间
planEndTime: "", //计划结束时间
splitQuantity: 2, //分解数量
splitList: [] //分解后产生的列表
};
this.dataList = []
}, },
p(s) { watch: {
return s < 10 ? "0" + s : s; row(v) {
}, if (v != null) {
returnDataList() { this.orderForm = this.$u.clone(this.row);
//返回审批数据 this.orderForm.planStartTime = this.orderForm.demandStartDate;
return this.dataListRetrun; this.orderForm.planEndTime = this.orderForm.demandFinishDate;
} //this.orderForm.splitQuantity = 2;
}, this.dataListRetrun.id = this.orderForm.id;
created() { this.dataListRetrun.quantity = this.orderForm.quantity;
var theight = window.innerHeight - 400 + "px"; this.dataListRetrun.mesCode = this.orderForm.mesCode;
this.divHeight = theight; this.dataList = []
}, }
mounted() { }
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.divHeight = window.screenHeight - 400 + "px";
})();
};
this.orderForm = {
mesCode: this.orderInfo.mesCode, //订单编号
productName: "", //产品名称
stage: "", //阶段
quantity: "", //数量
planStartTime: "", //计划开始时间
planEndTime: "", //计划结束时间
splitQuantity: 2, //分解数量
splitList: [] //分解后产生的列表
};
},
watch: {
row(v) {
if (v != null) {
this.orderForm = this.$u.clone(this.row);
this.orderForm.planStartTime = this.orderForm.demandStartDate;
this.orderForm.planEndTime = this.orderForm.demandFinishDate;
//this.orderForm.splitQuantity = 2;
this.dataListRetrun.id = this.orderForm.id;
this.dataListRetrun.quantity = this.orderForm.quantity;
this.dataListRetrun.mesCode = this.orderForm.mesCode;
}
} }
}
}; };
</script> </script>
\ No newline at end of file
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