Commit aa47556c authored by renjintao's avatar renjintao

mesplan

parent af48d377
......@@ -52,7 +52,7 @@
</FormItem>
</Col>
<Col span="8">
<FormItem label="紧急程度" style="width:100%">
<FormItem label="紧急程度" style="width:100%" prop="urgencyLevel">
<dictionary style="width:240px" code="plan.order.urgencyLevel" v-model="orderSearchForm.urgencyLevel"></dictionary>
</FormItem>
</Col>
......@@ -136,6 +136,12 @@ export default {
type: "number",
trigger: "change",
}, ],
urgencyLevel: [{
required: true,
message: "请选择紧急程度",
trigger: "change",
type: "number",
}, ],
},
wfstatu: 1,
......
<template>
<Form :model="orderSearchForm" :label-width="95" :rules="ruleValidate" ref="formValidate">
<Form :model="orderSearchForm" :label-width="95" :rules="ruleValidate" ref="formValidate">
<Row>
<Col span="8">
<Col span="8">
<FormItem label="订单编号" style="width:100%">{{this.orderSearchForm.mesCode}}</FormItem>
</Col>
<Col span="8">
</Col>
<Col span="8">
<FormItem :label="l('productName')" style="width:100%" prop="productId">
<Select
v-model="orderSearchForm.productId"
:placeholder="placeholdeinfo"
style="width:240px;"
>
<Option
v-for="(item,index) in list"
:key="index"
:value="item.value"
style="display:none"
:label="item.label"
></Option>
<Tree key="mytree" :data="data1" ref="mytree" :render="renderContent"></Tree>
</Select>
<Select v-model="orderSearchForm.productId" :placeholder="placeholdeinfo" style="width:240px;">
<Option v-for="(item,index) in list" :key="index" :value="item.value" style="display:none" :label="item.label"></Option>
<Tree key="mytree" :data="data1" ref="mytree" :render="renderContent"></Tree>
</Select>
</FormItem>
</Col>
<Col span="8">
</Col>
<Col span="8">
<FormItem :label="l('drawnNumber')" style="width:100%">
<Input v-model="orderSearchForm.drawnNumber" style="width:240px" disabled />
<Input v-model="orderSearchForm.productName" style="width:240px" v-show="false" />
<Input v-model="orderSearchForm.bomId" style="width:240px" v-show="false" />
<Input v-model="orderSearchForm.drawnNumber" style="width:240px" disabled />
<Input v-model="orderSearchForm.productName" style="width:240px" v-show="false" />
<Input v-model="orderSearchForm.bomId" style="width:240px" v-show="false" />
</FormItem>
</Col>
</Col>
</Row>
<Row>
<Col span="8">
<Col span="8">
<FormItem :label="l('taskType')" style="width:100%" prop="taskType">
<dictionary
code="plan.order.taskType"
v-model="orderSearchForm.taskType"
style="width:240px"
></dictionary>
<dictionary code="plan.order.taskType" v-model="orderSearchForm.taskType" style="width:240px"></dictionary>
</FormItem>
</Col>
<Col span="8">
</Col>
<Col span="8">
<FormItem :label="l('quantity')" style="width:100%" prop="quantity">
<InputNumber :min="0" v-model="orderSearchForm.quantity" style="width:240px"></InputNumber>
<InputNumber :min="0" v-model="orderSearchForm.quantity" style="width:240px"></InputNumber>
</FormItem>
</Col>
<Col span="8">
</Col>
<Col span="8">
<FormItem :label="l('demandStartDate')" style="width:100%">
<DatePicker
type="date"
placeholder="请选择日期"
style="width:240px"
@on-change="getStartDate"
v-model="orderSearchForm.demandStartDate"
></DatePicker>
<DatePicker type="date" placeholder="请选择日期" style="width:240px" @on-change="getStartDate" v-model="orderSearchForm.demandStartDate"></DatePicker>
</FormItem>
</Col>
</Col>
</Row>
<Row>
<Col span="8">
<Col span="8">
<FormItem :label="l('demandFinishDate')" style="width:100%">
<DatePicker
type="date"
placeholder="请选择日期"
style="width:240px"
@on-change="getFinishedDate"
v-model="orderSearchForm.demandFinishDate"
></DatePicker>
<DatePicker type="date" placeholder="请选择日期" style="width:240px" @on-change="getFinishedDate" v-model="orderSearchForm.demandFinishDate"></DatePicker>
</FormItem>
</Col>
</Col>
<Col span="8">
<Col span="8">
<FormItem :label="l('projectNumber')" style="width:100%">
<Input v-model="orderSearchForm.projectNumber" style="width:240px" />
<Input v-model="orderSearchForm.projectNumber" style="width:240px" />
</FormItem>
</Col>
<Col span="8">
</Col>
<Col span="8">
<FormItem :label="l('batchNumber')" label="批次号" style="width:100%">
<Input v-model="orderSearchForm.batchNumber" style="width:240px" />
<Input v-model="orderSearchForm.batchNumber" style="width:240px" />
</FormItem>
</Col>
</Col>
</Row>
<Row>
<Col span="8">
<FormItem :label="l('urgencyLevel')" style="width:100%">
<dictionary
style="width:240px"
code="plan.order.urgencyLevel"
v-model="orderSearchForm.urgencyLevel"
></dictionary>
<Col span="8">
<FormItem :label="l('urgencyLevel')" style="width:100%" prop="urgencyLevel">
<dictionary style="width:240px" code="plan.order.urgencyLevel" v-model="orderSearchForm.urgencyLevel"></dictionary>
</FormItem>
</Col>
<Col span="24">
</Col>
<Col span="24">
<FormItem :label="l('taskRequire')" style="width:100%">
<Input v-model="orderSearchForm.taskRequire" placeholder />
<Input v-model="orderSearchForm.taskRequire" placeholder />
</FormItem>
</Col>
</Col>
</Row>
<Row>
<Col span="24">
<Col span="24">
<FormItem :label="l('remark')" style="width:100%">
<Input v-model="orderSearchForm.remark" placeholder type="textarea" :rows="3" />
<Input v-model="orderSearchForm.remark" placeholder type="textarea" :rows="3" />
</FormItem>
</Col>
<Col span="24">
</Col>
<Col span="24">
<FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Col>
</Col>
</Row>
</Form>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
orderSearchForm: {},
ruleValidate: {
productId: [
{
required: true,
message: "请选择产品名称",
type: "number",
trigger: "change",
},
],
taskType: [
{
required: true,
message: "请选择任务类型",
trigger: "change",
type: "number",
},
],
quantity: [
{
required: true,
message: "请输入数量",
type: "number",
trigger: "change",
},
],
},
placeholdeinfo: "",
list: [],
data1: [],
wfstatu: 1,
};
},
props: {
row: {
type: Object,
default: () => {
return null;
},
},
},
mounted() {
let params = {
id: "123327da-42b3-41f6-b785-cf933f137a95",
};
this.$api.get(`${workflowUrl}/schema/getbyid`, params).then((res) => {
if (res.success) {
let wfStatus = res.result.status;
if (wfStatus == 0) {
this.wfstatu = 1;
} else {
this.wfstatu = 3;
}
}
});
this.loadTree();
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleSubmit() {
this.$refs.formValidate.validate((v) => {
if (v) {
this.orderSearchForm.status = this.wfstatu;
Api.mesorderupdate(this.orderSearchForm)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "mes_plan" + "." + key;
return this.$t(key);
},
handleSelect(data) {
this.placeholdeinfo = "";
if (data.length > 0) {
this.selectdata = [];
this.selectdata = data;
this.list = [];
this.list.push({ label: data[0].title, value: data[0].id });
if (data[0].isProduct == "1") {
this.orderSearchForm.productName = data[0].title;
this.orderSearchForm.productId = data[0].productId;
this.orderSearchForm.drawnNumber = data[0].drawingNo;
this.orderSearchForm.bomId = data[0].bomId;
} else {
this.$Message.error("此节点不是产品,请选择产品节点!");
}
}
},
resetFields() {
this.orderSearchForm = {
productId: null, //产品id
productName: "", //产品名称
drawnNumber: null, //图号
taskType: null, //任务类型
quantity: 1, //数量
taskRequire: "", //任务接点要求
demandStartDate: this.getFormatDate(nowDate), //开始时间
demandFinishDate: this.getFormatDateEnd(tomorrowDate), //完成时间
remark: "", //备注
projectNumber: "", //项目号
batchNumber: "", //批次号
urgencyLevel: null, //紧急程度
bomId: "",
};
},
loadTree() {
//打开新增订单窗口加载产品
//this.resetFields();
var sumData = [];
this.$http.order.getallselecttree().then((res) => {
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = sumData;
} else {
this.$Message.error("加载产品树失败!");
}
});
name: "Edit",
data() {
return {
orderSearchForm: {},
ruleValidate: {
productId: [{
required: true,
message: "请选择产品名称",
type: "number",
trigger: "change",
}, ],
taskType: [{
required: true,
message: "请选择任务类型",
trigger: "change",
type: "number",
}, ],
quantity: [{
required: true,
message: "请输入数量",
type: "number",
trigger: "change",
}, ],
urgencyLevel: [{
required: true,
message: "请选择紧急程度",
trigger: "change",
type: "number",
}, ],
},
placeholdeinfo: "",
list: [],
data1: [],
wfstatu: 1,
};
},
renderContent(h, { root, node, data }) {
let type = "md-folder";
let title = data.title;
if (data.isProduct != 0) {
let version = this.$store.getters.dictionaryByCode(
"material.main.version",
data.version
);
type = "ios-image";
if (version) {
title = data.title + "(" + data.mmcode + "/" + version.name + ")";
} else {
title = data.title + "(" + data.mmcode + ")";
}
}
return h(
"span",
{
on: {
click: () => {
let arrTree = [];
arrTree.push(data);
this.handleSelect(arrTree); //手动选择树节点
props: {
row: {
type: Object,
default: () => {
return null;
},
},
},
[
h("Icon", {
props: {
type: type,
},
style: {
marginRight: "8px",
},
}),
h(
"span",
{
style: {
color: data.isProduct == 0 ? "#000" : "rgba(38, 128, 235, 1)",
},
},
title
),
]
);
},
//时间相关start
getStartDate(value) {
if (value == "") {
this.orderSearchForm.demandStartDate = this.getFormatDate(nowDate);
} else {
this.orderSearchForm.demandStartDate = this.getFormatDate(value);
}
},
getFinishedDate(value) {
if (value == "") {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(
tomorrowDate
);
} else {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(value);
}
},
getFormatDate(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
getFormatDateEnd(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 23:59:59";
return resDate;
mounted() {
let params = {
id: "123327da-42b3-41f6-b785-cf933f137a95",
};
this.$api.get(`${workflowUrl}/schema/getbyid`, params).then((res) => {
if (res.success) {
let wfStatus = res.result.status;
if (wfStatus == 0) {
this.wfstatu = 1;
} else {
this.wfstatu = 3;
}
}
});
this.loadTree();
},
p(s) {
return s < 10 ? "0" + s : s;
methods: {
load(v) {
Api.get({
id: v
}).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleSubmit() {
this.$refs.formValidate.validate((v) => {
if (v) {
this.orderSearchForm.status = this.wfstatu;
Api.mesorderupdate(this.orderSearchForm)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "mes_plan" + "." + key;
return this.$t(key);
},
handleSelect(data) {
this.placeholdeinfo = "";
if (data.length > 0) {
this.selectdata = [];
this.selectdata = data;
this.list = [];
this.list.push({
label: data[0].title,
value: data[0].id
});
if (data[0].isProduct == "1") {
this.orderSearchForm.productName = data[0].title;
this.orderSearchForm.productId = data[0].productId;
this.orderSearchForm.drawnNumber = data[0].drawingNo;
this.orderSearchForm.bomId = data[0].bomId;
} else {
this.$Message.error("此节点不是产品,请选择产品节点!");
}
}
},
resetFields() {
this.orderSearchForm = {
productId: null, //产品id
productName: "", //产品名称
drawnNumber: null, //图号
taskType: null, //任务类型
quantity: 1, //数量
taskRequire: "", //任务接点要求
demandStartDate: this.getFormatDate(nowDate), //开始时间
demandFinishDate: this.getFormatDateEnd(tomorrowDate), //完成时间
remark: "", //备注
projectNumber: "", //项目号
batchNumber: "", //批次号
urgencyLevel: null, //紧急程度
bomId: "",
};
},
loadTree() {
//打开新增订单窗口加载产品
//this.resetFields();
var sumData = [];
this.$http.order.getallselecttree().then((res) => {
if (res.result) {
for (var i = 0; i < res.result.length; i++) {
sumData = sumData.concat(res.result[i]);
}
this.data1 = sumData;
} else {
this.$Message.error("加载产品树失败!");
}
});
},
renderContent(h, {
root,
node,
data
}) {
let type = "md-folder";
let title = data.title;
if (data.isProduct != 0) {
let version = this.$store.getters.dictionaryByCode(
"material.main.version",
data.version
);
type = "ios-image";
if (version) {
title = data.title + "(" + data.mmcode + "/" + version.name + ")";
} else {
title = data.title + "(" + data.mmcode + ")";
}
}
return h(
"span", {
on: {
click: () => {
let arrTree = [];
arrTree.push(data);
this.handleSelect(arrTree); //手动选择树节点
},
},
},
[
h("Icon", {
props: {
type: type,
},
style: {
marginRight: "8px",
},
}),
h(
"span", {
style: {
color: data.isProduct == 0 ? "#000" : "rgba(38, 128, 235, 1)",
},
},
title
),
]
);
},
//时间相关start
getStartDate(value) {
if (value == "") {
this.orderSearchForm.demandStartDate = this.getFormatDate(nowDate);
} else {
this.orderSearchForm.demandStartDate = this.getFormatDate(value);
}
},
getFinishedDate(value) {
if (value == "") {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(
tomorrowDate
);
} else {
this.orderSearchForm.demandFinishDate = this.getFormatDateEnd(value);
}
},
getFormatDate(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
getFormatDateEnd(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 23:59:59";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
},
//时间相关end
},
//时间相关end
},
watch: {
row(v) {
if (v != null) {
this.orderSearchForm = this.$u.clone(this.row);
//this.placeholdeinfo = this.orderSearchForm.productName;
this.list = [];
this.list.push({
label: this.orderSearchForm.productName,
value: this.orderSearchForm.productId,
});
}
watch: {
row(v) {
if (v != null) {
this.orderSearchForm = this.$u.clone(this.row);
//this.placeholdeinfo = this.orderSearchForm.productName;
this.list = [];
this.list.push({
label: this.orderSearchForm.productName,
value: this.orderSearchForm.productId,
});
}
},
},
},
};
</script>
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