Commit b021587b by 胡悦

修改平板配置,品牌逻辑、配置校验

1 parent a27a1818
......@@ -39,21 +39,6 @@
</template>
<template v-else>-</template>
</div>
<div slot="subBrandName" slot-scope="scope">
<template v-if="scope.scope.subBrandName">
{{ scope.scope.subBrandName.split(",").length > 1 ? scope.scope.subBrandName.split(",")[0] + '...' :
scope.scope.subBrandName.split(",")[0]}}
<el-popover placement="top-start" width="200" trigger="hover">
<p v-for="(item, index) in scope.scope.subBrandName.split(',')" :key="index">
{{ item }}
</p>
<span class="trick-no" slot="reference" v-show="scope.scope.subBrandName.split(',').length > 1">({{
scope.scope.subBrandName.split(",").length - 1 }})</span>
<!-- <el-button slot="reference">hover 激活</el-button> -->
</el-popover>
</template>
<template v-else>-</template>
</div>
<div slot="merchantName" slot-scope="scope">
<template v-if="scope.scope.merchantName">
{{ scope.scope.merchantName.split(",").length > 1 ? scope.scope.merchantName.split(",")[0] + '...' :
......@@ -119,11 +104,11 @@ export default {
prop: "brandName",
addHtml: "brandName"
},
{
label: "子品牌",
prop: "subBrandName",
addHtml: "subBrandName"
},
// {
// label: "子品牌",
// prop: "subBrandName",
// addHtml: "subBrandName"
// },
{
label: "关联门店",
prop: "merchantName",
......
......@@ -33,6 +33,7 @@
</template>
<script>
import { deepClone } from "@/common/util"
import { getCarbrandTree } from "@api/contentManager"
export default {
name: "brandTree",
......@@ -46,50 +47,11 @@ export default {
checked: false,
checkList: [],
brandData: [],
// brandData: [{
// id: 1,
// label: '奥迪',
// children: [{
// id: 11,
// label: 'Audi Sport'
// }, {
// id: 12,
// label: '奥迪(进口)'
// }, {
// id: 13,
// label: '上汽奥迪'
// }, {
// id: 14,
// label: '一汽奥迪'
// }]
// }, {
// id: 2,
// label: '阿斯顿*马丁',
// children: [{
// id: 21,
// label: '阿斯顿*马丁'
// }, {
// id: 22,
// label: '阿斯顿*大发疯',
// }]
// }, {
// id: 3,
// label: '问界',
// children: [{
// id: 31,
// label: 'M5'
// }, {
// id: 32,
// label: 'M7'
// }, {
// id: 33,
// label: 'M9'
// }]
// }],
defaultProps: {
children: 'children',
label: 'label'
}
},
selectList: []
}
},
watch: {
......@@ -99,9 +61,10 @@ export default {
defaultKeys(val) {
console.log(val)
this.$nextTick(() => {
val.forEach(i => {
this.$refs.tree.setChecked(i, true)
})
// val.forEach(i => {
// this.$refs.tree.setChecked(i, true)
// })
this.$refs.tree.setCheckedKeys(val)
})
}
},
......@@ -120,7 +83,13 @@ export default {
},
handleConfirm() {
this.resetChecked()
this.$emit('submit', this.checkList)
console.log(this.checkList, 'checkList')
const newList = this.filterCheckList(deepClone(this.checkList))
console.log(newList, 'newList')
this.$emit('submit', {
checkList: this.checkList,
newList: newList
})
},
onSearch() {
this.$refs.tree.filter(this.filterText)
......@@ -129,6 +98,20 @@ export default {
console.log(data, this.$refs.tree.getCheckedNodes());
this.checkList = this.$refs.tree.getCheckedNodes()
},
filterCheckList(checkList) {
// 收集所有 children 中的 id
const childrenIds = new Set();
checkList.forEach(item => {
if (item.children && item.children.length > 0) {
item.children.forEach(child => {
childrenIds.add(child.id);
});
}
});
// 过滤掉一级项中 id 存在于 childrenIds 中的项
return checkList.filter(item => !childrenIds.has(item.id));
},
// 清空
resetChecked() {
this.$refs.tree.setCheckedKeys([]);
......
......@@ -1053,7 +1053,11 @@ export default {
// 取消按钮返回列表页
handleCancel() {
this.$router.push({
name: "packageConfig"
name: "packageConfig",
params: {
tabPane: '1',
tabLabel: 'UpgradeLightly'
}
})
},
getParams() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!