瀏覽代碼

拉取最新代码

maotao 9 月之前
父節點
當前提交
b693408a6b

+ 310 - 0
components/repositoryFilter.vue

@@ -0,0 +1,310 @@
1
+<template>
2
+  <view class="container" @touchmove.stop.prevent v-if="pageData.pageRouter === 'default'">
3
+    <view class="container_form">
4
+      <view class="hospital">
5
+        <text class="name">标题</text>
6
+        <text class="value ellipsis">
7
+					<input class="uni-input" v-model="searchData.title" placeholder="请输入标题" />
8
+				</text>
9
+      </view>
10
+      <view class="category">
11
+        <text class="name">故障现象</text>
12
+        <text class="value">
13
+					<uni-data-picker @change="categoryChange" v-model="searchData.category" :localdata="pageData.categoryList" popup-title="请选择故障信息" :map="{text:'category',value:'id'}">
14
+						
15
+					</uni-data-picker>
16
+				</text>
17
+      </view>
18
+    </view>
19
+    <view class="container_foot">
20
+      <view class="clear" @click="clear">清除选项</view>
21
+      <view class="foot_btns">
22
+        <view class="cancel" @click="cancel">取消</view>
23
+        <view class="confirm" @click="confirm">确认</view>
24
+      </view>
25
+    </view>
26
+  </view>
27
+  <view class="mask" @touchmove.stop.prevent></view>
28
+  <view class="line" @touchmove.stop.prevent></view>
29
+  
30
+</template>
31
+
32
+<script setup>
33
+  import { defineEmits, ref, reactive, defineProps } from 'vue'
34
+  import { onLoad } from '@dcloudio/uni-app'
35
+  import { useLoginUserStore } from '@/stores/loginUser'
36
+	import { repositoryListSearchStore } from '@/stores/repositorySearch'
37
+  import { api_area, api_incidentcategory } from "@/http/api.js"
38
+  import { transform } from '@/utils/index.js'
39
+		
40
+  const emit = defineEmits(['cancelEmit', 'confirmEmit']);
41
+  const loginUserStore = useLoginUserStore();
42
+	const repositorySearchStore = repositoryListSearchStore();
43
+  
44
+  // 页面数据
45
+  const pageData = reactive({
46
+    pageRouter: 'default',
47
+    areaList: [],
48
+    categoryList: [],
49
+  });
50
+	
51
+  const searchData = reactive({
52
+		title:'',
53
+    hospital: {},
54
+    selected: 'todoingAll',
55
+    area: {id: 0, area: '全部'},
56
+    category: {},
57
+    acceptDate: [],
58
+		categoryChangeData:[]
59
+  })
60
+  
61
+  // 清空
62
+  function clear(){
63
+    searchData.category = {};
64
+    searchData.acceptDate = [];
65
+		searchData.title = '';
66
+		searchData.categoryChangeData = [];
67
+		repositorySearchStore.clearRepositoryListSearchData()
68
+  }
69
+  
70
+  // 取消
71
+  function cancel(){
72
+    emit('cancelEmit')
73
+  }
74
+  
75
+  // 确认
76
+  function confirm(){
77
+		repositorySearchStore.setRepositoryListSearchData(searchData)
78
+    emit('confirmEmit', searchData);
79
+  }
80
+
81
+  function categoryChange(val){
82
+		searchData.categoryChangeData = val.detail.value
83
+	}
84
+	
85
+  // 获取故障现象列表
86
+  function getCategoryList(){
87
+    uni.showLoading({
88
+      title: "加载中",
89
+      mask: true,
90
+    });
91
+    
92
+    let postData = {
93
+      idx: 0,
94
+      sum: 9999,
95
+      incidentcategory: {
96
+
97
+			},
98
+    }
99
+    if(loginUserStore.loginUser.user.duty){
100
+      postData.incidentcategory.duty = loginUserStore.loginUser.user.duty.id;
101
+    }else if(loginUserStore.loginUser.user.branch){
102
+      postData.incidentcategory.selectType = 'one';
103
+    }
104
+    
105
+    api_incidentcategory(postData).then(res => {
106
+      uni.hideLoading();
107
+      if(res.status == 200){
108
+        let list = res.list || [];
109
+				list = list.map(i=> ({...i, parentid: i.parent?.id}))
110
+				pageData.categoryList = transform(list, 'id', 'parentid')
111
+      }else{
112
+        uni.showToast({
113
+          icon: 'none',
114
+          title: res.msg || '请求数据失败!'
115
+        });
116
+      }
117
+    })
118
+  }
119
+	
120
+  // 页面路由跳转
121
+  function clickPageRouter(type){
122
+    pageData.pageRouter = type;
123
+    switch(type){
124
+      case 'category':
125
+        getCategoryList('one');
126
+      break;
127
+    }
128
+  }
129
+	
130
+  onLoad((option) => {
131
+		getCategoryList()
132
+		let data = repositorySearchStore.repositorySearch.data
133
+    searchData.category = data && data.category;
134
+		searchData.title = data && data.title;
135
+		searchData.categoryChangeData = data && data.categoryChangeData
136
+  })
137
+</script>
138
+
139
+<style lang="scss" scoped>
140
+.mask{
141
+  position: fixed;
142
+  left: 0;
143
+  top: 0;
144
+  right: 0;
145
+  bottom: 0;
146
+  background-color: rgba(0, 0, 0, 0.4);
147
+  z-index: 999;
148
+}
149
+.line{
150
+  content: '';
151
+  position: fixed;
152
+  top: 0;
153
+  left: 0;
154
+  z-index: 9999;
155
+  height: 8rpx;
156
+  width: 100%;
157
+  background-color: #EBEBEB;
158
+}
159
+.container{
160
+  position: fixed;
161
+  left: 125rpx;
162
+  top: 0;
163
+  right: 0;
164
+  bottom: 0;
165
+  z-index: 9999;
166
+  background-color: #F7F7F7;
167
+  display: flex;
168
+  flex-direction: column;
169
+  justify-content: space-between;
170
+  
171
+  .container_form{
172
+    height: 100%;
173
+    display: flex;
174
+    flex-direction: column;
175
+    flex: 1;
176
+    min-height: 0;
177
+		.item{
178
+			padding: 32rpx;
179
+		}
180
+  }
181
+  
182
+  .hospital{
183
+    display: flex;
184
+		align-items: center;
185
+    padding: 32rpx 24rpx 24rpx;
186
+    background-color: #fff;
187
+    .name{
188
+      font-size: 28rpx;
189
+      flex-shrink: 0;
190
+      margin-right: 24rpx;
191
+    }
192
+    .value{
193
+			width: 100%;
194
+      font-size: 22rpx;
195
+			.uni-input{
196
+				font-size: 26rpx;
197
+			}
198
+    }
199
+  }
200
+  
201
+  .areas{
202
+    flex: 1;
203
+    min-height: 0;
204
+    margin-top: 16rpx;
205
+    background-color: #fff;
206
+    .areas_item{
207
+      padding: 24rpx;
208
+      border-bottom: 1rpx solid #DEDEDE;
209
+    }
210
+  }
211
+  
212
+  .categorys{
213
+    flex: 1;
214
+    min-height: 0;
215
+    margin-top: 16rpx;
216
+    background-color: #fff;
217
+    .categorys_item{
218
+      padding: 24rpx;
219
+      border-bottom: 1rpx solid #DEDEDE;
220
+    }
221
+  }
222
+  
223
+  .tabs{
224
+    margin-top: 16rpx;
225
+    background-color: #FBFBFB;
226
+    display: flex;
227
+    flex-wrap: wrap;
228
+    justify-content: space-between;
229
+    gap: 16rpx 0;
230
+    padding: 24rpx 16rpx;
231
+    .tab{
232
+      width: 180rpx;
233
+      height: 60rpx;
234
+      display: flex;
235
+      justify-content: center;
236
+      align-items: center;
237
+      background-color: #F7F7F7;
238
+      font-size: 28rpx;
239
+      position: relative;
240
+      .newicon-xuanzejiaobiao{
241
+        opacity: 0;
242
+        position: absolute;
243
+        right: 0;
244
+        bottom: 0;
245
+        font-size: 38rpx;
246
+        color: #53B9BB;
247
+      }
248
+      &.active{
249
+        background-color: rgba(149, 220, 231, 0.30);
250
+        .newicon-xuanzejiaobiao{
251
+          opacity: 1;
252
+        }
253
+      }
254
+    }
255
+  }
256
+  
257
+  .area,
258
+  .category,
259
+  .acceptDate{
260
+    display: flex;
261
+    justify-content: space-between;
262
+    align-items: center;
263
+    padding: 24rpx;
264
+    background-color: #fff;
265
+    margin-top: 24rpx;
266
+    .name{
267
+      font-size: 28rpx;
268
+      flex-shrink: 0;
269
+      margin-right: 24rpx;
270
+    }
271
+		.value{
272
+			flex:1;
273
+		}
274
+  }
275
+  
276
+  .container_foot{
277
+    .clear{
278
+      padding: 24rpx;
279
+      font-size: 28rpx;
280
+      background-color: #fff;
281
+      margin: 0 16rpx;
282
+      display: flex;
283
+      align-items: center;
284
+      justify-content: center;
285
+    }
286
+    .foot_btns{
287
+      margin-top: 24rpx;
288
+      display: flex;
289
+      border-top: 1rpx solid #BFBFBF;
290
+      .cancel{
291
+        flex: 1;
292
+        background-color: #fff;
293
+        font-size: 32rpx;
294
+        padding: 24rpx;
295
+        display: flex;
296
+        justify-content: center;
297
+      }
298
+      .confirm{
299
+        flex: 1;
300
+        font-size: 32rpx;
301
+        padding: 24rpx;
302
+        background-color: $uni-primary;
303
+        display: flex;
304
+        justify-content: center;
305
+        color: #fff;
306
+      }
307
+    }
308
+  }
309
+}
310
+</style>

