Commit f841ca11a5d047f43a9b031fe003756f72a6bca9
1 parent
1bdde35d
fix: form solts
Showing
9 changed files
with
20 additions
and
55 deletions
yudao-ui-admin-vue3/src/views/Profile/components/BasicInfo.vue
| 1 | <template> | 1 | <template> |
| 2 | <Form ref="formRef" :rules="rules" :schema="schema" :labelWidth="80"> | 2 | <Form ref="formRef" :rules="rules" :schema="schema" :labelWidth="80"> |
| 3 | - <template #sex> | ||
| 4 | - <el-radio-group v-model="sexVlue"> | 3 | + <template #sex="form"> |
| 4 | + <el-radio-group v-model="form['sex']"> | ||
| 5 | <el-radio :label="1">{{ t('profile.user.man') }}</el-radio> | 5 | <el-radio :label="1">{{ t('profile.user.man') }}</el-radio> |
| 6 | <el-radio :label="2">{{ t('profile.user.woman') }}</el-radio> | 6 | <el-radio :label="2">{{ t('profile.user.woman') }}</el-radio> |
| 7 | </el-radio-group> | 7 | </el-radio-group> |
| @@ -67,7 +67,6 @@ const schema = reactive<FormSchema[]>([ | @@ -67,7 +67,6 @@ const schema = reactive<FormSchema[]>([ | ||
| 67 | value: 0 | 67 | value: 0 |
| 68 | } | 68 | } |
| 69 | ]) | 69 | ]) |
| 70 | -const sexVlue = ref<number>() | ||
| 71 | const formRef = ref<FormExpose>() // 表单 Ref | 70 | const formRef = ref<FormExpose>() // 表单 Ref |
| 72 | const submit = () => { | 71 | const submit = () => { |
| 73 | const elForm = unref(formRef)?.getElFormRef() | 72 | const elForm = unref(formRef)?.getElFormRef() |
| @@ -75,7 +74,6 @@ const submit = () => { | @@ -75,7 +74,6 @@ const submit = () => { | ||
| 75 | elForm.validate(async (valid) => { | 74 | elForm.validate(async (valid) => { |
| 76 | if (valid) { | 75 | if (valid) { |
| 77 | const data = unref(formRef)?.formModel as UserProfileUpdateReqVO | 76 | const data = unref(formRef)?.formModel as UserProfileUpdateReqVO |
| 78 | - data.sex = sexVlue.value as unknown as number | ||
| 79 | await updateUserProfileApi(data) | 77 | await updateUserProfileApi(data) |
| 80 | ElMessage.success(t('common.updateSuccess')) | 78 | ElMessage.success(t('common.updateSuccess')) |
| 81 | await init() | 79 | await init() |
| @@ -84,7 +82,6 @@ const submit = () => { | @@ -84,7 +82,6 @@ const submit = () => { | ||
| 84 | } | 82 | } |
| 85 | const init = async () => { | 83 | const init = async () => { |
| 86 | const res = await getUserProfileApi() | 84 | const res = await getUserProfileApi() |
| 87 | - sexVlue.value = res.sex | ||
| 88 | unref(formRef)?.setValues(res) | 85 | unref(formRef)?.setValues(res) |
| 89 | } | 86 | } |
| 90 | onMounted(async () => { | 87 | onMounted(async () => { |
yudao-ui-admin-vue3/src/views/bpm/group/index.vue
| @@ -29,7 +29,6 @@ const dialogTitle = ref('edit') // 弹出层标题 | @@ -29,7 +29,6 @@ const dialogTitle = ref('edit') // 弹出层标题 | ||
| 29 | const formRef = ref<FormExpose>() // 表单 Ref | 29 | const formRef = ref<FormExpose>() // 表单 Ref |
| 30 | 30 | ||
| 31 | // ========== 用户选择 ========== | 31 | // ========== 用户选择 ========== |
| 32 | -const userIds = ref<number[]>([]) | ||
| 33 | const userOptions = ref<UserVO[]>([]) | 32 | const userOptions = ref<UserVO[]>([]) |
| 34 | const getUserOptions = async () => { | 33 | const getUserOptions = async () => { |
| 35 | const res = await getListSimpleUsersApi() | 34 | const res = await getListSimpleUsersApi() |
| @@ -46,7 +45,6 @@ const setDialogTile = (type: string) => { | @@ -46,7 +45,6 @@ const setDialogTile = (type: string) => { | ||
| 46 | // 新增操作 | 45 | // 新增操作 |
| 47 | const handleCreate = () => { | 46 | const handleCreate = () => { |
| 48 | setDialogTile('create') | 47 | setDialogTile('create') |
| 49 | - userIds.value = [] | ||
| 50 | } | 48 | } |
| 51 | 49 | ||
| 52 | // 修改操作 | 50 | // 修改操作 |
| @@ -54,7 +52,6 @@ const handleUpdate = async (row: UserGroupVO) => { | @@ -54,7 +52,6 @@ const handleUpdate = async (row: UserGroupVO) => { | ||
| 54 | setDialogTile('update') | 52 | setDialogTile('update') |
| 55 | // 设置数据 | 53 | // 设置数据 |
| 56 | const res = await UserGroupApi.getUserGroupApi(row.id) | 54 | const res = await UserGroupApi.getUserGroupApi(row.id) |
| 57 | - userIds.value = res.memberUserIds | ||
| 58 | unref(formRef)?.setValues(res) | 55 | unref(formRef)?.setValues(res) |
| 59 | } | 56 | } |
| 60 | 57 | ||
| @@ -68,7 +65,6 @@ const submitForm = async () => { | @@ -68,7 +65,6 @@ const submitForm = async () => { | ||
| 68 | // 提交请求 | 65 | // 提交请求 |
| 69 | try { | 66 | try { |
| 70 | const data = unref(formRef)?.formModel as UserGroupVO | 67 | const data = unref(formRef)?.formModel as UserGroupVO |
| 71 | - data.memberUserIds = userIds.value | ||
| 72 | if (actionType.value === 'create') { | 68 | if (actionType.value === 'create') { |
| 73 | await UserGroupApi.createUserGroupApi(data) | 69 | await UserGroupApi.createUserGroupApi(data) |
| 74 | ElMessage.success(t('common.createSuccess')) | 70 | ElMessage.success(t('common.createSuccess')) |
| @@ -183,8 +179,8 @@ onMounted(async () => { | @@ -183,8 +179,8 @@ onMounted(async () => { | ||
| 183 | :rules="rules" | 179 | :rules="rules" |
| 184 | ref="formRef" | 180 | ref="formRef" |
| 185 | > | 181 | > |
| 186 | - <template #memberUserIds> | ||
| 187 | - <el-select v-model="userIds" multiple> | 182 | + <template #memberUserIds="form"> |
| 183 | + <el-select v-model="form['memberUserIds']" multiple> | ||
| 188 | <el-option | 184 | <el-option |
| 189 | v-for="item in userOptions" | 185 | v-for="item in userOptions" |
| 190 | :key="item.id" | 186 | :key="item.id" |
yudao-ui-admin-vue3/src/views/infra/job/index.vue
| @@ -93,8 +93,8 @@ | @@ -93,8 +93,8 @@ | ||
| 93 | :rules="rules" | 93 | :rules="rules" |
| 94 | ref="formRef" | 94 | ref="formRef" |
| 95 | > | 95 | > |
| 96 | - <template #cronExpression> | ||
| 97 | - <Crontab v-model="cronExpression" :shortcuts="shortcuts" /> | 96 | + <template #cronExpression="form"> |
| 97 | + <Crontab v-model="form['cronExpression']" :shortcuts="shortcuts" /> | ||
| 98 | </template> | 98 | </template> |
| 99 | </Form> | 99 | </Form> |
| 100 | <!-- 对话框(详情) --> | 100 | <!-- 对话框(详情) --> |
| @@ -162,7 +162,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | @@ -162,7 +162,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | ||
| 162 | const dialogTitle = ref('edit') // 弹出层标题 | 162 | const dialogTitle = ref('edit') // 弹出层标题 |
| 163 | const formRef = ref<FormExpose>() // 表单 Ref | 163 | const formRef = ref<FormExpose>() // 表单 Ref |
| 164 | const detailRef = ref() // 详情 Ref | 164 | const detailRef = ref() // 详情 Ref |
| 165 | -const cronExpression = ref('') | ||
| 166 | const nextTimes = ref([]) | 165 | const nextTimes = ref([]) |
| 167 | const shortcuts = ref([ | 166 | const shortcuts = ref([ |
| 168 | { | 167 | { |
| @@ -179,7 +178,6 @@ const setDialogTile = (type: string) => { | @@ -179,7 +178,6 @@ const setDialogTile = (type: string) => { | ||
| 179 | 178 | ||
| 180 | // 新增操作 | 179 | // 新增操作 |
| 181 | const handleCreate = () => { | 180 | const handleCreate = () => { |
| 182 | - cronExpression.value = '' | ||
| 183 | setDialogTile('create') | 181 | setDialogTile('create') |
| 184 | } | 182 | } |
| 185 | 183 | ||
| @@ -193,7 +191,6 @@ const handleUpdate = async (rowId: number) => { | @@ -193,7 +191,6 @@ const handleUpdate = async (rowId: number) => { | ||
| 193 | setDialogTile('update') | 191 | setDialogTile('update') |
| 194 | // 设置数据 | 192 | // 设置数据 |
| 195 | const res = await JobApi.getJobApi(rowId) | 193 | const res = await JobApi.getJobApi(rowId) |
| 196 | - cronExpression.value = res.cronExpression | ||
| 197 | unref(formRef)?.setValues(res) | 194 | unref(formRef)?.setValues(res) |
| 198 | } | 195 | } |
| 199 | 196 | ||
| @@ -305,7 +302,6 @@ const submitForm = async () => { | @@ -305,7 +302,6 @@ const submitForm = async () => { | ||
| 305 | // 提交请求 | 302 | // 提交请求 |
| 306 | try { | 303 | try { |
| 307 | const data = unref(formRef)?.formModel as JobApi.JobVO | 304 | const data = unref(formRef)?.formModel as JobApi.JobVO |
| 308 | - data.cronExpression = cronExpression.value | ||
| 309 | if (actionType.value === 'create') { | 305 | if (actionType.value === 'create') { |
| 310 | await JobApi.createJobApi(data) | 306 | await JobApi.createJobApi(data) |
| 311 | message.success(t('common.createSuccess')) | 307 | message.success(t('common.createSuccess')) |
yudao-ui-admin-vue3/src/views/system/dept/index.vue
| @@ -38,20 +38,19 @@ | @@ -38,20 +38,19 @@ | ||
| 38 | <!-- 添加或修改菜单对话框 --> | 38 | <!-- 添加或修改菜单对话框 --> |
| 39 | <XModal id="deptModel" v-model="dialogVisible" :title="dialogTitle"> | 39 | <XModal id="deptModel" v-model="dialogVisible" :title="dialogTitle"> |
| 40 | <!-- 对话框(添加 / 修改) --> | 40 | <!-- 对话框(添加 / 修改) --> |
| 41 | - <!-- 操作工具栏 --> | ||
| 42 | <Form ref="formRef" :schema="allSchemas.formSchema" :rules="rules"> | 41 | <Form ref="formRef" :schema="allSchemas.formSchema" :rules="rules"> |
| 43 | - <template #parentId> | 42 | + <template #parentId="form"> |
| 44 | <el-tree-select | 43 | <el-tree-select |
| 45 | node-key="id" | 44 | node-key="id" |
| 46 | - v-model="deptParentId" | 45 | + v-model="form['parentId']" |
| 47 | :props="defaultProps" | 46 | :props="defaultProps" |
| 48 | :data="deptOptions" | 47 | :data="deptOptions" |
| 49 | :default-expanded-keys="[100]" | 48 | :default-expanded-keys="[100]" |
| 50 | check-strictly | 49 | check-strictly |
| 51 | /> | 50 | /> |
| 52 | </template> | 51 | </template> |
| 53 | - <template #leaderUserId> | ||
| 54 | - <el-select v-model="leaderUserId"> | 52 | + <template #leaderUserId="form"> |
| 53 | + <el-select v-model="form['leaderUserId']"> | ||
| 55 | <el-option | 54 | <el-option |
| 56 | v-for="item in userOption" | 55 | v-for="item in userOption" |
| 57 | :key="item.id" | 56 | :key="item.id" |
| @@ -105,8 +104,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | @@ -105,8 +104,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | ||
| 105 | const dialogTitle = ref('edit') // 弹出层标题 | 104 | const dialogTitle = ref('edit') // 弹出层标题 |
| 106 | const actionType = ref('') // 操作按钮的类型 | 105 | const actionType = ref('') // 操作按钮的类型 |
| 107 | const actionLoading = ref(false) // 遮罩层 | 106 | const actionLoading = ref(false) // 遮罩层 |
| 108 | -const deptParentId = ref(0) // 上级ID | ||
| 109 | -const leaderUserId = ref() | ||
| 110 | const formRef = ref<FormExpose>() // 表单 Ref | 107 | const formRef = ref<FormExpose>() // 表单 Ref |
| 111 | const deptOptions = ref() // 树形结构 | 108 | const deptOptions = ref() // 树形结构 |
| 112 | const userOption = ref<UserVO[]>([]) | 109 | const userOption = ref<UserVO[]>([]) |
| @@ -154,8 +151,6 @@ const setDialogTile = (type: string) => { | @@ -154,8 +151,6 @@ const setDialogTile = (type: string) => { | ||
| 154 | 151 | ||
| 155 | // 新增操作 | 152 | // 新增操作 |
| 156 | const handleCreate = async () => { | 153 | const handleCreate = async () => { |
| 157 | - deptParentId.value = 0 | ||
| 158 | - leaderUserId.value = null | ||
| 159 | setDialogTile('create') | 154 | setDialogTile('create') |
| 160 | } | 155 | } |
| 161 | 156 | ||
| @@ -164,8 +159,6 @@ const handleUpdate = async (rowId: number) => { | @@ -164,8 +159,6 @@ const handleUpdate = async (rowId: number) => { | ||
| 164 | setDialogTile('update') | 159 | setDialogTile('update') |
| 165 | // 设置数据 | 160 | // 设置数据 |
| 166 | const res = await DeptApi.getDeptApi(rowId) | 161 | const res = await DeptApi.getDeptApi(rowId) |
| 167 | - deptParentId.value = res.parentId | ||
| 168 | - leaderUserId.value = res.leaderUserId | ||
| 169 | await nextTick() | 162 | await nextTick() |
| 170 | unref(formRef)?.setValues(res) | 163 | unref(formRef)?.setValues(res) |
| 171 | } | 164 | } |
| @@ -180,8 +173,6 @@ const submitForm = async () => { | @@ -180,8 +173,6 @@ const submitForm = async () => { | ||
| 180 | // 提交请求 | 173 | // 提交请求 |
| 181 | try { | 174 | try { |
| 182 | const data = unref(formRef)?.formModel as DeptApi.DeptVO | 175 | const data = unref(formRef)?.formModel as DeptApi.DeptVO |
| 183 | - data.parentId = deptParentId.value | ||
| 184 | - data.leaderUserId = leaderUserId.value | ||
| 185 | if (actionType.value === 'create') { | 176 | if (actionType.value === 'create') { |
| 186 | await DeptApi.createDeptApi(data) | 177 | await DeptApi.createDeptApi(data) |
| 187 | message.success(t('common.createSuccess')) | 178 | message.success(t('common.createSuccess')) |
yudao-ui-admin-vue3/src/views/system/oauth2/client/index.vue
| @@ -62,8 +62,8 @@ | @@ -62,8 +62,8 @@ | ||
| 62 | :schema="allSchemas.formSchema" | 62 | :schema="allSchemas.formSchema" |
| 63 | :rules="rules" | 63 | :rules="rules" |
| 64 | > | 64 | > |
| 65 | - <template #logo> | ||
| 66 | - <UploadImg :imgs="uploadLogo" :limit="1" /> | 65 | + <template #logo="form"> |
| 66 | + <UploadImg :imgs="form['logo']" :limit="1" /> | ||
| 67 | </template> | 67 | </template> |
| 68 | </Form> | 68 | </Form> |
| 69 | <!-- 表单:详情 --> | 69 | <!-- 表单:详情 --> |
| @@ -164,7 +164,6 @@ const actionType = ref('') // 操作按钮的类型 | @@ -164,7 +164,6 @@ const actionType = ref('') // 操作按钮的类型 | ||
| 164 | const actionLoading = ref(false) // 按钮 Loading | 164 | const actionLoading = ref(false) // 按钮 Loading |
| 165 | const formRef = ref<FormExpose>() // 表单 Ref | 165 | const formRef = ref<FormExpose>() // 表单 Ref |
| 166 | const detailRef = ref() // 详情 Ref | 166 | const detailRef = ref() // 详情 Ref |
| 167 | -const uploadLogo = ref('') | ||
| 168 | // 设置标题 | 167 | // 设置标题 |
| 169 | const setDialogTile = (type: string) => { | 168 | const setDialogTile = (type: string) => { |
| 170 | dialogTitle.value = t('action.' + type) | 169 | dialogTitle.value = t('action.' + type) |
| @@ -174,7 +173,6 @@ const setDialogTile = (type: string) => { | @@ -174,7 +173,6 @@ const setDialogTile = (type: string) => { | ||
| 174 | 173 | ||
| 175 | // 新增操作 | 174 | // 新增操作 |
| 176 | const handleCreate = () => { | 175 | const handleCreate = () => { |
| 177 | - uploadLogo.value = '' | ||
| 178 | setDialogTile('create') | 176 | setDialogTile('create') |
| 179 | } | 177 | } |
| 180 | 178 | ||
| @@ -183,7 +181,6 @@ const handleUpdate = async (rowId: number) => { | @@ -183,7 +181,6 @@ const handleUpdate = async (rowId: number) => { | ||
| 183 | setDialogTile('update') | 181 | setDialogTile('update') |
| 184 | // 设置数据 | 182 | // 设置数据 |
| 185 | const res = await ClientApi.getOAuth2ClientApi(rowId) | 183 | const res = await ClientApi.getOAuth2ClientApi(rowId) |
| 186 | - uploadLogo.value = res.logo | ||
| 187 | unref(formRef)?.setValues(res) | 184 | unref(formRef)?.setValues(res) |
| 188 | } | 185 | } |
| 189 | 186 | ||
| @@ -209,7 +206,6 @@ const submitForm = async () => { | @@ -209,7 +206,6 @@ const submitForm = async () => { | ||
| 209 | // 提交请求 | 206 | // 提交请求 |
| 210 | try { | 207 | try { |
| 211 | const data = unref(formRef)?.formModel as ClientApi.OAuth2ClientVO | 208 | const data = unref(formRef)?.formModel as ClientApi.OAuth2ClientVO |
| 212 | - data.logo = uploadLogo.value | ||
| 213 | if (actionType.value === 'create') { | 209 | if (actionType.value === 'create') { |
| 214 | await ClientApi.createOAuth2ClientApi(data) | 210 | await ClientApi.createOAuth2ClientApi(data) |
| 215 | message.success(t('common.createSuccess')) | 211 | message.success(t('common.createSuccess')) |
yudao-ui-admin-vue3/src/views/system/sensitiveWord/index.vue
| @@ -64,8 +64,8 @@ | @@ -64,8 +64,8 @@ | ||
| 64 | :rules="rules" | 64 | :rules="rules" |
| 65 | ref="formRef" | 65 | ref="formRef" |
| 66 | > | 66 | > |
| 67 | - <template #tags> | ||
| 68 | - <el-select v-model="tags" multiple placeholder="请选择"> | 67 | + <template #tags="form"> |
| 68 | + <el-select v-model="form['tags']" multiple placeholder="请选择"> | ||
| 69 | <el-option v-for="item in tagsOptions" :key="item" :label="item" :value="item" /> | 69 | <el-option v-for="item in tagsOptions" :key="item" :label="item" :value="item" /> |
| 70 | </el-select> | 70 | </el-select> |
| 71 | </template> | 71 | </template> |
| @@ -130,7 +130,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | @@ -130,7 +130,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | ||
| 130 | const dialogTitle = ref('edit') // 弹出层标题 | 130 | const dialogTitle = ref('edit') // 弹出层标题 |
| 131 | const formRef = ref<FormExpose>() // 表单 Ref | 131 | const formRef = ref<FormExpose>() // 表单 Ref |
| 132 | const detailData = ref() // 详情 Ref | 132 | const detailData = ref() // 详情 Ref |
| 133 | -const tags = ref() | ||
| 134 | 133 | ||
| 135 | // 获取标签 | 134 | // 获取标签 |
| 136 | const tagsOptions = ref() | 135 | const tagsOptions = ref() |
| @@ -148,7 +147,6 @@ const setDialogTile = (type: string) => { | @@ -148,7 +147,6 @@ const setDialogTile = (type: string) => { | ||
| 148 | 147 | ||
| 149 | // 新增操作 | 148 | // 新增操作 |
| 150 | const handleCreate = () => { | 149 | const handleCreate = () => { |
| 151 | - tags.value = null | ||
| 152 | setDialogTile('create') | 150 | setDialogTile('create') |
| 153 | } | 151 | } |
| 154 | 152 | ||
| @@ -162,7 +160,6 @@ const handleUpdate = async (rowId: number) => { | @@ -162,7 +160,6 @@ const handleUpdate = async (rowId: number) => { | ||
| 162 | setDialogTile('update') | 160 | setDialogTile('update') |
| 163 | // 设置数据 | 161 | // 设置数据 |
| 164 | const res = await SensitiveWordApi.getSensitiveWordApi(rowId) | 162 | const res = await SensitiveWordApi.getSensitiveWordApi(rowId) |
| 165 | - tags.value = res.tags | ||
| 166 | unref(formRef)?.setValues(res) | 163 | unref(formRef)?.setValues(res) |
| 167 | } | 164 | } |
| 168 | 165 | ||
| @@ -188,7 +185,6 @@ const submitForm = async () => { | @@ -188,7 +185,6 @@ const submitForm = async () => { | ||
| 188 | // 提交请求 | 185 | // 提交请求 |
| 189 | try { | 186 | try { |
| 190 | const data = unref(formRef)?.formModel as SensitiveWordApi.SensitiveWordVO | 187 | const data = unref(formRef)?.formModel as SensitiveWordApi.SensitiveWordVO |
| 191 | - data.tags = tags.value | ||
| 192 | if (actionType.value === 'create') { | 188 | if (actionType.value === 'create') { |
| 193 | await SensitiveWordApi.createSensitiveWordApi(data) | 189 | await SensitiveWordApi.createSensitiveWordApi(data) |
| 194 | message.success(t('common.createSuccess')) | 190 | message.success(t('common.createSuccess')) |
yudao-ui-admin-vue3/src/views/system/tenantPackage/index.vue
| @@ -155,7 +155,7 @@ const submitForm = async () => { | @@ -155,7 +155,7 @@ const submitForm = async () => { | ||
| 155 | // 提交请求 | 155 | // 提交请求 |
| 156 | try { | 156 | try { |
| 157 | const data = unref(formRef)?.formModel as TenantPackageApi.TenantPackageVO | 157 | const data = unref(formRef)?.formModel as TenantPackageApi.TenantPackageVO |
| 158 | - data.menuIds = treeRef.value!.getCheckedKeys(false) as string[] | 158 | + data.menuIds = treeRef.value!.getCheckedKeys(false) as number[] |
| 159 | if (actionType.value === 'create') { | 159 | if (actionType.value === 'create') { |
| 160 | await TenantPackageApi.createTenantPackageTypeApi(data) | 160 | await TenantPackageApi.createTenantPackageTypeApi(data) |
| 161 | message.success(t('common.createSuccess')) | 161 | message.success(t('common.createSuccess')) |
yudao-ui-admin-vue3/src/views/system/user/index.vue
| @@ -130,17 +130,17 @@ | @@ -130,17 +130,17 @@ | ||
| 130 | :schema="allSchemas.formSchema" | 130 | :schema="allSchemas.formSchema" |
| 131 | ref="formRef" | 131 | ref="formRef" |
| 132 | > | 132 | > |
| 133 | - <template #deptId> | 133 | + <template #deptId="form"> |
| 134 | <el-tree-select | 134 | <el-tree-select |
| 135 | node-key="id" | 135 | node-key="id" |
| 136 | - v-model="deptId" | 136 | + v-model="form['deptId']" |
| 137 | :props="defaultProps" | 137 | :props="defaultProps" |
| 138 | :data="deptOptions" | 138 | :data="deptOptions" |
| 139 | check-strictly | 139 | check-strictly |
| 140 | /> | 140 | /> |
| 141 | </template> | 141 | </template> |
| 142 | - <template #postIds> | ||
| 143 | - <el-select v-model="postIds" multiple :placeholder="t('common.selectText')"> | 142 | + <template #postIds="form"> |
| 143 | + <el-select v-model="form['postIds']" multiple :placeholder="t('common.selectText')"> | ||
| 144 | <el-option | 144 | <el-option |
| 145 | v-for="item in postOptions" | 145 | v-for="item in postOptions" |
| 146 | :key="item.id" | 146 | :key="item.id" |
| @@ -354,8 +354,6 @@ const actionType = ref('') // 操作按钮的类型 | @@ -354,8 +354,6 @@ const actionType = ref('') // 操作按钮的类型 | ||
| 354 | const dialogVisible = ref(false) // 是否显示弹出层 | 354 | const dialogVisible = ref(false) // 是否显示弹出层 |
| 355 | const dialogTitle = ref('edit') // 弹出层标题 | 355 | const dialogTitle = ref('edit') // 弹出层标题 |
| 356 | const formRef = ref<FormExpose>() // 表单 Ref | 356 | const formRef = ref<FormExpose>() // 表单 Ref |
| 357 | -const deptId = ref() // 部门ID | ||
| 358 | -const postIds = ref<string[]>([]) // 岗位ID | ||
| 359 | const postOptions = ref<PostVO[]>([]) //岗位列表 | 357 | const postOptions = ref<PostVO[]>([]) //岗位列表 |
| 360 | 358 | ||
| 361 | // 获取岗位列表 | 359 | // 获取岗位列表 |
| @@ -374,8 +372,6 @@ const setDialogTile = async (type: string) => { | @@ -374,8 +372,6 @@ const setDialogTile = async (type: string) => { | ||
| 374 | const handleCreate = async () => { | 372 | const handleCreate = async () => { |
| 375 | setDialogTile('create') | 373 | setDialogTile('create') |
| 376 | // 重置表单 | 374 | // 重置表单 |
| 377 | - deptId.value = null | ||
| 378 | - postIds.value = [] | ||
| 379 | await nextTick() | 375 | await nextTick() |
| 380 | if (allSchemas.formSchema[0].field !== 'username') { | 376 | if (allSchemas.formSchema[0].field !== 'username') { |
| 381 | unref(formRef)?.addSchema( | 377 | unref(formRef)?.addSchema( |
| @@ -405,8 +401,6 @@ const handleUpdate = async (rowId: number) => { | @@ -405,8 +401,6 @@ const handleUpdate = async (rowId: number) => { | ||
| 405 | unref(formRef)?.delSchema('password') | 401 | unref(formRef)?.delSchema('password') |
| 406 | // 设置数据 | 402 | // 设置数据 |
| 407 | const res = await UserApi.getUserApi(rowId) | 403 | const res = await UserApi.getUserApi(rowId) |
| 408 | - deptId.value = res.deptId | ||
| 409 | - postIds.value = res.postIds | ||
| 410 | unref(formRef)?.setValues(res) | 404 | unref(formRef)?.setValues(res) |
| 411 | } | 405 | } |
| 412 | const detailData = ref() | 406 | const detailData = ref() |
| @@ -428,8 +422,6 @@ const submitForm = async () => { | @@ -428,8 +422,6 @@ const submitForm = async () => { | ||
| 428 | // 提交请求 | 422 | // 提交请求 |
| 429 | try { | 423 | try { |
| 430 | const data = unref(formRef)?.formModel as UserApi.UserVO | 424 | const data = unref(formRef)?.formModel as UserApi.UserVO |
| 431 | - data.deptId = deptId.value | ||
| 432 | - data.postIds = postIds.value | ||
| 433 | if (actionType.value === 'create') { | 425 | if (actionType.value === 'create') { |
| 434 | await UserApi.createUserApi(data) | 426 | await UserApi.createUserApi(data) |
| 435 | message.success(t('common.createSuccess')) | 427 | message.success(t('common.createSuccess')) |
yudao-ui-admin-vue3/src/views/system/user/user.data.ts
| @@ -10,6 +10,7 @@ export const rules = reactive({ | @@ -10,6 +10,7 @@ export const rules = reactive({ | ||
| 10 | username: [required], | 10 | username: [required], |
| 11 | nickname: [required], | 11 | nickname: [required], |
| 12 | email: [required], | 12 | email: [required], |
| 13 | + postIds: [required], | ||
| 13 | status: [required], | 14 | status: [required], |
| 14 | mobile: [ | 15 | mobile: [ |
| 15 | { | 16 | { |