二级新增属性

This commit is contained in:
jjLv 2024-12-10 10:53:23 +08:00
parent 6e1893f596
commit 3cb5273ca0
1 changed files with 68 additions and 0 deletions

View File

@ -612,6 +612,46 @@
</el-col>
</el-row>
<div
v-for="(item, index) in propertyNames"
:key="index"
class="dynamic-item"
>
<el-row :gutter="24">
<el-col :span="9">
<el-form-item label="属性" prop="attribute">
<el-input
v-model="propertyNames[index]"
placeholder="请输入"
maxlength="20"
style="width: 370px"
>
</el-input>
</el-form-item>
</el-col>
<el-col
:span="5"
style="
margin-top: 10px;
display: flex;
justify-content: right;
align-items: center;
"
>
<i
class="el-icon-plus"
style="font-size: 20px; color: blue"
@click="addPartItem"
></i>
<i
class="el-icon-minus"
style="font-size: 20px; color: red"
v-if="index != 0"
@click="removePartItem(index)"
></i>
</el-col>
</el-row>
</div>
<el-row style="text-align: right">
<el-form-item>
<el-button size="small" type="primary" @click="onSubmit"
@ -882,6 +922,8 @@ export default {
isMousemoveId: null,
editTypeIds: [],
batchEdit: true,
propertyNames: [''],
};
},
watch: {
@ -1184,6 +1226,7 @@ export default {
/* 树节点增加 */
appendTreeNode(data) {
this.propertyNames = [];
if (data.level === 3) {
this.reset();
Object.assign(this.form, data);
@ -1215,10 +1258,22 @@ export default {
/* 树节点修改 */
editTreeNode(data) {
console.log(data, "修改");
if(data.level!=2){
this.propertyNames= []
Object.assign(this.addFormParams, data);
this.addTitle = "修改";
this.addFormParams.typeName = data.label;
this.addTitleVisible = true;
}else{
this.propertyNames= ['']
if(data.propertyNames!=null){
this.propertyNames = data.propertyNames
}
Object.assign(this.addFormParams, data);
this.addTitle = "修改";
this.addFormParams.typeName = data.label;
this.addTitleVisible = true;
}
},
/* 确定 */
onSubmit() {
@ -1231,6 +1286,7 @@ export default {
typeId: id,
typeName,
parentId,
propertyNames:this.propertyNames,
};
this.$refs["addFormParamsRef"].validate(async (valid) => {
@ -1249,6 +1305,7 @@ export default {
this.addTitleVisible = false;
this.getTreeData();
}
this.propertyNames = [];
}
}
});
@ -1256,6 +1313,7 @@ export default {
/* 取消 */
onCancel() {
this.addTitleVisible = false;
this.propertyNames = ['']
},
getParentName(list, id) {
try {
@ -1325,6 +1383,16 @@ export default {
this.editTypeIds.push(row.typeId);
this.editLeasePriceVisible = true;
},
//
addPartItem() {
this.propertyNames.push('');
},
removePartItem(index) {
if (this.propertyNames.length > 1) {
this.propertyNames.splice(index, 1);
}
},
},
};
</script>