diff --git a/back/src/router/index.js b/back/src/router/index.js index b2f3777e..c386dc1b 100644 --- a/back/src/router/index.js +++ b/back/src/router/index.js @@ -5,10 +5,9 @@ import { isURL } from '@/utils/validate' import store from '@/store' import Cookies from 'js-cookie' - // 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题 const originalPush = Router.prototype.push -Router.prototype.push = function push(location) { +Router.prototype.push = function push (location) { return originalPush.call(this, location).catch(err => err) } @@ -42,7 +41,8 @@ export const moduleRoutes = { meta: { title: '主入口布局' }, children: [ // todos 临时调整,后期去掉 - { path: '/home', redirect: '/bscatalogue-bscatalogue', component: () => import('@/views/modules/home'), name: 'home', meta: { title: '首页', isTab: true } }, + // { path: '/home', redirect: '/bscatalogue-bscatalogue', component: () => import('@/views/modules/home'), name: 'home', meta: { title: '首页', isTab: true } }, + { path: '/home', redirect: '/workBench-workBench', component: () => import('@/views/modules/home'), name: 'home', meta: { title: '首页', isTab: true } }, { path: '/iframe', component: null, name: 'iframe', meta: { title: 'iframe', isTab: true } } ] } diff --git a/back/src/views/modules/sys/user-add-or-update.vue b/back/src/views/modules/sys/user-add-or-update.vue index e8537498..c366c760 100644 --- a/back/src/views/modules/sys/user-add-or-update.vue +++ b/back/src/views/modules/sys/user-add-or-update.vue @@ -56,6 +56,7 @@ import { isEmail, isMobile } from '@/utils/validate' export default { data () { return { + submitFlag: true, visible: false, roleList: [], roleIdListDefault: [], @@ -170,6 +171,22 @@ export default { ]).then(() => { if (this.dataForm.id) { this.getInfo() + } else { + this.dataForm = { + id: '', + username: '', + deptId: '', + deptName: '', + password: '', + confirmPassword: '', + realName: '', + gender: 0, + email: '', + mobile: '', + roleIdList: [], + postIdList: [], + status: 1 + } } }) }) @@ -219,30 +236,34 @@ export default { if (!valid) { return false } - this.dataForm.password = Encrypt(this.dataForm.password) - if (this.dataForm.id) { - delete this.dataForm.password - } - this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', { - ...this.dataForm, - roleIdList: [ - ...this.dataForm.roleIdList, - ...this.roleIdListDefault - ] - }).then(({ data: res }) => { - if (res.code !== 0) { - return this.$message.error(res.msg) + if (this.submitFlag) { + this.submitFlag = false + this.dataForm.password = Encrypt(this.dataForm.password) + if (this.dataForm.id) { + delete this.dataForm.password } - this.$message({ - message: this.$t('prompt.success'), - type: 'success', - duration: 500, - onClose: () => { - this.visible = false - this.$emit('refreshDataList') + this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', { + ...this.dataForm, + roleIdList: [ + ...this.dataForm.roleIdList, + ...this.roleIdListDefault + ] + }).then(({ data: res }) => { + if (res.code !== 0) { + return this.$message.error(res.msg) } - }) - }).catch(() => {}) + this.$message({ + message: this.$t('prompt.success'), + type: 'success', + duration: 500, + onClose: () => { + this.visible = false + this.$emit('refreshDataList') + } + }) + this.submitFlag = true + }).catch(() => {}) + } }) }, 1000, { leading: true, trailing: false }) }