From 1c83eedaf6fb58f448a1e51e54c8f3eeb6f0b6df Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Wed, 8 Feb 2023 11:12:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(=E7=99=BB=E5=BD=95):=20=E9=80=80?= =?UTF-8?q?=E5=87=BA=E5=90=8E=E9=87=8D=E6=96=B0=E7=99=BB=E5=BD=95=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E5=88=B0=E5=8E=86=E5=8F=B2=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/layout/components/Topbar.vue | 2 +- frontend/src/permission.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/layout/components/Topbar.vue b/frontend/src/layout/components/Topbar.vue index 0eca5b451d..29ce410ffb 100644 --- a/frontend/src/layout/components/Topbar.vue +++ b/frontend/src/layout/components/Topbar.vue @@ -365,7 +365,7 @@ export default { if (result !== 'success' && result !== 'fail') { window.location.href = result } else { - this.$router.push('/login') + this.$router.push(`/login?redirect=${this.$route.fullPath}`) } }, loadUiInfo() { diff --git a/frontend/src/permission.js b/frontend/src/permission.js index ba89f734a7..c5961184b6 100644 --- a/frontend/src/permission.js +++ b/frontend/src/permission.js @@ -53,7 +53,7 @@ const routeBefore = (callBack) => { callBack() } } -router.beforeEach(async(to, from, next) => routeBefore(() => { +router.beforeEach(async (to, from, next) => routeBefore(() => { // start progress bar NProgress.start() const mobileIgnores = ['/delink'] @@ -118,8 +118,7 @@ router.beforeEach(async(to, from, next) => routeBefore(() => { next() } else { // other pages that do not have permission to access are redirected to the login page. - // next(`/login?redirect=${to.path}`) - next('/login') + next(`/login?redirect=${to.path}`) NProgress.done() } } From 9e5daa101ffcf112392817579d37dd278e751b99 Mon Sep 17 00:00:00 2001 From: wisonic-s Date: Wed, 8 Feb 2023 14:02:23 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(=E8=A1=80=E7=BC=98=E5=85=B3=E7=B3=BB):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E8=A1=80=E7=BC=98=E5=85=B3=E7=B3=BB?= =?UTF-8?q?=E6=A8=A1=E7=B3=8A=E6=90=9C=E7=B4=A2=E5=90=8E=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=A4=B9=E6=A8=A1=E7=B3=8A=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E6=B6=88=E5=A4=B1=20https://www.tapd.cn/5557?= =?UTF-8?q?8866/bugtrace/bugs/view/1155578866001022202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/system/relationship/index.vue | 83 +++++++++---------- 1 file changed, 41 insertions(+), 42 deletions(-) diff --git a/frontend/src/views/system/relationship/index.vue b/frontend/src/views/system/relationship/index.vue index d96ac23586..3d31a03fcf 100644 --- a/frontend/src/views/system/relationship/index.vue +++ b/frontend/src/views/system/relationship/index.vue @@ -7,7 +7,6 @@
- - - + v-model="querySelected" + :placeholder="queryPlaceholder" + @click.native.stop="showTree = true" + @input="onQueryInput" + @focus="onQueryFocus" + /> @@ -186,10 +177,6 @@ export default { queryType: 'datasource', dataSourceName: '' }, - rules: { - queryType: [{ required: true, trigger: 'blur' }], - dataSourceName: [{ required: true, trigger: 'blur', message: this.$t('chart.name_can_not_empty') }] - }, queryTypeNameList: [ { label: 'commons.datasource', @@ -218,11 +205,13 @@ export default { total: 0 }, resourceTreeData: [], - ignoredOptions: [], showTree: false, nodeData: {}, popoverSize: 400, - currentNode: {} + currentNode: {}, + querySelected: '', + queryPlaceholder: '', + errorMsg: '' } }, computed: { @@ -271,7 +260,9 @@ export default { data, activeQueryType(activeIcon) { this.activeIcon = activeIcon - this.onSubmit() + if (this.formInline.dataSourceName) { + this.onSubmit() + } }, async searchDetail(id, queryType, name) { switch (queryType) { @@ -289,7 +280,7 @@ export default { } this.formInline = { queryType, dataSourceName: id } this.nodeData = { id, name } - this.ignoredOptions = [this.nodeData] + this.querySelected = this.queryPlaceholder = name this.$refs.resourceTree.setCurrentKey(id) const currentParents = this.$refs.resourceTree.getNodePath(this.nodeData) currentParents.forEach((node) => { @@ -438,6 +429,7 @@ export default { this.resourceTreeData = [] this.nodeData = {} this.currentNode = {} + this.querySelected = this.queryPlaceholder = '' switch (val) { case 'datasource': { this.listDatasource() @@ -456,15 +448,16 @@ export default { } }, onSubmit() { - this.$refs.form.validate((valid) => { - if (valid) { - if (this.activeIcon === 'date') { - this.getChartData() - } else { - this.$refs.consanguinity.getChartData(this.current) - } - } - }) + if (!this.formInline.dataSourceName) { + this.errorMsg = this.$t('chart.name_can_not_empty') + return + } + this.errorMsg = '' + if (this.activeIcon === 'date') { + this.getChartData() + } else { + this.$refs.consanguinity.getChartData(this.current) + } }, handleSizeChange(pageSize) { this.paginationConfig.currentPage = 1 @@ -528,32 +521,38 @@ export default { } return data.name.toLowerCase().indexOf(value.toLowerCase()) !== -1 }, - filterMethod(filterText) { + onQueryInput(filterText) { this.$refs.resourceTree.filter(filterText) }, + onQueryFocus() { + this.querySelected = '' + }, nodeClick(data, node) { if (node.isLeaf) { - this.ignoredOptions = [{ id: data.id, name: data.name }] this.formInline.dataSourceName = data.id this.showTree = false this.nodeData = data this.currentNode = node + this.querySelected = this.queryPlaceholder = data.name + this.errorMsg = '' } }, resetFilter() { if (this.showTree) { this.showTree = false + this.querySelected = this.queryPlaceholder = this.nodeData.name this.$refs.resourceTree.filter() this.$refs.resourceTree.setCurrentKey(this.formInline.dataSourceName) if (this.formInline.dataSourceName === '') { this.$refs.resourceTree.setCurrentKey(null) } + const nodesMap = this.$refs.resourceTree.store.nodesMap || {} + let currentParents = [] if (this.formInline.dataSourceName) { - const currentParents = this.$refs.resourceTree.getNodePath(this.nodeData).map((item) => item.id) - const nodesMap = this.$refs.resourceTree.store.nodesMap || {} - for (const key in nodesMap) { - nodesMap[key].expanded = currentParents.includes(key) - } + currentParents = this.$refs.resourceTree.getNodePath(this.nodeData).map((item) => item.id) + } + for (const key in nodesMap) { + nodesMap[key].expanded = currentParents.includes(key) } } }