Commit a52b6f8f by cwq0219
2 parents 884f81d5 1f0a6e32
......@@ -78,6 +78,7 @@
>全部取消</el-button
>
<el-button
v-if="$Common.getParams().id"
:size="btn_size"
type="primary"
@click="btnClick('resetTree', index)"
......@@ -136,7 +137,8 @@ export default {
list: [],
accountParams: {},
defaultChecked: [],
responseList: []
responseList: [],
checkStrictly: true
}
},
mounted() {
......@@ -154,10 +156,6 @@ export default {
},
// 渲染树结构
renderContent(h, v) {
console.log(v.node.checked)
// if (!this.$Common.getParams().id) {
// v.node.checked = true
// }
if (v.data.logo == 'function') {
return (
<div class="custom-tree-node fun-tree-node">
......@@ -197,10 +195,7 @@ export default {
}
},
authVisibleChange(val) {
console.log(11)
if (!val && this.accountRuleForm.requestList.length !== 0) {
console.log(this.accountRuleForm.requestList)
console.log(this.responseList)
this.activeName = this.accountRuleForm.requestList[0].dictLabel
const arr = this.accountRuleForm.requestList
const productId = arr.map(item => item.dictValue)
......@@ -236,7 +231,6 @@ export default {
}
},
authChange(val) {
console.log(val, 'change')
if (val.length > 0 && this.treeData.length > 0) {
this.activeName = val[0].dictLabel
const arr = this.accountRuleForm.requestList
......@@ -266,17 +260,29 @@ export default {
btnClick(type, index) {
switch (type) {
case 'allTree':
console.log(this.$refs[`tree${index}`])
this.treeData.forEach((i, idx) => {
if (this.$refs[`tree${idx}`][0]) { // 可能被删除了
this.$refs[`tree${idx}`][0].setCheckedKeys(this.getAllId(i.children))
}
})
// this.checkStrictly = false
// this.treeData.forEach((i, idx) => {
// if (this.$refs[`tree${index}`][0]) { // 可能被删除了
// console.log(this.getAllId(i.children), '====')
// console.log(this.treeData[index].children)
this.$refs[`tree${index}`][0].setCheckedNodes(this.treeData[index].children)
// this.$refs[`tree${index}`][0].setCheckedKeys(this.getAllId(i.children))
// }
// })
// this.$nextTick(() => {
// this.checkStrictly = true
// })
break
case 'cancelAllTree':
this.$refs[`tree${index}`][0].setCheckedNodes([])
break
case 'resetTree':
this.responseList.forEach((item, index) => {
if (this.$refs[`tree${index}`][0]) {
this.$refs[`tree${index}`][0].setCheckedKeys(item.idList)
}
})
this.addStyle()
break
// eslint-disable-next-line no-case-declarations
case 'draft':
......@@ -386,6 +392,7 @@ export default {
getById(id) {
accountApi.getById({ id }).then(res => {
const { code, data } = res
console.log(data)
if (code == '0') {
const requestList = data.responseList.map(item => {
return {
......
<template>
<div>
<div class="detail">
<el-form :model="detailForm" label-width="100px">
<h3 class="content-title">基本信息</h3>
......@@ -45,12 +44,11 @@
</el-tree>
</el-tab-pane>
</el-tabs>
<!-- <div class="footer-btn">
<div class="footer-btn">
<el-button :size="btn_size" @click="cancel" type="primary"
>取消</el-button
>关闭</el-button
>
</div> -->
</div>
</div>
</div>
</template>
......@@ -160,15 +158,32 @@ export default {
}
},
mounted() {
// this.accountParams = this.$Common.getParams()
// if (this.$Common.getParams()) this.getById(this.$Common.getParams().id)
this.$root.eventBus.$on('params', params => {
console.log(params)
this.detailId = params.id
this.getById(params.id)
})
this.accountParams = this.$Common.getParams()
if (this.$Common.getParams()) {
this.detailId = this.$Common.getParams().id
this.getById(this.$Common.getParams().id)
}
// this.$root.eventBus.$on('params', params => {
// console.log(params)
// this.detailId = params.id
// this.getById(params.id)
// })
},
methods: {
setDisabled(data) {
if (data) {
data.forEach(item => {
if (item.children && item.children.length != 0) {
item.children.forEach(i => {
this.setDisabled(i.children)
i.disabled = true
})
}
item.disabled = true
})
}
return data
},
getById(id) {
accountApi.getById({ id }).then(res => {
console.log(res)
......@@ -192,17 +207,16 @@ export default {
accountApi.findProductById(params).then(res => {
if (res.code == '0') {
const data = _.cloneDeep(res.data)
console.log(data, '=========')
// const data = _.cloneDeep(data)
this.treeData = data
console.log('disabled', this.setDisabled(data))
this.treeData = this.setDisabled(data)
// 编辑
if (this.detailForm.requestList.length != 0) {
this.$nextTick(() => {
this.activeName = this.detailForm.requestList[0].productName
this.detailForm.requestList.forEach((item, index) => {
this.$refs[`tree${index}`][0].setCheckedKeys(item.idList)
// this.$refs[`tree${index}`][0].setCheckedNodes(
// this.treeData[index]
// )
})
this.addStyle()
})
......@@ -212,7 +226,6 @@ export default {
},
// 渲染树结构
renderContent(h, v) {
// v.node.disabled = true
if (v.data.logo == 'function') {
return (
<div class="custom-tree-node fun-tree-node">
......
......@@ -153,17 +153,18 @@ export default {
this.$Common.confirmDialog(tipData)
break
case 'detail':
// window.location.href = `./detail.html?id=${scope.id}`
this.$root.to(
[
'商户账号系统',
'系统设置',
'账户管理',
'账户类型管理',
'*账户详情'
],
{ id: scope.id }
)
console.log(11)
window.location.href = `./detail.html?id=${scope.id}`
// this.$root.to(
// [
// '商户账号系统(开发)',
// '商户账户管理',
// '账户管理',
// '账户类型管理',
// '*账户详情'
// ],
// { id: scope.id }
// )
break
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!