fix:物料添加时增加排序
This commit is contained in:
parent
25e2a1e9d6
commit
63737587e1
|
|
@ -14,20 +14,32 @@
|
|||
:rules="rules"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
style="padding: 0 10px;"
|
||||
style="padding: 0 10px"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="名称" prop="name">
|
||||
<el-input v-model="form.name" clearable></el-input>
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="标识">
|
||||
<el-input v-model="form.code" clearable></el-input>
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="类型">
|
||||
<el-select
|
||||
v-model="form.type"
|
||||
placeholder="类型"
|
||||
clearable
|
||||
style="width: 100%;"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in typeOptions"
|
||||
|
|
@ -37,13 +49,15 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="检测项目">
|
||||
<el-select
|
||||
v-model="form.testitems"
|
||||
placeholder="检测项目"
|
||||
clearable
|
||||
multiple
|
||||
style="width: 100%;"
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
|
|
@ -53,18 +67,47 @@
|
|||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="单位成本" prop="price_unit">
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="已到工序">
|
||||
<el-select
|
||||
v-model="form.process"
|
||||
placeholder="已到工序"
|
||||
clearable
|
||||
style="width: 100%"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in processOptions"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="计量单位">
|
||||
<el-input
|
||||
v-model="form.unit"
|
||||
clearable
|
||||
></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :md="12" :sm="24">
|
||||
<el-form-item label="排序">
|
||||
<el-input-number
|
||||
v-model="form.sort"
|
||||
:precision="0"
|
||||
style="width: 100%;"
|
||||
clearable>
|
||||
</el-input-number>
|
||||
</el-form-item> -->
|
||||
clearable
|
||||
></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</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>
|
||||
|
|
@ -77,7 +120,8 @@
|
|||
name: "",
|
||||
code: "",
|
||||
type: "",
|
||||
// sort:1,
|
||||
sort: 1,
|
||||
unit: "",
|
||||
testitems: [],
|
||||
};
|
||||
export default {
|
||||
|
|
@ -87,40 +131,49 @@
|
|||
loading: false,
|
||||
mode: "add",
|
||||
titleMap: {
|
||||
add: '新增产品',
|
||||
edit: '编辑产品',
|
||||
show: '查看产品'
|
||||
add: "新增产品",
|
||||
edit: "编辑产品",
|
||||
show: "查看产品",
|
||||
},
|
||||
//表单数据
|
||||
form: defaultForm,
|
||||
//验证规则
|
||||
rules: {
|
||||
name: [{required: true, message: "请输入名称", trigger: "blur"}],
|
||||
name: [
|
||||
{ required: true, message: "请输入名称", trigger: "blur" },
|
||||
],
|
||||
},
|
||||
visible: false,
|
||||
isSaveing: false,
|
||||
options: [],
|
||||
typeOptions: [
|
||||
{label:'电/水/气',value:0},
|
||||
{label:'成品',value:10},
|
||||
{label:'半成品',value:20},
|
||||
{label:'主要原料',value:30},
|
||||
{label:'辅助材料',value:40},
|
||||
{label:'加工工具',value:50},
|
||||
{label:'辅助工装',value:60},
|
||||
{ label: "电/水/气", value: 0 },
|
||||
{ label: "成品", value: 10 },
|
||||
{ label: "半成品", value: 20 },
|
||||
{ label: "主要原料", value: 30 },
|
||||
{ label: "辅助材料", value: 40 },
|
||||
{ label: "加工工具", value: 50 },
|
||||
{ label: "辅助工装", value: 60 },
|
||||
],
|
||||
processOptions: [],
|
||||
setFiltersVisible: false,
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getTestItem(); //获取部门
|
||||
this.getProcessOptions();
|
||||
},
|
||||
methods: {
|
||||
getTestItem() {
|
||||
this.$API.qm.getTestItem.get({page:0}).then(res=>{
|
||||
this.$API.qm.getTestItem.get({ page: 0 }).then((res) => {
|
||||
this.options = res;
|
||||
});
|
||||
},
|
||||
getProcessOptions() {
|
||||
this.$API.mtm.process.list.req({ page: 0 }).then((res) => {
|
||||
this.processOptions = res;
|
||||
});
|
||||
},
|
||||
//显示
|
||||
open(mode = "add") {
|
||||
this.mode = mode;
|
||||
|
|
@ -137,24 +190,30 @@
|
|||
that.$refs.dialogForm.validate(async (valid) => {
|
||||
if (valid) {
|
||||
that.isSaveing = true;
|
||||
if(that.mode==='add'){
|
||||
that.$API.mtm.material.create.req(that.form).then(res=>{
|
||||
if (that.mode === "add") {
|
||||
that.$API.mtm.material.create
|
||||
.req(that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
}).catch(res=>{
|
||||
that.isSaveing = false;
|
||||
})
|
||||
.catch((res) => {
|
||||
that.isSaveing = false;
|
||||
});
|
||||
} else {
|
||||
res = that.$API.mtm.material.update.req(that.form.id,that.form).then(res=>{
|
||||
res = that.$API.mtm.material.update
|
||||
.req(that.form.id, that.form)
|
||||
.then((res) => {
|
||||
that.isSaveing = false;
|
||||
that.$emit("success", that.form, that.mode);
|
||||
that.visible = false;
|
||||
that.$message.success("操作成功");
|
||||
}).catch(res=>{
|
||||
that.isSaveing = false;
|
||||
})
|
||||
.catch((res) => {
|
||||
that.isSaveing = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -169,6 +228,4 @@
|
|||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
||||
<style></style>
|
||||
|
|
|
|||
Loading…
Reference in New Issue