fix : 修复分摊汇总及编辑功能
This commit is contained in:
@@ -41,7 +41,7 @@ export const getProjectOption = () => {
|
||||
export const getAllocationCollect = (allocationId) => {
|
||||
return request({
|
||||
url: '/workflow/mosr/cost/allocation/collect',
|
||||
method: "get",
|
||||
method: "post",
|
||||
params:{
|
||||
allocationId:allocationId
|
||||
}
|
||||
@@ -54,3 +54,9 @@ export const editAllocation = (data) => {
|
||||
data
|
||||
});
|
||||
};
|
||||
export const deleteAllocation = (id) => {
|
||||
return request({
|
||||
url: `/workflow/mosr/cost/allocation/${id}`,
|
||||
method: "delete"
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div v-loading="loading">
|
||||
<div>
|
||||
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
|
||||
<fvTable v-if="showTable" ref="tableIns" :tableConfig="tableConfig" :data="detailList">
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig">
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据"/>
|
||||
</template>
|
||||
@@ -10,6 +10,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
const route = useRoute()
|
||||
const searchConfig = reactive([
|
||||
{
|
||||
label: '项目名称',
|
||||
@@ -33,16 +34,16 @@ const searchConfig = reactive([
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '起始时间',
|
||||
prop: 'time',
|
||||
component: 'el-date-picker',
|
||||
props: {
|
||||
placeholder: '请选择起始时间',
|
||||
clearable: true,
|
||||
},
|
||||
colProps: {}
|
||||
},
|
||||
// {
|
||||
// label: '起始时间',
|
||||
// prop: 'time',
|
||||
// component: 'el-date-picker',
|
||||
// props: {
|
||||
// placeholder: '请选择起始时间',
|
||||
// clearable: true,
|
||||
// },
|
||||
// colProps: {}
|
||||
// },
|
||||
])
|
||||
const tableConfig = reactive({
|
||||
columns: [
|
||||
@@ -91,33 +92,20 @@ const tableConfig = reactive({
|
||||
label: '研发时长(天)',
|
||||
align: 'center'
|
||||
},
|
||||
]
|
||||
})
|
||||
const tableIns = ref()
|
||||
const props = defineProps({
|
||||
detailList: {
|
||||
type: Array,
|
||||
default: []
|
||||
},
|
||||
loading: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
showTable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
],
|
||||
api:'/workflow/mosr/cost/allocation/usr',
|
||||
params:{
|
||||
allocationId:route.query.id
|
||||
}
|
||||
})
|
||||
const tableIns = ref()
|
||||
const search = (val) => {
|
||||
tableConfig.params = {...val}
|
||||
tableConfig.params = {
|
||||
allocationId:route.query.id,
|
||||
...val
|
||||
}
|
||||
tableIns.value.refresh()
|
||||
}
|
||||
watch(() => props.loading, (val) => {
|
||||
props.loading=val
|
||||
})
|
||||
watch(() => props.showTable, (val) => {
|
||||
props.showTable=val
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
@@ -101,12 +101,26 @@ const tableConfig = reactive({
|
||||
{
|
||||
prop: 'projectCost',
|
||||
label: '项目费用',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.projectCost !== null) {
|
||||
return (<Tag dictType={'project_cost'} value={row.projectCost}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'researchStage',
|
||||
label: '研发阶段',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.researchStage&&row.researchStage !== null&&row.researchStage!==undefined) {
|
||||
return (<Tag dictType={'research_stage'} value={row.researchStage}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -15,10 +15,10 @@
|
||||
</el-form>
|
||||
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
|
||||
<el-tab-pane label="分摊明细" name="first">
|
||||
<expense-detail :showTable="showTable" :detailList="detailList" :loading="loading"/>
|
||||
<expense-detail/>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="分摊汇总" name="second">
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig" :data="collectList">
|
||||
<el-tab-pane label="分摊汇总" name="second" v-loading="loading">
|
||||
<fvTable v-if="showTable" ref="tableRef" :tableConfig="tableConfig" :data="collectList">
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据"/>
|
||||
</template>
|
||||
@@ -52,12 +52,11 @@ import OperationRender from '@/views/workflow/common/OperationRender.vue'
|
||||
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'
|
||||
import {ElNotification} from "element-plus";
|
||||
import {useProcessStore} from '@/stores/processStore.js';
|
||||
import {getAllocationDetail, getAllocationDetailList,getAllocationCollect} from "@/api/expense-manage";
|
||||
import {getAllocationDetail,getAllocationCollect} from "@/api/expense-manage";
|
||||
|
||||
const processStore = useProcessStore()
|
||||
const route = useRoute()
|
||||
const shareData = ref({})
|
||||
const detailList = ref([])
|
||||
const formData = ref({})
|
||||
const auditOpinion = ref('')
|
||||
const shareProcessViewer = ref(true)
|
||||
@@ -75,23 +74,42 @@ const tableConfig = reactive({
|
||||
width: '80',
|
||||
},
|
||||
{
|
||||
prop: 'originalFileName',
|
||||
prop: 'projectName',
|
||||
label: '项目名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'tag',
|
||||
prop: 'projectCost',
|
||||
label: '费用性质',
|
||||
align: 'center'
|
||||
align: 'center',
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.projectCost !== null) {
|
||||
return (<Tag dictType={'project_cost'} value={row.projectCost}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'size',
|
||||
prop: 'researchStage',
|
||||
label: '项目阶段',
|
||||
align: 'center',
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.researchStage&&row.researchStage !== null&&row.researchStage!==undefined) {
|
||||
return (<Tag dictType={'research_stage'} value={row.researchStage}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'afterTax',
|
||||
label: '分摊金额',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'size',
|
||||
label: '分摊金额',
|
||||
prop: 'digest',
|
||||
label: '摘要',
|
||||
align: 'center'
|
||||
}
|
||||
]
|
||||
@@ -120,18 +138,16 @@ const getDetail = async () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
const getDetailList = async () => {
|
||||
let params = {
|
||||
allocationId: route.query.id
|
||||
}
|
||||
|
||||
const getDetailCollect = async () => {
|
||||
loading.value = true
|
||||
showTable.value = false
|
||||
const {code, data, msg} = await getAllocationDetailList(params)
|
||||
const {code, data, msg} = await getAllocationCollect(route.query.id)
|
||||
if (code === 1000) {
|
||||
detailList.value = data.rows
|
||||
collectList.value = data
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
loading.value = false
|
||||
showTable.value = true
|
||||
})
|
||||
}else {
|
||||
ElNotification({
|
||||
@@ -141,23 +157,21 @@ const getDetailList = async () => {
|
||||
})
|
||||
}
|
||||
}
|
||||
const getDetailCollect = async () => {
|
||||
const {code, data, msg} = await getAllocationCollect(route.query.id)
|
||||
if (code === 1000) {
|
||||
collectList.value = data.rows
|
||||
const handleClick = (tab) => {
|
||||
console.log('tab',tab.index)
|
||||
if (tab.index==0) {
|
||||
getDetail()
|
||||
}else {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: msg,
|
||||
type: 'error'
|
||||
})
|
||||
getDetailCollect()
|
||||
}
|
||||
}
|
||||
getDetail()
|
||||
getDetailList()
|
||||
// getDetailCollect()
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.el-table--fit ){
|
||||
width: 100%;
|
||||
height: 400px!important;
|
||||
}
|
||||
:deep(.el-tabs__nav-scroll) {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
<script setup lang="jsx">
|
||||
// import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||
import { ElNotification} from "element-plus";
|
||||
import {deleteAllocation} from "@/api/expense-manage";
|
||||
|
||||
const router = useRouter();
|
||||
const searchConfig = reactive([
|
||||
@@ -22,7 +24,7 @@ const searchConfig = reactive([
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},{
|
||||
}, {
|
||||
label: '分摊月份',
|
||||
prop: 'apportionmentMonth',
|
||||
component: 'el-date-picker',
|
||||
@@ -78,7 +80,7 @@ const tableConfig = reactive({
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.state == undefined||row.state == 0) {
|
||||
if (row.state == undefined || row.state == 0) {
|
||||
return '--'
|
||||
} else {
|
||||
return (<Tag dictType={'special_fund'} value={row.state}/>)
|
||||
@@ -93,7 +95,7 @@ const tableConfig = reactive({
|
||||
currentRender: ({row, index}) => {
|
||||
let btn = []
|
||||
let buttons
|
||||
if(row.buttons){
|
||||
if (row.buttons) {
|
||||
buttons = new Set(Array.from(row.buttons))
|
||||
}
|
||||
if (buttons.has("details")) {
|
||||
@@ -124,10 +126,10 @@ const tableConfig = reactive({
|
||||
}
|
||||
{
|
||||
buttons.has("delete") ?
|
||||
<popover-delete name={row.requirementName} type={'费用分摊'} btnType={'danger'}
|
||||
<popover-delete name={row.shareName} type={'费用分摊'} btnType={'danger'}
|
||||
perm={['mosr:requirement:del']}
|
||||
onDelete={() => handleDelete(row)}/>
|
||||
: ''
|
||||
: ''
|
||||
}
|
||||
</div>
|
||||
)
|
||||
@@ -155,7 +157,7 @@ const handleDetail = (row) => {
|
||||
router.push({
|
||||
name: 'Share/detail',
|
||||
query: {
|
||||
id:row.allocationId
|
||||
id: row.allocationId
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -163,10 +165,22 @@ const handleEdit = (row) => {
|
||||
router.push({
|
||||
name: 'Share/edit',
|
||||
query: {
|
||||
id:row.allocationId
|
||||
id: row.allocationId
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleDelete = (row) => {
|
||||
deleteAllocation(row.allocationId).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
if (res.code === 1000) {
|
||||
tableIns.value.refresh()
|
||||
}
|
||||
});
|
||||
}
|
||||
const headBtnClick = (key) => {
|
||||
switch (key) {
|
||||
case 'add':
|
||||
|
||||
Reference in New Issue
Block a user