Compare commits
No commits in common. "be9e78ec7337b718d32e596c9b660b19ca598c8c" and "5d9adab706f5679c9be08ee7e7b342a99555e696" have entirely different histories.
be9e78ec73
...
5d9adab706
|
@ -325,12 +325,3 @@ export function useUserIDGetDoctorID(data) {
|
||||||
data
|
data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// 管理端修改用户角色
|
|
||||||
export function updateUserRoleInfo(data) {
|
|
||||||
return request({
|
|
||||||
url: `/User/updateUserRoleInfo`,
|
|
||||||
method: 'put',
|
|
||||||
data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
@ -85,32 +85,11 @@
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
:disabled="user.CanEditUserType === false || type === 1"
|
:disabled="user.CanEditUserType === false || type === 1"
|
||||||
@change="handleChange"
|
@change="handleChange"
|
||||||
v-if="type === 0"
|
|
||||||
>
|
>
|
||||||
<template v-for="userType of userTypeOptions">
|
<template v-for="(userType, key) of userTypeOptions">
|
||||||
<el-option
|
<el-option
|
||||||
v-if="userType.UserTypeEnum !== 20"
|
v-if="userType.UserTypeEnum !== 20"
|
||||||
:key="userType.Id"
|
:key="key"
|
||||||
:label="userType.UserType"
|
|
||||||
:value="userType.Id"
|
|
||||||
/>
|
|
||||||
</template>
|
|
||||||
</el-select>
|
|
||||||
<el-select
|
|
||||||
ref="userType"
|
|
||||||
v-model="Roles"
|
|
||||||
size="small"
|
|
||||||
placeholder="Please select"
|
|
||||||
multiple
|
|
||||||
style="width: 100%"
|
|
||||||
:disabled="user.CanEditUserType === false || type === 1"
|
|
||||||
@change="handleChange"
|
|
||||||
v-else
|
|
||||||
>
|
|
||||||
<template v-for="userType of userTypeOptions">
|
|
||||||
<el-option
|
|
||||||
v-if="userType.UserTypeEnum !== 20"
|
|
||||||
:key="userType.Id"
|
|
||||||
:label="userType.UserType"
|
:label="userType.UserType"
|
||||||
:value="userType.Id"
|
:value="userType.Id"
|
||||||
/>
|
/>
|
||||||
|
@ -183,10 +162,9 @@
|
||||||
<roleList
|
<roleList
|
||||||
v-if="visible"
|
v-if="visible"
|
||||||
:visible.sync="visible"
|
:visible.sync="visible"
|
||||||
:userId="userId"
|
:list="user.UserRoleList"
|
||||||
:list="userRoleList"
|
:roles.sync="user.Roles"
|
||||||
:userTypeOptions="userTypeOptions"
|
:userTypeOptions="userTypeOptions"
|
||||||
@getRoleList="getRoleList"
|
|
||||||
/>
|
/>
|
||||||
</el-form>
|
</el-form>
|
||||||
</template>
|
</template>
|
||||||
|
@ -215,10 +193,6 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openRoleList() {
|
openRoleList() {
|
||||||
this.userRoleList = []
|
|
||||||
this.user.UserRoleList.forEach((item) => {
|
|
||||||
this.userRoleList.push(Object.assign({}, item))
|
|
||||||
})
|
|
||||||
this.visible = true
|
this.visible = true
|
||||||
},
|
},
|
||||||
handleChange(val) {
|
handleChange(val) {
|
||||||
|
@ -300,33 +274,10 @@ export default {
|
||||||
IdentityUserId: this.userId,
|
IdentityUserId: this.userId,
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
this.user = res.Result
|
this.user = res.Result
|
||||||
this.Roles = []
|
|
||||||
this.user.Roles = []
|
this.user.Roles = []
|
||||||
this.user.UserRoleList = []
|
this.user.UserRoleList = []
|
||||||
res.Result.AccountList.forEach((item) => {
|
res.Result.AccountList.forEach((item) => {
|
||||||
if (!item.IsUserRoleDisabled) {
|
if (!item.IsUserRoleDisabled) {
|
||||||
this.Roles.push(item.UserTypeId)
|
|
||||||
this.user.Roles.push(item.UserTypeId)
|
|
||||||
}
|
|
||||||
this.user.UserRoleList.push({
|
|
||||||
UserTypeEnum: item.UserTypeEnum,
|
|
||||||
UserTypeId: item.UserTypeId,
|
|
||||||
IsUserRoleDisabled: item.IsUserRoleDisabled,
|
|
||||||
UserTypeShortName: item.UserTypeShortName,
|
|
||||||
})
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
getRoleList() {
|
|
||||||
getUser({
|
|
||||||
IdentityUserId: this.userId,
|
|
||||||
}).then((res) => {
|
|
||||||
this.Roles = []
|
|
||||||
this.user.Roles = []
|
|
||||||
this.user.UserRoleList = []
|
|
||||||
res.Result.AccountList.forEach((item) => {
|
|
||||||
if (!item.IsUserRoleDisabled) {
|
|
||||||
this.Roles.push(item.UserTypeId)
|
|
||||||
this.user.Roles.push(item.UserTypeId)
|
this.user.Roles.push(item.UserTypeId)
|
||||||
}
|
}
|
||||||
this.user.UserRoleList.push({
|
this.user.UserRoleList.push({
|
||||||
|
@ -364,8 +315,6 @@ export default {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
userRoleList: [],
|
|
||||||
Roles: [],
|
|
||||||
user: {
|
user: {
|
||||||
Roles: [],
|
Roles: [],
|
||||||
UserRoleList: [],
|
UserRoleList: [],
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
append-to-body
|
append-to-body
|
||||||
|
:show-close="false"
|
||||||
:title="$t('system:userlist:roleList:title')"
|
:title="$t('system:userlist:roleList:title')"
|
||||||
:before-close="cancel"
|
:before-close="cancel"
|
||||||
>
|
>
|
||||||
|
@ -18,12 +19,7 @@
|
||||||
>
|
>
|
||||||
{{ $t('common:button:new') }}
|
{{ $t('common:button:new') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-table
|
<el-table :data="list" style="width: 100%" max-height="300px">
|
||||||
:data="list"
|
|
||||||
style="width: 100%"
|
|
||||||
max-height="300px"
|
|
||||||
v-loading="loading"
|
|
||||||
>
|
|
||||||
<el-table-column type="index" width="40" />
|
<el-table-column type="index" width="40" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
prop="UserTypeShortName"
|
prop="UserTypeShortName"
|
||||||
|
@ -60,13 +56,9 @@
|
||||||
</el-table>
|
</el-table>
|
||||||
<div slot="footer">
|
<div slot="footer">
|
||||||
<!-- 保存 -->
|
<!-- 保存 -->
|
||||||
<el-button type="primary" :loading="loading" size="small" @click="save">
|
<el-button type="primary" size="small" @click="save">
|
||||||
{{ $t('common:button:confirm') }}
|
{{ $t('common:button:confirm') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<!-- 取消 -->
|
|
||||||
<el-button size="small" @click="cancel">
|
|
||||||
{{ $t('common:button:cancel') }}
|
|
||||||
</el-button>
|
|
||||||
</div>
|
</div>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-if="addVisible"
|
v-if="addVisible"
|
||||||
|
@ -111,11 +103,9 @@
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import { updateUserRoleInfo } from '@/api/admin.js'
|
|
||||||
export default {
|
export default {
|
||||||
name: 'roleList',
|
name: 'roleList',
|
||||||
props: {
|
props: {
|
||||||
userId: { type: String, default: '' },
|
|
||||||
visible: {
|
visible: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
|
@ -126,6 +116,12 @@ export default {
|
||||||
return []
|
return []
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
roles: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return []
|
||||||
|
},
|
||||||
|
},
|
||||||
userTypeOptions: {
|
userTypeOptions: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => {
|
default: () => {
|
||||||
|
@ -136,7 +132,6 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
addVisible: false,
|
addVisible: false,
|
||||||
loading: false,
|
|
||||||
form: {
|
form: {
|
||||||
roles: [],
|
roles: [],
|
||||||
},
|
},
|
||||||
|
@ -166,24 +161,15 @@ export default {
|
||||||
openAdd() {
|
openAdd() {
|
||||||
this.addVisible = true
|
this.addVisible = true
|
||||||
},
|
},
|
||||||
async save() {
|
save() {
|
||||||
try {
|
let roles = []
|
||||||
let data = {
|
this.list.forEach((item) => {
|
||||||
Id: this.userId,
|
if (!item.IsUserRoleDisabled) {
|
||||||
UserRoleList: this.list,
|
roles.push(item.UserTypeId)
|
||||||
}
|
}
|
||||||
this.loading = true
|
})
|
||||||
let res = await updateUserRoleInfo(data)
|
this.$emit('update:roles', roles)
|
||||||
this.loading = false
|
this.$emit('update:visible', false)
|
||||||
if (res.IsSuccess) {
|
|
||||||
this.$message.success(this.$t('common:message:updatedSuccessfully'))
|
|
||||||
this.$emit('update:visible', false)
|
|
||||||
this.$emit('getRoleList')
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
this.loading = false
|
|
||||||
console.log(err)
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
async saveAdd() {
|
async saveAdd() {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue