Browse Source

修改工作中心运维管理权限控制

huang_an 1 year ago
parent
commit
4496e55cb2
1 changed files with 23 additions and 12 deletions
  1. 23 12
      pages/index/index.vue

+ 23 - 12
pages/index/index.vue

@@ -33,7 +33,7 @@
 			<CellTip title="运维管理" v-if="operationsList.length > 0"></CellTip>
 			<view class="nav">
 				<view class="nav-content">
-					<view class="nav-item" v-for="(item, index) in operationsList" @click="toNav(item.url)">
+					<view class="nav-item" v-for="(item, index) in operationsList" @click="toNav(item.path)">
 						<span :class="'iconfont ' + item.icon"></span>
 						<i class="badge" v-if="item.badge">{{ item.badge }}</i>
 						<label>{{ item.name }}</label>
@@ -88,9 +88,7 @@
 
 <script>
 	import CellTip from '@/components/CellTip.vue'
-	import {
-		statistics
-	} from '@/api/myTicket'
+	import { statistics } from '@/api/myTicket'
 	export default {
 		components: {
 			CellTip
@@ -260,7 +258,8 @@
 				],
 
 				//运维类
-				operationsList: [{
+				operationsList: [
+					{
 						name: '保养工单',
 						type: 'maintenance',
 						workOrderType: 2,
@@ -358,7 +357,7 @@
 						icon: 'icon-gongdanguanli',
 						badge: 0
 						//"num": 34
-					},
+					}
 				],
 				treeList: []
 			}
@@ -366,14 +365,16 @@
 		created() {
 			this.getTree()
 		},
-		onShow() {
-			this.getStatistics()
-		},
+		// onShow() {
+		// 	this.getStatistics()
+		// },
 		methods: {
 			getStatistics() {
 				// 获取工单统计数
 				statistics().then(res => {
 					this.workOrder = res
+					console.log('this.operationsList---', this.operationsList)
+					console.log('res', res)
 					this.operationsList.forEach(item => {
 						if (item.name == '保养工单') item.badge = res.maintenanceNum
 						if (item.name == '巡点检工单') item.badge = res.patrolInspection
@@ -381,6 +382,7 @@
 						if (item.name == '维修工单') item.badge = res.repairsNum
 						// if(item.badge)
 					})
+					console.log(this.operationsList)
 				})
 			},
 			getTree() {
@@ -393,8 +395,17 @@
 						if (f.path == 'productionManage') {
 							this.productionList = f.children
 						} else if (f.path == 'operationsList') {
-							// this.operationsList = f.children
-							// console.log(this.operationsList)
+							statistics().then(res => {
+								this.workOrder = res
+								console.log('this.operationsList---', this.operationsList)
+								console.log('res', res)
+								f.children.forEach(item => {
+									if (item.name == '保养工单') item.badge = res.maintenanceNum
+									if (item.name == '巡点检工单') item.badge = res.patrolInspection
+									if (item.name == '维修工单') item.badge = res.repairsNum
+								})
+								this.operationsList = f.children
+							})
 						}
 					})
 				}
@@ -409,7 +420,7 @@
 			HandlScanCode() {
 				let _this = this
 				uni.scanCode({
-					success: function(res) {
+					success: function (res) {
 						_this.scantoRouter(res.result)
 					}
 				})