BUG修改

This commit is contained in:
a0049873 2022-07-28 17:12:30 +08:00
parent e47d7cf470
commit fc524a6b43
2 changed files with 46 additions and 25 deletions

View File

@ -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 } }
]
}

View File

@ -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 })
}