fix : 修复新增分摊复制/添加一行功能

This commit is contained in:
2024-06-25 16:21:03 +08:00
parent 9d0490a253
commit afa0a52898
2 changed files with 57 additions and 27 deletions

View File

@@ -49,6 +49,7 @@
<script setup lang="jsx"> <script setup lang="jsx">
import {getResearchUser, getAllocationDetails} from "@/api/expense-manage"; import {getResearchUser, getAllocationDetails} from "@/api/expense-manage";
import {exportExcel} from "@/utils/export-excel"; import {exportExcel} from "@/utils/export-excel";
import {ElNotification} from "element-plus";
const route = useRoute() const route = useRoute()
const tableIns = ref() const tableIns = ref()
@@ -159,6 +160,13 @@ const concatColumn = (columnIndex, length, rowIndex) => {
const init = () => { const init = () => {
loading.value = true loading.value = true
getAllocationDetails(route.query.id).then(res => { getAllocationDetails(route.query.id).then(res => {
if(res.code!==1000){
ElNotification({
title: '提示',
message: res.msg,
type: 'error'
})
}
columnInfo.value = res.data.columns columnInfo.value = res.data.columns
let tableDataLet = res.data.tableData; let tableDataLet = res.data.tableData;
let personInfoKey = [] let personInfoKey = []

View File

@@ -243,6 +243,7 @@ const handleAdd = () => {
projectId: '', projectId: '',
projectName: '', projectName: '',
researchPersonnel: '', researchPersonnel: '',
researchPersonnelName: '',
wagesPayable: null, wagesPayable: null,
performance: null, performance: null,
reserveFund: null, reserveFund: null,
@@ -251,6 +252,7 @@ const handleAdd = () => {
workday: '21.75', workday: '21.75',
researchDuration: null, researchDuration: null,
} }
currentReachPerson.value.name=''
formData.value.tableData.push(row) formData.value.tableData.push(row)
} }
const handleCopy = (row) => { const handleCopy = (row) => {
@@ -281,31 +283,41 @@ const handleSubmit = (instance) => {
type: 'error' type: 'error'
}) })
} }
let researchPersonnel = ''
formData.value.tableData.forEach(item => { formData.value.tableData.forEach(item => {
item.projectName = getProjectName(item.projectId) item.projectName = getProjectName(item.projectId)
researchPersonnel = item.researchPersonnel
if (item.performance == 0) { if (item.performance == 0) {
item.performance = null item.performance = null
} }
}) })
if (!researchPersonnel) {
ElNotification({
title: '提示',
message: '请选择研发人员',
type: 'error'
})
return;
}
let params = { let params = {
shareName: formData.value.shareName, shareName: formData.value.shareName,
apportionmentMonth: formData.value.apportionmentMonth, apportionmentMonth: formData.value.apportionmentMonth,
usrAllocations: formData.value.tableData, usrAllocations: formData.value.tableData,
deploymentId: processInstanceData.value.deploymentId, deploymentId: processInstanceData.value.deploymentId,
} }
// console.log('params', params, formData.value.tableData) console.log('params', params, formData.value.tableData)
const {code, msg} = await addAllocation(params) // const {code, msg} = await addAllocation(params)
ElNotification({ // ElNotification({
title: '提示', // title: '提示',
message: msg, // message: msg,
type: code === 1000 ? 'success' : 'error' // type: code === 1000 ? 'success' : 'error'
}) // })
if (code === 1000) { // if (code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path) // tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({ // router.push({
name: 'Expense/share' // name: 'Expense/share'
}) // })
} // }
}) })
} }
const handleResubmit = (instance) => { const handleResubmit = (instance) => {
@@ -320,9 +332,11 @@ const handleResubmit = (instance) => {
} }
let newUsrAllocationsObj = {} let newUsrAllocationsObj = {}
let newUsrAllocationsObjArray = [] let newUsrAllocationsObjArray = []
let researchPersonnel = ''
formData.value.tableData.forEach(item => { formData.value.tableData.forEach(item => {
item.allocationId = formData.value.allocationId item.allocationId = formData.value.allocationId
item.projectName = getProjectName(item.projectId) item.projectName = getProjectName(item.projectId)
researchPersonnel = item.researchPersonnel
if (item.performance == 0) { if (item.performance == 0) {
item.performance = null item.performance = null
} }
@@ -340,6 +354,14 @@ const handleResubmit = (instance) => {
} }
newUsrAllocationsObjArray.push(newUsrAllocationsObj) newUsrAllocationsObjArray.push(newUsrAllocationsObj)
}) })
if (!researchPersonnel) {
ElNotification({
title: '提示',
message: '请选择研发人员',
type: 'error'
})
return;
}
let params = { let params = {
allocationId: formData.value.allocationId, allocationId: formData.value.allocationId,
shareName: formData.value.shareName, shareName: formData.value.shareName,