Compare commits
10
Commits
943093ed5e
...
3609558042
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3609558042 | ||
|
|
a570dde8b7 | ||
|
|
1ff292a3d8 | ||
|
|
a7f1d11435 | ||
|
|
b57cdf35a2 | ||
|
|
dd56481b52 | ||
|
|
4cb9f7cd67 | ||
|
|
d351368ba4 | ||
|
|
b6645238fd | ||
|
|
aad82d10a2 |
@@ -49,12 +49,13 @@ export function getNonGroupUsers() {
|
||||
});
|
||||
}
|
||||
|
||||
// 添加/修改组内人员角色
|
||||
export function updateGroupUserRole(groupId, userid, role) {
|
||||
// 更新组内用户角色
|
||||
export const updateGroupUserRole = (data) => {
|
||||
return service({
|
||||
url: `/group/${groupId}/user/${userid}/role/${role}`,
|
||||
method: "post",
|
||||
});
|
||||
url: '/group/user',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取组内人员列表
|
||||
@@ -98,10 +99,11 @@ export function updateUserSalaryConfig(data) {
|
||||
}
|
||||
|
||||
// 添加用户到组
|
||||
export function addUserToGroup(groupId, userid, role) {
|
||||
export function addUserToGroup(data) {
|
||||
return service({
|
||||
url: `/group/${groupId}/user/${userid}/role/${role}`,
|
||||
method: 'post'
|
||||
url: '/group/user',
|
||||
method: 'post',
|
||||
data
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import request from './request'
|
||||
|
||||
// 获取最低工资配置
|
||||
export function getMinimumWageConfig() {
|
||||
return request({
|
||||
url: '/config',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 更新最低工资配置
|
||||
export function updateMinimumWageConfig(data) {
|
||||
return request({
|
||||
url: '/config',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
+6
-6
@@ -10,13 +10,13 @@ const errorCode = {
|
||||
};
|
||||
|
||||
// 肖星越服务
|
||||
const url = "https://paystubs.vip.cpolar.top";
|
||||
// const url = "http://192.168.31.182:8088";
|
||||
|
||||
// 袁永军测试服务
|
||||
// const url = "https://crm-test.scdswj.cn/prod-api";
|
||||
|
||||
// 正式环境
|
||||
// const url = "https://paystubs.vip.cpolar.top";
|
||||
const url = "https://payroll.scdswj.cn/prod-api";
|
||||
|
||||
const service = axios.create({
|
||||
baseURL: url,
|
||||
@@ -65,8 +65,8 @@ service.interceptors.response.use(
|
||||
// store.commit('setMenuData', {});
|
||||
// resetRouter(); // 重置路由
|
||||
ElMessageBox.alert("你已被登出,请重新登录", "提示", {})
|
||||
.then(() => {})
|
||||
.catch(() => {});
|
||||
.then(() => { })
|
||||
.catch(() => { });
|
||||
}
|
||||
} else if (code === 500) {
|
||||
// Message({ message: msg, type: 'error' })
|
||||
@@ -98,8 +98,8 @@ service.interceptors.response.use(
|
||||
} else {
|
||||
ElMessage.error(
|
||||
error.response.data.errmsg ||
|
||||
error.response.data.error ||
|
||||
error.response.data.errMessage
|
||||
error.response.data.error ||
|
||||
error.response.data.errMessage
|
||||
);
|
||||
}
|
||||
return Promise.reject(error);
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -35,7 +35,7 @@ export default {
|
||||
mounted(el, binding) {
|
||||
const { value } = binding
|
||||
const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
|
||||
const userRole = userInfo.role || 0
|
||||
const userRole = userInfo.roles || 0
|
||||
|
||||
// 如果没有权限配置,默认显示
|
||||
if (!value) {
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
<template>
|
||||
<el-icon class="icon-style" id="collapseIcon" @click="changeShrinkage">
|
||||
<!-- <el-icon class="icon-style" id="collapseIcon" @click="changeShrinkage">
|
||||
<component :is="!isCollapse ? 'Fold' : 'Expand'"></component>
|
||||
</el-icon>
|
||||
</el-icon> -->
|
||||
<el-breadcrumb separator="/" id="breadcrumb">
|
||||
<el-breadcrumb-item v-for="(item, index) in breadcrumbList" :key="index">
|
||||
<span class="no-redirect" v-if="index === breadcrumbList.length - 1" :style="{ color: themeConfig.footColor }">{{ item.meta.name }}</span>
|
||||
<span class="redirect" v-else @click="handleRedirect(item.path)" :style="{ color: themeConfig.footColor }">{{ item.meta.name }}</span>
|
||||
<span class="no-redirect" v-if="index === breadcrumbList.length - 1" :style="{ color: themeConfig.footColor }">{{
|
||||
item.meta.name }}</span>
|
||||
<span class="redirect" v-else @click="handleRedirect(item.path)" :style="{ color: themeConfig.footColor }">{{
|
||||
item.meta.name }}</span>
|
||||
</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
</template>
|
||||
@@ -19,7 +21,7 @@ const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const breadcrumbList = ref([]);
|
||||
const isCollapse = ref(false);
|
||||
const isCollapse = ref(true);
|
||||
const globalStore = useStore();
|
||||
const themeConfig = store.getters.themeConfig;
|
||||
const initBreadcrumbList = () => {
|
||||
@@ -49,13 +51,16 @@ watch(
|
||||
// color: #97a8be;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
.redirect {
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover {
|
||||
color: #97a8be;
|
||||
}
|
||||
}
|
||||
|
||||
.icon-style {
|
||||
font-size: 20px;
|
||||
cursor: pointer;
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<template v-for="subItem in menuList" :key="subItem.path">
|
||||
<el-menu-item v-if="!subItem.children" :index="subItem.url" :route="subItem.url">
|
||||
<el-icon>
|
||||
<!-- <el-icon>
|
||||
<component :is="subItem.icon"></component>
|
||||
</el-icon>
|
||||
</el-icon> -->
|
||||
<span>{{ subItem.title }}</span>
|
||||
</el-menu-item>
|
||||
<!--有多级菜单-->
|
||||
<el-sub-menu v-if="subItem.children" :key="subItem.url" :index="subItem.url">
|
||||
<template #title>
|
||||
<el-icon>
|
||||
<!-- <el-icon>
|
||||
<component :is="subItem.icon"></component>
|
||||
</el-icon>
|
||||
</el-icon> -->
|
||||
<span> {{ subItem.title }}</span>
|
||||
</template>
|
||||
<!--递归组件,把遍历的值传回子组件,完成递归调用-->
|
||||
|
||||
@@ -1,19 +1,17 @@
|
||||
<template>
|
||||
<div id="guide" class="menu" :style="{
|
||||
width: store.getters.isCollapse == true ? '' : '200px',
|
||||
width: '200px',
|
||||
height: '100%',
|
||||
color: themeConfig.textColor,
|
||||
}">
|
||||
<div class="logo" v-if="!store.getters.isCollapse">
|
||||
<img src="../../assets/logo.png" alt="" style="margin-right: 5px" /> BIG CUTE
|
||||
</div>
|
||||
<div class="logo" v-else>
|
||||
<img src="../../assets/logo.png" alt="" />
|
||||
<div class="logo">
|
||||
<img src="../../assets/logo2.jpg" alt="" style="margin-right: 5px" /> 工资核算系统
|
||||
</div>
|
||||
|
||||
<el-scrollbar style="height: 100%">
|
||||
<el-menu :default-active="activeMenu" :router="true" :collapse="store.getters.isCollapse"
|
||||
:collapse-transition="false" :unique-opened="true" :background-color="themeConfig.backgroundColor"
|
||||
:text-color="themeConfig.textColor" :active-text-color="themeConfig.primary">
|
||||
<el-menu :default-active="activeMenu" :router="true" :collapse="false" :collapse-transition="false"
|
||||
:unique-opened="true" :background-color="themeConfig.backgroundColor" :text-color="themeConfig.textColor"
|
||||
:active-text-color="themeConfig.primary">
|
||||
<menuItems :menuList="menuList"></menuItems>
|
||||
</el-menu>
|
||||
</el-scrollbar>
|
||||
@@ -46,7 +44,7 @@ const themeConfig = store.getters.themeConfig;
|
||||
onMounted(() => {
|
||||
// 权限检查
|
||||
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
||||
const menuTable = generateMenu(routerList, userInfo.role)
|
||||
const menuTable = generateMenu(routerList, userInfo.roles)
|
||||
// 获取本地菜单表渲染
|
||||
menuList.value = menuTable;
|
||||
});
|
||||
|
||||
+2
-2
@@ -17,8 +17,8 @@ import "@kangc/v-md-editor/lib/theme/style/vuepress.css";
|
||||
import VConsole from "vconsole";
|
||||
import authDirective from './directives/auth'
|
||||
// 或者使用配置参数来初始化,详情见文档
|
||||
const vConsole = new VConsole({ theme: "dark" });
|
||||
VMdEditor.use(vuepressTheme);
|
||||
// const vConsole = new VConsole({ theme: "dark" });
|
||||
// VMdEditor.use(vuepressTheme);
|
||||
const app = createApp(App);
|
||||
|
||||
// 小图标引用
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// 递归处理路由列表生成菜单数据
|
||||
export const generateMenu = (routes, userRole) => {
|
||||
export const generateMenu = (routes, userRoles) => {
|
||||
const menuList = [];
|
||||
|
||||
// 递归处理路由
|
||||
@@ -7,10 +7,17 @@ export const generateMenu = (routes, userRole) => {
|
||||
// 检查路由是否需要权限验证
|
||||
if (route.meta && route.meta.requiresAuth) {
|
||||
// 检查用户角色是否有权限访问
|
||||
if (route.meta.roles && !route.meta.roles.includes(userRole)) {
|
||||
return null;
|
||||
if (route.meta.roles) {
|
||||
const hasPermission = userRoles.some(role =>
|
||||
route.meta.roles.includes(Number(role))
|
||||
);
|
||||
if (!hasPermission) {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
const menuItem = {
|
||||
title: route.meta.name,
|
||||
path: route.path,
|
||||
@@ -61,7 +68,7 @@ export const generateMenu = (routes, userRole) => {
|
||||
|
||||
// 使用示例
|
||||
/*
|
||||
const userRole = 2; // 用户角色
|
||||
const menuList = generateMenu(routerList, userRole);
|
||||
const userRoles = [2]; // 用户角色
|
||||
const menuList = generateMenu(routerList, userRoles);
|
||||
console.log(menuList);
|
||||
*/
|
||||
@@ -141,6 +141,18 @@ const routerList = [
|
||||
icon: "Notebook",
|
||||
roles: [3] // 只有财务角色可以访问
|
||||
}
|
||||
},
|
||||
{
|
||||
path: '/config',
|
||||
name: 'MinimumWageConfig',
|
||||
component: () => import('../views/payroll/config/index.vue'),
|
||||
meta: {
|
||||
title: '当地最低工资查询',
|
||||
name: "当地最低工资查询",
|
||||
requiresAuth: true,
|
||||
icon: "Notebook",
|
||||
roles: [3] // 只有财务角色可以访问
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button type="primary" size="small" @click="handleAdd" v-auth="'group:add'">添加组别</el-button>
|
||||
<el-button type="primary" size="small" @click="handleAdd" v-if="canAdd">添加组别</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -28,12 +28,12 @@
|
||||
{{ scope.row.createTime || "暂无" }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" fixed="right" align="center" v-if="userRole === 2">
|
||||
<el-table-column label="操作" width="180" fixed="right" align="center" v-if="canEdit || canDelete">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" link size="small" @click.stop="handleEdit(scope.row)"
|
||||
v-auth="'group:edit'">编辑</el-button>
|
||||
v-if="canEdit">编辑</el-button>
|
||||
<el-button type="danger" link size="small" @click.stop="handleDelete(scope.row)"
|
||||
v-auth="'group:delete'">删除</el-button>
|
||||
v-if="canDelete">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -55,7 +55,7 @@
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button type="primary" size="small" @click="handleAddUser" v-auth="'member:add'">添加成员</el-button>
|
||||
<el-button type="primary" size="small" @click="handleAddUser" v-if="canAddMember">添加成员</el-button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -64,39 +64,45 @@
|
||||
<!-- 组内人员列表 -->
|
||||
<div class="user-section">
|
||||
<el-table :data="groupUsers" style="width: 100%" height="calc(100vh - 280px)" border stripe>
|
||||
<el-table-column label="头像" align="center">
|
||||
<el-table-column label="头像" align="center" width="120">
|
||||
<template #default="scope">
|
||||
<el-avatar :size="40" :src="scope.row.avatar" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="姓名" show-overflow-tooltip />
|
||||
<el-table-column label="角色" align="center">
|
||||
<el-table-column label="角色" align="center" width="220">
|
||||
<template #default="scope">
|
||||
<template v-if="userRole === 2">
|
||||
<el-select v-model="scope.row.role" placeholder="选择角色" size="small"
|
||||
<template v-if="canManageRole">
|
||||
<el-select v-model="scope.row.roles" placeholder="选择角色" size="small" multiple
|
||||
@change="(value) => handleRoleChange(scope.row, value)">
|
||||
<el-option label="普通员工" :value="0" />
|
||||
<el-option label="部门主管" :value="1" />
|
||||
<el-option label="综合部" :value="2" />
|
||||
<el-option label="财务部" :value="3" />
|
||||
<el-option label="普通员工" value="0" />
|
||||
<el-option label="部门主管" value="1" />
|
||||
<el-option label="综合部" value="2" />
|
||||
<el-option label="财务部" value="3" />
|
||||
</el-select>
|
||||
</template>
|
||||
<template v-else>
|
||||
<el-tag :type="getRoleTagType(scope.row.role)">
|
||||
{{ getRoleName(scope.row.role) }}
|
||||
</el-tag>
|
||||
<div class="role-tags">
|
||||
<el-tag v-for="role in scope.row.roles" :key="role" :type="getRoleTagType(role)"
|
||||
class="role-tag">
|
||||
{{ getRoleName(role) }}
|
||||
</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="220" fixed="right" align="center"
|
||||
v-if="userRole === 2 || userRole === 3">
|
||||
<el-table-column label="操作" width="140" fixed="right" align="center"
|
||||
v-if="canViewSalary || canRemoveUser">
|
||||
<template #default="scope">
|
||||
<template v-if="userRole === 3">
|
||||
<el-button type="primary" link size="small" @click="handleViewSalary(scope.row)"
|
||||
v-auth="'member:salary'">查看工资配置</el-button>
|
||||
<template v-if="canViewSalary">
|
||||
<el-button type="primary" link size="small" @click="handleViewSalary(scope.row)">
|
||||
查看工资配置
|
||||
</el-button>
|
||||
</template>
|
||||
<el-button type="danger" link size="small" @click="handleRemoveUser(scope.row)"
|
||||
v-auth="'member:delete'">移除</el-button>
|
||||
v-if="canRemoveUser">
|
||||
移除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -203,7 +209,7 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from "vue";
|
||||
import { ref, onMounted, computed } from "vue";
|
||||
import { ElMessage, ElMessageBox } from "element-plus";
|
||||
import {
|
||||
getGroupList,
|
||||
@@ -296,7 +302,21 @@ const groupRules = {
|
||||
const router = useRouter();
|
||||
|
||||
const userInfo = JSON.parse(sessionStorage.getItem('userInfo') || '{}')
|
||||
const userRole = userInfo.role || 0
|
||||
const userRoles = userInfo.roles || []
|
||||
|
||||
// 检查是否有权限
|
||||
const hasPermission = (requiredRoles) => {
|
||||
return userRoles.some(role => requiredRoles.includes(Number(role)))
|
||||
}
|
||||
|
||||
// 按钮权限判断
|
||||
const canAdd = computed(() => hasPermission([2])) // 角色1和2可以添加
|
||||
const canEdit = computed(() => hasPermission([2])) // 角色1和2可以编辑
|
||||
const canDelete = computed(() => hasPermission([2])) // 只有角色1可以删除
|
||||
const canManageRole = computed(() => hasPermission([2])) // 只有角色2可以管理角色
|
||||
const canViewSalary = computed(() => hasPermission([3])) // 只有角色3可以查看工资
|
||||
const canRemoveUser = computed(() => hasPermission([2])) // 只有角色2可以删除成员
|
||||
const canAddMember = computed(() => hasPermission([2])) // 只有角色2可以添加成员
|
||||
|
||||
// 获取组别列表
|
||||
const fetchGroupList = async () => {
|
||||
@@ -355,14 +375,14 @@ const handleMemberSearch = () => {
|
||||
);
|
||||
};
|
||||
|
||||
// 修改成员角色
|
||||
const handleRoleChange = async (user, role) => {
|
||||
// 修改角色变更处理函数
|
||||
const handleRoleChange = async (user, roles) => {
|
||||
try {
|
||||
const res = await updateGroupUserRole(
|
||||
currentGroup.value.groupId,
|
||||
user.userid,
|
||||
role
|
||||
);
|
||||
const res = await updateGroupUserRole({
|
||||
groupId: currentGroup.value.groupId,
|
||||
userid: user.userid,
|
||||
roles: roles
|
||||
});
|
||||
if (res.errcode === 0) {
|
||||
ElMessage.success("修改成功");
|
||||
const userInfo = JSON.parse(sessionStorage.getItem("userInfo")) || {}
|
||||
@@ -376,11 +396,6 @@ const handleRoleChange = async (user, role) => {
|
||||
ElMessage.error("修改失败");
|
||||
}
|
||||
};
|
||||
const gotoLogin = () => {
|
||||
sessionStorage.removeItem("token");
|
||||
sessionStorage.removeItem("userInfo");
|
||||
router.push("/login");
|
||||
};
|
||||
|
||||
// 移除成员
|
||||
const handleRemoveUser = async (user) => {
|
||||
@@ -557,7 +572,11 @@ const fetchNonGroupUsers = async () => {
|
||||
// 添加用户到组
|
||||
const handleAddToGroup = async (user) => {
|
||||
try {
|
||||
const res = await addUserToGroup(currentGroup.value.groupId, user.userid, 0); // 默认角色为普通员工
|
||||
const res = await addUserToGroup({
|
||||
groupId: currentGroup.value.groupId,
|
||||
userid: user.userid,
|
||||
roles: ["0"] // 默认角色为普通员工
|
||||
});
|
||||
if (res.errcode === 0) {
|
||||
ElMessage.success("添加成功");
|
||||
addUserDialogVisible.value = false;
|
||||
@@ -598,10 +617,10 @@ const handleSearch = () => {
|
||||
// 获取角色名称
|
||||
const getRoleName = (role) => {
|
||||
const roleMap = {
|
||||
0: '普通员工',
|
||||
1: '部门主管',
|
||||
2: '综合部',
|
||||
3: '财务部'
|
||||
"0": '普通员工',
|
||||
"1": '部门主管',
|
||||
"2": '综合部',
|
||||
"3": '财务部'
|
||||
}
|
||||
return roleMap[role] || '未知角色'
|
||||
}
|
||||
@@ -609,10 +628,10 @@ const getRoleName = (role) => {
|
||||
// 获取角色标签类型
|
||||
const getRoleTagType = (role) => {
|
||||
const typeMap = {
|
||||
0: 'info',
|
||||
1: 'success',
|
||||
2: 'warning',
|
||||
3: 'danger'
|
||||
"0": 'info',
|
||||
"1": 'success',
|
||||
"2": 'warning',
|
||||
"3": 'danger'
|
||||
}
|
||||
return typeMap[role] || 'info'
|
||||
}
|
||||
@@ -621,6 +640,12 @@ const getRoleTagType = (role) => {
|
||||
onMounted(() => {
|
||||
fetchGroupList();
|
||||
});
|
||||
|
||||
const gotoLogin = () => {
|
||||
sessionStorage.removeItem("token");
|
||||
sessionStorage.removeItem("userInfo");
|
||||
router.push("/login");
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@@ -909,4 +934,15 @@ onMounted(() => {
|
||||
border-top: 1px solid var(--el-border-color-light);
|
||||
background-color: var(--el-bg-color);
|
||||
}
|
||||
|
||||
.role-tags {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
justify-content: center;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.role-tag {
|
||||
margin: 2px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
<template>
|
||||
<div class="minimum-wage-config">
|
||||
<el-card class="box-card">
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span class="title">当地最低工资配置</span>
|
||||
<el-tag type="info" size="small">仅财务人员可操作</el-tag>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-form :model="formData" :rules="rules" ref="formRef" label-width="120px" class="wage-form">
|
||||
<el-form-item label="最低工资标准" prop="minimumWage">
|
||||
<el-input-number v-model="formData.minimumWage" :min="0" :precision="2" :step="100"
|
||||
:controls-position="'right'" @change="handleWageChange" class="wage-input" />
|
||||
<span class="unit">元/月</span>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSubmit" :loading="loading">
|
||||
保存修改
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { getMinimumWageConfig, updateMinimumWageConfig } from '../../../api/payroll'
|
||||
|
||||
const formRef = ref(null)
|
||||
const loading = ref(false)
|
||||
|
||||
const formData = ref({
|
||||
minimumWage: 0
|
||||
})
|
||||
|
||||
const rules = {
|
||||
minimumWage: [
|
||||
{ required: true, message: '请输入最低工资标准', trigger: 'blur' },
|
||||
{ type: 'number', min: 0, message: '最低工资不能小于0', trigger: 'blur' }
|
||||
],
|
||||
effectiveDate: [
|
||||
{ required: true, message: '请选择生效日期', trigger: 'change' }
|
||||
]
|
||||
}
|
||||
|
||||
// 获取最低工资配置
|
||||
const fetchConfig = async () => {
|
||||
try {
|
||||
loading.value = true
|
||||
const response = await getMinimumWageConfig()
|
||||
// 处理后端返回的数据格式
|
||||
if (response && response.errcode === 0 && response.result) {
|
||||
formData.value = {
|
||||
minimumWage: Number(response.result.recordValue) || 0
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
ElMessage.error('获取最低工资配置失败')
|
||||
console.error('获取配置失败:', error)
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 提交修改
|
||||
const handleSubmit = async () => {
|
||||
if (!formRef.value) return
|
||||
|
||||
try {
|
||||
await formRef.value.validate()
|
||||
loading.value = true
|
||||
|
||||
await ElMessageBox.confirm(
|
||||
'确定要修改最低工资标准吗?',
|
||||
'提示',
|
||||
{
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}
|
||||
)
|
||||
|
||||
// 只传递recordValue参数
|
||||
const submitData = {
|
||||
recordValue: formData.value.minimumWage.toString()
|
||||
}
|
||||
|
||||
await updateMinimumWageConfig(submitData)
|
||||
ElMessage.success('修改成功')
|
||||
} catch (error) {
|
||||
if (error !== 'cancel') {
|
||||
ElMessage.error('修改失败')
|
||||
console.error('修改失败:', error)
|
||||
}
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
|
||||
// 重置表单
|
||||
const resetForm = () => {
|
||||
if (!formRef.value) return
|
||||
formRef.value.resetFields()
|
||||
}
|
||||
|
||||
// 工资变化时的处理
|
||||
const handleWageChange = (value) => {
|
||||
console.log('工资值变化:', value)
|
||||
}
|
||||
|
||||
// 禁用过去的日期
|
||||
const disablePastDates = (time) => {
|
||||
return time.getTime() < Date.now() - 8.64e7
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchConfig()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.minimum-wage-config {
|
||||
padding: 20px;
|
||||
background-color: #f5f7fa;
|
||||
min-height: calc(100vh - 120px);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.box-card {
|
||||
width: 100%;
|
||||
max-width: 800px;
|
||||
margin: 0 auto;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
@media screen and (max-width: 768px) {
|
||||
.minimum-wage-config {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.box-card {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__label) {
|
||||
width: 100px !important;
|
||||
}
|
||||
|
||||
.wage-input {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.card-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
.card-header .title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.wage-form {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.wage-input {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.unit {
|
||||
margin-left: 10px;
|
||||
color: #606266;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
:deep(.el-form-item__label) {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
:deep(.el-input-number .el-input__wrapper) {
|
||||
padding-right: 40px;
|
||||
}
|
||||
|
||||
:deep(.el-textarea__inner) {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
:deep(.el-button) {
|
||||
padding: 12px 20px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
:deep(.el-button + .el-button) {
|
||||
margin-left: 12px;
|
||||
}
|
||||
</style>
|
||||
@@ -5,24 +5,14 @@
|
||||
<div class="card-header">
|
||||
<span class="title">工资条列表</span>
|
||||
<div class="header-right">
|
||||
<el-date-picker
|
||||
v-model="dateRange"
|
||||
type="month"
|
||||
placeholder="选择月份"
|
||||
:default-time="defaultTime"
|
||||
:shortcuts="dateShortcuts"
|
||||
@change="handleDateChange"
|
||||
style="width: 200px; margin-right: 8px;"
|
||||
/>
|
||||
<el-input
|
||||
v-model="searchKeyword"
|
||||
placeholder="请输入姓名搜索"
|
||||
clearable
|
||||
@input="handleSearch"
|
||||
style="width: 200px; margin-right: 8px;"
|
||||
>
|
||||
<el-date-picker v-model="dateRange" type="month" placeholder="选择月份" :default-time="defaultTime"
|
||||
:shortcuts="dateShortcuts" @change="handleDateChange" style="width: 200px; margin-right: 8px;" />
|
||||
<el-input v-model="searchKeyword" placeholder="请输入姓名搜索" clearable @input="handleSearch"
|
||||
style="width: 200px; margin-right: 8px;">
|
||||
<template #prefix>
|
||||
<el-icon><Search /></el-icon>
|
||||
<el-icon>
|
||||
<Search />
|
||||
</el-icon>
|
||||
</template>
|
||||
</el-input>
|
||||
<el-button type="success" @click="handleBatchShowToEmployee">批量展示给员工</el-button>
|
||||
@@ -30,24 +20,15 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<el-table
|
||||
:data="payrollList"
|
||||
style="width: 100%"
|
||||
height="calc(100vh - 280px)"
|
||||
border
|
||||
stripe
|
||||
:header-cell-style="{
|
||||
background: '#f5f7fa',
|
||||
color: '#606266',
|
||||
fontWeight: 'bold',
|
||||
textAlign: 'center',
|
||||
padding: '12px 0'
|
||||
}"
|
||||
:cell-style="{
|
||||
<el-table :data="payrollList" style="width: 100%" height="calc(100vh - 280px)" border stripe :header-cell-style="{
|
||||
background: '#f5f7fa',
|
||||
color: '#606266',
|
||||
fontWeight: 'bold',
|
||||
textAlign: 'center',
|
||||
padding: '12px 0'
|
||||
}" :cell-style="{
|
||||
padding: '8px 0'
|
||||
}"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
}" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="头像" width="80" align="center" fixed="left">
|
||||
<template #default="scope">
|
||||
@@ -105,12 +86,14 @@
|
||||
{{ formatMoney(scope.row.grossPaySummary) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="annualPerformanceDeduction" label="年度绩效扣款" width="120" align="right" show-overflow-tooltip>
|
||||
<el-table-column prop="annualPerformanceDeduction" label="年度绩效扣款" width="120" align="right"
|
||||
show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ formatMoney(scope.row.annualPerformanceDeduction) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="monthlyPerformanceDeduction" label="月度绩效扣款" width="120" align="right" show-overflow-tooltip>
|
||||
<el-table-column prop="monthlyPerformanceDeduction" label="月度绩效扣款" width="120" align="right"
|
||||
show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ formatMoney(scope.row.monthlyPerformanceDeduction) }}
|
||||
</template>
|
||||
@@ -130,7 +113,8 @@
|
||||
{{ formatMoney(scope.row.lateEarlyDeduction) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="missedCheckInOutDeduction" label="签到签退扣款" width="120" align="right" show-overflow-tooltip>
|
||||
<el-table-column prop="missedCheckInOutDeduction" label="签到签退扣款" width="120" align="right"
|
||||
show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ formatMoney(scope.row.missedCheckInOutDeduction) }}
|
||||
</template>
|
||||
@@ -155,7 +139,8 @@
|
||||
{{ formatMoney(scope.row.basicPensionDeduction) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="unemploymentInsuranceDeduction" label="失业保险" width="120" align="right" show-overflow-tooltip>
|
||||
<el-table-column prop="unemploymentInsuranceDeduction" label="失业保险" width="120" align="right"
|
||||
show-overflow-tooltip>
|
||||
<template #default="scope">
|
||||
{{ formatMoney(scope.row.unemploymentInsuranceDeduction) }}
|
||||
</template>
|
||||
@@ -197,20 +182,10 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" width="180" fixed="right" align="center">
|
||||
<template #default="scope">
|
||||
<el-button
|
||||
type="primary"
|
||||
link
|
||||
size="small"
|
||||
@click="handleEdit(scope.row)"
|
||||
>
|
||||
<el-button type="primary" link size="small" @click="handleEdit(scope.row)">
|
||||
修改
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
link
|
||||
size="small"
|
||||
@click="handleShowToEmployee(scope.row)"
|
||||
>
|
||||
<el-button type="success" link size="small" @click="handleShowToEmployee(scope.row)">
|
||||
展示给员工
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -218,44 +193,24 @@
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination
|
||||
v-model:current-page="currentPage"
|
||||
v-model:page-size="pageSize"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
@size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange"
|
||||
/>
|
||||
<el-pagination v-model:current-page="currentPage" v-model:page-size="pageSize" :page-sizes="[10, 20, 50, 100]"
|
||||
:total="total" layout="total, sizes, prev, pager, next, jumper" @size-change="handleSizeChange"
|
||||
@current-change="handleCurrentChange" />
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<!-- 修改工资条对话框 -->
|
||||
<div class="edit-payroll-dialog">
|
||||
<el-dialog
|
||||
v-model="editDialogVisible"
|
||||
title="修改工资条"
|
||||
width="900px"
|
||||
>
|
||||
<el-dialog v-model="editDialogVisible" title="修改工资条" width="900px">
|
||||
<div class="edit-form">
|
||||
<el-form
|
||||
ref="editFormRef"
|
||||
:model="editForm"
|
||||
:rules="editRules"
|
||||
label-width="140px"
|
||||
>
|
||||
<el-form ref="editFormRef" :model="editForm" :rules="editRules" label-width="140px">
|
||||
<!-- 仅保留可编辑字段 -->
|
||||
<div class="form-section">
|
||||
<div class="section-title">违纪扣款</div>
|
||||
<div class="form-grid">
|
||||
<el-form-item label="违纪扣款" prop="violationDeduction">
|
||||
<el-input-number
|
||||
v-model="editForm.violationDeduction"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.violationDeduction" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
@@ -263,49 +218,24 @@
|
||||
<div class="section-title">社保公积金</div>
|
||||
<div class="form-grid">
|
||||
<el-form-item label="基本养老保险" prop="basicPensionDeduction">
|
||||
<el-input-number
|
||||
v-model="editForm.basicPensionDeduction"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.basicPensionDeduction" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="失业保险" prop="unemploymentInsuranceDeduction">
|
||||
<el-input-number
|
||||
v-model="editForm.unemploymentInsuranceDeduction"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.unemploymentInsuranceDeduction" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="基本医疗保险" prop="basicMedicalDeduction">
|
||||
<el-input-number
|
||||
v-model="editForm.basicMedicalDeduction"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.basicMedicalDeduction" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="补充医疗保险" prop="medicalDeductionAmount">
|
||||
<el-input-number
|
||||
v-model="editForm.medicalDeductionAmount"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.medicalDeductionAmount" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="住房公积金" prop="housingFundDeduction">
|
||||
<el-input-number
|
||||
v-model="editForm.housingFundDeduction"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.housingFundDeduction" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
@@ -313,22 +243,12 @@
|
||||
<div class="section-title">其他扣款</div>
|
||||
<div class="form-grid">
|
||||
<el-form-item label="个人所得税" prop="individualTaxDeduction">
|
||||
<el-input-number
|
||||
v-model="editForm.individualTaxDeduction"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.individualTaxDeduction" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
<el-form-item label="其他扣款" prop="otherDeduction">
|
||||
<el-input-number
|
||||
v-model="editForm.otherDeduction"
|
||||
:precision="2"
|
||||
:step="100"
|
||||
:min="0"
|
||||
controls-position="right"
|
||||
/>
|
||||
<el-input-number v-model="editForm.otherDeduction" :precision="2" :step="100" :min="0"
|
||||
controls-position="right" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</div>
|
||||
@@ -358,7 +278,7 @@ import {
|
||||
|
||||
// 权限检查
|
||||
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
||||
// if (userInfo.role !== 3) {
|
||||
// if (userInfo.roles !== 3) {
|
||||
// ElMessage.error("您没有权限访问此页面");
|
||||
// window.history.back();
|
||||
// }
|
||||
@@ -854,7 +774,7 @@ onMounted(() => {
|
||||
background-color: #f8fafd;
|
||||
border-radius: 8px;
|
||||
padding: 20px 24px 8px 24px;
|
||||
box-shadow: 0 2px 8px rgba(0,0,0,0.03);
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
|
||||
|
||||
&:last-child {
|
||||
margin-bottom: 0;
|
||||
@@ -879,14 +799,17 @@ onMounted(() => {
|
||||
|
||||
:deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
|
||||
.el-form-item__label {
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
font-size: 15px;
|
||||
}
|
||||
|
||||
.el-input-number {
|
||||
width: 100%;
|
||||
min-width: 120px;
|
||||
|
||||
.el-input__wrapper {
|
||||
padding-right: 40px;
|
||||
}
|
||||
|
||||
@@ -226,10 +226,6 @@ const formatMoney = (value) => {
|
||||
|
||||
// 权限检查
|
||||
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
||||
// if (userInfo.role !== 3) {
|
||||
// ElMessage.error("您没有权限访问此页面");
|
||||
// window.history.back();
|
||||
// }
|
||||
|
||||
// 列表数据
|
||||
const attendanceList = ref([]);
|
||||
|
||||
@@ -278,10 +278,7 @@ import {
|
||||
|
||||
// 权限检查
|
||||
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
||||
// if (userInfo.role !== 2) {
|
||||
// ElMessage.error("您没有权限访问此页面");
|
||||
// window.history.back();
|
||||
// }
|
||||
|
||||
|
||||
// 列表数据
|
||||
const attendanceList = ref([]);
|
||||
|
||||
@@ -133,11 +133,11 @@
|
||||
<el-dialog v-model="performanceDialogVisible" title="修改绩效" width="500px">
|
||||
<el-form ref="performanceFormRef" :model="performanceForm" label-width="100px" :rules="performanceRules">
|
||||
<el-form-item label="年度绩效" prop="annualPerformance">
|
||||
<el-input-number v-model="performanceForm.annualPerformance" :min="0" :max="100" :precision="1" :step="0.5"
|
||||
<el-input-number v-model="performanceForm.annualPerformance" :min="0" :max="100" :precision="2" :step="0.5"
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="月度绩效" prop="monthlyPerformance">
|
||||
<el-input-number v-model="performanceForm.monthlyPerformance" :min="0" :max="100" :precision="1" :step="0.5"
|
||||
<el-input-number v-model="performanceForm.monthlyPerformance" :min="0" :max="100" :precision="2" :step="0.5"
|
||||
style="width: 200px" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
@@ -165,10 +165,7 @@ import {
|
||||
|
||||
// 权限检查
|
||||
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
||||
// if (userInfo.role !== 2) {
|
||||
// ElMessage.error("您没有权限访问此页面");
|
||||
// window.history.back();
|
||||
// }
|
||||
|
||||
|
||||
// 列表数据
|
||||
const attendanceList = ref([]);
|
||||
|
||||
@@ -164,10 +164,7 @@ import {
|
||||
|
||||
// 权限检查
|
||||
const userInfo = JSON.parse(sessionStorage.getItem("userInfo") || "{}");
|
||||
// if (userInfo.role !== 2) {
|
||||
// ElMessage.error("您没有权限访问此页面");
|
||||
// window.history.back();
|
||||
// }
|
||||
|
||||
|
||||
// 列表数据
|
||||
const attendanceList = ref([]);
|
||||
|
||||
Reference in New Issue
Block a user