员工编辑

This commit is contained in:
duan 2024-09-24 15:35:01 +08:00
parent f5d5aca77e
commit 7d904db9ed
9 changed files with 626 additions and 107 deletions

View File

@ -99,7 +99,8 @@ function commonsProcess(showLoading, httpReqCallback) {
// if(bodyData.code == 500){ // 密码已过期, 直接跳转到更改密码页面 // if(bodyData.code == 500){ // 密码已过期, 直接跳转到更改密码页面
// uni.redirectTo({url: '/pages/login/index'}) // uni.redirectTo({url: '/pages/login/index'})
// } // }
return Promise.reject(bodyData) return bodyData
// return Promise.reject(bodyData)
} }
// 加密数据 // 加密数据

View File

@ -18,6 +18,21 @@ export function dateProduct(params) {
params params
}) })
} }
// 是否开启
export function updateStatus(data) {
return request({
url: `/api/tbPlussShopStaff/updateStatus`,
method: "put",
data
});
}
// 编辑
export function tbPlussShopStaffDetail(id) {
return request({
url: `/api/tbPlussShopStaff/${id}`,
method: "get"
});
}
// 桌型列表 // 桌型列表
export function callTable(params) { export function callTable(params) {
return request({ return request({
@ -66,4 +81,41 @@ export function callTablecall(data) {
method: 'post', method: 'post',
data data
}); });
}
// 获取员工列表
export function rolesGet() {
return request({
url: `/api/tbPlussShopStaff`,
method: "get"
});
}
// 删除员工
export function shopStaffDelete(data) {
return request({
url: `/api/tbPlussShopStaff`,
method: "delete",
data
});
}
// 新增员工获取权限
export function tbShopPermissionList() {
return request({
url: `/api/tbShopPermission/list`,
method: "get"
});
}
// 获取角色权限
export function getroles() {
return request({
url: `/api/roles`,
method: "get"
});
}
export function tbPlussShopStaff(data) {
return request({
url: `/api/tbPlussShopStaff`,
method: data.id ? "put" : "post",
data
});
} }

View File

@ -15,7 +15,8 @@
</JeepayTableList> </JeepayTableList>
<view class="footer-wrapper"> <view class="footer-wrapper">
<view class="footer-button footer-button-style"> <view class="footer-button footer-button-style">
<button hover-class="hover-button" hover-stay-time="150" class="flex-center" @tap="createStaff">创建</button> <button hover-class="hover-button" hover-stay-time="150" class="flex-center"
@tap="createStaff">创建</button>
</view> </view>
</view> </view>
</view> </view>
@ -23,87 +24,104 @@
</template> </template>
<script setup> <script setup>
import { nextTick, reactive, ref } from 'vue'; import {
import { onReachBottom, onShow, onUnload } from '@dcloudio/uni-app'; nextTick,
import go from '@/commons/utils/go.js'; reactive,
import emit from '@/commons/utils/emit.js'; ref
import { reqLoad, API_URL_SYS_USER_LIST } from '@/http/apiManager.js'; } from 'vue';
import SysUserRender from '@/pages/list/render/SysUserRender.vue'; import {
onReachBottom,
onShow,
onUnload
} from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js';
import emit from '@/commons/utils/emit.js';
import SysUserRender from '@/pages/list/render/SysUserRender.vue';
import {rolesGet } from '@/http/yskApi/requestAll.js';
const jeepayTableListRef = ref();
const jeepayPopupConfirmRef = ref();
const jeepayTableListRef = ref(); onReachBottom(() => {});
const jeepayPopupConfirmRef = ref();
onReachBottom(() => {}); // //
onUnload(() => uni.$off(emit.ENAME_REF_SYS_USER_LIST));
uni.$on(emit.ENAME_REF_SYS_USER_LIST, function(data) {
jeepayTableListRef.value.refTable(true);
});
// // //
onUnload(() => uni.$off(emit.ENAME_REF_SYS_USER_LIST)); function reqTableDataFunc(params) {
uni.$on(emit.ENAME_REF_SYS_USER_LIST, function (data) { //
jeepayTableListRef.value.refTable(true); params.isNotHasType2 = 1;
}); rolesGet({
}).then((res) => {
console.log(res, '调试1')
})
return res.content
}
// //
function reqTableDataFunc(params) { const createStaff = () => {
// go.to('PAGES_USER_EDIT');
params.isNotHasType2 = 1; };
return reqLoad.list(API_URL_SYS_USER_LIST, params);
}
//
const createStaff = () => {
go.to('PAGES_USER_EDIT');
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.sta-input { .sta-input {
display: flex;
align-items: center;
padding: 0 30rpx;
height: 110rpx;
background-color: $J-bg-ff;
.input-main {
flex: 1;
display: flex; display: flex;
align-items: center; align-items: center;
height: 70rpx; padding: 0 30rpx;
background-color: $J-bg-f5; height: 110rpx;
border-radius: $J-b-r12; background-color: $J-bg-ff;
color: rgba(0, 0, 0, 0.35);
font-size: 27rpx; .input-main {
font-weight: 400; flex: 1;
image { display: flex;
padding: 22rpx; align-items: center;
width: 26rpx; height: 70rpx;
height: 26rpx; background-color: $J-bg-f5;
border-radius: $J-b-r12;
color: rgba(0, 0, 0, 0.35);
font-size: 27rpx;
font-weight: 400;
image {
padding: 22rpx;
width: 26rpx;
height: 26rpx;
}
}
.icon-more {
margin-left: 30rpx;
width: 70rpx;
height: 70rpx;
} }
} }
.icon-more {
margin-left: 30rpx; .footer-wrapper {
width: 70rpx; height: 170rpx;
height: 70rpx; background-color: transparent;
}
} .footer-button {
.footer-wrapper { position: fixed;
height: 170rpx; left: 0;
background-color: transparent; right: 0;
.footer-button { bottom: 0;
position: fixed; padding: 30rpx;
left: 0;
right: 0; button {
bottom: 0; height: 110rpx;
padding: 30rpx; font-size: 33rpx;
button { font-weight: 500;
height: 110rpx; color: $J-color-tff;
font-size: 33rpx; border-radius: 20rpx;
font-weight: 500; background: $jeepay-bg-primary;
color: $J-color-tff; }
border-radius: 20rpx;
background: $jeepay-bg-primary; .hover-button {
} opacity: 0.5;
.hover-button { }
opacity: 0.5;
} }
} }
} </style>
</style>

View File

@ -70,7 +70,6 @@
page: 1, page: 1,
size: 9999 size: 9999
}).then((res) => { }).then((res) => {
console.log(res, '调试1')
datas.list = res.records datas.list = res.records
}) })
} }

