From 2b40bb0620db566e54fd4305d3c3ab21d13a3435 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Mon, 26 Jul 2021 10:09:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BA=A7=E5=93=81=E5=8F=8A=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9E=B6=E6=9E=84=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Header.vue | 1 - src/views/data/Framework.vue | 97 ++++++++++++++++++++++++------------ src/views/data/Product.vue | 16 ++++-- 3 files changed, 77 insertions(+), 37 deletions(-) diff --git a/src/components/Header.vue b/src/components/Header.vue index edeb954..4977b33 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -28,7 +28,6 @@ export default { methods: { getUserInfo(){ this.$get(this.api.queryUserInfoDetails).then(res => { - console.log(res,'头像处理'); let userInfo = res.result.hrUserInfo if(userInfo.userAvatars) this.$store.commit('userAvatar',{avatar: userInfo.userAvatars}) this.userName = userInfo.userName diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index 60b3887..af459fa 100644 --- a/src/views/data/Framework.vue +++ b/src/views/data/Framework.vue @@ -5,9 +5,9 @@
- + - {{ node.label }} + {{ node.label }} @@ -60,10 +60,14 @@
- +
+
+

+ 预览 +
@@ -112,6 +116,7 @@ export default { updateTime: '', importVisible: false, defaultTypeActive: [], + defaultTypeChecked: [], listData: [], keyword: '', page: 1, @@ -119,6 +124,7 @@ export default { total: 0, multipleSelection: [], importTypeList: [], + importTypeIndex: 10000, fieldData: [], fieldHead: [], tableName: '', @@ -126,7 +132,8 @@ export default { categoryIndex: 0, previewVisible: false, previewHead: [], - previewData: [] + previewData: [], + submited: false, }; }, watch: { @@ -164,7 +171,9 @@ export default { this.categoryId = res[0].id this.defaultActive = [res[0].id] } - + this.$nextTick(() => { + this.$refs.type.setCurrentKey(res[0].children[0].id) + }) this.getData() }).catch(res => {}) }, @@ -285,14 +294,17 @@ export default { } }, getTable(n,i){ - this.$post(`${this.api.originalListById}?categoryId=${n.id}&showName=&pageNum=1&pageSize=10000`).then(res => { + this.$post(`${this.api.originalListById}?categoryId=${n.realId}&showName=&pageNum=1&pageSize=10000`).then(res => { res.list.map(n => { n.label = n.showName n.id = String(n.id) + if(this.defaultTypeChecked.includes(n.id)){ + n.disabled = true + } }) + n.children = res.list if(!i && !this.tableName){ - this.defaultTypeActive = [res.list[0].id] this.tableName = res.list[0].name this.curId = res.list[0].id } @@ -301,35 +313,48 @@ export default { batchImport(){ this.$post(this.api.originalList).then(res => { res.map(n => { - n.id = String(n.id) + this.importTypeIndex++ + n.realId = n.id + n.id = String(this.importTypeIndex + n.id) n.label = n.categoryName n.children.map(n => { - n.id = String(n.id) + n.realId = n.id + this.importTypeIndex++ + n.id = String(this.importTypeIndex + n.id) n.label = n.categoryName n.children.map(n => { - n.id = String(n.id) + this.importTypeIndex++ + n.realId = n.id + n.id = String(this.importTypeIndex + n.id) n.label = n.categoryName n.isThird = true }) }) }) - res.map((n,i) => { - if(n.children.length){ - n.children.map(n => { - if(n.children.length){ - n.children.map(n => this.getTable(n,i)) - }else{ - this.getTable(n,i) - } - }) - }else{ - this.getTable(n,i) - } - }) - setTimeout(() => { - this.importTypeList = res - this.getFields() - },500) + this.$post(`${this.api.getIdQueryTable}?categoryId=${this.categoryId}&showName=${this.keyword}&pageNum=1&pageSize=10000&updateTime=${this.updateTime ? this.updateTime : ''}`).then(res1 => { + this.defaultTypeChecked = res1.list.map(n => n.copyId) + + res.map((n,i) => { + if(n.children.length){ + n.children.map(n => { + if(n.children.length){ + n.children.map(n => this.getTable(n,i)) + }else{ + this.getTable(n,i) + } + }) + }else{ + this.getTable(n,i) + } + }) + setTimeout(() => { + this.importTypeList = res + this.defaultTypeActive = [res[0].id] + if(res[0].children.length) this.defaultTypeActive.push(res[0].children[0].id) + this.getFields() + },500) + }).catch(res => {}) + this.importVisible = true }).catch(res => {}) }, @@ -349,7 +374,6 @@ export default { } }) this.fieldData = data - console.log(data,'data'); }).catch(res => {}) this.importVisible = true }, @@ -361,19 +385,23 @@ export default { } }, closeImport(){ - + this.$refs.typeTree.setCheckedKeys([]) }, confirmImport(){ + if(this.submited) return false let list = this.$refs.typeTree.getCheckedNodes() let names = [] let showNames = [] list.map(n => { - if(n.name){ + if(n.name && !n.disabled){ names.push(n.name) showNames.push(n.showName) } }) + console.log(11,names,showNames) if(!names.length) return this.$message.warning('请选择数据') + + this.submited = true let data = [] let categoryId = Number(this.categoryId) names.map((n,i) => { @@ -385,9 +413,14 @@ export default { }) this.$post(this.api.saveTable,data).then(res => { this.$message.success('导入成功') - this.getType() + this.getData() this.importVisible = false - }).catch(res => {}) + setTimeout(() => { + this.submited = false + },1000) + }).catch(res => { + this.submited = false + }) }, } }; diff --git a/src/views/data/Product.vue b/src/views/data/Product.vue index cf20b91..e77e358 100644 --- a/src/views/data/Product.vue +++ b/src/views/data/Product.vue @@ -71,7 +71,7 @@ - + @@ -82,7 +82,11 @@ 配置数据权限 - + + + {{ node.label }} + + @@ -94,7 +98,11 @@ - + + + {{ node.label }} + + @@ -166,7 +174,7 @@ export default { }], page: 1, pageSize: 10, - totals: 1, + totals: 0, productVisible: false, id: '', userId: '', From 4048df003192a1a2233493c23d366ccc465c8d54 Mon Sep 17 00:00:00 2001 From: yujialong <479214531@qq.com> Date: Mon, 26 Jul 2021 11:50:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/data/Framework.vue | 20 ++++++++++---------- src/views/user/User.vue | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/views/data/Framework.vue b/src/views/data/Framework.vue index af459fa..9c40f78 100644 --- a/src/views/data/Framework.vue +++ b/src/views/data/Framework.vue @@ -21,7 +21,7 @@
- + @@ -41,7 +41,7 @@ {{scope.row.dataSize}}M - +