|
@@ -5,11 +5,26 @@ defineOptions({
|
|
|
});
|
|
|
import { ref, reactive } from "vue";
|
|
|
import { ElMessageBox, ElMessage } from "element-plus";
|
|
|
-const dialogVisibleAdd = ref(false);
|
|
|
-const handleNodeClick = data => {
|
|
|
- console.log(data);
|
|
|
-};
|
|
|
-
|
|
|
+import prosonEditDrawer from "./components/prosonEditDrawer.vue";
|
|
|
+import newDepartment from "./components/newDepartment.vue";
|
|
|
+import addPerson from "./components/addPerson.vue";
|
|
|
+import personDetailsDrawer from "./components/personDetailsDrawer.vue";
|
|
|
+import changeRole from "./components/changeRole.vue";
|
|
|
+// 添加部门
|
|
|
+const newDepartmentRef = ref(null);
|
|
|
+const newDepartmentShow = ref(false);
|
|
|
+// 编辑部门
|
|
|
+const prosonEditDrawerRef = ref(null);
|
|
|
+const prosonEditDrawerShow = ref(false);
|
|
|
+// 添加成员
|
|
|
+const addPersonDrawerRef = ref(null);
|
|
|
+const addPersonDrawerShow = ref(false);
|
|
|
+// 成员详情
|
|
|
+const personDetailsDrawerRef = ref(null);
|
|
|
+const personDetailsDrawerShow = ref(false);
|
|
|
+// 配置角色
|
|
|
+const changeRoleRef = ref(null);
|
|
|
+const changeRoleShow = ref(false);
|
|
|
const data = [
|
|
|
{
|
|
|
label: "Level one 1",
|
|
@@ -67,11 +82,6 @@ const data = [
|
|
|
]
|
|
|
}
|
|
|
];
|
|
|
-
|
|
|
-const defaultProps = {
|
|
|
- children: "children",
|
|
|
- label: "label"
|
|
|
-};
|
|
|
const tableData = [
|
|
|
{
|
|
|
date: "2016-05-03",
|
|
@@ -96,14 +106,17 @@ const tableData = [
|
|
|
];
|
|
|
// 添加部门弹窗
|
|
|
const addDepartment = () => {
|
|
|
- dialogVisibleAdd.value = !dialogVisibleAdd.value;
|
|
|
+ newDepartmentRef.value.open();
|
|
|
};
|
|
|
-const handleClose = () => {
|
|
|
- ElMessageBox.confirm("确认关闭弹窗吗?")
|
|
|
+// 删除人员
|
|
|
+const deletePerson = row => {
|
|
|
+ console.log(row);
|
|
|
+ ElMessageBox.confirm("删除后不可恢复,确定要删除吗?", "确认删除该人员吗?", {
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
.then(() => {
|
|
|
- dialogVisibleAdd.value = !dialogVisibleAdd.value;
|
|
|
ElMessage({
|
|
|
- message: "已关闭",
|
|
|
+ message: "删除成功",
|
|
|
type: "success"
|
|
|
});
|
|
|
})
|
|
@@ -111,31 +124,62 @@ const handleClose = () => {
|
|
|
// catch error
|
|
|
});
|
|
|
};
|
|
|
-// 添加部门保存
|
|
|
-const saveDepartment = () => {
|
|
|
- dialogVisibleAdd.value = false;
|
|
|
- ElMessage({
|
|
|
- message: "添加成功",
|
|
|
- type: "success"
|
|
|
- });
|
|
|
+// 编辑部门弹窗
|
|
|
+const editDepartment = () => {
|
|
|
+ prosonEditDrawerRef.value.open();
|
|
|
};
|
|
|
-const form = reactive({
|
|
|
- name: "",
|
|
|
- region: "",
|
|
|
- date1: "",
|
|
|
- date2: "",
|
|
|
- delivery: false,
|
|
|
- type: [],
|
|
|
- resource: "",
|
|
|
- desc: ""
|
|
|
-});
|
|
|
-const deleteRow = row => {
|
|
|
+// 删除部门
|
|
|
+const deleteDepartment = () => {
|
|
|
+ ElMessageBox.confirm(
|
|
|
+ "请先移除部门内的所有人员再进行删除部门操作",
|
|
|
+ "确认删除该部门吗?",
|
|
|
+ {
|
|
|
+ type: "warning"
|
|
|
+ }
|
|
|
+ )
|
|
|
+ .then(() => {
|
|
|
+ ElMessage({
|
|
|
+ message: "删除成功",
|
|
|
+ type: "success"
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ // catch error
|
|
|
+ });
|
|
|
+};
|
|
|
+// 添加成员弹窗
|
|
|
+const AddPerson = () => {
|
|
|
+ addPersonDrawerRef.value.open();
|
|
|
+};
|
|
|
+const personDetails = row => {
|
|
|
+ personDetailsDrawerRef.value.open();
|
|
|
+ console.log(row);
|
|
|
+};
|
|
|
+const ChangeRole = row => {
|
|
|
+ changeRoleRef.value.open();
|
|
|
console.log(row);
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<div class="flex w-full h-full">
|
|
|
+ <!-- 编辑部门 -->
|
|
|
+ <prosonEditDrawer
|
|
|
+ ref="prosonEditDrawerRef"
|
|
|
+ v-model="prosonEditDrawerShow"
|
|
|
+ />
|
|
|
+ <!-- 添加部门 -->
|
|
|
+ <newDepartment ref="newDepartmentRef" v-model="newDepartmentShow" />
|
|
|
+ <!-- 添加成员 -->
|
|
|
+ <addPerson ref="addPersonDrawerRef" v-model="addPersonDrawerShow" />
|
|
|
+ <!-- 成员详情 -->
|
|
|
+ <personDetailsDrawer
|
|
|
+ ref="personDetailsDrawerRef"
|
|
|
+ v-model="personDetailsDrawerShow"
|
|
|
+ />
|
|
|
+ <!-- 配置角色 -->
|
|
|
+ <changeRole ref="changeRoleRef" v-model="changeRoleShow" />
|
|
|
+ <!-- 主体内容 -->
|
|
|
<div class="box-left">
|
|
|
<el-input placeholder="搜索" class="mb-2" />
|
|
|
<el-tree
|
|
@@ -154,11 +198,15 @@ const deleteRow = row => {
|
|
|
</span>
|
|
|
<template #dropdown>
|
|
|
<el-dropdown-menu class="setting">
|
|
|
- <el-dropdown-item> 编辑部门 </el-dropdown-item>
|
|
|
+ <el-dropdown-item @click="editDepartment">
|
|
|
+ 编辑部门
|
|
|
+ </el-dropdown-item>
|
|
|
<el-dropdown-item> 添加子部门 </el-dropdown-item>
|
|
|
<el-dropdown-item> 配置角色 </el-dropdown-item>
|
|
|
<el-dropdown-item>
|
|
|
- <el-link type="danger">删除</el-link>
|
|
|
+ <el-link type="danger" @click="deleteDepartment"
|
|
|
+ >删除</el-link
|
|
|
+ >
|
|
|
</el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
@@ -172,7 +220,7 @@ const deleteRow = row => {
|
|
|
<div class="box-right">
|
|
|
<div class="flex justify-between mb-3">
|
|
|
<el-input placeholder="搜索" class="mb-2" style="max-width: 300px" />
|
|
|
- <el-button type="primary">添加成员</el-button>
|
|
|
+ <el-button type="primary" @click="AddPerson">添加成员</el-button>
|
|
|
</div>
|
|
|
<el-table :data="tableData" style="width: 100%">
|
|
|
<el-table-column prop="date" label="姓名" />
|
|
@@ -184,18 +232,20 @@ const deleteRow = row => {
|
|
|
<el-table-column label="操作">
|
|
|
<template #default="{ row }">
|
|
|
<el-dropdown trigger="click" class="mr-2">
|
|
|
- <el-icon><View /></el-icon>
|
|
|
+ <el-icon @click="personDetails(row)"><View /></el-icon>
|
|
|
</el-dropdown>
|
|
|
<el-dropdown trigger="click">
|
|
|
<el-icon><Operation /></el-icon>
|
|
|
<template #dropdown>
|
|
|
<el-dropdown-menu class="setting">
|
|
|
<el-dropdown-item>
|
|
|
- <el-link type="danger" @click="deleteRow(row)"
|
|
|
+ <el-link type="danger" @click="deletePerson(row)"
|
|
|
>删除</el-link
|
|
|
>
|
|
|
</el-dropdown-item>
|
|
|
- <el-dropdown-item> 配置角色 </el-dropdown-item>
|
|
|
+ <el-dropdown-item @click="ChangeRole(row)">
|
|
|
+ 配置角色
|
|
|
+ </el-dropdown-item>
|
|
|
</el-dropdown-menu>
|
|
|
</template>
|
|
|
</el-dropdown>
|
|
@@ -203,56 +253,6 @@ const deleteRow = row => {
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
- <!-- 添加部门 -->
|
|
|
- <el-dialog
|
|
|
- v-model="dialogVisibleAdd"
|
|
|
- title="新建部门"
|
|
|
- width="500"
|
|
|
- :before-close="handleClose"
|
|
|
- >
|
|
|
- <el-form :model="form" label-width="auto" style="max-width: 600px">
|
|
|
- <el-form-item
|
|
|
- prop="name"
|
|
|
- label="部门名称"
|
|
|
- :rules="[
|
|
|
- {
|
|
|
- required: true,
|
|
|
- message: '请填写部门名称',
|
|
|
- trigger: 'blur'
|
|
|
- }
|
|
|
- ]"
|
|
|
- >
|
|
|
- <el-input v-model="form.name" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="部门编号">
|
|
|
- <el-input v-model="form.name" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="上级部门">
|
|
|
- <el-select
|
|
|
- v-model="form.region"
|
|
|
- placeholder="please select your zone"
|
|
|
- >
|
|
|
- <el-option label="Zone one" value="shanghai" />
|
|
|
- <el-option label="Zone two" value="beijing" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="部门负责人">
|
|
|
- <el-select
|
|
|
- v-model="form.region"
|
|
|
- placeholder="please select your zone"
|
|
|
- >
|
|
|
- <el-option label="Zone one" value="shanghai" />
|
|
|
- <el-option label="Zone two" value="beijing" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <div class="dialog-footer">
|
|
|
- <el-button @click="handleClose">取消</el-button>
|
|
|
- <el-button type="primary" @click="saveDepartment"> 确认 </el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<style lang="scss" scoped>
|