修改角色为多角色

This commit is contained in:
1147680382@qq.com
2025-06-05 17:23:38 +08:00
parent dd56481b52
commit b57cdf35a2
10 changed files with 153 additions and 203 deletions
+55 -132
View File
@@ -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();
// }
@@ -534,7 +454,7 @@ const handleEdit = (row) => {
// 提交修改
const handleSubmitEdit = async () => {
if (!editFormRef.value) return;
await editFormRef.value.validate(async (valid) => {
if (valid) {
try {
@@ -633,7 +553,7 @@ onMounted(() => {
:deep(.el-table) {
flex: 1;
.el-table__body-wrapper {
height: 100%;
}
@@ -854,8 +774,8 @@ 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;
}
@@ -902,4 +825,4 @@ onMounted(() => {
border-top: 1px solid var(--el-border-color-light);
background-color: var(--el-bg-color);
}
</style>
</style>