View File

@ -46,7 +46,20 @@
<!-- 播报弹窗 --> <!-- 播报弹窗 -->
<uni-popup ref="alertDialog" type="dialog"> <uni-popup ref="alertDialog" type="dialog">
<uni-popup-dialog :type="datas.msgType" cancelText="完成" confirmText="过号" confirmText-color="#000" title="播报" <uni-popup-dialog :type="datas.msgType" cancelText="完成" confirmText="过号" confirmText-color="#000" title="播报"
content="通知消息已发送" @confirm="dialogConfirm(1)" @close="dialogConfirm(2)"></uni-popup-dialog> @confirm="dialogConfirm(1)" @close="dialogConfirm(2)">
<view class="">
<view class="">
正在叫号请稍后
</view>
<view style="font-size: 24rpx; text-align:center;color: #52C41A;"
v-if="datas.profilepicturedata.state==1">
已发送至用户
</view>
<view style="font-size: 24rpx;text-align:center;color: #F02C45;" v-else>
用户未订阅消息
</view>
</view>
</uni-popup-dialog>
</uni-popup> </uni-popup>
<!-- 取号遮罩层 --> <!-- 取号遮罩层 -->
<up-popup :show="datas.show" :round="18" mode="center" @close="close" @open="open"> <up-popup :show="datas.show" :round="18" mode="center" @close="close" @open="open">
@ -129,7 +142,10 @@
// \ // \
selecttopType: '', selecttopType: '',
// id // id
dialId: "" dialId: "",
//
profilepicturedata: ""
}) })
onMounted(() => { onMounted(() => {
getList() getList()
@ -215,17 +231,7 @@
datas.showtowData = res datas.showtowData = res
datas.phone = '' datas.phone = ''
getList() getList()
//
// getrefs.ctx.$refs.uToastRef.show({
// type: 'default',
// title: '',
// message: "",
// iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/default.png',
// complete() {
// datas.phone = ''
// getList()
// }
// });
} }
}) })
@ -240,8 +246,8 @@
callTablecall({ callTablecall({
shopId: uni.getStorageSync('shopId'), shopId: uni.getStorageSync('shopId'),
callQueueId: item.id callQueueId: item.id
}).then(() => { }).then((res) => {
// datas.msgType = type datas.profilepicturedata = res
getrefs.ctx.$refs.alertDialog.open() getrefs.ctx.$refs.alertDialog.open()
}) })

