月工资计算,产品详情页补充
This commit is contained in:
@@ -91,6 +91,7 @@
|
||||
<script setup name="WageMakeup">
|
||||
import { listWageEntryDetail, updateWageEntryDetail, delWageEntryDetail } from '@/api/oa/wageEntryDetail'
|
||||
import useUserStore from '@/store/modules/user'
|
||||
import { onMounted } from 'vue'
|
||||
|
||||
const { proxy } = getCurrentInstance()
|
||||
const userStore = useUserStore()
|
||||
@@ -102,6 +103,27 @@ const open = ref(false)
|
||||
const title = ref('')
|
||||
const buttonLoading = ref(false)
|
||||
|
||||
// 存储累计金额数据
|
||||
const cumulativeAmounts = ref({})
|
||||
|
||||
// 从localStorage加载累计金额数据
|
||||
function loadCumulativeAmounts() {
|
||||
const stored = localStorage.getItem('wageCumulativeAmounts')
|
||||
if (stored) {
|
||||
try {
|
||||
cumulativeAmounts.value = JSON.parse(stored)
|
||||
} catch (e) {
|
||||
console.error('Failed to parse cumulative amounts:', e)
|
||||
cumulativeAmounts.value = {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 保存累计金额数据到localStorage
|
||||
function saveCumulativeAmounts() {
|
||||
localStorage.setItem('wageCumulativeAmounts', JSON.stringify(cumulativeAmounts.value))
|
||||
}
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
@@ -197,6 +219,18 @@ function submitForm() {
|
||||
}
|
||||
// 本页面补录语义:更新当前记录并标记为已补录
|
||||
updateWageEntryDetail(payload).then(() => {
|
||||
// 更新累计金额
|
||||
const workload = parseFloat(payload.workload) || 0
|
||||
const unitPrice = parseFloat(payload.unitPrice) || 0
|
||||
const extraAmount = parseFloat(payload.extraAmount) || 0
|
||||
const totalAmount = workload * unitPrice + extraAmount
|
||||
|
||||
if (!cumulativeAmounts.value[payload.empName]) {
|
||||
cumulativeAmounts.value[payload.empName] = 0
|
||||
}
|
||||
cumulativeAmounts.value[payload.empName] += totalAmount
|
||||
saveCumulativeAmounts()
|
||||
|
||||
proxy.$modal.msgSuccess('补录成功')
|
||||
open.value = false
|
||||
getList()
|
||||
@@ -229,5 +263,8 @@ function handleExport() {
|
||||
proxy.download('oa/wageEntryDetail/export', { ...buildQuery() }, `wage_makeup_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList()
|
||||
onMounted(() => {
|
||||
loadCumulativeAmounts()
|
||||
getList()
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user