Add route half-finished material creation
This commit is contained in:
parent
2912518b67
commit
243f0e044d
|
|
@ -70,13 +70,24 @@
|
|||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="输出物料" prop="material_out">
|
||||
<div class="material-out-field">
|
||||
<el-tag
|
||||
v-if="form.material_out_create"
|
||||
closable
|
||||
class="material-out-draft"
|
||||
@close="clearMaterialOutCreate"
|
||||
>
|
||||
待新建:{{ form.material_out_create.name }}
|
||||
</el-tag>
|
||||
<xtSelect
|
||||
v-else
|
||||
:apiObj="apiObjM"
|
||||
v-model="form.material_out"
|
||||
v-model:label="form.material_out_name"
|
||||
:labelField="'full_name'"
|
||||
style="width: 100%;"
|
||||
class="material-out-select"
|
||||
:params = "paramsMOut"
|
||||
@update:modelValue="materialOutSelected"
|
||||
>
|
||||
<el-table-column label="物料">
|
||||
<template #default="scope">
|
||||
|
|
@ -85,6 +96,16 @@
|
|||
</template>
|
||||
</el-table-column>
|
||||
</xtSelect>
|
||||
<el-button
|
||||
v-if="mode !== 'show'"
|
||||
type="primary"
|
||||
plain
|
||||
v-auth="'material.create'"
|
||||
@click="openMaterialOutCreate"
|
||||
>
|
||||
{{ form.material_out_create ? "修改新建项" : "新建半成品" }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
|
|
@ -286,6 +307,76 @@
|
|||
</el-footer>
|
||||
</el-container>
|
||||
</el-dialog>
|
||||
<el-dialog
|
||||
title="新建并绑定半成品"
|
||||
v-model="materialCreateVisible"
|
||||
width="680px"
|
||||
append-to-body
|
||||
destroy-on-close
|
||||
>
|
||||
<el-alert
|
||||
title="保存工艺步骤时才会创建物料;取消或保存失败不会留下孤立物料。"
|
||||
type="info"
|
||||
:closable="false"
|
||||
style="margin-bottom: 18px"
|
||||
/>
|
||||
<el-form
|
||||
ref="materialCreateForm"
|
||||
:model="materialCreate"
|
||||
:rules="materialCreateRules"
|
||||
label-width="100px"
|
||||
>
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料名称" prop="name">
|
||||
<el-input v-model="materialCreate.name" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料编号" prop="number">
|
||||
<el-input v-model="materialCreate.number" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="规格">
|
||||
<el-input v-model="materialCreate.specification" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="型号">
|
||||
<el-input v-model="materialCreate.model" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="物料系列">
|
||||
<el-input v-model="materialCreate.cate" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计量单位">
|
||||
<el-input v-model="materialCreate.unit" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="入库检验">
|
||||
<el-select v-model="materialCreate.test_mode_in" style="width: 100%">
|
||||
<el-option label="免检" :value="10" />
|
||||
<el-option label="必检" :value="20" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所到工序">
|
||||
<el-input :model-value="processName" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="materialCreateVisible = false">取消</el-button>
|
||||
<el-button type="primary" @click="confirmMaterialOutCreate">确定使用</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -303,6 +394,15 @@ const defaultForm = {
|
|||
is_autotask: true,
|
||||
material_out_tracking:10
|
||||
};
|
||||
const defaultMaterialCreate = {
|
||||
name: "",
|
||||
number: "",
|
||||
cate: "",
|
||||
specification: "",
|
||||
model: "",
|
||||
unit: "个",
|
||||
test_mode_in: 20,
|
||||
};
|
||||
export default {
|
||||
props: {
|
||||
count: { type: Number, default : 0 },
|
||||
|
|
@ -338,6 +438,12 @@ export default {
|
|||
},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
materialCreateVisible: false,
|
||||
materialCreate: Object.assign({}, defaultMaterialCreate),
|
||||
materialCreateRules: {
|
||||
name: [{ required: true, message: "请输入物料名称", trigger: "blur" }],
|
||||
number: [{ required: true, message: "请输入物料编号", trigger: "blur" }],
|
||||
},
|
||||
divDisable:false,
|
||||
materialsIn: [],
|
||||
materialsOut: [],
|
||||
|
|
@ -444,6 +550,51 @@ export default {
|
|||
}
|
||||
})
|
||||
},
|
||||
materialOutSelected(value) {
|
||||
if (value) {
|
||||
delete this.form.material_out_create;
|
||||
}
|
||||
},
|
||||
clearMaterialOutCreate() {
|
||||
delete this.form.material_out_create;
|
||||
this.materialCreate = Object.assign({}, defaultMaterialCreate);
|
||||
},
|
||||
openMaterialOutCreate() {
|
||||
if (!this.form.process) {
|
||||
this.$message.warning("请先选择工序");
|
||||
return;
|
||||
}
|
||||
if (this.form.material_out_create) {
|
||||
this.materialCreate = Object.assign(
|
||||
{},
|
||||
defaultMaterialCreate,
|
||||
this.form.material_out_create
|
||||
);
|
||||
this.materialCreateVisible = true;
|
||||
return;
|
||||
}
|
||||
this.materialCreate = Object.assign({}, defaultMaterialCreate);
|
||||
this.materialCreateVisible = true;
|
||||
if (this.form.material_in) {
|
||||
this.$API.mtm.material.item.req(this.form.material_in).then((material) => {
|
||||
const fields = ["name", "number", "cate", "specification", "model", "unit", "test_mode_in"];
|
||||
fields.forEach((field) => {
|
||||
if (material[field] !== undefined && material[field] !== null) {
|
||||
this.materialCreate[field] = material[field];
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
confirmMaterialOutCreate() {
|
||||
this.$refs.materialCreateForm.validate((valid) => {
|
||||
if (!valid) return;
|
||||
this.form.material_out_create = Object.assign({}, this.materialCreate);
|
||||
this.form.material_out = "";
|
||||
this.form.material_out_name = "";
|
||||
this.materialCreateVisible = false;
|
||||
});
|
||||
},
|
||||
//合并新增的图片Ids
|
||||
imagesChange(data,data1){
|
||||
let that = this;
|
||||
|
|
@ -498,6 +649,8 @@ export default {
|
|||
this.fileurl_form = [];
|
||||
this.paramsJsonFileurl = [];
|
||||
this.routemats = [];
|
||||
this.materialCreateVisible = false;
|
||||
this.materialCreate = Object.assign({}, defaultMaterialCreate);
|
||||
this.routeId = "";
|
||||
this.processName = "";
|
||||
this.divDisable = false;
|
||||
|
|
@ -604,4 +757,21 @@ export default {
|
|||
};
|
||||
</script>
|
||||
|
||||
<style></style>
|
||||
<style scoped>
|
||||
.material-out-field {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.material-out-select,
|
||||
.material-out-draft {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.material-out-draft {
|
||||
height: 32px;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue