增加个人办公模块
This commit is contained in:
@@ -37,38 +37,31 @@
|
||||
<template #default="{ data }">
|
||||
<div class="tree-node">
|
||||
<div class="node-content">
|
||||
<span class="node-icon">
|
||||
<el-icon v-if="data.is_company">
|
||||
<OfficeBuilding />
|
||||
</el-icon>
|
||||
<el-icon v-else>
|
||||
<Folder />
|
||||
</el-icon>
|
||||
</span>
|
||||
<span
|
||||
class="node-status-dot"
|
||||
:class="data.status === 1 ? 'is-active' : 'is-inactive'"
|
||||
:title="data.status === 1 ? '启用' : '停用'"
|
||||
/>
|
||||
<span class="node-label">{{ data.org_name }}</span>
|
||||
<span class="node-code">{{ data.org_code }}</span>
|
||||
<span class="node-status">
|
||||
<el-tag :type="data.status === 1 ? 'success' : 'danger'" size="small">
|
||||
{{ data.status === 1 ? '启用' : '禁用' }}
|
||||
</el-tag>
|
||||
</span>
|
||||
</div>
|
||||
<div class="node-actions">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
title="编辑"
|
||||
@click.stop="editOrg(data)"
|
||||
>
|
||||
编辑
|
||||
<el-icon><Edit /></el-icon>
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
size="small"
|
||||
title="添加子组织"
|
||||
@click.stop="addChildOrg(data)"
|
||||
>
|
||||
添加子组织
|
||||
<el-icon><Plus /></el-icon>
|
||||
</el-button>
|
||||
<el-button
|
||||
link
|
||||
@@ -203,10 +196,9 @@ import {
|
||||
Plus,
|
||||
Refresh,
|
||||
Setting,
|
||||
OfficeBuilding,
|
||||
Folder,
|
||||
Expand,
|
||||
Fold
|
||||
Fold,
|
||||
Edit
|
||||
} from "@element-plus/icons-vue";
|
||||
import OrgEditDialog from "./components/orgEditDialog.vue";
|
||||
import EmployeeEditDialog from "./components/employeeEditDialog.vue";
|
||||
@@ -273,8 +265,9 @@ const employeeFormData = reactive(emptyEmployeeForm());
|
||||
|
||||
const loadOrgTree = async () => {
|
||||
try {
|
||||
const data = await getOrganizationList();
|
||||
orgTreeData.value = buildTreeData(data);
|
||||
const res = await getOrganizationList();
|
||||
const data = res?.data || res || [];
|
||||
orgTreeData.value = buildTreeData(Array.isArray(data) ? data : []);
|
||||
if (orgTreeData.value.length > 0 && !selectedOrg.value) {
|
||||
selectedOrg.value = orgTreeData.value[0];
|
||||
await loadEmployeeList(selectedOrg.value.id);
|
||||
@@ -332,8 +325,9 @@ const collapseAll = () => {
|
||||
|
||||
const loadEmployeeList = async (orgId) => {
|
||||
try {
|
||||
const data = await getEmployeeList({ org_id: orgId });
|
||||
employeeList.value = data || [];
|
||||
const res = await getEmployeeList({ org_id: orgId });
|
||||
const data = res?.data || res || [];
|
||||
employeeList.value = Array.isArray(data) ? data : [];
|
||||
} catch (error) {
|
||||
ElMessage.error(error?.message || '加载员工列表失败');
|
||||
}
|
||||
@@ -571,22 +565,24 @@ onMounted(() => {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.node-icon {
|
||||
color: #409eff;
|
||||
}
|
||||
|
||||
.node-label {
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.node-code {
|
||||
color: #909399;
|
||||
font-size: 12px;
|
||||
}
|
||||
.node-status-dot {
|
||||
flex-shrink: 0;
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
|
||||
.node-status {
|
||||
margin-left: 8px;
|
||||
&.is-active {
|
||||
background-color: #67c23a;
|
||||
}
|
||||
|
||||
&.is-inactive {
|
||||
background-color: #c0c4cc;
|
||||
}
|
||||
}
|
||||
|
||||
.node-actions {
|
||||
|
||||
Reference in New Issue
Block a user