fix : 修复费用管理功能细节

This commit is contained in:
2024-05-28 23:05:10 +08:00
parent 0ae84ba12e
commit 7f40296f3b
7 changed files with 677 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
import request from '@/utils/request.js'
export const addAllocation = (data) => {
return request({
url:'/workflow/mosr/cost/allocation',
method: "post",
data
});
};
export const getAllocationDetail = (allocationId) => {
return request({
url: `/workflow/mosr/cost/allocation/info/${allocationId}`,
method: "get"
});
};

View File

@@ -0,0 +1,130 @@
<template>
<div v-loading="loading">
<el-form :model="formData" ref="form" class="query-form" label-width="auto">
<el-row>
<el-col :span="12">
<el-form-item label="分摊名称">
<span>{{ formData.shareName }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分摊月份">
<span>{{ formData.apportionmentMonth }}</span>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="projectId" label="项目名称" width="180"/>
<el-table-column prop="researchPersonnel" label="研发人员" width="180"/>
<el-table-column prop="wagesPayable" label="应发工资"/>
<el-table-column prop="performance" label="绩效"/>
<el-table-column prop="reserveFund" label="公积金"/>
<el-table-column prop="socialSecurity" label="社保"/>
<el-table-column prop="annuity" label="年金"/>
<el-table-column prop="workday" label="工作日(天)"/>
<el-table-column prop="researchDuration" label="研发时长(天)"/>
</el-table>
</el-form-item>
</el-col>
<el-col :span="24">
<div v-if="formData.taskId">
<baseTitle title="审核意见"></baseTitle>
<el-form-item prop="auditOpinion">
<el-input
v-model="formData.auditOpinion"
:rows="3"
type="textarea"
placeholder="请输入审核意见"
/>
</el-form-item>
</div>
</el-col>
</el-row>
</el-form>
<div class="approval-record">
<baseTitle title="审批记录"></baseTitle>
<div class="process">
<operation-render v-if="processViewer" :operation-list="data.operationList"
:state="data.state"/>
<process-diagram-viewer v-if="processViewer" id-name="collectionProcess"/>
</div>
</div>
<opinion v-if="data.taskId" :formData="data.formData" :taskId="data.taskId"></opinion>
</div>
</template>
<script setup lang="jsx">
import OperationRender from '@/views/workflow/common/OperationRender.vue'
import ProcessDiagramViewer from '@/views/workflow/common/ProcessDiagramViewer.vue'
const searchConfig = reactive([
{
label: '项目名称',
prop: 'projectName',
component: 'el-input',
props: {
placeholder: '请输入项目名称查询',
clearable: true,
filterable: true,
checkStrictly: true
}
},
{
label: '姓名',
prop: 'projectName',
component: 'el-input',
props: {
placeholder: '请输入姓名查询',
clearable: true,
filterable: true,
checkStrictly: true
}
},
{
label: '起始时间',
prop: 'time',
component: 'el-date-picker',
props: {
placeholder: '请选择起始时间',
clearable: true,
},
colProps: {}
},
])
const tableIns = ref()
const tableData = ref([])
const props = defineProps({
formData: {
type: Array,
default: []
},
data: {
type: Array,
default: []
},
processViewer: {
type: Boolean,
default: false
},
loading: {
type: Boolean,
default: false
}
})
const search = (val) => {
tableConfig.params = {...val}
// tableIns.value.refresh()
}
</script>
<style scoped>
</style>

View File

@@ -72,6 +72,8 @@
</div>
</div>
</el-form>
<opinion v-if="data.taskId" :formData="data.formData" :taskId="data.taskId"></opinion>
</div>
</template>

View File

@@ -0,0 +1,97 @@
<template>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig">
<template #empty>
<el-empty description="暂无数据"/>
</template>
</fvTable>
</template>
<script setup lang="jsx">
const router = useRouter()
const route = useRoute()
const searchConfig = reactive([
{
label: '名称',
prop: 'requirementName',
component: 'el-input',
props: {
placeholder: '请输入名称查询',
clearable: true,
filterable: true,
checkStrictly: true
}
}, {
label: '项目费用',
prop: 'requirementName',
component: 'el-input',
props: {
placeholder: '请输入项目费用查询',
clearable: true,
filterable: true,
checkStrictly: true
}
},
{
label: '起始时间',
prop: 'time',
component: 'el-date-picker',
props: {
placeholder: '请选择起始时间',
clearable: true,
},
colProps: {}
},
])
const tableIns = ref()
const tableConfig = reactive({
columns: [
{
prop: 'name',
type: 'index',
label: '序号',
width:'80',
align: 'center'
},
{
prop: 'projectName',
label: '项目名称',
align: 'center'
},{
prop: 'time',
label: '时间',
align: 'center'
},
{
prop: 'projectCost',
label: '项目费用',
align: 'center'
},
{
prop: 'researchStage',
label: '研发阶段',
align: 'center'
},
{
prop: 'digest',
label: '摘要',
align: 'center'
},
{
prop: 'afterTax',
label: '税后余额(元)',
align: 'center'
}
],
api: '/workflow/mosr/expense/ledger',
params: {}
})
const search = (val) => {
tableConfig.params = {...val}
tableIns.value.refresh()
}
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,232 @@
<template>
<div v-loading="loading">
<el-form :model="formData" ref="form" class="query-form" :rules="rules">
<el-row>
<el-col :span="12">
<el-form-item label="分摊名称" prop="shareName">
<el-input v-model="formData.shareName" placeholder="请输入分摊名称" clearable>
</el-input>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="分摊月份" prop="apportionmentMonth">
<el-date-picker
v-model="formData.apportionmentMonth"
type="month"
format="YYYY-MM"
value-format="YYYY-MM-DD HH:mm:ss"
placeholder="选择月"
>
</el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
<el-table :data="tableData" style="width: 100%">
<el-table-column prop="projectId" label="项目名称" width="180">
<template #default="scope">
<el-select v-model="scope.row.projectId" placeholder="请选择项目名称" clearable>
<el-option
v-for="item in nameOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
</template>
</el-table-column>
<el-table-column prop="researchPersonnel" label="研发人员" width="180">
<template #default="scope">
<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>
</template>
</el-table-column>
<el-table-column prop="wagesPayable" label="应发工资">
<template #default="scope">
<el-input v-model="scope.row.wagesPayable" placeholder="请输入应发工资" clearable>
</el-input>
</template>
</el-table-column>
<el-table-column prop="performance" label="绩效">
<template #default="scope">
<el-input v-model="scope.row.performance" placeholder="请输入绩效" clearable>
</el-input>
</template>
</el-table-column>
<el-table-column prop="reserveFund" label="公积金">
<template #default="scope">
<el-input v-model="scope.row.reserveFund" placeholder="请输入公积金" clearable>
</el-input>
</template>
</el-table-column>
<el-table-column prop="socialSecurity" label="社保">
<template #default="scope">
<el-input v-model="scope.row.socialSecurity" placeholder="请输入社保" clearable>
</el-input>
</template>
</el-table-column>
<el-table-column prop="annuity" label="年金">
<template #default="scope">
<el-input v-model="scope.row.annuity" placeholder="请输入年金" clearable>
</el-input>
</template>
</el-table-column>
<el-table-column prop="workday" label="工作日(天)">
<template #default="scope">
<el-input v-model="scope.row.workday" placeholder="请输入工作日" clearable>
</el-input>
</template>
</el-table-column>
<el-table-column prop="researchDuration" label="研发时长(天)">
<template #default="scope">
<el-input v-model="scope.row.researchDuration" placeholder="请输入研发时长" clearable>
</el-input>
</template>
</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="操作">
<template #default="scope">
<el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 18px">复制</el-button>
<el-button type="primary" @click="handleDelete(scope.$index)" link style="font-size: 18px">删除</el-button>
</template>
</el-table-column>
</el-table>
<div style="width:100%;text-align: center;padding: 10px">
<el-button type="primary" @click="handleAdd" link style="font-size: 18px">添加一行</el-button>
</div>
<div class="oper-page-btn">
<el-button color="#DED0B2" @click="handleSubmit(form)">提交</el-button>
<el-button @click="handleBack">返回</el-button>
</div>
</div>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {useTagsView} from '@/stores/tagsview.js'
import {addAllocation, getAllocationDetail} from "@/api/expense-manage";
const rules = reactive({
shareName: [{required: true, message: '请输入分摊名称', trigger: 'blur'}],
apportionmentMonth: [{required: true, message: '请选择月份', trigger: 'blur'}]
})
const loading = ref(false)
const route = useRoute()
const router = useRouter()
const tagsViewStore = useTagsView()
const formData = ref({})
const form = ref()
const nameOptions = ref([
{
label: "某项目",
value: '2'
}
])
const researchOptions = ref([
{
label: "某人员",
value: '1'
}
])
const tableData = ref([
{
projectId: '',
projectName: '',
researchPersonnel: '',
wagesPayable: '',
performance: '',
reserveFund: '',
socialSecurity: '',
annuity: '',
workday: '',
researchDuration: '',
subtotal: '',
}
])
const handleAdd = () => {
let row = {
projectId: '',
projectName: '',
researchPersonnel: '',
wagesPayable: '',
performance: '',
reserveFund: '',
socialSecurity: '',
annuity: '',
workday: '',
researchDuration: '',
subtotal: '',
}
tableData.value.push(row)
}
const handleCopy = (row) => {
tableData.value.push(row)
}
const handleDelete = (index) => {
tableData.value.splice(index, 1)
}
const handleSubmit = (instance) => {
if (!instance) return
instance.validate(async (valid) => {
if (!valid) return
let params = {
...formData.value,
usrAllocations: tableData.value
}
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 getDetailInfo = async () => {
getAllocationDetail(12).then(res => {
ElNotification({
title: '提示',
message: res.msg,
type: res.code === 1000 ? 'success' : 'error'
})
if (res.code === 1000) {
formData.value = res.data.formData
loading.value = false
}
})
}
const handleBack = () => {
history.back()
}
onMounted(async () => {
// await init()
if (route.query.id) {
loading.value = true
await getDetailInfo()
}
})
</script>

View File

@@ -0,0 +1,48 @@
<template>
<expense-detail :formData="shareData.formData" :data="shareData" :showTable="showTable" :processViewer="shareProcessViewer"
:loading="loading"/>
</template>
<script setup lang="jsx">
import {ElNotification} from "element-plus";
import {useProcessStore} from '@/stores/processStore.js';
import {getAllocationDetail} from "@/api/expense-manage";
const processStore = useProcessStore()
const route = useRoute()
const shareData = ref({})
const shareProcessViewer = ref(true)
const showTable = ref(true)
const loading = ref(false)
const getDetail = async () => {
// const specialFundId = route.query.id
showTable.value = false
loading.value = true
const {code, data, msg} = await getAllocationDetail(12)
ElNotification({
title: '提示',
message: msg,
type: code === 1000 ? 'success' : 'error'
})
if (code === 1000) {
shareData.value = data
loading.value = false
nextTick(() => {
showTable.value = true
})
// if(data.operationList==null)return;
// processStore.setDesign(data)
// processStore.runningList.value = data.runningList;
// processStore.endList.value = data.endList;
// processStore.noTakeList.value = data.noTakeList;
// processStore.refuseList.value = data.refuseList;
// processStore.passList.value = data.passList;
}else {
loading.value = false
}
}
getDetail()
</script>
<style scoped>
</style>

View File

@@ -0,0 +1,153 @@
<template>
<fvSearchForm :searchConfig="searchConfig" @search="search"></fvSearchForm>
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick">
<template #empty>
<el-empty description="暂无数据"/>
</template>
</fvTable>
</template>
<script setup lang="jsx">
const router = useRouter();
const searchConfig = reactive([
{
label: '名称',
prop: 'projectName',
component: 'el-input',
props: {
placeholder: '请输入名称查询',
clearable: true,
filterable: true,
checkStrictly: true
}
},
{
label: '起始时间',
prop: 'time',
component: 'el-date-picker',
props: {
placeholder: '请选择起始时间',
clearable: true,
},
colProps: {}
},
])
const tableIns = ref()
const tableConfig = reactive({
columns: [
{
prop: 'requirementName',
label: '分摊名称',
align: 'center'
},
{
prop: 'collectType',
label: '分摊月份',
align: 'center'
},
{
prop: 'deadline',
label: '生成时间',
align: 'center'
},
{
prop: 'state',
label: '状态',
align: 'center',
width: 200,
showOverflowTooltip: false,
currentRender: ({row, index}) => (<Tag dictType={'demand_collection'} value={row.state}/>)
},
{
prop: 'oper',
label: '操作',
align: 'center',
showOverflowTooltip: false,
currentRender: ({row, index}) => {
let btn = []
let buttons = new Set(Array.from(row.buttons))
if (buttons.has("details")) {
btn.push({label: '详情', prem: ['mosr:requirement:info'], func: () => handleDetail(row), type: 'primary'})
}
if (buttons.has("edit")) {
btn.push({label: '编辑', prem: ['mosr:requirement:resubmit'], func: () => handleEdit(row), type: 'primary'})
}
// if (buttons.has("delete")) {
// btn.push({label: '删除',prem: ['mosr:requirement:del'], func: () => handleDelete(row), type: 'primary'})
// }
if (buttons.has("report")) {
btn.push({label: '明细导出', prem: ['mosr:requirement:info'], func: () => handleReport(row), type: 'primary'})
}
if (buttons.has("report")) {
btn.push({label: '汇总导出', prem: ['mosr:requirement:info'], func: () => handleReport(row), type: 'primary'})
}
return (
<div style={{width: '100%'}}>
{
btn.map(item => (
<el-button
type={item.type}
v-perm={item.prem}
onClick={() => item.func()}
link
>
{item.label}
</el-button>
))
}
{
buttons.has("delete") ?
<popover-delete name={row.requirementName} type={'费用分摊'} btnType={'danger'}
perm={['mosr:requirement:del']}
onDelete={() => handleDelete(row)}/> : ''
}
</div>
)
}
}
],
api: '',
btns: [
{name: '添加分摊', key: 'add', color: '#DED0B2'}
],
params: {}
})
const search = (val) => {
tableConfig.params = {...val}
tableIns.value.refresh()
}
const handleAdd = () => {
router.push({
name: 'Share/add',
query: {}
})
}
const handleDetail = (row) => {
router.push({
name: 'Share/detail',
query: {
id:row.id
}
})
}
const handleEdit = (row) => {
router.push({
name: 'Share/edit',
query: {
id:row.id
}
})
}
const headBtnClick = (key) => {
switch (key) {
case 'add':
handleAdd()
break;
}
}
</script>
<style scoped>
</style>