This commit is contained in:
qsh
2024-07-22 20:07:53 +08:00
parent 8142e05543
commit 9dada27bd0
6 changed files with 132 additions and 80 deletions

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"
@@ -70,7 +70,7 @@
<script setup name="DialogCreateSalary">
import * as SalaryApi from '@/api/home/salary.js'
import { downloadFile } from '@/utils/download'
import download from '@/utils/download'
const message = useMessage() // 消息弹窗
const dialogVisible = ref(false)
@@ -104,13 +104,10 @@ async function handleSave() {
if (!formRef.value) return
const valid = await formRef.value.validate()
if (!valid) return
if (!fd.value.get('attendanceFile')) {
message.info('请导入考勤表!')
return
}
// 提交请求
formLoading.value = true
try {
fd.value.delete('period')
fd.value.append('period', formData.value.period)
await SalaryApi.createSalarySlip(fd.value)
message.success('生成成功')
@@ -126,10 +123,11 @@ async function downloadTemplateFile(type) {
let data
if (type == 1) {
data = await SalaryApi.getLinkReward()
downloadFile(data, '奖金模板.xls')
console.log(data)
download.excel(data, '奖金模板.xls')
} else if (type == 2) {
data = await SalaryApi.getLinkAttendance()
downloadFile(data, '考勤模板.xls')
download.excel(data, '考勤模板.xls')
}
}