Commit 30fd22f8 by yuzhenWang

Merge branch 'wyz' into 'test'

修改薪资单计算代码

See merge request !175
parents b3301dd3 005a8c87
...@@ -180,7 +180,7 @@ const allSelectedRows = ref(new Map()) ...@@ -180,7 +180,7 @@ const allSelectedRows = ref(new Map())
const selectedRows = ref([]) const selectedRows = ref([])
const multipAddSalaryDialog = ref(false) const multipAddSalaryDialog = ref(false)
const addRecordRef = ref(null) const addRecordRef = ref(null)
const apiSalaryBatchAddDTOList = ref([{}]) //批量新增薪资单 const apiSalaryBatchAddDTOList = ref([]) //批量新增薪资单
const salaryRemittanceDTOList = ref([{}]) //银行数据 const salaryRemittanceDTOList = ref([{}]) //银行数据
const editTableRef = ref(null) const editTableRef = ref(null)
const bankTableRef = ref(null) const bankTableRef = ref(null)
...@@ -631,7 +631,10 @@ const clearAllSelection = () => { ...@@ -631,7 +631,10 @@ const clearAllSelection = () => {
//==============表格复选框结束=========== //==============表格复选框结束===========
const addSalaryRecord = () => { const addSalaryRecord = () => {
apiSalaryBatchAddDTOList.value.push({ apiSalaryBatchAddDTOList.value.push({
multipleId: Date.now() + Math.random() // 或使用 uuid multipleId: Date.now() + Math.random(), // 或使用 uuid
otherAmount: 0,
mpfAmount: 0,
grossAmount: 0
}) })
} }
const addSalaryRemittanceRecord = () => { const addSalaryRemittanceRecord = () => {
...@@ -702,20 +705,21 @@ const handleSplitCellChange = async ({ row, col, newValue, oldValue, rowIndex, p ...@@ -702,20 +705,21 @@ const handleSplitCellChange = async ({ row, col, newValue, oldValue, rowIndex, p
const updatedRow = { ...currentRow } const updatedRow = { ...currentRow }
//计算实发金额 //计算实发金额
if (prop === 'grossAmount' || prop === 'mpfAmount' || prop === 'otherAmount') { if (prop === 'grossAmount' || prop === 'mpfAmount' || prop === 'otherAmount') {
if (currentRow.grossAmount && currentRow.mpfAmount && currentRow.otherAmount) { // if (currentRow.grossAmount && currentRow.mpfAmount && currentRow.otherAmount) {
try {
let params = { // }
grossAmount: currentRow.grossAmount, try {
mpfAmount: currentRow.mpfAmount, let params = {
otherAmount: currentRow.otherAmount grossAmount: currentRow.grossAmount,
} mpfAmount: currentRow.mpfAmount,
const res = await calculatePaidAmount(params) otherAmount: currentRow.otherAmount
updatedRow.paidAmount = res.data
needUpdate = true
} catch (error) {
console.log('实发金额计算失败', error)
ElMessage.error('实发金额计算失败')
} }
const res = await calculatePaidAmount(params)
updatedRow.paidAmount = res.data
needUpdate = true
} catch (error) {
console.log('实发金额计算失败', error)
ElMessage.error('实发金额计算失败')
} }
} }
// 如果用户手动修改了 hkdAmount,不做反向联动(符合需求) // 如果用户手动修改了 hkdAmount,不做反向联动(符合需求)
...@@ -823,21 +827,22 @@ const handleSingleSalaryCellChange = async ({ row, col, newValue, oldValue, rowI ...@@ -823,21 +827,22 @@ const handleSingleSalaryCellChange = async ({ row, col, newValue, oldValue, rowI
} }
//计算折合港币总金额,改变币种汇率也会改变,所以等表格更新完在更新折合港币总金额 //计算折合港币总金额,改变币种汇率也会改变,所以等表格更新完在更新折合港币总金额
if (prop === 'amount' || prop === 'exchangeRate') { if (prop === 'amount' || prop === 'exchangeRate') {
if (currentRow.amount && currentRow.exchangeRate && currentRow.currency) { // if (currentRow.amount && currentRow.exchangeRate && currentRow.currency) {
try {
let calculateTotalAmountDTOList = JSON.parse(JSON.stringify(salaryRemittanceDTOList.value)) // }
let params = calculateTotalAmountDTOList.reduce((acc, item) => { try {
if (item.amount && item.exchangeRate && item.currency) { let calculateTotalAmountDTOList = JSON.parse(JSON.stringify(salaryRemittanceDTOList.value))
acc.push({ ...item }) let params = calculateTotalAmountDTOList.reduce((acc, item) => {
} if (item.exchangeRate && item.currency) {
return acc acc.push({ ...item })
}, []) }
const res = await calculateTotalAmountApi({ calculateTotalAmountDTOList: params }) return acc
personSaleryFormModel.value.apiSalaryRemittanceFzDTO.totalAmount = res.data }, [])
} catch (error) { const res = await calculateTotalAmountApi({ calculateTotalAmountDTOList: params })
console.log('折合港币总金额计算失败', error) personSaleryFormModel.value.apiSalaryRemittanceFzDTO.totalAmount = res.data
ElMessage.error('折合港币总金额计算失败') } catch (error) {
} console.log('折合港币总金额计算失败', error)
ElMessage.error('折合港币总金额计算失败')
} }
} }
} }
...@@ -931,23 +936,24 @@ const handleFormInputChange = async (prop, value, item) => { ...@@ -931,23 +936,24 @@ const handleFormInputChange = async (prop, value, item) => {
await nextTick() await nextTick()
//计算实发金额 //计算实发金额
if (prop === 'grossAmount' || prop === 'mpfAmount' || prop === 'otherAmount') { if (prop === 'grossAmount' || prop === 'mpfAmount' || prop === 'otherAmount') {
if ( // if (
personSaleryFormModel.value.grossAmount && // personSaleryFormModel.value.grossAmount &&
personSaleryFormModel.value.mpfAmount && // personSaleryFormModel.value.mpfAmount &&
personSaleryFormModel.value.otherAmount // personSaleryFormModel.value.otherAmount
) { // ) {
try {
let params = { // }
grossAmount: personSaleryFormModel.value.grossAmount, try {
mpfAmount: personSaleryFormModel.value.mpfAmount, let params = {
otherAmount: personSaleryFormModel.value.otherAmount grossAmount: personSaleryFormModel.value.grossAmount,
} mpfAmount: personSaleryFormModel.value.mpfAmount,
const res = await calculatePaidAmount(params) otherAmount: personSaleryFormModel.value.otherAmount
personSaleryFormModel.value.paidAmount = res.data
} catch (error) {
console.log('实发金额计算失败', error)
ElMessage.error('实发金额计算失败')
} }
const res = await calculatePaidAmount(params)
personSaleryFormModel.value.paidAmount = res.data
} catch (error) {
console.log('实发金额计算失败', error)
ElMessage.error('实发金额计算失败')
} }
} }
} }
...@@ -999,8 +1005,18 @@ const setSignleSalaryFormStatus = () => { ...@@ -999,8 +1005,18 @@ const setSignleSalaryFormStatus = () => {
const handleSingleAdd = () => { const handleSingleAdd = () => {
commonDialogTit.value = '增加薪资单' commonDialogTit.value = '增加薪资单'
commonDialogType.value = 'add' commonDialogType.value = 'add'
personSaleryFormModel.value = { apiSalaryRemittanceFzDTO: {} } personSaleryFormModel.value = {
salaryRemittanceDTOList.value = [{}] apiSalaryRemittanceFzDTO: {},
otherAmount: 0,
mpfAmount: 0,
grossAmount: 0
}
salaryRemittanceDTOList.value = [
{
amount: 0,
signleId: Date.now() + Math.random()
}
]
setSignleSalaryFormStatus() setSignleSalaryFormStatus()
detailDialogVisible.value = true detailDialogVisible.value = true
} }
...@@ -1094,7 +1110,14 @@ const handleAdd = () => { ...@@ -1094,7 +1110,14 @@ const handleAdd = () => {
if (addRecordRef.value) { if (addRecordRef.value) {
addRecordRef.value.resetForm() addRecordRef.value.resetForm()
} }
apiSalaryBatchAddDTOList.value = [{}] apiSalaryBatchAddDTOList.value = [
{
multipleId: Date.now() + Math.random(), // 或使用 uuid
otherAmount: 0,
mpfAmount: 0,
grossAmount: 0
}
]
} }
const handleExport = async () => { const handleExport = async () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment