瀏覽代碼

拉取代码

maotao 4 月之前
父節點
當前提交
4db1196372

+ 41 - 2
components/IncidentListFilter.vue

@@ -1,11 +1,20 @@
1 1
 <template>
2 2
   <view class="container" @touchmove.stop.prevent v-if="pageData.pageRouter === 'default'">
3 3
     <view class="container_form">
4
-      <view class="hospital">
4
+      <view class="hospital" v-if="!showDept">
5 5
         <text class="name">院区</text>
6
-        <text class="value ellipsis">{{searchData.hospital ? searchData.hospital.hosName : ''}}</text>
6
+        <text class="value">{{loginUserStore.loginUser.user.currentHospital.hosName}}</text>
7 7
       </view>
8 8
       
9
+			<view class="category" v-if="showDept">
10
+			  <text class="name">维修科室</text>
11
+			  <text class="value flex-1">
12
+					<uni-data-picker @change="deptChange" v-model="searchData.deptValue" :localdata="pageData.deptList" popup-title="请选择维修科室" :map="{text:'hosName',value:'id'}">
13
+						
14
+					</uni-data-picker>
15
+				</text>
16
+			</view>
17
+			
9 18
       <view class="tabs">
10 19
         <view class="tab" :class="{active: tab.value === searchData.selected}" v-for="tab in tabs" :key="tab.value" @click="clickTab(tab)">{{tab.name}}<text class="newicon newicon-xuanzejiaobiao"></text></view>
11 20
       </view>
@@ -124,8 +133,12 @@
124 133
     pageRouter: 'default',
125 134
     areaList: [],
126 135
     categoryList: [],
136
+		deptList:[]
127 137
   });
128 138
   
139
+	// 是否开启跨科查看
140
+	const showDept = ref(false);
141
+	
129 142
   const searchData = reactive({
130 143
     hospital: {},
131 144
     selected: 'todoingAll',
@@ -133,6 +146,7 @@
133 146
     category: {},
134 147
 		categoryValue:{},
135 148
     acceptDate: [],
149
+		deptValue: {}
136 150
   })
137 151
   
138 152
   // 显示登记时间
@@ -171,6 +185,7 @@
171 185
     searchData.category = {};
172 186
     searchData.acceptDate = [];
173 187
 		searchData.categoryValue = {};
188
+		searchData.deptValue = {};
174 189
     console.log(searchData.acceptDate)
175 190
   }
176 191
   
@@ -201,6 +216,11 @@
201 216
     }
202 217
   }
203 218
   
219
+	// 选择维修科室
220
+	function deptChange(val){
221
+		searchData.deptValue = val.detail.value[val.detail.value.length-1]
222
+	}
223
+	
204 224
 	// 选择故障现象
205 225
 	function categoryChange(val){
206 226
 		searchData.category = val.detail.value[val.detail.value.length-1]
@@ -324,12 +344,31 @@
324 344
         tabs.splice(0, 0 , { name: '全部事件', value: 'all' });
325 345
       }
326 346
     }
347
+		let menu = JSON.parse(uni.getStorageSync("menuList")) || []; //菜单
348
+		console.log(9555,menu)
349
+		showDept.value = false
350
+		menu.forEach((e) => {
351
+		  if (e.title=='故障管理') {
352
+		    e.childrens.forEach((el) => {
353
+					if(el.link=='incidentManagement'){
354
+						el.childrens.forEach(item =>{
355
+							if(item.link=='strideLook'){
356
+								showDept.value = true
357
+							}
358
+						})
359
+					}
360
+		    });
361
+		  }
362
+		});
363
+		let data = loginUserStore.loginUser.infoPermission
364
+		pageData.deptList = data.dutyList
327 365
     setHospital();
328 366
     searchData.selected = evt.selected;
329 367
     searchData.area = evt.area;
330 368
     searchData.category = evt.category;
331 369
 		searchData.categoryValue = evt.categoryValue;
