@@ -51,6 +51,13 @@ export interface ReqId { | |||
/** id */ | |||
id: number | string; | |||
} | |||
/** ReqClothId请求参数 */ | |||
export interface ReqClothId { | |||
/** ReqClothId */ | |||
clothSetId: number | string; | |||
} | |||
/** id请求参数 */ | |||
export interface ReqPersonId { | |||
/** id */ | |||
@@ -0,0 +1,75 @@ | |||
/** | |||
* @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: syy | |||
* @Date: 2023-12-15 15:34:54 | |||
*/ | |||
export namespace SysUserCloth { | |||
// 服装底库树 | |||
export interface Page { | |||
clothSetId: number | string; | |||
clothSetName: number | string; | |||
} | |||
/** id请求参数 */ | |||
export interface ReqName { | |||
name: number | string; | |||
} | |||
/** 底库信息 */ | |||
export interface ClassPage { | |||
personSetId?: string | number | undefined; | |||
personSetName?: string | undefined; | |||
id?: string | undefined; | |||
name?: string | undefined; | |||
personId?: string | undefined | number; | |||
} | |||
/** 人脸信息 */ | |||
export interface SysUserAvatar { | |||
/** 人脸 */ | |||
personId?: string | undefined | number; | |||
faceId?: string | number; | |||
faceUrl: string; | |||
uid?: string | number; | |||
} | |||
// 人脸删除 | |||
export interface SysUserFace { | |||
personId: string | undefined; | |||
faceIds: Array<string | number>; | |||
} | |||
/** 用户信息 */ | |||
export interface SysUserClothInfo { | |||
/** 人员id */ | |||
personId?: string; | |||
/** 姓名 */ | |||
name?: string; | |||
/** 年龄 */ | |||
age?: number | string; | |||
/** 性别 */ | |||
gender?: string; | |||
/** 手机 */ | |||
phone?: string; | |||
/** 扩展字段 */ | |||
extData?: string; | |||
/** 人脸 */ | |||
faces: Array<SysUserAvatar>; | |||
/** 分组 */ | |||
personSets: Array<ClassPage>; | |||
personSetId?: number | string; | |||
} | |||
} |
@@ -13,3 +13,4 @@ | |||
* @see https://gitee.com/dotnetmoyu/SimpleAdmin | |||
*/ | |||
export * from "./personnel"; | |||
export * from "./clothing"; |
@@ -26,9 +26,11 @@ export namespace SysUserPersonnel { | |||
export interface ClassPage { | |||
personSetId?: string | number | undefined; | |||
personSetName?: string | undefined; | |||
id?: string | undefined; | |||
name?: string | undefined; | |||
personId?: string | undefined | number; | |||
id?: string | number | undefined; | |||
name?: string | number | undefined; | |||
userId?: string | number | undefined; | |||
personId?: string | number | undefined; | |||
userName?: string | number | undefined; | |||
} | |||
/** 人脸信息 */ | |||
export interface SysUserAvatar { | |||
@@ -59,9 +61,9 @@ export namespace SysUserPersonnel { | |||
/** 扩展字段 */ | |||
extData?: string; | |||
/** 人脸 */ | |||
faces: Array<SysUserAvatar>; | |||
faces: any; | |||
/** 分组 */ | |||
personSets: Array<ClassPage>; | |||
personSets: any; | |||
personSetId?: number | string; | |||
} | |||
} |
@@ -23,8 +23,8 @@ const http = moduleRequest("/business/dfieldApi/"); | |||
*/ | |||
const userManageClassManageApi = { | |||
/** 查询底库列表 */ | |||
page(params: SysUserPersonnel.ClassPage) { | |||
return http.get("queryAll", params); | |||
page() { | |||
return http.get("queryAll"); | |||
}, | |||
/** 删除底库 */ | |||
delete(params: ReqId) { | |||
@@ -0,0 +1,68 @@ | |||
/** | |||
* @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, SysUserCloth, ReqClothId } from "@/api/interface"; | |||
const http = moduleRequest("/business/clothApi/"); | |||
/** | |||
* @Description: 单页管理 | |||
* @Author: SYY | |||
* @Date: 2023-12-15 15:34:54 | |||
*/ | |||
const userManageClothApi = { | |||
/** 查询服装底库列表 */ | |||
getList(params: SysUserCloth.Page) { | |||
return http.get("getList", params); | |||
}, | |||
/** 查询服装底库详情 */ | |||
page(params: ReqClothId) { | |||
return http.get("getInfo", params); | |||
}, | |||
/** 删除服装底库 */ | |||
deleteClothDataBaseD(params: ReqClothId) { | |||
return http.delete("deleteClothDataBaseD", params); | |||
}, | |||
/** 新增服装底库 */ | |||
addClothDataBaseA(params: SysUserCloth.ReqName) { | |||
return http.post("addClothDataBaseA", params); | |||
}, | |||
/** 更新服装底库 */ | |||
update(params: SysUserCloth.SysUserPerInfo) { | |||
return http.put("updateClothU", params); | |||
}, | |||
/** 服装图片上传 */ | |||
uploadFile(params: SysUserCloth.SysUserAvatar) { | |||
return http.post("uploadFile", params); | |||
}, | |||
/** 新增服装 */ | |||
add(params: SysUserCloth.SysUserPerInfo) { | |||
return http.post("addClothA", params); | |||
}, | |||
/** 删除服装 */ | |||
delete(params: SysUserCloth.SysUserFace) { | |||
return http.post("deleteClothD", params); | |||
} | |||
}; | |||
const userClothButtonCode = { | |||
/** 新增人员 */ | |||
add: "userManageClothAdd", | |||
/** 删除人员 */ | |||
edit: "userManageClothEdit", | |||
/** 删除人员 */ | |||
delete: "userManageClothDelete" | |||
}; | |||
export { userManageClothApi, userClothButtonCode }; |
@@ -14,3 +14,5 @@ | |||
*/ | |||
export * from "./personnel"; | |||
export * from "./classManage"; | |||
export * from "./clothing"; | |||
export * from "./teacher"; |
@@ -0,0 +1,54 @@ | |||
/** | |||
* @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"; | |||
const http = moduleRequest("/business/classTeacher/"); | |||
/** | |||
* @Description: 单页管理 | |||
* @Author: SYY | |||
* @Date: 2023-12-15 15:34:54 | |||
*/ | |||
const userManageTeacherApi = { | |||
/** 查询班主任列表 */ | |||
page() { | |||
return http.get("getNoPageList"); | |||
}, | |||
/** 获取单页详情 */ | |||
detail(params: any) { | |||
return http.get("getInfo", params); | |||
}, | |||
/** 删除班主任 */ | |||
delete(params: any) { | |||
return http.delete("delete", params); | |||
}, | |||
/** 创建班主任 */ | |||
add(params: any) { | |||
return http.post("add", params); | |||
}, | |||
/** 更新班主任 */ | |||
update(params: any) { | |||
return http.put("update", params); | |||
} | |||
}; | |||
const userTeacherButtonCode = { | |||
/** 新增人员 */ | |||
add: "userManageClassManageAdd", | |||
/** 删除人员 */ | |||
edit: "userManageClassManageEdit", | |||
/** 删除人员 */ | |||
delete: "userManageClassManageDelete" | |||
}; | |||
export { userManageTeacherApi, userTeacherButtonCode }; |
@@ -75,7 +75,7 @@ | |||
import { SysUserPersonnel, userManagePersonnelApi, userManageClassManageApi } from "@/api"; | |||
import { Plus } from "@element-plus/icons-vue"; | |||
import { useUserStore } from "@/stores/modules"; | |||
import type { UploadProps, UploadUserFile } from "element-plus"; | |||
import type { UploadProps } from "element-plus"; | |||
import { ElMessage } from "element-plus"; | |||
import { TokenEnum } from "@/enums"; | |||
// props | |||
@@ -92,12 +92,12 @@ const userInfo = computed({ | |||
/* */ | |||
const userStore = useUserStore(); | |||
const { accessToken } = userStore; | |||
const fileList = ref([]); | |||
const fileList = ref<any>([]); | |||
const faces = ref<SysUserPersonnel.SysUserAvatar[]>([]); | |||
const dialogImageUrl = ref(""); | |||
const dialogVisible = ref(false); | |||
const treeData = ref<{ [key: string]: any }[]>([]); | |||
const handleRemove: UploadProps["onRemove"] = uploadFile => { | |||
const treeData = ref<any>([]); | |||
const handleRemove: UploadProps["onRemove"] = (uploadFile: any) => { | |||
const index = faces.value.findIndex(item => item.uid === uploadFile.uid); | |||
if (index > -1) { | |||
faces.value.splice(index, 1); | |||
@@ -143,7 +143,6 @@ const genderOptions = ref([ | |||
const getRequestData = async () => { | |||
const { data } = await userManageClassManageApi.page(); | |||
treeData.value = data; | |||
console.log(treeData.value, "treeData"); | |||
}; | |||
onMounted(() => { | |||
// 初始化 | |||
@@ -152,7 +151,7 @@ onMounted(() => { | |||
if (userInfo.value.personId) { | |||
if (userInfo.value.faces?.length > 0) { | |||
fileList.value = [ | |||
...JSON.parse(JSON.stringify(userInfo.value.faces)).map(item => { | |||
...JSON.parse(JSON.stringify(userInfo.value.faces)).map((item: any) => { | |||
return { | |||
url: item.faceUrl, | |||
uid: item.faceId, | |||
@@ -161,7 +160,7 @@ onMounted(() => { | |||
}) | |||
]; | |||
faces.value = [ | |||
...JSON.parse(JSON.stringify(userInfo.value.faces)).map(item => { | |||
...JSON.parse(JSON.stringify(userInfo.value.faces)).map((item: any) => { | |||
return { | |||
faceUrl: item.faceUrl, | |||
uid: item.faceId, | |||
@@ -0,0 +1,116 @@ | |||
<!-- | |||
* @Description: 表单 | |||
* @Author: syy | |||
* @Date: 2023-12-15 15:45:59 | |||
--> | |||
<template> | |||
<div> | |||
<form-container v-model="visibleClass" :title="`${sysUserProps.opt}`" form-size="400px" @close="onClose"> | |||
<el-form | |||
ref="sysUserFormRef" | |||
:rules="rules" | |||
:disabled="sysUserProps.disabled" | |||
:model="sysUserProps.record" | |||
:hide-required-asterisk="sysUserProps.disabled" | |||
label-width="auto" | |||
label-suffix=" :" | |||
> | |||
<div> | |||
<el-row :gutter="16"> | |||
<el-col :span="22"> | |||
<s-form-item label="班主任" prop="userId"> | |||
<s-select v-model="sysUserProps.record.userId" :options="teacherData" label="name" value="userId"></s-select> | |||
</s-form-item> | |||
</el-col> | |||
</el-row> | |||
</div> | |||
</el-form> | |||
<template #footer> | |||
<el-button @click="onClose"> 取消 </el-button> | |||
<el-button v-show="!sysUserProps.disabled" type="primary" @click="handleSubmit"> 确定 </el-button> | |||
</template> | |||
</form-container> | |||
</div> | |||
</template> | |||
<script setup lang="ts" name="SysUserPerformClass"> | |||
import { ref } from "vue"; | |||
import { SysUserPersonnel, userManageTeacherApi } from "@/api"; | |||
import { required } from "@/utils/formRules"; | |||
import { FormInstance } from "element-plus"; | |||
const teacherData = ref<any>([]); | |||
const visibleClass = ref(false); //是否显示表单 | |||
// 表单参数 | |||
enum FormOptEnum { | |||
/** 新增 */ | |||
AddTeacher = "绑定班主任", | |||
/** 编辑 */ | |||
UpdateTeacher = "修改班主任" | |||
} | |||
const sysUserProps = reactive<FormProps.Base<SysUserPersonnel.ClassPage>>({ | |||
opt: FormOptEnum.AddTeacher, | |||
record: {}, | |||
disabled: false | |||
}); | |||
// 表单验证规则 | |||
const rules = reactive({ | |||
userId: [required("请选择班主任名称")] | |||
}); | |||
/** | |||
* 打开表单 | |||
* @param props 表单参数 | |||
*/ | |||
function onOpen(props: FormProps.Base<SysUserPersonnel.ClassPage>) { | |||
getRequestData(); | |||
Object.assign(sysUserProps, props); //合并参数 | |||
visibleClass.value = true; //显示表单 | |||
sysUserProps.record = props.record; | |||
} | |||
const getRequestData = async () => { | |||
const { data } = await userManageTeacherApi.page(); | |||
teacherData.value = data; | |||
}; | |||
// 提交数据(新增/编辑) | |||
const sysUserFormRef = ref<FormInstance>(); | |||
/** 提交表单 */ | |||
async function handleSubmit() { | |||
sysUserFormRef.value?.validate(async valid => { | |||
if (!valid) return; //表单验证失败 | |||
console.log(sysUserProps); | |||
//提交表单 | |||
if (sysUserProps.opt === FormOptEnum.UpdateTeacher) { | |||
await userManageTeacherApi | |||
.update(sysUserProps.record) | |||
.then(() => { | |||
sysUserProps.successful!(); //调用父组件的successful方法 | |||
}) | |||
.finally(() => { | |||
onClose(); | |||
}); | |||
} else { | |||
await userManageTeacherApi | |||
.add(sysUserProps.record) | |||
.then(() => { | |||
sysUserProps.successful!(); //调用父组件的successful方法 | |||
}) | |||
.finally(() => { | |||
onClose(); | |||
}); | |||
} | |||
}); | |||
} | |||
/** 关闭表单*/ | |||
function onClose() { | |||
visibleClass.value = false; | |||
} | |||
// 暴露给父组件的方法 | |||
defineExpose({ | |||
onOpen | |||
}); | |||
</script> | |||
<style lang="scss" scoped></style> |
@@ -27,6 +27,24 @@ | |||
<a style="margin-left: 8px" @click="addDelete(row.node.data.personSetId, '删除班级')"> | |||
<el-icon><Delete /></el-icon> | |||
</a> | |||
<a style="margin-left: 8px"> | |||
<el-dropdown @command="handleCommandTree"> | |||
<el-link :underline="false" :icon="More"> </el-link> | |||
<template #dropdown> | |||
<el-dropdown-menu> | |||
<el-dropdown-item v-if="!row.node.data.userId" :command="commander(row.node.data, cmdEnumTree.AddTeacher)"> | |||
{{ cmdEnumTree.AddTeacher }} | |||
</el-dropdown-item> | |||
<el-dropdown-item v-if="row.node.data.userId" :command="commander(row.node.data, cmdEnumTree.UpdateTeacher)"> | |||
{{ cmdEnumTree.UpdateTeacher }} | |||
</el-dropdown-item> | |||
<el-dropdown-item v-if="row.node.data.userId" :command="commander(row.node.data, cmdEnumTree.DeleteTeacher)"> | |||
{{ cmdEnumTree.DeleteTeacher }} | |||
</el-dropdown-item> | |||
</el-dropdown-menu> | |||
</template> | |||
</el-dropdown> | |||
</a> | |||
</span> | |||
</span> | |||
</template> | |||
@@ -86,6 +104,8 @@ | |||
<Form ref="formRef"></Form> | |||
<!-- 班级新增/编辑表单 --> | |||
<FormClass ref="formRefC" /> | |||
<!-- 班主任绑定/修改 --> | |||
<FormTeacher ref="formRefT" /> | |||
<!-- 预览头像 --> | |||
<el-dialog v-model="visible" title="查看头像" width="830px" :before-close="handleClose"> | |||
<div style="display: flex; align-items: center; justify-content: center"> | |||
@@ -95,12 +115,13 @@ | |||
</div> | |||
</template> | |||
<script setup lang="tsx" name="SysUserPersonnel"> | |||
import { userManagePersonnelApi,userPerButtonCode,SysUserPersonnel,userManageClassManageApi } from "@/api"; | |||
import { userManagePersonnelApi,userPerButtonCode,SysUserPersonnel,userManageClassManageApi,userManageTeacherApi } from "@/api"; | |||
import { useHandleData } from "@/hooks/useHandleData"; | |||
import { FormOptEnum } from "@/enums"; | |||
import Form from "./components/form/index.vue"; | |||
import FormClass from "./components/formClass/index.vue"; | |||
import { ArrowDown } from "@element-plus/icons-vue"; | |||
import FormTeacher from "./components/formTeacher/index.vue"; | |||
import { ArrowDown,More } from "@element-plus/icons-vue"; | |||
import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface"; | |||
import TreeFilter from "@/components/TreeFilter/index.vue"; | |||
import { useUserStore } from "@/stores/modules"; | |||
@@ -158,8 +179,11 @@ const handleClose = () => { | |||
// 人员表单引用 | |||
const formRef = ref<InstanceType<typeof Form> | null>(null); | |||
// 班级表单引用 | |||
// 班级表单引用 | |||
const formRefC = ref<InstanceType<typeof FormClass> | null>(null); | |||
// 班级表单引用 | |||
const formRefT = ref<InstanceType<typeof FormTeacher> | null>(null); | |||
/** | |||
* 打开表单 | |||
* @param opt 操作类型 | |||
@@ -231,11 +255,11 @@ function command(row: SysUserPersonnel.SysUserPerInfo, command: cmdEnum): Comman | |||
}; | |||
} | |||
/** | |||
* 更多下拉菜单点击事件 | |||
* 列表更多下拉菜单点击事件 | |||
* @param command | |||
*/ | |||
const personId = ref<number | string>(); //人员id | |||
function handleCommand(command: Command) { | |||
const personId = ref<number | string>(); //人员id | |||
function handleCommand(command: Command) { | |||
switch (command.command) { | |||
case cmdEnum.AddFace: | |||
personId.value = command.row.personId; //获取人员id | |||
@@ -245,15 +269,57 @@ function command(row: SysUserPersonnel.SysUserPerInfo, command: cmdEnum): Comman | |||
personId:command.row.personId, | |||
personSetId: command.row.personSets[0].personSetId | |||
}).then(res=>{ | |||
if(res.code == 200){ | |||
ElMessage.success('底库解绑成功'); | |||
RefreshTable() | |||
} | |||
}) | |||
break; | |||
} | |||
} | |||
const handleAvatarSuccess: UploadProps["onSuccess"] = (response, uploadFile) => { | |||
/** 更多下拉菜单命令枚举 */ | |||
enum cmdEnumTree { | |||
AddTeacher = "绑定班主任", | |||
UpdateTeacher = "修改班主任", | |||
DeleteTeacher = "解绑班主任", | |||
} | |||
/** 树下拉菜单参数接口 */ | |||
interface CommandTree { | |||
row: SysUserPersonnel.ClassPage; | |||
commander: cmdEnumTree; | |||
} | |||
/**配置command的参数 */ | |||
function commander(row: SysUserPersonnel.ClassPage, commander: cmdEnumTree): CommandTree { | |||
return { | |||
row: row, | |||
commander: commander, | |||
}; | |||
} | |||
/** | |||
* 树更多下拉菜单点击事件 | |||
* @param commandtree | |||
*/ | |||
async function handleCommandTree(commander: CommandTree) { | |||
switch (commander.commander) { | |||
case cmdEnumTree.AddTeacher: | |||
formRefT.value?.onOpen({ opt: commander.commander, record: commander.row, successful: RefreshTable }); | |||
break | |||
case cmdEnumTree.UpdateTeacher: | |||
formRefT.value?.onOpen({ opt: commander.commander, record: commander.row, successful: RefreshTable }); | |||
break; | |||
case cmdEnumTree.DeleteTeacher: | |||
// 二次确认 => 请求api => 刷新表格 | |||
await useHandleData(userManageTeacherApi.delete, {id: commander.row.id}, '解绑教师'); | |||
RefreshTable(); //刷新表格 | |||
break; | |||
} | |||
} | |||
const handleAvatarSuccess: UploadProps["onSuccess"] = (response) => { | |||
if (response.code === 200) { | |||
userManagePersonnelApi.addFace({ | |||
personId: personId.value, | |||