From aa082dd75031cf41aac723188759ac7147ac622a Mon Sep 17 00:00:00 2001 From: zhaoxiao Date: Mon, 6 Mar 2023 09:24:57 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=20ESLint=E3=80=91src/components/je?= =?UTF-8?q?ro/JTreeSelect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jero-web/src/components/jero/JTreeSelect.vue | 26 +++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/jero-web/src/components/jero/JTreeSelect.vue b/jero-web/src/components/jero/JTreeSelect.vue index a61c5594..72aa5305 100644 --- a/jero-web/src/components/jero/JTreeSelect.vue +++ b/jero-web/src/components/jero/JTreeSelect.vue @@ -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) {