【fix ESLint】src/components/jero/JTreeSelect

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