接口调试

This commit is contained in:
qsh
2024-07-23 11:45:55 +08:00
parent 9dada27bd0
commit 3aa44fa60a
5 changed files with 34 additions and 11 deletions

View File

@@ -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 })
}
// 封存

View File

@@ -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"

View File

@@ -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"

View File

@@ -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')}`
}
}

View File

@@ -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>