From 2bee2aed437834131dd76e1cb1671d9ec80b7bff Mon Sep 17 00:00:00 2001 From: xiongqin <3323939337@qq.com> Date: Tue, 8 Jul 2025 20:00:18 +0800 Subject: [PATCH] =?UTF-8?q?xq=20feat:"=E5=AE=8C=E6=88=90=E4=BA=86=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E5=92=8C=E9=A1=B9=E7=9B=AE=E5=85=B3=E8=81=94=EF=BC=88?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E9=80=BB=E8=BE=91=EF=BC=89"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/system/user/types.ts | 1 + src/store/modules/program.ts | 8 +++++++- src/views/system/user/index.vue | 33 ++++++++++++++++++++++++++++++--- 3 files changed, 38 insertions(+), 4 deletions(-) diff --git a/src/api/system/user/types.ts b/src/api/system/user/types.ts index 304e3bc..ea06cea 100644 --- a/src/api/system/user/types.ts +++ b/src/api/system/user/types.ts @@ -67,6 +67,7 @@ export interface UserForm { remark?: string; postIds: string[]; roleIds: string[]; + wxList: []; } export interface UserInfoVO { diff --git a/src/store/modules/program.ts b/src/store/modules/program.ts index 84135f9..d9ed2a1 100644 --- a/src/store/modules/program.ts +++ b/src/store/modules/program.ts @@ -2,15 +2,21 @@ import { defineStore } from 'pinia'; interface ProgramState { programID: string; + personProgramTemp: any; } const useProgram = defineStore('program', { state: (): ProgramState => ({ - programID: '' + programID: '', + personProgramTemp: [] }), actions: { updateId(id: string) { this.programID = id; + }, + updateTemp(arr: any) { + console.info(arr); + this.personProgramTemp = arr; } } }); diff --git a/src/views/system/user/index.vue b/src/views/system/user/index.vue index 170cd9c..a1b1a09 100644 --- a/src/views/system/user/index.vue +++ b/src/views/system/user/index.vue @@ -240,7 +240,7 @@ - + @@ -323,6 +323,7 @@ import { hasPermi } from '@/directive/permission'; import { checkPermi } from '@/utils/permission'; import { ref } from 'vue'; import { getAll } from '@/api/business/inverter'; +import { useProgram } from '@/store/modules/program'; const props = { multiple: true }; const router = useRouter(); const { proxy } = getCurrentInstance() as ComponentInternalInstance; @@ -341,6 +342,7 @@ const enabledDeptOptions = ref([]); const initPassword = ref(''); const postOptions = ref([]); const roleOptions = ref([]); +const programStore = useProgram(); const options = ref([ { @@ -459,7 +461,8 @@ const initFormData: UserForm = { status: '0', remark: '', postIds: [], - roleIds: [] + roleIds: [], + wxList: [] }; const initData: PageData = { @@ -550,8 +553,24 @@ function getAllList() { }); } +function updateTemp(a) { + const arr = []; + programList.value.forEach((item) => { + a.forEach((item2) => { + if (item.nbqId === item2) { + arr.push(item); + } + }); + }); + tempArr.value = []; + arr.forEach((item) => { + tempArr.value.push(item); + }); +} + watch(tempArr, (nv) => { - programArr.value = programList.value.filter((obj) => nv.includes(obj.nbqId)); + programArr.value = nv; + programStore.updateTemp(programArr.value); }); /** 查询部门下拉树结构 */ @@ -719,6 +738,13 @@ const handleUpdate = async (row?: UserForm) => { reset(); const userId = row?.userId || ids.value[0]; const { data } = await api.getUser(userId); + if (data.wxLis && data.wxLis.length > 0) { + programStore.updateTemp(data.wxLis); + tempArr.value = data.wxLis; + } else { + programStore.updateTemp([]); + tempArr.value = []; + } dialog.visible = true; dialog.title = '修改用户'; Object.assign(form.value, data.user); @@ -746,6 +772,7 @@ const submitForm = () => { */ const closeDialog = () => { dialog.visible = false; + programStore.updateTemp([]); resetForm(); };