Browse Source

长期折旧费用与待摊费用接口联调

ljb 10 months ago
parent
commit
193cb1f243

+ 11 - 1
src/option/projectManage/personCost.js

@@ -69,11 +69,16 @@ export default {
       prop: 'zzsc',
       type: 'number',
       min: 0,
-      precision: 2,
+      precision: 0,
       span: 24,
       minWidth: 90,
       align: 'center',
       showOverflowTooltip: true,
+      rules: [{
+        required: true,
+        message: '请输入',
+        trigger: 'blur',
+      }]
     },
     {
       label: '月平均人工费用/元',
@@ -85,6 +90,11 @@ export default {
       minWidth: 90,
       align: 'center',
       showOverflowTooltip: true,
+      rules: [{
+        required: true,
+        message: '请输入',
+        trigger: 'blur',
+      }]
     },
     {
       label: '预算合计/元',

+ 12 - 10
src/option/projectManage/zjfyycqdtfyCost.js

@@ -18,22 +18,23 @@ export default {
   column: [
     {
       label: '资产名称',
-      prop: 'zcId',
+      prop: 'zcbm',
       type: 'select',
+      filterable: true,
       minWidth: 140,
       span: 24,
-      dicUrl: '',
+      dicUrl: '/api/kd-scientific/zc/simple/list',
       dicFormatter:(res)=>{
-        return res.data.records
-      },
-      dicQuery: {
-        current: 1,
-        size: 99999,
-        yearAndMonth: ''
+        return res.data
       },
+      // dicQuery: {
+      //   current: 1,
+      //   size: 99999,
+      //   yearAndMonth: ''
+      // },
       props: {
         label: 'zcmc',
-        value: 'id',
+        value: 'zcbm',
       },
       dicFlag: true,
       showOverflowTooltip: true,
@@ -51,11 +52,12 @@ export default {
       span: 24,
       align: 'center',
       min: 0,
+      precision: 0,
       showOverflowTooltip: true,
       rules: [{
         required: true,
         message: '请输入工作时长',
-        trigger: 'change',
+        trigger: 'blur',
       }]
     },
     {

+ 24 - 11
src/views/project-manage/components/zjfyycqdtfy-cost.vue

@@ -51,7 +51,7 @@
         <print-table-btn @click="printTable" />
       </template>
 
-      <template slot="zcId" slot-scope="scope">
+      <template slot="zcbm" slot-scope="scope">
         <span>{{ scope.row.zcmc }}</span>
       </template>
       
@@ -77,6 +77,7 @@ import projectSelect from "@/components/project-select";
 import {getToken} from "@/util/auth";
 import {downloadXls} from "@/util/util";
 import moment from "moment";
+import Decimal from "decimal.js";
 
 
 export default window.$crudCommon({
@@ -107,9 +108,10 @@ export default window.$crudCommon({
     let newOption = { ...this.option };
     // 姓名下拉框,设置监听事件
     newOption.column.forEach(item => {
-      if (item.prop == "zcId") {
+      if (item.prop == "zcbm") {
         item.change = ({ item }) => {
           if (!!item) {
+            console.log(item)
             this.currZcObj = item;
           }
         }
@@ -156,13 +158,13 @@ export default window.$crudCommon({
         return;
       }
       this.currZcObj = {};
-      this.option.column.forEach(item => {
-        let yearAndMonth = this.selProject.xmkssj || new Date();
-        if (item.prop == "zcId") {
-          item.dicUrl = '/api/kd-scientific/zc/page';
-          item.dicQuery.yearAndMonth = moment(yearAndMonth).format("yyyyMM");
-        }
-      });
+      // this.option.column.forEach(item => {
+      //   let yearAndMonth = this.selProject.xmkssj || new Date();
+      //   if (item.prop == "zcbm") {
+      //     item.dicUrl = '/api/kd-scientific/zc/simple/list';
+      //     item.dicQuery.yearAndMonth = moment(yearAndMonth).format("yyyyMM");
+      //   }
+      // });
       done();
     },
     getList() {
@@ -188,7 +190,7 @@ export default window.$crudCommon({
     },
     handleExport() {
       exportBloByPost(`/api/kd-scientific/ys-zjfyycqdtfy/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `折旧费用与长期待摊费用.xlsx`);
+        downloadXls(res.data, `${this.selProject.xmmc}折旧费用与长期待摊费用.xlsx`);
       });
     },
     /**
@@ -197,7 +199,7 @@ export default window.$crudCommon({
      */
     printTable(isLandscape) {
       this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `折旧费用与长期待摊费用`;
+      this.printTitle = `${this.selProject.xmmc}折旧费用与长期待摊费用`;
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
       })
@@ -207,6 +209,17 @@ export default window.$crudCommon({
   // 模块路径
   name: 'projectManage/zjfyycqdtfyCost',
   res: ({ data }) => {
+    data.records = data.records.map(item => {
+      item.zcmc = item.zcEntity.zcmc;
+      item.zcbm = item.zcEntity.zcbm;
+      item.yzje = (item.zcEntity.yzje || 0).toFixed(2);
+      item.cqdtfyysje = (item.cqdtfyysje || 0).toFixed(2);
+
+      let zzscD = new Decimal(item.zzsc || 0); // 工作时长
+      let yzjeD = new Decimal(item.yzje || 0);
+      item.yshj = zzscD.mul(yzjeD).toFixed(2);
+      return item;
+    });
     return data;
   },
 });