261
pageStaff/addstaff.vue Normal file
View File

@ -0,0 +1,261 @@
<template>
<view class="h7">基本信息设置</view>
<view class="content">
<view>
<view>
员工姓名
</view>
<input type="text" v-model="datas.formData.name" placeholder="请填写员工名称" />
<hr />
</view>
<view>
<view>
手机号
</view>
<input type="text" v-model="datas.formData.phone" placeholder="请填写手机号" />
<hr />
</view>
<view>
<view>
员工编号
</view>
<input type="text" v-model="datas.formData.code" placeholder="请填写员工编号" />
<hr />
</view>
<view>
<view>
员工账号
</view>
<input type="text" v-model="datas.formData.account" placeholder="请填写员工账号,建议使用手机号" />
<hr />
</view>
<view>
<view>
登录密码
</view>
<input type="text" v-model="datas.formData.password" placeholder="请输入登录密码不填写默认123456" />
<hr />
</view>
<view>
<view>
优惠类型
</view>
<up-radio-group v-model="datas.formData.discountType" placement="row">
<up-radio label="折扣" name="1"></up-radio>
<up-radio style="margin: 18px 10px;" label="金额" name="0"></up-radio>
</up-radio-group>
<hr />
</view>
<view>
<view>
最低优惠折扣
</view>
<input type="text" v-model="datas.formData.maxDiscountAmount" placeholder="0" />
<hr />
</view>
<view>
<view>
角色
</view>
<view @tap="show=true" style="height: 50rpx;font-size: 28rpx;color: #999999;">{{datas.rolesdata }}</view>
<hr />
</view>
</view>
<view class="h7">员工权限设置</view>
<view class="contentBottom" v-for="item in datas.formData.permissions" :key="item.id">
<view>
{{item.label}}
</view>
<view class="">
<up-checkbox shape='circle' :customStyle="{marginBottom: '8px'}" v-model:checked="ele.hasPermission"
usedAlone v-for="(ele, index) in item.children" :key="index" :label="ele.label"
style="margin-right: 40rpx;font-size: 28rpx;">
</up-checkbox>
</view>
</view>
<view class="bottomBotton" @tap="sumbitEvent">
保存
</view>
<view class="bottomBotton2" @tap="toUrl">
取消
</view>
<!-- 角色选择器 -->
<up-picker :show="show" @confirm="confirm" @cancel="show = false" :columns="columns"></up-picker>
<!-- 弹窗 -->
<uni-popup ref="message" type="message">
<uni-popup-message type="warn" message="请选择角色" :duration="2000"></uni-popup-message>
</uni-popup>
</template>
<script setup>
import {
getCurrentInstance,
onMounted,
reactive,
ref
} from 'vue';
import go from '@/commons/utils/go.js';
import {
tbShopPermissionList,
getroles,
tbPlussShopStaff,
tbPlussShopStaffDetail
} from "@/http/yskApi/requestAll.js"
const currentInstance = getCurrentInstance()
const props = defineProps({
type: {
type: String
},
id: {
type: Number
}
})
let datas = reactive({
formData: {
permissions: []
},
rolesList: [],
columns: [],
rolesdata: '请选择角色'
})
const columns = reactive([
[]
]);
const show = ref(false)
onMounted(() => {
//
getrolesEvent()
if (props.type == 'add') {
getList()
} else {
// id
gettbPlussShopStaffDetail(props.id)
}
})
function gettbPlussShopStaffDetail(id) {
tbPlussShopStaffDetail(id).then(res => {
datas.formData = res
datas.rolesdata = datas.rolesList.filter(ele => ele.id == res.roleId)[0].name
})
}
function sumbitEvent() {
let rolesId = datas.rolesList.filter(ele => ele.name == datas.rolesdata)
if (rolesId.length == 0) {
currentInstance.ctx.$refs.message.open()
return
}
datas.formData.roleId = rolesId[0].id
datas.formData.permissions.forEach(ele => {
ele.children.forEach(res => {
if (res.hasPermission) {
res.hasPermission = 1
}
})
})
tbPlussShopStaff({
shopId: uni.getStorageSync("shopId"),
...datas.formData
}).then(res => {
toUrl()
})
}
function getList() {
tbShopPermissionList().then((res) => {
datas.formData.permissions = res
})
}
function getrolesEvent() {
getroles().then((res) => {
datas.rolesList = res.content
res.content.forEach(ele => {
columns[0].push(ele.name)
})
})
}
function confirm(e) {
// console.log(e.value, '1')
datas.rolesdata = e.value[0]
show.value = false
}
function toUrl() {
go.to('PAGES_STAFF')
}
</script>
<style scoped lang="less">
page {
background-color: #f9f9f9;
padding: 32rpx 28rpx;
}
.h7 {
margin: 32rpx 0;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #333333;
}
.content {
width: 694rpx;
// height: 1256rpx;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
>view {
padding: 32rpx 24rpx;
background-color: #fff;
font-weight: bold;
font-size: 28rpx;
color: #333333;
>input {
padding: 24rpx 0;
}
}
}
.contentBottom {
width: 694rpx;
background: #FFFFFF;
border-radius: 18rpx 18rpx 18rpx 18rpx;
padding: 32rpx 24rpx;
margin-top: 24rpx;
}
.bottomBotton {
width: 530rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background: #318AFE;
border-radius: 56rpx 56rpx 56rpx 56rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
margin-top: 50rpx;
margin-left: 50%;
transform: translateX(-50%);
}
.bottomBotton2 {
width: 530rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
font-size: 32rpx;
font-weight: 400;
color: #999999;
margin-left: 50%;
transform: translateX(-50%);
}
</style>

