From 49ceae85c049412aef0bf9d0a1f61e7dfb0c614e Mon Sep 17 00:00:00 2001 From: z_yu <1534695664@qq.com> Date: Tue, 21 Jun 2022 09:48:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=97=A8=E7=B1=BB=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/category/form.vue | 6 ++++- src/views/category/index.vue | 27 ++++++++++++------- src/views/category/orderingRule/index.vue | 4 +-- .../category/orderingRule/module/form.vue | 22 ++++++--------- 4 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/views/category/form.vue b/src/views/category/form.vue index f8129cf..db7d578 100644 --- a/src/views/category/form.vue +++ b/src/views/category/form.vue @@ -70,7 +70,11 @@ export default { [CRUD.HOOK.beforeToAdd]() { this.form.isType = null this.selectOptions.forEach(item => { - if (this.selectedCategory.isType === 2) { + if (this.selectedCategory.isType === 1) { + if (item.value === 4) { + item.typeState = true + } + } else if (this.selectedCategory.isType === 2) { if (item.value !== 3) { item.typeState = true } diff --git a/src/views/category/index.vue b/src/views/category/index.vue index bef5636..38314d0 100644 --- a/src/views/category/index.vue +++ b/src/views/category/index.vue @@ -40,7 +40,7 @@ @@ -115,7 +115,8 @@ export default { selectedCategory: {}, deleteData: {}, activeIndex: 0, - sortLoading: false + sortLoading: false, + brotherNodeNum: 0 // sortTableData: [] } }, @@ -136,15 +137,17 @@ export default { } return 'baseInfo' } + // , + // brotherNodeNum: function() { + // const selectedNode = this.$refs.tree.getCurrentNode() + // if (selectedNode && selectedNode.pid && this.$refs.tree.getNode(selectedNode.pid)) { + // return this.$refs.tree.getNode(selectedNode.pid).childNodes.length + // } else { + // return 0 + // } + // } }, methods: { - // 右边初始化数据是空 - // [CRUD.HOOK.beforeRefresh]() { - // if (this.$refs.dictDetail) { - // this.$refs.dictDetail.query.id = '' - // } - // return true - // }, // 逆归实现 获取指定元素 findNode(tree, func) { for (const node of tree) { @@ -199,6 +202,10 @@ export default { } // 缓存当前的选中的 localStorage.setItem('currentCategoryKey', JSON.stringify(val)) + this.brotherNodeNum = val.pid + if (this.$refs.tree.getNode(val.pid) && this.$refs.tree.getNode(val.pid).childNodes) { + this.brotherNodeNum = this.$refs.tree.getNode(val.pid).childNodes.length + } } }, // 新增 - 判断当前节点类型,卷内/文件不可新建 @@ -230,7 +237,7 @@ export default { done() }, toSort(data) { - this.$refs.sort.sortTableData = data[0].children + this.$refs.sort.sortTableData = this.$refs.tree.getNode(data[0].pid).data.children this.$refs.sort.sortVisible = true }, changeActiveTab(data) { diff --git a/src/views/category/orderingRule/index.vue b/src/views/category/orderingRule/index.vue index ed57f80..1c455f9 100644 --- a/src/views/category/orderingRule/index.vue +++ b/src/views/category/orderingRule/index.vue @@ -34,8 +34,8 @@ diff --git a/src/views/category/orderingRule/module/form.vue b/src/views/category/orderingRule/module/form.vue index 0a95202..090e5db 100644 --- a/src/views/category/orderingRule/module/form.vue +++ b/src/views/category/orderingRule/module/form.vue @@ -41,20 +41,14 @@ export default { }, methods: { save() { - this.$refs['formData'].validate((valid) => { - if (valid) { - edit(this.formData.fields).then((res) => { - this.$notify({ - title: '保存成功', - type: 'success', - duration: 2500 - }) - this.cuDialogVisible = false - this.$emit('refresh') - }) - } else { - return false - } + edit(this.formData.fields).then((res) => { + this.$notify({ + title: '保存成功', + type: 'success', + duration: 2500 + }) + this.cuDialogVisible = false + this.$emit('refresh') }) } }