소스 검색

Task 资产折旧计算

rongxin_dev
zhaodengke 2 주 전
부모
커밋
0d65569b77
1개의 변경된 파일72개의 추가작업 그리고 18개의 파일을 삭제
  1. +72
    -18
      src/views/sunVillage_info/fixedAssetsAdd.vue

+ 72
- 18
src/views/sunVillage_info/fixedAssetsAdd.vue 파일 보기

@@ -209,7 +209,7 @@


<van-field label="净残值(元)" input-align="right" :border="false"> <van-field label="净残值(元)" input-align="right" :border="false">
<template #input> <template #input>
<van-stepper v-model="form.netSalvage" input-width="100" min="0.00" :decimal-length="2" @change="changeNetSalvage" />
<van-stepper v-model="form.netSalvage" input-width="100" min="0.00" :decimal-length="2" @changexxx="changeNetSalvage" />
</template> </template>
</van-field> </van-field>


@@ -262,7 +262,12 @@
<van-stepper v-model="form.depreciationYears" input-width="100" min="0" @change="changeDepreciationYears" /> <van-stepper v-model="form.depreciationYears" input-width="100" min="0" @change="changeDepreciationYears" />
</template> </template>
</van-field> </van-field>
<van-field readonly v-model="form.depreciationValue" label="累计折旧(元)" placeholder="0" input-align="right" :border="false" @change="changeDepreciationValue" />
<van-field readonly v-model="form.depreciationValue" label="累计折旧(元)" placeholder="0" input-align="right" :border="false" @change="changeDepreciationValue"
>
<template #button>
<van-button size="small" type="primary" round @click="calcDepreciationValue" native-type="button">重新计算</van-button>
</template>
</van-field>
</div> </div>


<div style="margin: 16px auto;width: 50%;"> <div style="margin: 16px auto;width: 50%;">
@@ -282,7 +287,6 @@
minDate:new Date(1900,1,1), minDate:new Date(1900,1,1),
applicationList:[], applicationList:[],
applicationListSecond:[], applicationListSecond:[],
assetStatusOptions:[],
form:{ form:{
assetType:'151001', assetType:'151001',
operationType:'1', operationType:'1',
@@ -433,18 +437,42 @@
}, },
// 累计折旧变动监听 // 累计折旧变动监听
changeDepreciationValue(val) { changeDepreciationValue(val) {
if (this.form.originalValue != null) {
// 净值 = 原值-累计折旧
this.form.netValue = this.form.originalValue - val;
}
if (val == null)
return;

// 每期折旧额 = (原值-净残值)/ 预计使用期数
let depreciation = this.form.originalValue - this.form.netSalvage;
depreciation -= val;
let periods = this.form.expectedYears - (this.form.depreciationYears || 0);
if(periods > 0 && depreciation > 0)
this.form.perYearDepreciationValue = (depreciation / periods).toFixed(2);
else
this.form.perYearDepreciationValue = 0;

// 净值 = 原值-累计折旧
this.form.netValue = (this.form.originalValue || 0) - val;
}, },


// 残值率变动监听 // 残值率变动监听
changeResidualsRate(val) { changeResidualsRate(val) {
if (this.form.originalValue != null) {
// 净残值 = 原值*残值率
this.form.netSalvage = (this.form.originalValue * val) / 100;
if (val == null)
return;

// 净残值 = 原值*残值率
this.form.netSalvage = val > 0 ? ((this.form.originalValue * val) / 100).toFixed(2) : 0;

if (this.form.expectedYears > 0) {
// 每期折旧额 = (原值-净残值)/ 预计使用期数
let depreciation = this.form.originalValue - (this.form.netSalvage || 0);
depreciation -= (this.form.depreciationValue || 0);
let periods = this.form.expectedYears - (this.form.depreciationYears || 0);
if(periods > 0 && depreciation > 0)
this.form.perYearDepreciationValue = (depreciation / periods).toFixed(2);
else
this.form.perYearDepreciationValue = 0;
} }
else
this.form.perYearDepreciationValue = 0;
}, },


// 净残值变动监听 // 净残值变动监听
@@ -458,18 +486,36 @@


// 预计使用年数变动监听 // 预计使用年数变动监听
changeExpectedYears(val) { changeExpectedYears(val) {
if (this.form.originalValue != null && this.form.netSalvage != null) {
// 每年折旧额:(原值-净残值)/ 预计使用年数
this.form.perYearDepreciationValue =
(this.form.originalValue - this.form.netSalvage) / val;
}
if (val == null)
return;

// 每期折旧额 = (原值-净残值)/ 预计使用期数
let depreciation = this.form.originalValue - this.form.netSalvage;
depreciation -= this.form.depreciationValue;
let periods = val - (this.form.depreciationYears || 0);
if(periods > 0 && depreciation > 0)
this.form.perYearDepreciationValue = (depreciation / periods).toFixed(2);
else
this.form.perYearDepreciationValue = 0;
}, },


// 已折旧年数变动监听 // 已折旧年数变动监听
changeDepreciationYears(val) { changeDepreciationYears(val) {
if (this.form.perYearDepreciationValue != null) {
this.form.depreciationValue = val * this.form.perYearDepreciationValue;
if (val == null)
return;

//if(!this.form.depreciationValueManual)
{
if (this.form.perYearDepreciationValue > 0) {
// 累计折旧 = 已折旧期数 * 每期折旧额
this.form.depreciationValue = val * this.form.perYearDepreciationValue;
}
else
this.form.depreciationValue = 0;
} }

// 净值 = 原值-累计折旧
this.form.netValue = (this.form.originalValue || 0) - (this.form.depreciationValue || 0);
}, },
onSubmit(){ onSubmit(){
addPermanent(this.form).then((response) => { addPermanent(this.form).then((response) => {
@@ -480,7 +526,15 @@
},2000) },2000)
} }
}); });
}
},
calcDepreciationValue() {
this.form.depreciationValue = 0;
const depreciationYears = this.form.depreciationYears;
this.form.depreciationYears = 0;
this.changeOriginalValue(this.form.originalValue);
this.form.depreciationYears = depreciationYears;
this.changeDepreciationYears(depreciationYears);
},
}, },
} }
</script> </script>


불러오는 중...
취소
저장