166
pageStaff/index.vue Normal file
View File

@ -0,0 +1,166 @@
<template>
<ul class="liststyle">
<li v-for="item in datas.list " :key="item.id">
<view class="">
<view class="">
<span style="font-size: 28rpx;color: #333333; ">{{item.name}}</span>
<span style="font-size: 24rpx;color: #999; ">{{item.code}}</span>
</view>
<view class="" style="font-size: 24rpx;color: #666666;">
{{item.account}}
</view>
</view>
<view class="">
<view class="">
<span style="font-size: 28rpx;color: #999999;">是否启用用</span>
<up-switch :activeValue="1" :inactiveValue="0" v-model="item.status" size="18"
@change="switch2Change($event,item)"></up-switch>
</view>
<view class="df">
<up-button size="small" style="border-radius: 28rpx 28rpx 28rpx 28rpx;"
@tap="datas.show = true;datas.rolesId=item.id" text="删除"></up-button>
<up-button type="primary" plain size="small"
style="border-radius: 28rpx 28rpx 28rpx 28rpx;margin-left: 16rpx;" @tap="toUrl(item)"
text="编辑"></up-button>
</view>
</view>
</li>
</ul>
<view class="bottomBotton" @tap="toUrl">
添加员工
</view>
<!-- 删除确认框 -->
<up-modal :show="datas.show" contentTextAlign="center" showCancelButton @confirm='delTableHandle'
@cancel='datas.show=false' content='是否确认删除?'></up-modal>
</template>
<script setup>
import {
reactive,
ref,
watch,
onMounted
} from 'vue';
import go from '@/commons/utils/go.js';
import {
rolesGet,
shopStaffDelete,
updateStatus
} from "@/http/yskApi/requestAll.js"
let datas = reactive({
list: [],
show: false,
// id
rolesId: ""
})
onMounted(() => {
getList()
})
function delTableHandle() {
shopStaffDelete(
[datas.rolesId]
)
datas.show = false
setTimeout(() => {
getList()
}, 500)
}
function toUrl(d) {
if (d.id) {
go.to('PAGES_ADD_STAFF', {
type: '',
id: d.id
})
} else {
go.to('PAGES_ADD_STAFF', {
type: 'add',
})
}
}
function switch2Change(e, d) {
updateStatus({
id: d.id,
status: e
}).then(res => {
setTimeout(() => {
getList()
}, 500)
})
}
function getList() {
rolesGet({
shopId: uni.getStorageSync("shopId"),
page: 1,
size: 100
}).then((res) => {
datas.list = res.content
})
}
</script>
<style lang="less" scoped>
* {
padding: 0;
margin: 0;
text-decoration: none;
outline: none;
}
page {
background-color: #f9f9f9;
}
ul,
li {
list-style: none;
}
.liststyle {
>li {
width: 694rpx;
height: 192rpx;
background: #FFFFFF;
border-radius: 10rpx 10rpx 10rpx 10rpx;
padding: 0 16rpx;
margin: 32rpx auto;
>view {
display: flex;
align-items: center;
justify-content: space-between;
height: 96rpx;
}
>view:first-child {
border-bottom: 2rpx solid #E5E5E5;
}
}
}
.bottomBotton {
width: 530rpx;
height: 80rpx;
line-height: 80rpx;
text-align: center;
background: #318AFE;
border-radius: 56rpx 56rpx 56rpx 56rpx;
font-family: Source Han Sans CN, Source Han Sans CN;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
position: fixed;
bottom: 20rpx;
left: 50%;
transform: translateX(-50%);
}
.df {
display: flex;
justify-content: center;
}
</style>

