代码更新

This commit is contained in:
GaoHao
2025-02-26 19:46:20 +08:00
parent 7519ffced3
commit b4a0393d2d
413 changed files with 7483 additions and 60762 deletions

View File

@@ -1,6 +1,6 @@
<template>
<view class="liststyle">
<view v-for="item in datas.list " :key="item.id">
<view v-for="item in pageData.list " :key="item.id">
<view class="">
<view class="">
<span style="font-size: 28rpx;color: #333333; ">{{item.name}}&nbsp;</span>
@@ -13,12 +13,12 @@
<view class="">
<view style="display: flex;justify-content: center;align-items: center;">
<span style="font-size: 28rpx;color: #999999;">是否启用</span>&nbsp;&nbsp;
<up-switch :activeValue="1" :inactiveValue="0" v-model="item.status" size="18"
<up-switch :activeValue="true" :inactiveValue="false" v-model="item.status" size="18"
@change="switch2Change($event,item)"></up-switch>
</view>
<view class="df">
<up-button size="small" shape="circle" style="border-radius: 28rpx 28rpx 28rpx 28rpx;"
@tap="datas.show = true;datas.rolesId=item.id" text="删除"></up-button>&nbsp;&nbsp;
@tap="pageData.show = true;pageData.rolesId=item.id" text="删除"></up-button>&nbsp;&nbsp;
<up-button type="primary" shape="circle" plain size="small"
style="border-radius: 28rpx 28rpx 28rpx 28rpx;margin-left: 16rpx;" @tap="toUrl(item)"
text="编辑"></up-button>
@@ -27,7 +27,7 @@
</view>
<view style="background-color: rgba(0,0,0,0);"></view>
</view>
<view v-if="datas.list.length==0" style="text-align: center;">
<view v-if="pageData.list.length==0" style="text-align: center;">
<image src="./bg.png" style="width: 325rpx;height: 335rpx;" mode=""></image>
<view style="font-size: 28rpx;color: #999;">暂无员工</view>
</view>
@@ -35,50 +35,72 @@
添加员工
</view>
<!-- 删除确认框 -->
<up-modal :show="datas.show" contentTextAlign="center" showCancelButton @confirm='delTableHandle'
@cancel='datas.show=false' content='是否确认删除?'></up-modal>
<up-modal :show="pageData.show" contentTextAlign="center" showCancelButton @confirm='delTableHandle'
@cancel='pageData.show=false' content='是否确认删除?'></up-modal>
</template>
<script setup>
import {
reactive,
ref,
watch,
onMounted
} from 'vue';
import {
onShow
} from '@dcloudio/uni-app';
import { reactive, ref, watch, onMounted } from 'vue';
import { onShow } from '@dcloudio/uni-app';
import go from '@/commons/utils/go.js';
import {
rolesGet,
shopStaffDelete,
updateStatus
} from "@/http/yskApi/requestAll.js"
let datas = reactive({
list: [],
import { shopStaffList,shopStaffDel,shopStaffPut } from "@/api/staff.js"
let pageData = reactive({
show: false,
// 删除员工id
rolesId: ""
list: [],
rolesId: "" // 删除员工id
})
onShow(() => {
getList()
})
/**
* 获取员工列表
*/
function getList() {
shopStaffList({
page: 0,
size: 100
}).then((res) => {
pageData.list = res.records
})
}
/**
* 员工状态修改
* @param {Object} e
* @param {Object} d
*/
function switch2Change(e, d) {
shopStaffPut({
id: d.id,
status: e
}).then(res => {
setTimeout(() => {
getList()
}, 500)
})
}
/**
* 删除员工
*/
function delTableHandle() {
shopStaffDelete(
[datas.rolesId]
)
datas.show = false
shopStaffDel({id:pageData.rolesId})
pageData.show = false
setTimeout(() => {
getList()
}, 500)
}
/**
* 前往新增/修改
* @param {Object} d
*/
function toUrl(d) {
if (d.id) {
go.to('PAGES_ADD_STAFF', {
type: '',
type: 'edit',
id: d.id
})
} else {
@@ -88,26 +110,8 @@
}
}
function switch2Change(e, d) {
updateStatus({
id: d.id,
status: e
}).then(res => {
setTimeout(() => {
getList()
}, 500)
})
}
function getList() {
rolesGet({
shopId: uni.getStorageSync("shopId"),
page: 0,
size: 100
}).then((res) => {
datas.list = res.content
})
}
</script>
<style>
page {
@@ -115,13 +119,6 @@
}
</style>
<style lang="less" scoped>
// * {
// padding: 0;
// margin: 0;
// text-decoration: none;
// outline: none;
// }