添加基础表维护
This commit is contained in:
@@ -62,13 +62,7 @@
|
||||
highlight-current-row
|
||||
@current-change="handleCurrentProfitChange"
|
||||
>
|
||||
<el-table-column
|
||||
align="center"
|
||||
label="工程名称"
|
||||
min-width="220"
|
||||
prop="projectName"
|
||||
show-overflow-tooltip
|
||||
/>
|
||||
<el-table-column align="center" label="工程名称" min-width="220" prop="projectName" />
|
||||
<el-table-column align="center" label="是否签约" width="100">
|
||||
<template #default="scope">
|
||||
<el-tag :type="scope.row.contractSignedFlag ? 'success' : 'info'">
|
||||
@@ -102,16 +96,26 @@
|
||||
{{ formatAmountText(scope.row.majorOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="预计 K 值" width="100">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.expectedKValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="专业所预计绩效(元)" width="150">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.majorExpectedPerformance) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="科创产值比例" width="110">
|
||||
<template #default="scope">
|
||||
{{ formatPercentText(scope.row.innovationOutputRate) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="科创产值(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.innovationOutputValue) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="其他成本(元)" width="130">
|
||||
<template #default="scope">
|
||||
{{ formatAmountText(scope.row.otherCost) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" label="盈亏值(元)" width="120">
|
||||
<template #default="scope">
|
||||
<span :class="profitLossClass(scope.row.profitLossValue)">
|
||||
@@ -137,19 +141,11 @@
|
||||
|
||||
<ContentWrap v-if="currentProfit">
|
||||
<div class="mb-16px flex items-center justify-between gap-16px">
|
||||
<div>
|
||||
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
|
||||
</div>
|
||||
<div class="flex items-center gap-12px">
|
||||
<el-button plain type="primary" @click="openProfitEditDialog">
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑盈亏参数
|
||||
</el-button>
|
||||
<el-button @click="refreshCurrentProfit">
|
||||
<Icon class="mr-5px" icon="ep:refresh" />
|
||||
刷新详情
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="text-16px font-600">{{ currentProfit.projectName }}</div>
|
||||
<el-button plain type="primary" @click="openProfitEditDialog">
|
||||
<Icon class="mr-5px" icon="ep:edit" />
|
||||
编辑盈亏参数
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-descriptions :column="3" border>
|
||||
@@ -171,12 +167,18 @@
|
||||
<el-descriptions-item label="专业所产值(元)">
|
||||
{{ formatAmountText(currentProfit.majorOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="预计 K 值">
|
||||
{{ formatPercentText(currentProfit.expectedKValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="专业所预计绩效(元)">
|
||||
{{ formatAmountText(currentProfit.majorExpectedPerformance) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值比例">
|
||||
{{ formatPercentText(currentProfit.innovationOutputRate) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="科创产值(元)">
|
||||
{{ formatAmountText(currentProfit.innovationOutputValue) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="其他成本(元)">
|
||||
{{ formatAmountText(currentProfit.otherCost) }}
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="盈亏值(元)">
|
||||
<span :class="profitLossClass(currentProfit.profitLossValue)">
|
||||
{{ formatAmountText(currentProfit.profitLossValue) }}
|
||||
@@ -187,9 +189,6 @@
|
||||
{{ formatPercentText(currentProfit.profitLossRate) }}
|
||||
</span>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="创建时间">
|
||||
{{ currentProfit.createTime || '-' }}
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</ContentWrap>
|
||||
|
||||
@@ -198,7 +197,7 @@
|
||||
</ContentWrap>
|
||||
|
||||
<Dialog v-model="dialogVisible" title="编辑盈亏参数" width="520">
|
||||
<el-form ref="formRef" v-loading="dialogLoading" :model="formData" :rules="formRules" label-width="140px">
|
||||
<el-form ref="formRef" v-loading="dialogLoading" :model="formData" label-width="140px">
|
||||
<el-form-item label="最终结算金额(元)" prop="finalSettlementAmount">
|
||||
<el-input-number
|
||||
v-model="formData.finalSettlementAmount"
|
||||
@@ -209,17 +208,29 @@
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="预计 K 值(%)" prop="expectedKValue">
|
||||
<el-form-item label="科创产值比例(%)" prop="innovationOutputRate">
|
||||
<el-input-number
|
||||
v-model="expectedKValuePercent"
|
||||
v-model="innovationOutputRatePercent"
|
||||
:min="0"
|
||||
:max="100"
|
||||
:precision="2"
|
||||
:step="0.01"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他成本(元)" prop="otherCost">
|
||||
<el-input-number
|
||||
v-model="formData.otherCost"
|
||||
:min="0"
|
||||
:precision="2"
|
||||
:step="1000"
|
||||
class="!w-1/1"
|
||||
controls-position="right"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<el-button :disabled="dialogLoading" type="primary" @click="submitProfitForm">保存</el-button>
|
||||
<el-button @click="dialogVisible = false">取消</el-button>
|
||||
@@ -228,11 +239,11 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import type { FormRules } from 'element-plus'
|
||||
import * as ProfitApi from '@/api/tjt/profit'
|
||||
import * as ProjectApi from '@/api/tjt/project'
|
||||
import {
|
||||
CONTRACT_SIGN_OPTIONS,
|
||||
DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
formatAmountText,
|
||||
formatPercentText,
|
||||
fromPercentValue,
|
||||
@@ -256,17 +267,25 @@ const dialogLoading = ref(false)
|
||||
const formRef = ref()
|
||||
const formData = ref<ProjectApi.ProjectVO>({
|
||||
projectName: '',
|
||||
contractSignedFlag: true
|
||||
contractSignedFlag: true,
|
||||
innovationOutputRate: DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
otherCost: 0,
|
||||
rolePersons: []
|
||||
})
|
||||
|
||||
const expectedKValuePercent = computed({
|
||||
get: () => toPercentValue(formData.value.expectedKValue),
|
||||
const innovationOutputRatePercent = computed({
|
||||
get: () => toPercentValue(formData.value.innovationOutputRate),
|
||||
set: (value) => {
|
||||
formData.value.expectedKValue = fromPercentValue(value)
|
||||
formData.value.innovationOutputRate = fromPercentValue(value)
|
||||
}
|
||||
})
|
||||
|
||||
const formRules = reactive<FormRules>({})
|
||||
const normalizeProjectFormData = (data: ProjectApi.ProjectVO): ProjectApi.ProjectVO => ({
|
||||
...data,
|
||||
innovationOutputRate: data.innovationOutputRate ?? DEFAULT_INNOVATION_OUTPUT_RATE,
|
||||
otherCost: data.otherCost ?? 0,
|
||||
rolePersons: data.rolePersons || []
|
||||
})
|
||||
|
||||
const queryParams = reactive<ProfitApi.ProjectProfitPageReqVO>({
|
||||
pageNo: 1,
|
||||
@@ -294,8 +313,7 @@ const getList = async () => {
|
||||
return
|
||||
}
|
||||
const targetProjectId = currentProfit.value?.projectId || list.value[0].projectId
|
||||
const targetProfit =
|
||||
list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
|
||||
const targetProfit = list.value.find((item) => item.projectId === targetProjectId) || list.value[0]
|
||||
await nextTick()
|
||||
profitTableRef.value?.setCurrentRow(targetProfit)
|
||||
} finally {
|
||||
@@ -336,7 +354,7 @@ const openProfitEditDialog = async () => {
|
||||
dialogVisible.value = true
|
||||
dialogLoading.value = true
|
||||
try {
|
||||
formData.value = await ProjectApi.getProject(currentProfit.value.projectId)
|
||||
formData.value = normalizeProjectFormData(await ProjectApi.getProject(currentProfit.value.projectId))
|
||||
} finally {
|
||||
dialogLoading.value = false
|
||||
}
|
||||
@@ -352,22 +370,19 @@ const buildProjectSavePayload = (): ProjectApi.ProjectSaveVO => ({
|
||||
contactName: formData.value.contactName,
|
||||
contactPhone: formData.value.contactPhone,
|
||||
contractSigningDate: formData.value.contractSigningDate,
|
||||
projectManagerName: formData.value.projectManagerName,
|
||||
engineeringPrincipalName: formData.value.engineeringPrincipalName,
|
||||
projectType: formData.value.projectType,
|
||||
projectCategory: formData.value.projectCategory,
|
||||
projectStartYear: formData.value.projectStartYear,
|
||||
projectStatus: formData.value.projectStatus,
|
||||
pauseReason: formData.value.pauseReason,
|
||||
terminateReason: formData.value.terminateReason,
|
||||
finalSettlementAmount: formData.value.finalSettlementAmount,
|
||||
expectedKValue: formData.value.expectedKValue
|
||||
innovationOutputRate: formData.value.innovationOutputRate,
|
||||
otherCost: formData.value.otherCost,
|
||||
rolePersons: formData.value.rolePersons || []
|
||||
})
|
||||
|
||||
const submitProfitForm = async () => {
|
||||
if (!formRef.value) {
|
||||
return
|
||||
}
|
||||
const valid = await formRef.value.validate()
|
||||
if (!valid) {
|
||||
return
|
||||
}
|
||||
dialogLoading.value = true
|
||||
try {
|
||||
await ProjectApi.updateProject(buildProjectSavePayload())
|
||||
|
||||
Reference in New Issue
Block a user