Compare commits

...

3 Commits

Author SHA1 Message Date
qsh 9180d14ede 上传 2 months ago
qsh 0c555e8473 上传 2 months ago
qsh 3aa44fa60a 接口调试 2 months ago
  1. 8
      src/api/home/salary.js
  2. 81
      src/views/Finance/Commission/Comp/DialogPlan.vue
  3. 2
      src/views/Finance/Salary/Comp/DialogSalary.vue
  4. 2
      src/views/Home/Salary/Comp/DialogCreateSalary.vue
  5. 3
      src/views/Home/Salary/Comp/DialogSalaryImport.vue
  6. 30
      src/views/Home/Salary/index.vue

@ -7,8 +7,8 @@ export const getSalaryPage = async (params) => {
// 生成工资条
export const createSalarySlip = async (data) => {
return await request.post({
url: '/admin-api/oa/user-salary-grant/create',
return await request.upload({
url: '/admin-api/oa/user-salary-grant/import',
data,
isSubmitForm: true
})
@ -16,12 +16,12 @@ export const createSalarySlip = 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) => {
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-col>
</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>若设置 010002000</p>
<p>金额为1500则未满1000的部分按照0档结算提成1000-1500的部分按照1000档结算</p>
</div>
<div v-else-if="formData.percentageType == 2">
<p class="text-red-500">阶梯结算说明</p>
<p>若设置 010002000</p>
<p>金额为1500则全部按照1000档结算</p>
</div>
</el-card>
<el-button type="primary" class="mb-10px" plain @click="handleAddRules">
添加提成档位
</el-button>
@ -38,7 +52,12 @@
v-for="(item, index) in formData.rules"
: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
v-for="it in opts.percentage_param1"
:key="it.value"
@ -46,7 +65,13 @@
:value="it.value"
/>
</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
v-for="it in opts.percentage_param2"
:key="it.value"
@ -85,7 +110,13 @@
</div>
<div v-else class="inline-flex items-center">
<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
v-for="it in opts.percentage_param5"
:key="it.value"
@ -105,7 +136,12 @@
<template #suffix> % </template>
</el-input>
</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-row>
@ -202,7 +238,7 @@ const message = useMessage() // 消息弹窗
const { t } = useI18n() //
const dialogVisible = ref(false) //
const dialogTitle = ref('工资条设置')
const dialogTitle = ref('提成方案')
const formLoading = ref(false) // 12
const formData = ref({})
@ -244,9 +280,15 @@ defineExpose({ open }) // 提供 open 方法,用于打开弹窗
/** 重置表单 */
const resetForm = () => {
opts.value = {
percentage_param1: [],
percentage_param2: [],
percentage_param4: [],
percentage_param5: []
}
formData.value = {
percentageName: undefined,
percentageType: 1,
percentageType: 2,
rules: [
{
ruleParam1: '2',
@ -267,14 +309,7 @@ const resetForm = () => {
}
function handleAddRules() {
formData.value.rules.push({
ruleParam1: '2',
ruleParam2: '1',
ruleParam3: 0,
ruleParam4: '1',
ruleParam5: '1',
ruleParam6: 0
})
formData.value.rules.push(formData.value.rules[0])
}
const emit = defineEmits(['success'])
@ -306,6 +341,24 @@ const submitForm = async () => {
function handleRemove(index) {
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>
<style lang="scss" scoped></style>

@ -26,7 +26,7 @@
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<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
v-for="item in planOptions"
:key="item.percentageId"

@ -16,7 +16,7 @@
</el-row>
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="导入工资">
<el-form-item label="导入奖金">
<div>
<el-upload
ref="rewardFile"

@ -68,8 +68,9 @@ function open() {
}
function resetForm() {
const month = `${new Date().getMonth() + 1}`
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
type="danger"
v-if="row.id"
v-if="row.id && !row.isConfirm"
style="padding: 0"
text
v-hasPermi="['home:salary:sealup']"
@click="handleSave(row)"
@click="handleSealup(row)"
>
封存
</el-button>
@ -316,6 +316,8 @@ import DialogSalaryImport from './Comp/DialogSalaryImport.vue'
import { removeNullField } from '@/utils'
import * as SalaryApi from '@/api/home/salary.js'
const message = useMessage() //
const searchForm = ref({
name: undefined,
period: undefined,
@ -357,7 +359,7 @@ async function getList() {
tableList.value = data.list.map((it, index) => ({
...it,
id: index + 1,
edit: '0'
edit: it.isConfirm ? '2' : '0'
}))
}
total.value = data.total
@ -395,9 +397,29 @@ function handleEdit(row) {
row.userSalaryGrantRespVOList.forEach((it) => (it.edit = true))
}
function handleSave(row) {
async function handleSave(row) {
row.edit = '0'
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>

Loading…
Cancel
Save