Browse Source

无形资产费用接口联调

ljb 10 months ago
parent
commit
b8e3021ad1

+ 4 - 2
src/api/projectManage/wxzctxCost.js

@@ -30,10 +30,12 @@ export const update = (row) => {
 }
 }
 
 
 
 
-export const remove = (data) => {
+export const remove = (ids) => {
   return request({
   return request({
     url: '/api/kd-scientific/ys-wxzctxfy/remove',
     url: '/api/kd-scientific/ys-wxzctxfy/remove',
     method: 'post',
     method: 'post',
-    data
+    params: {
+      ids
+    }
   })
   })
 }
 }

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

@@ -18,23 +18,19 @@ export default {
   column: [
   column: [
     {
     {
       label: '资产名称',
       label: '资产名称',
-      prop: 'zcmc',
+      prop: 'zcbm',
       type: 'select',
       type: 'select',
       minWidth: 220,
       minWidth: 220,
       span: 24,
       span: 24,
-      dicUrl: '',
+      dicUrl: '/api/kd-scientific/zc/simple/list',
       dicFormatter:(res)=>{
       dicFormatter:(res)=>{
-        return res.data.records
-      },
-      dicQuery: {
-        current: 1,
-        size: 99999,
-        yearAndMonth: ''
+        return res.data
       },
       },
       props: {
       props: {
         label: 'zcmc',
         label: 'zcmc',
-        value: 'id',
+        value: 'zcbm',
       },
       },
+      dicFlag: true,
       showOverflowTooltip: true,
       showOverflowTooltip: true,
       rules: [{
       rules: [{
         required: true,
         required: true,
@@ -50,10 +46,12 @@ export default {
       span: 24,
       span: 24,
       align: 'center',
       align: 'center',
       showOverflowTooltip: true,
       showOverflowTooltip: true,
+      min: 0,
+      precision: 0,
       rules: [{
       rules: [{
         required: true,
         required: true,
         message: '请输入工作时长',
         message: '请输入工作时长',
-        trigger: 'change',
+        trigger: 'blur',
       }]
       }]
     },
     },
     {
     {
@@ -64,11 +62,11 @@ export default {
       span: 24,
       span: 24,
       align: 'center',
       align: 'center',
       showOverflowTooltip: true,
       showOverflowTooltip: true,
-      disabled: true,
+      display: false
     },
     },
     {
     {
       label: '预算合计/元',
       label: '预算合计/元',
-      prop: 'hjfy',
+      prop: 'yshj',
       type: 'number',
       type: 'number',
       width: 90,
       width: 90,
       span: 24,
       span: 24,

+ 0 - 5
src/option/projectManage/zjfyycqdtfyCost.js

@@ -27,11 +27,6 @@ export default {
       dicFormatter:(res)=>{
       dicFormatter:(res)=>{
         return res.data
         return res.data
       },
       },
-      // dicQuery: {
-      //   current: 1,
-      //   size: 99999,
-      //   yearAndMonth: ''
-      // },
       props: {
       props: {
         label: 'zcmc',
         label: 'zcmc',
         value: 'zcbm',
         value: 'zcbm',

+ 1 - 1
src/views/basic-resource/comp-basic-info/ky-asset-list.vue

@@ -92,7 +92,7 @@
 </template>
 </template>
 
 
 <script>
 <script>
-import { getLastMonthData } from "@/api/basicResource/technicianRoster";
+import { getLastMonthData } from "@/api/basicResource/kyAssetList";
 import {exportBloByPost} from "@/api/common";
 import {exportBloByPost} from "@/api/common";
 import YearMonthSelect from "@/components/year-month-select";
 import YearMonthSelect from "@/components/year-month-select";
 import UploadExcelDialog from "@/components/upload-excel-dialog";
 import UploadExcelDialog from "@/components/upload-excel-dialog";

+ 84 - 18
src/views/project-manage/components/wxzctx-cost.vue

@@ -3,7 +3,7 @@
     <div style="margin-top: 6px;">
     <div style="margin-top: 6px;">
       <el-form :inline="true">
       <el-form :inline="true">
         <el-form-item label="研发项目名称">
         <el-form-item label="研发项目名称">
-          <project-select v-model="currProjectId" @change="handleProjectChange"></project-select>
+          <project-select v-model="params.xmId" @change="handleProjectChange"></project-select>
         </el-form-item>
         </el-form-item>
         <el-form-item label="研发项目编号">
         <el-form-item label="研发项目编号">
           {{ selProject.xmbh }}
           {{ selProject.xmbh }}
@@ -50,6 +50,10 @@
         </el-button>
         </el-button>
         <print-table-btn @click="printTable" />
         <print-table-btn @click="printTable" />
       </template>
       </template>
+
+      <template slot="zcbm" slot-scope="scope">
+        <span>{{ scope.row.zcmc }}</span>
+      </template>
       
       
     </avue-crud>
     </avue-crud>
 
 
@@ -72,6 +76,8 @@ import UploadExcelDialog from "@/components/upload-excel-dialog";
 import projectSelect from "@/components/project-select";
 import projectSelect from "@/components/project-select";
 import {getToken} from "@/util/auth";
 import {getToken} from "@/util/auth";
 import {downloadXls} from "@/util/util";
 import {downloadXls} from "@/util/util";
+import moment from "moment";
+import Decimal from "decimal.js";
 
 
 
 
 export default window.$crudCommon({
 export default window.$crudCommon({
@@ -84,27 +90,28 @@ export default window.$crudCommon({
   },
   },
   data() {
   data() {
     return {
     return {
-      currProjectId: '',
+      params: {
+        xmId: ''
+      },
       selProject: {},
       selProject: {},
 
 
       wideTableColumns: [],
       wideTableColumns: [],
       printTitle: "",
       printTitle: "",
+
+      currZcObj: {},
     };
     };
   },
   },
   created() {
   created() {
-    this.currProjectId = this.projectId;
+    this.params.xmId = this.projectId;
     this.option.height = window.innerHeight - 340;
     this.option.height = window.innerHeight - 340;
 
 
     let newOption = { ...this.option };
     let newOption = { ...this.option };
     // 姓名下拉框,设置监听事件
     // 姓名下拉框,设置监听事件
     newOption.column.forEach(item => {
     newOption.column.forEach(item => {
-      if (item.prop == "zcmc") {
+      if (item.prop == "zcbm") {
         item.change = ({ item }) => {
         item.change = ({ item }) => {
           if (!!item) {
           if (!!item) {
-            this.form = {
-              ...this.form,
-              ytxe: item.zcyz,
-            };
+            this.currZcObj = item;
           }
           }
         }
         }
       }
       }
@@ -112,18 +119,67 @@ export default window.$crudCommon({
     this.option = { ...newOption };
     this.option = { ...newOption };
   },
   },
   methods: {
   methods: {
-    handleProjectChange(data) {
-      this.selProject = data;
+    validCustom() {
+      const { sysm, ysysm } = this.currZcObj;
+      const { xmkssj, xmjssj } = this.selProject
+      let sm = sysm - ysysm;
+      if (this.form.zzsc > sm) {
+        this.$message.warning(`设备剩余寿命为${sm}月,在项目的工作时长不能大于设备寿命!`);
+        return false;
+      }
+
+      if (xmkssj && xmjssj) {
+        let monthDiff = moment(xmjssj).diff(moment(xmkssj), 'months', true).toFixed(0);
+        if (this.form.zzsc > monthDiff) {
+          this.$message.warning(`项目周期为${monthDiff}月,在项目的工作时长不能大于项目周期!`);
+          return false;
+        }
+      }
+      return true;
+    },
+    addBefore(loading, callback) {
+      if (!this.validCustom()) {
+        loading();
+        return;
+      }
+      callback && callback();
+    },
+    updateBefore(loading, callback) {
+      if (!this.validCustom()) {
+        loading();
+        return false;
+      }
+      callback && callback();
     },
     },
     handleBeforeOpen(done) {
     handleBeforeOpen(done) {
-      this.option.column.forEach(item => {
-        if (item.prop == "zcmc") {
-          item.dicUrl = '/api/kd-scientific/zc/page';
-          item.dicQuery.yearAndMonth = '202507';
-        }
-      });
+      if (!this.params.xmId) {
+        this.$message.warning("请选择项目!");
+        return;
+      }
+      this.currZcObj = {};
+      // 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();
       done();
     },
     },
+    getList() {
+      if (!this.params.xmId) {
+        return;
+      }
+      this.loadData();
+    },
+    getFormData() {
+      return { ...this.form, xmId: this.params.xmId }
+    },
+    handleProjectChange(data) {
+      this.selProject = data;
+      this.page.currentPage = 1;
+      this.getList(this.page);
+    },
     handleImport() {
     handleImport() {
       this.$refs.uploadExcelDialog.open('/api/kd-scientific/ys-wxzctxfy/import');
       this.$refs.uploadExcelDialog.open('/api/kd-scientific/ys-wxzctxfy/import');
     },
     },
@@ -133,7 +189,7 @@ export default window.$crudCommon({
     },
     },
     handleExport() {
     handleExport() {
       exportBloByPost(`/api/kd-scientific/ys-wxzctxfy/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
       exportBloByPost(`/api/kd-scientific/ys-wxzctxfy/export?${this.website.tokenHeader}=${getToken()}`, this.params).then(res => {
-        downloadXls(res.data, `无形资产摊销费用.xlsx`);
+        downloadXls(res.data, `${this.selProject.xmmc}无形资产摊销费用.xlsx`);
       });
       });
     },
     },
     /**
     /**
@@ -142,7 +198,7 @@ export default window.$crudCommon({
      */
      */
     printTable(isLandscape) {
     printTable(isLandscape) {
       this.wideTableColumns = this.$refs.crud.columnOption;
       this.wideTableColumns = this.$refs.crud.columnOption;
-      this.printTitle = `无形资产摊销费用`;
+      this.printTitle = `${this.selProject.xmmc}无形资产摊销费用`;
       this.$nextTick(() => {
       this.$nextTick(() => {
         this.$refs.printWideTable.printTable(isLandscape);
         this.$refs.printWideTable.printTable(isLandscape);
       })
       })
@@ -152,6 +208,16 @@ export default window.$crudCommon({
   // 模块路径
   // 模块路径
   name: 'projectManage/wxzctxCost',
   name: 'projectManage/wxzctxCost',
   res: ({ data }) => {
   res: ({ data }) => {
+    data.records = data.records.map(item => {
+      item.zcmc = item.zcEntity ? item.zcEntity.zcmc : '';
+      item.zcbm = item.zcEntity ? item.zcEntity.zcbm : '';
+      item.ytxe = (item.zcEntity ? item.zcEntity.ytxe : 0).toFixed(2);
+
+      let zzscD = new Decimal(item.zzsc || 0); // 工作时长
+      let yzjeD = new Decimal(item.ytxe || 0); // 摊销额
+      item.yshj = zzscD.mul(yzjeD).toFixed(2);
+      return item;
+    });
     return data;
     return data;
   },
   },
 });
 });

+ 0 - 1
src/views/project-manage/components/zjfyycqdtfy-cost.vue

@@ -111,7 +111,6 @@ export default window.$crudCommon({
       if (item.prop == "zcbm") {
       if (item.prop == "zcbm") {
         item.change = ({ item }) => {
         item.change = ({ item }) => {
           if (!!item) {
           if (!!item) {
-            console.log(item)
             this.currZcObj = item;
             this.currZcObj = item;
           }
           }
         }
         }