组织架构完成
This commit is contained in:
parent
fd6f4ef9b1
commit
da4af39a04
|
|
@ -1,5 +1,5 @@
|
|||
// Generated by 'unplugin-auto-import'
|
||||
export {}
|
||||
declare global {
|
||||
const ElMessage: typeof import('element-plus/es')['ElMessage']
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,6 +88,19 @@ export const AdminAddUserRequestService = (Data) => {
|
|||
})
|
||||
}
|
||||
|
||||
export const AdminAddUserGroupRequestService = (Data) => {
|
||||
const params = new URLSearchParams();
|
||||
for (let key in Data) {
|
||||
params.append(key, Data[key])
|
||||
}
|
||||
let token = localStorage.getItem("token") || "";
|
||||
return request.post('/user/add_group', params,{
|
||||
headers: {
|
||||
'token': token,
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export const AdminDeleteUserRequestService = (Data) => {
|
||||
const params = new URLSearchParams();
|
||||
for (let key in Data) {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@
|
|||
:close-on-click-modal="false" @close="closeDialog">
|
||||
<TableEdit :form-data="rowData" :options="options" :edit="isAdd" :update="addData" />
|
||||
</el-dialog>
|
||||
<el-dialog :title="'新建用户组'" v-model="visible_add_group" width="700px" destroy-on-close
|
||||
:close-on-click-modal="false" @close="closeDialog">
|
||||
<TableEdit :form-data="rowData_" :options="options_gourp" :edit="isAddGroup" :update="addGroupData" />
|
||||
</el-dialog>
|
||||
<el-dialog title="查看详情" v-model="visible1" width="700px" destroy-on-close>
|
||||
<TableDetail :data="viewData"></TableDetail>
|
||||
</el-dialog>
|
||||
|
|
@ -43,6 +47,9 @@
|
|||
|
||||
<el-dialog title="组织架构" v-model="visible_system" width="900px" destroy-on-close>
|
||||
<div>
|
||||
<el-button type="primary" link @click="append_group({id:0,name:'根目录',type:0})">
|
||||
添加用户组
|
||||
</el-button>
|
||||
<el-tree
|
||||
ref="treeRef"
|
||||
style="max-width: 800px;"
|
||||
|
|
@ -92,7 +99,7 @@ import { ElMessage } from 'element-plus';
|
|||
import { CirclePlusFilled } from '@element-plus/icons-vue';
|
||||
import { UserInfo } from '@/types/user';
|
||||
import { fetchUserData } from '@/api';
|
||||
import { SearchUserService,AdminAddUserRequestService,UpdateUserCatalogueService,AdminDeleteUserRequestService } from "@/api/user";
|
||||
import { SearchUserService,AdminAddUserRequestService,UpdateUserCatalogueService,AdminDeleteUserRequestService,AdminAddUserGroupRequestService } from "@/api/user";
|
||||
import {GetUserInfoService} from "@/api/user";
|
||||
import {updateUserInfoService} from "@/api/user";
|
||||
import TableCustom from '@/components/table-custom.vue';
|
||||
|
|
@ -108,6 +115,8 @@ interface Tree {
|
|||
label: string
|
||||
children?: Tree[]
|
||||
}
|
||||
|
||||
const visible_add_group = ref(false);
|
||||
const opts_group = ref([]);
|
||||
const currentNode = ref(null);
|
||||
const currentPrev = ref(0); // 当前选中的父节点ID
|
||||
|
|
@ -185,7 +194,7 @@ const append_user = (data) => {
|
|||
|
||||
const append_group = (data) => {
|
||||
currentPrev.value = data.id;
|
||||
visible_add.value = true;
|
||||
visible_add_group.value = true;
|
||||
};
|
||||
|
||||
const remove = async (node, data) => {
|
||||
|
|
@ -320,6 +329,25 @@ const getData = async () => {
|
|||
};
|
||||
getData();
|
||||
|
||||
const addGroupData = async (data) => {
|
||||
let result ={}
|
||||
try{
|
||||
let req={
|
||||
prev: currentPrev.value,
|
||||
name: data.Name,
|
||||
}
|
||||
result = await AdminAddUserGroupRequestService(req);
|
||||
if (result["code"] === 0) {
|
||||
ElMessage.success("新增成功");
|
||||
closeDialog();
|
||||
} else {
|
||||
ElMessage.error("新增失败:"+result["message"]);
|
||||
}
|
||||
}catch(e){
|
||||
console.log(e);
|
||||
}
|
||||
GetAllDefaultUsers();
|
||||
};
|
||||
const addData = async (data) => {
|
||||
let result ={}
|
||||
try{
|
||||
|
|
@ -369,6 +397,14 @@ let options = ref<FormOption>({
|
|||
]
|
||||
})
|
||||
|
||||
let options_gourp = ref<FormOption>({
|
||||
labelWidth: '100px',
|
||||
span: 12,
|
||||
list: [
|
||||
{ type: 'input', label: '用户组名', prop: 'Name', required: true },
|
||||
]
|
||||
})
|
||||
|
||||
//编辑弹窗
|
||||
let options_edit = ref<FormOption>({
|
||||
labelWidth: '100px',
|
||||
|
|
@ -390,7 +426,9 @@ const visible = ref(false);
|
|||
const visible_add = ref(false);
|
||||
const isEdit = ref(false);
|
||||
const isAdd = ref(false);
|
||||
const isAddGroup = ref(false);
|
||||
const rowData = ref({});
|
||||
const rowData_ = ref({});
|
||||
const handleEdit = async (row: UserInfo) => {
|
||||
let data = await getUserInfo(row.ID);
|
||||
|
||||
|
|
@ -449,6 +487,8 @@ const closeDialog = () => {
|
|||
visible.value = false;
|
||||
visible_add.value = false;
|
||||
isEdit.value = false;
|
||||
visible_add_group.value = false;
|
||||
|
||||
};
|
||||
|
||||
// 查看详情弹窗相关
|
||||
|
|
|
|||
Loading…
Reference in New Issue