Merge pull request 'fix : 修复分摊汇总及编辑功能' (#291) from dj into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/291
This commit is contained in:
2024-06-06 05:36:20 +00:00
6 changed files with 162 additions and 79 deletions

View File

@@ -41,7 +41,7 @@ export const getProjectOption = () => {
export const getAllocationCollect = (allocationId) => { export const getAllocationCollect = (allocationId) => {
return request({ return request({
url: '/workflow/mosr/cost/allocation/collect', url: '/workflow/mosr/cost/allocation/collect',
method: "get", method: "post",
params:{ params:{
allocationId:allocationId allocationId:allocationId
} }
@@ -54,3 +54,9 @@ export const editAllocation = (data) => {
data data
}); });
}; };
export const deleteAllocation = (id) => {
return request({
url: `/workflow/mosr/cost/allocation/${id}`,
method: "delete"
});
};

View File

@@ -1,7 +1,7 @@
<template> <template>
<div v-loading="loading"> <div>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm> <fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable v-if="showTable" ref="tableIns" :tableConfig="tableConfig" :data="detailList"> <fvTable ref="tableIns" :tableConfig="tableConfig">
<template #empty> <template #empty>
<el-empty description="暂无数据"/> <el-empty description="暂无数据"/>
</template> </template>
@@ -10,6 +10,7 @@
</template> </template>
<script setup lang="jsx"> <script setup lang="jsx">
const route = useRoute()
const searchConfig = reactive([ const searchConfig = reactive([
{ {
label: '项目名称', label: '项目名称',
@@ -33,16 +34,16 @@ const searchConfig = reactive([
checkStrictly: true checkStrictly: true
} }
}, },
{ // {
label: '起始时间', // label: '起始时间',
prop: 'time', // prop: 'time',
component: 'el-date-picker', // component: 'el-date-picker',
props: { // props: {
placeholder: '请选择起始时间', // placeholder: '请选择起始时间',
clearable: true, // clearable: true,
}, // },
colProps: {} // colProps: {}
}, // },
]) ])
const tableConfig = reactive({ const tableConfig = reactive({
columns: [ columns: [
@@ -91,33 +92,20 @@ const tableConfig = reactive({
label: '研发时长(天)', label: '研发时长(天)',
align: 'center' align: 'center'
}, },
] ],
}) api:'/workflow/mosr/cost/allocation/usr',
const tableIns = ref() params:{
const props = defineProps({ allocationId:route.query.id
detailList: {
type: Array,
default: []
},
loading: {
type: Boolean,
default: false
},
showTable: {
type: Boolean,
default: true
} }
}) })
const tableIns = ref()
const search = (val) => { const search = (val) => {
tableConfig.params = {...val} tableConfig.params = {
allocationId:route.query.id,
...val
}
tableIns.value.refresh() tableIns.value.refresh()
} }
watch(() => props.loading, (val) => {
props.loading=val
})
watch(() => props.showTable, (val) => {
props.showTable=val
})
</script> </script>
<style scoped> <style scoped>

View File

@@ -101,12 +101,26 @@ const tableConfig = reactive({
{ {
prop: 'projectCost', prop: 'projectCost',
label: '项目费用', label: '项目费用',
align: 'center' align: 'center',
currentRender: ({row, index}) => {
if (row.projectCost !== null) {
return (<Tag dictType={'project_cost'} value={row.projectCost}/>)
} else {
return '--'
}
}
}, },
{ {
prop: 'researchStage', prop: 'researchStage',
label: '研发阶段', 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', prop: 'digest',

View File

@@ -20,7 +20,7 @@
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
</el-col> </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"> <el-table-column prop="projectId" label="项目名称" width="230">
<template #default="scope"> <template #default="scope">
<el-form-item prop="time" :rules="scope.row.projectId?'1':rules.projectId"> <el-form-item prop="time" :rules="scope.row.projectId?'1':rules.projectId">
@@ -129,7 +129,8 @@
<process-diagram-viewer mode="view" v-if="processDiagramViewer"/> <process-diagram-viewer mode="view" v-if="processDiagramViewer"/>
</div> </div>
<div class="oper-page-btn"> <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> <el-button @click="handleBack">返回</el-button>
</div> </div>
</div> </div>
@@ -138,10 +139,9 @@
<script setup lang="jsx"> <script setup lang="jsx">
import {ElNotification} from "element-plus"; import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js' 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 {useProcessStore} from '@/stores/processStore.js';
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'; import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue';
import {getAllocationDetailList} from "../../../api/expense-manage";
const rules = reactive({ const rules = reactive({
shareName: [{required: true, message: '请输入分摊名称', trigger: 'blur'}], shareName: [{required: true, message: '请输入分摊名称', trigger: 'blur'}],
@@ -159,9 +159,11 @@ const rules = reactive({
const processStore = useProcessStore() const processStore = useProcessStore()
const processInstanceData = ref() const processInstanceData = ref()
const processDiagramViewer = ref(false) const processDiagramViewer = ref(false)
const loading = ref(false) const loading = ref(true)
const showTable = ref(true)
const route = useRoute() const route = useRoute()
const router = useRouter() const router = useRouter()
const routerName = ref(router.currentRoute.value.name)
const tagsViewStore = useTagsView() const tagsViewStore = useTagsView()
const formData = ref({ const formData = ref({
tableData: [ 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 () => { const getDetailInfo = async () => {
loading.value=true loading.value=true
getAllocationDetail(route.query.id).then(res => { getAllocationDetail(route.query.id).then(res => {
@@ -265,6 +304,7 @@ const getDetailInfo = async () => {
type: res.code === 1000 ? 'success' : 'error' type: res.code === 1000 ? 'success' : 'error'
}) })
if (res.code === 1000) { if (res.code === 1000) {
getDetailList()
formData.value = res.data.formData formData.value = res.data.formData
loading.value = false loading.value = false
} }
@@ -274,9 +314,17 @@ const getDetailList = async () => {
let params = { let params = {
allocationId: route.query.id allocationId: route.query.id
} }
showTable.value=false
const {code, data, msg} = await getAllocationDetailList(params) const {code, data, msg} = await getAllocationDetailList(params)
if (code === 1000) { if (code === 1000) {
data.rows.forEach(item => {
item.researchPersonnel = Number(item.researchPersonnel)
})
formData.value.tableData = data.rows formData.value.tableData = data.rows
console.log('formData.value.tableData',formData.value.tableData)
nextTick(() => {
showTable.value = true
})
}else { }else {
ElNotification({ ElNotification({
title: '提示', title: '提示',
@@ -319,7 +367,6 @@ onMounted(async () => {
if (route.query.id) { if (route.query.id) {
loading.value = true loading.value = true
await getDetailInfo() await getDetailInfo()
// await getDetailList()
} }
}) })
</script> </script>

View File

@@ -15,10 +15,10 @@
</el-form> </el-form>
<el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick"> <el-tabs v-model="activeName" class="demo-tabs" @tab-click="handleClick">
<el-tab-pane label="分摊明细" name="first"> <el-tab-pane label="分摊明细" name="first">
<expense-detail :showTable="showTable" :detailList="detailList" :loading="loading"/> <expense-detail/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="分摊汇总" name="second"> <el-tab-pane label="分摊汇总" name="second" v-loading="loading">
<fvTable ref="tableIns" :tableConfig="tableConfig" :data="collectList"> <fvTable v-if="showTable" ref="tableRef" :tableConfig="tableConfig" :data="collectList">
<template #empty> <template #empty>
<el-empty description="暂无数据"/> <el-empty description="暂无数据"/>
</template> </template>
@@ -52,12 +52,11 @@ import OperationRender from '@/views/workflow/common/OperationRender.vue'
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue' import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'
import {ElNotification} from "element-plus"; import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js'; 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 processStore = useProcessStore()
const route = useRoute() const route = useRoute()
const shareData = ref({}) const shareData = ref({})
const detailList = ref([])
const formData = ref({}) const formData = ref({})
const auditOpinion = ref('') const auditOpinion = ref('')
const shareProcessViewer = ref(true) const shareProcessViewer = ref(true)
@@ -75,23 +74,42 @@ const tableConfig = reactive({
width: '80', width: '80',
}, },
{ {
prop: 'originalFileName', prop: 'projectName',
label: '项目名称', label: '项目名称',
align: 'center', align: 'center',
}, },
{ {
prop: 'tag', prop: 'projectCost',
label: '费用性质', 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: '项目阶段', 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' align: 'center'
}, },
{ {
prop: 'size', prop: 'digest',
label: '分摊金额', label: '摘要',
align: 'center' align: 'center'
} }
] ]
@@ -120,18 +138,16 @@ const getDetail = async () => {
}) })
} }
} }
const getDetailList = async () => {
let params = { const getDetailCollect = async () => {
allocationId: route.query.id
}
loading.value = true loading.value = true
showTable.value = false showTable.value = false
const {code, data, msg} = await getAllocationDetailList(params) const {code, data, msg} = await getAllocationCollect(route.query.id)
if (code === 1000) { if (code === 1000) {
detailList.value = data.rows collectList.value = data
nextTick(() => { nextTick(() => {
showTable.value = true
loading.value = false loading.value = false
showTable.value = true
}) })
}else { }else {
ElNotification({ ElNotification({
@@ -141,23 +157,21 @@ const getDetailList = async () => {
}) })
} }
} }
const getDetailCollect = async () => { const handleClick = (tab) => {
const {code, data, msg} = await getAllocationCollect(route.query.id) console.log('tab',tab.index)
if (code === 1000) { if (tab.index==0) {
collectList.value = data.rows getDetail()
}else { }else {
ElNotification({ getDetailCollect()
title: '提示',
message: msg,
type: 'error'
})
} }
} }
getDetail() getDetail()
getDetailList()
// getDetailCollect()
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
:deep(.el-table--fit ){
width: 100%;
height: 400px!important;
}
:deep(.el-tabs__nav-scroll) { :deep(.el-tabs__nav-scroll) {
width: 100%; width: 100%;
display: flex; display: flex;

View File

@@ -9,6 +9,8 @@
<script setup lang="jsx"> <script setup lang="jsx">
// import fvSelect from '@/fvcomponents/fvSelect/index.vue' // import fvSelect from '@/fvcomponents/fvSelect/index.vue'
import { ElNotification} from "element-plus";
import {deleteAllocation} from "@/api/expense-manage";
const router = useRouter(); const router = useRouter();
const searchConfig = reactive([ const searchConfig = reactive([
@@ -22,7 +24,7 @@ const searchConfig = reactive([
filterable: true, filterable: true,
checkStrictly: true checkStrictly: true
} }
},{ }, {
label: '分摊月份', label: '分摊月份',
prop: 'apportionmentMonth', prop: 'apportionmentMonth',
component: 'el-date-picker', component: 'el-date-picker',
@@ -78,7 +80,7 @@ const tableConfig = reactive({
align: 'center', align: 'center',
showOverflowTooltip: false, showOverflowTooltip: false,
currentRender: ({row, index}) => { currentRender: ({row, index}) => {
if (row.state == undefined||row.state == 0) { if (row.state == undefined || row.state == 0) {
return '--' return '--'
} else { } else {
return (<Tag dictType={'special_fund'} value={row.state}/>) return (<Tag dictType={'special_fund'} value={row.state}/>)
@@ -93,7 +95,7 @@ const tableConfig = reactive({
currentRender: ({row, index}) => { currentRender: ({row, index}) => {
let btn = [] let btn = []
let buttons let buttons
if(row.buttons){ if (row.buttons) {
buttons = new Set(Array.from(row.buttons)) buttons = new Set(Array.from(row.buttons))
} }
if (buttons.has("details")) { if (buttons.has("details")) {
@@ -124,10 +126,10 @@ const tableConfig = reactive({
} }
{ {
buttons.has("delete") ? buttons.has("delete") ?
<popover-delete name={row.requirementName} type={'费用分摊'} btnType={'danger'} <popover-delete name={row.shareName} type={'费用分摊'} btnType={'danger'}
perm={['mosr:requirement:del']} perm={['mosr:requirement:del']}
onDelete={() => handleDelete(row)}/> onDelete={() => handleDelete(row)}/>
: '' : ''
} }
</div> </div>
) )
@@ -155,7 +157,7 @@ const handleDetail = (row) => {
router.push({ router.push({
name: 'Share/detail', name: 'Share/detail',
query: { query: {
id:row.allocationId id: row.allocationId
} }
}) })
} }
@@ -163,10 +165,22 @@ const handleEdit = (row) => {
router.push({ router.push({
name: 'Share/edit', name: 'Share/edit',
query: { 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) => { const headBtnClick = (key) => {
switch (key) { switch (key) {
case 'add': case 'add':