feat(expense-management): 新增费用分摊功能
This commit is contained in:
248
src/views/expense-management/cost-detail/index.vue
Normal file
248
src/views/expense-management/cost-detail/index.vue
Normal file
@@ -0,0 +1,248 @@
|
||||
<template>
|
||||
<fvSearchForm :searchConfig="searchConfig" @search="search" style="margin-left: 16px"></fvSearchForm>
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig">
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据"/>
|
||||
</template>
|
||||
</fvTable>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||
import {toThousands} from '@/utils/changePrice.js'
|
||||
import { getSubCompOpt } from '@/api/user/user.js';
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const searchConfig = ref([
|
||||
{
|
||||
label: '公司名称',
|
||||
prop: 'affiliatedCompanyIds',
|
||||
component: 'el-tree-select',
|
||||
props: {
|
||||
placeholder: '请输入公司名称查询',
|
||||
clearable: true,
|
||||
data: [],
|
||||
filterable: true,
|
||||
checkStrictly: true,
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '项目名称',
|
||||
prop: 'projectName',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入项目名称查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: '项目费用',
|
||||
prop: 'projectCost',
|
||||
component: shallowRef(fvSelect),
|
||||
props: {
|
||||
placeholder: '请选择项目费用查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
cacheKey: 'project_cost',
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '研发阶段',
|
||||
prop: 'researchStage',
|
||||
component: shallowRef(fvSelect),
|
||||
props: {
|
||||
placeholder: '请选择研发阶段查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true,
|
||||
cacheKey: 'fee_stage',
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: '时间',
|
||||
prop: 'time',
|
||||
component: 'el-date-picker',
|
||||
props: {
|
||||
placeholder: '请选择时间',
|
||||
clearable: true,
|
||||
type:'month',
|
||||
format: 'YYYY-MM',
|
||||
valueFormat:'YYYY-MM',
|
||||
},
|
||||
colProps: {}
|
||||
},
|
||||
{
|
||||
label: '税后余额',
|
||||
prop: 'afterTax',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入税后余额查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '摘要',
|
||||
prop: 'digest',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入摘要查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
])
|
||||
const tableIns = ref()
|
||||
const tableConfig = reactive({
|
||||
columns: [
|
||||
// {
|
||||
// prop: 'name',
|
||||
// type: 'index',
|
||||
// label: '序号',
|
||||
// align: 'center',
|
||||
// width:85,
|
||||
// index: index => {
|
||||
// return (tableIns.value.getQuery().pageNum - 1) * tableIns.value.getQuery().pageSize + index + 1
|
||||
// }
|
||||
// },
|
||||
{
|
||||
prop: 'affiliatedCompany',
|
||||
label: '支出年份',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'projectName',
|
||||
label: '月份',
|
||||
align: 'center'
|
||||
},
|
||||
|
||||
{
|
||||
prop: 'projectCost',
|
||||
label: '主项目',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.projectCost !== null&&row.projectCost !== null&&row.projectCost!==undefined) {
|
||||
return (<Tag dictType={'project_cost'} value={row.projectCost}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
prop: 'time',
|
||||
label: '子项目',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
prop: 'researchStage',
|
||||
label: '凭证日期',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.researchStage&&row.researchStage !== null&&row.researchStage!==undefined) {
|
||||
return (<Tag dictType={'research_stage'} value={row.researchStage}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '凭证号',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '分录号',
|
||||
align: 'center',
|
||||
currentRender:({row})=>{
|
||||
return <span>{toThousands(row.afterTax)}</span>
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '科目编码',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.source&&row.source !== null&&row.source!==undefined) {
|
||||
return (<Tag dictType={'ledger_source'} value={row.source}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '科目名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '辅助项',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '会计凭证记载金额(元)',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '归集研发费用金额(元)',
|
||||
align: 'center',
|
||||
},
|
||||
],
|
||||
api: '',
|
||||
params: {},
|
||||
export:{
|
||||
open :true,
|
||||
fileName:`科技创新费用支出明细.xlsx`
|
||||
}
|
||||
})
|
||||
const search = (val) => {
|
||||
tableConfig.params = {...val}
|
||||
tableIns.value.refresh()
|
||||
}
|
||||
const init = async () => {
|
||||
const res = await getSubCompOpt()
|
||||
searchConfig.value.find(item=>item.prop == 'affiliatedCompanyIds').props.data = res.data
|
||||
}
|
||||
|
||||
// init()
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.el-table__header) {
|
||||
.is-leaf:first-child {
|
||||
.cell {
|
||||
margin-left: -25px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table__body) {
|
||||
.el-table__cell:first-child {
|
||||
.cell {
|
||||
margin-left: -13px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.el-date-editor--month){
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
263
src/views/expense-management/expend-detail/index.vue
Normal file
263
src/views/expense-management/expend-detail/index.vue
Normal file
@@ -0,0 +1,263 @@
|
||||
<template>
|
||||
<fvSearchForm :searchConfig="searchConfig" @search="search" style="margin-left: 16px"></fvSearchForm>
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig">
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据"/>
|
||||
</template>
|
||||
</fvTable>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||
import {toThousands} from '@/utils/changePrice.js'
|
||||
import { getSubCompOpt } from '@/api/user/user.js';
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const searchConfig = ref([
|
||||
{
|
||||
label: '公司名称',
|
||||
prop: 'affiliatedCompanyIds',
|
||||
component: 'el-tree-select',
|
||||
props: {
|
||||
placeholder: '请输入公司名称查询',
|
||||
clearable: true,
|
||||
data: [],
|
||||
filterable: true,
|
||||
checkStrictly: true,
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '项目名称',
|
||||
prop: 'projectName',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入项目名称查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: '项目费用',
|
||||
prop: 'projectCost',
|
||||
component: shallowRef(fvSelect),
|
||||
props: {
|
||||
placeholder: '请选择项目费用查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
cacheKey: 'project_cost',
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '研发阶段',
|
||||
prop: 'researchStage',
|
||||
component: shallowRef(fvSelect),
|
||||
props: {
|
||||
placeholder: '请选择研发阶段查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true,
|
||||
cacheKey: 'fee_stage',
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: '时间',
|
||||
prop: 'time',
|
||||
component: 'el-date-picker',
|
||||
props: {
|
||||
placeholder: '请选择时间',
|
||||
clearable: true,
|
||||
type:'month',
|
||||
format: 'YYYY-MM',
|
||||
valueFormat:'YYYY-MM',
|
||||
},
|
||||
colProps: {}
|
||||
},
|
||||
{
|
||||
label: '税后余额',
|
||||
prop: 'afterTax',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入税后余额查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '摘要',
|
||||
prop: 'digest',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入摘要查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
])
|
||||
const tableIns = ref()
|
||||
const tableConfig = reactive({
|
||||
columns: [
|
||||
// {
|
||||
// prop: 'name',
|
||||
// type: 'index',
|
||||
// label: '序号',
|
||||
// align: 'center',
|
||||
// width:85,
|
||||
// index: index => {
|
||||
// return (tableIns.value.getQuery().pageNum - 1) * tableIns.value.getQuery().pageSize + index + 1
|
||||
// }
|
||||
// },
|
||||
{
|
||||
prop: 'affiliatedCompany',
|
||||
label: '支出年份',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'projectName',
|
||||
label: '月份',
|
||||
align: 'center'
|
||||
},
|
||||
|
||||
{
|
||||
prop: 'projectCost',
|
||||
label: '主项目',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.projectCost !== null&&row.projectCost !== null&&row.projectCost!==undefined) {
|
||||
return (<Tag dictType={'project_cost'} value={row.projectCost}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
prop: 'time',
|
||||
label: '子项目',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
prop: 'researchStage',
|
||||
label: '项目类型',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.researchStage&&row.researchStage !== null&&row.researchStage!==undefined) {
|
||||
return (<Tag dictType={'research_stage'} value={row.researchStage}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: 'RAD统计类型',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '付款流程类型',
|
||||
align: 'center',
|
||||
currentRender:({row})=>{
|
||||
return <span>{toThousands(row.afterTax)}</span>
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '流程状态',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.source&&row.source !== null&&row.source!==undefined) {
|
||||
return (<Tag dictType={'ledger_source'} value={row.source}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '归档时间',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '付款流程编号',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: '付款/请款事由',
|
||||
label: '来源',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '付款金额',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '合同编号',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '合同名称',
|
||||
align: 'center',
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '合同金额(元)',
|
||||
align: 'center',
|
||||
},
|
||||
],
|
||||
api: '',
|
||||
params: {},
|
||||
export:{
|
||||
open :true,
|
||||
fileName:`科技创新费用支出明细.xlsx`
|
||||
}
|
||||
})
|
||||
const search = (val) => {
|
||||
tableConfig.params = {...val}
|
||||
tableIns.value.refresh()
|
||||
}
|
||||
const init = async () => {
|
||||
const res = await getSubCompOpt()
|
||||
searchConfig.value.find(item=>item.prop == 'affiliatedCompanyIds').props.data = res.data
|
||||
}
|
||||
|
||||
// init()
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.el-table__header) {
|
||||
.is-leaf:first-child {
|
||||
.cell {
|
||||
margin-left: -25px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table__body) {
|
||||
.el-table__cell:first-child {
|
||||
.cell {
|
||||
margin-left: -13px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.el-date-editor--month){
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
551
src/views/expense-management/share-detail/add.vue
Normal file
551
src/views/expense-management/share-detail/add.vue
Normal file
@@ -0,0 +1,551 @@
|
||||
<template>
|
||||
<div v-loading="loading" style="padding: 0 30px">
|
||||
<el-form :model="formData" ref="form" :rules="rules" style="margin-left: 5px;margin-top: 18px">
|
||||
<el-row :gutter="30">
|
||||
<!-- <el-col :span="6" style="margin-left: -15px">-->
|
||||
<!-- <el-form-item label="分摊名称" prop="shareName" >-->
|
||||
<!-- <el-input v-model="formData.shareName" placeholder="请输入分摊名称" clearable>-->
|
||||
<!-- </el-input>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<el-col :span="6" style="margin-left: -10px">
|
||||
<el-form-item label="分摊月份" prop="apportionmentMonth" label-width="80">
|
||||
<el-date-picker
|
||||
v-model="formData.apportionmentMonth"
|
||||
type="month"
|
||||
format="YYYY-MM"
|
||||
value-format="YYYY-MM"
|
||||
placeholder="选择月"
|
||||
>
|
||||
</el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="3" >
|
||||
<el-button color="#DED0B2" @click="handleAdd" style="font-size: 16px">添加一行</el-button>
|
||||
</el-col>
|
||||
<el-table v-if="showTable" :data="formData.tableData" style="width: 100%">
|
||||
<el-table-column prop="projectId" label="项目名称" min-width="230">
|
||||
<template #default="scope">
|
||||
<el-form-item prop="time" :rules="scope.row.projectId?'1':rules.projectId">
|
||||
<el-select v-model="scope.row.projectId" placeholder="请选择项目名称" clearable filterable @change="selectProject(scope.row,scope.$index)">
|
||||
<el-option
|
||||
v-for="item in nameOptions"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="researchPersonnelId" label="研发人员" min-width="180">
|
||||
<template #default="scope">
|
||||
<el-form-item prop="researchPersonnelId">
|
||||
{{ scope.row.researchPersonnel }}
|
||||
<el-button color="#DED0B2" @click="showPersonnelPicker(scope.row,scope.$index)"
|
||||
style="margin-left: 10px">
|
||||
{{ scope.row.researchPersonnel ? '更改' : '请选择研发人员' }}
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="wagesPayable" label="当月总工时(天)" min-width="175">
|
||||
<template #default="scope">
|
||||
<el-form-item prop="time" :rules="scope.row.wagesPayable?'1':rules.wagesPayable">
|
||||
<div>21.75</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="researchDuration" label="当月研发工时(天)" min-width="175">
|
||||
<template #default="scope">
|
||||
<el-form-item prop="time" :rules="scope.row.researchDuration?'1':rules.researchDuration">
|
||||
<el-input-number v-model="scope.row.researchDuration" placeholder="请输入当月研发工时" :controls="false"/>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="oper" label="操作" min-width="130">
|
||||
<template #default="scope">
|
||||
<el-button type="primary" @click="handleCopy(scope.row)" link style="font-size: 16px">复制</el-button>
|
||||
<el-button type="primary" @click="handleDelete(scope.$index)" link style="font-size: 16px">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<user-picker :multiple="false" ref="userPicker" title="请选择研发人员" v-model:value="userList"
|
||||
@ok="selectedResearchPersonnel" @cancelOrClear="researchPersonnelPickerCancel"
|
||||
:setNullToSelectList="true" :isResearch="true"/>
|
||||
|
||||
|
||||
<div class="oper-page-btn">
|
||||
<el-button color="#DED0B2" v-if="routerName==='Sharedetail/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>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import {ElNotification} from "element-plus";
|
||||
import {useTagsView} from '@/stores/tagsview.js'
|
||||
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 OperationRender from '@/views/workflow/common/OperationRender.vue'
|
||||
import UserPicker from "@/views/workflow/process/common/UserPicker.vue";
|
||||
localStorage.removeItem('originallySelectedList')
|
||||
|
||||
const userList = ref([])
|
||||
const changeDiagram = ref(false)
|
||||
const rules = reactive({
|
||||
shareName: [{required: true, message: '请输入分摊名称', trigger: ['blur', 'change']}],
|
||||
apportionmentMonth: [{required: true, message: '请选择月份', trigger: ['blur', 'change']}],
|
||||
projectId: [{required: true, message: '请选择项目名称', trigger: ['blur', 'change']}],
|
||||
// researchPersonnelId: [{required: true, message: '请选择研发人员', trigger: ['blur', 'change']}],
|
||||
wagesPayable: [{required: true, message: '请输入应发工资', trigger: ['blur', 'change']}],
|
||||
performance: [{required: true, message: '请输入绩效', trigger: ['blur', 'change']}],
|
||||
reserveFund: [{required: true, message: '请输入公积金', trigger: ['blur', 'change']}],
|
||||
socialSecurity: [{required: true, message: '请输入社保', trigger: ['blur', 'change']}],
|
||||
annuity: [{required: true, message: '请输入年金', trigger: ['blur', 'change']}],
|
||||
workday: [{required: true, message: '请输入工作日', trigger: ['blur', 'change']}],
|
||||
researchDuration: [{required: true, message: '请输入研发时长', trigger: ['blur', 'change']}],
|
||||
})
|
||||
const processStore = useProcessStore()
|
||||
const opentionData = ref({})
|
||||
const processInstanceData = ref()
|
||||
const processDiagramViewer = ref(false)
|
||||
const loading = ref(false)
|
||||
const isRepeatResearchPersonnel = ref(false)
|
||||
const showTable = ref(true)
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
const routerName = ref(router.currentRoute.value.name)
|
||||
const tagsViewStore = useTagsView()
|
||||
const formData = ref({
|
||||
tableData: [
|
||||
{
|
||||
projectId: '',
|
||||
projectName: '',
|
||||
researchPersonnelId: '',
|
||||
wagesPayable: null,
|
||||
performance: null,
|
||||
reserveFund: null,
|
||||
socialSecurity: null,
|
||||
annuity: null,
|
||||
workday: '21.75',
|
||||
researchDuration: null,
|
||||
}
|
||||
]
|
||||
})
|
||||
const userPicker = ref()
|
||||
const form = ref()
|
||||
const currentReachPerson = ref({})
|
||||
const currentRow = ref()
|
||||
const currentIndex = ref()
|
||||
const nameOptions = ref([])
|
||||
const researchOptions = ref([])
|
||||
const showPersonnelPicker = (row, index) => {
|
||||
currentRow.value = row
|
||||
currentIndex.value = index
|
||||
if (row.companyName&&row.researchPersonnelId) {
|
||||
let userObj = {
|
||||
id: row.researchPersonnelId,
|
||||
name: row.researchPersonnel,
|
||||
companyName: row.companyName,
|
||||
accountType: row.accountType,
|
||||
}
|
||||
userList.value = [userObj]
|
||||
} else if (!row.researchPersonnel) {
|
||||
userList.value = []
|
||||
}
|
||||
nextTick(() => {
|
||||
userPicker.value.showUserPicker()
|
||||
})
|
||||
}
|
||||
const selectProject=(row,index)=>{
|
||||
console.log('row,index',row,index)
|
||||
//先选择人员, 再选择项目: 再添加一行,重复操作
|
||||
const projectIdArray = formData.value.tableData.map(item => item.projectId)
|
||||
const researchPersonnelIdArray = formData.value.tableData.map(item => item.researchPersonnelId)
|
||||
// console.log('projectIdArray',projectIdArray)
|
||||
// console.log('researchPersonnelIdArray',researchPersonnelIdArray)
|
||||
const projectNumObj = getSelectProjectAndResearchPersonnelNum(projectIdArray)
|
||||
const researchPersonnelNumObj = getSelectProjectAndResearchPersonnelNum(researchPersonnelIdArray)
|
||||
let repeatProjectName=getProjectName(row.projectId)
|
||||
// console.log('currentRow.value',currentRow.value)
|
||||
for (let researchPersonnelIdKey in researchPersonnelNumObj) {//先判断人员是否重复
|
||||
if(currentRow.value.projectId){
|
||||
if(researchPersonnelNumObj[researchPersonnelIdKey]>1){
|
||||
ElNotification({
|
||||
title: '警告',
|
||||
message: `${repeatProjectName} 项目下,同一个研发人员不能分摊多次!`,
|
||||
type: 'warning',
|
||||
})
|
||||
row.researchPersonnelId = ''
|
||||
row.researchPersonnel = ''
|
||||
row.companyName = ''
|
||||
row.accountType = ''
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
// for (let projectIdKey in projectNumObj) {
|
||||
// // console.log('projectNumObjKey', projectIdKey, projectNumObj[projectIdKey])
|
||||
// if(projectNumObj[projectIdKey]>1){
|
||||
// // console.log('getProjectName(projectIdKey)',getProjectName(projectIdKey))
|
||||
// repeatProjectName=getProjectName(projectIdKey)
|
||||
//
|
||||
// }
|
||||
// }
|
||||
}
|
||||
const researchPersonnelPickerCancel = (select) => {
|
||||
console.log('select',select)
|
||||
if(select.length>0){
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = select[0].id
|
||||
item.researchPersonnel = select[0].name
|
||||
item.companyName = select[0].companyName
|
||||
item.accountType = select[0].accountType
|
||||
}
|
||||
})
|
||||
}else{
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = ''
|
||||
item.researchPersonnel = ''
|
||||
item.companyName = ''
|
||||
item.accountType = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
const selectedResearchPersonnel = (select) => {
|
||||
if(select.length>0){
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = select[0].id
|
||||
item.researchPersonnel = select[0].name
|
||||
item.companyName = select[0].companyName
|
||||
item.accountType = select[0].accountType
|
||||
}
|
||||
})
|
||||
}else{
|
||||
formData.value.tableData?.forEach((item, index) => {
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = ''
|
||||
item.researchPersonnel = ''
|
||||
item.companyName = ''
|
||||
item.accountType = ''
|
||||
}
|
||||
})
|
||||
}
|
||||
//以下是为" 同一项目下,同一人不能分摊多次 "
|
||||
const projectIdArray = formData.value.tableData?.map(item => item.projectId)
|
||||
const researchPersonnelIdArray = formData.value.tableData?.map(item => item.researchPersonnelId)
|
||||
const projectNumObj = getSelectProjectAndResearchPersonnelNum(projectIdArray)
|
||||
const researchPersonnelNumObj = getSelectProjectAndResearchPersonnelNum(researchPersonnelIdArray)
|
||||
let repeatProjectName=''
|
||||
for (let projectIdKey in projectNumObj) {
|
||||
// console.log('projectNumObjKey', projectIdKey, projectNumObj[projectIdKey])
|
||||
if(projectNumObj[projectIdKey]>1){
|
||||
// console.log('getProjectName(projectIdKey)',getProjectName(projectIdKey))
|
||||
repeatProjectName=getProjectName(projectIdKey)
|
||||
}
|
||||
}
|
||||
for (let researchPersonnelIdKey in researchPersonnelNumObj) {
|
||||
// console.log('researchPersonnelIdKey', researchPersonnelIdKey, researchPersonnelNumObj[researchPersonnelIdKey])
|
||||
if(researchPersonnelNumObj[researchPersonnelIdKey]>1&&repeatProjectName&¤tRow.value.projectId){
|
||||
isRepeatResearchPersonnel.value=true
|
||||
ElNotification({
|
||||
title: '警告',
|
||||
message: `${repeatProjectName} 项目下,同一个研发人员不能分摊多次!`,
|
||||
type: 'warning',
|
||||
})
|
||||
formData.value.tableData.forEach((item,index)=>{
|
||||
if (index === currentIndex.value) {
|
||||
item.researchPersonnelId = ''
|
||||
item.researchPersonnel = ''
|
||||
item.companyName = ''
|
||||
item.accountType = ''
|
||||
}
|
||||
})
|
||||
}else{
|
||||
userList.value = select
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* 获取一个项目/研发人员的选择次数
|
||||
* @param projectIdArray
|
||||
* @returns {{}}
|
||||
*/
|
||||
const getSelectProjectAndResearchPersonnelNum = (projectIdArray) => {
|
||||
const obj = {};
|
||||
for (let i = 0, l = projectIdArray.length; i < l; i++) {
|
||||
const item = projectIdArray[i];
|
||||
obj[item] = (obj[item] + 1) || 1;
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
const getResearchOptions = async () => {
|
||||
const res = await getResearchUser()
|
||||
researchOptions.value = res.data
|
||||
}
|
||||
const getProjectOptions = async () => {
|
||||
const res = await getProjectOption()
|
||||
nameOptions.value = res.data
|
||||
}
|
||||
const getProjectName = (id) => {
|
||||
let label = ''
|
||||
nameOptions.value.forEach(item => {
|
||||
if (item.value == id) {
|
||||
label = item.label
|
||||
}
|
||||
})
|
||||
return label
|
||||
}
|
||||
const handleAdd = () => {
|
||||
let row = {
|
||||
projectId: '',
|
||||
projectName: '',
|
||||
researchPersonnelId: '',
|
||||
researchPersonnel: '',
|
||||
wagesPayable: null,
|
||||
performance: null,
|
||||
reserveFund: null,
|
||||
socialSecurity: null,
|
||||
annuity: null,
|
||||
workday: '21.75',
|
||||
researchDuration: null,
|
||||
}
|
||||
currentReachPerson.value.name = ''
|
||||
formData.value.tableData.push(row)
|
||||
}
|
||||
const handleCopy = (row) => {
|
||||
let copyObj = {
|
||||
projectId: row.projectId,
|
||||
projectName: '',
|
||||
// accountType: row.accountType,
|
||||
// companyName: row.companyName,
|
||||
// researchPersonnelId: row.researchPersonnelId,
|
||||
// researchPersonnel: row.researchPersonnel,
|
||||
wagesPayable: row.wagesPayable,
|
||||
performance: row.performance,
|
||||
reserveFund: row.reserveFund,
|
||||
socialSecurity: row.socialSecurity,
|
||||
annuity: row.annuity,
|
||||
workday: '21.75',
|
||||
researchDuration: row.researchDuration,
|
||||
}
|
||||
formData.value.tableData.push(copyObj)
|
||||
}
|
||||
const handleDelete = (index) => {
|
||||
formData.value.tableData.splice(index, 1)
|
||||
}
|
||||
const handleSubmit = (instance) => {
|
||||
console.log('tableData', formData.value.tableData)
|
||||
if (!instance) return
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '请完善数据,再提交!',
|
||||
type: 'error'
|
||||
})
|
||||
return;
|
||||
}
|
||||
let researchPersonnelId = ''
|
||||
formData.value.tableData.forEach(item => {
|
||||
item.projectName = getProjectName(item.projectId)
|
||||
researchPersonnelId = item.researchPersonnelId
|
||||
if (item.performance == 0) {
|
||||
item.performance = null
|
||||
}
|
||||
})
|
||||
if (!researchPersonnelId) {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '请选择研发人员',
|
||||
type: 'error'
|
||||
})
|
||||
return;
|
||||
}
|
||||
let params = {
|
||||
shareName: formData.value.shareName,
|
||||
apportionmentMonth: formData.value.apportionmentMonth,
|
||||
usrAllocations: formData.value.tableData,
|
||||
deploymentId: processInstanceData.value.deploymentId,
|
||||
}
|
||||
console.log('params', params, formData.value.tableData)
|
||||
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 handleResubmit = (instance) => {
|
||||
if (!instance) return
|
||||
instance.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '请完善数据,再提交!',
|
||||
type: 'error'
|
||||
})
|
||||
return;
|
||||
}
|
||||
let researchPersonnelId = ''
|
||||
formData.value.tableData.forEach(item => {
|
||||
item.allocationId = formData.value.allocationId
|
||||
item.projectName = getProjectName(item.projectId)
|
||||
researchPersonnelId = item.researchPersonnelId
|
||||
if (item.performance == 0) {
|
||||
item.performance = null
|
||||
}
|
||||
})
|
||||
if (!researchPersonnelId) {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: '请选择研发人员',
|
||||
type: 'error'
|
||||
})
|
||||
return;
|
||||
}
|
||||
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, formData.value.tableData)
|
||||
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 = () => {
|
||||
loading.value = true
|
||||
getAllocationDetail(route.query.id).then(res => {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: res.code === 1000 ? 'success' : 'error'
|
||||
})
|
||||
if (res.code === 1000) {
|
||||
getDetailList()
|
||||
formData.value = res.data.formData
|
||||
opentionData.value = res.data
|
||||
loading.value = false
|
||||
}
|
||||
})
|
||||
}
|
||||
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.researchPersonnelId = Number(item.researchPersonnelId)
|
||||
})
|
||||
formData.value.tableData = data.rows
|
||||
nextTick(() => {
|
||||
showTable.value = true
|
||||
})
|
||||
} else {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
const init = async () => {
|
||||
processDiagramViewer.value = false
|
||||
await getResearchOptions()
|
||||
await getProjectOptions()
|
||||
getAllocationProcess().then(res => {
|
||||
if (res.code === 1000) {
|
||||
let data = res.data
|
||||
processInstanceData.value = data
|
||||
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;
|
||||
nextTick(() => {
|
||||
processDiagramViewer.value = true
|
||||
})
|
||||
} else {
|
||||
ElNotification({
|
||||
title: '提示',
|
||||
message: res.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
const handleBack = () => {
|
||||
history.back()
|
||||
}
|
||||
onMounted(() => {
|
||||
init()
|
||||
if (route.query.id) {
|
||||
getDetailInfo()
|
||||
}
|
||||
})
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.el-table--enable-row-transition) {
|
||||
.el-table__body td.el-table__cell {
|
||||
.cell {
|
||||
.el-form-item {
|
||||
margin-top: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.el-date-editor--month){
|
||||
width: 100%!important;
|
||||
}
|
||||
:deep(.el-input-number) {
|
||||
width: 100%;
|
||||
|
||||
.el-input__inner {
|
||||
text-align: left;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
249
src/views/expense-management/share-detail/index.vue
Normal file
249
src/views/expense-management/share-detail/index.vue
Normal file
@@ -0,0 +1,249 @@
|
||||
<template>
|
||||
<fvSearchForm :searchConfig="searchConfig" @search="search" style="margin-left: 16px"></fvSearchForm>
|
||||
<fvTable ref="tableIns" :tableConfig="tableConfig" @headBtnClick="headBtnClick">
|
||||
<template #empty>
|
||||
<el-empty description="暂无数据"/>
|
||||
</template>
|
||||
</fvTable>
|
||||
</template>
|
||||
|
||||
<script setup lang="jsx">
|
||||
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||
import {toThousands} from '@/utils/changePrice.js'
|
||||
import { getSubCompOpt } from '@/api/user/user.js';
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
const searchConfig = ref([
|
||||
{
|
||||
label: '公司名称',
|
||||
prop: 'affiliatedCompanyIds',
|
||||
component: 'el-tree-select',
|
||||
props: {
|
||||
placeholder: '请输入公司名称查询',
|
||||
clearable: true,
|
||||
data: [],
|
||||
filterable: true,
|
||||
checkStrictly: true,
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '项目名称',
|
||||
prop: 'projectName',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入项目名称查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: '项目费用',
|
||||
prop: 'projectCost',
|
||||
component: shallowRef(fvSelect),
|
||||
props: {
|
||||
placeholder: '请选择项目费用查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
cacheKey: 'project_cost',
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '研发阶段',
|
||||
prop: 'researchStage',
|
||||
component: shallowRef(fvSelect),
|
||||
props: {
|
||||
placeholder: '请选择研发阶段查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true,
|
||||
cacheKey: 'fee_stage',
|
||||
remote: true
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
label: '时间',
|
||||
prop: 'time',
|
||||
component: 'el-date-picker',
|
||||
props: {
|
||||
placeholder: '请选择时间',
|
||||
clearable: true,
|
||||
type:'month',
|
||||
format: 'YYYY-MM',
|
||||
valueFormat:'YYYY-MM',
|
||||
},
|
||||
colProps: {}
|
||||
},
|
||||
{
|
||||
label: '税后余额',
|
||||
prop: 'afterTax',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入税后余额查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
{
|
||||
label: '摘要',
|
||||
prop: 'digest',
|
||||
component: 'el-input',
|
||||
props: {
|
||||
placeholder: '请输入摘要查询',
|
||||
clearable: true,
|
||||
filterable: true,
|
||||
checkStrictly: true
|
||||
}
|
||||
},
|
||||
])
|
||||
const tableIns = ref()
|
||||
const tableConfig = reactive({
|
||||
columns: [
|
||||
// {
|
||||
// prop: 'name',
|
||||
// type: 'index',
|
||||
// label: '序号',
|
||||
// align: 'center',
|
||||
// width:85,
|
||||
// index: index => {
|
||||
// return (tableIns.value.getQuery().pageNum - 1) * tableIns.value.getQuery().pageSize + index + 1
|
||||
// }
|
||||
// },
|
||||
{
|
||||
prop: 'affiliatedCompany',
|
||||
label: '支出年份',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'projectName',
|
||||
label: '月份',
|
||||
align: 'center'
|
||||
},
|
||||
|
||||
{
|
||||
prop: 'projectCost',
|
||||
label: '主项目',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.projectCost !== null&&row.projectCost !== null&&row.projectCost!==undefined) {
|
||||
return (<Tag dictType={'project_cost'} value={row.projectCost}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
prop: 'time',
|
||||
label: '子项目',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
},
|
||||
{
|
||||
prop: 'researchStage',
|
||||
label: '研发人员',
|
||||
align: 'center',
|
||||
width: 120,
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.researchStage&&row.researchStage !== null&&row.researchStage!==undefined) {
|
||||
return (<Tag dictType={'research_stage'} value={row.researchStage}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '人员性质',
|
||||
align: 'center'
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '当月研发工时(天)',
|
||||
align: 'center',
|
||||
currentRender:({row})=>{
|
||||
return <span>{toThousands(row.afterTax)}</span>
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '当月总工时(天)',
|
||||
align: 'center',
|
||||
showOverflowTooltip: false,
|
||||
currentRender: ({row, index}) => {
|
||||
if (row.source&&row.source !== null&&row.source!==undefined) {
|
||||
return (<Tag dictType={'ledger_source'} value={row.source}/>)
|
||||
} else {
|
||||
return '--'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
prop: 'digest',
|
||||
label: '人工成本分摊(元)',
|
||||
align: 'center',
|
||||
},
|
||||
|
||||
],
|
||||
api: '',
|
||||
params: {},
|
||||
btns: [
|
||||
{name: '添加分摊', key: 'add', color: '#DED0B2'}
|
||||
],
|
||||
export:{
|
||||
open :false,
|
||||
}
|
||||
})
|
||||
const search = (val) => {
|
||||
tableConfig.params = {...val}
|
||||
tableIns.value.refresh()
|
||||
}
|
||||
const headBtnClick = (key) => {
|
||||
switch (key) {
|
||||
case 'add':
|
||||
handleAdd()
|
||||
break;
|
||||
}
|
||||
}
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
name: 'Sharedetail/add',
|
||||
query: {}
|
||||
})
|
||||
}
|
||||
const init = async () => {
|
||||
const res = await getSubCompOpt()
|
||||
searchConfig.value.find(item=>item.prop == 'affiliatedCompanyIds').props.data = res.data
|
||||
}
|
||||
|
||||
// init()
|
||||
|
||||
</script>
|
||||
<style scoped lang="scss">
|
||||
:deep(.el-table__header) {
|
||||
.is-leaf:first-child {
|
||||
.cell {
|
||||
margin-left: -25px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.el-table__body) {
|
||||
.el-table__cell:first-child {
|
||||
.cell {
|
||||
margin-left: -13px !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
:deep(.el-date-editor--month){
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user