Browse Source

feat: 增加不同角色的首页静态

liujt 1 day ago
parent
commit
eee991566b

+ 1 - 1
pages/home/components/DeviceDetail.vue

@@ -24,7 +24,7 @@
 						 <view class="device-name">{{item.postName}}</view>
                         <text class="device-name">{{ item.name+ (item.codeNumber ? '-' + item.codeNumber : '') }}</text>
 						
-					    <text v-if="item.status == 2" class="alarm-icon">🚨</text>
+					    <text v-if="item.alarmLogStatusDTO && item.alarmLogStatusDTO.alarmId" class="alarm-icon">🚨</text>
                     </view>
 					<u-tag
 						:text="getStatusLabel(item.status)"

+ 29 - 12
pages/home/home.vue

@@ -14,15 +14,30 @@
 		<view class="container">
 			<navigation :workOrder="workOrder" ref="navigationRef"></navigation>
 			<!-- 设备主管 -->
-			<equipment v-if="roleId == 102" ref="equipmentRef"></equipment>
+			 <view v-if="$isAuthorities('pda:home:equipmentSupervisor')">
+				<equipment ref="equipmentRef"></equipment>
+			 </view>
+			
 			<!-- 运维 -->
-			<Mocha v-if="roleId == 157" ref="mochaRef"></Mocha>
+			<view v-else-if="$isAuthorities('pda:home:operation')">
+				<Mocha ref="mochaRef"></Mocha>
+			</view>
+
+			<!-- 生产管理 -->
+			 <view v-else-if="$isAuthorities('pda:home:production')">
+				<production ref="productionRef"></production>
+			 </view>
+			
 			<!-- 模具舟皿 -->
-			<mould v-if="roleId == 155" ref="mouldRef"></mould>
+			 <view v-else-if="$isAuthorities('pda:home:moldBoat')">
+				<mould ref="mouldRef"></mould>
+			 </view>
 			<!-- 备品备件 -->
-			<sparePart v-if="roleId == 150" ref="sparePartRef"></sparePart>
-			<!--  -->
-			<view v-if="$isAuthorities('pda:home:manage')">
+			<view v-else-if="$isAuthorities('pda:home:spareParts')">
+				<sparePart ref="sparePartRef"></sparePart>
+			</view>
+			<!-- 管理 -->
+			<view v-else-if="$isAuthorities('pda:home:manage')">
 				<homeNew ref="homeNewRef"></homeNew>
 			</view>
 
@@ -164,6 +179,7 @@
 	import equipment from './pages/equipment/equipment.vue'
 	import Mocha from './pages/Mocha/Mocha.vue'
 	import mould from './pages/mould/mould.vue'
+	import production from './pages/production/production.vue'
 	import sparePart from './pages/sparePart/sparePart.vue'
 	import ScanCode from '@/components/ScanCode.vue'
 	import homeNew from './homeNew.vue'
@@ -202,6 +218,7 @@
 			mould,
 			sparePart,
 			ScanCode,
