From eaaa09d6d50c9175a409f2b29899a9812c1fe6f2 Mon Sep 17 00:00:00 2001 From: pnoker Date: Sun, 9 Jan 2022 22:55:37 +0800 Subject: [PATCH] feat(ui): improve layout and detail display across all entity card views --- src/components/layout/Layout.vue | 4 +- src/views/application/ApplicationCard.vue | 4 +- src/views/dashboard/DashboardCard.vue | 4 +- src/views/device/DeviceCard.vue | 8 +++- src/views/device/DeviceDetail.vue | 4 +- src/views/device/DeviceEdit.vue | 8 +++- src/views/driver/DriverCard.vue | 47 +++++++++++++++-------- src/views/driver/DriverDetail.vue | 24 +++++++++++- src/views/gateway/GatewayCard.vue | 4 +- src/views/gateway/GatewayDetail.vue | 4 +- src/views/point/PointCard.vue | 8 +++- src/views/point/PointDetail.vue | 4 +- src/views/point/PointEdit.vue | 8 +++- src/views/point/info/PointInfoCard.vue | 2 +- src/views/profile/ProfileCard.vue | 8 +++- src/views/profile/ProfileDetail.vue | 4 +- src/views/profile/ProfileEdit.vue | 8 +++- 17 files changed, 116 insertions(+), 37 deletions(-) diff --git a/src/components/layout/Layout.vue b/src/components/layout/Layout.vue index cf9dfcde0..da4013e04 100644 --- a/src/components/layout/Layout.vue +++ b/src/components/layout/Layout.vue @@ -71,7 +71,9 @@ }, handleCommand(command) { if (command === 'logout') { - this.$store.dispatch('ClearToken').then(() => this.$router.push('/login')); + this.$store.dispatch('ClearToken').then(() => this.$router.push('/login')) + .catch(() => { + }); } else if (command === 'help') { window.open('https://doc.dc3.site'); } diff --git a/src/views/application/ApplicationCard.vue b/src/views/application/ApplicationCard.vue index 034061a92..451399d9c 100644 --- a/src/views/application/ApplicationCard.vue +++ b/src/views/application/ApplicationCard.vue @@ -41,7 +41,9 @@ methods: { show() { if (this.url) { - this.$router.push({name: 'application', query: {id: encode(this.url)}}); + this.$router.push({name: 'application', query: {id: encode(this.url)}}) + .catch(() => { + }); } } } diff --git a/src/views/dashboard/DashboardCard.vue b/src/views/dashboard/DashboardCard.vue index b47c193f7..71264c39d 100644 --- a/src/views/dashboard/DashboardCard.vue +++ b/src/views/dashboard/DashboardCard.vue @@ -41,7 +41,9 @@ methods: { show() { if (this.url) { - this.$router.push({name: 'dashboard', query: {id: encode(this.url)}}); + this.$router.push({name: 'dashboard', query: {id: encode(this.url)}}) + .catch(() => { + }); } } } diff --git a/src/views/device/DeviceCard.vue b/src/views/device/DeviceCard.vue index 1f00cf862..bdbf1b7d4 100644 --- a/src/views/device/DeviceCard.vue +++ b/src/views/device/DeviceCard.vue @@ -120,10 +120,14 @@ }); }, edit(id, driverId) { - this.$router.push({name: 'deviceEdit', query: {id, driverId, active: '0'}}); + this.$router.push({name: 'deviceEdit', query: {id, driverId, active: '0'}}) + .catch(() => { + }); }, detail(id, driverId) { - this.$router.push({name: 'deviceDetail', query: {id, driverId, active: 'detail'}}); + this.$router.push({name: 'deviceDetail', query: {id, driverId, active: 'detail'}}) + .catch(() => { + }); }, copyId(content) { setCopyContent(content, true, '设备ID'); diff --git a/src/views/device/DeviceDetail.vue b/src/views/device/DeviceDetail.vue index 3849455b5..cdb6086b4 100644 --- a/src/views/device/DeviceDetail.vue +++ b/src/views/device/DeviceDetail.vue @@ -280,7 +280,9 @@ }, changeActive(tab) { let query = this.$route.query; - this.$router.push({query: {...query, active: tab.name}}); + this.$router.push({query: {...query, active: tab.name}}) + .catch(() => { + }); }, copyId(content) { setCopyContent(content, true, '设备ID'); diff --git a/src/views/device/DeviceEdit.vue b/src/views/device/DeviceEdit.vue index a6eba2072..ea434aafb 100644 --- a/src/views/device/DeviceEdit.vue +++ b/src/views/device/DeviceEdit.vue @@ -523,7 +523,9 @@ } this.active += step; if (this.active > 2) { - this.$router.push({name: 'device'}); + this.$router.push({name: 'device'}) + .catch(() => { + }); } else { this.changeActive(this.active); } @@ -539,7 +541,9 @@ }, changeActive(step) { let query = this.$route.query; - this.$router.push({query: {...query, active: step}}); + this.$router.push({query: {...query, active: step}}) + .catch(() => { + }); } } }; diff --git a/src/views/driver/DriverCard.vue b/src/views/driver/DriverCard.vue index fbc4153e8..c433d1b1f 100644 --- a/src/views/driver/DriverCard.vue +++ b/src/views/driver/DriverCard.vue @@ -1,11 +1,11 @@