合并
This commit is contained in:
		| @ -72,9 +72,14 @@ | ||||
|         <el-form-item label="跳转路由" prop="route"> | ||||
|           <el-input v-model="form.route" placeholder="请输入跳转路由" /> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="通知部门" prop="deptId"> | ||||
|           <el-select v-model="form.deptId" placeholder="请选择通知部门" filterable @change="getUser"> | ||||
|             <el-option v-for="item in deptList" :key="item.deptId" :label="item.deptName" :value="item.deptId" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|         <el-form-item label="通知人" prop="userId"> | ||||
|           <el-select v-model="form.userId" placeholder="请选择通知人" multiple filterable> | ||||
|             <el-option v-for="item in userList" :key="item.id" :label="item.nickName" :value="item.id" /> | ||||
|           <el-select v-model="form.userId" placeholder="请选择通知人" multiple filterable :disabled="!form.deptId"> | ||||
|             <el-option v-for="item in userList" :key="item.userId" :label="item.nickName" :value="item.userId" /> | ||||
|           </el-select> | ||||
|         </el-form-item> | ||||
|       </el-form> | ||||
| @ -89,8 +94,9 @@ | ||||
| </template> | ||||
|  | ||||
| <script setup name="Config" lang="ts"> | ||||
| import { listConfig, getConfig, delConfig, addConfig, updateConfig, listUser } from '@/api/message/config'; | ||||
| import { listConfig, getConfig, delConfig, addConfig, updateConfig, listUsers } from '@/api/message/config'; | ||||
| import { ConfigVO, ConfigQuery, ConfigForm } from '@/api/message/config/types'; | ||||
| import { listUser } from '@/api/system/user'; | ||||
| import { useUserStoreHook } from '@/store/modules/user'; | ||||
|  | ||||
| const { proxy } = getCurrentInstance() as ComponentInternalInstance; | ||||
| @ -107,6 +113,9 @@ const single = ref(true); | ||||
| const multiple = ref(true); | ||||
| const total = ref(0); | ||||
| const userList = ref([]); | ||||
| const deptList = ref([]); | ||||
|  | ||||
| const deptId = ref(''); | ||||
| const queryFormRef = ref<ElFormInstance>(); | ||||
| const configFormRef = ref<ElFormInstance>(); | ||||
|  | ||||
| @ -117,10 +126,11 @@ const dialog = reactive<DialogOption>({ | ||||
|  | ||||
| const initFormData: ConfigForm = { | ||||
|   id: undefined, | ||||
|   projectId: currentProject.value.id, | ||||
|   projectId: currentProject.value?.id, | ||||
|   msgName: undefined, | ||||
|   msgContent: undefined, | ||||
|   msgKey: undefined, | ||||
|   deptId: undefined, | ||||
|   route: undefined, | ||||
|   userId: undefined | ||||
| }; | ||||
| @ -129,7 +139,7 @@ const data = reactive<PageData<ConfigForm, ConfigQuery>>({ | ||||
|   queryParams: { | ||||
|     pageNum: 1, | ||||
|     pageSize: 10, | ||||
|     projectId: currentProject.value.id, | ||||
|     projectId: currentProject.value?.id, | ||||
|     msgName: undefined, | ||||
|     msgContent: undefined, | ||||
|     msgKey: undefined, | ||||
| @ -167,7 +177,7 @@ const cancel = () => { | ||||
| /** 表单重置 */ | ||||
| const reset = () => { | ||||
|   form.value = { ...initFormData }; | ||||
|   form.value.projectId = currentProject.value.id; | ||||
|   form.value.projectId = currentProject.value?.id; | ||||
|   configFormRef.value?.resetFields(); | ||||
| }; | ||||
|  | ||||
| @ -245,23 +255,41 @@ const handleExport = () => { | ||||
| }; | ||||
|  | ||||
| /** 获取用户列表 */ | ||||
| const getListUser = async () => { | ||||
| const getDept = async () => { | ||||
|   const res = await listUsers({ | ||||
|     pageNum: 1, | ||||
|     pageSize: 1000, | ||||
|     projectId: currentProject.value?.id | ||||
|   }); | ||||
|   deptId.value = res.data.deptId; | ||||
|   getListDept(); | ||||
| }; | ||||
|  | ||||
| const getListDept = async () => { | ||||
|   const res = await listUser({ | ||||
|     pageNum: 1, | ||||
|     pageSize: 1000, | ||||
|     projectId: currentProject.value.id | ||||
|     deptId: deptId.value | ||||
|   }); | ||||
|   deptList.value = res.rows; | ||||
| }; | ||||
| const getUser = async () => { | ||||
|   const res = await listUser({ | ||||
|     pageNum: 1, | ||||
|     pageSize: 1000, | ||||
|     deptId: form.value.deptId | ||||
|   }); | ||||
|   userList.value = res.rows; | ||||
| }; | ||||
|  | ||||
| onMounted(() => { | ||||
|   getList(); | ||||
|   getListUser(); | ||||
|   getDept(); | ||||
| }); | ||||
|  | ||||
| //监听项目id刷新数据 | ||||
| const listeningProject = watch( | ||||
|   () => currentProject.value.id, | ||||
|   () => currentProject.value?.id, | ||||
|   (nid, oid) => { | ||||
|     queryParams.value.projectId = nid; | ||||
|     form.value.projectId = nid; | ||||
|  | ||||
		Reference in New Issue
	
	Block a user