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 store from '@/store'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题 // 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalPush = Router.prototype.push 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) return originalPush.call(this, location).catch(err => err)
} }
@ -42,7 +41,8 @@ export const moduleRoutes = {
meta: { title: '主入口布局' }, meta: { title: '主入口布局' },
children: [ children: [
// todos 临时调整,后期去掉 // 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 } } { 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 { export default {
data () { data () {
return { return {
submitFlag: true,
visible: false, visible: false,
roleList: [], roleList: [],
roleIdListDefault: [], roleIdListDefault: [],
@ -170,6 +171,22 @@ export default {
]).then(() => { ]).then(() => {
if (this.dataForm.id) { if (this.dataForm.id) {
this.getInfo() 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) { if (!valid) {
return false return false
} }
this.dataForm.password = Encrypt(this.dataForm.password) if (this.submitFlag) {
if (this.dataForm.id) { this.submitFlag = false
delete this.dataForm.password this.dataForm.password = Encrypt(this.dataForm.password)
} if (this.dataForm.id) {
this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', { delete this.dataForm.password
...this.dataForm,
roleIdList: [
...this.dataForm.roleIdList,
...this.roleIdListDefault
]
}).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} }
this.$message({ this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/user', {
message: this.$t('prompt.success'), ...this.dataForm,
type: 'success', roleIdList: [
duration: 500, ...this.dataForm.roleIdList,
onClose: () => { ...this.roleIdListDefault
this.visible = false ]
this.$emit('refreshDataList') }).then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg)
} }
}) this.$message({
}).catch(() => {}) 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 }) }, 1000, { leading: true, trailing: false })
} }