|
@@ -58,14 +58,14 @@
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="12" label-width="100px">
|
|
<el-col :span="12" label-width="100px">
|
|
|
- <el-form-item label="编码" prop="category.code">
|
|
|
|
|
- <el-input placeholder="" @click.native="handleProduct()" v-model="category.code"></el-input>
|
|
|
|
|
|
|
+ <el-form-item label="编码" prop="code">
|
|
|
|
|
+ <el-input placeholder="" @click.native="handleProduct()" v-model="attributeData.code"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
|
<el-col :span="12" label-width="100px">
|
|
<el-col :span="12" label-width="100px">
|
|
|
- <el-form-item label="名称" prop="category.name">
|
|
|
|
|
- <el-input placeholder="" v-model="category.name"></el-input>
|
|
|
|
|
|
|
+ <el-form-item label="名称" prop="name">
|
|
|
|
|
+ <el-input placeholder="" v-model="attributeData.name"></el-input>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-col>
|
|
</el-col>
|
|
|
|
|
|
|
@@ -194,13 +194,14 @@
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
category: {
|
|
category: {
|
|
|
- name: '',
|
|
|
|
|
- code: ''
|
|
|
|
|
|
|
+ name: ''
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
rules: {
|
|
rules: {
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ code: [{ required: true, message: '请选择编码', trigger: 'change' }],
|
|
|
|
|
+
|
|
|
|
|
+ name: [{ required: true, message: '请选择名称', trigger: 'change' }]
|
|
|
},
|
|
},
|
|
|
bomTreeList: [],
|
|
bomTreeList: [],
|
|
|
statusOptions: [
|
|
statusOptions: [
|
|
@@ -233,9 +234,9 @@
|
|
|
methods: {
|
|
methods: {
|
|
|
getTreeValue(data) {
|
|
getTreeValue(data) {
|
|
|
this.category = {
|
|
this.category = {
|
|
|
- name: '',
|
|
|
|
|
- code: ''
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ this.$set(this.attributeData, 'code', null);
|
|
|
|
|
+ this.$set(this.attributeData, 'name', null);
|
|
|
if(data) {
|
|
if(data) {
|
|
|
this.attributeData.parentId = data.id;
|
|
this.attributeData.parentId = data.id;
|
|
|
this.attributeData.level = +data.level + 1;
|
|
this.attributeData.level = +data.level + 1;
|
|
@@ -248,11 +249,10 @@
|
|
|
|
|
|
|
|
},
|
|
},
|
|
|
save() {
|
|
save() {
|
|
|
- if(!this.category.code) {
|
|
|
|
|
- this.$message.error('编码不能为空');
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
|
|
+ if (!valid) {
|
|
|
|
|
+ return false;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
if (!this.attributeData.parentId) {
|
|
if (!this.attributeData.parentId) {
|
|
|
this.attributeData.parentId = 0;
|
|
this.attributeData.parentId = 0;
|
|
|
this.attributeData.level = 1;
|
|
this.attributeData.level = 1;
|
|
@@ -264,7 +264,7 @@
|
|
|
this.$emit('reload', this.attributeData.versions);
|
|
this.$emit('reload', this.attributeData.versions);
|
|
|
this.handleClose();
|
|
this.handleClose();
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ });
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
versionsChange(versions) {
|
|
versionsChange(versions) {
|
|
@@ -278,6 +278,8 @@
|
|
|
chooseStandardList(type, data) {
|
|
chooseStandardList(type, data) {
|
|
|
if (type == 9 || type == 1) {
|
|
if (type == 9 || type == 1) {
|
|
|
this.category = data[0];
|
|
this.category = data[0];
|
|
|
|
|
+ this.$set(this.attributeData, 'code', data[0].code);
|
|
|
|
|
+ this.$set(this.attributeData, 'name', data[0].name);
|
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|