feat:route中添加辅料
This commit is contained in:
parent
295ed27bac
commit
1fb2942e44
|
@ -162,12 +162,60 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row v-if="project_code=='bxerp'&&mode=='edit'">
|
||||
<sc-form-table
|
||||
hideDelete
|
||||
ref="routematTable"
|
||||
:tableHeight="300"
|
||||
v-model="routemats"
|
||||
:addTemplate="addTemplate"
|
||||
placeholder="暂无数据"
|
||||
>
|
||||
<el-table-column prop="number" label="辅料编号">
|
||||
<template #default="scope">
|
||||
<el-select
|
||||
v-model="scope.row.material"
|
||||
placeholder="辅料编号"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in materialOptions"
|
||||
:key="item.id"
|
||||
:label="item.full_name"
|
||||
:value="item.id"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="open" label="操作" width="125" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
text
|
||||
v-if="scope.row.id==''"
|
||||
type="primary"
|
||||
size="small"
|
||||
@click="formTableSave(scope.row)"
|
||||
>保存</el-button
|
||||
>
|
||||
<el-button
|
||||
text
|
||||
v-else
|
||||
type="danger"
|
||||
size="small"
|
||||
@click="formTableDel(scope.row)"
|
||||
>删除</el-button
|
||||
>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</sc-form-table>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-main>
|
||||
<el-footer>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit"
|
||||
>提交</el-button
|
||||
>
|
||||
<el-button type="primary" :loading="isSaveing" @click="submit">提交</el-button>
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
</el-footer>
|
||||
</el-container>
|
||||
|
@ -182,9 +230,9 @@ const defaultForm = {
|
|||
material_in:'',
|
||||
material_out:'',
|
||||
hour_work:0,
|
||||
div_number:1,
|
||||
batch_bind: true,
|
||||
is_autotask: true,
|
||||
// is_count_utask: false,
|
||||
};
|
||||
export default {
|
||||
props: {
|
||||
|
@ -209,9 +257,18 @@ export default {
|
|||
materialsOut: [],
|
||||
mgroups: [],
|
||||
options: [],
|
||||
routemats:[],
|
||||
materialOptions:[],
|
||||
titleMap: { add: "新增", edit: "编辑" },
|
||||
setFiltersVisible: false,
|
||||
routeId: "",
|
||||
project_code: "",
|
||||
addTemplate:{
|
||||
id:'',
|
||||
material:'',
|
||||
route:'',
|
||||
|
||||
}
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
@ -219,6 +276,7 @@ export default {
|
|||
this.getProcess();
|
||||
this.getMaterialIn();
|
||||
this.getMaterialOut();
|
||||
this.getMaterialOptions();
|
||||
this.project_code = this.$TOOL.data.get("BASE_INFO").base.base_code;
|
||||
this.form.routepack = this.routepack;
|
||||
},
|
||||
|
@ -228,24 +286,30 @@ export default {
|
|||
},
|
||||
getMgroup() {
|
||||
let that = this;
|
||||
this.$API.mtm.mgroup.list.req({ page: 0 }).then((res) => {
|
||||
this.mgroups = res;
|
||||
that.$API.mtm.mgroup.list.req({ page: 0 }).then((res) => {
|
||||
that.mgroups = res;
|
||||
});
|
||||
},
|
||||
getMaterialOptions() {
|
||||
let that = this;
|
||||
that.$API.mtm.material.list.req({ page: 0, type__in: "20,30"}).then((res) => {
|
||||
that.materialOptions = res;
|
||||
});
|
||||
},
|
||||
getMaterialIn() {
|
||||
let that = this;
|
||||
this.$API.mtm.material.list
|
||||
that.$API.mtm.material.list
|
||||
.req({ page: 0, type__in: "10,20,30" })
|
||||
.then((res) => {
|
||||
this.materialsIn = res;
|
||||
that.materialsIn = res;
|
||||
});
|
||||
},
|
||||
getMaterialOut() {
|
||||
let that = this;
|
||||
this.$API.mtm.material.list
|
||||
that.$API.mtm.material.list
|
||||
.req({ page: 0, type__in: "10,20" })
|
||||
.then((res) => {
|
||||
this.materialsOut = res;
|
||||
that.materialsOut = res;
|
||||
});
|
||||
},
|
||||
getProcess() {
|
||||
|
@ -254,6 +318,32 @@ export default {
|
|||
that.options = res;
|
||||
});
|
||||
},
|
||||
getroutemats(){
|
||||
let that = this;
|
||||
that.$API.mtm.routemat.list.req({ route: that.routeId,page: 0}).then((res) => {
|
||||
that.routemats = res;
|
||||
});
|
||||
},
|
||||
formTableSave(row){
|
||||
let that = this;
|
||||
that.$API.mtm.routemat.create.req(row).then((res) => {
|
||||
that.getroutemats();
|
||||
});
|
||||
},
|
||||
formTableDel(row){
|
||||
this.$confirm(`确定删除吗?`, "提示", {
|
||||
type: "warning",
|
||||
}).then(() => {
|
||||
this.$API.mtm.routemat.delete.req(row.id).then((res) => {
|
||||
let index = this.routemats.findIndex((item) => item.id === row.id);
|
||||
this.routemats.splice(index, 1);
|
||||
this.$message.success("删除成功");
|
||||
that.getroutemats();
|
||||
}).catch((err) => {
|
||||
return err;
|
||||
});
|
||||
}).catch(() => {});
|
||||
},
|
||||
//显示
|
||||
open(mode = "add") {
|
||||
this.mode = mode;
|
||||
|
@ -263,6 +353,9 @@ export default {
|
|||
//表单注入数据
|
||||
setData(data) {
|
||||
Object.assign(this.form, data);
|
||||
this.routeId = data.id;
|
||||
this.addTemplate.route = data.id;
|
||||
this.getroutemats();
|
||||
},
|
||||
//表单提交方法
|
||||
submit() {
|
||||
|
|
Loading…
Reference in New Issue