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())
const selectedRows = ref([])
const multipAddSalaryDialog = ref(false)
const addRecordRef = ref(null)
const apiSalaryBatchAddDTOList = ref([{}]) //批量新增薪资单
const apiSalaryBatchAddDTOList = ref([]) //批量新增薪资单
const salaryRemittanceDTOList = ref([{}]) //银行数据
const editTableRef = ref(null)
const bankTableRef = ref(null)
......@@ -631,7 +631,10 @@ const clearAllSelection = () => {
//==============表格复选框结束===========
const addSalaryRecord = () => {
apiSalaryBatchAddDTOList.value.push({
multipleId: Date.now() + Math.random() // 或使用 uuid
multipleId: Date.now() + Math.random(), // 或使用 uuid
otherAmount: 0,
mpfAmount: 0,
grossAmount: 0
})
}
const addSalaryRemittanceRecord = () => {
......@@ -702,7 +705,9 @@ const handleSplitCellChange = async ({ row, col, newValue, oldValue, rowIndex, p
const updatedRow = { ...currentRow }
//计算实发金额
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,
......@@ -717,7 +722,6 @@ const handleSplitCellChange = async ({ row, col, newValue, oldValue, rowIndex, p
ElMessage.error('实发金额计算失败')
}
}
}
// 如果用户手动修改了 hkdAmount,不做反向联动(符合需求)
if (needUpdate) {
// 更新表格数据(整体替换,触发视图更新)
......@@ -823,11 +827,13 @@ const handleSingleSalaryCellChange = async ({ row, col, newValue, oldValue, rowI
}
//计算折合港币总金额,改变币种汇率也会改变,所以等表格更新完在更新折合港币总金额
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) => {
if (item.amount && item.exchangeRate && item.currency) {
if (item.exchangeRate && item.currency) {
acc.push({ ...item })
}
return acc
......@@ -839,7 +845,6 @@ const handleSingleSalaryCellChange = async ({ row, col, newValue, oldValue, rowI
ElMessage.error('折合港币总金额计算失败')
}
}
}
}
// 单个薪资单的新增,修改
const handleConfirmSingleSalary = async () => {
......@@ -931,11 +936,13 @@ const handleFormInputChange = async (prop, value, item) => {
await nextTick()
//计算实发金额
if (prop === 'grossAmount' || prop === 'mpfAmount' || prop === 'otherAmount') {
if (
personSaleryFormModel.value.grossAmount &&
personSaleryFormModel.value.mpfAmount &&
personSaleryFormModel.value.otherAmount
) {
// if (
// personSaleryFormModel.value.grossAmount &&
// personSaleryFormModel.value.mpfAmount &&
// personSaleryFormModel.value.otherAmount
// ) {
// }
try {
let params = {
grossAmount: personSaleryFormModel.value.grossAmount,
......@@ -949,7 +956,6 @@ const handleFormInputChange = async (prop, value, item) => {
ElMessage.error('实发金额计算失败')
}
}
}
}
const handleFormSelectChange = async (prop, value, item) => {
console.log('表单选中项改变', prop, value, item)
......@@ -999,8 +1005,18 @@ const setSignleSalaryFormStatus = () => {
const handleSingleAdd = () => {
commonDialogTit.value = '增加薪资单'
commonDialogType.value = 'add'
personSaleryFormModel.value = { apiSalaryRemittanceFzDTO: {} }
salaryRemittanceDTOList.value = [{}]
personSaleryFormModel.value = {
apiSalaryRemittanceFzDTO: {},
otherAmount: 0,
mpfAmount: 0,
grossAmount: 0
}
salaryRemittanceDTOList.value = [
{
amount: 0,
signleId: Date.now() + Math.random()
}
]
setSignleSalaryFormStatus()
detailDialogVisible.value = true
}
......@@ -1094,7 +1110,14 @@ const handleAdd = () => {
if (addRecordRef.value) {
addRecordRef.value.resetForm()
}
apiSalaryBatchAddDTOList.value = [{}]
apiSalaryBatchAddDTOList.value = [
{
multipleId: Date.now() + Math.random(), // 或使用 uuid
otherAmount: 0,
mpfAmount: 0,
grossAmount: 0
}
]
}
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