c063a9a1 by lihua

估值模型百分比支持大于100

1 parent ea3da759
......@@ -648,6 +648,10 @@ const incomeCalculateData = computed(() => { //响应式不生效
let transfer = (v, need = true) => {
return v ? (need ? parseFloat(v) / 100 : parseFloat(v)) : 0;
}
/** 转换千分位为正整数 */
let transferQianFenWei = (v) => {
return typeof v == 'string' ? parseFloat(v?.replace(/,/g, '')) : parseFloat(v)
}
incomeYears.value.forEach((year, i) => {
let C6 = transfer(data[5][year.field])
let C7 = transfer(data[6][year.field])
......@@ -659,10 +663,10 @@ const incomeCalculateData = computed(() => { //响应式不生效
sumC7 = sumC7 + transfer(data[6][item.field]);
})
}
resultInfo['综合分成率'].push(changeNum(C6 * (1 - sumC7 + C7 / 2) * 100, 2, true)); //TODO综合分成率算法有问题
resultInfo['综合分成率'].push(changeNum(C6 * (1 - sumC7 + C7 / 2) * 100, 2, true));
let C1 = transfer(data[0][year.field], false)
let C5 = transfer(data[4][year.field])
resultInfo['现金流'].push(changeNum(C1 * C5 * resultInfo['综合分成率'][i] / 100, 2, true));
resultInfo['现金流'].push(changeNum(C1 * C5 * transferQianFenWei(resultInfo['综合分成率'][i]) / 100, 2, true));
if (i == 0) {
let cnt = month == 12 ? 12 : (12 - month);
resultInfo['折现年期'].push(changeNum(cnt / 12 / 2, 2, true));
......@@ -673,7 +677,7 @@ const incomeCalculateData = computed(() => { //响应式不生效
}
let C10 = transfer(data[9][year.field]);
resultInfo['折现因子'].push(changeNum(1 / Math.pow((1 + C10), parseFloat(resultInfo['折现年期'][i])), 2, true));
resultInfo['折现现值'].push(changeNum(parseFloat(resultInfo['折现因子'][i]) * parseFloat(resultInfo['现金流'][i]?.replace(/,/g, '')), 2, true));
resultInfo['折现现值'].push(changeNum(parseFloat(resultInfo['折现因子'][i]) * transferQianFenWei(resultInfo['现金流'][i]), 2, true));
})
resultInfo['数据资产估值'] = resultInfo['折现现值'].length < 2 ? resultInfo['折现现值'][0] : changeNum(resultInfo['折现现值'].reduce(function (prev, curr, idx, arr) {
return (typeof prev == 'string' ? parseFloat(prev?.replace(/,/g, '')) : parseFloat(prev)) + parseFloat(curr?.replace(/,/g, ''));
......@@ -874,7 +878,7 @@ onMounted(async () => {
<div v-if="scope.row.auto != true" class="input_cell">
<el-input v-model.trim="scope.row[year.field]" placeholder="请输入"
@change="(val) => inputChange(val, scope, year.field)"
@input="(val) => inputEventChange(val, scope, year.field, scope.row.unit == '%' ? 100 : null)"
@input="(val) => inputEventChange(val, scope, year.field, null)"
clearable></el-input>
</div>
<span v-else>
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!