Commit 005a8c87 by yuzhenWang

修改薪资单计算代码

parent 28b4ef95
...@@ -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,7 +705,9 @@ const handleSplitCellChange = async ({ row, col, newValue, oldValue, rowIndex, p ...@@ -702,7 +705,9 @@ 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 { try {
let params = { let params = {
grossAmount: currentRow.grossAmount, grossAmount: currentRow.grossAmount,
...@@ -717,7 +722,6 @@ const handleSplitCellChange = async ({ row, col, newValue, oldValue, rowIndex, p ...@@ -717,7 +722,6 @@ const handleSplitCellChange = async ({ row, col, newValue, oldValue, rowIndex, p
ElMessage.error('实发金额计算失败') ElMessage.error('实发金额计算失败')
} }
} }
}
// 如果用户手动修改了 hkdAmount,不做反向联动(符合需求) // 如果用户手动修改了 hkdAmount,不做反向联动(符合需求)
if (needUpdate) { if (needUpdate) {
// 更新表格数据(整体替换,触发视图更新) // 更新表格数据(整体替换,触发视图更新)
...@@ -823,11 +827,13 @@ const handleSingleSalaryCellChange = async ({ row, col, newValue, oldValue, rowI ...@@ -823,11 +827,13 @@ 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 { try {
let calculateTotalAmountDTOList = JSON.parse(JSON.stringify(salaryRemittanceDTOList.value)) let calculateTotalAmountDTOList = JSON.parse(JSON.stringify(salaryRemittanceDTOList.value))
let params = calculateTotalAmountDTOList.reduce((acc, item) => { let params = calculateTotalAmountDTOList.reduce((acc, item) => {
if (item.amount && item.exchangeRate && item.currency) { if (item.exchangeRate && item.currency) {
acc.push({ ...item }) acc.push({ ...item })
} }
return acc return acc
...@@ -839,7 +845,6 @@ const handleSingleSalaryCellChange = async ({ row, col, newValue, oldValue, rowI ...@@ -839,7 +845,6 @@ const handleSingleSalaryCellChange = async ({ row, col, newValue, oldValue, rowI
ElMessage.error('折合港币总金额计算失败') ElMessage.error('折合港币总金额计算失败')
} }
} }
}
} }
// 单个薪资单的新增,修改 // 单个薪资单的新增,修改
const handleConfirmSingleSalary = async () => { const handleConfirmSingleSalary = async () => {
...@@ -931,11 +936,13 @@ const handleFormInputChange = async (prop, value, item) => { ...@@ -931,11 +936,13 @@ 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 { try {
let params = { let params = {
grossAmount: personSaleryFormModel.value.grossAmount, grossAmount: personSaleryFormModel.value.grossAmount,
...@@ -949,7 +956,6 @@ const handleFormInputChange = async (prop, value, item) => { ...@@ -949,7 +956,6 @@ const handleFormInputChange = async (prop, value, item) => {
ElMessage.error('实发金额计算失败') ElMessage.error('实发金额计算失败')
} }
} }
}
} }
const handleFormSelectChange = async (prop, value, item) => { const handleFormSelectChange = async (prop, value, item) => {
console.log('表单选中项改变', prop, value, item) console.log('表单选中项改变', prop, value, item)
...@@ -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