|
|
@@ -33,11 +33,15 @@
|
|
|
|
|
|
<el-card shadow="never">
|
|
|
<template #header>
|
|
|
- <el-row :gutter="10" class="mb8">
|
|
|
- <el-col :span="20"><span>人员设定信息列表</span> </el-col>
|
|
|
- <el-col :span="1.5">
|
|
|
+ <el-row :gutter="10" class="mb8" type="flex" justify="space-between" align="middle">
|
|
|
+ <!-- 左侧标题 -->
|
|
|
+ <span style="font-size: 16px; font-weight: 500">人员设定信息列表</span>
|
|
|
+
|
|
|
+ <!-- 右侧按钮组 -->
|
|
|
+ <!-- 这里的 flex-wrap: nowrap 保证了按钮挤在一起也不换行 -->
|
|
|
+ <div style="display: flex; flex-wrap: nowrap; gap: 10px">
|
|
|
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:comStaff:add']">新增</el-button>
|
|
|
- </el-col>
|
|
|
+ </div>
|
|
|
</el-row>
|
|
|
</template>
|
|
|
|
|
|
@@ -59,6 +63,11 @@
|
|
|
<el-switch v-model="scope.row.status" active-value="0" inactive-value="1" @change="handleStatusChange(scope.row)"></el-switch>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="所属平台" align="center" prop="platformRange">
|
|
|
+ <template #default="scope">
|
|
|
+ <dict-tag :options="sys_platform_code" :value="scope.row.platformRange" />
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
|
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['system:comStaff:edit']">编辑</el-button>
|
|
|
@@ -72,19 +81,16 @@
|
|
|
<el-dialog :title="dialog.title" v-model="dialog.visible" width="700px" append-to-body>
|
|
|
<el-form ref="comStaffFormRef" :model="form" :rules="rules" label-width="100px">
|
|
|
<el-row :gutter="20">
|
|
|
- <el-col :span="12">
|
|
|
+ <!-- <el-col :span="12">
|
|
|
<el-form-item label="人员编码" prop="staffCode">
|
|
|
<el-input v-model="form.staffCode" placeholder="请输入人员编码" :disabled="!!form.staffId" />
|
|
|
</el-form-item>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="姓名" prop="staffName">
|
|
|
<el-input v-model="form.staffName" placeholder="请输入姓名" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
-
|
|
|
- <el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="所属部门" prop="deptId">
|
|
|
<el-tree-select
|
|
|
@@ -96,6 +102,14 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="手机号" prop="phone">
|
|
|
+ <el-input v-model="form.phone" placeholder="请输入联系电话" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="岗位" prop="postId">
|
|
|
<el-select v-model="form.postId" placeholder="请选择岗位">
|
|
|
@@ -106,11 +120,6 @@
|
|
|
</el-row>
|
|
|
|
|
|
<el-row :gutter="20">
|
|
|
- <el-col :span="12">
|
|
|
- <el-form-item label="手机号" prop="phone">
|
|
|
- <el-input v-model="form.phone" placeholder="请输入联系电话" />
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="性别" prop="sex">
|
|
|
<el-radio-group v-model="form.sex">
|
|
|
@@ -118,8 +127,6 @@
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- </el-row>
|
|
|
- <el-row :gutter="20">
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="是否启用" prop="status">
|
|
|
<el-radio-group v-model="form.status">
|
|
|
@@ -128,6 +135,15 @@
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
+ <el-row>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="所属平台" prop="platformRange">
|
|
|
+ <el-select v-model="form.platformRange" placeholder="请选择平台" filterable multiple>
|
|
|
+ <el-option v-for="dict in sys_platform_code" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
</el-form>
|
|
|
<template #footer>
|
|
|
<div class="dialog-footer">
|
|
|
@@ -148,7 +164,9 @@ import { listPost, getPost, deptTreeSelect } from '@/api/system/post';
|
|
|
import { PostVO } from '@/api/system/post/types';
|
|
|
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
-const { sys_platform_yes_no, sys_user_sex } = toRefs<any>(proxy?.useDict('sys_platform_yes_no', 'sys_user_sex'));
|
|
|
+const { sys_platform_yes_no, sys_user_sex, sys_platform_code } = toRefs<any>(
|
|
|
+ proxy?.useDict('sys_platform_yes_no', 'sys_user_sex', 'sys_platform_code')
|
|
|
+);
|
|
|
|
|
|
const comStaffList = ref<ComStaffVO[]>([]);
|
|
|
const buttonLoading = ref(false);
|
|
|
@@ -183,6 +201,7 @@ const initFormData: ComStaffForm = {
|
|
|
validFrom: undefined,
|
|
|
validTo: undefined,
|
|
|
status: '0',
|
|
|
+ platformRange: [],
|
|
|
remark: undefined
|
|
|
};
|
|
|
const data = reactive<PageData<ComStaffForm, ComStaffQuery>>({
|
|
|
@@ -214,7 +233,7 @@ const { queryParams, form, rules } = toRefs(data);
|
|
|
|
|
|
/** 获取部门列表(树结构) */
|
|
|
const getDeptList = async () => {
|
|
|
- const res = await listDept();
|
|
|
+ const res = await listDept({ isCompanyFlag: '0' } as any);
|
|
|
const data = proxy?.handleTree<DeptVO>(res.data, 'deptId');
|
|
|
if (data) {
|
|
|
deptList.value = data;
|
|
|
@@ -225,7 +244,7 @@ const getDeptList = async () => {
|
|
|
/** 获取岗位列表 */
|
|
|
const getPostList = async (deptId?: number | string) => {
|
|
|
try {
|
|
|
- const res = await listPost({ belongDeptId: deptId });
|
|
|
+ const res = await listPost({ belongDeptId: deptId } as any);
|
|
|
postList.value = res.rows || [];
|
|
|
} catch (error) {
|
|
|
console.error('获取岗位列表失败', error);
|
|
|
@@ -297,9 +316,10 @@ const resetQuery = () => {
|
|
|
|
|
|
const handleStatusChange = async (row: ComStaffVO) => {
|
|
|
const oldValue = row.status; // 保存旧值(0 或 1)
|
|
|
+ console.log(row);
|
|
|
|
|
|
try {
|
|
|
- await changeStatus(row.postId, row.status); // 传新值
|
|
|
+ await changeStatus(row.staffId, row.status); // 传新值
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
} catch {
|
|
|
row.status = oldValue; // 失败回滚
|
|
|
@@ -327,6 +347,9 @@ const handleUpdate = async (row?: ComStaffVO) => {
|
|
|
const _staffId = row?.staffId || ids.value[0];
|
|
|
const res = await getComStaff(_staffId);
|
|
|
Object.assign(form.value, res.data);
|
|
|
+ if (res.data.platformRange && typeof res.data.platformRange === 'string') {
|
|
|
+ form.value.platformRange = res.data.platformRange.split(',');
|
|
|
+ }
|
|
|
dialog.visible = true;
|
|
|
dialog.title = '修改人员信息';
|
|
|
};
|
|
|
@@ -336,10 +359,14 @@ const submitForm = () => {
|
|
|
comStaffFormRef.value?.validate(async (valid: boolean) => {
|
|
|
if (valid) {
|
|
|
buttonLoading.value = true;
|
|
|
+ const submitData = {
|
|
|
+ ...form.value,
|
|
|
+ platformRange: Array.isArray(form.value.platformRange) ? form.value.platformRange.join(',') : form.value.platformRange
|
|
|
+ };
|
|
|
if (form.value.staffId) {
|
|
|
- await updateComStaff(form.value).finally(() => (buttonLoading.value = false));
|
|
|
+ await updateComStaff(submitData).finally(() => (buttonLoading.value = false));
|
|
|
} else {
|
|
|
- await addComStaff(form.value).finally(() => (buttonLoading.value = false));
|
|
|
+ await addComStaff(submitData).finally(() => (buttonLoading.value = false));
|
|
|
}
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
dialog.visible = false;
|