Compare commits
3 Commits
9dada27bd0
...
9180d14ede
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9180d14ede | ||
|
|
0c555e8473 | ||
|
|
3aa44fa60a |
@@ -7,8 +7,8 @@ export const getSalaryPage = async (params) => {
|
|||||||
|
|
||||||
// 生成工资条
|
// 生成工资条
|
||||||
export const createSalarySlip = async (data) => {
|
export const createSalarySlip = async (data) => {
|
||||||
return await request.post({
|
return await request.upload({
|
||||||
url: '/admin-api/oa/user-salary-grant/create',
|
url: '/admin-api/oa/user-salary-grant/import',
|
||||||
data,
|
data,
|
||||||
isSubmitForm: true
|
isSubmitForm: true
|
||||||
})
|
})
|
||||||
@@ -16,12 +16,12 @@ export const createSalarySlip = async (data) => {
|
|||||||
|
|
||||||
// 导入工资条
|
// 导入工资条
|
||||||
export const importSalarySlip = async (data) => {
|
export const importSalarySlip = async (data) => {
|
||||||
return await request.post({ url: '/admin-api/oa/user-salary-grant/import', data })
|
return await request.upload({ url: '/admin-api/oa/user-salary-grant/import/history', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 修改工资条
|
// 修改工资条
|
||||||
export const updateSalarySlip = async (data) => {
|
export const updateSalarySlip = async (data) => {
|
||||||
return await request.put({ url: '/admin-api/oa/user-salary-grant/update', data })
|
return await request.put({ url: '/admin-api/oa/user-salary-grant/batchUpdate', data })
|
||||||
}
|
}
|
||||||
|
|
||||||
// 封存
|
// 封存
|
||||||
|
|||||||
@@ -27,6 +27,20 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
|
<el-card class="mb-18px" shadow="never" :body-style="{ padding: '10px' }">
|
||||||
|
<div v-if="formData.percentageType == 1">
|
||||||
|
<p class="text-red-500">阶梯结算说明:</p>
|
||||||
|
<p>若设置 0档、1000档、2000档</p>
|
||||||
|
<p>金额为1500,则未满1000的部分按照0档结算提成,1000-1500的部分按照1000档结算</p>
|
||||||
|
</div>
|
||||||
|
<div v-else-if="formData.percentageType == 2">
|
||||||
|
<p class="text-red-500">阶梯结算说明:</p>
|
||||||
|
<p>若设置 0档、1000档、2000档</p>
|
||||||
|
<p>金额为1500,则全部按照1000档结算</p>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
<el-button type="primary" class="mb-10px" plain @click="handleAddRules">
|
<el-button type="primary" class="mb-10px" plain @click="handleAddRules">
|
||||||
添加提成档位
|
添加提成档位
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -38,7 +52,12 @@
|
|||||||
v-for="(item, index) in formData.rules"
|
v-for="(item, index) in formData.rules"
|
||||||
:key="index"
|
:key="index"
|
||||||
>
|
>
|
||||||
<el-select v-model="item.ruleParam1" style="width: 100px">
|
<el-select
|
||||||
|
v-model="item.ruleParam1"
|
||||||
|
style="width: 100px"
|
||||||
|
:disabled="index > 0"
|
||||||
|
@change="planChanged('ruleParam1', false)"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="it in opts.percentage_param1"
|
v-for="it in opts.percentage_param1"
|
||||||
:key="it.value"
|
:key="it.value"
|
||||||
@@ -46,7 +65,13 @@
|
|||||||
:value="it.value"
|
:value="it.value"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<el-select class="ml-5px" v-model="item.ruleParam2" style="width: 100px">
|
<el-select
|
||||||
|
class="ml-5px"
|
||||||
|
v-model="item.ruleParam2"
|
||||||
|
style="width: 100px"
|
||||||
|
:disabled="index > 0"
|
||||||
|
@change="planChanged('ruleParam2', false)"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="it in opts.percentage_param2"
|
v-for="it in opts.percentage_param2"
|
||||||
:key="it.value"
|
:key="it.value"
|
||||||
@@ -85,7 +110,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-else class="inline-flex items-center">
|
<div v-else class="inline-flex items-center">
|
||||||
<span class="ml-5px">取</span>
|
<span class="ml-5px">取</span>
|
||||||
<el-select class="ml-5px" v-model="item.ruleParam5" style="width: 100px">
|
<el-select
|
||||||
|
class="ml-5px"
|
||||||
|
v-model="item.ruleParam5"
|
||||||
|
style="width: 100px"
|
||||||
|
:disabled="formData.percentageType == 1"
|
||||||
|
@change="planChanged('ruleParam5')"
|
||||||
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="it in opts.percentage_param5"
|
v-for="it in opts.percentage_param5"
|
||||||
:key="it.value"
|
:key="it.value"
|
||||||
@@ -105,7 +136,12 @@
|
|||||||
<template #suffix> % </template>
|
<template #suffix> % </template>
|
||||||
</el-input>
|
</el-input>
|
||||||
</div>
|
</div>
|
||||||
<Icon icon="ep:remove-filled" class="text-red-500 ml-20px" @click="handleRemove(index)" />
|
<Icon
|
||||||
|
v-if="index > 0"
|
||||||
|
icon="ep:remove-filled"
|
||||||
|
class="text-red-500 ml-20px"
|
||||||
|
@click="handleRemove(index)"
|
||||||
|
/>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
@@ -202,7 +238,7 @@ const message = useMessage() // 消息弹窗
|
|||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
|
|
||||||
const dialogVisible = ref(false) // 弹窗的是否展示
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
||||||
const dialogTitle = ref('工资条设置')
|
const dialogTitle = ref('提成方案')
|
||||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
|
||||||
|
|
||||||
const formData = ref({})
|
const formData = ref({})
|
||||||
@@ -244,9 +280,15 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|||||||
|
|
||||||
/** 重置表单 */
|
/** 重置表单 */
|
||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
|
opts.value = {
|
||||||
|
percentage_param1: [],
|
||||||
|
percentage_param2: [],
|
||||||
|
percentage_param4: [],
|
||||||
|
percentage_param5: []
|
||||||
|
}
|
||||||
formData.value = {
|
formData.value = {
|
||||||
percentageName: undefined,
|
percentageName: undefined,
|
||||||
percentageType: 1,
|
percentageType: 2,
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
ruleParam1: '2',
|
ruleParam1: '2',
|
||||||
@@ -267,14 +309,7 @@ const resetForm = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function handleAddRules() {
|
function handleAddRules() {
|
||||||
formData.value.rules.push({
|
formData.value.rules.push(formData.value.rules[0])
|
||||||
ruleParam1: '2',
|
|
||||||
ruleParam2: '1',
|
|
||||||
ruleParam3: 0,
|
|
||||||
ruleParam4: '1',
|
|
||||||
ruleParam5: '1',
|
|
||||||
ruleParam6: 0
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const emit = defineEmits(['success'])
|
const emit = defineEmits(['success'])
|
||||||
@@ -306,6 +341,24 @@ const submitForm = async () => {
|
|||||||
function handleRemove(index) {
|
function handleRemove(index) {
|
||||||
formData.value.rules.splice(index, 1)
|
formData.value.rules.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function planChanged(paramName, editble = true) {
|
||||||
|
const defaultRule = formData.value.rules[0]
|
||||||
|
formData.value.rules.forEach((it, index) => {
|
||||||
|
if (formData.value.percentageType == 2) {
|
||||||
|
if (!editble) {
|
||||||
|
it[paramName] = defaultRule[paramName]
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (index > 0) {
|
||||||
|
it[paramName] = defaultRule[paramName]
|
||||||
|
}
|
||||||
|
if (paramName == 'ruleParam2') {
|
||||||
|
it['ruleParam5'] = defaultRule[paramName]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped></style>
|
<style lang="scss" scoped></style>
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12" :offset="0">
|
<el-col :span="12" :offset="0">
|
||||||
<el-form-item label="提成方案" prop="planId">
|
<el-form-item label="提成方案" prop="planId">
|
||||||
<el-select v-model="formData.planId" placeholder="请选择" filterable>
|
<el-select v-model="formData.planId" placeholder="请选择" filterable clearable>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in planOptions"
|
v-for="item in planOptions"
|
||||||
:key="item.percentageId"
|
:key="item.percentageId"
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
</el-row>
|
</el-row>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12" :offset="0">
|
<el-col :span="12" :offset="0">
|
||||||
<el-form-item label="导入工资">
|
<el-form-item label="导入奖金">
|
||||||
<div>
|
<div>
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="rewardFile"
|
ref="rewardFile"
|
||||||
|
|||||||
@@ -68,8 +68,9 @@ function open() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetForm() {
|
function resetForm() {
|
||||||
|
const month = `${new Date().getMonth() + 1}`
|
||||||
formData.value = {
|
formData.value = {
|
||||||
period: `${new Date().getFullYear()}-${new Date().getMonth() + 1}`
|
period: `${new Date().getFullYear()}-${month.padStart(2, '0')}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -285,11 +285,11 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
type="danger"
|
type="danger"
|
||||||
v-if="row.id"
|
v-if="row.id && !row.isConfirm"
|
||||||
style="padding: 0"
|
style="padding: 0"
|
||||||
text
|
text
|
||||||
v-hasPermi="['home:salary:sealup']"
|
v-hasPermi="['home:salary:sealup']"
|
||||||
@click="handleSave(row)"
|
@click="handleSealup(row)"
|
||||||
>
|
>
|
||||||
封存
|
封存
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -316,6 +316,8 @@ import DialogSalaryImport from './Comp/DialogSalaryImport.vue'
|
|||||||
import { removeNullField } from '@/utils'
|
import { removeNullField } from '@/utils'
|
||||||
import * as SalaryApi from '@/api/home/salary.js'
|
import * as SalaryApi from '@/api/home/salary.js'
|
||||||
|
|
||||||
|
const message = useMessage() // 消息弹窗
|
||||||
|
|
||||||
const searchForm = ref({
|
const searchForm = ref({
|
||||||
name: undefined,
|
name: undefined,
|
||||||
period: undefined,
|
period: undefined,
|
||||||
@@ -357,7 +359,7 @@ async function getList() {
|
|||||||
tableList.value = data.list.map((it, index) => ({
|
tableList.value = data.list.map((it, index) => ({
|
||||||
...it,
|
...it,
|
||||||
id: index + 1,
|
id: index + 1,
|
||||||
edit: '0'
|
edit: it.isConfirm ? '2' : '0'
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
total.value = data.total
|
total.value = data.total
|
||||||
@@ -395,9 +397,29 @@ function handleEdit(row) {
|
|||||||
row.userSalaryGrantRespVOList.forEach((it) => (it.edit = true))
|
row.userSalaryGrantRespVOList.forEach((it) => (it.edit = true))
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleSave(row) {
|
async function handleSave(row) {
|
||||||
row.edit = '0'
|
row.edit = '0'
|
||||||
row.userSalaryGrantRespVOList.forEach((it) => (it.edit = false))
|
row.userSalaryGrantRespVOList.forEach((it) => (it.edit = false))
|
||||||
|
loading.value = true
|
||||||
|
await SalaryApi.updateSalarySlip(row.userSalaryGrantRespVOList)
|
||||||
|
message.success('保存成功!')
|
||||||
|
getList()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function handleSealup(row) {
|
||||||
|
try {
|
||||||
|
// 二次确认
|
||||||
|
await message.confirm('确认要封存"' + row.period + '"工资条吗?')
|
||||||
|
// 发起修改状态
|
||||||
|
await SalaryApi.sealupSalarySlip({
|
||||||
|
grantIdList: row.userSalaryGrantRespVOList.map((it) => it.grantId),
|
||||||
|
period: row.period
|
||||||
|
})
|
||||||
|
// 刷新列表
|
||||||
|
await getList()
|
||||||
|
} catch (err) {
|
||||||
|
console.log(err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user