Przeglądaj źródła

调整分组耗用进度表

Lijy 11 miesięcy temu
rodzic
commit
b42ad45270

+ 84 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/echartsData.js

@@ -141,12 +141,20 @@ export const fixedGrouping = {
       { label: '研发部工艺调试', filed: '研发部工艺调试' },
       { label: '研发部工艺调试验收', filed: '研发部工艺调试验收' },
       { label: '研发部工艺设计', filed: '研发部工艺设计' },
+      { label: '报价占比', filed: '报价占比', unit: '%' },
+      { label: '行政占比', filed: '行政占比', unit: '%'  },
+      { label: '项目设计占比', filed: '项目设计占比', unit: '%'  },
     ],
     tabPicFileds: [
       { label: '方案设计', filed: '方案设计', title: '报价项目占比' },
       // { label: '研发部', filed: '研发部', title: '行政项目占比' },
       { label: '研发部工艺调试', filed: '研发部工艺调试', title: '项目设计占比' }
     ],
+    proportion: [
+      { key: '报价占比', value: '方案设计' },
+      { key: '行政占比', value: '研发部' },
+      { key: '项目设计占比', value: '研发部工艺设计' },
+    ],
     deptIds: '8754,8768',
     name: '研发工艺',
     tableKey: 1001
@@ -155,11 +163,17 @@ export const fixedGrouping = {
     tableFileds: [
       { label: '研发部', filed: '研发部' },
       { label: '研发部BIM设计', filed: '研发部BIM设计' },
+      { label: '行政占比', filed: '行政占比', unit: '%'  },
+      { label: '设计占比', filed: '设计占比', unit: '%'  },
     ],
     tabPicFileds: [
       // { label: '研发部', filed: '研发部', title: 'BIM行政工时占比' },
       { label: '研发部BIM设计', filed: '研发部BIM设计', title: 'BIM设计项目占比' }
     ],
+    proportion: [
+      { key: '行政占比', value: '研发部' },
+      { key: '设计占比', value: '研发部BIM设计' },
+    ],
     deptIds: '8757',
     name: '研发BIM',
     tableKey: 1002,
@@ -168,11 +182,17 @@ export const fixedGrouping = {
     tableFileds: [
       { label: '研发部', filed: '研发部' },
       { label: '研发部结构设计', filed: '研发部结构设计' },
+      { label: '行政占比', filed: '行政占比', unit: '%'  },
+      { label: '设计占比', filed: '设计占比', unit: '%'  },
     ],
     tabPicFileds: [
       // { label: '研发部', filed: '研发部', title: '研发行政工时占比' },
       { label: '研发部结构设计', filed: '研发部结构设计', title: '结构设计项目占比' }
     ],
+    proportion: [
+      { key: '行政占比', value: '研发部' },
+      { key: '设计占比', value: '研发部结构设计' },
+    ],
     deptIds: '8758,8769',
     name: '研发结构',
     tableKey: 1003
@@ -183,12 +203,20 @@ export const fixedGrouping = {
       { label: '研发部电气调试验收', filed: '研发电气调试验收' },
       { label: '研发部电气设计', filed: '研发部电气设计' },
       { label: '研发部售后', filed: '研发部售后' },
+      { label: '行政占比', filed: '行政占比', unit: '%'  },
+      { label: '设计占比', filed: '设计占比', unit: '%'  },
+      { label: '调试占比', filed: '调试占比', unit: '%'  },
     ],
     tabPicFileds: [
       // { label: '研发部', filed: '研发部', title: '电气行政工时占比' },
       { label: '研发部电气设计', filed: '研发部电气设计', title: '电气设计项目占比' },
       { label: '研发部电气调试验收', filed: '研发部电气调试验收', title: '电气调试项目占比' }
     ],
+    proportion: [
+      { key: '行政占比', value: '研发部' },
+      { key: '设计占比', value: '研发部电气设计' },
+      { key: '调试占比', value: '研发部电气调试验收' },
+    ],
     deptIds: '8756,8770',
     name: '研发电气',
     tableKey: 1004
@@ -201,12 +229,20 @@ export const fixedGrouping = {
       { label: '研发部工艺设计', filed: '研发部工艺设计' },
       { label: '研发部售后', filed: '研发部售后' },
       { label: '研发部运维', filed: '研发部运维' },
+      { label: '行政占比', filed: '行政占比', unit: '%'  },
+      { label: '项目调试占比', filed: '项目调试占比', unit: '%'  },
+      { label: '售后占比', filed: '售后占比', unit: '%'  },
     ],
     tabPicFileds: [
       // { label: '研发部', filed: '研发部', title: '研发调试行政工时占比' },
       { label: '研发部工艺调试验收', filed: '研发部工艺调试验收', title: '调试项目占比' },
       { label: '研发部售后', filed: '研发部售后', title: '售后项目占比' }
     ],
+    proportion: [
+      { key: '行政占比', value: '研发部' },
+      { key: '项目调试占比', value: '研发部工艺调试验收' },
+      { key: '售后占比', value: '研发部售后' },
+    ],
     deptIds: '8755',
     name: '研发调试',
     tableKey: 1005
@@ -216,11 +252,18 @@ export const fixedGrouping = {
       { label: '生产部', filed: '生产部' },
       { label: '生产部车间', filed: '生产部车间' },
       { label: '生产部电气', filed: '生产部电气' },
+      { label: '行政占比', filed: '行政占比', unit: '%'  },
+      { label: '项目占比', filed: '项目占比', unit: '%'  },
     ],
     tabPicFileds: [
       // { label: '研发部', filed: '研发部', title: '生产部行政工时占比' },
       { label: '生产部车间,生产部电气', filed: '生产部车间,生产部电气', title: '生产项目占比' }
     ],
+    proportion: [
+      { key: '行政占比', value: '生产部' },
+      { key: '项目占比', value: '生产部车间' },
+      { key: '项目占比', value: '生产部电气' },
+    ],
     deptIds: '8762,8760,8761,8737,7903',
     name: '生产部',
     tableKey: 1006
@@ -238,6 +281,13 @@ export const fixedGrouping = {
       { label: '项目阶段', filed: '项目阶段' },
       { label: '研发部工艺调试验收', filed: '研发部工艺调试验收' },
       { label: '研发部运维', filed: '研发部运维' },
+      { label: '行政占比', filed: '行政占比', unit: '%'  },
+      { label: '配合调试占比', filed: '配合调试占比', unit: '%'  },
+      { label: '运维占比', filed: '运维占比', unit: '%'  },
+      { label: '售后占比', filed: '售后占比', unit: '%'  },
+      { label: '施工占比', filed: '施工占比', unit: '%'  },
+      { label: '施工占配合生产占比', filed: '施工占配合生产占比', unit: '%'  },
+      { label: '配合生产占比', filed: '配合生产占比', unit: '%'  },
     ],
     tabPicFileds: [
       // { label: '工程部', filed: '工程部', title: '工程部行政工时占比' },
@@ -247,8 +297,42 @@ export const fixedGrouping = {
       { label: '工程部现场安装施工', filed: '工程部现场安装施工', title: '施工占比' },
       { label: '生产部,生产部车间,生产部电气', filed: '生产部,生产部车间,生产部电气', title: '配合生产占比' },
     ],
+    proportion: [
+      { key: '行政占比', value: '工程部' },
+      { key: '配合调试占比', value: '工程部配合调试' },
+      { key: '运维占比', value: '工程部配合运维' },
+      { key: '售后占比', value: '工程部售后' },
+      { key: '施工占比', value: '工程部现场安装施工' },
+      { key: '配合生产占比', value: '生产部' },
+      { key: '配合生产占比', value: '生产部车间' },
+      { key: '配合生产占比', value: '生产部电气' },
+    ],
     deptIds: '7460,8763,8764,8765,8766',
     name: '工程部',
     tableKey: 1007
   },
+}
+
+// 更具计算返回对应的占比
+export const getProportion = (list, fixedKey) => {
+  const listItem = fixedGrouping[fixedKey]
+  const proportion = listItem.proportion
+  list.forEach(item => {
+    proportion.forEach(proportionItem => {
+      if(!item[proportionItem.key]) {
+        item[proportionItem.key] = item[proportionItem.value]
+      } else {
+        item[proportionItem.key] += item[proportionItem.value]
+      }
+    })
+  })
+  list.forEach(item => {
+    proportion.forEach(proportionItem => {
+      if(item[proportionItem.key] != 0) {
+        let num = (item[proportionItem.key] / item.totalWorkTime) * 100
+        item[proportionItem.key] = Number(num.toFixed(2))
+      }
+    })
+  })
+  return list
 }

+ 21 - 10
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/packetConsumption/tables.vue

@@ -4,24 +4,25 @@
     <template v-if="tabPosition != '1'">
       <template v-if="types != 'all'">
         <el-table :key="typesDataObj[types].tableKey" border :data="tableList" highlight-current-row :height="(+tableHeight - 0) - 1" style="width: 100%;" :span-method="objectSpanMethod" show-summary :summary-method="getSummaries" v-loading="tableLoading">
-          <el-table-column align="center" prop="departmentName" :label="'所属部门'" min-width="200">
+          <el-table-column align="center" prop="departmentName" :label="'所属部门'" min-width="200" fixed="left">
             <template slot-scope="scope">
               <template v-for="(list, listIndex) in scope.row.departmentNameList">
                 <TranslationOpenDataText type='departmentName' :openid='list'></TranslationOpenDataText> <template v-if="listIndex < scope.row.departmentNameList.length - 1">/</template>
               </template>
             </template>
           </el-table-column>
-          <el-table-column align="center" prop="jobNumber" :label="'工号'" min-width="150"></el-table-column>
-          <el-table-column align="center" prop="userName" :label="'员工'" min-width="150">
+          <el-table-column align="center" prop="userName" :label="'员工'" min-width="150" fixed="left">
             <template slot-scope="scope">
               <TranslationOpenDataText type='userName' :openid='scope.row.userName'></TranslationOpenDataText>
             </template>
           </el-table-column>
+          <el-table-column align="center" prop="jobNumber" :label="'工号'" min-width="150"></el-table-column>
           <template v-for="(item, index) in typesDataObj[types].tableFileds">
-            <el-table-column align="center" :prop="item.filed" :label="`${item.label}(h)`" min-width="170" :key="index">
+            <el-table-column align="center" :prop="item.filed" :label="`${item.label}${item.unit ? '' : '(h)'}`" min-width="170">
               <template slot-scope="scope">
                 <div>
-                  {{ scope.row[item.filed] || 0 }}
+                  <span v-if="!item.unit">{{ scope.row[item.filed] }}</span> 
+                  <el-progress :text-inside="true" :stroke-width="26" :percentage="scope.row[item.filed] || 0" :color="'#a7cef9'" v-else></el-progress>
                 </div>
               </template>
             </el-table-column>
@@ -29,7 +30,7 @@
           <el-table-column align="center" prop="totalWorkTime" :label="'总计(h)'" min-width="150">
             <template slot-scope="scope">
               <div>
-                {{ scope.row['totalWorkTime'] || 0 }}
+                {{ scope.row['totalWorkTime'] }}
               </div>
             </template>
           </el-table-column>
@@ -91,7 +92,7 @@
 </template>
 
 <script>
-import { debounce, fixedGrouping, getPieEchartOption } from "../echartsData.js";
+import { debounce, fixedGrouping, getPieEchartOption, getProportion } from "../echartsData.js";
 import EchartsEchar from "@/components/echartsEchar.vue"
 export default {
   props: {
@@ -178,10 +179,12 @@ export default {
       this.echartsTableData = dataList
       const list = fixedGrouping[type].tabPicFileds
       const item = list.find(item => item.filed == groupNames)
+      const strList = fixedGrouping[type].proportion.map(item => item.key)
       const datas = dataList.map(item => {
         return {
           name: `${item.projectName} ${item.percent}`,
-          value: item.workTime
+          value: item.workTime,
+          fledStrList: [...new Set(strList)]
         }
       })
       this.echartsEcharData = getPieEchartOption(item.title, datas)
@@ -206,12 +209,15 @@ export default {
       this.listPosition1 = 0
       this.listPosition2 = 0
       this.listPosition3 = 0
-      this.tableList = data.record.map(item => {
+      const strList = fixedGrouping[type].proportion.map(item => item.key)
+      let dataList = data.record.map(item => {
         return {
           ...item,
-          departmentNameList: item.departmentName.split('/')
+          departmentNameList: item.departmentName.split('/'),
+          fledStrList: [...new Set(strList)]
         }
       })
+      this.tableList = getProportion(dataList, this.types)
       this.typesDataObj[this.types].tableKey = this.randomInt()
       console.log(this.tableList, '<====== 返回最终的数据')
     },
@@ -313,11 +319,16 @@ export default {
     getSummaries(param) {
       const { columns, data } = param;
       const sums = [];
+      const strList = (data[0] && data[0].fledStrList) || []
       columns.forEach((column, index) => {
         if (index === 0) {
           sums[index] = '总计';
           return;
         }
+        if (strList.includes(column.property)) {
+          sums[index] = ' ';
+          return;
+        }
         const values = data.map(item => Number(item[column.property]));
         if (!values.every(value => isNaN(value))) {
           sums[index] = values.reduce((prev, curr) => {