fix : 修复用户切换报错提示、税后余额数字输入框、新增分摊时研发人员传参

This commit is contained in:
2024-06-22 23:54:54 +08:00
parent 2d9bba98a7
commit 7e524039bd
4 changed files with 64 additions and 68 deletions

View File

@@ -97,7 +97,7 @@ const handleVisitedP = () => {
ElNotification({ ElNotification({
title: '提示', title: '提示',
message: res.msg, message: res.msg,
type: res.code === 1000 ? 'success' : 'error' type: 'error'
}) })
} }
accountList.value = res.data accountList.value = res.data

View File

@@ -39,19 +39,10 @@
<el-table-column prop="researchPersonnel" label="研发人员" width="230"> <el-table-column prop="researchPersonnel" label="研发人员" width="230">
<template #default="scope"> <template #default="scope">
<el-form-item prop="researchPersonnel"> <el-form-item prop="researchPersonnel">
{{ chooseUserInfo() }} {{ scope.row.researchPersonnelName ? scope.row.researchPersonnelName : currentReachPerson.name }}
<el-button @click="showPersonnelPicker"> <el-button @click="showPersonnelPicker(scope.row,scope.$index)">
{{ chooseUserInfo() == null ? '请选择研发人员' : '更改' }} {{ scope.row.researchPersonnelName || currentReachPerson.name ? '更改' : '请选择研发人员' }}
</el-button> </el-button>
<!-- <el-select v-model="scope.row.researchPersonnel" placeholder="请选择研发人员" clearable>-->
<!-- <el-option-->
<!-- v-for="item in researchOptions"-->
<!-- :key="item.value"-->
<!-- :label="item.label"-->
<!-- :value="item.value"-->
<!-- >-->
<!-- </el-option>-->
<!-- </el-select>-->
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
@@ -64,7 +55,7 @@
</el-table-column> </el-table-column>
<el-table-column prop="performance" label="绩效" width="175"> <el-table-column prop="performance" label="绩效" width="175">
<template #default="scope"> <template #default="scope">
<el-form-item prop="time" :rules="scope.row.performance?'1':rules.performance"> <el-form-item prop="time">
<el-input-number v-model="scope.row.performance" placeholder="请输入绩效" :controls="false"/> <el-input-number v-model="scope.row.performance" placeholder="请输入绩效" :controls="false"/>
</el-form-item> </el-form-item>
</template> </template>
@@ -104,18 +95,6 @@
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column prop="time" label="时间">-->
<!-- <template #default="scope">-->
<!-- <el-input v-model="scope.row.time" placeholder="请输入时间" clearable>-->
<!-- </el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<!-- <el-table-column prop="subtotal" label="小计">-->
<!-- <template #default="scope">-->
<!-- <el-input v-model="scope.row.subtotal" placeholder="请输入小计" clearable>-->
<!-- </el-input>-->
<!-- </template>-->
<!-- </el-table-column>-->
<el-table-column prop="oper" label="操作"> <el-table-column prop="oper" label="操作">
<template #default="scope"> <template #default="scope">
<el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 18px">复制</el-button> <el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 18px">复制</el-button>
@@ -125,7 +104,8 @@
</el-table> </el-table>
</el-row> </el-row>
</el-form> </el-form>
<user-picker :multiple="true" ref="userPicker" title="请选择研发人员" v-model:value="userList" @ok="selected"/> <user-picker :multiple="false" ref="userPicker" title="请选择研发人员" v-model:value="userList" @ok="selected"
:setNullToSelectList="true"/>
<div style="width:100%;text-align: center;padding: 10px"> <div style="width:100%;text-align: center;padding: 10px">
<el-button type="primary" @click="handleAdd" link style="font-size: 18px">添加一行</el-button> <el-button type="primary" @click="handleAdd" link style="font-size: 18px">添加一行</el-button>
@@ -220,22 +200,26 @@ const formData = ref({
}) })
const userPicker = ref() const userPicker = ref()
const form = ref() const form = ref()
const currentReachPerson = ref({})
const currentRow = ref()
const currentIndex = ref()
const nameOptions = ref([]) const nameOptions = ref([])
const researchOptions = ref([]) const researchOptions = ref([])
const showPersonnelPicker = () => { const showPersonnelPicker = (row, index) => {
currentRow.value = row
currentIndex.value = index
userPicker.value.showUserPicker() userPicker.value.showUserPicker()
} }
const chooseUserInfo = () => {
if (userList.value.length > 0) {
return userList.value.map(item => {
return item.name
}).join('')
} else {
return null
}
}
const selected = (select) => { const selected = (select) => {
userList.value = select for (const selectElement of select) {
currentReachPerson.value = selectElement
}
formData.value.tableData.forEach((item, index) => {
if (index == currentIndex.value) {
item.researchPersonnel = currentReachPerson.value.id
item.researchPersonnelName = currentReachPerson.value.name
}
})
} }
const getResearchOptions = async () => { const getResearchOptions = async () => {
const res = await getResearchUser() const res = await getResearchUser()
@@ -288,17 +272,20 @@ const handleDelete = (index) => {
formData.value.tableData.splice(index, 1) formData.value.tableData.splice(index, 1)
} }
const handleSubmit = (instance) => { const handleSubmit = (instance) => {
// if (!instance) return if (!instance) return
// instance.validate(async (valid) => { instance.validate(async (valid) => {
// if (!valid) { if (!valid) {
// return ElNotification({ return ElNotification({
// title: '提示', title: '提示',
// message: '请完善数据,再提交!', message: '请完善数据,再提交!',
// type: 'error' type: 'error'
// }) })
// } }
formData.value.tableData.forEach(item => { formData.value.tableData.forEach(item => {
item.projectName = getProjectName(item.projectId) item.projectName = getProjectName(item.projectId)
if (item.performance == 0) {
item.performance = null
}
}) })
let params = { let params = {
shareName: formData.value.shareName, shareName: formData.value.shareName,
@@ -306,20 +293,20 @@ const handleSubmit = (instance) => {
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) => {
if (!instance) return if (!instance) return
@@ -334,6 +321,9 @@ const handleResubmit = (instance) => {
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)
if (item.performance == 0) {
item.performance = null
}
}) })
let params = { let params = {
allocationId: formData.value.allocationId, allocationId: formData.value.allocationId,
@@ -342,7 +332,7 @@ const handleResubmit = (instance) => {
usrAllocations: formData.value.tableData, usrAllocations: formData.value.tableData,
deploymentId: processInstanceData.value.deploymentId, deploymentId: processInstanceData.value.deploymentId,
} }
// console.log('params',params) console.log('params', params)
const {code, msg} = await editAllocation(params) const {code, msg} = await editAllocation(params)
ElNotification({ ElNotification({
title: '提示', title: '提示',

View File

@@ -56,8 +56,8 @@
<el-table-column prop="afterTax" label="税后余额(元)" width="220"> <el-table-column prop="afterTax" label="税后余额(元)" width="220">
<template #default="scope"> <template #default="scope">
<el-form-item prop="afterTax" :rules="scope.row.afterTax?'1':rules.afterTax"> <el-form-item prop="afterTax" :rules="scope.row.afterTax?'1':rules.afterTax">
<el-input v-model="scope.row.afterTax" placeholder="请输入税后余额" clearable> <el-input-number v-model="scope.row.afterTax" placeholder="请输入税后余额" :controls="false">
</el-input> </el-input-number>
</el-form-item> </el-form-item>
</template> </template>
</el-table-column> </el-table-column>
@@ -127,7 +127,7 @@ const tableForm = reactive({
projectCost: '', projectCost: '',
researchStage: '', researchStage: '',
digest: '', digest: '',
afterTax: '' afterTax: null
} }
] ]
}) })
@@ -148,7 +148,7 @@ const handleAdd = () => {
projectCost: '', projectCost: '',
researchStage: '', researchStage: '',
digest: '', digest: '',
afterTax: '' afterTax: null
} }
tableForm.tableData.push(row) tableForm.tableData.push(row)
} }

View File

@@ -88,6 +88,11 @@ const props = defineProps({
showCheckbox: { //是否显示左侧选择框 showCheckbox: { //是否显示左侧选择框
default: true, default: true,
type: Boolean type: Boolean
},
//打开弹窗时是否重置选中数据
setNullToSelectList: {
default: false,
type: Boolean
} }
}); });
const radio = ref(0); const radio = ref(0);
@@ -151,7 +156,6 @@ const getList = (flag) => {
} }
} }
getMosrDept(params).then(res => { getMosrDept(params).then(res => {
console.log('selectItem.type', selectItem.type)
// if (res.data) { // if (res.data) {
if (selectItem.type === -1) { if (selectItem.type === -1) {
dataList.value = res.data; dataList.value = res.data;
@@ -189,7 +193,9 @@ const showUserPicker = () => {
value: "0" value: "0"
}; };
dataList.value = []; dataList.value = [];
// selectList.value = [] if(props.setNullToSelectList){
selectList.value = []
}
chooseId.value = 0; chooseId.value = 0;
radio.value = 0; radio.value = 0;
visible.value = true; visible.value = true;