Browse Source

工单添加条数提示

jabin 2 năm trước cách đây
mục cha
commit
d336f40b8c
4 tập tin đã thay đổi với 51 bổ sung13 xóa
  1. 10 1
      pages/home/components/navigation.vue
  2. 10 2
      pages/home/home.vue
  3. 11 0
      pages/index/index.scss
  4. 20 10
      pages/index/index.vue

+ 10 - 1
pages/home/components/navigation.vue

@@ -11,6 +11,11 @@
 <script>
 	import { getTodoTaskPage } from '@/api/wt/index.js'
 	export default {
+		props: {
+			workOrder: {
+				default: {}
+			},
+		},
 		data() {
 			return {
 				workList: [
@@ -37,7 +42,8 @@
 					{
 						class: 'iconfont icon-yizhihang_1',
 						title: '我的已办',
-						link_url: '/pages/home/wt/done/done'
+						link_url: '/pages/home/wt/done/done',
+						// badge: 0
 						// badge:0
 						// "num": 1
 					}
@@ -50,6 +56,9 @@
 		},
 		created() {
 			this.getCount()
+			this.$nextTick(()=>{
+				this.workList[0].badge = String(this.workOrder.total)
+			})
 		},
 		methods: {
 			toNav(url) {

+ 10 - 2
pages/home/home.vue

@@ -9,7 +9,7 @@
       @clickRight="HandlScanCode"
     ></uni-nav-bar>
     <!-- <uni-nav-bar fixed="true" statusBar="true" title="工作台"></uni-nav-bar> -->
-    <navigation ref="navigationRef"></navigation>
+    <navigation :workOrder="workOrder" ref="navigationRef"></navigation>
     <!-- 设备主管 -->
     <equipment v-if="roleId == 102" ref="equipmentRef"></equipment>
     <!-- 运维 -->
@@ -30,6 +30,7 @@ import mould from './pages/mould/mould.vue'
 import sparePart from './pages/sparePart/sparePart.vue'
 import ScanCode from '@/components/ScanCode.vue'
 import { postJ, post, get } from '@/utils/api'
+import { statistics } from '@/api/myTicket'
 export default {
   components: {
     navigation,
@@ -47,6 +48,7 @@ export default {
       console.log(data, '-----scancodedate')
       _this.cbScancodedate(data)
     })
+	this.getStatistics()
     // this.Scancodedate()
   },
   onUnload () {
@@ -64,7 +66,8 @@ export default {
       // 扫码后的设备信息
       equipmentInfo: '',
       qrContent: '',
-      barType: ''
+      barType: '',
+	  workOrder: {},  // 工单统计数据
     }
   },
   created () {
@@ -76,6 +79,11 @@ export default {
     })
   },
   methods: {
+	getStatistics(){  // 获取工单统计数
+		statistics().then(res=>{
+			this.workOrder = res
+		})
+	},
     init () {
       this.$refs.navigationRef && this.$refs.navigationRef.getCount()
       this.$refs.equipmentRef && this.$refs.equipmentRef.getData()

+ 11 - 0
pages/index/index.scss

@@ -12,6 +12,7 @@ page{
 		flex-direction: row;
 		flex-wrap: wrap;
 		.nav-item{
+			position: relative;
 			display: flex;
 			flex-direction: column;
 			align-items: center;
@@ -28,6 +29,16 @@ page{
 				//color:$uni-text-color-grey ;
 				font-size: $uni-font-size-base;
 			}
+			.badge {
+				position: absolute;
+				top: 0;
+				left: 115rpx;
+				padding: 0rpx 10rpx;
+				border-radius: 38rpx;
+				background-color: #ff4949;
+				color: #fff;
+				font-style: normal;
+			}
 		}
 	}
 }

+ 20 - 10
pages/index/index.vue

@@ -35,8 +35,8 @@
 				<view class="nav-content">
 					<view class="nav-item" v-for="(item, index) in operationsList" @click="toNav(item.url)">
 						<span :class="'iconfont ' + item.icon"></span>
+						<i class="badge" v-if="item.badge">{{ item.badge }}</i>
 						<label>{{ item.name }}</label>
-						<!-- <label>{{ item.num }}</label> -->
 					</view>
 				</view>
 			</view>
@@ -76,6 +76,7 @@
 
 <script>
 	import CellTip from '@/components/CellTip.vue'
+	import { statistics } from '@/api/myTicket'
 	export default {
 		components: {
 			CellTip
@@ -83,6 +84,7 @@
 		data() {
 			return {
 				src1: 'https://cdn.uviewui.com/uview/album/1.jpg',
+				workOrder: {},  // 工单统计数据
 				//生产类
 				productionList: [
 					// {
@@ -251,9 +253,7 @@
 						workOrderType: 2,
 						url: `/pages/home/myTicket/myTicket?index=0`,
 						icon: "icon-gongdanguanli",
-						badge: {
-							value: 0
-						}
+						badge: 0
 					},
 					{
 						name: '巡点检工单',
@@ -261,9 +261,7 @@
 						workOrderType: 1,
 						url: `/pages/home/myTicket/myTicket?index=1`,
 						icon: "icon-gongdanguanli",
-						badge: {
-							value: 0
-						}
+						badge: 0
 					},
 					{
 						name: '量具送检工单',
@@ -271,9 +269,7 @@
 						workOrderType: 5,
 						url: `/pages/home/myTicket/myTicket?index=2`,
 						icon: "icon-gongdanguanli",
-						badge: {
-							value: 0
-						}
+						badge: 0
 					}
 					/*	{
 							class: "iconfont icon-xundianjian",
@@ -325,7 +321,21 @@
 		created() {
 			this.getTree()
 		},
+		onShow() {
+			this.getStatistics()
+		},
 		methods: {
+			getStatistics(){  // 获取工单统计数
+				statistics().then(res=>{
+					this.workOrder = res
+					this.operationsList.forEach(item=>{
+						if(item.name=='保养工单') item.badge = String(res.maintenanceNum)
+						if(item.name=='巡点检工单') item.badge = String(res.patrolInspection)
+						if(item.name=='量具送检工单') item.badge = String(res.quantityNum)
+						// if(item.badge)
+					})
+				})
+			},
 			getTree() {
 				let _list = uni.getStorageSync('treeList')
 				let list = JSON.parse(_list) || []