Browse Source

长期待摊费用明细功能完善

ljb 10 months ago
parent
commit
82f450f85e

+ 2 - 4
src/option/yfCostManage/basicDataSetting/dtCostAllocationList.js

@@ -8,11 +8,9 @@ export default {
   searchMenuSpan: 6,
   border: true,
   index: true,
-  delBtn: false,
-  menu: false,
   selection: true,
   labelWidth: 140,
-  menuWidth: 220,
+  menuWidth: 140,
   dialogClickModal: false,
   dialogWidth: 500,
   dialogType: "drawer",
@@ -183,7 +181,7 @@ export default {
       }]
     },
     {
-      label: '使用占比',
+      label: '使用占比(%)',
       prop: 'syzb',
       type: 'number',
       min: 0,

+ 18 - 1
src/views/yf-cost-manage/basic-data-setting/dt-cost-allocation-list.vue

@@ -115,6 +115,8 @@ import UploadExcelDialog from "@/components/upload-excel-dialog";
 import projectSelect from "@/components/project-select";
 import assetSelect from "@/components/asset-select";
 import moment from "moment";
+import Decimal from "decimal.js";
+import { isAlphanumericCombination } from "@/util/regex";
 
 
 export default window.$crudCommon({
@@ -154,7 +156,7 @@ export default window.$crudCommon({
       return { ...this.form, yearAndMonth: this.params.yearAndMonth }
     },
     validCustom() {
-      if (this.form.cqdtfybh && !isAlphanumericCombination(this.form.cgbh)) {
+      if (this.form.ctdtfybm && !isAlphanumericCombination(this.form.ctdtfybm)) {
         this.$message.warning("长期待摊费用编号必须是英文字母加数字组合!");
         return false;
       }
@@ -167,6 +169,13 @@ export default window.$crudCommon({
       }
       callback && callback();
     },
+    updateBefore(loading, callback) {
+      if (!this.validCustom()) {
+        loading();
+        return;
+      }
+      callback && callback();
+    },
     handleImport() {
       let excelParams = { yearAndMonth: this.params.yearAndMonth };
       this.$refs.uploadExcelDialog.open('/api/kd-scientific/xm/cqdtfy/import', excelParams);
@@ -207,6 +216,14 @@ export default window.$crudCommon({
   // 模块路径
   name: 'yfCostManage/basicDataSetting/dtCostAllocationList',
   res: ({ data }) => {
+    data.records = data.records.map(item => {
+      let ytxeNum = Number(item.ytxe);
+      let syzbNum = new Decimal(Number(item.syzb)).div(new Decimal(100));
+      item.yftxe = new Decimal(ytxeNum).mul(new Decimal(syzbNum)).toFixed(2);
+
+      return item;
+    });
+
     return data;
   },
 });