|
|
@@ -112,6 +112,20 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="部门经理" prop="managerId">
|
|
|
+ <el-select v-model="form.managerId" placeholder="请选择部门经理" @change="handleManagerChange">
|
|
|
+ <el-option v-for="item in staffOptions" :key="item.staffId" :label="`${item.staffCode} , ${item.staffName}`" :value="item.staffId" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="12">
|
|
|
+ <el-form-item label="部门主管" prop="chargeId">
|
|
|
+ <el-select v-model="form.chargeId" placeholder="请选择部门主管" @change="handleChargeChange">
|
|
|
+ <el-option v-for="item in staffOptions" :key="item.staffId" :label="`${item.staffCode} , ${item.staffName}`" :value="item.staffId" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
<el-col :span="12">
|
|
|
<el-form-item label="联系电话" prop="phone">
|
|
|
<el-input v-model="form.phone" placeholder="请输入联系电话" maxlength="11" />
|
|
|
@@ -157,7 +171,8 @@ import { DeptForm, DeptQuery, DeptVO } from '@/api/system/dept/types';
|
|
|
import { UserVO } from '@/api/system/user/types';
|
|
|
import { listUserByDeptId } from '@/api/system/user';
|
|
|
import { getPlatformCode } from '@/utils/platform';
|
|
|
-
|
|
|
+import { listComStaff } from '@/api/company/comStaff';
|
|
|
+import { ComStaffVO } from '@/api/company/comStaff/types';
|
|
|
interface DeptOptionsType {
|
|
|
deptId: number | string;
|
|
|
deptName: string;
|
|
|
@@ -184,6 +199,7 @@ const dialog = reactive<DialogOption>({
|
|
|
const deptTableRef = ref<ElTableInstance>();
|
|
|
const queryFormRef = ref<ElFormInstance>();
|
|
|
const deptFormRef = ref<ElFormInstance>();
|
|
|
+const staffOptions = ref<ComStaffVO[]>([]);
|
|
|
|
|
|
const initFormData: DeptForm = {
|
|
|
deptId: undefined,
|
|
|
@@ -259,6 +275,43 @@ const resetQuery = () => {
|
|
|
handleQuery();
|
|
|
};
|
|
|
|
|
|
+/** 获取员工列表 */
|
|
|
+const getStaffList = async () => {
|
|
|
+ try {
|
|
|
+ const res = await listComStaff();
|
|
|
+ staffOptions.value = res.rows || [];
|
|
|
+ } catch (error) {
|
|
|
+ console.error('获取列表失败:', error);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+/** 经理变更 */
|
|
|
+const handleManagerChange = (staffId: string | number) => {
|
|
|
+ if (staffId) {
|
|
|
+ const staff = staffOptions.value.find((item) => item.staffId === staffId);
|
|
|
+ if (staff) {
|
|
|
+ form.value.managerName = staff.staffName || '';
|
|
|
+ form.value.managerNo = staff.staffCode || '';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ form.value.managerName = '';
|
|
|
+ form.value.managerNo = '';
|
|
|
+ }
|
|
|
+};
|
|
|
+/** 主管变更 */
|
|
|
+const handleChargeChange = (staffId: string | number) => {
|
|
|
+ if (staffId) {
|
|
|
+ const staff = staffOptions.value.find((item) => item.staffId === staffId);
|
|
|
+ if (staff) {
|
|
|
+ form.value.chargeName = staff.staffName || '';
|
|
|
+ form.value.chargeNo = staff.staffCode || '';
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ form.value.chargeName = '';
|
|
|
+ form.value.chargeNo = '';
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
/** 展开/折叠操作 */
|
|
|
const handleToggleExpandAll = () => {
|
|
|
isExpandAll.value = !isExpandAll.value;
|
|
|
@@ -335,5 +388,6 @@ const handleDelete = async (row: DeptVO) => {
|
|
|
|
|
|
onMounted(() => {
|
|
|
getList();
|
|
|
+ getStaffList();
|
|
|
});
|
|
|
</script>
|