+ 2 - 1
manifest.json

@@ -62,7 +62,8 @@
62 62
         "devServer" : {
63 63
             "proxy" : {
64 64
                 "/service" : {
65
-                    "target" : "http://192.168.3.111", //请求的目标域名
65
+                    // "target" : "http://192.168.3.111", //请求的目标域名
66
+										"target" : "http://192.168.4.163", //宋程玉本地
66 67
                     "changeOrigin" : true, //是否跨域
67 68
                     "secure" : false
68 69
                 },

+ 32 - 3
pages/handler/handler.vue

@@ -85,6 +85,10 @@
85 85
 					</view>
86 86
           <uni-easyinput id="scheme" class="value" type="textarea" v-model="dataInfo.handleDescription" placeholder="请输入解决方案" :class="{formRed: isSubmit && !dataInfo.handleDescription.trim()}" />
87 87
         </view>
88
+				<view class="form_item" v-if="dataInfo.provideBackupMachine==1">
89
+				  <view class="title"><text class="required newicon newicon-bitian"></text>是否归还备用机:</view>
90
+					<uni-data-checkbox v-model="dataInfo.returnBackupMachine" :localdata="machineData"></uni-data-checkbox>
91
+				</view>
88 92
         <view class="form_item" v-if="dataInfo.category.hasSimple != 1">
89 93
           <view class="title"><text class="required newicon newicon-bitian"></text>故障现象:</view>
90 94
           <view class="value category" @click="selectCategory">
@@ -151,6 +155,10 @@
151 155
 						:clear-icon="false" :class="{formRed: isSubmit && !dataInfo.deferralDayId}">
152 156
 					</uni-data-picker>
153 157
 				</view>
158
+				<view class="form_item">
159
+				  <view class="title"><text class="required newicon newicon-bitian"></text>是否提供备用机:</view>
160
+					<uni-data-checkbox v-model="dataInfo.provideBackupMachine" :localdata="machineData"></uni-data-checkbox>
161
+				</view>
154 162
       </template>
155 163
     <!-- </scroll-view> -->
156 164
 		</view>
@@ -186,6 +194,18 @@
186 194
   // 主题颜色
187 195
   const primaryColor = ref(defaultColor)
188 196
   
197
+	// 备用机选项
198
+	const machineData = ref([
199
+		{
200
+			text:'是',
201
+			value:1
202
+		},
203
+		{
204
+			text:'否',
205
+			value:0
206
+		},
207
+	])
208
+	
189 209
   // 数据
190 210
   const dataInfo = reactive({
191 211
     tabs: [
@@ -218,7 +238,9 @@
218 238
     category: {},//故障现象
219 239
     synergetic: [],//协同人员
220 240
     isSummaryNext: false,//汇总单-下一步
221
-		introduceCount :0 //引入次数
241
+		introduceCount :0 ,//引入次数
242
+		provideBackupMachine:0,//是否提供备用机
243
+		returnBackupMachine:null//是否归还备用机
222 244
   })
223 245
   
224 246
 	// 知识库id
@@ -471,6 +493,8 @@
471 493
     dataInfo.handlerImgList = [];//处理图片列表
472 494
     dataInfo.category = {};//故障现象
473 495
     dataInfo.synergetic = [];//协同人员
496
+		dataInfo.provideBackupMachine = 0
497
+		dataInfo.returnBackupMachine = null
474 498
   }
475 499
   
476 500
   // 初始化表单
@@ -510,7 +534,9 @@
510 534
       uni.hideLoading();
511 535
       if(res.status == 200){
512 536
         dataInfo.incidentData = res.data || {};
513
-        
537
+				if(res.data.provideBackupMachine){
538
+					dataInfo.provideBackupMachine = res.data.provideBackupMachine
539
+				}
514 540
         if(dataInfo.isSummaryNext){
515 541
           // 汇总单-下一步
516 542
           dataInfo.incidentData.duty.addSummary = 0;
@@ -698,6 +724,7 @@
698 724
   
699 725
   // 处理提交事件
700 726
   function handlerOrder(){
727
+		dataInfo.incidentData.returnBackupMachine = dataInfo.returnBackupMachine
701 728
     let postData = {
702 729
       incident: dataInfo.incidentData,
703 730
 			solutionId:solutionId.value
@@ -817,7 +844,9 @@
817 844
       title: "加载中",
818 845
       mask: true,
819 846
     });
820
-    
847
+    if(dataInfo.provideBackupMachine){
848
+    	dataInfo.incidentData.provideBackupMachine = dataInfo.provideBackupMachine
849
+    }
821 850
     let postData = {
822 851
       incident: dataInfo.incidentData,
823 852
     }

+ 5 - 1
pages/incidentDetail/incidentDetail.vue

@@ -114,6 +114,10 @@
114 114
 					  <text class="name">引用知识库:</text>
115 115
 					  <text class="value">{{dataInfo.incidentData.solutionNo?dataInfo.incidentData.solutionNo:'未引用'}}</text>
116 116
 					</view>
117
+					<view class="deital_item">
118
+					  <text class="name">是否归还备用机:</text>
119
+					  <text class="value">{{dataInfo.incidentData.returnBackupMachine==1?'是':'否'}}</text>
120
+					</view>
117 121
         </view>
118 122
       </template>
119 123
 
@@ -530,7 +534,7 @@
530 534
       display: flex;
531 535
       align-items: center;
532 536
       .name{
533
-        width: 7em;
537
+        width: 8em;
534 538
         margin-right: 24rpx;
535 539
       }
536 540
       .value{

+ 10 - 1
pages/my/my.vue

@@ -46,6 +46,7 @@
46 46
       </view>
47 47
     </scroll-view>
48 48
     <view class="foot_common_btns">
49
+			<button @click="repository" type="default" class="primaryButton btn"><text class="newicon newicon-zhishiku"></text>知识库</button>
49 50
       <button @click="toBuildIncident" type="default" class="primaryButton btn"><text class="newicon newicon-xinjian2"></text>新建事件</button>
50 51
     </view>
51 52
   </view>
@@ -121,6 +122,13 @@
121 122
     })
122 123
   }
123 124
   
125
+	// 知识库
126
+	function repository(){
127
+		uni.navigateTo({
128
+		  url: `/pages/repository/repository?type=view`
129
+		})
130
+	}
131
+	
124 132
   // 新建事件
125 133
   function toBuildIncident(){
126 134
     uni.navigateTo({
@@ -166,7 +174,8 @@ page{
166 174
   .phone-filled{
167 175
     margin-right: 5rpx;
168 176
   }
169
-  .newicon-xinjian2{
177
+  .newicon-xinjian2,
178
+	.newicon-zhishiku{
170 179
     margin-right: 10rpx;
171 180
   }
172 181
   .body{

+ 65 - 10
pages/repository/repository.vue

@@ -1,6 +1,9 @@
1 1
 <template>
2 2
   <view class="categoryOne">
3
-    <view class="body" v-if="dataInfo.list.length">
3
+		<view class="filter" @click="filterClick" v-if="entrance == 'view'">
4
+		  <text class="newicon newicon-shaixuan"></text>
5
+		</view>
6
+    <view class="body" v-if="dataInfo.list.length" :class="entrance == 'view' ? 'mar-t40' : ''">
4 7
       <view class="body_item" v-for="data in dataInfo.list" :key="data.id">
5 8
 				<view @click="toCategoryTwo(data)">
6 9
 					<view class="title">{{data.title}}</view>
@@ -13,7 +16,7 @@
13 16
 					</view>
14 17
 				</view>
15 18
 				<view class="btn-style">
16
-					<button @click.stop="importData(data)" type="default" class="primaryButton btn">引入</button>
19
+					<button v-if="entrance!='view'" @click.stop="importData(data)" type="default" class="primaryButton btn">引入</button>
17 20
 				</view>
18 21
       </view>
19 22
 			<view class="back-style" @click="goBack">
@@ -26,6 +29,8 @@
26 29
 		<view v-if="dataInfo.list.length==0" class="foot_common_btns">
27 30
 			<button @click="goBack" type="default" class="primaryButton btn">返回</button>
28 31
 		</view>
32
+		<repositoryFilter v-if="isFilter" @cancelEmit="cancelFilter" 
33
+		@confirmEmit="conformFilter" :evt="evtFilter"></repositoryFilter>
29 34
   </view>
30 35
 </template>
31 36
 
@@ -36,7 +41,7 @@
36 41
   import { useSetTitle } from '@/share/useSetTitle.js'
37 42
   import { useGoBack } from '@/share/useGoBack.js'
38 43
   import { useHandlerStore } from '@/stores/handler'
39
-	
44
+	import repositoryFilter from '@/components/repositoryFilter.vue';
40 45
   useSetTitle();
41 46
 	
42 47
 	const handlerStore = useHandlerStore();
@@ -49,8 +54,14 @@
49 54
 	// 关联故障分类的知识库数量
50 55
 	const introduceCount = ref(0)
51 56
 	
52
-	// tab类型
53
-	// const tabType = ref(null)
57
+	// 入口类型
58
+	const entrance = ref(null)
59
+	
60
+	// 筛选数据
61
+	const evtFilter = ref({})
62
+	
63
+	// 筛选状态
64
+	const isFilter = ref(null)
54 65
 	
55 66
   // 数据
56 67
   const dataInfo = reactive({
@@ -89,9 +100,25 @@
89 100
 		})
90 101
 	}
91 102
 	
103
+	// 点击筛选
104
+	function filterClick(){
105
+	  isFilter.value = true;
106
+	}
107
+	
108
+	// 确认筛选
109
+	function conformFilter(evtFilter){
110
+	  evtFilter.value = evtFilter;
111
+	  isFilter.value = false;
112
+	  getList(0,evtFilter);
113
+	}
114
+	
115
+	// 关闭筛选
116
+	function cancelFilter(){
117
+	  isFilter.value = false;
118
+	}
119
+	
92 120
   // 获取列表信息
93
-  function getList(idx){
94
-		
121
+  function getList(idx,data){
95 122
     uni.showLoading({
96 123
       title: "加载中",
97 124
       mask: true,
@@ -101,18 +128,28 @@
101 128
     if(dataInfo.idx === 0){
102 129
       dataInfo.list = [];
103 130
     }
104
-		console.log(777,handlerStore.handler.data)
131
+		let categoryId = entrance.value=='view' ? data && data.category : handlerStore.handler.data.category.id
105 132
     let postData = {
106 133
       idx: dataInfo.idx,
107 134
       sum: 9999,
108 135
       solution: {
109 136
 				category:{
110
-					id:handlerStore.handler.data.category.id,
137
+					id:'',
111 138
 				},
139
+				title:'',
112 140
 				status:{id:72},
113 141
       }
114 142
     }
115
-    
143
+    if(typeof(categoryId)=='number' || typeof(categoryId)=='string'){
144
+			postData.solution.category.id = categoryId
145
+		}else{
146
+			delete postData.solution.category.id
147
+		}
148
+		if(data && data.title){
149
+			postData.solution.title = data.title
150
+		}else{
151
+			delete postData.solution.title
152
+		}
116 153
     api_getSolution(postData).then(res => {
117 154
       uni.hideLoading();
118 155
       // uni.stopPullDownRefresh();
@@ -137,6 +174,7 @@
137 174
   
138 175
   onLoad((option) => {
139 176
     dataInfo.incidentId = option.incidentId;
177
+		entrance.value = option.type
140 178
     getList(0);
141 179
   })
142 180
   
@@ -157,6 +195,23 @@
157 195
   display: flex;
158 196
   flex-direction: column;
159 197
   justify-content: space-between;
198
+	.filter{
199
+		width: 100%;
200
+	  display: flex;
201
+	  justify-content: flex-end;
202
+		align-items: center;
203
+		position: fixed;
204
+		height: 80rpx;
205
+		background: #fff;
206
+	  .newicon-shaixuan{
207
+			margin-right: 40rpx;
208
+	    font-size: 36rpx;
209
+	    color: #2C2C2C;
210
+	  }
211
+	}
212
+	.mar-t40{
213
+		margin-top: 80rpx;
214
+	}
160 215
   .head{
161 216
     height: 88rpx;
162 217
     display: flex;

+ 30 - 0
stores/repositorySearch.js

@@ -0,0 +1,30 @@
1
+import { defineStore } from "pinia"
2
+import { reactive } from 'vue'
3
+
4
+export const repositoryListSearchStore = defineStore(
5
+  "repositorySearch",
6
+  () => {
7
+    const repositorySearch = reactive({
8
+      data: null,
9
+    });
10
+
11
+    // 保存
12
+    function setRepositoryListSearchData(data) {
13
+      repositorySearch.data = data;
14
+    }
15
+    
16
+    // 清空
17
+    function clearRepositoryListSearchData() {
18
+      repositorySearch.data = null;
19
+    }
20
+
21
+    return {
22
+      repositorySearch,
23
+      setRepositoryListSearchData,
24
+      clearRepositoryListSearchData,
25
+    };
26
+  },
27
+  {
28
+    unistorage: true, // 开启后对 state 的数据读写都将持久化
29
+  },
30
+);

+ 18 - 0
utils/index.js

@@ -41,3 +41,21 @@ export const encryptByEnAESLogin = (str) => {
41 41
   });
42 42
   return tmpAES.toString();
43 43
 }
44
+
45
+// 处理树数据(parent格式转为children格式)
46
+export const transform = (nodes, id, parentid) => {
47
+  let parents = [];
48
+  const idMapping = nodes.reduce((acc, el, i) => {
49
+    acc[el[id]] = i;
50
+    return acc;
51
+  }, {});
52
+  nodes.forEach((el) => {
53
+    if (el[parentid] === null || el[parentid] === undefined) {
54
+      parents.push(el);
55
+    } else {
56
+      const parentEl = nodes[idMapping[el[parentid]]];
57
+      parentEl.children = [...(parentEl.children || []), el];
58
+    }
59
+  });
60
+  return parents;
61
+}