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

View File

@@ -160,17 +160,17 @@ import UserPicker from "@/views/workflow/process/common/UserPicker.vue";
const userList = ref([])
const changeDiagram = ref(false)
const rules = reactive({
shareName: [{required: true, message: '请输入分摊名称', trigger: ['blur', 'change']}],
apportionmentMonth: [{required: true, message: '请选择月份', trigger: ['blur', 'change']}],
projectId: [{required: true, message: '请选择项目名称', trigger: ['blur', 'change']}],
shareName: [{required: true, message: '请输入分摊名称', trigger: ['blur', 'change']}],
apportionmentMonth: [{required: true, message: '请选择月份', trigger: ['blur', 'change']}],
projectId: [{required: true, message: '请选择项目名称', trigger: ['blur', 'change']}],
// researchPersonnel: [{required: true, message: '请选择研发人员', trigger: ['blur', 'change']}],
wagesPayable: [{required: true, message: '请输入应发工资', trigger: ['blur', 'change']}],
performance: [{required: true, message: '请输入绩效', trigger: ['blur', 'change']}],
reserveFund: [{required: true, message: '请输入公积金', trigger: ['blur', 'change']}],
socialSecurity: [{required: true, message: '请输入社保', trigger: ['blur', 'change']}],
annuity: [{required: true, message: '请输入年金', trigger: ['blur', 'change']}],
workday: [{required: true, message: '请输入工作日', trigger: ['blur', 'change']}],
researchDuration: [{required: true, message: '请输入研发时长', trigger: ['blur', 'change']}],
wagesPayable: [{required: true, message: '请输入应发工资', trigger: ['blur', 'change']}],
performance: [{required: true, message: '请输入绩效', trigger: ['blur', 'change']}],
reserveFund: [{required: true, message: '请输入公积金', trigger: ['blur', 'change']}],
socialSecurity: [{required: true, message: '请输入社保', trigger: ['blur', 'change']}],
annuity: [{required: true, message: '请输入年金', trigger: ['blur', 'change']}],
workday: [{required: true, message: '请输入工作日', trigger: ['blur', 'change']}],
researchDuration: [{required: true, message: '请输入研发时长', trigger: ['blur', 'change']}],
})
const processStore = useProcessStore()
const opentionData = ref()
@@ -243,6 +243,7 @@ const handleAdd = () => {
projectId: '',
projectName: '',
researchPersonnel: '',
researchPersonnelName: '',
wagesPayable: null,
performance: null,
reserveFund: null,
@@ -251,6 +252,7 @@ const handleAdd = () => {
workday: '21.75',
researchDuration: null,
}
currentReachPerson.value.name=''
formData.value.tableData.push(row)
}
const handleCopy = (row) => {
@@ -281,31 +283,41 @@ const handleSubmit = (instance) => {
type: 'error'
})
}
let researchPersonnel = ''
formData.value.tableData.forEach(item => {
item.projectName = getProjectName(item.projectId)
researchPersonnel = item.researchPersonnel
if (item.performance == 0) {
item.performance = null
}
})
if (!researchPersonnel) {
ElNotification({
title: '提示',
message: '请选择研发人员',
type: 'error'
})
return;
}
let params = {
shareName: formData.value.shareName,
apportionmentMonth: formData.value.apportionmentMonth,
usrAllocations: formData.value.tableData,
deploymentId: processInstanceData.value.deploymentId,
}
// console.log('params', params, formData.value.tableData)
const {code, msg} = await addAllocation(params)
ElNotification({
title: '提示',
message: msg,
type: code === 1000 ? 'success' : 'error'
})
if (code === 1000) {
tagsViewStore.delVisitedViews(router.currentRoute.value.path)
router.push({
name: 'Expense/share'
})
}
console.log('params', params, formData.value.tableData)
// const {code, msg} = await addAllocation(params)
// ElNotification({
// title: '提示',
// message: msg,
// type: code === 1000 ? 'success' : 'error'
// })
// if (code === 1000) {
// tagsViewStore.delVisitedViews(router.currentRoute.value.path)
// router.push({
// name: 'Expense/share'
// })
// }
})
}
const handleResubmit = (instance) => {
@@ -318,17 +330,19 @@ const handleResubmit = (instance) => {
type: 'error'
})
}
let newUsrAllocationsObj={}
let newUsrAllocationsObjArray=[]
let newUsrAllocationsObj = {}
let newUsrAllocationsObjArray = []
let researchPersonnel = ''
formData.value.tableData.forEach(item => {
item.allocationId = formData.value.allocationId
item.projectName = getProjectName(item.projectId)
researchPersonnel = item.researchPersonnel
if (item.performance == 0) {
item.performance = null
}
newUsrAllocationsObj={
newUsrAllocationsObj = {
projectId: item.projectId,
projectName:item.projectName,
projectName: item.projectName,
researchPersonnel: item.researchPersonnel,
wagesPayable: item.wagesPayable,
performance: item.performance,
@@ -340,6 +354,14 @@ const handleResubmit = (instance) => {
}
newUsrAllocationsObjArray.push(newUsrAllocationsObj)
})
if (!researchPersonnel) {
ElNotification({
title: '提示',
message: '请选择研发人员',
type: 'error'
})
return;
}
let params = {
allocationId: formData.value.allocationId,
shareName: formData.value.shareName,