增加员工收银权限设置
This commit is contained in:
parent
5e6646b574
commit
db05de04a5
|
|
@ -2,4 +2,5 @@ export default {
|
||||||
'JEEPAY_BASE_URL': 'http://192.168.1.31/', // 请求URL(生产环境)
|
'JEEPAY_BASE_URL': 'http://192.168.1.31/', // 请求URL(生产环境)
|
||||||
'JEEPAY_BASE_URL_H5': 'http://192.168.1.31/',
|
'JEEPAY_BASE_URL_H5': 'http://192.168.1.31/',
|
||||||
'JEEPAY_BASE_URL_WSS': 'ws://192.168.1.31:2348' ,// sockets
|
'JEEPAY_BASE_URL_WSS': 'ws://192.168.1.31:2348' ,// sockets
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
import http from '@/http/http.js'
|
||||||
|
const request = http.request
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取所有页面路径
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getshopPagePermission(data, urlType = 'account') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopPagePermission`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取员工拥有页面路径
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export function getshopPagePermissionDetail(data, urlType = 'account') {
|
||||||
|
return request({
|
||||||
|
url: `${urlType}/admin/shopPagePermission/detail`,
|
||||||
|
method: "GET",
|
||||||
|
data: {
|
||||||
|
...data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
@ -44,6 +44,13 @@
|
||||||
<view @tap="show=true" style="height: 50rpx;font-size: 28rpx;color: #999999;margin-top: 24rpx;">{{datas.rolesdata }}</view>
|
<view @tap="show=true" style="height: 50rpx;font-size: 28rpx;color: #999999;margin-top: 24rpx;">{{datas.rolesdata }}</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="h7">收银机权限设置</view>
|
||||||
|
<view class="contentBottom" style="display: flex;flex-wrap: wrap;">
|
||||||
|
<up-checkbox shape='circle' :customStyle="{marginBottom: '8px',marginRight: '30rpx'}" v-model:checked="ele.hasPermission"
|
||||||
|
usedAlone v-for="(ele, index) in datas.shopPagePermission" :key="index" :label="ele.name"
|
||||||
|
:labelColor="ele.isImportant==1?'#e66c6d':''" style="margin-right: 40rpx;font-size: 28rpx;">
|
||||||
|
</up-checkbox>
|
||||||
|
</view>
|
||||||
<view class="h7">员工权限设置</view>
|
<view class="h7">员工权限设置</view>
|
||||||
<view class="contentBottom" v-for="item in datas.permissions" :key="item.id">
|
<view class="contentBottom" v-for="item in datas.permissions" :key="item.id">
|
||||||
<view> {{item.label}} </view>
|
<view> {{item.label}} </view>
|
||||||
|
|
@ -74,6 +81,7 @@
|
||||||
import { shopStaffDetail,getShopStaffPermission,shopStaffAdd,shopStaffPut } from "@/http/api/staff.js"
|
import { shopStaffDetail,getShopStaffPermission,shopStaffAdd,shopStaffPut } from "@/http/api/staff.js"
|
||||||
import { getShopPermission } from "@/http/api/index.js"
|
import { getShopPermission } from "@/http/api/index.js"
|
||||||
import { getRoleList } from "@/http/api/role.js"
|
import { getRoleList } from "@/http/api/role.js"
|
||||||
|
import { getshopPagePermission, getshopPagePermissionDetail } from "@/http/api/shopPagePermission.js"
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
type: {
|
type: {
|
||||||
|
|
@ -86,6 +94,7 @@
|
||||||
let datas = reactive({
|
let datas = reactive({
|
||||||
formData: {
|
formData: {
|
||||||
shopPermissionIds: [],
|
shopPermissionIds: [],
|
||||||
|
pagePathIdList: [],
|
||||||
maxDiscountAmount: 0,
|
maxDiscountAmount: 0,
|
||||||
discountType: 0
|
discountType: 0
|
||||||
},
|
},
|
||||||
|
|
@ -93,7 +102,8 @@
|
||||||
rolesList: [],
|
rolesList: [],
|
||||||
permissions: [],
|
permissions: [],
|
||||||
columns: [],
|
columns: [],
|
||||||
rolesdata: '请选择角色'
|
rolesdata: '请选择角色',
|
||||||
|
shopPagePermission: []
|
||||||
})
|
})
|
||||||
const columns = reactive([
|
const columns = reactive([
|
||||||
[]
|
[]
|
||||||
|
|
@ -111,6 +121,8 @@
|
||||||
let res = await getShopPermission()
|
let res = await getShopPermission()
|
||||||
datas.permissions = res
|
datas.permissions = res
|
||||||
Object.assign(datas.permissions, res)
|
Object.assign(datas.permissions, res)
|
||||||
|
let resDetail = await getshopPagePermission()
|
||||||
|
datas.shopPagePermission = resDetail
|
||||||
if (props.type == 'edit') {
|
if (props.type == 'edit') {
|
||||||
uni.setNavigationBarTitle({
|
uni.setNavigationBarTitle({
|
||||||
title: '编辑员工'
|
title: '编辑员工'
|
||||||
|
|
@ -118,6 +130,8 @@
|
||||||
// 调用id查询接口和编辑接口
|
// 调用id查询接口和编辑接口
|
||||||
getShopStaffDetail(props.id)
|
getShopStaffDetail(props.id)
|
||||||
getStaffPermission(props.id)
|
getStaffPermission(props.id)
|
||||||
|
getPagePermissionDetail(props.id)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
datas.isPassword = true;
|
datas.isPassword = true;
|
||||||
}
|
}
|
||||||
|
|
@ -140,7 +154,6 @@
|
||||||
*/
|
*/
|
||||||
function getStaffPermission(id) {
|
function getStaffPermission(id) {
|
||||||
getShopStaffPermission({id: id}).then((res2) => {
|
getShopStaffPermission({id: id}).then((res2) => {
|
||||||
|
|
||||||
datas.permissions.forEach(ele => {
|
datas.permissions.forEach(ele => {
|
||||||
ele.children.forEach(res => {
|
ele.children.forEach(res => {
|
||||||
res2.forEach(v => {
|
res2.forEach(v => {
|
||||||
|
|
@ -153,6 +166,20 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取收银机权限列表列表
|
||||||
|
*/
|
||||||
|
function getPagePermissionDetail(id) {
|
||||||
|
getshopPagePermissionDetail({staffId: id}).then((res2) => {
|
||||||
|
datas.shopPagePermission.forEach(ele => {
|
||||||
|
res2.forEach(v => {
|
||||||
|
if (ele.id == v.id ) {
|
||||||
|
ele.hasPermission = 1
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户详情
|
* 获取用户详情
|
||||||
|
|
@ -184,26 +211,35 @@
|
||||||
if(datas.permissions){
|
if(datas.permissions){
|
||||||
datas.permissions.forEach(ele => {
|
datas.permissions.forEach(ele => {
|
||||||
ele.children.forEach(res => {
|
ele.children.forEach(res => {
|
||||||
|
|
||||||
if (res.hasPermission) {
|
if (res.hasPermission) {
|
||||||
console.log(res)
|
|
||||||
console.log(datas.formData.shopPermissionIds)
|
|
||||||
res.hasPermission = 1
|
res.hasPermission = 1
|
||||||
datas.formData.shopPermissionIds.push(res.id)
|
datas.formData.shopPermissionIds.push(res.id)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if(datas.shopPagePermission){
|
||||||
|
datas.shopPagePermission.forEach(ele => {
|
||||||
|
if (ele.hasPermission) {
|
||||||
|
ele.hasPermission = 1
|
||||||
|
datas.formData.pagePathIdList.push(ele.id)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
if ( !datas.isPassword ) {
|
if ( !datas.isPassword ) {
|
||||||
delete datas.formData.accountPwd;
|
delete datas.formData.accountPwd;
|
||||||
}
|
}
|
||||||
let res;
|
let res;
|
||||||
if( props.type == 'add'){
|
if( props.type == 'add'){
|
||||||
res = await shopStaffAdd({...datas.formData})
|
res = await shopStaffAdd({...datas.formData})
|
||||||
|
uni.$utils.showToast("添加成功")
|
||||||
} else {
|
} else {
|
||||||
res = await shopStaffPut({...datas.formData})
|
res = await shopStaffPut({...datas.formData})
|
||||||
|
uni.$utils.showToast("编辑成功")
|
||||||
}
|
}
|
||||||
go.back()
|
setTimeout(()=>{
|
||||||
|
uni.navigateBack()
|
||||||
|
},1500)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue