Commit d11aeedd authored by 仇晓婷's avatar 仇晓婷

工艺bom新增的物料获取

parent 82596033
...@@ -217,6 +217,7 @@ export default { ...@@ -217,6 +217,7 @@ export default {
Id: this.bId, Id: this.bId,
}) })
.then((res) => { .then((res) => {
console.log(res)
if (res.success) { if (res.success) {
this.ids = res.result; this.ids = res.result;
let arr = [...this.data].filter((x) => let arr = [...this.data].filter((x) =>
......
<template> <template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90"> <Form ref="form" :model="entity" :rules="rules" :label-width="120">
<Row> <Row>
<!-- <!--
<Col :span="12"> <Col :span="12">
...@@ -38,10 +38,11 @@ ...@@ -38,10 +38,11 @@
<FormItem :label="l('routingDetailName')" prop="routingDetailId"> <FormItem :label="l('routingDetailName')" prop="routingDetailId">
<Select v-model="entity.routingDetailId"> <Select v-model="entity.routingDetailId">
<Option <Option
v-for="(item,index) in routingDetailList" v-for="(item, index) in routingDetailList"
:value="item.value" :value="item.value"
:key="index" :key="index"
>{{ item.label }}</Option> >{{ item.label }}</Option
>
</Select> </Select>
</FormItem> </FormItem>
</Col> </Col>
...@@ -58,12 +59,31 @@ ...@@ -58,12 +59,31 @@
<Materiel :bomId="productBomId" v-model="entity.materialId" @on-change="change"></Materiel> <Materiel :bomId="productBomId" v-model="entity.materialId" @on-change="change"></Materiel>
</FormItem>--> </FormItem>-->
<FormItem :label="l('nameMaterial')" prop="materialId"> <FormItem :label="l('nameMaterial')" prop="materialId">
<Materiel <Select
v-model="entity.materialId"
placeholder="请选择"
style="width: 300px"
>
<Option
v-for="(item, index) in listData"
:key="index"
:value="item.value"
:label="item.label"
style="display: none"
></Option>
<Tree
key="mytree"
:data="dataTree"
ref="mytree"
:render="renderContent"
></Tree>
</Select>
<!-- <Materiel
v-model="entity.materialId" v-model="entity.materialId"
@on-change="change" @on-change="change"
:codeRuleType="1" :codeRuleType="1"
:setType="true" :setType="true"
></Materiel> ></Materiel> -->
</FormItem> </FormItem>
</Col> </Col>
<!-- <Col :span="8" v-if="false"> <!-- <Col :span="8" v-if="false">
...@@ -73,19 +93,22 @@ ...@@ -73,19 +93,22 @@
</Col>--> </Col>-->
<Col :span="12"> <Col :span="12">
<FormItem :label="l('quantity')" prop="quantity"> <FormItem :label="l('quantity')" prop="quantity">
<InputNumber v-model="entity.quantity" style="width:100%"></InputNumber> <InputNumber
v-model="entity.quantity"
style="width: 100%"
></InputNumber>
</FormItem> </FormItem>
</Col> </Col>
<Divider orientation="left">物料属性</Divider> <Divider orientation="left">物料属性</Divider>
<Row> <Row>
<Col :span="12" v-if="entity.materialId"> <Col :span="12" v-if="entity.materialId">
<FormItem label="名称:"> <FormItem label="名称:">
<span>{{entity.nameMaterial}}</span> <span>{{ entity.nameMaterial }}</span>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="12" v-if="entity.materialId"> <Col :span="12" v-if="entity.materialId">
<FormItem label="编码:"> <FormItem label="编码:">
<span>{{entity.materialNumber}}</span> <span>{{ entity.materialNumber }}</span>
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
...@@ -140,6 +163,8 @@ export default { ...@@ -140,6 +163,8 @@ export default {
data() { data() {
return { return {
forItem: {}, forItem: {},
listData: [],
dataTree: [],
entity: { entity: {
routingHeaderId: null, routingHeaderId: null,
routingDetailId: null, routingDetailId: null,
...@@ -200,11 +225,59 @@ export default { ...@@ -200,11 +225,59 @@ export default {
}, },
mounted() { mounted() {
this.loadDetails(); this.loadDetails();
this.getData();
}, },
methods: { methods: {
// onValue(filed, v) { renderContent(h, { root, node, data }) {
// this.$set(this.entity, filed, v); //渲染树的样式
// }, return h(
"span",
{
style: {
cursor: "pointer",
},
on: {
click: () => {
this.handleSelect(data); //手动选择树节点
},
},
},
data.title
);
},
handleSelect(data) {
console.log(data);
let obj = {
label: data.title,
value: data.materialId,
};
this.listData = [];
this.listData.push(obj);
this.entity.materialId = this.listData[0].value;
this.entity.nameMaterial = this.listData[0].label;
this.entity.nameMaterial = data.name;
this.entity.materialId = data.materialId;
this.entity.materialNumber = data.mmcode;
this.entity.json.nameMaterial = data.name;
this.entity.json.materialNumber = data.mmcode;
Api.getMaterial({ id: data.materialId }).then((r) => {
if (r.result) {
this.forItem = r.result;
}
});
},
getData() {
Api.alltree({ id: this.productBomId }).then((r) => {
if (r.success) {
this.dataTree = r.result;
// this.$Message.success("获取物料成功");
} else {
this.$Message.error("获取物料失败");
}
});
},
handleSubmit() { handleSubmit() {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
...@@ -228,15 +301,17 @@ export default { ...@@ -228,15 +301,17 @@ export default {
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
change(e, v) { // change(e, v) {
this.entity.nameMaterial = e.name; // console.log(e);
this.entity.materialId = e.materialId; // console.log(v);
this.entity.materialNumber = e.mmcode; // this.entity.nameMaterial = e.name;
// this.entity.materialId = e.materialId;
// this.entity.materialNumber = e.mmcode;
this.entity.json.nameMaterial = e.name; // this.entity.json.nameMaterial = e.name;
this.entity.json.materialNumber = e.mmcode; // this.entity.json.materialNumber = e.mmcode;
this.forItem = v; // this.forItem = v;
}, // },
loadDetails() { loadDetails() {
//获取工序列表 //获取工序列表
let parms = { let parms = {
......
...@@ -37,4 +37,10 @@ export default { ...@@ -37,4 +37,10 @@ export default {
materiallist(params){ materiallist(params){
return Api.post(`${material}/material/materiallist`,params); return Api.post(`${material}/material/materiallist`,params);
}, },
alltree(params){
return Api.post(`${technologyUrl}productinfo/alltree`,params); //bom树
},
getMaterial(params){
return Api.get(`${material}/material/get`,params); //bom树
},
} }
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