新增属性bug修复
This commit is contained in:
parent
6e5d37ec91
commit
ae6f19e332
|
|
@ -623,6 +623,7 @@
|
|||
"
|
||||
>
|
||||
<el-button
|
||||
v-if="visiableAttr"
|
||||
class="primary-lease"
|
||||
type="primary"
|
||||
@click="addPartItem"
|
||||
|
|
@ -667,8 +668,8 @@
|
|||
<el-col :span="8">
|
||||
<el-form-item label="是否必填" prop="mustHave">
|
||||
<el-radio-group v-model="item.mustHave">
|
||||
<el-radio label=1>是</el-radio>
|
||||
<el-radio label=0>否</el-radio>
|
||||
<el-radio label="1">是</el-radio>
|
||||
<el-radio label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
|
@ -973,7 +974,9 @@ export default {
|
|||
editTypeIds: [],
|
||||
batchEdit: true,
|
||||
|
||||
maTypeProperties: [{'propertyName':'','mustHave': null}],
|
||||
maTypeProperties: [{'propertyName':'','mustHave': "0"}],
|
||||
visiableAttr:false,
|
||||
allPass:true,
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
|
|
@ -1001,7 +1004,7 @@ export default {
|
|||
// })
|
||||
// },
|
||||
/** 查询新增页面-上级类型下拉树结构 */
|
||||
getTreeData() {
|
||||
async getTreeData() {
|
||||
getMaTypeList().then((response) => {
|
||||
this.treeOptions = [
|
||||
{
|
||||
|
|
@ -1276,6 +1279,7 @@ export default {
|
|||
|
||||
/* 树节点增加 */
|
||||
appendTreeNode(data) {
|
||||
this.visiableAttr = false;
|
||||
this.maTypeProperties = [];
|
||||
if (data.level === 3) {
|
||||
this.reset();
|
||||
|
|
@ -1306,18 +1310,23 @@ export default {
|
|||
.catch(() => {});
|
||||
},
|
||||
/* 树节点修改 */
|
||||
editTreeNode(data) {
|
||||
console.log(data, "修改");
|
||||
async editTreeNode(data) {
|
||||
await this.getTreeData()
|
||||
if(data.level!=2){
|
||||
this.visiableAttr = false;
|
||||
this.maTypeProperties= []
|
||||
Object.assign(this.addFormParams, data);
|
||||
this.addTitle = "修改";
|
||||
this.addFormParams.typeName = data.label;
|
||||
this.addTitleVisible = true;
|
||||
}else{
|
||||
this.maTypeProperties= [{'propertyName':'','mustHave':null}]
|
||||
if(data.maTypeProperties!=null){
|
||||
this.maTypeProperties= []
|
||||
this.visiableAttr = true;
|
||||
if(data.maTypeProperties!=null && data.maTypeProperties.length>0){
|
||||
console.log('1111111',data.maTypeProperties)
|
||||
this.maTypeProperties = data.maTypeProperties
|
||||
}else{
|
||||
this.maTypeProperties= [{'propertyName':'','mustHave':"0"}]
|
||||
}
|
||||
Object.assign(this.addFormParams, data);
|
||||
this.addTitle = "修改";
|
||||
|
|
@ -1339,37 +1348,40 @@ export default {
|
|||
maTypeProperties:this.maTypeProperties,
|
||||
};
|
||||
|
||||
this.$refs["addFormParamsRef"].validate( (valid) => {
|
||||
this.$refs["addFormParamsRef"].validate( async(valid) => {
|
||||
if (valid) {
|
||||
this.$refs["maTypeRef"].forEach((formRef)=>{
|
||||
formRef.validate(async(validTemp)=>{
|
||||
if(validTemp){
|
||||
if (this.addTitle === "新增") {
|
||||
const res = await addMaType(addParams);
|
||||
if (res.code === 200) {
|
||||
this.$message.success("新增成功!");
|
||||
this.addTitleVisible = false;
|
||||
this.getTreeData();
|
||||
}
|
||||
} else {
|
||||
const res = await updateMaType(editParams);
|
||||
if (res.code === 200) {
|
||||
this.$message.success("修改成功!");
|
||||
this.addTitleVisible = false;
|
||||
this.getTreeData();
|
||||
}
|
||||
this.maTypeProperties = [];
|
||||
}
|
||||
await this.$refs["maTypeRef"].forEach((formRef)=>{
|
||||
formRef.validate((validTemp)=>{
|
||||
if(!validTemp){
|
||||
this.allPass = false;
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
if(this.allPass==true){
|
||||
if (this.addTitle === "新增") {
|
||||
const res = await addMaType(addParams);
|
||||
if (res.code === 200) {
|
||||
this.$message.success("新增成功!");
|
||||
this.addTitleVisible = false;
|
||||
this.getTreeData();
|
||||
}
|
||||
} else {
|
||||
const res = await updateMaType(editParams);
|
||||
if (res.code === 200) {
|
||||
this.$message.success("修改成功!");
|
||||
this.addTitleVisible = false;
|
||||
this.getTreeData();
|
||||
}
|
||||
this.maTypeProperties = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/* 取消 */
|
||||
onCancel() {
|
||||
this.addTitleVisible = false;
|
||||
this.maTypeProperties = ['']
|
||||
this.maTypeProperties = []
|
||||
},
|
||||
getParentName(list, id) {
|
||||
try {
|
||||
|
|
@ -1442,7 +1454,7 @@ export default {
|
|||
|
||||
//新增属性
|
||||
addPartItem() {
|
||||
this.maTypeProperties.push({'propertyName':'','mustHave': null});
|
||||
this.maTypeProperties.push({'propertyName':'','mustHave': "0"});
|
||||
},
|
||||
removePartItem(index) {
|
||||
if (this.maTypeProperties.length > 1) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue