修复估值模型
Showing
3 changed files
with
54 additions
and
26 deletions
| ... | @@ -396,6 +396,10 @@ | ... | @@ -396,6 +396,10 @@ |
| 396 | background-color: var(--el-table-current-row-bg-color); | 396 | background-color: var(--el-table-current-row-bg-color); |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | thead.is-group th.el-table__cell { | ||
| 400 | background-color: var(--el-table-header-bg-color); | ||
| 401 | } | ||
| 402 | |||
| 399 | &--border { | 403 | &--border { |
| 400 | 404 | ||
| 401 | .el-table__header, | 405 | .el-table__header, | ... | ... |
| ... | @@ -586,11 +586,11 @@ const visibleChange = (visible, row) => { | ... | @@ -586,11 +586,11 @@ const visibleChange = (visible, row) => { |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | const panelChange = (scope, row) => { | 588 | const panelChange = (scope, row) => { |
| 589 | if (row.field == 'baseDate' || row.field == 'investYear') { | 589 | if (row.field == 'evaluateBaseDate' || row.field == 'baseDate' || row.field == 'investYear') { |
| 590 | const date = new Date(); | 590 | const date = new Date(); |
| 591 | const year = date.getFullYear(); | 591 | const year = date.getFullYear(); |
| 592 | const datePopperNextBtn = document.querySelector('.date-month-popper .d-arrow-right'); | 592 | const datePopperNextBtn = document.querySelector('.date-month-popper .d-arrow-right'); |
| 593 | if (row.field == 'baseDate') { | 593 | if (row.field == 'baseDate' || row.field == 'evaluateBaseDate') { |
| 594 | const currentYear = scope.date.getFullYear(); | 594 | const currentYear = scope.date.getFullYear(); |
| 595 | if (currentYear >= year) { | 595 | if (currentYear >= year) { |
| 596 | datePopperNextBtn.setAttribute("disabled", ''); | 596 | datePopperNextBtn.setAttribute("disabled", ''); |
| ... | @@ -1463,7 +1463,7 @@ const panelChange = (scope, row) => { | ... | @@ -1463,7 +1463,7 @@ const panelChange = (scope, row) => { |
| 1463 | @panel-change="(date, mode) => panelChange({ date, mode }, item)" | 1463 | @panel-change="(date, mode) => panelChange({ date, mode }, item)" |
| 1464 | @visible-change="(vis) => visibleChange(vis, item)" /> | 1464 | @visible-change="(vis) => visibleChange(vis, item)" /> |
| 1465 | <el-date-picker :class="[item.col, { is_block: item.block }]" v-else-if="item.type == 'date-month'" | 1465 | <el-date-picker :class="[item.col, { is_block: item.block }]" v-else-if="item.type == 'date-month'" |
| 1466 | v-model="formInline[item.field]" type="month" format="YYYY-MM" value-format="YYYY-MM" | 1466 | v-model="formInline[item.field]" type="month" :format="item.format ?? 'YYYY-MM'" :value-format="item.valueFormat ?? 'YYYY-MM'" |
| 1467 | :placeholder="item.placeholder" :unlink-panels="item.unlink ?? false" :shortcuts="item.shortcuts ?? []" | 1467 | :placeholder="item.placeholder" :unlink-panels="item.unlink ?? false" :shortcuts="item.shortcuts ?? []" |
| 1468 | :default-value="item.defaultDate" :disabled="item.disabled ?? false" :disabled-date="item.disabledDate" | 1468 | :default-value="item.defaultDate" :disabled="item.disabled ?? false" :disabled-date="item.disabledDate" |
| 1469 | :popper-class="item.popperClass" @change="(val) => inputChange(val, item)" | 1469 | :popper-class="item.popperClass" @change="(val) => inputChange(val, item)" | ... | ... |
| ... | @@ -22,6 +22,17 @@ const route = useRoute(); | ... | @@ -22,6 +22,17 @@ const route = useRoute(); |
| 22 | const fullPath = route.fullPath; | 22 | const fullPath = route.fullPath; |
| 23 | const fullscreenLoading = ref(false); | 23 | const fullscreenLoading = ref(false); |
| 24 | 24 | ||
| 25 | /** 获取当月的最后一天。 */ | ||
| 26 | const getLastDayOfMonth = (month) => { | ||
| 27 | const year = parseInt(month.split('-')[0], 10); | ||
| 28 | const monthIndex = parseInt(month.split('-')[1], 10) - 1; // JavaScript 的月份是从0开始计数的 | ||
| 29 | const date = new Date(year, monthIndex + 1, 0); // 使用0可以得到前一个月的最后一天 | ||
| 30 | const yearString = date.getFullYear(); | ||
| 31 | const monthString = String(date.getMonth() + 1).padStart(2, '0'); // JavaScript 的月份是从0开始计数的 | ||
| 32 | const dayString = String(date.getDate()).padStart(2, '0'); | ||
| 33 | return `${yearString}-${monthString}-${dayString}`; | ||
| 34 | } | ||
| 35 | |||
| 25 | /** 数据产品列表 */ | 36 | /** 数据产品列表 */ |
| 26 | const damProductList: any = ref([]); | 37 | const damProductList: any = ref([]); |
| 27 | 38 | ||
| ... | @@ -47,8 +58,10 @@ const valuateFormItems: any = ref([ | ... | @@ -47,8 +58,10 @@ const valuateFormItems: any = ref([ |
| 47 | label: "基准日", | 58 | label: "基准日", |
| 48 | type: "date-month", | 59 | type: "date-month", |
| 49 | field: "evaluateBaseDate", | 60 | field: "evaluateBaseDate", |
| 50 | default: moment(new Date()).format('YYYY-MM'), | 61 | default: getLastDayOfMonth(moment(new Date()).format('YYYY-MM')), |
| 51 | placeholder: "请选择", | 62 | placeholder: "请选择", |
| 63 | format: 'YYYY-MM-DD', | ||
| 64 | valueFormat: 'YYYY-MM-DD', | ||
| 52 | clearable: true, | 65 | clearable: true, |
| 53 | required: true, | 66 | required: true, |
| 54 | style: { width: 'calc(33.33% - 70px)', 'margin-right': '8px' }, | 67 | style: { width: 'calc(33.33% - 70px)', 'margin-right': '8px' }, |
| ... | @@ -126,22 +139,24 @@ const handleValudateFormChange = (val, row, info) => { | ... | @@ -126,22 +139,24 @@ const handleValudateFormChange = (val, row, info) => { |
| 126 | valuateFormItems.value.forEach(item => { | 139 | valuateFormItems.value.forEach(item => { |
| 127 | item.default = info[item.field]; | 140 | item.default = info[item.field]; |
| 128 | if (item.field == 'useYears') { | 141 | if (item.field == 'useYears') { |
| 129 | item.visible = item.default != '1'; | 142 | item.visible = val != '1'; |
| 130 | item.default = info.useYears ? info.useYears : 1; | 143 | item.default = info.useYears ? info.useYears : 1; |
| 131 | } | 144 | } |
| 132 | }) | 145 | }) |
| 133 | } | 146 | } |
| 134 | } | 147 | } |
| 135 | 148 | ||
| 136 | /** 获取当月的最后一天。 */ | 149 | const handleInputChange = (val, row, info) => { |
| 137 | const getLastDayOfMonth = (month) => { | 150 | if (row.field == 'evaluateBaseDate') { |
| 138 | const year = parseInt(month.split('-')[0], 10); | 151 | valuateFormItems.value.forEach(item => { |
| 139 | const monthIndex = parseInt(month.split('-')[1], 10) - 1; // JavaScript 的月份是从0开始计数的 | 152 | item.default = info[item.field]; |
| 140 | const date = new Date(year, monthIndex + 1, 0); // 使用0可以得到前一个月的最后一天 | 153 | if (item.field == 'useYears') { |
| 141 | const yearString = date.getFullYear(); | 154 | item.visible = info.evaluateMethod != '1'; |
| 142 | const monthString = String(date.getMonth() + 1).padStart(2, '0'); // JavaScript 的月份是从0开始计数的 | 155 | } else if (item.field == 'evaluateBaseDate') { |
| 143 | const dayString = String(date.getDate()).padStart(2, '0'); | 156 | item.default = getLastDayOfMonth(val); |
| 144 | return `${yearString}-${monthString}-${dayString}`; | 157 | } |
| 158 | }) | ||
| 159 | } | ||
| 145 | } | 160 | } |
| 146 | 161 | ||
| 147 | const costTableField: any = ref([ | 162 | const costTableField: any = ref([ |
| ... | @@ -433,10 +448,7 @@ const incomeYears = computed(() => { | ... | @@ -433,10 +448,7 @@ const incomeYears = computed(() => { |
| 433 | let year = parseInt(infos[0]); | 448 | let year = parseInt(infos[0]); |
| 434 | let month = parseInt(infos[1]); | 449 | let month = parseInt(infos[1]); |
| 435 | if (month == 12) { | 450 | if (month == 12) { |
| 436 | let a = [{ | 451 | let a: any = []; |
| 437 | field: year + '', | ||
| 438 | label: year + '年' | ||
| 439 | }]; | ||
| 440 | for (var i = 1; i < useYears + 1; i++) { | 452 | for (var i = 1; i < useYears + 1; i++) { |
| 441 | a.push({ | 453 | a.push({ |
| 442 | field: year + i + '', | 454 | field: year + i + '', |
| ... | @@ -447,7 +459,7 @@ const incomeYears = computed(() => { | ... | @@ -447,7 +459,7 @@ const incomeYears = computed(() => { |
| 447 | } else if (month == 1) { | 459 | } else if (month == 1) { |
| 448 | let a = [{ | 460 | let a = [{ |
| 449 | field: evaluateBaseDate + '', | 461 | field: evaluateBaseDate + '', |
| 450 | label: year + '年' + `(1)` | 462 | label: year + '年' + `(2~12)` |
| 451 | }]; | 463 | }]; |
| 452 | for (var i = 1; i < useYears + 1; i++) { | 464 | for (var i = 1; i < useYears + 1; i++) { |
| 453 | a.push({ | 465 | a.push({ |
| ... | @@ -459,12 +471,12 @@ const incomeYears = computed(() => { | ... | @@ -459,12 +471,12 @@ const incomeYears = computed(() => { |
| 459 | } else { | 471 | } else { |
| 460 | let a = [{ | 472 | let a = [{ |
| 461 | field: evaluateBaseDate + '', | 473 | field: evaluateBaseDate + '', |
| 462 | label: year + '年' + `(1~${month})` | 474 | label: year + '年' + `(${month + 1}~12)` |
| 463 | }]; | 475 | }]; |
| 464 | for (var i = 1; i < useYears + 1; i++) { | 476 | for (var i = 1; i < useYears + 1; i++) { |
| 465 | a.push({ | 477 | a.push({ |
| 466 | field: year + i + '', | 478 | field: year + i + '', |
| 467 | label: i == useYears ? ((year + i) + '年' + `(${month}~12)`) : ((year + i) + '年') | 479 | label: i == useYears ? ((year + i) + '年' + `(1~${month})`) : ((year + i) + '年') |
| 468 | }); | 480 | }); |
| 469 | } | 481 | } |
| 470 | return a; | 482 | return a; |
| ... | @@ -584,21 +596,29 @@ const incomeCalculateData = computed(() => { //响应式不生效 | ... | @@ -584,21 +596,29 @@ const incomeCalculateData = computed(() => { //响应式不生效 |
| 584 | resultInfo['折现因子'] = []; | 596 | resultInfo['折现因子'] = []; |
| 585 | resultInfo['折现现值'] = []; | 597 | resultInfo['折现现值'] = []; |
| 586 | resultInfo['数据资产估值'] = 0; | 598 | resultInfo['数据资产估值'] = 0; |
| 599 | let formInline = formRef.value.formInline; | ||
| 600 | let evaluateBaseDate = formInline.evaluateBaseDate; | ||
| 601 | let infos = evaluateBaseDate.split('-'); | ||
| 602 | let month = parseInt(infos[1]); | ||
| 587 | let transfer = (v, need = true) => { | 603 | let transfer = (v, need = true) => { |
| 588 | return v ? (need ? parseFloat(v) / 100 : parseFloat(v)) : 0; | 604 | return v ? (need ? parseFloat(v) / 100 : parseFloat(v)) : 0; |
| 589 | } | 605 | } |
| 590 | incomeYears.value.forEach((year, i) => { | 606 | incomeYears.value.forEach((year, i) => { |
| 591 | let C6 = transfer(data[5][year.field]) | 607 | let C6 = transfer(data[5][year.field]) |
| 592 | let C7 = transfer(data[6][year.field]) | 608 | let C7 = transfer(data[6][year.field]) |
| 593 | let sumC7: any = i == 0 ? C7 : incomeYears.value.slice(0, i + 1).reduce(function (prev, curr, idx, arr) { | 609 | let sumC7: any = C7; |
| 594 | return transfer(data[6][prev.field]) + transfer(data[6][curr.field]); | 610 | incomeYears.value.slice(0, i + 1).forEach((item) => { |
| 611 | sumC7 = sumC7 + transfer(data[6][item.field]); | ||
| 595 | }) | 612 | }) |
| 596 | resultInfo['综合分成率'].push(changeNum(C6 * (1 - sumC7 + C7 / 2) * 100, 2, true)); //TODO综合分成率算法有问题 | 613 | resultInfo['综合分成率'].push(changeNum(C6 * (1 - sumC7 + C7 / 2) * 100, 2, true)); //TODO综合分成率算法有问题 |
| 597 | let C1 = transfer(data[0][year.field], false) | 614 | let C1 = transfer(data[0][year.field], false) |
| 598 | let C5 = transfer(data[4][year.field]) | 615 | let C5 = transfer(data[4][year.field]) |
| 599 | resultInfo['现金流'].push(changeNum(C1 * C5 * resultInfo['综合分成率'][i] / 100, 2, true)); | 616 | resultInfo['现金流'].push(changeNum(C1 * C5 * resultInfo['综合分成率'][i] / 100, 2, true)); |
| 600 | if (i == 0) { | 617 | if (i == 0) { |
| 601 | resultInfo['折现年期'].push(changeNum(10 / 12 / 2, 2, true)); | 618 | let cnt = month == 12 ? 12 : (12 - month); |
| 619 | resultInfo['折现年期'].push(changeNum(cnt / 12 / 2, 2, true)); | ||
| 620 | } else if (i == incomeYears.value.length - 1) { | ||
| 621 | resultInfo['折现年期'].push(changeNum(parseFloat(resultInfo['折现年期'][i - 1]) + (month == 12 ? 1 : (month / 12 / 2)), 2, true)) | ||
| 602 | } else { | 622 | } else { |
| 603 | resultInfo['折现年期'].push(changeNum(parseFloat(resultInfo['折现年期'][i - 1]) + 1, 2, true)) | 623 | resultInfo['折现年期'].push(changeNum(parseFloat(resultInfo['折现年期'][i - 1]) + 1, 2, true)) |
| 604 | } | 624 | } |
| ... | @@ -619,6 +639,10 @@ const submit = () => { | ... | @@ -619,6 +639,10 @@ const submit = () => { |
| 619 | if (params.evaluateMethod == '1') { | 639 | if (params.evaluateMethod == '1') { |
| 620 | params.valuationCostRQVOList = costTableData.value; | 640 | params.valuationCostRQVOList = costTableData.value; |
| 621 | params.damValuation = costTableSummaryValue.value; | 641 | params.damValuation = costTableSummaryValue.value; |
| 642 | if (!costTableData.value.some(table => table.amount !== '')) { | ||
| 643 | proxy.$ElMessage.error('成本法请至少输入一项指标金额'); | ||
| 644 | return | ||
| 645 | } | ||
| 622 | } else { | 646 | } else { |
| 623 | params.valuationEarningsRQVOList = incomeTableData.value; | 647 | params.valuationEarningsRQVOList = incomeTableData.value; |
| 624 | params.damValuation = incomeCalculateData.value['数据资产估值']; | 648 | params.damValuation = incomeCalculateData.value['数据资产估值']; |
| ... | @@ -761,10 +785,10 @@ onMounted(async () => { | ... | @@ -761,10 +785,10 @@ onMounted(async () => { |
| 761 | <div class="content_main"> | 785 | <div class="content_main"> |
| 762 | <ContentWrap id="id-baseInfo" title="估值类型" instructions="" style="margin-top: 8px;"> | 786 | <ContentWrap id="id-baseInfo" title="估值类型" instructions="" style="margin-top: 8px;"> |
| 763 | <Form ref="formRef" :itemList="valuateFormItems" :rules="valuateFormRules" formId="main-model-edit" | 787 | <Form ref="formRef" :itemList="valuateFormItems" :rules="valuateFormRules" formId="main-model-edit" |
| 764 | @select-change="handleValudateFormChange" col="col3" /> | 788 | @select-change="handleValudateFormChange" @input-change="handleInputChange" col="col3" /> |
| 765 | </ContentWrap> | 789 | </ContentWrap> |
| 766 | <ContentWrap id="id-grade-info" title="填写成本明细" | 790 | <ContentWrap id="id-grade-info" title="填写成本明细" |
| 767 | :instructions="formRef?.formInline?.evaluateMethod == '1' ? '填写时请按照所选数据产品的成本投入进行填写,跟数据产品产生的成本一致' : ''" | 791 | :description="formRef?.formInline?.evaluateMethod == '1' ? '填写时请按照所选数据产品的成本投入进行填写,跟数据产品产生的成本一致' : ''" |
| 768 | style="margin-top: 16px;"> | 792 | style="margin-top: 16px;"> |
| 769 | <el-table id="cost-table" v-show="formRef?.formInline?.evaluateMethod == '1'" ref="costTableRef" | 793 | <el-table id="cost-table" v-show="formRef?.formInline?.evaluateMethod == '1'" ref="costTableRef" |
| 770 | :data="costTableData" :span-method="costTableSpanMethod" :summary-method="costTableSummaryMethod" show-summary | 794 | :data="costTableData" :span-method="costTableSpanMethod" :summary-method="costTableSummaryMethod" show-summary | ... | ... |
-
Please register or sign in to post a comment