diff --git a/src/views/sunVillage_info/fixedAssetsAdd.vue b/src/views/sunVillage_info/fixedAssetsAdd.vue
index fa12c45d..c867c245 100644
--- a/src/views/sunVillage_info/fixedAssetsAdd.vue
+++ b/src/views/sunVillage_info/fixedAssetsAdd.vue
@@ -209,7 +209,7 @@
-
+
@@ -262,7 +262,12 @@
-
+
+
+ 重新计算
+
+
@@ -282,7 +287,6 @@
minDate:new Date(1900,1,1),
applicationList:[],
applicationListSecond:[],
- assetStatusOptions:[],
form:{
assetType:'151001',
operationType:'1',
@@ -433,18 +437,42 @@
},
// 累计折旧变动监听
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) {
- 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) {
- 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) {
- 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(){
addPermanent(this.form).then((response) => {
@@ -480,7 +526,15 @@
},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);
+ },
},
}