+			production,
 			homeNew
 		},
 		onShow() {
@@ -304,12 +321,12 @@
 			init() {
 				this.getStatistics()
 				// this.$refs.navigationRef && this.$refs.navigationRef.getCount()
-				this.$refs.equipmentRef && this.$refs.equipmentRef.getData()
-				this.$refs.mochaRef && this.$refs.mochaRef.getData()
-				this.$refs.mouldRef &&
-					(this.$refs.mouldRef.getBoatInventoryCountList(),
-						this.$refs.mouldRef.getModeInventoryCountList())
-				this.$refs.sparePartRef && this.$refs.sparePartRef.getData()
+				// this.$refs.equipmentRef && this.$refs.equipmentRef.getData()
+				// this.$refs.mochaRef && this.$refs.mochaRef.getData()
+				// this.$refs.mouldRef &&
+				// 	(this.$refs.mouldRef.getBoatInventoryCountList(),
+				// 		this.$refs.mouldRef.getModeInventoryCountList())
+				// this.$refs.sparePartRef && this.$refs.sparePartRef.getData()
 				this.timer = setTimeout(() => {
 					console.log('timer~~~home')
 					this.init()

+ 0 - 2
pages/home/homeNew.vue

@@ -226,8 +226,6 @@
 			this.getNoticeDocumentList()
 		},
 
-
-
 		methods: {
 			// 停止定时轮询
 			stopTimer() {

+ 1 - 1
pages/home/pages/Mocha/Mocha.vue

@@ -73,7 +73,7 @@ export default {
     }
   },
   created () {
-    this.getData()
+    // this.getData()
   },
   methods: {
     getData () {

+ 3 - 3
pages/home/pages/Mocha/components/TabMain.vue

@@ -55,7 +55,7 @@ export default {
   },
   watch: {
     lineCode: function (nval) {
-      this.getdata()
+      // this.getdata()
     }
   },
   data () {
@@ -71,8 +71,8 @@ export default {
     }
   },
   async mounted () {
-    await this.getlineCode()
-    this.getavgRepairTimeCount()
+    // await this.getlineCode()
+    // this.getavgRepairTimeCount()
 
     this.cWidth = uni.upx2px(750)
     //这里的 500 对应 css .charts 的 height

+ 6 - 4
pages/home/pages/Mocha/components/work_order.vue

@@ -5,6 +5,7 @@
       class="item"
       v-for="[key, item] in Object.entries(dataList)"
       :key="key"
+      @click="toNav(item.path)"
     >
       <view class="img-warp">
         <image class="img" :src="item.img" mode="widthFix"></image>
@@ -30,30 +31,31 @@ export default {
           name: '维修工单',
           num: '',
           totalSum: '',
-          path: '',
+          path: '/pages/maintenanceWorkorder/order/order',
           img: img_wx
         },
         巡点检: {
           name: '巡点检工单',
           num: '',
           totalSum: '',
-          path: '',
+          path: '/pages/tour_tally/order/order',
           img: img_xdj
         },
         保养: {
           name: '保养工单',
           num: '',
           totalSum: '',
-          path: '',
+          path: '/pages/maintenance/order/order',
           img: img_by
         }
       }
     }
   },
   created () {
-    this.getData()
+    // this.getData()
   },
   methods: {
+    toNav(url) { uni.navigateTo({ url }) },
     getData () {
       let param = {
         startTime: dayjs().subtract(7, 'day').format('YYYY-MM-DD'),

+ 54 - 10
pages/home/pages/equipment/components/TabMain.vue

@@ -63,20 +63,26 @@ export default {
       pickTabIndex: 0,
       cWidth: 750,
       cHeight: 400,
-      lineCode: '',
+      lineCode: { name: '全部产线', code: '' },
       option: {
         lineCode: []
       },
-      show: false
+      show: false,
+      apiUrl: '',
+      // 模拟数据开关
+      useMock: true,
+      mockMonths: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12']
     }
   },
   async mounted () {
-    await this.getlineCode()
-    this.getavgRepairTimeCount()
+    // await this.getlineCode()
+    // this.getavgRepairTimeCount()
 
-    this.cWidth = uni.upx2px(750)
+    this.cWidth = uni.upx2px(710)
     //这里的 500 对应 css .charts 的 height
     this.cHeight = uni.upx2px(400)
+    // 模拟数据:页面加载时直接渲染图表
+    this.getdata()
   },
   methods: {
     tabList_change (val) {
@@ -96,7 +102,7 @@ export default {
         series: data.series,
         animation: true,
         background: '#FFFFFF',
-        padding: [15, 15, 0, 5],
+        padding: [15, 15, 5, 5],
         touchMoveLimit: 24,
         legend: {
           show: false
@@ -104,8 +110,8 @@ export default {
         dataLabel: false,
         xAxis: {
           disableGrid: true,
-          scrollShow: true,
-          itemCount: 4
+          // scrollShow: true,
+          itemCount: 12
         },
         yAxis: {
           splitNumber: 3,
@@ -151,6 +157,10 @@ export default {
     },
     // 请求平均修复时间图表数据
     getavgRepairTimeCount () {
+      if (this.useMock) {
+        this.showMockRepairTime()
+        return
+      }
       let param = {
         dateType: 2,
         lineCode: this.lineCode.code
@@ -177,8 +187,27 @@ export default {
         }
       )
     },
+    // 模拟数据:平均修复时间
+    showMockRepairTime () {
+      const mockValues = [380, 420, 350, 480, 320, 520, 410, 360, 450, 390, 470, 340]
+      let seriesData = {
+        categories: this.mockMonths,
+        series: [
+          {
+            name: this.tabList[0] || '平均修复时间',
+            color: '#319547',
+            data: mockValues
+          }
+        ]
+      }
+      this.showDraw('canvasA', seriesData)
+    },
     // 请求平均故障间隔时间
     getavgFailureIntervalTimeCount () {
+      if (this.useMock) {
+        this.showMockFailureInterval()
+        return
+      }
       let param = {
         dateType: 2,
         lineCode: this.lineCode.code
@@ -206,6 +235,21 @@ export default {
         }
       })
     },
+    // 模拟数据:平均故障间隔时间
+    showMockFailureInterval () {
+      const mockValues = [580, 620, 550, 700, 510, 680, 600, 530, 650, 570, 720, 490]
+      let seriesData = {
+        categories: this.mockMonths,
+        series: [
+          {
+            name: this.tabList[1] || '平均故障间隔时间',
+            color: '#319547',
+            data: mockValues
+          }
+        ]
+      }
+      this.showDraw('canvasA', seriesData)
+    },
     // 请求产线
     getlineCode () {
       return get(this.apiUrl + '/base/line/getList').then(res => {
@@ -265,7 +309,7 @@ export default {
 <style lang="scss" scoped>
 .charts {
   position: relative;
-  width: 750rpx;
+  width: 710rpx;
   height: 400rpx;
 
   .charts-box {
@@ -278,7 +322,7 @@ export default {
   }
 
   canvas {
-    width: 750rpx;
+    width: 710rpx;
     height: 400rpx;
     background-color: #ffffff;
   }

+ 2 - 2
pages/home/pages/equipment/components/productionLine.vue

@@ -62,12 +62,12 @@ export default {
     }
   },
   created () {
-    this.getproductionLine()
+    // this.getproductionLine()
   },
   watch: {
     activeCode: function (nval) {
       if (nval) {
-        this.getequipmentStatusList()
+        // this.getequipmentStatusList()
       }
     }
   },

+ 12 - 12
pages/home/pages/equipment/equipment.vue

@@ -75,22 +75,22 @@ export default {
     }
   },
   created () {
-    this.getData()
+    // this.getData()
   },
   methods: {
-    getData () {
-      post(this.apiUrl + '/home/page/system/myToBeDoneWorkOrderList').then(
-        res => {
-          if (res.success) {
-            this.order_list = res.data.records
-            this.orderNum = res.data.total
-          }
-        }
-      )
-    },
+    // getData () {
+    //   post(this.apiUrl + '/home/page/system/myToBeDoneWorkOrderList').then(
+    //     res => {
+    //       if (res.success) {
+    //         this.order_list = res.data.records
+    //         this.orderNum = res.data.total
+    //       }
+    //     }
+    //   )
+    // },
     handlMor () {
       uni.navigateTo({
-        url: '/pages/home/backlog/backlog'
+        url: '/pages/home/myTicket/myTicket?orderType=1'
       })
     },
     // 去详情

+ 50 - 11
pages/home/pages/mould/components/TabMain.vue

@@ -61,22 +61,25 @@ export default {
   data () {
     return {
       pickTabIndex: 0,
-      cWidth: 750,
+      cWidth: 710,
       cHeight: 400,
-      lineCode: '',
+      lineCode: { name: '全部产线', code: '' },
       option: {
         lineCode: []
       },
-      show: false
+      show: false,
+      apiUrl: '',
+      useMock: true
     }
   },
   async mounted () {
-    await this.getlineCode()
-    this.getavgRepairTimeCount()
+    // await this.getlineCode()
+    // this.getavgRepairTimeCount()
 
-    this.cWidth = uni.upx2px(750)
+    this.cWidth = uni.upx2px(710)
     //这里的 500 对应 css .charts 的 height
     this.cHeight = uni.upx2px(400)
+    this.getdata()
   },
   methods: {
     tabList_change (val) {
@@ -93,6 +96,7 @@ export default {
         categories: data.categories,
         series: data.series,
         animation: true,
+        dataLabel: false,
         background: '#FFFFFF',
         color: [
           '#1890FF',
@@ -107,16 +111,18 @@ export default {
         ],
         padding: [15, 15, 0, 5],
         touchMoveLimit: 24,
-        enableScroll: true,
+        // enableScroll: true,
         legend: {},
         xAxis: {
           disableGrid: true,
           scrollShow: true,
-          itemCount: 4
+          itemCount: 12
         },
         yAxis: {
+          gridType: 'dash',
           data: [
             {
+              axisLine: false,
               min: 0
             }
           ]
@@ -124,7 +130,7 @@ export default {
         extra: {
           column: {
             type: 'group',
-            width: 30,
+            width: 8,
             activeBgColor: '#000000',
             activeBgOpacity: 0.08
           }
@@ -153,6 +159,10 @@ export default {
     },
     // 请求模具实时库存统计(柱状图)
     getavgRepairTimeCount () {
+      if (this.useMock) {
+        this.showMockMouldInventory()
+        return
+      }
       let param = {
         dateType: 2,
         lineCode: this.lineCode.code
@@ -187,6 +197,10 @@ export default {
     },
     // 请求舟皿实时库存统计(柱状图)
     getboatInventoryCount () {
+      if (this.useMock) {
+        this.showMockBoatInventory()
+        return
+      }
       let param = {
         dateType: 2,
         lineCode: this.lineCode.code
@@ -219,6 +233,31 @@ export default {
         }
       )
     },
+    // 模拟数据:模具实时库存(3组柱状图)
+    showMockMouldInventory () {
+      const months = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
+      const seriesData = {
+        categories: months,
+        series: [
+          { name: '在库', data: [45,42,48,50,44,52,47,49,46,51,43,53] },
+          { name: '在修', data: [8, 10, 7, 12, 9,  11, 6, 13, 10, 8, 12, 9] },
+          { name: '待检', data: [5, 3,  6, 4,  7,  5,  8, 4,  6,  3,  5,  7] }
+        ]
+      }
+      this.showDraw('canvasA', seriesData)
+    },
+    // 模拟数据:舟皿实时库存(2组柱状图)
+    showMockBoatInventory () {
+      const months = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
+      const seriesData = {
+        categories: months,
+        series: [
+          { name: '在库', data: [120,115,130,125,135,118,140,128,122,132,126,138] },
+          { name: '在途', data: [30, 25, 35, 28, 40,  22, 38, 32, 27, 34, 29, 36] }
+        ]
+      }
+      this.showDraw('canvasA', seriesData)
+    },
     // 请求产线
     getlineCode () {
       return get(this.apiUrl + '/base/line/getList').then(res => {
@@ -278,7 +317,7 @@ export default {
 <style lang="scss" scoped>
 .charts {
   position: relative;
-  width: 750rpx;
+  width: 710rpx;
   height: 400rpx;
 
   .charts-box {
@@ -291,7 +330,7 @@ export default {
   }
 
   canvas {
-    width: 750rpx;
+    width: 710rpx;
     height: 400rpx;
     background-color: #ffffff;
   }

+ 2 - 2
pages/home/pages/mould/mould.vue

@@ -93,8 +93,8 @@ export default {
     }
   },
   created () {
-    this.getBoatInventoryCountList()
-    this.getModeInventoryCountList()
+    // this.getBoatInventoryCountList()
+    // this.getModeInventoryCountList()
   },
   methods: {
     tabList_change (val) {

+ 366 - 0
pages/home/pages/production/components/TabMain.vue

@@ -0,0 +1,366 @@
+<template>
+  <view class="">
+    <tabTitle
+      :tabList="tabList"
+      @change="tabList_change"
+      :active="pickTabIndex"
+    ></tabTitle>
+    <view class="unit-wrap">
+      <view class="item" @click="pickerOpen">
+        <text>{{ lineCode.name }}</text>
+        <u-icon size="24rpx" class="icon" name="arrow-down"></u-icon>
+      </view>
+      <view class="item"> 单位:月 </view>
+    </view>
+    <view class="charts">
+      <canvas
+        class="charts-box"
+        canvas-id="canvasA"
+        id="canvasA"
+        @touchstart="touchstart"
+        @touchmove="touchmove"
+        @touchend="touchend"
+      ></canvas>
+    </view>
+    <u-picker
+      :defaultIndex="defaultIndex()"
+      :show="show"
+      ref="uPicker"
+      :columns="option.lineCode"
+      @close="pickerClose"
+      :closeOnClickOverlay="true"
+      @confirm="pickerConfirm"
+      keyName="name"
+    ></u-picker>
+  </view>
+</template>
+
+<script>
+import tabTitle from '@/pages/home/components/tabTitle.vue'
+import uCharts from '@/plugins/stan-ucharts/u-charts/u-charts-2.js'
+let uChartsInstance = {}
+import { get } from '@/utils/api.js'
+export default {
+  name: 'TabMain',
+  props: {
+    tabList: {
+      type: Array,
+      default: () => {
+        return []
+      }
+    }
+  },
+  components: {
+    tabTitle
+  },
+  watch: {
+    lineCode: function (nval) {
+      this.getdata()
+    }
+  },
+  data () {
+    return {
+      pickTabIndex: 0,
+      cWidth: 710,
+      cHeight: 400,
+      lineCode: { name: '全部产线', code: '' },
+      option: {
+        lineCode: []
+      },
+      show: false,
+      apiUrl: '',
+      useMock: true
+    }
+  },
+  async mounted () {
+    // await this.getlineCode()
+    // this.getavgRepairTimeCount()
+
+    this.cWidth = uni.upx2px(710)
+    //这里的 500 对应 css .charts 的 height
+    this.cHeight = uni.upx2px(400)
+    this.getdata()
+  },
+  methods: {
+    tabList_change (val) {
+      this.pickTabIndex = val
+      this.getdata()
+    },
+    showDraw (id, data) {
+      const ctx = uni.createCanvasContext(id, this)
+      uChartsInstance[id] = new uCharts({
+        type: 'column',
+        context: ctx,
+        width: this.cWidth,
+        height: this.cHeight,
+        categories: data.categories,
+        series: data.series,
+        animation: true,
+        dataLabel: false,
+        background: '#FFFFFF',
+        color: [
+          '#1890FF',
+          '#91CB74',
+          '#FAC858',
+          '#EE6666',
+          '#73C0DE',
+          '#3CA272',
+          '#FC8452',
+          '#9A60B4',
+          '#ea7ccc'
+        ],
+        padding: [15, 15, 0, 5],
+        touchMoveLimit: 24,
+        // enableScroll: true,
+        legend: {},
+        xAxis: {
+          disableGrid: true,
+          scrollShow: true,
+          itemCount: 12
+        },
+        yAxis: {
+          gridType: 'dash',
+          data: [
+            {
+              axisLine: false,
+              min: 0
+            }
+          ]
+        },
+        extra: {
+          column: {
+            type: 'group',
+            width: 8,
+            activeBgColor: '#000000',
+            activeBgOpacity: 0.08
+          }
+        }
+      })
+    },
+
+    canvasFn (e, name) {
+      uChartsInstance[name].showToolTip(e, {
+        format: function (item, category) {
+          return item.data
+        }
+      })
+    },
+    getdata () {
+      switch (this.pickTabIndex) {
+        case 0:
+          this.getavgRepairTimeCount()
+          break
+        case 1:
+          this.getboatInventoryCount()
+          break
+        default:
+          break
+      }
+    },
+    // 请求模具实时库存统计(柱状图)
+    getavgRepairTimeCount () {
+      if (this.useMock) {
+        this.showMockMouldInventory()
+        return
+      }
+      let param = {
+        dateType: 2,
+        lineCode: this.lineCode.code
+      }
+      get(this.apiUrl + '/home/page/inventory/modeInventoryCount', param).then(
+        res => {
+          if (res.success) {
+            let seriesData = {
+              categories: [],
+              series: []
+            }
+            for (let [index, item] of res.data.entries()) {
+              // 初始化series个数
+              if (index == 0) {
+                item.pointSum.forEach((n, index_s) => {
+                  seriesData.series.push({
+                    name: n.name,
+                    data: []
+                  })
+                })
+              }
+              item.pointSum.forEach((n, index_s) => {
+                seriesData.series[index_s].data.push(n.sum)
+              })
+
+              seriesData.categories.push(item.dateTime)
+            }
+            this.showDraw('canvasA', seriesData)
+          }
+        }
+      )
+    },
+    // 请求舟皿实时库存统计(柱状图)
+    getboatInventoryCount () {
+      if (this.useMock) {
+        this.showMockBoatInventory()
+        return
+      }
+      let param = {
+        dateType: 2,
+        lineCode: this.lineCode.code
+      }
+      get(this.apiUrl + '/home/page/inventory/boatInventoryCount', param).then(
+        res => {
+          if (res.success) {
+            let seriesData = {
+              categories: [],
+              series: []
+            }
+            for (let [index, item] of res.data.entries()) {
+              // 初始化series个数
+              if (index == 0) {
+                item.pointSum.forEach((n, index_s) => {
+                  seriesData.series.push({
+                    name: n.name,
+                    data: []
+                  })
+                })
+              }
+              item.pointSum.forEach((n, index_s) => {
+                seriesData.series[index_s].data.push(n.sum)
+              })
+
+              seriesData.categories.push(item.dateTime)
+            }
+            this.showDraw('canvasA', seriesData)
+          }
+        }
+      )
+    },
+    // 模拟数据:模具实时库存(3组柱状图)
+    showMockMouldInventory () {
+      const months = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
+      const seriesData = {
+        categories: months,
+        series: [
+          { name: '在库', data: [45,42,48,50,44,52,47,49,46,51,43,53] },
+          { name: '在修', data: [8, 10, 7, 12, 9,  11, 6, 13, 10, 8, 12, 9] },
+          { name: '待检', data: [5, 3,  6, 4,  7,  5,  8, 4,  6,  3,  5,  7] }
+        ]
+      }
+      this.showDraw('canvasA', seriesData)
+    },
+    // 模拟数据:舟皿实时库存(2组柱状图)
+    showMockBoatInventory () {
+      const months = ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
+      const seriesData = {
+        categories: months,
+        series: [
+          { name: '在库', data: [120,115,130,125,135,118,140,128,122,132,126,138] },
+          { name: '在途', data: [30, 25, 35, 28, 40,  22, 38, 32, 27, 34, 29, 36] }
+        ]
+      }
+      this.showDraw('canvasA', seriesData)
+    },
+    // 请求产线
+    getlineCode () {
+      return get(this.apiUrl + '/base/line/getList').then(res => {
+        if (res.success) {
+          let list = res.data.map(item => {
+            return {
+              name: item.name,
+              code: item.code
+            }
+          })
+          this.option.lineCode = [list]
+          this.lineCode = this.option.lineCode[0][0]
+        }
+      })
+    },
+    pickerConfirm (e) {
+      this.lineCode = e.value[0]
+      this.pickerClose()
+    },
+    // 打开弹窗
+    pickerOpen () {
+      this.show = true
+    },
+    // 关闭弹窗
+    pickerClose () {
+      this.show = false
+    },
+    // 默认值
+    defaultIndex () {
+      if (this.option.lineCode.length < 1) {
+        return []
+      }
+      let index = this.option.lineCode[0].findIndex(n => {
+        return n.code == this.lineCode.code
+      })
+      if (index !== -1) {
+        return [index]
+      } else {
+        return []
+      }
+    },
+    touchstart (e) {
+      uChartsInstance[e.target.id].scrollStart(e)
+    },
+    touchmove (e) {
+      uChartsInstance[e.target.id].scroll(e)
+    },
+    touchend (e) {
+      uChartsInstance[e.target.id].scrollEnd(e)
+      uChartsInstance[e.target.id].touchLegend(e)
+      uChartsInstance[e.target.id].showToolTip(e)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.charts {
+  position: relative;
+  width: 710rpx;
+  height: 400rpx;
+
+  .charts-box {
+    position: absolute;
+    top: 0;
+    left: 0;
+    right: 0;
+    bottom: 0;
+    background-color: #ffffff;
+  }
+
+  canvas {
+    width: 710rpx;
+    height: 400rpx;
+    background-color: #ffffff;
+  }
+
+  .z99 {
+    z-index: 99;
+  }
+}
+
+.unit-wrap {
+  display: flex;
+  justify-content: flex-end;
+  align-items: center;
+  padding: 20rpx 20rpx 0;
+  background: #ffffff;
+
+  .item {
+    color: #999;
+    font-size: 28rpx;
+    display: flex;
+    align-items: center;
+
+    & + .item {
+      margin-left: 30rpx;
+    }
+
+    .icon {
+      margin-left: 10rpx;
+      margin-top: 10rpx;
+    }
+  }
+}
+</style>

+ 158 - 0
pages/home/pages/production/production.vue

@@ -0,0 +1,158 @@
+<template>
+  <!-- 模具舟皿 -->
+  <view class="">
+    <TabMain :tabList="chartsTabList"></TabMain>
+    <view class="box-bar">
+      <view class="title">
+        <image src="@/static/u24.svg" class="icon" mode=""></image>
+        <view class="text"> 我的工单({{ orderNum }}) </view>
+      </view>
+      <template v-if="orderList.length > 0">
+        <view
+          class="order-list"
+          v-for="(item, index) in orderList"
+          :key="index"
+          @click="goDetails(item)"
+        >
+          <view class="s1 item">
+            <view class="b1">
+              {{ item.planName }}
+            </view>
+            <view class="b2">
+              {{ item.workOrderCode }}
+            </view>
+          </view>
+          <view class="s2 item">
+            <view class="b1">
+              {{ item.type.descp }}
+            </view>
+            <view class="b2">
+              {{ item.executeUserName }}
+            </view>
+          </view>
+          <view class="s3 item">
+            <view class="b1">
+              {{ dict.status[item.status] }}
+            </view>
+            <view class="b2">
+              {{ item.createTime }}
+            </view>
+          </view>
+        </view>
+      </template>
+      <view class="u-empty" v-else>
+        <u-empty mode="data"> </u-empty>
+      </view>
+    </view>
+  </view>
+</template>
+
+<script>
+import TabMain from './components/TabMain.vue'
+import ListOrder from '@/components/ListOrder.vue'
+import CellTip from '@/components/CellTip.vue'
+import tabTitle from '@/pages/home/components/tabTitle.vue'
+import { get } from '@/utils/api.js'
+export default {
+  components: {
+    TabMain,
+    ListOrder,
+    CellTip,
+    tabTitle
+  },
+  data () {
+    return {
+      chartsTabList: ['成型产量', '不良率'],
+      tabList: ['模具库存统计', '舟皿库存统计'],
+      pickTabIndex: 0,
+      // 模具库存统计
+      orderList: [],
+      // 舟皿库存统计
+      zmList: []
+    }
+  },
+  created () {
+    // this.getBoatInventoryCountList()
+    // this.getModeInventoryCountList()
+  },
+  methods: {
+    tabList_change (val) {
+      this.pickTabIndex = val
+    },
+    /* 舟皿库存统计列表 */
+    getBoatInventoryCountList () {
+      get(this.apiUrl + '/home/page/inventory/boatInventoryCountList').then(
+        res => {
+          if (res.success) {
+            this.zmList = res.data || []
+          }
+        }
+      )
+    },
+    /* 模具库存统计列表 */
+    getModeInventoryCountList () {
+      get(this.apiUrl + '/home/page/inventory/modeInventoryCountList').then(
+        res => {
+          if (res.success) {
+            this.orderList = res.data || []
+          }
+        }
+      )
+    }
+  }
+}
+</script>
+
+<style scoped lang="scss">
+.marginTop {
+  margin-top: 20rpx;
+}
+
+.box-bar {
+  background-color: #fff;
+  margin-top: 20rpx;
+  .title {
+    display: flex;
+    padding: 20rpx;
+    align-items: center;
+    .text {
+      font-size: 32rpx;
+      color: #333333;
+    }
+    .icon {
+      width: 37rpx;
+      height: 37rpx;
+      margin-right: 10rpx;
+    }
+  }
+}
+
+.order-list {
+  background-color: #fff;
+
+  & + .order-list {
+    border-top: 1px solid #f2f2f2;
+  }
+
+  padding: 15rpx;
+
+  .item {
+    font-size: 28rpx;
+    color: rgb(170, 170, 170);
+    display: flex;
+    justify-content: space-between;
+
+    & + .item {
+      margin-top: 15rpx;
+    }
+
+    &.s1 {
+      .b1 {
+        color: #333333;
+        font-size: 28rpx;
+        font-weight: bold;
+      }
+    }
+  }
+}
+</style>

+ 25 - 8
pages/home/pages/sparePart/components/Charts.vue

@@ -19,16 +19,20 @@ import { get } from '@/utils/api.js'
 export default {
   data () {
     return {
-      cWidth: 750,
-      cHeight: 500
+      cWidth: 710,
+      cHeight: 500,
+      useMock: true
     }
   },
   mounted () {
     //这里的 750 对应 css .charts 的 width
-    this.cWidth = uni.upx2px(750)
+    this.cWidth = uni.upx2px(710)
     //这里的 500 对应 css .charts 的 height
     this.cHeight = uni.upx2px(500)
-    this.getServerData()
+    // this.getServerData()
+    if (this.useMock) {
+      this.showMockData()
+    }
   },
   methods: {
     getServerData () {
@@ -79,6 +83,16 @@ export default {
         }
       })
     },
+    showMockData () {
+      const chartData = {
+        categories: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
+        series: [
+          { name: '入库数量', data: [35, 42, 28, 55, 31, 48, 40, 52, 33, 45, 38, 50] },
+          { name: '出库数量', data: [20, 28, 15, 38, 22, 32, 25, 36, 18, 30, 26, 35] }
+        ]
+      }
+      this.drawCharts('myid', chartData)
+    },
     drawCharts (id, data) {
       const ctx = uni.createCanvasContext(id, this)
       uChartsInstance[id] = new uCharts({
@@ -90,6 +104,7 @@ export default {
         series: data.series,
         animation: true,
         background: '#FFFFFF',
+        dataLabel: false,
         color: [
           '#1890FF',
           '#91CB74',
@@ -103,16 +118,18 @@ export default {
         ],
         padding: [15, 15, 0, 5],
         touchMoveLimit: 24,
-        enableScroll: true,
+        // enableScroll: true,
         legend: {},
         xAxis: {
           disableGrid: true,
           scrollShow: true,
-          itemCount: 4
+          itemCount: 12
         },
         yAxis: {
+          gridType: 'dash',
           data: [
             {
+              axisLine: false,
               min: 0
             }
           ]
@@ -120,7 +137,7 @@ export default {
         extra: {
           column: {
             type: 'group',
-            width: 30,
+            width: 8,
             activeBgColor: '#000000',
             activeBgOpacity: 0.08
           }
@@ -154,7 +171,7 @@ export default {
 }
 
 .charts {
-  width: 750rpx;
+  width: 710rpx;
   height: 500rpx;
   margin-top: 10rpx;
 }

+ 1 - 1
pages/home/pages/sparePart/sparePart.vue

@@ -57,7 +57,7 @@ export default {
     }
   },
   created () {
-    this.getData()
+    // this.getData()
   },
   methods: {
     getData () {