feat: 员工列表页面添加编辑增加收音机权限设置
This commit is contained in:
parent
dab029cd23
commit
2d92fca5a5
|
|
@ -165,19 +165,8 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||
],
|
||||
initialValue: 1,
|
||||
},
|
||||
{
|
||||
label: "员工权限设置",
|
||||
prop: "",
|
||||
type: "title",
|
||||
slotName: "title",
|
||||
},
|
||||
{
|
||||
type: 'custom',
|
||||
prop: 'permission',
|
||||
slotName: 'permission',
|
||||
label: '',
|
||||
hidden: true
|
||||
}
|
||||
|
||||
|
||||
|
||||
],
|
||||
};
|
||||
|
|
|
|||
|
|
@ -164,12 +164,6 @@ const modalConfig: IModalConfig<editRequest> = {
|
|||
],
|
||||
initialValue: 1,
|
||||
},
|
||||
{
|
||||
label: "员工权限设置",
|
||||
prop: "",
|
||||
type: "title",
|
||||
slotName: "title",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,19 @@
|
|||
<!-- 新增 -->
|
||||
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
||||
<template #formFooter>
|
||||
<div>11</div>
|
||||
<h3 style="color: rgb(63, 158, 255)">收银机权限设置</h3>
|
||||
<div>
|
||||
<el-checkbox-group v-model="addPagePathIdList">
|
||||
<el-checkbox
|
||||
v-for="(item, index) in pagePathIdLists"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
/>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<h3 style="color: rgb(63, 158, 255)">员工权限设置</h3>
|
||||
|
||||
<selectPermission v-model="addSelPermissionList" :list="permissionList"></selectPermission>
|
||||
</template>
|
||||
</page-modal>
|
||||
|
|
@ -56,6 +68,19 @@
|
|||
@submit-click="handleSubmitClick"
|
||||
>
|
||||
<template #formFooter>
|
||||
<h3 style="color: rgb(63, 158, 255)">收银机权限设置</h3>
|
||||
<div>
|
||||
<el-checkbox-group v-model="editPagePathIdList">
|
||||
<el-checkbox
|
||||
v-for="(item, index) in pagePathIdLists"
|
||||
:key="index"
|
||||
:value="item.value"
|
||||
:label="item.label"
|
||||
/>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
<h3 style="color: rgb(63, 158, 255)">员工权限设置</h3>
|
||||
|
||||
<selectPermission v-model="selPermissionList" :list="permissionList"></selectPermission>
|
||||
</template>
|
||||
</page-modal>
|
||||
|
|
@ -78,7 +103,7 @@ import RoleApi, { type SysRole } from "@/api/account/role";
|
|||
import ShopStaffApi from "@/api/account/shopStaff";
|
||||
import permissionApi, { type ShopPermission } from "@/api/account/permission";
|
||||
import selectPermission from "./components/select-permission.vue";
|
||||
|
||||
import shopPagePermissionApi from "@/api/account/shopPagePermission";
|
||||
const {
|
||||
searchRef,
|
||||
contentRef,
|
||||
|
|
@ -99,6 +124,18 @@ let permissionList = ref<ShopPermission[]>([]);
|
|||
//选中的权限列表
|
||||
let selPermissionList = ref<string[]>([]);
|
||||
let addSelPermissionList = ref<string[]>([]);
|
||||
|
||||
// 选中的收音机页面列表
|
||||
interface PagePath {
|
||||
label: string;
|
||||
value: string;
|
||||
[property: string]: any;
|
||||
}
|
||||
|
||||
const pagePathIdLists = ref<PagePath[]>([]);
|
||||
const addPagePathIdList = ref<string[]>([]);
|
||||
const editPagePathIdList = ref<string[]>([]);
|
||||
|
||||
// 数据初始化
|
||||
async function init() {
|
||||
// 覆写添加确定方法
|
||||
|
|
@ -106,6 +143,7 @@ async function init() {
|
|||
addModalConfig.formAction = (data) => {
|
||||
return oldAddSubmitFunc({
|
||||
...data,
|
||||
pagePathIdList: addPagePathIdList.value,
|
||||
shopPermissionIds: addSelPermissionList.value.reduce((pre: string[], cur: string) => {
|
||||
return pre.concat(cur);
|
||||
}, [] as string[]),
|
||||
|
|
@ -116,6 +154,7 @@ async function init() {
|
|||
editModalConfig.formAction = (data) => {
|
||||
return oldeditSubmitFunc({
|
||||
...data,
|
||||
pagePathIdList: editPagePathIdList.value,
|
||||
shopPermissionIds: selPermissionList.value.reduce((pre: string[], cur: string) => {
|
||||
return pre.concat(cur);
|
||||
}, [] as string[]),
|
||||
|
|
@ -134,6 +173,14 @@ async function init() {
|
|||
});
|
||||
addModalConfig.formItems[1]!.options = roleArr;
|
||||
editModalConfig.formItems[1]!.options = roleArr;
|
||||
const pagesRes = await shopPagePermissionApi.getPageAll({});
|
||||
pagePathIdLists.value = pagesRes.map((item: any) => {
|
||||
return {
|
||||
...item,
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
};
|
||||
});
|
||||
}
|
||||
init();
|
||||
|
||||
|
|
@ -165,6 +212,9 @@ async function handleEditClick(row: IObject) {
|
|||
}
|
||||
}
|
||||
}
|
||||
const pageList = await shopPagePermissionApi.detail({ staffId: row.id });
|
||||
console.log(pageList);
|
||||
editPagePathIdList.value = pageList.map((item) => item.id);
|
||||
console.log(selPermissionList.value);
|
||||
// 根据id获取数据进行填充
|
||||
await ShopStaffApi.get(row.id).then((res) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue