fix : 修复分摊汇总及编辑功能
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-table :data="formData.tableData" style="width: 100%">
|
||||
<el-table v-if="showTable" :data="formData.tableData" style="width: 100%">
|
||||
<el-table-column prop="projectId" label="项目名称" width="230">
|
||||
<template #default="scope">
|
||||
<el-form-item prop="time" :rules="scope.row.projectId?'1':rules.projectId">
|
||||
@@ -129,7 +129,8 @@
|
||||
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
|
||||
</div>
|
||||
<div class="oper-page-btn">
|
||||
<el-button color="#DED0B2" @click="handleSubmit(form)">提交</el-button>
|
||||
<el-button color="#DED0B2" v-if="routerName==='Share/add'" @click="handleSubmit(form)">提交</el-button>
|
||||
<el-button color="#DED0B2" v-else @click="handleResubmit(form)">重新提交</el-button>
|
||||
<el-button @click="handleBack">返回</el-button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -138,10 +139,9 @@
|
||||
<script setup lang="jsx">
|
||||
import {ElNotification} from "element-plus";
|
||||
import {useTagsView} from '@/stores/tagsview.js'
|
||||
import {addAllocation, getAllocationDetail, getAllocationProcess, getResearchUser,getProjectOption} from "@/api/expense-manage";
|
||||
import {addAllocation, getAllocationDetail, getAllocationProcess, getResearchUser,getProjectOption,editAllocation, getAllocationDetailList} from "@/api/expense-manage";
|
||||
import {useProcessStore} from '@/stores/processStore.js';
|
||||
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
|
||||
import {getAllocationDetailList} from "../../../api/expense-manage";
|
||||
|
||||
const rules = reactive({
|
||||
shareName: [{required: true, message: '请输入分摊名称', trigger: 'blur'}],
|
||||
@@ -159,9 +159,11 @@ const rules = reactive({
|
||||
const processStore = useProcessStore()
|
||||
const processInstanceData = ref()
|
||||
const processDiagramViewer = ref(false)
|
||||
const loading = ref(false)
|
||||
const loading = ref(true)
|
||||
const showTable = ref(true)
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const routerName = ref(router.currentRoute.value.name)
|
||||
const tagsViewStore = useTagsView()
|
||||
const formData = ref({
|
||||
tableData: [
|
||||
@@ -256,6 +258,43 @@ const handleSubmit = (instance) => {
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleResubmit = (instance) => {
|
||||
if (!instance) return
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid){
|
||||
return ElNotification({
|
||||
title: '提示',
|
||||
message: '请完善数据,再提交!',
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
formData.value.tableData.forEach(item => {
|
||||
item.allocationId = formData.value.allocationId
|
||||
item.projectName = getProjectName(item.projectId)
|
||||
})
|
||||
let params = {
|
||||
allocationId:formData.value.allocationId,
|
||||
shareName:formData.value.shareName,
|
||||
apportionmentMonth:formData.value.apportionmentMonth,
|
||||
usrAllocations: formData.value.tableData,
|
||||
deploymentId: processInstanceData.value.deploymentId,
|
||||
}
|
||||
console.log('params',params)
|
||||
const {code, msg} = await editAllocation(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 getDetailInfo = async () => {
|
||||
loading.value=true
|
||||
getAllocationDetail(route.query.id).then(res => {
|
||||
@@ -265,6 +304,7 @@ const getDetailInfo = async () => {
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
if (res.code === 1000) {
|
||||
getDetailList()
|
||||
formData.value = res.data.formData
|
||||
loading.value = false
|
||||
}
|
||||
@@ -274,9 +314,17 @@ const getDetailList = async () => {
|
||||
let params = {
|
||||
allocationId: route.query.id
|
||||
}
|
||||
showTable.value=false
|
||||
const {code, data, msg} = await getAllocationDetailList(params)
|
||||
if (code === 1000) {
|
||||
data.rows.forEach(item => {
|
||||
item.researchPersonnel = Number(item.researchPersonnel)
|
||||
})
|
||||
formData.value.tableData = data.rows
|
||||
console.log('formData.value.tableData',formData.value.tableData)
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
}else {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
@@ -319,7 +367,6 @@ onMounted(async () => {
|
||||
if (route.query.id) {
|
||||
loading.value = true
|
||||
await getDetailInfo()
|
||||
// await getDetailList()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user