添加薪资管理
This commit is contained in:
44
gear-ui3/src/api/oa/reimbursement.js
Normal file
44
gear-ui3/src/api/oa/reimbursement.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询报销列表
|
||||
export function listReimbursement(query) {
|
||||
return request({
|
||||
url: '/oa/reimbursement/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询报销详细
|
||||
export function getReimbursement(reimbursementId) {
|
||||
return request({
|
||||
url: '/oa/reimbursement/' + reimbursementId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增报销
|
||||
export function addReimbursement(data) {
|
||||
return request({
|
||||
url: '/oa/reimbursement',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改报销
|
||||
export function updateReimbursement(data) {
|
||||
return request({
|
||||
url: '/oa/reimbursement',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除报销
|
||||
export function delReimbursement(reimbursementId) {
|
||||
return request({
|
||||
url: '/oa/reimbursement/' + reimbursementId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
53
gear-ui3/src/api/oa/wageEntryDetail.js
Normal file
53
gear-ui3/src/api/oa/wageEntryDetail.js
Normal file
@@ -0,0 +1,53 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询工资录入明细列表
|
||||
export function listWageEntryDetail(query) {
|
||||
return request({
|
||||
url: '/oa/wageEntryDetail/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工资录入明细详细
|
||||
export function getWageEntryDetail(detailId) {
|
||||
return request({
|
||||
url: '/oa/wageEntryDetail/' + detailId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工资录入明细
|
||||
export function addWageEntryDetail(data) {
|
||||
return request({
|
||||
url: '/oa/wageEntryDetail',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工资录入明细
|
||||
export function updateWageEntryDetail(data) {
|
||||
return request({
|
||||
url: '/oa/wageEntryDetail',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工资录入明细
|
||||
export function delWageEntryDetail(detailId) {
|
||||
return request({
|
||||
url: '/oa/wageEntryDetail/' + detailId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 一键初始化当日工人名单
|
||||
export function initDailyWorkers(data) {
|
||||
return request({
|
||||
url: '/oa/wageEntryDetail/initDailyWorkers',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/oa/wageMakeupLog.js
Normal file
44
gear-ui3/src/api/oa/wageMakeupLog.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询工资补录日志列表
|
||||
export function listWageMakeupLog(query) {
|
||||
return request({
|
||||
url: '/oa/wageMakeupLog/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工资补录日志详细
|
||||
export function getWageMakeupLog(logId) {
|
||||
return request({
|
||||
url: '/oa/wageMakeupLog/' + logId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工资补录日志
|
||||
export function addWageMakeupLog(data) {
|
||||
return request({
|
||||
url: '/oa/wageMakeupLog',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工资补录日志
|
||||
export function updateWageMakeupLog(data) {
|
||||
return request({
|
||||
url: '/oa/wageMakeupLog',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工资补录日志
|
||||
export function delWageMakeupLog(logId) {
|
||||
return request({
|
||||
url: '/oa/wageMakeupLog/' + logId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
44
gear-ui3/src/api/oa/wageRateConfig.js
Normal file
44
gear-ui3/src/api/oa/wageRateConfig.js
Normal file
@@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询工资费率配置列表
|
||||
export function listWageRateConfig(query) {
|
||||
return request({
|
||||
url: '/oa/wageRateConfig/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工资费率配置详细
|
||||
export function getWageRateConfig(rateId) {
|
||||
return request({
|
||||
url: '/oa/wageRateConfig/' + rateId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工资费率配置
|
||||
export function addWageRateConfig(data) {
|
||||
return request({
|
||||
url: '/oa/wageRateConfig',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工资费率配置
|
||||
export function updateWageRateConfig(data) {
|
||||
return request({
|
||||
url: '/oa/wageRateConfig',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工资费率配置
|
||||
export function delWageRateConfig(rateId) {
|
||||
return request({
|
||||
url: '/oa/wageRateConfig/' + rateId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
65
gear-ui3/src/api/oa/worker.js
Normal file
65
gear-ui3/src/api/oa/worker.js
Normal file
@@ -0,0 +1,65 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询工人列表
|
||||
export function listWorker(query) {
|
||||
return request({
|
||||
url: '/oa/worker/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询工人详细
|
||||
export function getWorker(workerId) {
|
||||
return request({
|
||||
url: '/oa/worker/' + workerId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工人
|
||||
export function addWorker(data) {
|
||||
return request({
|
||||
url: '/oa/worker',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改工人
|
||||
export function updateWorker(data) {
|
||||
return request({
|
||||
url: '/oa/worker',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工人
|
||||
export function delWorker(workerId) {
|
||||
return request({
|
||||
url: '/oa/worker/' + workerId,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
// 下载导入模板
|
||||
export function importTemplateWorker() {
|
||||
return request({
|
||||
url: '/oa/worker/importTemplate',
|
||||
method: 'get',
|
||||
responseType: 'blob'
|
||||
})
|
||||
}
|
||||
|
||||
// 导入工人
|
||||
export function importWorkerData(data) {
|
||||
return request({
|
||||
url: '/oa/worker/importData',
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data'
|
||||
},
|
||||
data
|
||||
})
|
||||
}
|
||||
BIN
gear-ui3/src/assets/images/index.jpg
Normal file
BIN
gear-ui3/src/assets/images/index.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 332 KiB |
@@ -17,14 +17,14 @@
|
||||
<!-- 上传按钮 -->
|
||||
<el-button size="mini" type="primary">选取文件</el-button>
|
||||
<!-- 上传提示 -->
|
||||
<div class="el-upload__tip" slot="tip" v-if="showTip">
|
||||
|
||||
</el-upload>
|
||||
<div class="el-upload__tip" slot="tip" v-if="showTip">
|
||||
请上传
|
||||
<template v-if="fileSize"> 大小不超过 <b style="color: #f56c6c">{{ fileSize }}MB</b> </template>
|
||||
<template v-if="fileType"> 格式为 <b style="color: #f56c6c">{{ fileType.join("/") }}</b> </template>
|
||||
的文件
|
||||
</div>
|
||||
</el-upload>
|
||||
|
||||
<!-- 文件列表 -->
|
||||
<transition-group class="upload-file-list el-upload-list el-upload-list--text" name="el-fade-in-linear" tag="ul">
|
||||
<li :key="file.url" class="el-upload-list__item ele-upload-list__item-content" v-for="(file, index) in fileList">
|
||||
|
||||
@@ -1,289 +1,11 @@
|
||||
<template>
|
||||
<div class="dashboard-root">
|
||||
<!-- 第一行:头像+欢迎语 -->
|
||||
<UserGreeting />
|
||||
|
||||
<Statistic />
|
||||
|
||||
<!-- 全部应用 -->
|
||||
<AllApplications @addFavorites="handleAddFavorites" />
|
||||
</div>
|
||||
<div class="home-full-bg"></div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import AllApplications from '@/components/AllApplications.vue';
|
||||
import UserGreeting from '@/views/components/Hello.vue';
|
||||
import Statistic from '@/views/components/Statistic.vue';
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dashboard-root {
|
||||
min-height: 100vh;
|
||||
/* background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%); */
|
||||
padding: 32px;
|
||||
.home-full-bg {
|
||||
width: 100%;
|
||||
height: 90vh;
|
||||
background: url('@/assets/images/index.jpg') center center / 100% 100% no-repeat;
|
||||
}
|
||||
|
||||
/* 业务功能区标题栏 */
|
||||
.business-area-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.business-area-title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
padding: 6px 12px;
|
||||
background: #f3f4f6;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
color: #6b7280;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.edit-btn:hover {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
/* 业务功能区样式 */
|
||||
.business-modules {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
gap: 24px;
|
||||
margin-bottom: 32px;
|
||||
}
|
||||
|
||||
.business-module {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
border-radius: 12px;
|
||||
background: #fff;
|
||||
box-shadow: 0 2px 12px 0 rgba(0,0,0,0.05);
|
||||
transition: all 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.business-module:hover {
|
||||
box-shadow: 0 4px 16px 0 rgba(0,0,0,0.1);
|
||||
transform: translateY(-2px);
|
||||
}
|
||||
|
||||
.business-module-icon {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
margin-right: 12px;
|
||||
background: #3b82f6; /* 默认图标背景色 */
|
||||
}
|
||||
|
||||
.business-module-icon i {
|
||||
font-size: 20px;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.business-module-title {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #303133;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* 弹窗样式 */
|
||||
.dialog-mask {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.setting-dialog {
|
||||
width: 500px;
|
||||
background: #fff;
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
.dialog-header {
|
||||
padding: 16px 24px;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.dialog-header h3 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.close-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
color: #999;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.close-btn:hover {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.dialog-content {
|
||||
padding: 24px;
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.module-list {
|
||||
list-style: none;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.module-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 12px 0;
|
||||
border-bottom: 1px solid #f5f5f5;
|
||||
}
|
||||
|
||||
.module-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.module-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.module-index {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 50%;
|
||||
background: #f3f4f6;
|
||||
color: #6b7280;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.module-name {
|
||||
font-size: 16px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.module-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.action-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
border-radius: 6px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.move-btn {
|
||||
color: #9ca3af;
|
||||
background: #f9fafb;
|
||||
}
|
||||
|
||||
.move-btn:hover {
|
||||
background: #f3f4f6;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.move-btn:disabled {
|
||||
opacity: 0.5;
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.delete-btn {
|
||||
color: #ef4444;
|
||||
background: #fee2e2;
|
||||
}
|
||||
|
||||
.delete-btn:hover {
|
||||
background: #fecaca;
|
||||
}
|
||||
|
||||
.empty-tip {
|
||||
text-align: center;
|
||||
padding: 40px 0;
|
||||
color: #9ca3af;
|
||||
font-size: 14px;
|
||||
background: #f9fafb;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.dialog-footer {
|
||||
padding: 16px 24px;
|
||||
border-top: 1px solid #f0f0f0;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.cancel-btn, .confirm-btn {
|
||||
padding: 8px 16px;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
transition: all 0.2s;
|
||||
}
|
||||
|
||||
.cancel-btn {
|
||||
background: #f3f4f6;
|
||||
border: none;
|
||||
color: #6b7280;
|
||||
}
|
||||
|
||||
.cancel-btn:hover {
|
||||
background: #e5e7eb;
|
||||
color: #374151;
|
||||
}
|
||||
|
||||
.confirm-btn {
|
||||
background: #3b82f6;
|
||||
border: none;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.confirm-btn:hover {
|
||||
background: #2563eb;
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
322
gear-ui3/src/views/oms/reimbursement/index.vue
Normal file
322
gear-ui3/src/views/oms/reimbursement/index.vue
Normal file
@@ -0,0 +1,322 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item label="申请人" prop="applicantName">
|
||||
<el-input v-model="queryParams.applicantName" placeholder="请输入申请人" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="报销状态" prop="reimburseStatus">
|
||||
<el-select v-model="queryParams.reimburseStatus" placeholder="请选择状态" clearable style="width: 180px">
|
||||
<el-option label="未报销" value="0" />
|
||||
<el-option label="已报销" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="reimbursementList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="申请人" align="center" prop="applicantName" width="120" />
|
||||
<el-table-column label="附件" align="left" min-width="260">
|
||||
<template #default="scope">
|
||||
<div v-if="scope.row._attachmentFiles?.length" class="attachment-list">
|
||||
<el-link
|
||||
v-for="file in scope.row._attachmentFiles"
|
||||
:key="file.ossId"
|
||||
:href="file.url"
|
||||
target="_blank"
|
||||
type="primary"
|
||||
:underline="false"
|
||||
class="attachment-link"
|
||||
>
|
||||
{{ file.originalName || file.fileName || `附件-${file.ossId}` }}
|
||||
</el-link>
|
||||
</div>
|
||||
<span v-else class="text-muted">无附件</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="上传时间" align="center" prop="uploadTime" width="180">
|
||||
<template #default="scope">
|
||||
<span>{{ proxy.parseTime(scope.row.uploadTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="金额" align="center" prop="amount" width="120" />
|
||||
<el-table-column label="状态" align="center" width="180">
|
||||
<template #default="scope">
|
||||
<el-switch
|
||||
:model-value="scope.row.reimburseStatus === '1'"
|
||||
active-text="已报销"
|
||||
inactive-text="未报销"
|
||||
inline-prompt
|
||||
@change="(val) => handleQuickStatusChange(scope.row, val)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog :title="title" v-model="open" width="680px" append-to-body>
|
||||
<el-form ref="reimbursementRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="附件" prop="attachmentUrl">
|
||||
<div class="upload-wrap">
|
||||
<file-upload v-model="form.attachmentUrl" :limit="3" />
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="上传时间" prop="uploadTime">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.uploadTime"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择上传时间"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="金额" prop="amount">
|
||||
<el-input v-model="form.amount" placeholder="请输入金额" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Reimbursement">
|
||||
import { listReimbursement, getReimbursement, delReimbursement, addReimbursement, updateReimbursement } from '@/api/oa/reimbursement'
|
||||
import { listByIds } from '@/api/system/oss'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const reimbursementList = ref([])
|
||||
const open = ref(false)
|
||||
const buttonLoading = ref(false)
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref('')
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
applicantName: undefined,
|
||||
reimburseStatus: undefined
|
||||
},
|
||||
rules: {
|
||||
uploadTime: [{ required: true, message: '上传时间不能为空', trigger: 'change' }],
|
||||
amount: [{ required: true, message: '金额不能为空', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
async function hydrateAttachmentFiles(list) {
|
||||
const idSet = new Set()
|
||||
list.forEach(row => {
|
||||
const ids = (row.attachmentUrl || '').split(',').map(i => i.trim()).filter(Boolean)
|
||||
ids.forEach(id => idSet.add(id))
|
||||
})
|
||||
if (!idSet.size) {
|
||||
reimbursementList.value = list.map(row => ({ ...row, _attachmentFiles: [] }))
|
||||
return
|
||||
}
|
||||
const idStr = Array.from(idSet).join(',')
|
||||
const res = await listByIds(idStr)
|
||||
const files = res?.data || []
|
||||
const fileMap = new Map(files.map(f => [String(f.ossId), f]))
|
||||
reimbursementList.value = list.map(row => {
|
||||
const ids = (row.attachmentUrl || '').split(',').map(i => i.trim()).filter(Boolean)
|
||||
const attachmentFiles = ids.map(id => fileMap.get(id)).filter(Boolean)
|
||||
return { ...row, _attachmentFiles: attachmentFiles }
|
||||
})
|
||||
}
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listReimbursement(queryParams.value).then(async response => {
|
||||
total.value = response.total
|
||||
await hydrateAttachmentFiles(response.rows || [])
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
function reset() {
|
||||
form.value = {
|
||||
reimbursementId: null,
|
||||
attachmentUrl: null,
|
||||
uploadTime: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
|
||||
amount: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm('reimbursementRef')
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.reimbursementId)
|
||||
single.value = selection.length !== 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = '添加报销'
|
||||
}
|
||||
|
||||
function handleUpdate(row) {
|
||||
loading.value = true
|
||||
reset()
|
||||
const _reimbursementId = row.reimbursementId || ids.value
|
||||
getReimbursement(_reimbursementId).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = '修改报销'
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
proxy.$refs.reimbursementRef.validate(valid => {
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
buttonLoading.value = true
|
||||
const req = form.value.reimbursementId != null ? updateReimbursement(form.value) : addReimbursement(form.value)
|
||||
req.then(() => {
|
||||
proxy.$modal.msgSuccess(form.value.reimbursementId != null ? '修改成功' : '新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleQuickStatusChange(row, val) {
|
||||
const oldStatus = row.reimburseStatus
|
||||
const targetStatus = val ? '1' : '0'
|
||||
const statusText = targetStatus === '1' ? '已报销' : '未报销'
|
||||
|
||||
proxy.$modal.confirm(`确认将状态改为${statusText}吗?`).then(() => {
|
||||
const payload = {
|
||||
...row,
|
||||
reimburseStatus: targetStatus
|
||||
}
|
||||
return updateReimbursement(payload)
|
||||
}).then(() => {
|
||||
row.reimburseStatus = targetStatus
|
||||
proxy.$modal.msgSuccess('状态更新成功')
|
||||
}).catch(() => {
|
||||
row.reimburseStatus = oldStatus
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
const _reimbursementIds = row.reimbursementId || ids.value
|
||||
proxy.$modal.confirm('是否确认删除报销编号为"' + _reimbursementIds + '"的数据项?').then(function () {
|
||||
loading.value = true
|
||||
return delReimbursement(_reimbursementIds)
|
||||
}).then(() => {
|
||||
getList()
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('oa/reimbursement/export', {
|
||||
...queryParams.value
|
||||
}, `reimbursement_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.upload-wrap {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.upload-tip {
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.attachment-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
gap: 4px;
|
||||
}
|
||||
|
||||
.attachment-link {
|
||||
max-width: 240px;
|
||||
}
|
||||
|
||||
.text-muted {
|
||||
color: #909399;
|
||||
}
|
||||
</style>
|
||||
275
gear-ui3/src/views/oms/wageEntryDetail/index.vue
Normal file
275
gear-ui3/src/views/oms/wageEntryDetail/index.vue
Normal file
@@ -0,0 +1,275 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-form-item label="员工姓名" prop="empName">
|
||||
<el-input v-model="queryParams.empName" placeholder="请输入员工姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计费类型" prop="billingType">
|
||||
<el-select v-model="queryParams.billingType" placeholder="请选择计费类型" clearable style="width: 180px">
|
||||
<el-option label="小时工" value="1" />
|
||||
<el-option label="计件工" value="2" />
|
||||
<el-option label="天工" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-alert type="info" :closable="false" show-icon style="margin-bottom: 10px">
|
||||
小时工/天工:工作量表示工作时间;计件工:工作量表示加工数量。仅计件工可录入单价。
|
||||
</el-alert>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="2.5">
|
||||
<el-button size="small" type="info" plain icon="RefreshRight" @click="handleInitDaily(true)">重置当日名单</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.8">
|
||||
<el-button size="small" type="primary" plain icon="Check" @click="saveAllRows">全部保存</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="wageEntryDetailList">
|
||||
<el-table-column label="业务日期" align="center" prop="entryDate" width="120" />
|
||||
<el-table-column label="员工姓名" align="center" prop="empName" width="120" />
|
||||
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
|
||||
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工种" align="center" prop="workTypeName" min-width="140" />
|
||||
|
||||
<el-table-column label="工作时间/加工数量" align="center" min-width="170">
|
||||
<template #default="scope">
|
||||
<el-input
|
||||
v-model="scope.row.workload"
|
||||
:placeholder="workloadPlaceholder(scope.row.billingType)"
|
||||
@input="recalcRowAmount(scope.row)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="单价" align="center" min-width="150">
|
||||
<template #default="scope">
|
||||
<el-input v-if="scope.row.billingType === '2'" v-model="scope.row.unitPrice" placeholder="多少钱/件" @input="recalcRowAmount(scope.row)" />
|
||||
<span v-else>{{ formatUnitPrice(scope.row) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="奖惩金额" align="center" min-width="130">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.extraAmount" placeholder="奖惩金额(负数为惩罚)" @input="recalcRowAmount(scope.row)" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="奖惩原因" align="center" min-width="180">
|
||||
<template #default="scope">
|
||||
<el-input v-model="scope.row.extraReason" placeholder="奖惩原因" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
<el-table-column label="总金额" align="center" prop="totalAmount" width="110" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="170">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Check" @click="saveRow(scope.row)">保存</el-button>
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="WageEntryDetail">
|
||||
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail, initDailyWorkers } from '@/api/oa/wageEntryDetail'
|
||||
import { ElMessage } from 'element-plus'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const wageEntryDetailList = ref([])
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const total = ref(0)
|
||||
|
||||
const data = reactive({
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 100,
|
||||
entryDate: proxy.parseTime(new Date(), '{y}-{m}-{d}'),
|
||||
empName: undefined,
|
||||
billingType: undefined,
|
||||
isMakeup: '0'
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams } = toRefs(data)
|
||||
|
||||
function formatBillingType(type) {
|
||||
if (type === '1') return '小时工'
|
||||
if (type === '2') return '计件工'
|
||||
if (type === '3') return '天工'
|
||||
return '-'
|
||||
}
|
||||
|
||||
function workloadPlaceholder(type) {
|
||||
return type === '2' ? '加工数量' : '工作时间'
|
||||
}
|
||||
|
||||
function formatUnitPrice(row) {
|
||||
const price = row?.unitPrice ?? ''
|
||||
if (row?.billingType === '1') return `${price || 0}元/小时`
|
||||
if (row?.billingType === '2') return `${price || 0}元/件`
|
||||
if (row?.billingType === '3') return `${price || 0}元/天`
|
||||
return '-'
|
||||
}
|
||||
|
||||
function normalizeEditableValue(v) {
|
||||
if (v === null || v === undefined) return ''
|
||||
if (String(v) === '0' || String(v) === '0.00') return ''
|
||||
return v
|
||||
}
|
||||
|
||||
function toNumber(v) {
|
||||
const n = Number(v)
|
||||
return Number.isFinite(n) ? n : 0
|
||||
}
|
||||
|
||||
function round2(v) {
|
||||
return Math.round(v * 100) / 100
|
||||
}
|
||||
|
||||
function recalcRowAmount(row) {
|
||||
const workload = toNumber(row.workload)
|
||||
const unitPrice = row.billingType === '2' ? toNumber(row.unitPrice) : toNumber(row.unitPrice)
|
||||
const extraAmount = toNumber(row.extraAmount)
|
||||
const baseAmount = round2(workload * unitPrice)
|
||||
row.baseAmount = baseAmount
|
||||
row.totalAmount = round2(baseAmount + extraAmount)
|
||||
}
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listWageEntryDetail(queryParams.value).then(response => {
|
||||
const rows = response.rows || []
|
||||
wageEntryDetailList.value = rows.map(row => {
|
||||
const r = {
|
||||
...row,
|
||||
workload: normalizeEditableValue(row.workload),
|
||||
unitPrice: normalizeEditableValue(row.unitPrice),
|
||||
extraAmount: normalizeEditableValue(row.extraAmount)
|
||||
}
|
||||
recalcRowAmount(r)
|
||||
return r
|
||||
})
|
||||
total.value = response.total || 0
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
queryParams.value.entryDate = proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||
queryParams.value.isMakeup = '0'
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
function buildRowPayload(row) {
|
||||
const payload = { ...row }
|
||||
if (payload.workload === '' || payload.workload === null || payload.workload === undefined) {
|
||||
payload.workload = 0
|
||||
}
|
||||
if (payload.extraAmount === '' || payload.extraAmount === null || payload.extraAmount === undefined) {
|
||||
payload.extraAmount = 0
|
||||
}
|
||||
if (payload.billingType !== '2') {
|
||||
payload.unitPrice = null
|
||||
} else if (payload.unitPrice === '' || payload.unitPrice === null || payload.unitPrice === undefined) {
|
||||
payload.unitPrice = 0
|
||||
}
|
||||
return payload
|
||||
}
|
||||
|
||||
function saveRow(row) {
|
||||
const payload = buildRowPayload(row)
|
||||
updateWageEntryDetail(payload).then(() => {
|
||||
proxy.$modal.msgSuccess('保存成功')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
async function saveAllRows() {
|
||||
if (!wageEntryDetailList.value.length) {
|
||||
proxy.$modal.msgInfo('暂无可保存的数据')
|
||||
return
|
||||
}
|
||||
loading.value = true
|
||||
let successCount = 0
|
||||
let failCount = 0
|
||||
for (const row of wageEntryDetailList.value) {
|
||||
const payload = buildRowPayload(row)
|
||||
try {
|
||||
await updateWageEntryDetail(payload)
|
||||
successCount++
|
||||
} catch (e) {
|
||||
failCount++
|
||||
}
|
||||
}
|
||||
loading.value = false
|
||||
if (failCount === 0) {
|
||||
proxy.$modal.msgSuccess(`全部保存完成,共 ${successCount} 条`)
|
||||
} else {
|
||||
ElMessage.warning(`保存完成:成功 ${successCount} 条,失败 ${failCount} 条`)
|
||||
}
|
||||
getList()
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
const detailId = row?.detailId
|
||||
if (!detailId) return
|
||||
proxy.$modal.confirm('是否确认删除该工资录入记录?').then(() => delWageEntryDetail(detailId)).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('oa/wageEntryDetail/export', {
|
||||
...queryParams.value
|
||||
}, `wage_entry_detail_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
function handleInitDaily(forceReset = false) {
|
||||
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||
const text = forceReset ? `确认重置 ${entryDate} 的当日名单吗?将先删除后重建。` : `确认初始化 ${entryDate} 的工人名单吗?`
|
||||
proxy.$modal.confirm(text).then(() => {
|
||||
return initDailyWorkers({ entryDate, forceReset })
|
||||
}).then(res => {
|
||||
if (!forceReset && Number(res.data || 0) === 0) {
|
||||
proxy.$modal.msgInfo('当日名单已存在,未重复初始化')
|
||||
} else {
|
||||
proxy.$modal.msgSuccess(`操作成功,共写入 ${res.data || 0} 人`)
|
||||
}
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
async function autoInitFirstEnter() {
|
||||
const entryDate = queryParams.value.entryDate || proxy.parseTime(new Date(), '{y}-{m}-{d}')
|
||||
await initDailyWorkers({ entryDate, forceReset: false })
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await autoInitFirstEnter()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
233
gear-ui3/src/views/oms/wageMakeup/index.vue
Normal file
233
gear-ui3/src/views/oms/wageMakeup/index.vue
Normal file
@@ -0,0 +1,233 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-alert type="warning" :closable="false" show-icon style="margin-bottom: 10px">
|
||||
本页面可查看所有工资录入数据;点击“补录”后将该记录标记为已补录(isMakeup=1)。
|
||||
</el-alert>
|
||||
|
||||
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-form-item label="业务日期" prop="entryDate">
|
||||
<el-date-picker clearable v-model="queryParams.entryDate" type="date" value-format="YYYY-MM-DD" placeholder="请选择业务日期" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工姓名" prop="empName">
|
||||
<el-input v-model="queryParams.empName" placeholder="请输入员工姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="查看范围" prop="makeupView">
|
||||
<el-select v-model="queryParams.makeupView" placeholder="请选择查看范围" style="width: 150px" @change="handleQuery">
|
||||
<el-option label="全部查看" value="all" />
|
||||
<el-option label="仅看补录" value="onlyMakeup" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="list">
|
||||
<el-table-column label="业务日期" align="center" prop="entryDate" width="120" />
|
||||
<el-table-column label="员工姓名" align="center" prop="empName" width="120" />
|
||||
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
|
||||
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工种" align="center" prop="workTypeName" min-width="140" />
|
||||
<el-table-column label="工作时间/加工数量" align="center" prop="workload" width="140" />
|
||||
<el-table-column label="单价" align="center" prop="unitPrice" width="110" />
|
||||
<el-table-column label="奖惩金额" align="center" prop="extraAmount" width="130" />
|
||||
<el-table-column label="奖惩原因" align="center" prop="extraReason" min-width="160" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="补录状态" align="center" prop="isMakeup" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.isMakeup === '1' ? 'warning' : 'info'">{{ scope.row.isMakeup === '1' ? '已补录' : '未补录' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="补录责任人" align="center" prop="makeupResponsible" width="120" />
|
||||
<el-table-column label="补录原因" align="center" prop="makeupReason" min-width="180" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" width="220">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleMakeup(scope.row)">补录</el-button>
|
||||
<el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<el-dialog :title="title" v-model="open" width="640px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="110px">
|
||||
<el-form-item label="业务日期" prop="entryDate">
|
||||
<el-date-picker clearable v-model="form.entryDate" type="date" value-format="YYYY-MM-DD" style="width: 100%" />
|
||||
</el-form-item>
|
||||
<el-form-item label="员工姓名" prop="empName"><el-input v-model="form.empName" /></el-form-item>
|
||||
<el-form-item label="计费类型" prop="billingType">
|
||||
<el-select v-model="form.billingType" style="width: 100%">
|
||||
<el-option label="小时工" value="1" />
|
||||
<el-option label="计件工" value="2" />
|
||||
<el-option label="天工" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="工种" prop="workTypeName"><el-input v-model="form.workTypeName" /></el-form-item>
|
||||
<el-form-item :label="form.billingType === '2' ? '加工数量' : '工作时间'" prop="workload"><el-input v-model="form.workload" /></el-form-item>
|
||||
<el-form-item label="单价" prop="unitPrice" v-if="form.billingType === '2'"><el-input v-model="form.unitPrice" placeholder="元/件" /></el-form-item>
|
||||
<el-form-item label="奖惩金额" prop="extraAmount"><el-input v-model="form.extraAmount" placeholder="负数为惩罚金额" /></el-form-item>
|
||||
<el-form-item label="奖惩原因" prop="extraReason"><el-input v-model="form.extraReason" placeholder="请输入奖惩原因" /></el-form-item>
|
||||
<el-form-item label="补录原因" prop="makeupReason"><el-input type="textarea" v-model="form.makeupReason" /></el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="open = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="WageMakeup">
|
||||
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail } from '@/api/oa/wageEntryDetail'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
const list = ref([])
|
||||
const loading = ref(true)
|
||||
const total = ref(0)
|
||||
const showSearch = ref(true)
|
||||
const open = ref(false)
|
||||
const title = ref('')
|
||||
const buttonLoading = ref(false)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 50,
|
||||
entryDate: undefined,
|
||||
empName: undefined,
|
||||
makeupView: 'all'
|
||||
},
|
||||
rules: {
|
||||
entryDate: [{ required: true, message: '业务日期不能为空', trigger: 'change' }],
|
||||
empId: [{ required: true, message: '员工ID不能为空', trigger: 'blur' }],
|
||||
billingType: [{ required: true, message: '计费类型不能为空', trigger: 'change' }],
|
||||
rateId: [{ required: true, message: '费率ID不能为空', trigger: 'blur' }],
|
||||
workload: [{ required: true, message: '工作量不能为空', trigger: 'blur' }],
|
||||
makeupReason: [{ required: true, message: '补录原因不能为空', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
function formatBillingType(type) {
|
||||
if (type === '1') return '小时工'
|
||||
if (type === '2') return '计件工'
|
||||
if (type === '3') return '天工'
|
||||
return '-'
|
||||
}
|
||||
|
||||
function buildQuery() {
|
||||
const q = {
|
||||
pageNum: queryParams.value.pageNum,
|
||||
pageSize: queryParams.value.pageSize,
|
||||
entryDate: queryParams.value.entryDate,
|
||||
empName: queryParams.value.empName
|
||||
}
|
||||
if (queryParams.value.makeupView === 'onlyMakeup') {
|
||||
q.isMakeup = '1'
|
||||
}
|
||||
return q
|
||||
}
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listWageEntryDetail(buildQuery()).then(res => {
|
||||
list.value = res.rows || []
|
||||
total.value = res.total || 0
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function resetForm() {
|
||||
form.value = {
|
||||
detailId: null,
|
||||
sourceDetailId: null,
|
||||
entryDate: null,
|
||||
empId: null,
|
||||
empName: null,
|
||||
billingType: '1',
|
||||
rateId: null,
|
||||
workTypeName: null,
|
||||
workload: null,
|
||||
unitPrice: null,
|
||||
extraAmount: 0,
|
||||
extraReason: null,
|
||||
isMakeup: '1',
|
||||
makeupResponsibleId: userStore.id || null,
|
||||
makeupResponsible: userStore.nickName || null,
|
||||
makeupReason: null
|
||||
}
|
||||
}
|
||||
|
||||
function handleMakeup(row) {
|
||||
form.value = {
|
||||
...row,
|
||||
sourceDetailId: row.detailId,
|
||||
isMakeup: '1',
|
||||
makeupResponsibleId: userStore.id || row.makeupResponsibleId || null,
|
||||
makeupResponsible: userStore.nickName || row.makeupResponsible || null,
|
||||
makeupReason: row.makeupReason || null
|
||||
}
|
||||
title.value = '补录 补录负责人:'+form.value.makeupResponsible
|
||||
open.value = true
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
proxy.$refs.formRef.validate(valid => {
|
||||
if (!valid) return
|
||||
buttonLoading.value = true
|
||||
const payload = {
|
||||
...form.value,
|
||||
isMakeup: '1'
|
||||
}
|
||||
// 本页面补录语义:更新当前记录并标记为已补录
|
||||
updateWageEntryDetail(payload).then(() => {
|
||||
proxy.$modal.msgSuccess('补录成功')
|
||||
open.value = false
|
||||
getList()
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
proxy.$modal.confirm('确认删除该记录吗?').then(() => delWageEntryDetail(row.detailId)).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
queryParams.value.entryDate = undefined
|
||||
queryParams.value.makeupView = 'all'
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('oa/wageEntryDetail/export', { ...buildQuery() }, `wage_makeup_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
268
gear-ui3/src/views/oms/wageMakeupLog/index.vue
Normal file
268
gear-ui3/src/views/oms/wageMakeupLog/index.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-form-item label="目标日期" prop="operationDate">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="queryParams.operationDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择目标日期"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作类型" prop="operationType">
|
||||
<el-select v-model="queryParams.operationType" placeholder="请选择操作类型" clearable style="width: 180px">
|
||||
<el-option label="新增补录" value="1" />
|
||||
<el-option label="修改补录" value="2" />
|
||||
<el-option label="撤销补录" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="责任人" prop="makeupResponsible">
|
||||
<el-input v-model="queryParams.makeupResponsible" placeholder="请输入责任人" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="wageMakeupLogList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="日志ID" align="center" prop="logId" width="90" />
|
||||
<el-table-column label="目标日期" align="center" prop="operationDate" width="120" />
|
||||
<el-table-column label="员工ID" align="center" prop="empId" width="100" />
|
||||
<el-table-column label="操作类型" align="center" prop="operationType" width="110">
|
||||
<template #default="scope">{{ formatOperationType(scope.row.operationType) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="明细ID" align="center" prop="detailId" width="100" />
|
||||
<el-table-column label="原始明细ID" align="center" prop="sourceDetailId" width="110" />
|
||||
<el-table-column label="责任人" align="center" prop="makeupResponsible" width="120" />
|
||||
<el-table-column label="补录原因" align="center" prop="makeupReason" min-width="220" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" min-width="160">
|
||||
<template #default="scope">
|
||||
<span>{{ proxy.parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog :title="title" v-model="open" width="620px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="目标日期" prop="operationDate">
|
||||
<el-date-picker
|
||||
clearable
|
||||
v-model="form.operationDate"
|
||||
type="date"
|
||||
value-format="YYYY-MM-DD"
|
||||
placeholder="请选择目标日期"
|
||||
style="width: 100%"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="操作类型" prop="operationType">
|
||||
<el-select v-model="form.operationType" placeholder="请选择操作类型" style="width: 100%">
|
||||
<el-option label="新增补录" value="1" />
|
||||
<el-option label="修改补录" value="2" />
|
||||
<el-option label="撤销补录" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="员工ID" prop="empId">
|
||||
<el-input v-model="form.empId" placeholder="请输入员工ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="明细ID" prop="detailId">
|
||||
<el-input v-model="form.detailId" placeholder="请输入明细ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="原始明细ID" prop="sourceDetailId">
|
||||
<el-input v-model="form.sourceDetailId" placeholder="请输入原始明细ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="责任人ID" prop="makeupResponsibleId">
|
||||
<el-input v-model="form.makeupResponsibleId" placeholder="请输入责任人ID" />
|
||||
</el-form-item>
|
||||
<el-form-item label="责任人" prop="makeupResponsible">
|
||||
<el-input v-model="form.makeupResponsible" placeholder="请输入责任人姓名" />
|
||||
</el-form-item>
|
||||
<el-form-item label="补录原因" prop="makeupReason">
|
||||
<el-input v-model="form.makeupReason" type="textarea" placeholder="请输入补录原因" />
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="WageMakeupLog">
|
||||
import { listWageMakeupLog, getWageMakeupLog, addWageMakeupLog, updateWageMakeupLog, delWageMakeupLog } from '@/api/oa/wageMakeupLog'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const wageMakeupLogList = ref([])
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const total = ref(0)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const open = ref(false)
|
||||
const title = ref('')
|
||||
const buttonLoading = ref(false)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
operationDate: undefined,
|
||||
operationType: undefined,
|
||||
makeupResponsible: undefined
|
||||
},
|
||||
rules: {
|
||||
operationDate: [{ required: true, message: '目标日期不能为空', trigger: 'change' }],
|
||||
operationType: [{ required: true, message: '操作类型不能为空', trigger: 'change' }],
|
||||
empId: [{ required: true, message: '员工ID不能为空', trigger: 'blur' }],
|
||||
detailId: [{ required: true, message: '明细ID不能为空', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
function formatOperationType(type) {
|
||||
if (type === '1') return '新增补录'
|
||||
if (type === '2') return '修改补录'
|
||||
if (type === '3') return '撤销补录'
|
||||
return '-'
|
||||
}
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listWageMakeupLog(queryParams.value).then(response => {
|
||||
wageMakeupLogList.value = response.rows || []
|
||||
total.value = response.total || 0
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function reset() {
|
||||
form.value = {
|
||||
logId: null,
|
||||
operationDate: null,
|
||||
operationType: '1',
|
||||
empId: null,
|
||||
detailId: null,
|
||||
sourceDetailId: null,
|
||||
makeupResponsibleId: null,
|
||||
makeupResponsible: null,
|
||||
makeupReason: null,
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm('formRef')
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.logId)
|
||||
single.value = selection.length !== 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = '新增工资补录日志'
|
||||
}
|
||||
|
||||
function handleUpdate(row) {
|
||||
const logId = row?.logId || ids.value[0]
|
||||
if (!logId) return
|
||||
reset()
|
||||
getWageMakeupLog(logId).then(response => {
|
||||
form.value = response.data
|
||||
open.value = true
|
||||
title.value = '修改工资补录日志'
|
||||
})
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
proxy.$refs.formRef.validate(valid => {
|
||||
if (!valid) return
|
||||
buttonLoading.value = true
|
||||
const req = form.value.logId ? updateWageMakeupLog(form.value) : addWageMakeupLog(form.value)
|
||||
req.then(() => {
|
||||
proxy.$modal.msgSuccess(form.value.logId ? '修改成功' : '新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
const logIds = row?.logId || ids.value
|
||||
if (!logIds || (Array.isArray(logIds) && !logIds.length)) return
|
||||
proxy.$modal.confirm('是否确认删除工资补录日志数据项?').then(() => {
|
||||
return delWageMakeupLog(logIds)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('oa/wageMakeupLog/export', {
|
||||
...queryParams.value
|
||||
}, `wage_makeup_log_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
268
gear-ui3/src/views/oms/wageRateConfig/index.vue
Normal file
268
gear-ui3/src/views/oms/wageRateConfig/index.vue
Normal file
@@ -0,0 +1,268 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="90px">
|
||||
<el-form-item label="工名" prop="rateName">
|
||||
<el-input v-model="queryParams.rateName" placeholder="请输入工名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计费类型" prop="billingType">
|
||||
<el-select v-model="queryParams.billingType" placeholder="请选择计费类型" clearable style="width: 180px">
|
||||
<el-option label="小时工" value="1" />
|
||||
<el-option label="计件工" value="2" />
|
||||
<el-option label="天工" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="wageRateConfigList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="工名" align="center" prop="rateName" />
|
||||
<el-table-column label="计费类型" align="center" prop="billingType" width="100">
|
||||
<template #default="scope">{{ formatBillingType(scope.row.billingType) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="单价" align="center" prop="unitPrice" width="120">
|
||||
<template #default="scope">
|
||||
<span>{{ scope.row.unitPrice }} {{ unitText(scope.row.billingType) }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.status === '0' ? 'success' : 'info'">{{ scope.row.status === '0' ? '启用' : '停用' }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<el-dialog :title="title" v-model="open" width="620px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="工名" prop="rateName">
|
||||
<el-input v-model="form.rateName" placeholder="例如:打包工/木工" />
|
||||
</el-form-item>
|
||||
<el-form-item label="计费类型" prop="billingType">
|
||||
<el-select v-model="form.billingType" placeholder="请选择计费类型" style="width: 100%">
|
||||
<el-option label="小时工" value="1" />
|
||||
<el-option label="计件工" value="2" />
|
||||
<el-option label="天工" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="unitPriceLabel" prop="unitPrice">
|
||||
<el-input v-model="form.unitPrice" :placeholder="unitPricePlaceholder" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="0">启用</el-radio>
|
||||
<el-radio label="1">停用</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" type="textarea" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="WageRateConfig">
|
||||
import { computed } from 'vue'
|
||||
import { listWageRateConfig, getWageRateConfig, addWageRateConfig, updateWageRateConfig, delWageRateConfig } from '@/api/oa/wageRateConfig'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const wageRateConfigList = ref([])
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref('')
|
||||
const open = ref(false)
|
||||
const buttonLoading = ref(false)
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
rateName: undefined,
|
||||
billingType: undefined
|
||||
},
|
||||
rules: {
|
||||
rateName: [{ required: true, message: '工名不能为空', trigger: 'blur' }],
|
||||
billingType: [{ required: true, message: '计费类型不能为空', trigger: 'change' }],
|
||||
unitPrice: [{ required: true, message: '单价不能为空', trigger: 'blur' }]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
const unitPriceLabel = computed(() => {
|
||||
if (form.value.billingType === '1') return '小时单价(元/小时)'
|
||||
if (form.value.billingType === '2') return '件单价(元/件)'
|
||||
if (form.value.billingType === '3') return '日薪(元/天)'
|
||||
return '单价'
|
||||
})
|
||||
|
||||
const unitPricePlaceholder = computed(() => {
|
||||
if (form.value.billingType === '1') return '请输入每小时多少钱'
|
||||
if (form.value.billingType === '2') return '请输入每件多少钱'
|
||||
if (form.value.billingType === '3') return '请输入每天多少钱'
|
||||
return '请输入单价'
|
||||
})
|
||||
|
||||
function formatBillingType(type) {
|
||||
if (type === '1') return '小时工'
|
||||
if (type === '2') return '计件工'
|
||||
if (type === '3') return '天工'
|
||||
return '-'
|
||||
}
|
||||
|
||||
function unitText(type) {
|
||||
if (type === '1') return '元/小时'
|
||||
if (type === '2') return '元/件'
|
||||
if (type === '3') return '元/天'
|
||||
return ''
|
||||
}
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listWageRateConfig(queryParams.value).then(response => {
|
||||
wageRateConfigList.value = response.rows || []
|
||||
total.value = response.total || 0
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function reset() {
|
||||
form.value = {
|
||||
rateId: null,
|
||||
rateCode: 'AUTO',
|
||||
rateName: null,
|
||||
billingType: '1',
|
||||
workTypeName: null,
|
||||
itemName: null,
|
||||
processName: null,
|
||||
workdayHours: null,
|
||||
unitPrice: null,
|
||||
status: '0',
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm('formRef')
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.rateId)
|
||||
single.value = selection.length !== 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = '新增工资费率配置'
|
||||
}
|
||||
|
||||
function handleUpdate(row) {
|
||||
const rateId = row?.rateId || ids.value[0]
|
||||
if (!rateId) return
|
||||
reset()
|
||||
getWageRateConfig(rateId).then(response => {
|
||||
form.value = { ...response.data, rateCode: response.data.rateCode || 'AUTO' }
|
||||
open.value = true
|
||||
title.value = '修改工资费率配置'
|
||||
})
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
proxy.$refs.formRef.validate(valid => {
|
||||
if (!valid) return
|
||||
buttonLoading.value = true
|
||||
form.value.workTypeName = ''
|
||||
form.value.itemName = ''
|
||||
form.value.processName = ''
|
||||
form.value.workdayHours = null
|
||||
const req = form.value.rateId ? updateWageRateConfig(form.value) : addWageRateConfig(form.value)
|
||||
req.then(() => {
|
||||
proxy.$modal.msgSuccess(form.value.rateId ? '修改成功' : '新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
const rateIds = row?.rateId || ids.value
|
||||
if (!rateIds || (Array.isArray(rateIds) && !rateIds.length)) return
|
||||
proxy.$modal.confirm('是否确认删除工资费率配置数据项?').then(() => {
|
||||
return delWageRateConfig(rateIds)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('oa/wageRateConfig/export', {
|
||||
...queryParams.value
|
||||
}, `wage_rate_config_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
362
gear-ui3/src/views/oms/worker/index.vue
Normal file
362
gear-ui3/src/views/oms/worker/index.vue
Normal file
@@ -0,0 +1,362 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form ref="queryRef" :model="queryParams" :inline="true" v-show="showSearch" label-width="80px">
|
||||
<el-form-item label="工号" prop="workerNo">
|
||||
<el-input v-model="queryParams.workerNo" placeholder="请输入工号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="workerName">
|
||||
<el-input v-model="queryParams.workerName" placeholder="请输入姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable style="width: 140px">
|
||||
<el-option label="在职" value="0" />
|
||||
<el-option label="离职" value="1" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button size="small" type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button size="small" icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5"><el-button size="small" type="primary" plain icon="Plus" @click="handleAdd">新增</el-button></el-col>
|
||||
<el-col :span="1.5"><el-button size="small" type="success" plain icon="Edit" :disabled="single" @click="handleUpdate">修改</el-button></el-col>
|
||||
<el-col :span="1.5"><el-button size="small" type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete">删除</el-button></el-col>
|
||||
<el-col :span="1.5"><el-button size="small" type="warning" plain icon="Download" @click="handleExport">导出</el-button></el-col>
|
||||
<el-col :span="1.5"><el-button size="small" type="info" plain icon="Upload" @click="openImport">导入</el-button></el-col>
|
||||
<el-col :span="1.8"><el-button size="small" plain icon="Download" @click="downloadTemplate">下载模板</el-button></el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList" />
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="workerList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="工号" align="center" prop="workerNo" width="140" />
|
||||
<el-table-column label="姓名" align="center" prop="workerName" width="120" />
|
||||
<el-table-column label="手机号" align="center" prop="phone" width="140" />
|
||||
<el-table-column label="默认计费类型" align="center" prop="defaultBillingType" width="120">
|
||||
<template #default="scope">{{ formatBillingType(scope.row.defaultBillingType) }}</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="默认工种" align="center" prop="defaultWorkTypeName" min-width="140" />
|
||||
<el-table-column label="状态" align="center" prop="status" width="100">
|
||||
<template #default="scope"><el-tag :type="scope.row.status === '0' ? 'success' : 'info'">{{ scope.row.status === '0' ? '在职' : '离职' }}</el-tag></template>
|
||||
</el-table-column>
|
||||
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="140">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
|
||||
<el-dialog :title="title" v-model="open" width="620px" append-to-body>
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
||||
<el-form-item label="工号" prop="workerNo">
|
||||
<el-input v-model="form.workerNo" placeholder="默认已生成,可手动修改" />
|
||||
</el-form-item>
|
||||
<el-form-item label="姓名" prop="workerName"><el-input v-model="form.workerName" placeholder="请输入姓名" /></el-form-item>
|
||||
<el-form-item label="手机号" prop="phone"><el-input v-model="form.phone" placeholder="请输入手机号" /></el-form-item>
|
||||
|
||||
<el-form-item label="默认工种" prop="selectedRateId">
|
||||
<el-select v-model="form.selectedRateId" placeholder="请选择默认工种" style="width: 100%" clearable @change="handleRateChange">
|
||||
<el-option
|
||||
v-for="item in rateOptions"
|
||||
:key="item.rateId"
|
||||
:label="rateOptionLabel(item)"
|
||||
:value="item.rateId"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="默认计费类型" prop="defaultBillingType">
|
||||
<el-select v-model="form.defaultBillingType" placeholder="请选择" style="width: 100%" disabled>
|
||||
<el-option label="小时工" value="1" />
|
||||
<el-option label="计件工" value="2" />
|
||||
<el-option label="天工" value="3" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio label="0">在职</el-radio>
|
||||
<el-radio label="1">离职</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark"><el-input v-model="form.remark" type="textarea" placeholder="请输入备注" /></el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="buttonLoading" type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="导入工人" v-model="importOpen" width="520px" append-to-body>
|
||||
<el-form label-width="140px">
|
||||
<el-form-item label="更新已存在数据">
|
||||
<el-switch v-model="updateSupport" />
|
||||
</el-form-item>
|
||||
<el-form-item label="选择Excel文件">
|
||||
<el-upload
|
||||
ref="uploadRef"
|
||||
:auto-upload="false"
|
||||
:limit="1"
|
||||
accept=".xlsx,.xls"
|
||||
:on-change="handleFileChange"
|
||||
:on-remove="handleFileRemove"
|
||||
>
|
||||
<el-button type="primary">选择文件</el-button>
|
||||
<template #tip>
|
||||
<div class="el-upload__tip">仅支持 .xls/.xlsx 文件</div>
|
||||
</template>
|
||||
</el-upload>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button :loading="importLoading" type="primary" @click="submitImport">导 入</el-button>
|
||||
<el-button @click="importOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="Worker">
|
||||
import { listWorker, getWorker, addWorker, updateWorker, delWorker, importWorkerData } from '@/api/oa/worker'
|
||||
import { listWageRateConfig } from '@/api/oa/wageRateConfig'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const workerList = ref([])
|
||||
const loading = ref(true)
|
||||
const showSearch = ref(true)
|
||||
const ids = ref([])
|
||||
const single = ref(true)
|
||||
const multiple = ref(true)
|
||||
const total = ref(0)
|
||||
const title = ref('')
|
||||
const open = ref(false)
|
||||
const buttonLoading = ref(false)
|
||||
|
||||
const importOpen = ref(false)
|
||||
const importLoading = ref(false)
|
||||
const updateSupport = ref(false)
|
||||
const importFile = ref(null)
|
||||
|
||||
const rateOptions = ref([])
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
workerNo: undefined,
|
||||
workerName: undefined,
|
||||
status: undefined
|
||||
},
|
||||
rules: {
|
||||
workerNo: [{ required: true, message: '工号不能为空', trigger: 'blur' }],
|
||||
workerName: [{ required: true, message: '姓名不能为空', trigger: 'blur' }],
|
||||
selectedRateId: [{ required: true, message: '默认工种不能为空', trigger: 'change' }]
|
||||
}
|
||||
})
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data)
|
||||
|
||||
function formatBillingType(type) {
|
||||
if (type === '1') return '小时工'
|
||||
if (type === '2') return '计件工'
|
||||
if (type === '3') return '天工'
|
||||
return '-'
|
||||
}
|
||||
|
||||
function unitText(type) {
|
||||
if (type === '1') return '元/小时'
|
||||
if (type === '2') return '元/件'
|
||||
if (type === '3') return '元/天'
|
||||
return ''
|
||||
}
|
||||
|
||||
function rateOptionLabel(item) {
|
||||
return `${item.rateName || '-'}-${formatBillingType(item.billingType)}-${item.unitPrice || 0}${unitText(item.billingType)}`
|
||||
}
|
||||
|
||||
function buildDefaultWorkerNo() {
|
||||
const now = new Date()
|
||||
const y = now.getFullYear()
|
||||
const m = String(now.getMonth() + 1).padStart(2, '0')
|
||||
const d = String(now.getDate()).padStart(2, '0')
|
||||
const h = String(now.getHours()).padStart(2, '0')
|
||||
const min = String(now.getMinutes()).padStart(2, '0')
|
||||
const s = String(now.getSeconds()).padStart(2, '0')
|
||||
const rand = Math.floor(Math.random() * 900 + 100)
|
||||
return `WK${y}${m}${d}${h}${min}${s}${rand}`
|
||||
}
|
||||
|
||||
function getList() {
|
||||
loading.value = true
|
||||
listWorker(queryParams.value).then(response => {
|
||||
workerList.value = response.rows || []
|
||||
total.value = response.total || 0
|
||||
}).finally(() => {
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
function loadRateOptions() {
|
||||
return listWageRateConfig({ pageNum: 1, pageSize: 1000, status: '0' }).then(res => {
|
||||
rateOptions.value = res.rows || []
|
||||
})
|
||||
}
|
||||
|
||||
function handleRateChange(rateId) {
|
||||
const picked = rateOptions.value.find(i => i.rateId === rateId)
|
||||
if (!picked) {
|
||||
form.value.defaultBillingType = '1'
|
||||
form.value.defaultWorkTypeName = null
|
||||
return
|
||||
}
|
||||
form.value.defaultBillingType = picked.billingType
|
||||
form.value.defaultWorkTypeName = picked.rateName
|
||||
}
|
||||
|
||||
function reset() {
|
||||
form.value = {
|
||||
workerId: null,
|
||||
workerNo: buildDefaultWorkerNo(),
|
||||
workerName: null,
|
||||
phone: null,
|
||||
selectedRateId: null,
|
||||
defaultBillingType: '1',
|
||||
defaultWorkTypeName: null,
|
||||
status: '0',
|
||||
remark: null
|
||||
}
|
||||
proxy.resetForm('formRef')
|
||||
}
|
||||
|
||||
function cancel() {
|
||||
open.value = false
|
||||
reset()
|
||||
}
|
||||
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1
|
||||
getList()
|
||||
}
|
||||
|
||||
function resetQuery() {
|
||||
proxy.resetForm('queryRef')
|
||||
handleQuery()
|
||||
}
|
||||
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.workerId)
|
||||
single.value = selection.length !== 1
|
||||
multiple.value = !selection.length
|
||||
}
|
||||
|
||||
function handleAdd() {
|
||||
loadRateOptions().then(() => {
|
||||
reset()
|
||||
open.value = true
|
||||
title.value = '新增工人'
|
||||
})
|
||||
}
|
||||
|
||||
function handleUpdate(row) {
|
||||
const workerId = row?.workerId || ids.value[0]
|
||||
if (!workerId) return
|
||||
Promise.all([loadRateOptions(), getWorker(workerId)]).then(([, response]) => {
|
||||
form.value = {
|
||||
...response.data,
|
||||
selectedRateId: null
|
||||
}
|
||||
const matched = rateOptions.value.find(i => i.rateName === form.value.defaultWorkTypeName && i.billingType === form.value.defaultBillingType)
|
||||
if (matched) {
|
||||
form.value.selectedRateId = matched.rateId
|
||||
}
|
||||
open.value = true
|
||||
title.value = '修改工人'
|
||||
})
|
||||
}
|
||||
|
||||
function submitForm() {
|
||||
proxy.$refs.formRef.validate(valid => {
|
||||
if (!valid) return
|
||||
buttonLoading.value = true
|
||||
const payload = {
|
||||
...form.value
|
||||
}
|
||||
delete payload.selectedRateId
|
||||
const req = payload.workerId ? updateWorker(payload) : addWorker(payload)
|
||||
req.then(() => {
|
||||
proxy.$modal.msgSuccess(payload.workerId ? '修改成功' : '新增成功')
|
||||
open.value = false
|
||||
getList()
|
||||
}).finally(() => {
|
||||
buttonLoading.value = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function handleDelete(row) {
|
||||
const workerIds = row?.workerId || ids.value
|
||||
if (!workerIds || (Array.isArray(workerIds) && !workerIds.length)) return
|
||||
proxy.$modal.confirm('是否确认删除工人数据项?').then(() => {
|
||||
return delWorker(workerIds)
|
||||
}).then(() => {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
getList()
|
||||
})
|
||||
}
|
||||
|
||||
function handleExport() {
|
||||
proxy.download('oa/worker/export', {
|
||||
...queryParams.value
|
||||
}, `worker_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
function openImport() {
|
||||
importOpen.value = true
|
||||
}
|
||||
|
||||
function handleFileChange(file) {
|
||||
importFile.value = file.raw
|
||||
}
|
||||
|
||||
function handleFileRemove() {
|
||||
importFile.value = null
|
||||
}
|
||||
|
||||
function downloadTemplate() {
|
||||
proxy.download('oa/worker/importTemplate', {}, `worker_template_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
function submitImport() {
|
||||
if (!importFile.value) {
|
||||
proxy.$modal.msgWarning('请先选择导入文件')
|
||||
return
|
||||
}
|
||||
const formData = new FormData()
|
||||
formData.append('file', importFile.value)
|
||||
formData.append('updateSupport', updateSupport.value)
|
||||
|
||||
importLoading.value = true
|
||||
importWorkerData(formData).then(res => {
|
||||
proxy.$modal.msgSuccess(res.msg || '导入成功')
|
||||
importOpen.value = false
|
||||
importFile.value = null
|
||||
getList()
|
||||
}).finally(() => {
|
||||
importLoading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
getList()
|
||||
</script>
|
||||
Reference in New Issue
Block a user