|
@@ -72,9 +72,13 @@
|
|
|
<CzrFormColumn
|
|
|
:span="12"
|
|
|
label="角色"
|
|
|
- v-model:param="state.form.roles"
|
|
|
+ v-model:param="state.roles"
|
|
|
link="select"
|
|
|
- :options="[]"
|
|
|
+ :options="state.roleOptions"
|
|
|
+ labelKey="roleName"
|
|
|
+ valueKey="id"
|
|
|
+ multiple
|
|
|
+ @getObject="(arr) => (state.form.roleEntities = arr)"
|
|
|
/>
|
|
|
<CzrFormColumn
|
|
|
:span="24"
|
|
@@ -108,6 +112,7 @@ import {
|
|
|
import { useRouter } from 'vue-router'
|
|
|
import { Edit } from '@element-plus/icons-vue'
|
|
|
import { userAdd, userDetail, userEdit } from '@/api/modules/center/user'
|
|
|
+import { rolesPage } from '@/api/modules/center/role'
|
|
|
|
|
|
const router = useRouter()
|
|
|
const AppStore = useAppStore()
|
|
@@ -124,6 +129,8 @@ const state: any = reactive({
|
|
|
loading: false,
|
|
|
form: {},
|
|
|
editPassword: false,
|
|
|
+ roleOptions: [],
|
|
|
+ roles: [],
|
|
|
})
|
|
|
const ref_form = ref()
|
|
|
const titleCpt = computed(() => {
|
|
@@ -150,6 +157,7 @@ watch(
|
|
|
state.form = {
|
|
|
enabled: true,
|
|
|
}
|
|
|
+ state.roles = []
|
|
|
state.editPassword = true
|
|
|
if (props.transfer.mode !== 'add') {
|
|
|
state.editPassword = false
|
|
@@ -161,12 +169,19 @@ watch(
|
|
|
}
|
|
|
},
|
|
|
)
|
|
|
-const initDictionary = () => {}
|
|
|
+const initDictionary = () => {
|
|
|
+ if (state.roleOptions.length === 0) {
|
|
|
+ rolesPage({ page: 1, size: 100000 }).then(({ data }: any) => {
|
|
|
+ state.roleOptions = data.content || []
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
const initData = () => {
|
|
|
state.loading = true
|
|
|
userDetail(props.transfer.id)
|
|
|
.then(({ data }: any) => {
|
|
|
state.form = data
|
|
|
+ state.roles = state.form.roleEntities.map((v) => v.id)
|
|
|
})
|
|
|
.catch(() => {})
|
|
|
.finally(() => {
|