瀏覽代碼

人员绩效

yuhan 1 年之前
父節點
當前提交
3ecac44a05

+ 17 - 17
itdmWeb/src/views/module-iTDM/itdmYeWu/itdmXmShuru.vue

@@ -212,32 +212,32 @@ export default {
     }
   },
   created() {
-    console.log(11111,this.tableData1)
-    const a = JSON.parse(JSON.stringify(this.tableData1))
-    console.log(a)
+    // console.log(11111,this.tableData1)
+    // const a = JSON.parse(JSON.stringify(this.tableData1))
+    // console.log(a)
     // this.tableData.kehuMingcheng =JSON.parse(JSON.stringify(this.tableData1[0].itdmWeituoInfo.weituoClient))
     // this.tableData.kehuMingcheng =this.tableData1[0].itdmWeituoInfo.weituoClient
     this.getDevicePrice()
   },
   computed: {
-    importExcelUrl: function () {
-      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
-    },
-    totalPrice() {
-      let total = 0
-      this.tableData.xnJiesuanPrice.forEach((item) => {
-        var row = item.time * item.price
-        if (!isNaN(row)) {
-          total += Number(row)
+    // importExcelUrl: function () {
+    //   return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
+    // },
+  },
+  watch: {
+    tableData1: {
+      handler(newV, oldV){
+        if(newV){
+          console.log(newV, oldV)
+
         }
-      })
-      return total.toFixed(2)
-    },
+      }
+    }
   },
   methods: {
     getDevicePrice(){
       getDeviceList().then(response => {
-        console.log(response)
+        // console.log(response)
         this.equipmentOptions = response
       })
     },
@@ -255,7 +255,7 @@ export default {
     },
     getSummaries(param){
       const { columns, data } = param;
-      console.log(columns, data)
+      // console.log(columns, data)
       const len = columns.length;
       const sums = [];
       columns.forEach((column, index) => {

+ 101 - 74
itdmWeb/src/views/module-iTDM/itdmYeWu/itdmXnJiesuan.vue

@@ -7,14 +7,14 @@
         <td class="title" style="width: 100px">核准<br/>虚拟结算额</td>
         <td class="content" style="width: 360px">
           <div>
-            <div v-for="(item, index) in tableData.xnJiesuanE" :key="index">{{ item.name }}:{{ item.amount }};</div>
+            <div v-for="(item, index) in tableData.xnJiesuanE" :key="index">{{ item.typeName }}:{{ item.price }};</div>
           </div>
         </td>
         <td class="title white" style="width: 100px">核准<br/>虚拟结算毛利</td>
         <td class="content">
           <!-- <input v-model="tableData.xnMaoli" style="text-align: center" /> -->
           <div>
-            <div v-for="(item, index) in tableData.xnJiesuanE" :key="index">{{ item.name }}:{{ item.amount * 0.8 }};</div>
+            <div v-for="(item, index) in tableData.xnJiesuanE" :key="index">{{ item.typeName }}:{{ item.price * 0.8 }};</div>
           </div>
         </td>
       </tr>
@@ -31,11 +31,11 @@
       <tr>
         <td class="title" style="width: 100px">销售提成<br/>基数</td>
         <td class="content" style="width: 360px">
-          
+          <input v-model="tableData.tichengJishu" style="text-align: center" />
         </td>
         <td class="title white" style="width: 100px">项目满意度</td>
         <td class="content" style="width: 350px">
-          <input v-model="tableData.shuruLeixing" style="text-align: center" />
+          <input v-model="tableData.manyidu" style="text-align: center" />
         </td>
       </tr>
       <tr>
@@ -51,10 +51,10 @@
         </td>
         <td class="title white" style="width: 100px">项目绩效<br/>基数计算</td>
         <td class="content" style="width: 350px">
-          <el-table :data="jixiaoData" style="width: 100%">
+          <el-table :data="tableData.jixiaoData" style="width: 100%">
             <el-table-column type="index" label="序号"></el-table-column>
             <!-- <el-table-column prop="type" label="试验类型"></el-table-column> -->
-            <el-table-column prop="name" label="试验类型"></el-table-column>
+            <el-table-column prop="typeName" label="试验类型"></el-table-column>
             <!-- <el-table-column prop="fenduan" label="合同分段"></el-table-column> -->
             <el-table-column prop="bili" label="分段比例"></el-table-column>
             <el-table-column prop="ticheng" label="分段提成"></el-table-column>
@@ -65,12 +65,15 @@
       <tr>
         <td class="title" style="width: 100px">项目得分<br/>(百分制)</td>
         <td class="content" style="width: 360px">
-          <!-- <itdm-device-run-list></itdm-device-run-list> -->
+          <input v-model="tableData.fenshu" style="text-align: center" />
         </td>
         <!-- <td class="content" style="width: 100px" colspan="2"></td> -->
         <td class="title white" style="width: 100px">虚拟结算<br/>绩效总额</td>
         <td class="content" style="width: 350px">
-          <div v-for="(item, index) in jixiaoZonge" :key="index">{{ item }}</div>
+          <!-- 乘系数之后的数值数组 -->
+          <!-- <div v-for="(item, index) in tableData.xnJixiaoZongeArr" :key="index">{{ item.typeName }}:{{ item.price }};</div> -->
+          <!-- 乘满意度之后的总额 -->
+          <div>{{ (tableData.xnJixiaoZonge * tableData.manyidu)/100 }}</div>
         </td>
       </tr>
       <tr>
@@ -141,30 +144,85 @@ export default {
   name: 'itdmXnJiesuan',
   data() {
     return {
+      defineXishu: [
+        { type: 0, xishu: 0.40 },
+        { type: 1, xishu: 0.70 },
+        { type: 2, xishu: 1 },
+      ],
       tableData: {
         xnJiesuanE: [
-          { type: 0, name: '气候试验', amount: 50000 },
-          { type: 1, name: '力学试验', amount: 510000 },
-          { type: 2, name: '重要/非标试验', amount: 100000 },
+          // { type: 0, typeName: '气候试验', price: 50000 },
+          // { type: 1, typeName: '力学试验', price: 510000 },
+          // { type: 2, typeName: '重要试验', price: 100000 },
         ],
+        tichengJishu: null,
+        manyidu: 100,
+        fenshu: null,
         jixiaoData: [],
-        jixiaoZonge: null
+        xnJixiaoZonge: null,
+        // hasMYDJixiaoZonge: null,
+        xnJixiaoZongeArr: []
       },
+      moniData: [
+        { type: 0, typeName: '气候试验', time: 1, unitPrice: 3, costPrice: 20000 },
+        { type: 0, typeName: '气候试验', time: 1, unitPrice: 3, costPrice: 30000 },
+        { type: 1, typeName: '力学试验', time: 1, unitPrice: 3, costPrice: 100000 },
+        { type: 1, typeName: '力学试验', time: 1, unitPrice: 3, costPrice: 200000 },
+        { type: 1, typeName: '力学试验', time: 1, unitPrice: 3, costPrice: 210000 },
+        { type: 2, typeName: '重要试验', time: 1, unitPrice: 3, costPrice: 100000 },
+      ]
     }
   },
-  computed: {
-    jixiaoData(){
+  computed: {    
+  },
+  created(){
+    this.getXnJiesuanE()
+  },
+  methods: {
+    // 获取第一部分设置的项目虚拟结算额并计算数据
+    getXnJiesuanE(){
+      // 计算核准虚拟结算额
+      this.tableData.xnJiesuanE = this.changeData(this.moniData, 'costPrice')
+      // 项目绩效基础计算
+      this.computeJixiaoData()
+      // 计算虚拟结算绩效总额
+      this.computeJXXishuZonge()
+      
+    },
+    // 将试验类型相同的金额相加,用于:核准虚拟结算额和虚拟结算绩效总额
+    changeData(array, key){
+      let totalArr = []
+      array.forEach(element => {
+        var itemObj = { type: element.type, typeName: element.typeName, price: element[key] }
+        if(totalArr.length === 0){
+          totalArr.push(itemObj)
+        } else {
+          var index = totalArr.findIndex(res => res.type === element.type)
+          if(index === -1){
+            // 原来没有  push
+            totalArr.push(itemObj)
+          } else {
+            // 原来有  相加
+            totalArr[index].price += itemObj.price
+          }
+        }
+      });
+      // console.log(totalArr)
+      return totalArr
+    },
+    // 项目绩效基础计算
+    computeJixiaoData(){
       var dataLists = []
       for (let i = 0; i < this.tableData.xnJiesuanE.length; i++) {
         const item = this.tableData.xnJiesuanE[i];
-        const money = item.amount * 0.8
+        const money = item.price * 0.8
         if(money > 500000){
           // 50万以上
           console.log(money+':50万以上')
           var arr = [
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.05,
               ticheng: 50000 * 0.05,
@@ -172,7 +230,7 @@ export default {
             },
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.04,
               ticheng: 50000 * 0.04,
@@ -180,7 +238,7 @@ export default {
             },
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.03,
               ticheng: 400000 * 0.03,
@@ -188,7 +246,7 @@ export default {
             },
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.02,
               ticheng: (money - 500000) * 0.02,
@@ -202,7 +260,7 @@ export default {
           var arr = [
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.05,
               ticheng: 50000 * 0.05,
@@ -210,7 +268,7 @@ export default {
             },
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.04,
               ticheng: 50000 * 0.04,
@@ -218,7 +276,7 @@ export default {
             },
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.03,
               ticheng: (money - 100000) * 0.03,
@@ -232,7 +290,7 @@ export default {
           var arr = [
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.05,
               ticheng: 50000 * 0.05,
@@ -240,7 +298,7 @@ export default {
             },
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.04,
               ticheng: (money - 50000) * 0.04,
@@ -254,7 +312,7 @@ export default {
           var arr = [
             {
               type: item.type,
-              name: item.name,
+              typeName: item.typeName,
               fenduan: item.fenduan,
               bili: 0.05,
               ticheng: money * 0.05,
@@ -264,56 +322,25 @@ export default {
           dataLists.push(...arr)
         }
       }
-      return dataLists
+      this.tableData.jixiaoData = dataLists
+    },
+    // 计算虚拟结算绩效总额
+    computeJXXishuZonge(){
+      // 将试验类型相同的金额相加
+      var noHasXishuZonge = this.changeData(this.tableData.jixiaoData, 'ticheng')
+      var total = 0
+      var arr = noHasXishuZonge.map(item => {
+        var obj = this.defineXishu.find(res => res.type === item.type)
+        // 根据试验类型*对应系数
+        item.price = item.price * obj.xishu
+        // 计算出总和
+        total += item.price
+        return item
+      })
+      this.tableData.xnJixiaoZongeArr = arr
+      console.log(total)
+      this.tableData.xnJixiaoZonge = total
     },
-    jixiaoZonge(){
-      console.log(this.jixiaoData)
-      
-      let totalArr = []
-      let total = 0
-
-      var arr0 = this.jixiaoData.filter(res => res.type === 0)
-      var arr1 = this.jixiaoData.filter(res => res.type === 1)
-      var arr2 = this.jixiaoData.filter(res => res.type === 2)
-      
-      // 默认传如一个参数0,prev的第一项就是0,每次加上下一次的价格即可
-      let total0 = 0
-      let total1 = 0
-      let total2 = 0
-      if(arr0.length > 0){
-        var d = arr0.reduce((prev, next) => {
-          console.log(prev, next)
-          return prev + next.ticheng
-        }, 0)
-        total0 = d * 0.4
-        totalArr.push(`气候试验:${total0};`)
-        total = total + total0
-      }
-      if(arr1.length > 0){
-        var d = arr1.reduce((prev, next) => {
-          console.log(prev, next)
-          return prev + next.ticheng
-        }, 0)
-        total1 = d * 0.7
-        totalArr.push(`力学试验:${total1};`)
-        total = total + total1
-      }
-      if(arr2.length > 0){
-        var d = arr2.reduce((prev, next) => {
-          console.log(prev, next)
-          return prev + next.ticheng
-        }, 0)
-        total2 = d * 1
-        totalArr.push(`重要/非标试验:${total2};`)
-        total = total + total2
-      }
-      totalArr.push(`总计:${total};`)
-      // console.log(total)
-      return totalArr
-    }
-  },
-  methods: {
-    
   },
 }
 </script>