Commit 4b1a81cf by cwq0219

bug修复

1 parent 23b2959f
......@@ -19,7 +19,7 @@
</div>
<div class="contentTree">
<template v-if="merchantProTreeResponses.length > 0">
<el-tree default-expand-all :data="merchantProTreeResponses" :props="defaultProps"></el-tree>
<el-tree default-expand-all :data="merchantProTreeResponses" :render-content="renderContent" :props="defaultProps"></el-tree>
</template>
<div v-else class="noDataContent">
<img src="../../../assets/img/empty.png" alt="" />
......@@ -39,6 +39,7 @@ export default {
data() {
return {
powerDataArray: [],
merchantProTreeResponses: [],
currentIndex: 0, //功能权限主标题的索引
subCurrentIndex: 0,
defaultProps: {
......@@ -61,17 +62,19 @@ export default {
return []
}
return this.powerDataArray[this.currentIndex].products
},
//功能树的数据
merchantProTreeResponses() {
if (!this.powerDataArray.length) {
return []
} else if (this.powerDataArray.length > 0 && this.powerDataArray[this.currentIndex].products.length == 0) {
return []
}
return this.powerDataArray[this.currentIndex].products[this.subCurrentIndex].merchantProTreeResponses
}
//功能树的数据
// merchantProTreeResponses() {
// if (!this.powerDataArray.length) {
// return []
// } else if (this.powerDataArray.length > 0 && this.powerDataArray[this.currentIndex].products.length == 0) {
// return []
// }
// this.$nextTick(() => {
// this.addStyle()
// })
// return this.powerDataArray[this.currentIndex].products[this.subCurrentIndex].merchantProTreeResponses
// }
},
mounted() {
......@@ -84,13 +87,49 @@ export default {
this.powerDataArray = res.accountTypeTreeResponseList
})
},
changeMerchantProTree() {
if (!this.powerDataArray.length) {
return []
} else if (this.powerDataArray.length > 0 && this.powerDataArray[this.currentIndex].products.length == 0) {
return []
}
this.merchantProTreeResponses = this.powerDataArray[this.currentIndex].products[this.subCurrentIndex].merchantProTreeResponses
this.$nextTick(() => {
this.addStyle()
})
},
// 渲染树结构
renderContent(h, v) {
if (v.data.logo == 'functionValue') {
return (
<div class="custom-tree-node fun-tree-node">
<span>{v.node.label}</span>
</div>
)
} else {
return (
<div class="custom-tree-node">
<span>{v.node.label}</span>
</div>
)
}
},
addStyle() {
const nodes = document.getElementsByClassName('fun-tree-node')
for (let i = 0; i < nodes.length; i++) {
const parentNode = nodes[i].parentNode.parentNode
parentNode.style.float = 'left'
}
},
powerTabClick(index) {
this.currentIndex = index
//每次切换将subCurrentIndex置为0
this.subCurrentIndex = 0
this.changeMerchantProTree()
},
powerSubTabClick(index) {
this.subCurrentIndex = index
this.changeMerchantProTree()
},
handleClose() {
this.$router.push({
......
......@@ -7,7 +7,7 @@
<p class="edit-sub-title p-rl-20">员工基本信息</p>
<glsx-combi-form class="p-tr-20" ref="editFormRef" labelWidth="160px" @handleImgDelete="handleImgDelete" :isBlock="isBlock" :formRef="editChildRef" :formObj="editForm" :formData="editFormData" :formRules="editRule">
<template slot="merchantId" slot-scope="item">
<span class="txt-ellipsis" v-if="routeInfo.addOrEdit == 2 || (routeInfo.addOrEdit == 1 && userInfo.accountLevel == 4)" :title="editForm.merchantName + '(' + editForm.merchantId + ')'">{{ editForm.merchantName + '(' + editForm.merchantId + ')' }}</span>
<span class="txt-ellipsis" v-if="routeInfo.addOrEdit == 2 || (routeInfo.addOrEdit == 1 && userInfo.accountLevel == 4)" :title="editForm.merchantName">{{ editForm.merchantName}}</span>
<el-select v-else :style="{ width: item.scope.width }" v-model="editForm[item.scope.name]" :clearable="item.scope.isClear || false" :placeholder="'请选择' + item.scope.label" :filterable="!item.scope.noFilter" @change="handleChangeMerchant($event)">
<el-option v-for="subItem in baseData.allMerchantList" :key="subItem[item.scope.optionId]" :label="subItem[item.scope.optionLabel]" :value="subItem[item.scope.optionId]"></el-option>
</el-select>
......
......@@ -73,8 +73,10 @@ export default {
optionList: [],
optionId: 'id',
optionLabel: 'merchantName',
optionsName: 'allMerchantList'
// addHtml: 'merchantId'
optionsName: 'allMerchantList',
changeAttr: (value, targetItem) => {
this.handleChangeMerchant(value)
}
},
{
label: '角色',
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!