From 3a0823db9324207eb54b1747dfe3d2c6d52a9962 Mon Sep 17 00:00:00 2001
From: yangan <yangan0921@163.com>
Date: 星期一, 28 十月 2024 08:57:40 +0800
Subject: [PATCH] feat:库管修改显示条件

---
 store/index.js |  587 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 567 insertions(+), 20 deletions(-)

diff --git a/store/index.js b/store/index.js
index 3a8f2cb..e2b3d14 100644
--- a/store/index.js
+++ b/store/index.js
@@ -1,42 +1,320 @@
 import Vue from 'vue'
 import Vuex from 'vuex'
+import { webSocketUrl,BaseUrl } from '@/api/request.js'
+// 璇锋眰鐩稿叧
+import {
+	reqGet
+} from '@/api/index.js'
 Vue.use(Vuex)
 
 // 鍔ㄦ�佸簳閮╰abbar
 const userRoleTabbar = {
 	first: [{
-			pagePath: "pages/tabbar-page/index-tabbar/index-tabbar",
-			iconPath: "../../static/tabBar-icon/Gfayun.png",
-			selectedIconPath: "../../static/tabBar-icon/Bfayun1.png",
-			text: "棣栭〉"
+			pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/home.png',
+			selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+			// #endif
+			// #ifdef H5
+			iconPath: '/static/tabBar-icon/home.png',
+			selectedIconPath: '/static/tabBar-icon/homeblue.png',
+			// #endif
+			text: '棣栭〉'
 		},
 		{
-			pagePath: "pages/tabbar-page/myPage-tabbar/myPage-tabbar",
-			iconPath: "../../static/tabBar-icon/Gmine10.png",
-			selectedIconPath: "../../static/tabBar-icon/Bmine57.png",
-			text: "鎴戠殑"
+			pagePath: 'pages/customer-page/customer-my/faYunstatistics/faYunstatistics',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/statistics.png',
+			selectedIconPath: '../../static/tabBar-icon/statisticsactive.png',
+			// #endif
+			// #ifdef H5
+			iconPath: '/static/tabBar-icon/statistics.png',
+			selectedIconPath: '/static/tabBar-icon/statisticsactive.png',
+			// #endif
+			text: '缁熻'
+		},
+		{
+			pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '../../static/tabBar-icon/Bmine57.png',
+		    // #endif
+			// #ifdef H5
+			iconPath: '/static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '/static/tabBar-icon/Bmine57.png',
+			// #endif
+			text: '鎴戠殑'
 		}
 	],
 	second: [{
-			pagePath: "pages/tabbar-page/index-tabbar/index-tabbar",
-			iconPath: "../../static/tabBar-icon/Ghome.png",
-			selectedIconPath: "../../static/tabBar-icon/Bhome.png",
-			text: "棣栭〉"
+			pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/home.png',
+			selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+			// #endif
+			// #ifdef H5
+			iconPath: '/static/tabBar-icon/home.png',
+			selectedIconPath: '/static/tabBar-icon/homeblue.png',
+			// #endif
+			text: '棣栭〉'
 		},
 		{
-			pagePath: "pages/tabbar-page/myPage-tabbar/myPage-tabbar",
-			iconPath: "../../static/tabBar-icon/Gmine10.png",
-			selectedIconPath: "../../static/tabBar-icon/Bmine57.png",
-			text: "鎴戠殑"
+			pagePath: 'pages/customer-page/customer-my/faYunstatistics/faYunstatistics',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/statistics.png',
+			selectedIconPath: '../../static/tabBar-icon/statisticsactive.png',
+			// #endif
+			//#ifdef H5
+			iconPath: '/static/tabBar-icon/statistics.png',
+			selectedIconPath: '/static/tabBar-icon/statisticsactive.png',
+			// #endif
+			text: '缁熻'
+		},
+		{
+			pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '../../static/tabBar-icon/Bmine57.png',
+			// #endif
+			//#ifdef H5
+			iconPath: '/static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '/static/tabBar-icon/Bmine57.png',
+			// #endif
+			text: '鎴戠殑'
 		}
-	]
+	],
+	three: [{
+			pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/home.png',
+			selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+			// #endif
+			//#ifdef H5
+			iconPath: '/static/tabBar-icon/home.png',
+			selectedIconPath: '/static/tabBar-icon/homeblue.png',
+			// #endif
+			text: '棣栭〉'
+		},
+		{
+			pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '../../static/tabBar-icon/Bmine57.png',
+		    // #endif
+			//#ifdef H5
+			iconPath: '/static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '/static/tabBar-icon/Bmine57.png',
+			// #endif
+			text: '鎴戠殑'
+		}
+	],
+	fourth: [{
+			pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/home.png',
+			selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+			// #endif
+			//#ifdef H5
+			iconPath: '/static/tabBar-icon/home.png',
+			selectedIconPath: '/static/tabBar-icon/homeblue.png',
+			// #endif
+			text: '杩涘満'
+		},{
+			pagePath: 'pages/doorkeeper-page/doorkeeper-index/exit-index',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/home.png',
+			selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+			// #endif
+			//#ifdef H5
+			iconPath: '/static/tabBar-icon/home.png',
+			selectedIconPath: '/static/tabBar-icon/homeblue.png',
+			// #endif
+			text: '鍑哄満'
+		},
+		{
+			pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
+			//#ifdef MP-WEIXIN
+			iconPath: '../../static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '../../static/tabBar-icon/Bmine57.png',
+			// #endif
+			//#ifdef H5
+			iconPath: '/static/tabBar-icon/Gmine10.png',
+			selectedIconPath: '/static/tabBar-icon/Bmine57.png',
+			// #endif
+			text: '鎴戠殑'
+		},
+
+	],
+	five:[{
+		pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
+		//#ifdef MP-WEIXIN
+		iconPath: '../../static/tabBar-icon/home.png',
+		selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+		// #endif
+		//#ifdef H5
+		iconPath: '/static/tabBar-icon/home.png',
+		selectedIconPath: '/static/tabBar-icon/homeblue.png',
+		// #endif
+		text: '棣栭〉'
+	},
+	{
+		pagePath: 'pages/loadUnload-page/historyOrder/index',
+		//#ifdef MP-WEIXIN
+		iconPath: '../../static/tabBar-icon/home.png',
+		selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+		// #endif
+		//#ifdef H5
+		iconPath: '/static/tabBar-icon/home.png',
+		selectedIconPath: '/static/tabBar-icon/homeblue.png',
+		// #endif
+		text: '鍘嗗彶鏀跺彂鍗�'
+	},
+	{
+		pagePath: 'pages/loadUnload-page/orderPlanList/index',
+		//#ifdef MP-WEIXIN
+		iconPath:  '../../static/tabBar-icon/statistics.png',
+		selectedIconPath: '../../static/tabBar-icon/statisticsactive.png',
+		// #endif
+		//#ifdef  H5
+		iconPath:  '/static/tabBar-icon/statistics.png',
+		selectedIconPath: '/static/tabBar-icon/statisticsactive.png',
+		// #endif
+		text: '鏃ヨ鍒�'
+	},
+	{
+		pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
+		//#ifdef MP-WEIXIN
+		iconPath: '../../static/tabBar-icon/Gmine10.png',
+		selectedIconPath: '../../static/tabBar-icon/Bmine57.png',
+		// #endif
+		//#ifdef H5
+		iconPath: '/static/tabBar-icon/Gmine10.png',
+		selectedIconPath: '/static/tabBar-icon/Bmine57.png',
+		// #endif
+		text: '鎴戠殑'
+	}
+	],
+	six:[{
+		pagePath: 'pages/tabbar-page/index-tabbar/index-tabbar',
+		//#ifdef MP-WEIXIN
+		iconPath: '../../static/tabBar-icon/home.png',
+		selectedIconPath: '../../static/tabBar-icon/homeblue.png',
+		// #endif
+		//#ifdef  H5
+		iconPath: '/static/tabBar-icon/home.png',
+		selectedIconPath: '/static/tabBar-icon/homeblue.png',
+		// #endif
+		text: '棣栭〉'
+	},
+	{
+		pagePath: 'pages/tabbar-page/myPage-tabbar/myPage-tabbar',
+		//#ifdef MP-WEIXIN
+		iconPath: '../../static/tabBar-icon/Gmine10.png',
+		selectedIconPath: '../../static/tabBar-icon/Bmine57.png',
+		// #endif
+		//#ifdef  H5
+		iconPath: '/static/tabBar-icon/Gmine10.png',
+		selectedIconPath: '/static/tabBar-icon/Bmine57.png',
+		// #endif
+		text: '鎴戠殑'
+	}]
 }
 const store = new Vuex.Store({
 	state: {
 		// 鐢ㄦ埗鐣岄潰鍒ゆ柗
 		userInfo: {},
-		roleType: null, // 1瀹㈡埛锛�2璐т唬锛�3鍙告満
-		userTabbar: [] // 鐢ㄦ埛鎵�鍦ㄨ鑹插簳閮ㄨ彍鍗�
+		roleType: null, // 1瀹㈡埛锛�2璐т唬锛�3鍙告満 5瑁呭嵏鍛�
+		userTabbar: [], // 鐢ㄦ埛鎵�鍦ㄨ鑹插簳閮ㄨ彍鍗曪紝
+		// 绉伴噸鏃剁殑閲嶉噺
+		globalweigh: 0,
+		// 娑堟伅鎺ㄩ��
+		globalmessage: '',
+		// 鍏ㄥ眬weihousecode
+		globalweighHouseCode: '',
+		// 鍏ㄥ眬绾㈠鐘舵��
+		globalinfraredStatus: false,
+		// 鍙告満淇敼涓汉淇℃伅
+		globaluserInfo: {
+			phone: '',
+			name: '',
+			username: '',
+			type: 3,
+			idCard: '',
+			carNo: '',
+			carImg: '',
+			drivingImg: '',
+			axleNum: '',
+			weight: '',
+			userId: ''
+		},
+		globalisconnect: true,
+		globalisUploadimg: false,
+		globalisLogin: false,
+		socketTask: null,
+		websocketData: null, // 瀛樻斁浠庡悗绔帴鏀跺埌鐨剋ebsocket鏁版嵁
+		globalIntervalId: null,
+		is_open_socket: false, //閬垮厤閲嶅杩炴帴
+		connectNum: 1, //閲嶈繛娆℃暟,
+		reconnectTimeOut: null,  //閲嶆柊閾炬帴鐨勫畾鏃跺櫒
+		// 鎵撳嵃鍑哄叆闂ㄨ瘉  涓�娆″氨鍙互鏈夋墦鍗板叆闂ㄨ瘉锛�  涓ゆ鍙互鏈夊叆闂ㄨ瘉 鍑洪棬璇�  0娆′竴寮犻兘娌℃湁
+		ablePrintInduction: false, //鍏ラ棬璇�
+		ablePrintOut: false, //鍑洪棬璇�
+		driverTourImgList: ['https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj1.png',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj2.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj3.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj4.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj5.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj6.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj7.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj8.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj9.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj10.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj11.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj12.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj13.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj14.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj15.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj16.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj17.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj18.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj19.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj20.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj21.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj22.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj23.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj24.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj25.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj26.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj27.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj28.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj29.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj30.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj31.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj32.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj33.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj33-1.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj34.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj35.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj36.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj37.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj38.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj39.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj40.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj41.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj42.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj43.jpg',
+			'https://wrzs.czjlchem.com:9090/appimg/image/tour/driver/sj44.jpg',
+		],
+		wsgVisiable: false, //纾呮埧蹇欑寮圭獥鎺у埗
+		wsgContent: '',
+		globalIsFirstWeighing: 1, //鏄惁鏄涓�娆′笂纾�
+		confirmWeighVisiable: false, //纾呮埧绠$悊纭绉伴噸瀹屾垚鎻愮ず寮圭獥
+		confirmWeighContent: '',
+		// 绉伴噸绋冲畾鎬�  0/绋冲畾 1/闈炵ǔ瀹�  闈炵ǔ瀹氭�佷笉鑳界偣绉伴噸
+		globalWarning: false,
+		filedId:'', //鍦哄湴id
+		bunkerList:'', //浠撳簱list
+		samplingPersonList:'', //閲囨牱鍛榣ist
 	},
 	mutations: {
 		setUserInfo(state, identity) {
@@ -51,10 +329,279 @@
 			} else if (roleType == 2 || roleType == 3) {
 				state.userTabbar = userRoleTabbar.second
 				uni.setStorageSync('userTabbar', state.userTabbar)
+			} else if (roleType == 5) {
+				state.userTabbar = userRoleTabbar.five
+				uni.setStorageSync('userTabbar', state.userTabbar)
+			}else if (roleType == 6) {
+				state.userTabbar = userRoleTabbar.fourth
+				uni.setStorageSync('userTabbar', state.userTabbar)
+			}else if (roleType == 7) {
+				state.userTabbar = userRoleTabbar.six
+				uni.setStorageSync('userTabbar', state.userTabbar)
 			}
+		},
+		// 鏀瑰彉閲嶉噺
+		changeWeigh(state, payload) {
+			state.globalweigh = payload
+			console.log(state.globalweigh, '鍏ㄥ眬閲嶉噺鏀瑰彉浜�')
+		},
+		// 娑堟伅鎺ㄩ��
+		pushMessage(state, payload) {
+			state.globalmessage = payload
+		},
+		// 鏀瑰彉weighHouseCode
+		changeweighHouseCode(state, payload) {
+			state.globalweighHouseCode = payload
+			console.log(state.globalweighHouseCode, 'globalweighHouseCode鏀瑰彉浜�')
+		},
+		// 鏀瑰彉绾㈠鐘舵��
+		changeinfraredStatus(state, payload) {
+			state.globalinfraredStatus = payload
+		},
+		changeuserInfo(state, payload) {
+			state.globaluserInfo = payload
+		},
+		changesocketTask(state, payload) {
+			state.socketTask = payload
+		},
+		// 鏀圭増鍏ㄥ眬websocket鐘舵�侊紙鍒ゆ柇鏄惁姝e父閾炬帴锛�
+		changeisconnect(state, payload) {
+			state.globalisconnect = payload
+		},
+		changeisUploadimg(state, payload) {
+			state.globalisUploadimg = payload
+		},
+		changeisLogin(state, payload) {
+			state.globalisLogin = payload
+			console.log(state.globalisLogin, '鍏ㄥ眬鐧诲綍鐘舵�佹敼鍙樹簡')
+		},
+		setWebsocketData(state, data) {
+			console.log(data,'data-----')
+			state.websocketData = data
+		},
+		// 鏀瑰彉閲嶈繛鐘舵��
+		changereconnectState(state, payload) {
+			state.is_open_socket = payload
+		},
+		// 鏀瑰彉閲嶈繛娆℃暟
+		changereconnectNum(state, payload) {
+			if (payload.isWeigh) {
+				state.connectNum = payload.connectNum
+			} else {
+				if (state.connectNum < 6) {
+					state.connectNum += payload.connectNum
+				} else {
+					state.connectNum = payload.connectNum
+				}
+			}
+		},
+		changeablePrintInduction(state, payload) {
+			state.ablePrintInduction = payload
+		},
+		changeablePrintOut(state, payload) {
+			state.ablePrintOut = payload
+		},
+		changewsgVisiable(state, payload) {
+			state.wsgVisiable = payload
+		},
+		changewsgContent(state, payload) {
+			state.wsgContent = payload
+		},
+		changeglobalIsFirstWeighing(state, payload) {
+			state.globalIsFirstWeighing = payload
+		},
+		changeconfirmWeighVisiable(state, payload) {
+			state.confirmWeighVisiable = payload
+		},
+		changeconfirmWeighContent(state, payload) {
+			state.confirmWeighContent = payload
+		},
+		// 鏀瑰彉绋冲畾鎬�
+		changeWarning(state, payload) {
+			state.globalWarning = payload
+		},
+		// 鍦哄湴filedId鐨勮幏鍙�
+		getFiledId(state, payload) {
+			console.log(payload,'filedId=====')
+			state.filedId = payload
+			uni.setStorageSync('filedId', state.filedId)
+		},
+		getBunkerList(state, payload) {
+			state.bunkerList = payload
+			uni.setStorageSync('bunkerList', state.bunkerList)
+		},
+		getSamplingPersonList(state, payload) {
+			console.log('鎴戞墽琛屼簡samplingPersonList====',payload)
+			state.samplingPersonList = payload
+			uni.setStorageSync('samplingPersonList', state.samplingPersonList)
+		},
+	},
+	actions: {
+		websocketInit({ state, dispatch, commit }) {
+			// #ifdef H5
+			let wsUrl = `${webSocketUrl}?UUID=${uni.getStorageSync('token')}`
+			// #endif
+			// #ifndef H5
+			let wsUrl = `${webSocketUrl}?access_token=${uni.getStorageSync('token')}`
+			// #endif
+			state.socketTask = uni.connectSocket({
+				url: wsUrl,
+				header: {
+				clientToc: 'Y' ,
+				'CLIENT_TOC': 'Y',
+			},
+				success: res => {
+					console.log(res, 'socketSuccess')
+					if (res.errMsg === 'connectSocket:ok') {
+						commit('changeisconnect', true)
+						commit('changereconnectState', true)
+					}
+				},
+				fail: res => {
+					console.log(res, 'socketFail')
+					console.log('ws澶辫触');
+					commit('changereconnectState', false)
+					dispatch('reconnect')
+					commit('changeisconnect', false)
+				}
+			})
+			state.socketTask.onOpen(() => dispatch('websocketOnOpen'))
+			state.socketTask.onMessage(result => dispatch('websocketOnMessage', result.data))
+			state.socketTask.onClose(e => dispatch('websocketOnClose', e))
+			state.socketTask.onError(e => dispatch('websocketOnError', e))
+		},
+		websocketOnOpen({ state, commit }) {
+			console.log('ws鎵撳紑')
+			clearInterval(state.reconnectTimeOut) //娓呴櫎涓婁竴娆$殑瀹氭椂鍣�
+			clearInterval(state.globalIntervalId)  //娓呴櫎蹇冭烦
+			state.globalIntervalId = setInterval(() => {
+				state.socketTask.send({
+					data: JSON.stringify({ type: 'ping' }),
+					success(e) {
+						console.log(e, '鍙戦�佸績璺虫垚鍔�')
+					}
+				})
+			}, 30000)
+		},
+		websocketOnClose({ state, commit, dispatch }, e) {
+			if (!state.socketTask) return
+			console.log('ws鍏抽棴', e)
+			state.socketTask.close(e => {
+				commit('changeisconnect', false)
+			})
+			clearInterval(state.globalIntervalId)
+			clearInterval(state.reconnectTimeOut)
+			state.socketTask = null
+			commit('changereconnectState', false)
+			if ((state.connectNum < 6 || state.connectNum.connectNum < 6) && state.globalisLogin) {
+				uni.showToast({
+					title: '杩炴帴澶辫触锛屾鍦ㄥ皾璇曢噸鏂拌繛鎺�',
+					icon: 'none'
+				})
+				commit('changereconnectNum', { connectNum: 1, isWeigh: false })
+				dispatch('reconnect')
+			} else if (state.connectNum >= 6 && state.globalisLogin) {
+				commit('changereconnectNum', { connectNum: 1, isWeigh: false })
+				uni.showToast({
+					title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�',
+					icon: 'none'
+				})
+			} else {
+				return
+			}
+		},
+		websocketOnError({ state, commit, dispatch }, e) {
+			// 濡傛灉閲嶈繛鐘舵�佷负false鍒欎笉杩涜閲嶈繛锛屼负true鎵嶄細
+			console.log('ws鎶ラ敊', e)
+			clearInterval(state.globalIntervalId)
+			clearInterval(state.reconnectTimeOut)
+			state.socketTask = null
+			commit('changereconnectState', false)
+			if (state.connectNum < 6 || state.connectNum.connectNum < 6 && state.globalisLogin) {
+				uni.showToast({
+					title: '杩炴帴澶辫触锛屾鍦ㄥ皾璇曢噸鏂拌繛鎺�',
+					icon: 'none'
+				})
+				commit('changereconnectNum', { connectNum: 1, isWeigh: false })
+				dispatch('reconnect')
+			} else if (state.connectNum > 6 && state.globalisLogin) {
+				commit('changereconnectNum', { connectNum: 1, isWeigh: false })
+				uni.showToast({
+					title: '缃戠粶寮傚父,璇风◢鍚庨噸璇�',
+					icon: 'none'
+				})
+			} else {
+				return
+			}
+		},
+		// 鎺ユ敹鏁版嵁
+		websocketOnMessage({ state, commit }, result) {
+			commit('setWebsocketData', result)
+		},
+		// 閲嶆柊杩炴帴
+		reconnect({ state, commit, dispatch }) {
+			console.log(state.is_open_socket, '閲嶆柊杩炴帴socket鐘舵��');
+			clearInterval(state.globalIntervalId)
+			if (!state.is_open_socket && state.globalisLogin) {
+				state.reconnectTimeOut = setInterval(() => {
+					dispatch('websocketInit')
+				}, 5000)
+			}
+		},
 
+		//filedId
+		async getBunkerList({ state,dispatch, commit }) { //鑾峰彇filedId
+			// this.$reqGet(`getList/${this.deptId}`).then(res => {
+			//   console.log(res,'鎯冲緱鍒癴iledId')
+			// })
+			let deptId = uni.getStorageSync('userInfo').deptIds
+			console.log(deptId,'deptId====')
+			await uni.request({  //鑾峰彇deptId
+				url: `/wrzs/jccoalfiled/list/${deptId}`,
+				method: 'GET',
+				header: {
+					Authorization: 'Bearer' + ' ' + uni.getStorageSync('token'),
+					clientToc: 'Y',
+					'CLIENT_TOC': 'Y',
+				},
+				success: res => {
+					console.log(res,'filedId鎺ュ彛000000000000')
+					commit('getFiledId',res.data.data[0].id || '')
+					dispatch('getFiledIdCoalBunker')
+					// console.log(res,'shuj------')
+					// this.filedId = res.data?.data.length > 0 ? res.data.data[0].id : '';
+					// this.getFiledIdCoalBunker()
+				}
+			})
 
-		}
+		},
+		getSamplingPerson({ state, commit }) {  //閲囨牱浜�
+			let params = {
+				current: 1,
+				size: 999,
+				type: 7
+			}
+			reqGet('pageCarAndHuoDai',params).then(res => {
+			  console.log(res,'pageCarAndHuoDai======')
+				if(res.code == 0) {
+					let temp = res.data.records
+					commit('getSamplingPersonList',temp)
+				}
+			})
+		},
+		getFiledIdCoalBunker({ state, commit }) {  //浠撳簱鍒楄〃锛堥噰鏍峰湴鐐癸級
+			let filedId = uni.getStorageSync('filedId')
+			console.log(filedId,'鏈�缁堢殑filedId=============')
+			reqGet('getFiledIdCoalBunker', {filedId: filedId}).then(res => {
+				console.log(res,'res----浠撳簱')
+				commit('getBunkerList',res.data)
+			})
+		},
+	},
+	getters:{
+		websocketData:(state) => state.websocketData,
+		samplingPersonList: (state) => state.samplingPersonList
+
 	}
 })
 

--
Gitblit v1.9.1