修改
This commit is contained in:
parent
d5327774d4
commit
cb218f72af
@ -192,12 +192,22 @@
|
|||||||
:required="true"
|
:required="true"
|
||||||
v-if="form.parentId"
|
v-if="form.parentId"
|
||||||
>
|
>
|
||||||
<el-input
|
<el-cascader
|
||||||
|
:props="treeOption"
|
||||||
|
@change="change"
|
||||||
|
style="width: 340px"
|
||||||
|
:show-all-levels="false"
|
||||||
|
:clearable="true"
|
||||||
|
ref="cascader"
|
||||||
|
:placeholder="form.parentName ? form.parentName : ''"
|
||||||
|
>
|
||||||
|
</el-cascader>
|
||||||
|
<!-- <el-input
|
||||||
v-model="form.parentName"
|
v-model="form.parentName"
|
||||||
placeholder="请输入父级分类名称"
|
placeholder="请输入父级分类名称"
|
||||||
maxlength="10"
|
maxlength="10"
|
||||||
disabled
|
disabled
|
||||||
/>
|
/> -->
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品分类名称" prop="goodsCategoryName">
|
<el-form-item label="商品分类名称" prop="goodsCategoryName">
|
||||||
<el-input
|
<el-input
|
||||||
@ -263,19 +273,26 @@ export default {
|
|||||||
components: { stationAcatar },
|
components: { stationAcatar },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
props: {
|
treeOption: {
|
||||||
lazy: true,
|
lazy: true,
|
||||||
|
checkStrictly: true, // 是否可选择任意一级
|
||||||
lazyLoad(node, resolve) {
|
lazyLoad(node, resolve) {
|
||||||
console.log(node);
|
const id = node.level === 0 ? 0 : node.data.id;
|
||||||
const { level } = node;
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const nodes = Array.from({ length: level + 1 }).map((item) => ({
|
getStationCategoryList(id).then((res) => {
|
||||||
value: ++id,
|
// 接口请求
|
||||||
label: `选项${id}`,
|
res.data.forEach((e) => {
|
||||||
leaf: level >= 2,
|
e.value = e.id;
|
||||||
}));
|
e.label = e.goodsCategoryName;
|
||||||
// 通过调用resolve将子节点数据返回,通知组件数据加载完成
|
});
|
||||||
resolve(nodes);
|
resolve(
|
||||||
|
res.data.map((item) => {
|
||||||
|
return {
|
||||||
|
...item,
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
}, 1000);
|
}, 1000);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -349,6 +366,9 @@ export default {
|
|||||||
this.info();
|
this.info();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
change(e) {
|
||||||
|
this.form.parentId = e[e.length - 1];
|
||||||
|
},
|
||||||
// 节点单击事件
|
// 节点单击事件
|
||||||
handleNodeClick(data) {
|
handleNodeClick(data) {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
@ -542,3 +562,9 @@ export default {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .el-cascader .el-input input::-webkit-input-placeholder {
|
||||||
|
color: black;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user