332 370
     searchData.acceptDate = evt.acceptDate;
371
+		searchData.deptValue = evt.deptValue.value;
333 372
   })
334 373
 </script>
335 374
 

+ 16 - 8
pages/buildIncident/buildIncident.vue

@@ -5,15 +5,15 @@
5 5
       <view class="form_item">
6 6
         <view class="title select"><text class="required newicon newicon-bitian"></text>院区:</view>
7 7
         <!-- <uni-data-select class="value" v-model="incidentData.branch" :localdata="dataInfo.branchList" :clear="false" placeholder="请选择院区" :class="{formRed: isSubmit && !incidentData.branch}" @change="changeBranch"></uni-data-select> -->
8
-<!-- 				<uni-data-picker class="value" placeholder="请选择院区" 
8
+ 				<uni-data-picker class="value" placeholder="请选择院区" 
9 9
 					:localdata="dataInfo.branchList" v-model="incidentData.branch" :clear-icon="false"
10 10
 					:class="{formRed: isSubmit && !incidentData.branch}" @change="changeBranch">
11
-				</uni-data-picker> -->
12
-				<view class="value size-14">
11
+				</uni-data-picker>
12
+		<!-- 		<view class="value size-14">
13 13
 					{{loginUserStore.loginUser.user.currentHospital.parent?
14 14
 					loginUserStore.loginUser.user.currentHospital.parent.hosName:
15 15
 					loginUserStore.loginUser.user.currentHospital.hosName}}
16
-				</view>
16
+				</view> -->
17 17
 			</view>
18 18
       <view class="form_item">
19 19
         <view class="title"><text class="required newicon newicon-bitian"></text>报修科室:</view>
@@ -217,10 +217,17 @@
217 217
 
218 218
   // 获取院区列表