View File

@ -1204,22 +1204,20 @@
{ {
"root": "pagesOrder", "root": "pagesOrder",
"pages": [{ "pages": [{
"pageId": "PAGES_ORDER_INDEX", "pageId": "PAGES_ORDER_INDEX",
"path" : "index/index", "path": "index/index",
"style" : "style": {
"navigationBarTitleText": "订单管理"
}
},
{ {
"navigationBarTitleText" : "订单管理" "pageId": "PAGES_ORDER_DETAIL",
"path": "detail/detail",
"style": {
"navigationBarTitleText": "订单详情"
}
} }
},
{
"pageId": "PAGES_ORDER_DETAIL",
"path" : "detail/detail",
"style" :
{
"navigationBarTitleText" : "订单详情"
}
}
] ]
}, },
{ {
@ -1264,16 +1262,30 @@
"style": { "style": {
"navigationBarTitleText": "排队" "navigationBarTitleText": "排队"
} }
},{ }, {
"pageId": "PAGES_CALLRE_CORD", "pageId": "PAGES_CALLRE_CORD",
"path": "callRecord", "path": "callRecord",
"style": { "style": {
"navigationBarTitleText": "叫号记录" "navigationBarTitleText": "叫号记录"
} }
} }]
] },
{
"root": "pageStaff",
"pages": [{
"pageId": "PAGES_STAFF",
"path": "index",
"style": {
"navigationBarTitleText": "员工管理"
}
}, {
"pageId": "PAGES_ADD_STAFF",
"path": "addstaff",
"style": {
"navigationBarTitleText": "新增员工"
}
}]
}, },
{ {
"root": "pageConsumables", "root": "pageConsumables",
"pages": [{ "pages": [{

View File

@ -66,6 +66,10 @@
title: '用户管理', title: '用户管理',
icon: '/static/indexImg/icon-user.svg', icon: '/static/indexImg/icon-user.svg',
pageUrl: 'PAGES_USER_CONTROL', pageUrl: 'PAGES_USER_CONTROL',
},{
title: '员工管理',
icon: '/static/indexImg/icon-staff.svg',
pageUrl: 'PAGES_STAFF'
}, },
{ {
title: '桌台', title: '桌台',