【fix ESLint】src/components/jero/JTreeSelect
This commit is contained in:
@@ -125,13 +125,10 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
_attrs () {
|
||||
let attrs
|
||||
attrs = { ...this.$attrs }
|
||||
return attrs
|
||||
return { ...this.$attrs }
|
||||
},
|
||||
// 透传给下级组件的事件,需要排除本组件使用的change事件
|
||||
childListeners () {
|
||||
const vm = this
|
||||
const result = Object.assign({},
|
||||
this.$listeners
|
||||
)
|
||||
@@ -151,13 +148,12 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
loadItemByCode () {
|
||||
if (!this.value || this.value == '0') {
|
||||
if (!this.value || this.value + '' === '0') {
|
||||
this.treeValue = null
|
||||
} else {
|
||||
getAction(`${this.view}${this.dict}`, { key: this.value }).then(res => {
|
||||
if (res.success) {
|
||||
const values = this.value.split(',')
|
||||
this.treeValue = values // v-model接收的是string || string[]
|
||||
this.treeValue = this.value.split(',') // v-model接收的是string || string[]
|
||||
// 将节点名称显示在选择框上
|
||||
this.treeValue = res.result[0]
|
||||
this.onLoadTriggleChange(res.result[0])
|
||||
@@ -198,9 +194,9 @@ export default {
|
||||
if (res.success) {
|
||||
for (const i of res.result) {
|
||||
i.value = i.key
|
||||
if (i.leaf == false) {
|
||||
if (i.leaf === false) {
|
||||
i.isLeaf = false
|
||||
} else if (i.leaf == true) {
|
||||
} else if (i.leaf === true) {
|
||||
i.isLeaf = true
|
||||
}
|
||||
}
|
||||
@@ -214,8 +210,8 @@ export default {
|
||||
addChildren (pid, children, treeArray) {
|
||||
if (treeArray && treeArray.length > 0) {
|
||||
for (const item of treeArray) {
|
||||
if (item.key == pid) { // 找到当前元素所在的父节点
|
||||
if (!children || children.length == 0) {
|
||||
if (item.key + '' === pid + '') { // 找到当前元素所在的父节点
|
||||
if (!children || children.length === 0) {
|
||||
item.isLeaf = true
|
||||
} else {
|
||||
item.children = children // 搜索出来的children添加到原树子children
|
||||
@@ -245,9 +241,9 @@ export default {
|
||||
if (res.success && res.result) {
|
||||
for (const i of res.result) {
|
||||
i.value = i.key
|
||||
if (i.leaf == false) {
|
||||
if (i.leaf === false) {
|
||||
i.isLeaf = false
|
||||
} else if (i.leaf == true) {
|
||||
} else if (i.leaf === true) {
|
||||
i.isLeaf = true
|
||||
}
|
||||
}
|
||||
@@ -324,9 +320,9 @@ function deepFor (source) {
|
||||
for (const i of source) {
|
||||
i.value = i.key
|
||||
|
||||
if (i.leaf == false) {
|
||||
if (i.leaf === false) {
|
||||
i.isLeaf = false
|
||||
} else if (i.leaf == true) {
|
||||
} else if (i.leaf === true) {
|
||||
i.isLeaf = true
|
||||
}
|
||||
if (i.children && i.children.length > 0) {
|
||||
|
||||
Reference in New Issue
Block a user