From 946d6ffda6553794791141e72461ce045a725e04 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Sun, 31 Oct 2021 14:05:25 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9E=B6=E6=9E=84=E3=80=81=E5=85=B3=E9=94=AE?= =?UTF-8?q?=E8=AF=8D=E7=AD=89=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/data/Framework.vue | 43 +++++++++++++++++++++++------------- src/views/data/Introduce.vue | 15 +++++++------ src/views/data/Product.vue | 1 - 3 files changed, 36 insertions(+), 23 deletions(-) diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index ec8ca6b..7f2d899 100644 --- a/src/views/data/Framework.vue +++ b/src/views/data/Framework.vue @@ -36,9 +36,9 @@ - + @@ -130,11 +130,18 @@ - + + + @@ -157,6 +164,7 @@ export default { label: 'label' }, defaultActive: [], + added: false, typeVisible: false, categoryName: '', categoryId: '', @@ -224,17 +232,20 @@ export default { handleId(res) this.typeList = res - if(res[0].children.length){ - this.categoryId = res[0].children[0].id - this.defaultActive = [res[0].children[0].id] - }else{ - this.categoryId = res[0].id - this.defaultActive = [res[0].id] + if (!this.added) { + if(res[0].children.length){ + this.categoryId = res[0].children[0].id + this.defaultActive = [res[0].children[0].id] + }else{ + this.categoryId = res[0].id + this.defaultActive = [res[0].id] + } + // 取第一个分类的id + this.$nextTick(() => { + this.$refs.type.setCurrentKey(res[0].children[0].id) + }) } - // 取第一个分类的id - this.$nextTick(() => { - this.$refs.type.setCurrentKey(res[0].children[0].id) - }) + this.added = false this.getData() }).catch(res => {}) }, @@ -253,6 +264,7 @@ export default { this.getData() }, addType(row){ + if (row) this.defaultActive = [row.data.id] this.typeVisible = true this.levelId = row ? row.data.id : 0 }, @@ -266,6 +278,7 @@ export default { this.$confirm('确定要删除吗?', '提示', { type: 'warning' }).then(() => { + this.added = true this.$post(`${this.api.deleteCategory}?categoryId=${row.data.id}`).then(res => { this.$message.success('删除成功') this.getType() @@ -275,6 +288,7 @@ export default { confirmType(){ if(this.submited) return false this.submited = true + this.added = true if(this.id){ this.$post(this.api.updateCategory,{ id: this.id, @@ -330,7 +344,6 @@ export default { if(typeof n[i] == 'string' && n[i].endsWith('+0000')) n[i] = this.formatDate('yyyy-MM-dd hh:mm:ss',new Date(n[i])) } }) - console.log(11, data) this.previewData = data if (!isEdit) this.previewVisible = true }).catch(res => {}) diff --git a/src/views/data/Introduce.vue b/src/views/data/Introduce.vue index 69571b0..db0c6c0 100644 --- a/src/views/data/Introduce.vue +++ b/src/views/data/Introduce.vue @@ -25,27 +25,27 @@ -
- 取 消 - 确 定 -

关键字

-
+
- 添加
{{tag.keyword}}
+
+ 取 消 + 确 定 +
@@ -160,6 +160,7 @@ export default { }).then(res => { this.newKeyword = '' this.getKeyword() + this.confirmEdit() }).catch(res => {}) } else { this.$message.error('请输入关键字!') diff --git a/src/views/data/Product.vue b/src/views/data/Product.vue index 4cf09ff..919498f 100644 --- a/src/views/data/Product.vue +++ b/src/views/data/Product.vue @@ -310,7 +310,6 @@ export default { getTable(res) setTimeout(() => { - console.log(11, res) this.typeList = res },500) this.importVisible = true