mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	fix: form solts
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| <template> | ||||
|   <Form ref="formRef" :rules="rules" :schema="schema" :labelWidth="80"> | ||||
|     <template #sex> | ||||
|       <el-radio-group v-model="sexVlue"> | ||||
|     <template #sex="form"> | ||||
|       <el-radio-group v-model="form['sex']"> | ||||
|         <el-radio :label="1">{{ t('profile.user.man') }}</el-radio> | ||||
|         <el-radio :label="2">{{ t('profile.user.woman') }}</el-radio> | ||||
|       </el-radio-group> | ||||
| @@ -67,7 +67,6 @@ const schema = reactive<FormSchema[]>([ | ||||
|     value: 0 | ||||
|   } | ||||
| ]) | ||||
| const sexVlue = ref<number>() | ||||
| const formRef = ref<FormExpose>() // 表单 Ref | ||||
| const submit = () => { | ||||
|   const elForm = unref(formRef)?.getElFormRef() | ||||
| @@ -75,7 +74,6 @@ const submit = () => { | ||||
|   elForm.validate(async (valid) => { | ||||
|     if (valid) { | ||||
|       const data = unref(formRef)?.formModel as UserProfileUpdateReqVO | ||||
|       data.sex = sexVlue.value as unknown as number | ||||
|       await updateUserProfileApi(data) | ||||
|       ElMessage.success(t('common.updateSuccess')) | ||||
|       await init() | ||||
| @@ -84,7 +82,6 @@ const submit = () => { | ||||
| } | ||||
| const init = async () => { | ||||
|   const res = await getUserProfileApi() | ||||
|   sexVlue.value = res.sex | ||||
|   unref(formRef)?.setValues(res) | ||||
| } | ||||
| onMounted(async () => { | ||||
|   | ||||
| @@ -29,7 +29,6 @@ const dialogTitle = ref('edit') // 弹出层标题 | ||||
| const formRef = ref<FormExpose>() // 表单 Ref | ||||
|  | ||||
| // ========== 用户选择  ========== | ||||
| const userIds = ref<number[]>([]) | ||||
| const userOptions = ref<UserVO[]>([]) | ||||
| const getUserOptions = async () => { | ||||
|   const res = await getListSimpleUsersApi() | ||||
| @@ -46,7 +45,6 @@ const setDialogTile = (type: string) => { | ||||
| // 新增操作 | ||||
| const handleCreate = () => { | ||||
|   setDialogTile('create') | ||||
|   userIds.value = [] | ||||
| } | ||||
|  | ||||
| // 修改操作 | ||||
| @@ -54,7 +52,6 @@ const handleUpdate = async (row: UserGroupVO) => { | ||||
|   setDialogTile('update') | ||||
|   // 设置数据 | ||||
|   const res = await UserGroupApi.getUserGroupApi(row.id) | ||||
|   userIds.value = res.memberUserIds | ||||
|   unref(formRef)?.setValues(res) | ||||
| } | ||||
|  | ||||
| @@ -68,7 +65,6 @@ const submitForm = async () => { | ||||
|       // 提交请求 | ||||
|       try { | ||||
|         const data = unref(formRef)?.formModel as UserGroupVO | ||||
|         data.memberUserIds = userIds.value | ||||
|         if (actionType.value === 'create') { | ||||
|           await UserGroupApi.createUserGroupApi(data) | ||||
|           ElMessage.success(t('common.createSuccess')) | ||||
| @@ -183,8 +179,8 @@ onMounted(async () => { | ||||
|       :rules="rules" | ||||
|       ref="formRef" | ||||
|     > | ||||
|       <template #memberUserIds> | ||||
|         <el-select v-model="userIds" multiple> | ||||
|       <template #memberUserIds="form"> | ||||
|         <el-select v-model="form['memberUserIds']" multiple> | ||||
|           <el-option | ||||
|             v-for="item in userOptions" | ||||
|             :key="item.id" | ||||
|   | ||||
| @@ -93,8 +93,8 @@ | ||||
|       :rules="rules" | ||||
|       ref="formRef" | ||||
|     > | ||||
|       <template #cronExpression> | ||||
|         <Crontab v-model="cronExpression" :shortcuts="shortcuts" /> | ||||
|       <template #cronExpression="form"> | ||||
|         <Crontab v-model="form['cronExpression']" :shortcuts="shortcuts" /> | ||||
|       </template> | ||||
|     </Form> | ||||
|     <!-- 对话框(详情) --> | ||||
| @@ -162,7 +162,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | ||||
| const dialogTitle = ref('edit') // 弹出层标题 | ||||
| const formRef = ref<FormExpose>() // 表单 Ref | ||||
| const detailRef = ref() // 详情 Ref | ||||
| const cronExpression = ref('') | ||||
| const nextTimes = ref([]) | ||||
| const shortcuts = ref([ | ||||
|   { | ||||
| @@ -179,7 +178,6 @@ const setDialogTile = (type: string) => { | ||||
|  | ||||
| // 新增操作 | ||||
| const handleCreate = () => { | ||||
|   cronExpression.value = '' | ||||
|   setDialogTile('create') | ||||
| } | ||||
|  | ||||
| @@ -193,7 +191,6 @@ const handleUpdate = async (rowId: number) => { | ||||
|   setDialogTile('update') | ||||
|   // 设置数据 | ||||
|   const res = await JobApi.getJobApi(rowId) | ||||
|   cronExpression.value = res.cronExpression | ||||
|   unref(formRef)?.setValues(res) | ||||
| } | ||||
|  | ||||
| @@ -305,7 +302,6 @@ const submitForm = async () => { | ||||
|       // 提交请求 | ||||
|       try { | ||||
|         const data = unref(formRef)?.formModel as JobApi.JobVO | ||||
|         data.cronExpression = cronExpression.value | ||||
|         if (actionType.value === 'create') { | ||||
|           await JobApi.createJobApi(data) | ||||
|           message.success(t('common.createSuccess')) | ||||
|   | ||||
| @@ -38,20 +38,19 @@ | ||||
|   <!-- 添加或修改菜单对话框 --> | ||||
|   <XModal id="deptModel" v-model="dialogVisible" :title="dialogTitle"> | ||||
|     <!-- 对话框(添加 / 修改) --> | ||||
|     <!-- 操作工具栏 --> | ||||
|     <Form ref="formRef" :schema="allSchemas.formSchema" :rules="rules"> | ||||
|       <template #parentId> | ||||
|       <template #parentId="form"> | ||||
|         <el-tree-select | ||||
|           node-key="id" | ||||
|           v-model="deptParentId" | ||||
|           v-model="form['parentId']" | ||||
|           :props="defaultProps" | ||||
|           :data="deptOptions" | ||||
|           :default-expanded-keys="[100]" | ||||
|           check-strictly | ||||
|         /> | ||||
|       </template> | ||||
|       <template #leaderUserId> | ||||
|         <el-select v-model="leaderUserId"> | ||||
|       <template #leaderUserId="form"> | ||||
|         <el-select v-model="form['leaderUserId']"> | ||||
|           <el-option | ||||
|             v-for="item in userOption" | ||||
|             :key="item.id" | ||||
| @@ -105,8 +104,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | ||||
| const dialogTitle = ref('edit') // 弹出层标题 | ||||
| const actionType = ref('') // 操作按钮的类型 | ||||
| const actionLoading = ref(false) // 遮罩层 | ||||
| const deptParentId = ref(0) // 上级ID | ||||
| const leaderUserId = ref() | ||||
| const formRef = ref<FormExpose>() // 表单 Ref | ||||
| const deptOptions = ref() // 树形结构 | ||||
| const userOption = ref<UserVO[]>([]) | ||||
| @@ -154,8 +151,6 @@ const setDialogTile = (type: string) => { | ||||
|  | ||||
| // 新增操作 | ||||
| const handleCreate = async () => { | ||||
|   deptParentId.value = 0 | ||||
|   leaderUserId.value = null | ||||
|   setDialogTile('create') | ||||
| } | ||||
|  | ||||
| @@ -164,8 +159,6 @@ const handleUpdate = async (rowId: number) => { | ||||
|   setDialogTile('update') | ||||
|   // 设置数据 | ||||
|   const res = await DeptApi.getDeptApi(rowId) | ||||
|   deptParentId.value = res.parentId | ||||
|   leaderUserId.value = res.leaderUserId | ||||
|   await nextTick() | ||||
|   unref(formRef)?.setValues(res) | ||||
| } | ||||
| @@ -180,8 +173,6 @@ const submitForm = async () => { | ||||
|       // 提交请求 | ||||
|       try { | ||||
|         const data = unref(formRef)?.formModel as DeptApi.DeptVO | ||||
|         data.parentId = deptParentId.value | ||||
|         data.leaderUserId = leaderUserId.value | ||||
|         if (actionType.value === 'create') { | ||||
|           await DeptApi.createDeptApi(data) | ||||
|           message.success(t('common.createSuccess')) | ||||
|   | ||||
| @@ -62,8 +62,8 @@ | ||||
|       :schema="allSchemas.formSchema" | ||||
|       :rules="rules" | ||||
|     > | ||||
|       <template #logo> | ||||
|         <UploadImg :imgs="uploadLogo" :limit="1" /> | ||||
|       <template #logo="form"> | ||||
|         <UploadImg :imgs="form['logo']" :limit="1" /> | ||||
|       </template> | ||||
|     </Form> | ||||
|     <!-- 表单:详情 --> | ||||
| @@ -164,7 +164,6 @@ const actionType = ref('') // 操作按钮的类型 | ||||
| const actionLoading = ref(false) // 按钮 Loading | ||||
| const formRef = ref<FormExpose>() // 表单 Ref | ||||
| const detailRef = ref() // 详情 Ref | ||||
| const uploadLogo = ref('') | ||||
| // 设置标题 | ||||
| const setDialogTile = (type: string) => { | ||||
|   dialogTitle.value = t('action.' + type) | ||||
| @@ -174,7 +173,6 @@ const setDialogTile = (type: string) => { | ||||
|  | ||||
| // 新增操作 | ||||
| const handleCreate = () => { | ||||
|   uploadLogo.value = '' | ||||
|   setDialogTile('create') | ||||
| } | ||||
|  | ||||
| @@ -183,7 +181,6 @@ const handleUpdate = async (rowId: number) => { | ||||
|   setDialogTile('update') | ||||
|   // 设置数据 | ||||
|   const res = await ClientApi.getOAuth2ClientApi(rowId) | ||||
|   uploadLogo.value = res.logo | ||||
|   unref(formRef)?.setValues(res) | ||||
| } | ||||
|  | ||||
| @@ -209,7 +206,6 @@ const submitForm = async () => { | ||||
|       // 提交请求 | ||||
|       try { | ||||
|         const data = unref(formRef)?.formModel as ClientApi.OAuth2ClientVO | ||||
|         data.logo = uploadLogo.value | ||||
|         if (actionType.value === 'create') { | ||||
|           await ClientApi.createOAuth2ClientApi(data) | ||||
|           message.success(t('common.createSuccess')) | ||||
|   | ||||
| @@ -64,8 +64,8 @@ | ||||
|       :rules="rules" | ||||
|       ref="formRef" | ||||
|     > | ||||
|       <template #tags> | ||||
|         <el-select v-model="tags" multiple placeholder="请选择"> | ||||
|       <template #tags="form"> | ||||
|         <el-select v-model="form['tags']" multiple placeholder="请选择"> | ||||
|           <el-option v-for="item in tagsOptions" :key="item" :label="item" :value="item" /> | ||||
|         </el-select> | ||||
|       </template> | ||||
| @@ -130,7 +130,6 @@ const dialogVisible = ref(false) // 是否显示弹出层 | ||||
| const dialogTitle = ref('edit') // 弹出层标题 | ||||
| const formRef = ref<FormExpose>() // 表单 Ref | ||||
| const detailData = ref() // 详情 Ref | ||||
| const tags = ref() | ||||
|  | ||||
| // 获取标签 | ||||
| const tagsOptions = ref() | ||||
| @@ -148,7 +147,6 @@ const setDialogTile = (type: string) => { | ||||
|  | ||||
| // 新增操作 | ||||
| const handleCreate = () => { | ||||
|   tags.value = null | ||||
|   setDialogTile('create') | ||||
| } | ||||
|  | ||||
| @@ -162,7 +160,6 @@ const handleUpdate = async (rowId: number) => { | ||||
|   setDialogTile('update') | ||||
|   // 设置数据 | ||||
|   const res = await SensitiveWordApi.getSensitiveWordApi(rowId) | ||||
|   tags.value = res.tags | ||||
|   unref(formRef)?.setValues(res) | ||||
| } | ||||
|  | ||||
| @@ -188,7 +185,6 @@ const submitForm = async () => { | ||||
|       // 提交请求 | ||||
|       try { | ||||
|         const data = unref(formRef)?.formModel as SensitiveWordApi.SensitiveWordVO | ||||
|         data.tags = tags.value | ||||
|         if (actionType.value === 'create') { | ||||
|           await SensitiveWordApi.createSensitiveWordApi(data) | ||||
|           message.success(t('common.createSuccess')) | ||||
|   | ||||
| @@ -155,7 +155,7 @@ const submitForm = async () => { | ||||
|       // 提交请求 | ||||
|       try { | ||||
|         const data = unref(formRef)?.formModel as TenantPackageApi.TenantPackageVO | ||||
|         data.menuIds = treeRef.value!.getCheckedKeys(false) as string[] | ||||
|         data.menuIds = treeRef.value!.getCheckedKeys(false) as number[] | ||||
|         if (actionType.value === 'create') { | ||||
|           await TenantPackageApi.createTenantPackageTypeApi(data) | ||||
|           message.success(t('common.createSuccess')) | ||||
|   | ||||
| @@ -130,17 +130,17 @@ | ||||
|       :schema="allSchemas.formSchema" | ||||
|       ref="formRef" | ||||
|     > | ||||
|       <template #deptId> | ||||
|       <template #deptId="form"> | ||||
|         <el-tree-select | ||||
|           node-key="id" | ||||
|           v-model="deptId" | ||||
|           v-model="form['deptId']" | ||||
|           :props="defaultProps" | ||||
|           :data="deptOptions" | ||||
|           check-strictly | ||||
|         /> | ||||
|       </template> | ||||
|       <template #postIds> | ||||
|         <el-select v-model="postIds" multiple :placeholder="t('common.selectText')"> | ||||
|       <template #postIds="form"> | ||||
|         <el-select v-model="form['postIds']" multiple :placeholder="t('common.selectText')"> | ||||
|           <el-option | ||||
|             v-for="item in postOptions" | ||||
|             :key="item.id" | ||||
| @@ -354,8 +354,6 @@ const actionType = ref('') // 操作按钮的类型 | ||||
| const dialogVisible = ref(false) // 是否显示弹出层 | ||||
| const dialogTitle = ref('edit') // 弹出层标题 | ||||
| const formRef = ref<FormExpose>() // 表单 Ref | ||||
| const deptId = ref() // 部门ID | ||||
| const postIds = ref<string[]>([]) // 岗位ID | ||||
| const postOptions = ref<PostVO[]>([]) //岗位列表 | ||||
|  | ||||
| // 获取岗位列表 | ||||
| @@ -374,8 +372,6 @@ const setDialogTile = async (type: string) => { | ||||
| const handleCreate = async () => { | ||||
|   setDialogTile('create') | ||||
|   // 重置表单 | ||||
|   deptId.value = null | ||||
|   postIds.value = [] | ||||
|   await nextTick() | ||||
|   if (allSchemas.formSchema[0].field !== 'username') { | ||||
|     unref(formRef)?.addSchema( | ||||
| @@ -405,8 +401,6 @@ const handleUpdate = async (rowId: number) => { | ||||
|   unref(formRef)?.delSchema('password') | ||||
|   // 设置数据 | ||||
|   const res = await UserApi.getUserApi(rowId) | ||||
|   deptId.value = res.deptId | ||||
|   postIds.value = res.postIds | ||||
|   unref(formRef)?.setValues(res) | ||||
| } | ||||
| const detailData = ref() | ||||
| @@ -428,8 +422,6 @@ const submitForm = async () => { | ||||
|   // 提交请求 | ||||
|   try { | ||||
|     const data = unref(formRef)?.formModel as UserApi.UserVO | ||||
|     data.deptId = deptId.value | ||||
|     data.postIds = postIds.value | ||||
|     if (actionType.value === 'create') { | ||||
|       await UserApi.createUserApi(data) | ||||
|       message.success(t('common.createSuccess')) | ||||
|   | ||||
| @@ -10,6 +10,7 @@ export const rules = reactive({ | ||||
|   username: [required], | ||||
|   nickname: [required], | ||||
|   email: [required], | ||||
|   postIds: [required], | ||||
|   status: [required], | ||||
|   mobile: [ | ||||
|     { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 xingyu4j
					xingyu4j