Browse Source

技术人员上年度月平均工作明细新增和列表接口联调

ljb 11 months ago
parent
commit
c5cb57ed22
2 changed files with 30 additions and 38 deletions
  1. 4 4
      src/option/technicianMonthAvgSales.js
  2. 26 34
      src/views/technician-month-avg-sales/index.vue

+ 4 - 4
src/option/technicianMonthAvgSales.js

@@ -7,6 +7,7 @@ export default {
   border: true,
   index: true,
   viewBtn: true,
+  editBtn: false,
   selection: true,
   searchLabelWidth: 140,
   labelWidth: 255,
@@ -18,7 +19,6 @@ export default {
     {
       label: '姓名',
       prop: 'name',
-      type: 'input',
       span: 24,
       search: true,
       width: 100,
@@ -28,14 +28,14 @@ export default {
       showOverflowTooltip: true,
       dicFlag: true,
       editDisabled: true,
-      // dicUrl: '/api/kd-scientific/technician/page',
+      dicUrl: '',
       dicFormatter:(res)=>{     
         return res.data.records
       },
       dicQuery: {
         current: 1,
         size: 99999,
-        yearAndMonth: '2025'
+        yearAndMonth: ''
       },
       props: {
         label: 'name',
@@ -44,7 +44,7 @@ export default {
       rules: [
         {
           required: true,
-          message: '请输入姓名',
+          message: '请选择技术人员',
           trigger: 'blur',
         },
       ],

+ 26 - 34
src/views/technician-month-avg-sales/index.vue

@@ -76,6 +76,7 @@ import NProgress from 'nprogress';
 import 'nprogress/nprogress.css';
 import {getToken} from "@/util/auth";
 import {downloadXls} from "@/util/util";
+import Decimal from "decimal.js";
 
 
 export default window.$crudCommon({
@@ -103,13 +104,6 @@ export default window.$crudCommon({
         submitBtn: false,
         emptyBtn: false,
         column: [
-          // {
-          //   label: '上传月份',
-          //   prop: 'yearAndMonth',
-          //   type: 'input',
-          //   span: 24,
-          //   disabled: true,
-          // },
           {
             label: '模板上传',
             prop: 'excelFile',
@@ -145,6 +139,7 @@ export default window.$crudCommon({
           if (!!item) {
             this.form = {
               ...this.form,
+              name: item.name,
               number: item.number,
               identityCard: item.identityCard,
               department: item.department,
@@ -159,36 +154,13 @@ export default window.$crudCommon({
   methods: {
     handleBeforeOpen(done, type) {
       this.option.column.forEach(item => {
-      if (item.prop == "name") {
-        item.dicUrl = '/api/kd-scientific/technician/page';
-          item.dicQuery.yearAndMonth = moment(this.params.yearAndMonth).subtract(1, 'year').format('YYYY');
+        if (item.prop == "name") {
+          item.dicUrl = '/api/kd-scientific/technician/page';
+          item.dicQuery.yearAndMonth = this.params.yearAndMonth;
         }
       });
-      // this.option = { ...this.option };
-      // console.log(this.option)
       done();
     },
-    validCustom() {
-      if (!this.form.number && !this.form.identityCard) {
-        this.$message.warning("工号和身份证号必须填写一项!");
-        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();
-    },
     handleImport() {
       this.excelBox = true;
       this.excelForm.yearAndMonth = this.params.yearAndMonth;
@@ -238,6 +210,26 @@ export default window.$crudCommon({
   },
 }, {
   // 模块路径
-  name: 'technicianMonthAvgSales'
+  name: 'technicianMonthAvgSales',
+  res: ({ data }) => {
+    data.records = data.records.map(item => {
+      let pensionInsurance = new Decimal(item.pensionInsurance || 0);
+      let medicalInsurance = new Decimal(item.medicalInsurance || 0);
+      let unemploymentInsurance = new Decimal(item.unemploymentInsurance || 0);
+      let injuryInsurance = new Decimal(item.injuryInsurance || 0);
+      let maternityInsurance = new Decimal(item.maternityInsurance || 0);
+      let providentFund = new Decimal(item.providentFund || 0);
+
+      // 社保合计
+      let socialInsurance = pensionInsurance.add(medicalInsurance).add(unemploymentInsurance).add(injuryInsurance).add(maternityInsurance);
+      // 总计
+      let total = socialInsurance.add(providentFund);
+
+      item.socialInsurance = socialInsurance.toFixed(2);
+      item.total = total.toFixed(2);
+      return item;
+    });
+    return data;
+  },
 });
 </script>