219 219
   function getBranchs(){
220
-		if(loginUserStore.loginUser.user.currentHospital.parent){
221
-			incidentData.branch = loginUserStore.loginUser.user.currentHospital.parent.id
222
-		}else{
223
-			incidentData.branch = loginUserStore.loginUser.user.currentHospital.id
220
+		let arr = loginUserStore.loginUser.hospital.filter(i=>i.parent==undefined)
221
+		dataInfo.branchList = arr.map(v => ({
222
+		  text: v.hosName,
223
+		  value: v.id,
224
+		}));
225
+		if(!incidentData.branch){
226
+			if(loginUserStore.loginUser.user.currentHospital.parent){
227
+				incidentData.branch = loginUserStore.loginUser.user.currentHospital.parent.id
228
+			}else{
229
+				incidentData.branch = loginUserStore.loginUser.user.currentHospital.id
230
+			}
224 231
 		}
225 232
    //  uni.showLoading({
226 233
    //    title: "加载中",
@@ -424,6 +431,7 @@
424 431
       incidentData.duty = incidentData.category.dutyDepartment;
425 432
     }
426 433
     incidentData.title = incidentData.category.category;
434
+		console.log(777,incidentData.branch)
427 435
     incidentBuildStore.setIncidentBuildData(incidentData, 'buildIncident');
428 436
     uni.navigateTo({
429 437
       url: '/pages/assign/assign'

+ 3 - 1
pages/homePage/homePage.vue

@@ -17,7 +17,7 @@
17 17
   
18 18
   useSetTitle()
19 19
   const { wechatAuth } = useWechatAuth()
20
-  const { loginSuccess } = useLoginSuccess()
20
+  const { loginSuccess, transform } = useLoginSuccess()
21 21
 
22 22
   /**
23 23
    * 微信登录
@@ -125,6 +125,7 @@
125 125
 			changeGroup();
126 126
       if (res.state == 200) {
127 127
         loginSuccess(res.data);
128
+				transform(res.data);
128 129
       } else {
129 130
         uni.showToast({
130 131
           icon: 'none',
@@ -143,6 +144,7 @@
143 144
 			uni.setStorageSync('sysData',JSON.stringify(res.list))
144 145
 			setTimeout(_=>{
145 146
 				loginSuccess(data);
147
+				transform(data);
146 148
 			},500)
147 149
 		})
148 150
 	}

+ 10 - 2
pages/incidentList/incidentList.vue

@@ -299,7 +299,16 @@
299 299
       delete postData.incident.duty;
300 300
       delete postData.incident.hosId;
301 301
     }
302
-
302
+		
303
+		if(postData.incident.queryTask!='todo' && postData.incident.queryTask!='doing' && postData.incident.queryTask!='storage'){
304
+			if(dataInfo.evtFilter.deptValue && dataInfo.evtFilter.deptValue.value){
305
+				let infoPermission = loginUserStore.loginUser.infoPermission
306
+				let itemDept = infoPermission.dutyList.find(i=>i.id == dataInfo.evtFilter.deptValue.value)
307
+				postData.incident.duty = itemDept;
308
+				delete postData.incident.hosId;
309
+			}
310
+		}
311
+		
303 312
     if(postData.incident.queryTask === 'todo' || postData.incident.queryTask === 'owns' || postData.incident.queryTask === 'todoingAll'){
304 313
         if(loginUserStore.loginUser.user && loginUserStore.loginUser.user.group){
305 314
 					postData.incident.candidateGroups = loginUserStore.loginUser.user.group.map(v => v.id).toString();
@@ -393,7 +402,6 @@
393 402
     }
394 403
     getTabs();
395 404
   }
396
-
397 405
   onLoad((option) => {
398 406
     for(let i = 0; i<7; i++){
399 407
     	setTabbar(i)

+ 3 - 0
pages/my/my.vue

@@ -63,10 +63,12 @@
63 63
   import { useIncidentNumStore } from '@/stores/incidentNum'
64 64
   import { repositoryListSearchStore } from '@/stores/repositorySearch'
65 65
   import { useSetTabbar } from '@/share/useSetTabbar.js'
66
+	import { useIncidentBuildStore } from '@/stores/incidentBuild'
66 67
 	
67 68
   useSetTitle();
68 69
   const loginUserStore = useLoginUserStore();
69 70
   const incidentNumStore = useIncidentNumStore();
71
+	const incidentBuildStore = useIncidentBuildStore();
70 72
   const { makePhoneCall }  = useMakePhoneCall();
71 73
   const repositorySearchStore = repositoryListSearchStore();
72 74
   const { setTabbar }  = useSetTabbar();
@@ -140,6 +142,7 @@
140 142
 	
141 143
   // 新建事件
142 144
   function toBuildIncident(){
145
+		incidentBuildStore.clearIncidentBuildData();
143 146
     uni.navigateTo({
144 147
       url: '/pages/buildIncident/buildIncident'
145 148
     })

+ 11 - 3
pages/searchArea/searchArea.vue

@@ -41,6 +41,7 @@
41 41
     idx: 0,//页码
42 42
     hasMore: true,//是否有更多数据
43 43
     incidentId: undefined,//事件ID
44
+		incidentData: {},//事件对象
44 45
   })
45 46
   
46 47
   // 跳转地点列表
@@ -68,10 +69,14 @@
68 69
     //   dataInfo.list = [];
69 70
     // }
70 71
 		let hosId = null
71
-		if(loginUserStore.loginUser.user.currentHospital.parent){
72
-			hosId = loginUserStore.loginUser.user.currentHospital.parent.id
72
+		if(dataInfo.incidentData && dataInfo.incidentData.branch){
73
+			hosId = dataInfo.incidentData.branch
73 74
 		}else{
74
-			hosId = loginUserStore.loginUser.user.currentHospital.id
75
+			if(loginUserStore.loginUser.user.currentHospital.parent){
76
+				hosId = loginUserStore.loginUser.user.currentHospital.parent.id
77
+			}else{
78
+				hosId = loginUserStore.loginUser.user.currentHospital.id
79
+			}
75 80
 		}
76 81
     let postData = {
77 82
       idx: 0,
@@ -108,6 +113,9 @@
108 113
   
109 114
   onLoad((option) => {
110 115
     dataInfo.incidentId = option.incidentId;
116
+		if(incidentBuildStore.incidentBuild.data){
117
+		  dataInfo.incidentData = incidentBuildStore.incidentBuild.data;
118
+		}
111 119
     getList(0);
112 120
   })
113 121
   

+ 8 - 3
pages/searchDept/searchDept.vue

@@ -94,11 +94,16 @@
94 94
 				postData.department.hospital.id = branchId.value
95 95
 			}
96 96
 		}else{
97
-			if(loginUserStore.loginUser.user.currentHospital.parent){
98
-				postData.department.hospital.id = loginUserStore.loginUser.user.currentHospital.parent.id
97
+			if(dataInfo.incidentData && dataInfo.incidentData.branch){
98
+				postData.department.hospital.id = dataInfo.incidentData.branch
99 99
 			}else{
100
-				postData.department.hospital.id = loginUserStore.loginUser.user.currentHospital.id
100
+				if(loginUserStore.loginUser.user.currentHospital.parent){
101
+					postData.department.hospital.id = loginUserStore.loginUser.user.currentHospital.parent.id
102
+				}else{
103
+					postData.department.hospital.id = loginUserStore.loginUser.user.currentHospital.id
104
+				}
101 105
 			}
106
+			
102 107
 		}
103 108
     api_department(postData).then(res => {
104 109
       uni.hideLoading();

+ 12 - 3
pages/searchPlace/searchPlace.vue

@@ -48,6 +48,7 @@
48 48
     parentName: '',//区域名称
49 49
     place: undefined,//地点-回显
50 50
     placeObj: {},//地点列表-已选择
51
+		incidentData: {}
51 52
   })
52 53
   
53 54
   // 选择
@@ -118,10 +119,15 @@
118 119
     //   }
119 120
     // })
120 121
 		let hosId = null
121
-		if(loginUserStore.loginUser.user.currentHospital.parent){
122
-			hosId = loginUserStore.loginUser.user.currentHospital.parent.id
122
+		
123
+		if(dataInfo.incidentData && dataInfo.incidentData.branch){
124
+			hosId = dataInfo.incidentData.branch
123 125
 		}else{
124
-			hosId = loginUserStore.loginUser.user.currentHospital.id
126
+			if(loginUserStore.loginUser.user.currentHospital.parent){
127
+				hosId = loginUserStore.loginUser.user.currentHospital.parent.id
128
+			}else{
129
+				hosId = loginUserStore.loginUser.user.currentHospital.id
130
+			}
125 131
 		}
126 132
 		let postData = {
127 133
 		  idx: 0,
@@ -142,6 +148,9 @@
142 148
     dataInfo.incidentId = option.incidentId;
143 149
     dataInfo.parentId = option.parentId;
144 150
     dataInfo.parentName = option.parentName;
151
+		if(incidentBuildStore.incidentBuild.data){
152
+		  dataInfo.incidentData = incidentBuildStore.incidentBuild.data;
153
+		}
145 154
     getParamData();
146 155
   })
147 156
   

+ 9 - 5
pages/searchUser/searchUser.vue

@@ -83,11 +83,15 @@
83 83
 				userTypeIds:String(userTypes.value.map(v => v.id))
84 84
       }
85 85
     }
86
-    if(loginUserStore.loginUser.user.currentHospital.parent){
87
-    	postData.user.hospital = loginUserStore.loginUser.user.currentHospital.parent.id
88
-    }else{
89
-    	postData.user.hospital = loginUserStore.loginUser.user.currentHospital.id
90
-    }
86
+		if(dataInfo.incidentData && dataInfo.incidentData.branch){
87
+			postData.user.hospital = dataInfo.incidentData.branch
88
+		}else{
89
+			if(loginUserStore.loginUser.user.currentHospital.parent){
90
+				postData.user.hospital = loginUserStore.loginUser.user.currentHospital.parent.id
91
+			}else{
92
+				postData.user.hospital = loginUserStore.loginUser.user.currentHospital.id
93
+			}
94
+		}
91 95
     api_user(postData).then(res => {
92 96
       uni.hideLoading();
93 97
       uni.stopPullDownRefresh();

+ 23 - 2
share/useLoginSuccess.js

@@ -8,6 +8,7 @@ export function useLoginSuccess() {
8 8
 		loginUserStore.setLoginHospital(user.infoPermission.hospitals);
9 9
     loginUserStore.setLoginUser(user.user);
10 10
     loginUserStore.setLoginUserMenu(user.menu);
11
+		loginUserStore.setInfoPermission(user.infoPermission);
11 12
 		let loginType = uni.getStorageSync('loginType'); //1:处理 2:报修
12 13
     // 判断用户标识是否为处理人
13 14
     if (user.user.engineer === 1) {
@@ -32,8 +33,28 @@ export function useLoginSuccess() {
32 33
 			}
33 34
     }
34 35
   }
35
-
36
+	
37
+	// 处理树数据(parent格式转为children格式)
38
+	const transform = (data) =>{
39
+		let nodes = data.menu
40
+	  let parents = [];
41
+	  const idMapping = nodes.reduce((acc, el, i) => {
42
+	    acc[el.id] = i;
43
+	    return acc;
44
+	  }, {});
45
+	  nodes.forEach((el) => {
46
+	    if (el.parentid === null || el.parentid === undefined) {
47
+	      parents.push(el);
48
+	    } else {
49
+	      const parentEl = nodes[idMapping[el.parentid]];
50
+	      parentEl.childrens = [...(parentEl.childrens || []), el];
51
+	    }
52
+	  });
53
+		uni.setStorageSync('menuList',JSON.stringify(parents));
54
+	}
55
+	
36 56
   return {
37
-    loginSuccess
57
+    loginSuccess,
58
+		transform
38 59
   };
39 60
 }

+ 2 - 1
share/useWechatAuth.js

@@ -1,6 +1,6 @@
1 1
 import { api_wechatAuth, api_systemConfiguration, api_getDictionary} from "@/http/api.js"
2 2
 import { useLoginSuccess } from '@/share/useLoginSuccess.js'
3
-const { loginSuccess } = useLoginSuccess()
3
+const { loginSuccess, transform } = useLoginSuccess()
4 4
 export function useWechatAuth() {
5 5
   /**
6 6
    * 微信登录2
@@ -18,6 +18,7 @@ export function useWechatAuth() {
18 18
         window.location.href = res.url;
19 19
       } else {
20 20
         loginSuccess(res.user);
21
+				transform(res.user);
21 22
 				api_systemConfiguration({
22 23
 					idx: 0,
23 24
 					sum: 9999,

+ 8 - 1
stores/loginUser.js

@@ -9,8 +9,14 @@ export const useLoginUserStore = defineStore(
9 9
       menu: [],
10 10
 			hospital:[],
11 11
       sysName: '',
12
+			infoPermission:[]
12 13
     });
13
-
14
+		
15
+		// 设置当前登录权限数据
16
+		function setInfoPermission(data) {
17
+		  loginUser.infoPermission = data;
18
+		}
19
+		
14 20
     // 设置当前登录用户院区
15 21
     function setLoginHospital(data) {
16 22
       loginUser.hospital = data;
@@ -37,6 +43,7 @@ export const useLoginUserStore = defineStore(
37 43
 			setLoginHospital,
38 44
       setLoginUserMenu,
39 45
       setLoginUserTitle,
46
+			setInfoPermission
40 47
     };
41 48
   },
42 49
   {