|
|
@@ -38,7 +38,7 @@ |
|
|
|
<ProTable ref="proTable" title="人员管理" :columns="columns" rowKey="personId" :request-api="userManagePersonnelApi.page"> |
|
|
|
<!-- 表格 header 按钮 --> |
|
|
|
<template #tableHeader="scope"> |
|
|
|
<s-button v-auth="userPerButtonCode.add" suffix="人员" @click="onOpen(FormOptEnum.ADD)" /> |
|
|
|
<s-button v-auth="userPerButtonCode.add" suffix="人员" @click="onOpen(FormOptEnum.ADD, { personSetId: personSetId })" /> |
|
|
|
<s-button |
|
|
|
v-auth="userPerButtonCode.delete" |
|
|
|
type="danger" |
|
|
@@ -58,8 +58,26 @@ |
|
|
|
<el-link type="primary" :underline="false" :icon="ArrowDown"> 更多 </el-link> |
|
|
|
<template #dropdown> |
|
|
|
<el-dropdown-menu> |
|
|
|
<el-dropdown-item :command="command(scope.row, cmdEnum.AddFace)">{{ cmdEnum.AddFace }}</el-dropdown-item> |
|
|
|
<el-dropdown-item :command="command(scope.row, cmdEnum.UnderpantsUnBinding)">{{ cmdEnum.UnderpantsUnBinding }}</el-dropdown-item> |
|
|
|
<el-dropdown-item :command="command(scope.row, cmdEnum.AddFace)" |
|
|
|
><el-upload |
|
|
|
ref="upload" |
|
|
|
class="upload-demo" |
|
|
|
action="/api/business/personApi/uploadFile" |
|
|
|
:show-file-list="false" |
|
|
|
:on-success="handleAvatarSuccess" |
|
|
|
accept=".jpg, .jpeg, .png" |
|
|
|
:headers="{ |
|
|
|
Authorization: `${TokenEnum.TOKEN_PREFIX} ${accessToken}` |
|
|
|
}" |
|
|
|
> |
|
|
|
<template #trigger> |
|
|
|
{{ cmdEnum.AddFace }} |
|
|
|
</template> |
|
|
|
</el-upload> |
|
|
|
</el-dropdown-item> |
|
|
|
<el-dropdown-item :command="command(scope.row, cmdEnum.UnderpantsUnBinding)"> |
|
|
|
{{ cmdEnum.UnderpantsUnBinding }} |
|
|
|
</el-dropdown-item> |
|
|
|
</el-dropdown-menu> |
|
|
|
</template> |
|
|
|
</el-dropdown> |
|
|
@@ -93,11 +111,16 @@ import FormClass from "./components/formClass/index.vue"; |
|
|
|
import { ArrowDown } from "@element-plus/icons-vue"; |
|
|
|
import { ColumnProps, ProTableInstance } from "@/components/ProTable/interface"; |
|
|
|
import TreeFilter from "@/components/TreeFilter/index.vue"; |
|
|
|
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 treeFilter = ref<InstanceType<typeof TreeFilter> | null>(null); |
|
|
|
const userStore = useUserStore(); |
|
|
|
const { accessToken } = userStore; |
|
|
|
// 表格配置项 |
|
|
|
const columns: ColumnProps<SysUserPersonnel.SysUserPerInfo>[] = [ |
|
|
|
{ type: "selection", fixed: "left", width: 50 }, |
|
|
@@ -219,27 +242,45 @@ function command(row: SysUserPersonnel.SysUserPerInfo, command: cmdEnum): Comman |
|
|
|
* 更多下拉菜单点击事件 |
|
|
|
* @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 |
|
|
|
case cmdEnum.UnderpantsUnBinding: |
|
|
|
userManagePersonnelApi.personUnBindDfie({ |
|
|
|
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) => { |
|
|
|
if (response.code === 200) { |
|
|
|
userManagePersonnelApi.addFace({ |
|
|
|
personId: personId.value, |
|
|
|
faceUrl: response.data |
|
|
|
}).then(res=>{ |
|
|
|
RefreshTable() |
|
|
|
}) |
|
|
|
} else { |
|
|
|
ElMessage.error(response.msg); |
|
|
|
} |
|
|
|
}; |
|
|
|
|
|
|
|
/** 部门切换 */ |
|
|
|
const personSetId = ref<number | string>() |
|
|
|
function changeTreeFilter(val: number | string) { |
|
|
|
console.log(proTable.value,".........",val); |
|
|
|
|
|
|
|
personSetId.value = val |
|
|
|
proTable.value!.pageable.pageNum = 1; |
|
|
|
// if (val != "") { |
|
|
|
// // 如果传入的val不为空,则将val赋值给initParam.parentId |
|
|
|
// initParam.orgId = val; |
|
|
|
// } else { |
|
|
|
// // 否则将initParam.parentId赋值为0 |
|
|
|
// initParam.orgId = 0; |
|
|
|
// } |
|
|
|
proTable.value!.searchParam.personSetId = val; |
|
|
|
proTable.value!.search(); |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped lang="scss"> |
|
|
|