Commit b021587b by 胡悦

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

1 parent a27a1818
...@@ -39,21 +39,6 @@ ...@@ -39,21 +39,6 @@
</template> </template>
<template v-else>-</template> <template v-else>-</template>
</div> </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"> <div slot="merchantName" slot-scope="scope">
<template v-if="scope.scope.merchantName"> <template v-if="scope.scope.merchantName">
{{ scope.scope.merchantName.split(",").length > 1 ? scope.scope.merchantName.split(",")[0] + '...' : {{ scope.scope.merchantName.split(",").length > 1 ? scope.scope.merchantName.split(",")[0] + '...' :
...@@ -119,11 +104,11 @@ export default { ...@@ -119,11 +104,11 @@ export default {
prop: "brandName", prop: "brandName",
addHtml: "brandName" addHtml: "brandName"
}, },
{ // {
label: "子品牌", // label: "子品牌",
prop: "subBrandName", // prop: "subBrandName",
addHtml: "subBrandName" // addHtml: "subBrandName"
}, // },
{ {
label: "关联门店", label: "关联门店",
prop: "merchantName", prop: "merchantName",
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
</template> </template>
<script> <script>
import { deepClone } from "@/common/util"
import { getCarbrandTree } from "@api/contentManager" import { getCarbrandTree } from "@api/contentManager"
export default { export default {
name: "brandTree", name: "brandTree",
...@@ -46,50 +47,11 @@ export default { ...@@ -46,50 +47,11 @@ export default {
checked: false, checked: false,
checkList: [], checkList: [],
brandData: [], 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: { defaultProps: {
children: 'children', children: 'children',
label: 'label' label: 'label'
} },
selectList: []
} }
}, },
watch: { watch: {
...@@ -99,9 +61,10 @@ export default { ...@@ -99,9 +61,10 @@ export default {
defaultKeys(val) { defaultKeys(val) {
console.log(val) console.log(val)
this.$nextTick(() => { this.$nextTick(() => {
val.forEach(i => { // val.forEach(i => {
this.$refs.tree.setChecked(i, true) // this.$refs.tree.setChecked(i, true)
}) // })
this.$refs.tree.setCheckedKeys(val)
}) })
} }
}, },
...@@ -120,7 +83,13 @@ export default { ...@@ -120,7 +83,13 @@ export default {
}, },
handleConfirm() { handleConfirm() {
this.resetChecked() 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() { onSearch() {
this.$refs.tree.filter(this.filterText) this.$refs.tree.filter(this.filterText)
...@@ -129,6 +98,20 @@ export default { ...@@ -129,6 +98,20 @@ export default {
console.log(data, this.$refs.tree.getCheckedNodes()); console.log(data, this.$refs.tree.getCheckedNodes());
this.checkList = 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() { resetChecked() {
this.$refs.tree.setCheckedKeys([]); this.$refs.tree.setCheckedKeys([]);
......
...@@ -1053,7 +1053,11 @@ export default { ...@@ -1053,7 +1053,11 @@ export default {
// 取消按钮返回列表页 // 取消按钮返回列表页
handleCancel() { handleCancel() {
this.$router.push({ this.$router.push({
name: "packageConfig" name: "packageConfig",
params: {
tabPane: '1',
tabLabel: 'UpgradeLightly'
}
}) })
}, },
getParams() { getParams() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!