@@ -0,0 +1,34 @@ | |||
/** | |||
* @description 用户管理接口 | |||
* @license Apache License Version 2.0 | |||
* @Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛 | |||
* @remarks | |||
* SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款: | |||
* 1.请不要删除和修改根目录下的LICENSE文件。 | |||
* 2.请不要删除和修改SimpleAdmin源码头部的版权声明。 | |||
* 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin | |||
* 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。 | |||
* 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为不要删除和修改作者声明。 | |||
* 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关 | |||
*/ | |||
import { ReqPage } from "@/api"; | |||
/** | |||
* @Description: 院系管理接口 | |||
* @Author: wwp | |||
* @Date: 2024-07-24 15:34:54 | |||
*/ | |||
export namespace SysDepartment { | |||
// 院系信息 | |||
export interface DepartmentInfo { | |||
id?: string | number | undefined; | |||
name?: string | undefined; | |||
code?: string | undefined; | |||
introduce?: string | undefined; | |||
depId?: string | number | undefined; | |||
departmentName?: string | undefined; | |||
} | |||
// 院系列表传参 | |||
export interface Page extends ReqPage {} | |||
} |
@@ -15,3 +15,5 @@ | |||
export * from "./personnel"; | |||
export * from "./clothing"; | |||
export * from "./dormitory"; | |||
export * from "./department"; | |||
export * from "./major"; |
@@ -0,0 +1,34 @@ | |||
/** | |||
* @description 用户管理接口 | |||
* @license Apache License Version 2.0 | |||
* @Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛 | |||
* @remarks | |||
* SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款: | |||
* 1.请不要删除和修改根目录下的LICENSE文件。 | |||
* 2.请不要删除和修改SimpleAdmin源码头部的版权声明。 | |||
* 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin | |||
* 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。 | |||
* 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为不要删除和修改作者声明。 | |||
* 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关 | |||
*/ | |||
import { ReqPage } from "@/api"; | |||
/** | |||
* @Description: 专业管理接口 | |||
* @Author: wwp | |||
* @Date: 2024-07-24 15:34:54 | |||
*/ | |||
export namespace SysMajor { | |||
// 院系信息 | |||
export interface MajorInfo { | |||
id?: string | number | undefined; | |||
name?: string | undefined; | |||
code?: string | undefined; | |||
introduce?: string | undefined; | |||
depId?: string | number | undefined; | |||
departmentName?: string | undefined; | |||
} | |||
// 院系列表传参 | |||
export interface Page extends ReqPage {} | |||
} |
@@ -0,0 +1,60 @@ | |||
/** | |||
* @description 单页管理接口 | |||
* @license Apache License Version 2.0 | |||
* @Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛 | |||
* @remarks | |||
* SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款: | |||
* 1.请不要删除和修改根目录下的LICENSE文件。 | |||
* 2.请不要删除和修改SimpleAdmin源码头部的版权声明。 | |||
* 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin | |||
* 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。 | |||
* 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为不要删除和修改作者声明。 | |||
* 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关 | |||
* @see https://gitee.com/dotnetmoyu/SimpleAdmin | |||
*/ | |||
import { moduleRequest } from "@/api/request"; | |||
import { ReqId, ResPage, ReqPersonId, SysDepartment } from "@/api/interface"; | |||
const http = moduleRequest("/business/department/"); | |||
/** | |||
* @Description: 单页管理 | |||
* @Author: wwp | |||
* @Date: 2023-12-15 15:34:54 | |||
*/ | |||
const userManageDepartmentApi = { | |||
// 获取院系分页列表 | |||
page(params: SysDepartment.Page) { | |||
return http.get("getPageList", params); | |||
}, | |||
/** 新增院系 */ | |||
add(params: SysDepartment.DepartmentInfo) { | |||
return http.post("add", params); | |||
}, | |||
/** 修改院系 */ | |||
update(params: SysDepartment.DepartmentInfo) { | |||
return http.put("update", params); | |||
}, | |||
/** 删除院系 */ | |||
delete(params: ReqId) { | |||
return http.post("delete", params); | |||
}, | |||
// 院系详情 | |||
detail(params: ReqId) { | |||
return http.post("getInfo", params); | |||
}, | |||
/**院系列表(不分页)*/ | |||
list(params: any) { | |||
return http.get("getNoPageList", params); | |||
} | |||
}; | |||
const departmentButtonCode = { | |||
/** 新增人员 */ | |||
add: "userManageDepartmentAdd", | |||
/** 删除人员 */ | |||
edit: "userManageDepartmentEdit", | |||
/** 删除人员 */ | |||
delete: "userManageDepartmentDelete" | |||
}; | |||
export { userManageDepartmentApi, departmentButtonCode }; |
@@ -18,3 +18,5 @@ export * from "./clothing"; | |||
export * from "./teacher"; | |||
export * from "./keyPersonnel"; | |||
export * from "./dormitory"; | |||
export * from "./department"; | |||
export * from "./major"; |
@@ -0,0 +1,60 @@ | |||
/** | |||
* @description 单页管理接口 | |||
* @license Apache License Version 2.0 | |||
* @Copyright (c) 2022-Now 少林寺驻北固山办事处大神父王喇嘛 | |||
* @remarks | |||
* SimpleAdmin 基于 Apache License Version 2.0 协议发布,可用于商业项目,但必须遵守以下补充条款: | |||
* 1.请不要删除和修改根目录下的LICENSE文件。 | |||
* 2.请不要删除和修改SimpleAdmin源码头部的版权声明。 | |||
* 3.分发源码时候,请注明软件出处 https://gitee.com/dotnetmoyu/SimpleAdmin | |||
* 4.基于本软件的作品,只能使用 SimpleAdmin 作为后台服务,除外情况不可商用且不允许二次分发或开源。 | |||
* 5.请不得将本软件应用于危害国家安全、荣誉和利益的行为,不能以任何形式用于非法为目的的行为不要删除和修改作者声明。 | |||
* 6.任何基于本软件而产生的一切法律纠纷和责任,均于我司无关 | |||
* @see https://gitee.com/dotnetmoyu/SimpleAdmin | |||
*/ | |||
import { moduleRequest } from "@/api/request"; | |||
import { ReqId, ResPage, ReqPersonId, SysMajor } from "@/api/interface"; | |||
const http = moduleRequest("/business/major/"); | |||
/** | |||
* @Description: 单页管理 | |||
* @Author: wwp | |||
* @Date: 2023-12-15 15:34:54 | |||
*/ | |||
const userManageMajorApi = { | |||
// 获取专业分页列表 | |||
page(params: SysMajor.Page) { | |||
return http.get("getPageList", params); | |||
}, | |||
/** 新增专业 */ | |||
add(params: SysMajor.MajorInfo) { | |||
return http.post("add", params); | |||
}, | |||
/** 修改专业 */ | |||
update(params: SysMajor.MajorInfo) { | |||
return http.put("update", params); | |||
}, | |||
/** 删除专业 */ | |||
delete(params: ReqId) { | |||
return http.post("delete", params); | |||
}, | |||
// 专业详情 | |||
detail(params: ReqId) { | |||
return http.post("getInfo", params); | |||
}, | |||
/**专业列表(不分页)*/ | |||
list(params: any) { | |||
return http.get("getNoPageList", params); | |||
} | |||
}; | |||
const majorButtonCode = { | |||
/** 新增人员 */ | |||
add: "userManageMajorAdd", | |||
/** 删除人员 */ | |||
edit: "userManageMajorEdit", | |||
/** 删除人员 */ | |||
delete: "userManageMajorDelete" | |||
}; | |||
export { userManageMajorApi, majorButtonCode }; |
@@ -0,0 +1,124 @@ | |||
<!-- | |||
* @Description: 表单 | |||
* @Author: huguodong | |||
* @Date: 2023-12-15 15:45:28 | |||
!--> | |||
<template> | |||
<div> | |||
<form-container v-model="visible" :title="`${orgProps.opt}监控`" form-size="600px"> | |||
<el-form | |||
ref="liveFormRef" | |||
:rules="rules" | |||
:disabled="orgProps.disabled" | |||
:model="orgProps.record" | |||
:hide-required-asterisk="orgProps.disabled" | |||
label-width="auto" | |||
label-suffix=" :" | |||
> | |||
<s-form-item label="摄像头名称" prop="sensorName"> | |||
<s-input v-model="orgProps.record.sensorName"></s-input> | |||
</s-form-item> | |||
<s-form-item label="所属学校" prop="fieldName"> | |||
<org-selector v-model:org-value="orgProps.record.fieldName" :org-tree-api="bizOrgApi.tree" :show-all="false" /> | |||
</s-form-item> | |||
<s-form-item label="设备IP" prop="directUrlIp"> | |||
<s-input v-model="orgProps.record.directUrlIp" clearable></s-input> | |||
</s-form-item> | |||
<s-form-item label="分辨率(width)" prop="resWidth"> | |||
<s-input v-model="orgProps.record.resWidth" clearable></s-input> | |||
</s-form-item> | |||
<s-form-item label="分辨率(height)" prop="resHeight"> | |||
<s-input v-model="orgProps.record.resHeight" clearable></s-input> | |||
</s-form-item> | |||
</el-form> | |||
<template #footer> | |||
<el-button @click="onClose"> 取消 </el-button> | |||
<el-button v-show="!orgProps.disabled" type="primary" @click="handleSubmit"> 确定 </el-button> | |||
</template> | |||
</form-container> | |||
</div> | |||
</template> | |||
<script setup lang="ts"> | |||
import { SysOrg, SysUser, bizOrgApi, bizPositionApi, sysRoleApi, bizUserApi } from "@/api"; | |||
import { FormOptEnum, SysDictEnum } from "@/enums"; | |||
import { required } from "@/utils/formRules"; | |||
import { FormInstance } from "element-plus"; | |||
import { useDictStore } from "@/stores/modules"; | |||
const visible = ref(false); //是否显示表单 | |||
const dictStore = useDictStore(); //字典仓库 | |||
// 通用状态选项 | |||
const statusOptions = dictStore.getDictList(SysDictEnum.COMMON_STATUS); | |||
// 表单参数 | |||
const orgProps = reactive<FormProps.Base<any>>({ | |||
opt: FormOptEnum.ADD, | |||
record: {}, | |||
disabled: false | |||
}); | |||
// 表单验证规则 | |||
const rules = reactive({ | |||
sensorName: [required("请输入摄像头名称")], | |||
fieldName: [required("请选择所属学校")], | |||
directUrlIp: [required("请选择设备IP")], | |||
resWidth: [required("请输入分辨率(width)")], | |||
resHeight: [required("请输入分辨率(height)")] | |||
}); | |||
/** | |||
* 打开表单 | |||
* @param props 表单参数 | |||
*/ | |||
function onOpen(props: FormProps.Base<SysOrg.SysOrgInfo>) { | |||
Object.assign(orgProps, props); //合并参数 | |||
if (props.opt == FormOptEnum.ADD) { | |||
//如果是新增,设置默认值 | |||
// orgProps.record.sortCode = 99; | |||
// orgProps.record.status = statusOptions[0].value; | |||
} | |||
visible.value = true; //显示表单 | |||
if (props.record.id) { | |||
orgProps.record = props.record; | |||
//如果传了id,就去请求api获取record | |||
return; | |||
bizOrgApi.detail({ id: props.record.id }).then(res => { | |||
orgProps.record = res.data; | |||
}); | |||
} | |||
} | |||
// 提交数据(新增/编辑) | |||
const liveFormRef = ref<FormInstance>(); | |||
/** 提交表单 */ | |||
async function handleSubmit() { | |||
liveFormRef.value?.validate(async valid => { | |||
if (!valid) return; //表单验证失败 | |||
console.log(orgProps); | |||
return; | |||
//提交表单 | |||
await bizOrgApi | |||
.submitForm(orgProps.record, orgProps.record.id != undefined) | |||
.then(() => { | |||
orgProps.successful!(); //调用父组件的successful方法 | |||
}) | |||
.finally(() => { | |||
onClose(); | |||
}); | |||
}); | |||
} | |||
/** 关闭表单*/ | |||
function onClose() { | |||
visible.value = false; | |||
} | |||
// 暴露给父组件的方法 | |||
defineExpose({ | |||
onOpen | |||
}); | |||
</script> | |||
<style lang="scss" scoped></style> |
@@ -0,0 +1,179 @@ | |||
<!-- | |||
* @Description: 人员管理 | |||
* @Author: wwp | |||
* @Date: 2024-7-15 | |||
--> | |||
<template> | |||
<div class="main-box"> | |||
<div class="table-box"> | |||
<ProTable ref="proTable" title="院系管理" :columns="columns" rowKey="personId" :request-api="userManageKeyPersonApi.page"> | |||
<!-- 表格 header 按钮 --> | |||
<template #tableHeader="scope"> | |||
<s-button suffix="院系" @click="onOpen(FormOptEnum.ADD)" /> | |||
<s-button | |||
type="danger" | |||
:opt="FormOptEnum.DELETE" | |||
plain | |||
suffix="院系" | |||
:disabled="!scope.isSelected" | |||
@click="onDelete(scope.selectedListIds, '删除所选院系')" | |||
/> | |||
</template> | |||
<!-- 表格操作栏 --> | |||
<template #operation="scope"> | |||
<el-space> | |||
<s-button link :opt="FormOptEnum.EDIT" @click="onOpen(FormOptEnum.EDIT, scope.row)" /> | |||
<s-button link :opt="FormOptEnum.DELETE" @click="onDelete([scope.row.personId], `删除院系`)" /> | |||
</el-space> | |||
</template> | |||
</ProTable> | |||
</div> | |||
<!-- 人员新增/编辑表单 --> | |||
<Form ref="formRef"></Form> | |||
</div> | |||
</template> | |||
<script setup lang="tsx" name="SysUserKeyPersonnel"> | |||
import { userManageKeyPersonApi,SysUserPersonnel } from "@/api"; | |||
import { useHandleData } from "@/hooks/useHandleData"; | |||
import { FormOptEnum } from "@/enums"; | |||
import Form from "./components/form.vue"; | |||
import { ArrowDown } from "@element-plus/icons-vue"; | |||
import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface"; | |||
import { ElMessage } from "element-plus"; | |||
import { useUserStore } from "@/stores/modules"; | |||
import { TokenEnum } from "@/enums"; | |||
import type { UploadProps } from "element-plus"; | |||
// 获取 ProTable 元素,调用其获取刷新数据方法(还能获取到当前查询参数,方便导出携带参数) | |||
const faceUrl = ref(''); | |||
const visible = ref(false); //是否显示人员表单 | |||
const proTable = ref<ProTableInstance>(); | |||
const userStore = useUserStore(); | |||
const { accessToken } = userStore; | |||
// 表格配置项 | |||
const columns: ColumnProps<SysUserPersonnel.SysUserPerInfo>[] = [ | |||
{ type: "selection", fixed: "left", width: 50 }, | |||
{ | |||
prop: "faceUrl", | |||
label: "人脸", | |||
render: scope => { | |||
return ( | |||
<img src={scope.row.faces.length > 0 ? scope.row.faces[0].faceUrl : ''} onClick={() => viewHeadImage(scope)} style='width:50px;height:50px;' alt=''/> | |||
); | |||
} | |||
}, | |||
{ | |||
prop: "name", | |||
label: "院系名称" | |||
}, | |||
{ | |||
prop: "personId", | |||
label: "人员ID" | |||
}, | |||
{ | |||
prop: "age", | |||
label: "年龄" | |||
}, | |||
{ | |||
prop: "personSetName", | |||
label: "所属班级", | |||
}, | |||
{ prop: "operation", label: "操作", width: 250, fixed: "right" } | |||
]; | |||
// 人员表单引用 | |||
const formRef = ref<InstanceType<typeof Form> | null>(null); | |||
/** | |||
* 打开表单 | |||
* @param opt 操作类型 | |||
* @param record 记录 | |||
*/ | |||
function onOpen(opt: FormOptEnum, record: {} | SysUserPersonnel.SysUserPerInfo = {}) { | |||
formRef.value?.onOpen({ opt: opt, record: record, successful: RefreshTable }); | |||
} | |||
/** | |||
* 人员删除 | |||
* @param ids id数组 | |||
*/ | |||
async function onDelete(ids: string[], msg: string) { | |||
if(ids.length === 0){ | |||
ElMessage({ | |||
message: '请选择要删除的人员', | |||
type: 'warning' | |||
}); | |||
return | |||
} | |||
// 二次确认 => 请求api => 刷新表格 | |||
await useHandleData(userManageKeyPersonApi.delete, {id: ids.join(",") }, msg); | |||
RefreshTable(); //刷新表格 | |||
} | |||
// 刷新表格 | |||
const RefreshTable = () => { | |||
proTable.value?.refresh(); | |||
} | |||
/** 更多下拉菜单命令枚举 */ | |||
enum cmdEnum { | |||
AddFace = "添加人脸", | |||
} | |||
/** 下拉菜单参数接口 */ | |||
interface Command { | |||
row: SysUserPersonnel.SysUserPerInfo; | |||
command: cmdEnum; | |||
} | |||
/**配置command的参数 */ | |||
function command(row: SysUserPersonnel.SysUserPerInfo, command: cmdEnum): Command { | |||
return { | |||
row: row, | |||
command: command | |||
}; | |||
} | |||
/** | |||
* 列表更多下拉菜单点击事件 | |||
* @param command | |||
*/ | |||
const personId = ref<number | string>(); //人员id | |||
function handleCommand(command: Command) { | |||
switch (command.command) { | |||
case cmdEnum.AddFace: | |||
personId.value = command.row.personId; //获取人员id | |||
break | |||
} | |||
} | |||
const handleAvatarSuccess: UploadProps["onSuccess"] = (response) => { | |||
if (response.code === 200) { | |||
userManageKeyPersonApi.addFace({ | |||
personId: personId.value, | |||
faceUrl: response.data | |||
}).then(res=>{ | |||
RefreshTable() | |||
}) | |||
} else { | |||
ElMessage.error(response.msg); | |||
} | |||
}; | |||
</script> | |||
<style scoped lang="scss"> | |||
.table-box { | |||
width: 100%; | |||
height: 100%; | |||
} | |||
.custom-tree-node { | |||
display: flex; | |||
flex: 1; | |||
align-items: center; | |||
justify-content: space-between; | |||
padding-right: 8px; | |||
font-size: 14px; | |||
} | |||
</style> |