From 4d244eeff92f38db978cad4962a72ee6cc2d73c4 Mon Sep 17 00:00:00 2001 From: LHD_HY <2872546851@qq.com> Date: Fri, 9 Jan 2026 14:40:12 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9B=A2=E9=98=9F=E5=A4=9A?= =?UTF-8?q?=E9=80=89=E4=BA=BA=E5=91=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/select.js | 4 +- src/views/system/team/components/TeamForm.vue | 67 +++++++++++++++++-- src/views/system/team/config.js | 4 +- src/views/system/team/index.vue | 28 +++++++- 4 files changed, 94 insertions(+), 9 deletions(-) diff --git a/src/api/select.js b/src/api/select.js index 5f4fc5a..e1a4fb8 100644 --- a/src/api/select.js +++ b/src/api/select.js @@ -12,7 +12,7 @@ export async function getClassifyMarkSelApi(params) { // 部门下拉树 export async function getDeptSelectApi(params) { return await request({ - url: '/smartPlatform/transferApply/getDeptSelect', + url: '/smartPlatform/system/dept/list', method: 'get', params, }) @@ -25,4 +25,4 @@ export async function getRoleSelectApi(params) { method: 'get', params, }) -} \ No newline at end of file +} diff --git a/src/views/system/team/components/TeamForm.vue b/src/views/system/team/components/TeamForm.vue index 08f9e18..a51a948 100644 --- a/src/views/system/team/components/TeamForm.vue +++ b/src/views/system/team/components/TeamForm.vue @@ -8,7 +8,25 @@ - + + + + + + + + import _ from 'lodash' import { addTeamAPI, editTeamAPI } from '@/api/system/team' +import { listUser } from '@/api/system/user' // 默认参数 export default { name: "TeamForm", @@ -38,12 +57,18 @@ export default { teamId: null, teamName: '', teamRemark: '', + memberIds: [], }, rules: { teamName: [ { required: true, message: '团队名称不能为空', trigger: 'blur' } ], + memberIds: [ + { required: true, message: '请选择至少一名团队成员', trigger: 'change' } + ], }, + personList: [], // 人员列表数据源 + personLoading: false // 人员列表加载状态 }; }, watch: { @@ -56,15 +81,45 @@ export default { immediate: true, }, }, + + created() { + this.initPersonList(); + }, + methods: { + + async initPersonList() { + try { + this.personLoading = true; + const res = await listUser({}); + if (res.code === 200) { + const userList = res.rows || []; + this.personList = userList.map(item => { + return { + userId: item.userId, // 主键ID + userName: item.userName, // 显示名称 + }; + }); + } else { + this.$modal.msgError('获取人员列表失败:' + res.msg); + } + } catch (error) { + this.$modal.msgError('获取人员列表异常:' + error.message); + console.error('获取人员列表失败:', error); + } finally { + this.personLoading = false; + } + }, + /** 初始化表单数据 */ async initFormData() { - if (!this.rowData) return; + if (!this.rowData) return; // 编辑模式:填充表单数据 this.form = { teamId: this.rowData.teamId, teamName: this.rowData.teamName || '', teamRemark: this.rowData.teamRemark || '', + memberIds: this.rowData.memberIds || [], // 回显已选的用户ID数组 }; }, /*关闭弹窗 */ @@ -191,7 +246,7 @@ export default { .w700 ::v-deep .el-dialog__header { flex-shrink: 0; border-bottom: 1px solid #EBEEF5; - + .el-dialog__title { font-size: 16px; } @@ -209,6 +264,10 @@ export default { width: 100%; } +::v-deep .el-select__tags { + flex-wrap: wrap; +} + .select-style { display: flex; justify-content: space-between; @@ -279,4 +338,4 @@ export default { } } } - \ No newline at end of file + diff --git a/src/views/system/team/config.js b/src/views/system/team/config.js index 9d9b5b5..94a33ac 100644 --- a/src/views/system/team/config.js +++ b/src/views/system/team/config.js @@ -12,7 +12,7 @@ export const formLabel = [ export const columnsList = [ { t_props: 'teamName', t_label: '团队名称' }, - { t_slot: 'teamNum', t_label: '团队成员' }, + { t_slot: 'teamNum', t_label: '团队成员' }, { t_props: 'teamRemark', t_label: '备注' }, { t_props: 'createTime', t_label: '创建时间' }, -] \ No newline at end of file +] diff --git a/src/views/system/team/index.vue b/src/views/system/team/index.vue index a0b01be..6e65a96 100644 --- a/src/views/system/team/index.vue +++ b/src/views/system/team/index.vue @@ -12,7 +12,13 @@ class="el-icon-plus"> 新增团队