feat: 员工列表页面添加编辑增加收音机权限设置
This commit is contained in:
@@ -165,19 +165,8 @@ const modalConfig: IModalConfig<addRequest> = {
|
|||||||
],
|
],
|
||||||
initialValue: 1,
|
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,
|
initialValue: 1,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
label: "员工权限设置",
|
|
||||||
prop: "",
|
|
||||||
type: "title",
|
|
||||||
slotName: "title",
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,19 @@
|
|||||||
<!-- 新增 -->
|
<!-- 新增 -->
|
||||||
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
<page-modal ref="addModalRef" :modal-config="addModalConfig" @submit-click="handleSubmitClick">
|
||||||
<template #formFooter>
|
<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>
|
<selectPermission v-model="addSelPermissionList" :list="permissionList"></selectPermission>
|
||||||
</template>
|
</template>
|
||||||
</page-modal>
|
</page-modal>
|
||||||
@@ -56,6 +68,19 @@
|
|||||||
@submit-click="handleSubmitClick"
|
@submit-click="handleSubmitClick"
|
||||||
>
|
>
|
||||||
<template #formFooter>
|
<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>
|
<selectPermission v-model="selPermissionList" :list="permissionList"></selectPermission>
|
||||||
</template>
|
</template>
|
||||||
</page-modal>
|
</page-modal>
|
||||||
@@ -78,7 +103,7 @@ import RoleApi, { type SysRole } from "@/api/account/role";
|
|||||||
import ShopStaffApi from "@/api/account/shopStaff";
|
import ShopStaffApi from "@/api/account/shopStaff";
|
||||||
import permissionApi, { type ShopPermission } from "@/api/account/permission";
|
import permissionApi, { type ShopPermission } from "@/api/account/permission";
|
||||||
import selectPermission from "./components/select-permission.vue";
|
import selectPermission from "./components/select-permission.vue";
|
||||||
|
import shopPagePermissionApi from "@/api/account/shopPagePermission";
|
||||||
const {
|
const {
|
||||||
searchRef,
|
searchRef,
|
||||||
contentRef,
|
contentRef,
|
||||||
@@ -99,6 +124,18 @@ let permissionList = ref<ShopPermission[]>([]);
|
|||||||
//选中的权限列表
|
//选中的权限列表
|
||||||
let selPermissionList = ref<string[]>([]);
|
let selPermissionList = ref<string[]>([]);
|
||||||
let addSelPermissionList = 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() {
|
async function init() {
|
||||||
// 覆写添加确定方法
|
// 覆写添加确定方法
|
||||||
@@ -106,6 +143,7 @@ async function init() {
|
|||||||
addModalConfig.formAction = (data) => {
|
addModalConfig.formAction = (data) => {
|
||||||
return oldAddSubmitFunc({
|
return oldAddSubmitFunc({
|
||||||
...data,
|
...data,
|
||||||
|
pagePathIdList: addPagePathIdList.value,
|
||||||
shopPermissionIds: addSelPermissionList.value.reduce((pre: string[], cur: string) => {
|
shopPermissionIds: addSelPermissionList.value.reduce((pre: string[], cur: string) => {
|
||||||
return pre.concat(cur);
|
return pre.concat(cur);
|
||||||
}, [] as string[]),
|
}, [] as string[]),
|
||||||
@@ -116,6 +154,7 @@ async function init() {
|
|||||||
editModalConfig.formAction = (data) => {
|
editModalConfig.formAction = (data) => {
|
||||||
return oldeditSubmitFunc({
|
return oldeditSubmitFunc({
|
||||||
...data,
|
...data,
|
||||||
|
pagePathIdList: editPagePathIdList.value,
|
||||||
shopPermissionIds: selPermissionList.value.reduce((pre: string[], cur: string) => {
|
shopPermissionIds: selPermissionList.value.reduce((pre: string[], cur: string) => {
|
||||||
return pre.concat(cur);
|
return pre.concat(cur);
|
||||||
}, [] as string[]),
|
}, [] as string[]),
|
||||||
@@ -134,6 +173,14 @@ async function init() {
|
|||||||
});
|
});
|
||||||
addModalConfig.formItems[1]!.options = roleArr;
|
addModalConfig.formItems[1]!.options = roleArr;
|
||||||
editModalConfig.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();
|
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);
|
console.log(selPermissionList.value);
|
||||||
// 根据id获取数据进行填充
|
// 根据id获取数据进行填充
|
||||||
await ShopStaffApi.get(row.id).then((res) => {
|
await ShopStaffApi.get(row.id).then((res) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user