Browse Source

项目折旧费用与长期待摊费用

ljb 10 months ago
parent
commit
1c861b4a7b

+ 4 - 2
src/api/projectManage/zjfyycqdtfyCost.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-zjfyycqdtfy/remove',
     url: '/api/kd-scientific/ys-zjfyycqdtfy/remove',
     method: 'post',
     method: 'post',
-    data
+    params: {
+      ids
+    }
   })
   })
 }
 }

+ 4 - 2
src/api/projectManage/zztlCost.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-zjtrfy/remove',
     url: '/api/kd-scientific/ys-zjtrfy/remove',
     method: 'post',
     method: 'post',
-    data
+    params: {
+      ids
+    }
   })
   })
 }
 }

+ 8 - 4
src/option/projectManage/zjfyycqdtfyCost.js

@@ -18,7 +18,7 @@ export default {
   column: [
   column: [
     {
     {
       label: '资产名称',
       label: '资产名称',
-      prop: 'zcmc',
+      prop: 'zcId',
       type: 'select',
       type: 'select',
       minWidth: 140,
       minWidth: 140,
       span: 24,
       span: 24,
@@ -35,6 +35,7 @@ export default {
         label: 'zcmc',
         label: 'zcmc',
         value: 'id',
         value: 'id',
       },
       },
+      dicFlag: true,
       showOverflowTooltip: true,
       showOverflowTooltip: true,
       rules: [{
       rules: [{
         required: true,
         required: true,
@@ -49,6 +50,7 @@ export default {
       width: 140,
       width: 140,
       span: 24,
       span: 24,
       align: 'center',
       align: 'center',
+      min: 0,
       showOverflowTooltip: true,
       showOverflowTooltip: true,
       rules: [{
       rules: [{
         required: true,
         required: true,
@@ -58,17 +60,17 @@ export default {
     },
     },
     {
     {
       label: '月折旧额',
       label: '月折旧额',
-      prop: 'ytxe',
+      prop: 'yzje',
       type: 'number',
       type: 'number',
       width: 90,
       width: 90,
       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,
@@ -96,6 +98,8 @@ export default {
       width: 120,
       width: 120,
       span: 24,
       span: 24,
       align: 'center',
       align: 'center',
+      min: 0,
+      precision: 2,
       showOverflowTooltip: true,
       showOverflowTooltip: true,
       rules: [{
       rules: [{
         required: true,
         required: true,

+ 67 - 12
src/views/project-manage/components/zjfyycqdtfy-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="zcId" slot-scope="scope">
+        <span>{{ scope.row.zcmc }}</span>
+      </template>
       
       
     </avue-crud>
     </avue-crud>
 
 
@@ -72,6 +76,7 @@ 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";
 
 
 
 
 export default window.$crudCommon({
 export default window.$crudCommon({
@@ -84,27 +89,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 == "zcId") {
         item.change = ({ item }) => {
         item.change = ({ item }) => {
           if (!!item) {
           if (!!item) {
-            this.form = {
-              ...this.form,
-              ytxe: item.zcyz,
-            };
+            this.currZcObj = item;
           }
           }
         }
         }
       }
       }
@@ -112,18 +118,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) {
+      if (!this.params.xmId) {
+        this.$message.warning("请选择项目!");
+        return;
+      }
+      this.currZcObj = {};
       this.option.column.forEach(item => {
       this.option.column.forEach(item => {
-        if (item.prop == "zcmc") {
+        let yearAndMonth = this.selProject.xmkssj || new Date();
+        if (item.prop == "zcId") {
           item.dicUrl = '/api/kd-scientific/zc/page';
           item.dicUrl = '/api/kd-scientific/zc/page';
-          item.dicQuery.yearAndMonth = '202507';
+          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-zjfyycqdtfy/import');
       this.$refs.uploadExcelDialog.open('/api/kd-scientific/ys-zjfyycqdtfy/import');
     },
     },