guarantee-lsq 2 éve
szülő
commit
fb49db6823

+ 15 - 0
src/api/workplace/backlog.js

@@ -205,3 +205,18 @@ export function getWorkplaceBacklogWeekData (parameter) {
     }
   })
 }
+/**
+ * page func
+ * parameter: { }
+ * @param parameter
+ * @returns {*}
+ */
+export function getWorkPlace () {
+  return axios({
+    url: '/index/workPlace/data',
+    method: 'get',
+    headers: {
+      'Content-Type': 'application/json;charset=UTF-8'
+    }
+  })
+}

+ 1 - 1
src/store/modules/user.js

@@ -104,7 +104,7 @@ const user = {
       return new Promise((resolve, reject) => {
         getInfo().then(response => {
           const result = response.data
-
+          console.log(response)
           // if (result && result.permissions && result.permissions.length > 0) {
           //   result.permissions.map(per => {
           //     if (per.actionEntitySet != null && per.actionEntitySet.length > 0) {

+ 319 - 39
src/views/workplace/backlog/Workbench.vue

@@ -1,70 +1,127 @@
 <template>
   <div>
-    <div class="content">
+    <div class="content" v-if="!(isSuper!==1&&roles.includes('MM'))">
       <div class="title">
         <a-icon type="bar-chart" />&nbsp;快捷按钮
       </div>
-      <a-row type="flex" justify="space-between" align="center" style="padding:30px">
-        <a-col :span="4" class="btn1 btn">
+      <a-row type="flex" justify="space-around" align="center" style="padding:30px">
+        <a-col v-if="roles.includes('REPAIR_MANAGE')||roles.includes('Maintenance_Leader')||roles.includes('Maintenance')" :span="4" class="btn1 btn">
           <my-icon type="icon-baoxiu-xuanzhong-copy" class="icon"/>
-          <span>修</span>
+          <span>修</span>
         </a-col>
-        <a-col :span="4" class="btn1 btn" style="background: linear-gradient(90deg, #FFDB5C, #FEB464);">
-          <my-icon type="icon-fapiao" class="icon"/>
-          <span>打印票证</span>
+        <a-col v-if="isSuper!==1&&(roles.includes('Maintenance_Leader')||roles.includes('Maintenance'))" :span="4" >
+          <a-badge :count="dataInfo.repairTicketPrintNum" class="btn1 btn" style="background: linear-gradient(90deg, #FFDB5C, #FEB464);">
+            <my-icon type="icon-fapiao" class="icon"/>
+            <span>打印票证</span>
+          </a-badge>
         </a-col>
-        <a-col :span="4" class="btn1 btn" style="background: linear-gradient(90deg, #9ADDD6, #91B8ED);">
+        <a-col v-if="isSuper!==1&&(roles.includes('Maintenance_Leader')||roles.includes('Maintenance'))" :span="4" class="btn1 btn" style="background: linear-gradient(90deg, #9ADDD6, #91B8ED);">
           <my-icon type="icon-shengchanlingliaoyutuiliao" class="icon"/>
           <span>领料</span>
         </a-col>
-        <a-col :span="4" class="btn1 btn" style="background: linear-gradient(90deg, #FC8C8F, #F76BD3)">
-          <my-icon type="icon-gongdan" class="icon"/>
-          <span>打印出库单</span>
+        <a-col v-if="isSuper!==1&&(roles.includes('Maintenance_Leader')||roles.includes('Maintenance'))" :span="4" >
+          <a-badge :count="dataInfo.outStorePrintNum" class="btn1 btn" style="background: linear-gradient(90deg, #FC8C8F, #F76BD3)">
+            <my-icon type="icon-gongdan" class="icon"/>
+            <span>打印出库单</span>
+          </a-badge>
         </a-col>
-        <a-col :span="4" class="btn1 btn" style="background: linear-gradient(90deg, #F084BF, #A971E8);">
+        <a-col v-if="roles.includes('REPAIR_MANAGE')||roles.includes('Maintenance_Leader')||roles.includes('Maintenance')" :span="4" class="btn1 btn" style="background: linear-gradient(90deg, #F084BF, #A971E8);">
           <my-icon type="icon-tixingshixin" class="icon"/>
           <span>隐患</span>
         </a-col>
       </a-row>
     </div>
-    <div class="content">
+    <div class="content" v-if="isSuper!==1">
       <div class="title">
         <my-icon type="icon-daibanshixiang" />&nbsp;待办事项
       </div>
       <div class="backlog">
-        <div class="btn">
-          <div class="icon">
-            <my-icon type="icon-weixiuguanli"/>
-          </div>
+        <div class="btn" v-if="roles.includes('Maintenance_Leader')||roles.includes('Maintenance')">
+          <a-badge :count="dataInfo.repairNum" >
+            <div class="icon">
+              <my-icon type="icon-weixiuguanli"/>
+            </div>
+          </a-badge>
           <div>维修</div>
         </div>
-        <div class="btn">
-          <div class="icon" style="background:#F59A23;">
-            <my-icon type="icon-xunjianjianyan"/>
-          </div>
+        <div class="btn" v-if="roles.includes('Maintenance_Leader')||roles.includes('Maintenance')">
+          <a-badge :count="dataInfo.fillCheckNum" >
+            <div class="icon" style="background:#F59A23;">
+              <my-icon type="icon-xunjianjianyan"/>
+            </div>
+          </a-badge>
           <div>巡检</div>
         </div>
-        <div class="btn">
-          <div class="icon" style="background:#02A7F0;">
-            <my-icon type="icon-shenpiliuchengguanli"/>
-          </div>
-          <div>审批</div>
+        <div class="btn" v-if="roles.includes('MM')||roles.includes('REPAIR_MANAGE')">
+          <a-badge :count="dataInfo.verifyRepairNum" >
+            <div class="icon">
+              <my-icon type="icon-weixiuguanli"/>
+            </div>
+          </a-badge>
+          <div>维修审批</div>
         </div>
-        <div class="btn">
-          <div class="icon" style="background:#EC808D;">
-            <my-icon type="icon-baobiao"/>
-          </div>
-          <div>报表</div>
+        <div class="btn" v-if="roles.includes('REPAIR_MANAGE')">
+          <a-badge :count="dataInfo.fillCheckNum" >
+            <div class="icon" style="background:#F59A23;">
+              <my-icon type="icon-xunjianjianyan"/>
+            </div>
+          </a-badge>
+          <div>巡检待审</div>
         </div>
-        <div class="btn">
-          <div class="icon" style="background:#C280FF;">
-            <my-icon type="icon-gongzuotai"/>
-          </div>
-          <div>盘点</div>
+        <div class="btn" v-if="roles.includes('REPAIR_MANAGE')">
+          <a-badge :count="dataInfo.jljdNum" >
+            <div class="icon" style="background:#02A7F0;">
+              <my-icon type="icon-shenpiliuchengguanli"/>
+            </div>
+          </a-badge>
+          <div>仪表待检定</div>
+        </div>
+        <div class="btn" v-if="roles.includes('REPAIR_MANAGE')">
+          <a-badge :count="dataInfo.verifyOutStoreNum" >
+            <div class="icon" style="background:#EC808D;">
+              <my-icon type="icon-baobiao"/>
+            </div>
+          </a-badge>
+          <div>出库待审</div>
+        </div>
+        <div class="btn" v-if="roles.includes('REPAIR_MANAGE')">
+          <a-badge :count="dataInfo.specialNum" >
+            <div class="icon" style="background:#C280FF;">
+              <my-icon type="icon-gongzuotai"/>
+            </div>
+          </a-badge>
+          <div>特种待检定</div>
+        </div>
+        <div class="btn" v-if="roles.includes('REPAIR_MANAGE')">
+          <a-badge :count="dataInfo.repairCloseNum" >
+            <div class="icon">
+              <my-icon type="icon-weixiuguanli"/>
+            </div>
+          </a-badge>
+          <div>维修待关</div>
         </div>
       </div>
     </div>
-    <div style="display:flex;">
+    <div class="content" v-if="isSuper || roles.includes('MM')">
+      <div class="title">
+        <my-icon type="icon-baobiao"/>&nbsp;图表信息
+      </div>
+      <a-row type="flex" justify="space-around" align="center" style="padding:30px">
+        <a-col :span="10" >
+          <div ref="chart1" style="height:280px;"></div>
+        </a-col>
+        <a-col :span="10" >
+          <div ref="chart2" style="height:280px;"></div>
+        </a-col>
+        <a-col :span="10" >
+          <div ref="chart3" style="height:280px;"></div>
+        </a-col>
+        <a-col :span="10" >
+          <div ref="chart4" style="height:280px;"></div>
+        </a-col>
+      </a-row>
+    </div>
+    <div style="display:flex;" v-if="isSuper!==1 && !roles.includes('MM')">
       <div class="content" style="flex:1;margin-right:10px;">
         <div class="title">
           <a-icon type="appstore" />&nbsp;常用菜单
@@ -104,7 +161,7 @@
       </div>
       <div class="content" style="flex:1;margin-left:10px;">
         <div class="title">
-          <a-icon type="bell" />&nbsp;消息通知
+          <a-icon type="bell" />&nbsp;待完善
         </div>
         <div
           class="demo-infinite-container"
@@ -126,9 +183,14 @@
 </template>
 
 <script>
+import * as echarts from 'echarts'
+import { getWorkPlace } from '@/api/workplace/backlog'
 export default {
   data () {
     return {
+      dataInfo: {},
+      isSuper: this.$store.state.user.info.superAdmin,
+      roles: this.$store.state.user.roles,
       data: [
         {
           title: 'Ant Design Title 1'
@@ -142,7 +204,225 @@ export default {
         {
           title: 'Ant Design Title 4'
         }
-      ]
+      ],
+      colors: ['#77EFD8', '#7FD6FF', '#FFDB5C', '#FEB464', '#9ADDD6', '#91B8ED', '#FC8C8F', '#F76BD3', '#F084BF', '#A971E8', '#ee6666', '#73c0de']
+    }
+  },
+  mounted () {
+    this.getInfo()
+    console.log(this.isSuper, this.roles)
+  },
+  methods: {
+    getInfo () {
+      getWorkPlace().then(res => {
+        this.dataInfo = res.data
+        const chartData1 = this.dataInfo.repairStatusList.map(item => {
+          return {
+            name: item.statusName,
+            value: item.repairNum
+          }
+        })
+        const chartData2 = this.dataInfo.factoryRoomList.map(item => {
+          return {
+            name: item.sbPositionName,
+            value: item.repairNum
+          }
+        })
+        const chartData3 = this.dataInfo.weekRepairList.map(item => {
+          return {
+            name: item.weekDayName,
+            value: item.tempTotalNum
+          }
+        })
+        const chartData4 = this.dataInfo.weekOutStoreList.map(item => {
+          return {
+            name: item.weekDayName,
+            value: item.totalNum
+          }
+        })
+        this.createChart1(chartData1)
+        this.createChart2(chartData2)
+        this.createChart3(chartData3)
+        this.createChart4(chartData4)
+
+        console.log(res)
+      })
+    },
+    createChart1 (data) {
+      data.forEach((item, index) => {
+        item.label = { color: this.colors[index] }
+      })
+      const myChart = echarts.init(this.$refs.chart1)
+      const option = {
+        color: this.colors,
+        tooltip: {
+          trigger: 'item'
+        },
+        title: {
+          left: 'center',
+          text: '维修状态数据统计'
+        },
+        series: [
+          {
+            type: 'pie',
+            radius: [20, 80],
+            center: ['50%', '50%'],
+            roseType: 'area',
+            label: {
+              formatter: `{c}\n{b}`,
+              textBorderColor: '#000',
+              textBorderWidth: 0,
+              fontSize: 10,
+              overflow: 'breakAll',
+              labelLine: {
+                length: 3
+              }
+            },
+
+            data: data
+          }
+        ]
+      }
+
+      option && myChart.setOption(option)
+    },
+    createChart2 (data) {
+      data.forEach((item, index) => {
+        item.label = { color: this.colors[index] }
+      })
+      const myChart = echarts.init(this.$refs.chart2)
+      const option = {
+        color: this.colors,
+        tooltip: {
+          trigger: 'item'
+        },
+        title: {
+          left: 'center',
+          text: '车间数据统计'
+        },
+        series: [
+          {
+            type: 'pie',
+            center: ['50%', '50%'],
+            label: {
+              formatter: `{c}\n{b}`,
+              textBorderColor: '#000',
+              textBorderWidth: 0,
+              fontSize: 10,
+              overflow: 'breakAll',
+              labelLine: {
+                length: 3
+              }
+            },
+
+            data: data
+          }
+        ]
+      }
+
+      option && myChart.setOption(option)
+    },
+    createChart3 (data) {
+      const label = data.map(item => {
+        return item.name
+      })
+      const value = data.map(item => {
+        return item.value
+      })
+      const myChart = echarts.init(this.$refs.chart3)
+      const option = {
+        title: {
+          left: 'center',
+          text: '近一周报修数据统计'
+        },
+        grid: {
+          left: '100', // 固定左边刻度宽度
+          right: '4%'
+        },
+        tooltip: {
+          trigger: 'item'
+        },
+        xAxis: {
+          type: 'category',
+          data: label,
+          axisLine: {
+            show: true
+          }
+        },
+        yAxis: {
+          type: 'value',
+          axisLine: {
+            show: true
+          }
+        },
+        series: [
+          {
+            data: value,
+            type: 'line',
+            barWidth: 14,
+            itemStyle: {
+              color: '#7FD6FF'
+            },
+            label: {
+              show: true,
+              color: '#fff'
+            }
+          }
+        ]
+      }
+
+      option && myChart.setOption(option)
+    },
+    createChart4 (data) {
+      const label = data.map(item => {
+        return item.name
+      })
+      const value = data.map(item => {
+        return item.value
+      })
+      const myChart = echarts.init(this.$refs.chart4)
+      const option = {
+        title: {
+          left: 'center',
+          text: '近一周出库数据统计'
+        },
+        grid: {
+          left: '100', // 固定左边刻度宽度
+          right: '4%'
+        },
+        tooltip: {
+          trigger: 'item'
+        },
+        xAxis: {
+          type: 'category',
+          data: label,
+          axisLine: {
+            show: true
+          }
+        },
+        yAxis: {
+          type: 'value',
+          axisLine: {
+            show: true
+          }
+        },
+        series: [
+          {
+            data: value,
+            type: 'bar',
+            barWidth: 14,
+            itemStyle: {
+              color: '#7FD6FF'
+            },
+            label: {
+              show: true,
+              color: '#fff'
+            }
+          }
+        ]
+      }
+
+      option && myChart.setOption(option)
     }
   }
 }