This commit is contained in:
shilixia 2021-11-10 09:56:08 +08:00
parent 91d82a7882
commit 4950bcd2f9
1 changed files with 210 additions and 159 deletions

View File

@ -107,48 +107,50 @@
>{{ item.name }}</el-button >{{ item.name }}</el-button
> >
</el-card> </el-card>
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>半成品</span> <span>半成品</span>
</div> </div>
<el-table <el-table
:data="wproductData" :data="wproductData"
@selection-change="handleSelectionChange" @selection-change="handleSelectionChange"
border border
fit fit
stripe stripe
style="width: 100%" style="width: 100%"
max-height="300" max-height="300"
> >
<el-table-column <el-table-column type="selection" width="55"> </el-table-column>
type="selection" <el-table-column type="index" width="50" />
width="55">
</el-table-column> <el-table-column label="半成品编号">
<el-table-column type="index" width="50" /> <template slot-scope="scope">{{ scope.row.number }}</template>
</el-table-column>
<el-table-column label="半成品编号"> <el-table-column label="半成品状态">
<template slot-scope="scope">{{ scope.row.number }}</template> <template slot-scope="scope">{{
</el-table-column> scope.row.m_state_.name
}}</template>
<el-table-column label="半成品状态"> </el-table-column>
<template slot-scope="scope">{{ scope.row.m_state_.name }}</template>
</el-table-column> <el-table-column label="所在子工序">
<template slot-scope="scope">{{
<el-table-column label="所在子工序"> scope.row.p_state_.name
<template slot-scope="scope">{{ scope.row.p_state_.name }}</template> }}</template>
</el-table-column> </el-table-column>
<el-table-column label="所在子工序执行状态"> <el-table-column label="所在子工序执行状态">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.is_executed" >已执行</el-tag> <el-tag v-if="scope.row.is_executed">已执行</el-tag>
<el-tag v-else >待执行</el-tag> <el-tag v-else>待执行</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="更新时间"> <el-table-column label="更新时间">
<template slot-scope="scope">{{ scope.row.update_time }}</template> <template slot-scope="scope">{{
</el-table-column> scope.row.update_time
</el-table> }}</template>
</el-table-column>
</el-table>
</el-card> </el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -308,55 +310,100 @@
> >
</el-step> </el-step>
</el-steps> </el-steps>
<el-row :gutter="24">
<el-col :span="12">
<el-card class="box-card" v-if="values === 0">
<div slot="header" class="clearfix">
<span>消耗物料表</span>
</div>
<el-table :data="input" border style="width: 100%">
<el-table-column
prop="material__name"
label="物料名称"
width="180"
>
</el-table-column>
<el-table-column
prop="material__batch"
label="物料批次"
width="180"
>
</el-table-column>
<el-table-column prop="count" label="可用数量" width="180">
</el-table-column>
<el-table-column prop="count_input" label="使用数量" width="180">
<template slot-scope="scope">
<el-form :model="scope.row">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.count_input"
:min="0"
:value="0"
></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
<el-col :span="12">
<el-card class="box-card" v-if="values === 0">
<div slot="header" class="clearfix">
<span>产出物料表</span>
</div>
<el-table
:data="output"
v-if="showPrise"
border
style="width: 100%"
>
<el-table-column
prop="material__name"
label="物料名称"
width="180"
>
</el-table-column>
<el-table-column prop="count_output" label="产出数量" width="180">
<template slot-scope="scope">
<el-form :model="scope.row">
<el-form-item size="mini">
<el-input-number
v-model="scope.row.count_output"
:min="0"
:value="0"
></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
</el-table>
</el-card>
</el-col>
</el-row>
<el-card class="box-card" v-if="values === 0"> <el-card class="box-card" v-if="values === 0">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>消耗物料表</span> <span>备注</span>
</div> </div>
<el-table :data="input" border style="width: 100%"> <el-form ref="form" label-width="80px">
<el-form-item label="操作备注">
<el-input v-model="remark" width="300"></el-input>
<el-table-column prop="material__name" label="物料名称" width="180">
</el-table-column>
<el-table-column prop="material__batch" label="物料批次" width="180">
</el-table-column>
<el-table-column prop="count" label="可用数量" width="180">
</el-table-column>
<el-table-column prop="count_input" label="使用数量" width="180">
<template slot-scope="scope" >
<el-form :model="scope.row">
<el-form-item size="mini">
<el-input-number v-model="scope.row.count_input" :min="0" :value="0"></el-input-number>
</el-form-item> </el-form-item>
</el-form> </el-form>
</template>
</el-table-column>
</el-table>
</el-card> </el-card>
<el-card class="box-card" v-if="values === 0"> <el-card
<div slot="header" class="clearfix"> class="box-card"
<span>产出物料表</span> v-for="(itemf, $index) in otherforms"
</div> :key="$index"
<el-table :data="output" border style="width: 100%"> >
<el-form
<el-table-column prop="material__name" label="物料名称" width="180"> label-width="80px"
</el-table-column> label-position="right"
v-if="values === $index + 1"
<el-table-column prop="count_output" label="产出数量" width="180"> >
<template slot-scope="scope" > <el-row v-for="(item, $index) in itemf.form_fields" :key="$index">
<el-form :model="scope.row">
<el-form-item size="mini">
<el-input-number v-model="scope.row.count_output" :min="0" :value="0"></el-input-number>
</el-form-item>
</el-form>
</template>
</el-table-column>
</el-table>
</el-card>
<el-card class="box-card" v-for="(itemf,$index) in otherforms" :key="$index" >
<el-form label-width="80px" label-position="right" v-if="values === $index+1">
<el-row v-for="(item, $index) in itemf.form_fields" :key="$index">
<el-form-item <el-form-item
v-if="item.field_type === 'string'" v-if="item.field_type === 'string'"
:label="item.field_name" :label="item.field_name"
@ -447,9 +494,9 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-row> </el-row>
</el-form> </el-form>
</el-card> </el-card>
<el-button <el-button
style="margin-top: 12px" style="margin-top: 12px"
@click="next" @click="next"
@ -475,7 +522,12 @@
import { getsubproductionplanList, createPick_need } from "@/api/pm"; import { getsubproductionplanList, createPick_need } from "@/api/pm";
import checkPermission from "@/utils/permission"; import checkPermission from "@/utils/permission";
import { getProcessList } from "@/api/mtm"; import { getProcessList } from "@/api/mtm";
import { createPick, getwmaterialList,submitWork,getwproductList} from "@/api/wpm"; import {
createPick,
getwmaterialList,
submitWork,
getwproductList,
} from "@/api/wpm";
import { getWarehouseList } from "@/api/inm"; import { getWarehouseList } from "@/api/inm";
import { createWork } from "@/api/wpm"; import { createWork } from "@/api/wpm";
import Pagination from "@/components/Pagination"; // secondary package based on el-pagination import Pagination from "@/components/Pagination"; // secondary package based on el-pagination
@ -494,11 +546,13 @@ export default {
page: 1, page: 1,
page_size: 20, page_size: 20,
}, },
remark: "",
values: 0, values: 0,
active: 0, active: 0,
activeName: "1", activeName: "1",
havewl: "", havewl: "",
needwl: "", needwl: "",
showPrise: false,
state_: { state_: {
0: "制定中", 0: "制定中",
1: "已下达", 1: "已下达",
@ -518,26 +572,26 @@ export default {
picks: [], picks: [],
pickData: {}, pickData: {},
steps: [], steps: [],
step:null, step: null,
processOption:"", processOption: "",
subproduction_plan: "", subproduction_plan: "",
form1: [], form1: [],
form2: [], form2: [],
form3: [], form3: [],
input: [], input: [],
output: [], output: [],
forms:[], forms: [],
inputData:[], inputData: [],
outputData:[], outputData: [],
field1:[], field1: [],
field2:[], field2: [],
fromData:[], fromData: [],
wproductData:"", wproductData: "",
wpID:[], wpID: [],
multipleSelection: [], multipleSelection: [],
wproducts:[], wproducts: [],
otherforms:[], otherforms: [],
from:[], from: [],
}; };
}, },
process: "", process: "",
@ -549,7 +603,7 @@ export default {
}, },
methods: { methods: {
checkPermission, checkPermission,
//选项卡切换 //选项卡切换
handleClick(tab) { handleClick(tab) {
this.process = tab.name; this.process = tab.name;
@ -639,7 +693,7 @@ export default {
this.pickData.warehouse = this.need.warehouse; this.pickData.warehouse = this.need.warehouse;
this.pickData.picks = this.picks; this.pickData.picks = this.picks;
// console.log(this.pickData); // console.log(this.pickData);
createPick(this.pickData).then((res) => { createPick(this.pickData).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
@ -654,95 +708,92 @@ export default {
next() { next() {
if (this.values++ > this.forms.length) this.values = 0; if (this.values++ > this.forms.length) this.values = 0;
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
let _this = this; let _this = this;
_this.wpID = []; _this.wpID = [];
val.forEach((item) => { val.forEach((item) => {
_this.wpID.push(item.id); _this.wpID.push(item.id);
}); });
},
},
//车间操作 //车间操作
handlework(item) { handlework(item) {
this.step = item.id;
this.step=item.id; // console.log(this.wpID);
// console.log(this.wpID);
createWork({ createWork({
step: item.id, step: item.id,
wproducts:this.wpID, wproducts: this.wpID,
subproduction_plan: this.subproduction_plan, subproduction_plan: this.subproduction_plan,
}).then((res) => { }).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.dialogVisiblework = true; this.dialogVisiblework = true;
this.forms=res.data.forms; this.forms = res.data.forms;
this.otherforms=res.data.forms.slice(0);//渲染生产表 this.otherforms = res.data.forms.slice(0); //渲染生产表
this.otherforms.shift(); this.otherforms.shift();
//console.log(this.otherforms) //console.log(this.otherforms)
this.input = res.data.forms[0].input; //消耗 this.input = res.data.forms[0].input; //消耗
this.output = res.data.forms[0].output; //产出 if (
this.wproducts=res.data.forms[0].wproducts; res.data.forms[0].output !== undefined &&
res.data.forms[0].output.length > 0
) {
this.output = res.data.forms[0].output; //产出
this.showPrise = true;
}
this.wproducts = res.data.forms[0].wproducts;
} }
}); });
}, },
//提交 //提交
submint(){ submint() {
this.form = []; this.form = [];
this.otherforms.forEach((item) => { this.otherforms.forEach((item) => {
let _this = this; let _this = this;
_this.field1 = []; _this.field1 = [];
item.form_fields.forEach((items) => { item.form_fields.forEach((items) => {
_this.field1.push({ _this.field1.push({
form_field:items.id, form_field: items.id,
field_value:items.sort field_value: items.sort,
});
});
}) this.form.push({
form: item.id,
}) record_data: _this.field1,
});
this.form.push({
form:item.id,
record_data:_this.field1
})
}); });
console.log(this.remark);
console.log( this.form); submitWork({
step: this.step,
subproduction_plan: this.subproduction_plan,
submitWork({ wproducts: this.wproducts,
step:this.step, input: this.input,
subproduction_plan:this.subproduction_plan,
wproducts:this.wproducts,
input: this.input,
output: this.output, output: this.output,
forms: this.from forms: this.from,
remark: this.remark,
}).then((res) => { }).then((res) => {
if (res.code >= 200) { if (res.code >= 200) {
this.dialogVisiblework = false; this.dialogVisiblework = false;
this.$message.success("成功!"); this.$message.success("成功!");
this.getwproductLists(); this.getwproductLists();
} }
}); });
}, },
//大工序下子工序产出的半成品 //大工序下子工序产出的半成品
getwproductLists(){ getwproductLists() {
getwproductList({page:0, subproduction_plan:this.subproduction_plan, p_state__process:this.process}).then((response) => { getwproductList({
page: 0,
subproduction_plan: this.subproduction_plan,
p_state__process: this.process,
}).then((response) => {
if (response.data) { if (response.data) {
this.wproductData = response.data; this.wproductData = response.data;
//console.log( this.wproductData) //console.log( this.wproductData)
} }
}); });
} },
}, },
}; };
</script> </script>