maotao 9 månader sedan
förälder
incheckning
57b6c96020

+ 88 - 0
components/DsFilePicker.vue

@@ -0,0 +1,88 @@
1
+<template>
2
+  <uni-file-picker ref="handlerImgRef" v-model="baseFormData.handlerImgList" limit="3" @success="handlerImgSuccess" @fail="handlerImgFail" @select="handlerImgSelect" @delete="handlerImgDelete" title="(支持JPG/PNG格式图片,单张大小10M以内)"></uni-file-picker>
3
+</template>
4
+
5
+<script setup>
6
+  import { defineEmits, ref, reactive, defineProps } from 'vue'
7
+  import { onLoad } from '@dcloudio/uni-app'
8
+  import { useLoginUserStore } from '@/stores/loginUser'
9
+  import { useUploadFile } from '@/share/useUploadFile.js'
10
+
11
+  const emit = defineEmits(['cancelEmit', 'knowEmit']);
12
+  const { inspectionExecuteId } = defineProps({
13
+    inspectionExecuteId: {
14
+      type: Number,
15
+    }
16
+  });
17
+  const loginUserStore = useLoginUserStore();
18
+  const { uploadFile }  = useUploadFile();
19
+
20
+  // 表单数据
21
+  const baseFormData = reactive({
22
+    handlerImgList: [],
23
+  })
24
+  
25
+  // 处理图片
26
+  const handlerImgRef = ref(null)
27
+  // handlerImgRef.value.upload();
28
+  
29
+  // 处理图片
30
+  function handlerOrderImg(imgObj){
31
+    return uploadFile(imgObj, 'incident', inspectionExecuteId.value)
32
+  }
33
+  
34
+  // 上传报修图片成功
35
+  function handlerImgSuccess(e){
36
+    baseFormData.handlerImgList.forEach(v => {
37
+      v.url = v.path;
38
+    })
39
+    
40
+    let requestList = [];
41
+    
42
+    // 处理图片
43
+    baseFormData.handlerImgList.forEach(v => {
44
+      let handlerOrderImg$ = handlerOrderImg(v);
45
+      requestList.push(handlerOrderImg$);
46
+    })
47
+    
48
+    Promise.all(requestList).then(resList => {
49
+      uni.hideLoading();
50
+      console.log(resList);
51
+      uni.showToast({
52
+      	icon: 'none',
53
+        title: '建单成功',
54
+        mask: true,
55
+      });
56
+      setTimeout(() => {
57
+        uni.reLaunch({
58
+          url: '/pages/incidentList/incidentList',
59
+        })
60
+      }, 1500)
61
+    })
62
+  }
63
+  
64
+  // 上传报修图片失败
65
+  function handlerImgFail(e){
66
+    baseFormData.handlerImgList.forEach(v => {
67
+      v.url = v.path;
68
+    })
69
+  }
70
+  
71
+  // 选择上传图片
72
+  function handlerImgSelect(e){
73
+    baseFormData.handlerImgList = baseFormData.handlerImgList.concat(e.tempFiles);
74
+  }
75
+  
76
+  // 删除上传图片
77
+  function handlerImgDelete(e){
78
+    baseFormData.handlerImgList = baseFormData.handlerImgList.filter(v => e.tempFile.uuid != v.uuid);
79
+  }
80
+  
81
+  onLoad((option) => {
82
+    console.log(inspectionExecuteId)
83
+  })
84
+</script>
85
+
86
+<style lang="scss" scoped>
87
+
88
+</style>

+ 400 - 0
components/InspectionListFilter.vue

@@ -0,0 +1,400 @@
1
+<template>
2
+  <view class="container" @touchmove.stop.prevent v-if="pageData.pageRouter === 'default'">
3
+    <view class="container_form">
4
+      <view class="category" @click="clickPageRouter('inspectionForm')">
5
+        <text class="name">巡检单</text>
6
+        <text class="value ellipsis">{{searchData.inspectionForm ? searchData.inspectionForm.name : ''}}</text>
7
+      </view>
8
+      
9
+      <view class="area" @click="clickPageRouter('area')">
10
+        <text class="name">楼栋</text>
11
+        <text class="value ellipsis">{{searchData.area ? searchData.area.buildingName : ''}}</text>
12
+      </view>
13
+      
14
+      <view class="acceptDate" @click="changeIsShowDate()">
15
+        <text class="name">登记时间</text>
16
+        <text class="value ellipsis" v-if="searchData.acceptDate.length">{{searchData.acceptDate[0] || ''}}至{{searchData.acceptDate[1] || ''}}</text>
17
+        <text class="value ellipsis" v-else>全部</text>
18
+      </view>
19
+    </view>
20
+    <view class="container_foot">
21
+      <view class="clear" @click="clear">清除选项</view>
22
+      <view class="foot_btns">
23
+        <view class="cancel" @click="cancel">取消</view>
24
+        <view class="confirm" @click="confirm">确认</view>
25
+      </view>
26
+    </view>
27
+    <PyhRdtpicker
28
+        :show="isShowDate"
29
+        :start="start"
30
+        :end="end"
31
+        @showchange="showDatechange"
32
+        :value="searchData.acceptDate"
33
+        @change="bindDateChange"
34
+        :themeColor="primaryColor"
35
+    ></PyhRdtpicker>
36
+  </view>
37
+  <view class="container" @touchmove.stop.prevent v-else-if="pageData.pageRouter === 'area'">
38
+    <view class="container_form">
39
+      <view class="hospital">
40
+        <text class="name">楼栋</text>
41
+      </view>
42
+      
43
+      <scroll-view scroll-y class="areas">
44
+        <view class="areas_item" v-for="area in pageData.areaList" :key="area.id" @click="clickArea(area)">{{area.buildingName}}</view>
45
+      </scroll-view>
46
+    </view>
47
+    <view class="container_foot">
48
+      <view class="foot_btns">
49
+        <view class="cancel" @click="clickPageRouter('default')">取消</view>
50
+      </view>
51
+    </view>
52
+  </view>
53
+  <view class="container" @touchmove.stop.prevent v-else-if="pageData.pageRouter === 'inspectionForm'">
54
+    <view class="container_form">
55
+      <view class="hospital">
56
+        <text class="name">巡检单</text>
57
+      </view>
58
+      
59
+      <scroll-view scroll-y class="categorys">
60
+        <view class="categorys_item" v-for="item in pageData.inspectionFormList" :key="item.id" @click="clickInspectionForm(item)">{{item.name}}</view>
61
+      </scroll-view>
62
+    </view>
63
+    <view class="container_foot">
64
+      <view class="foot_btns">
65
+        <view class="cancel" @click="clickPageRouter('default')">取消</view>
66
+      </view>
67
+    </view>
68
+  </view>
69
+  <view class="mask" @touchmove.stop.prevent></view>
70
+  <view class="line" @touchmove.stop.prevent></view>
71
+  
72
+</template>
73
+
74
+<script setup>
75
+  import PyhRdtpicker from '@/components/PyhRdtpicker/PyhRdtpicker.vue';
76
+  import { defineEmits, ref, reactive, defineProps } from 'vue'
77
+  import { startOfYear, endOfYear, format, add } from 'date-fns'
78
+  import { onLoad } from '@dcloudio/uni-app'
79
+  import { useLoginUserStore } from '@/stores/loginUser'
80
+  import { api_building, api_inspectionForm } from "@/http/api.js"
81
+  import { defaultColor } from '@/static/js/theme.js'
82
+  
83
+  const emit = defineEmits(['cancelEmit', 'confirmEmit']);
84
+  const { evt } = defineProps({
85
+    evt: {
86
+      type: Object,
87
+      required: true,
88
+    },
89
+  });
90
+  const loginUserStore = useLoginUserStore();
91
+  
92
+  // 主题颜色
93
+  const primaryColor = ref(defaultColor)
94
+  
95
+  // 登记时间
96
+  const isShowDate = ref(false)
97
+  
98
+  const start = ref(format(startOfYear(add(new Date(), { years: -5})), 'yyyy-MM-dd'));
99
+  const end = ref(format(endOfYear(add(new Date(), { years: 0})), 'yyyy-MM-dd'));
100
+  
101
+  // 页面数据
102
+  const pageData = reactive({
103
+    pageRouter: 'default',
104
+    areaList: [],
105
+    inspectionFormList: [],
106
+  });
107
+  
108
+  const searchData = reactive({
109
+    area: {id: 0, buildingName: '全部'},
110
+    inspectionForm: {id: 0, name: '全部'},
111
+    acceptDate: [],
112
+  })
113
+  
114
+  // 显示登记时间
115
+  function showDatechange(){
116
+    isShowDate.value = !isShowDate.value;
117
+  }
118
+  
119
+  // 登记时间确定
120
+  function bindDateChange(e){
121
+    console.log(e);
122
+    searchData.acceptDate = e;
123
+  }
124
+  
125
+  // 点击区域
126
+  function clickArea(area){
127
+    pageData.pageRouter = 'default';
128
+    searchData.area = area;
129
+  }
130
+  
131
+  // 点击故障现象
132
+  function clickInspectionForm(inspectionForm){
133
+    pageData.pageRouter = 'default';
134
+    searchData.inspectionForm = inspectionForm;
135
+  }
136
+  
137
+  // 清空
138
+  function clear(){
139
+    searchData.area = {id: 0, buildingName: '全部'};
140
+    searchData.inspectionForm = {id: 0, name: '全部'};
141
+    searchData.acceptDate = [];
142
+    console.log(searchData.acceptDate)
143
+  }
144
+  
145
+  // 取消
146
+  function cancel(){
147
+    emit('cancelEmit')
148
+  }
149
+  
150
+  // 确认
151
+  function confirm(){
152
+    emit('confirmEmit', searchData);
153
+  }
154
+  
155
+  // 获取楼栋列表
156
+  function getAreaList(){
157
+    uni.showLoading({
158
+      title: "加载中",
159
+      mask: true,
160
+    });
161
+    
162
+    let postData = {
163
+      idx: 0,
164
+      sum: 9999,
165
+      account: loginUserStore.loginUser.user.account,
166
+      building: {},
167
+    }
168
+    api_building(postData).then(res => {
169
+      uni.hideLoading();
170
+      if(res.status == 200){
171
+        let list = res.list || [];
172
+        pageData.areaList = [{ id: 0, buildingName: '全部' }, ...list];
173
+      }else{
174
+        uni.showToast({
175
+          icon: 'none',
176
+          title: res.msg || '请求数据失败!'
177
+        });
178
+      }
179
+    })
180
+  }
181
+  
182
+  // 获取故障现象列表
183
+  function getInspectionFormList(){
184
+    uni.showLoading({
185
+      title: "加载中",
186
+      mask: true,
187
+    });
188
+    
189
+    let postData = {
190
+      idx: 0,
191
+      sum: 9999,
192
+      account: loginUserStore.loginUser.user.account,
193
+      inspectionForm: {
194
+        status: {value: "1"},
195
+      },
196
+    }
197
+    
198
+    api_inspectionForm(postData).then(res => {
199
+      uni.hideLoading();
200
+      if(res.status == 200){
201
+        let list = res.list || [];
202
+        pageData.inspectionFormList = [{ id:0, name: '全部' }, ...list];
203
+      }else{
204
+        uni.showToast({
205
+          icon: 'none',
206
+          title: res.msg || '请求数据失败!'
207
+        });
208
+      }
209
+    })
210
+  }
211
+  
212
+  // 页面路由跳转
213
+  function clickPageRouter(type){
214
+    pageData.pageRouter = type;
215
+    switch(type){
216
+      case 'area':
217
+        getAreaList();
218
+      break;
219
+      case 'inspectionForm':
220
+        getInspectionFormList();
221
+      break;
222
+    }
223
+  }
224
+  
225
+  // 显示登记时间
226
+  function changeIsShowDate(type){
227
+    isShowDate.value = true;
228
+  }
229
+  
230
+  onLoad((option) => {
231
+    searchData.area = evt.area;
232
+    searchData.inspectionForm = evt.inspectionForm;
233
+    searchData.acceptDate = evt.acceptDate;
234
+  })
235
+</script>
236
+
237
+<style lang="scss" scoped>
238
+.mask{
239
+  position: fixed;
240
+  left: 0;
241
+  top: 0;
242
+  right: 0;
243
+  bottom: 0;
244
+  background-color: rgba(0, 0, 0, 0.4);
245
+  z-index: 999;
246
+}
247
+.line{
248
+  content: '';
249
+  position: fixed;
250
+  top: 0;
251
+  left: 0;
252
+  z-index: 9999;
253
+  height: 8rpx;
254
+  width: 100%;
255
+  background-color: #EBEBEB;
256
+}
257
+.container{
258
+  position: fixed;
259
+  left: 125rpx;
260
+  top: 0;
261
+  right: 0;
262
+  bottom: 0;
263
+  z-index: 9999;
264
+  background-color: #F7F7F7;
265
+  display: flex;
266
+  flex-direction: column;
267
+  justify-content: space-between;
268
+  
269
+  .container_form{
270
+    height: 100%;
271
+    display: flex;
272
+    flex-direction: column;
273
+    flex: 1;
274
+    min-height: 0;
275
+  }
276
+  
277
+  .hospital{
278
+    display: flex;
279
+    justify-content: space-between;
280
+    align-items: center;
281
+    padding: 32rpx 24rpx 24rpx;
282
+    background-color: #fff;
283
+    .name{
284
+      font-size: 30rpx;
285
+      flex-shrink: 0;
286
+      margin-right: 24rpx;
287
+    }
288
+    .value{
289
+      font-size: 26rpx;
290
+      color: #5DAAB6;
291
+    }
292
+  }
293
+  
294
+  .areas{
295
+    flex: 1;
296
+    min-height: 0;
297
+    margin-top: 16rpx;
298
+    background-color: #fff;
299
+    .areas_item{
300
+      padding: 24rpx;
301
+      border-bottom: 1rpx solid #DEDEDE;
302
+    }
303
+  }
304
+  
305
+  .categorys{
306
+    flex: 1;
307
+    min-height: 0;
308
+    margin-top: 16rpx;
309
+    background-color: #fff;
310
+    .categorys_item{
311
+      padding: 24rpx;
312
+      border-bottom: 1rpx solid #DEDEDE;
313
+    }
314
+  }
315
+  
316
+  .tabs{
317
+    margin-top: 16rpx;
318
+    background-color: #FBFBFB;
319
+    display: flex;
320
+    flex-wrap: wrap;
321
+    justify-content: space-between;
322
+    gap: 16rpx 0;
323
+    padding: 24rpx 16rpx;
324
+    .tab{
325
+      width: 180rpx;
326
+      height: 60rpx;
327
+      display: flex;
328
+      justify-content: center;
329
+      align-items: center;
330
+      background-color: #F7F7F7;
331
+      font-size: 28rpx;
332
+      position: relative;
333
+      .newicon-xuanzejiaobiao{
334
+        opacity: 0;
335
+        position: absolute;
336
+        right: 0;
337
+        bottom: 0;
338
+        font-size: 38rpx;
339
+        color: #53B9BB;
340
+      }
341
+      &.active{
342
+        background-color: rgba(149, 220, 231, 0.30);
343
+        .newicon-xuanzejiaobiao{
344
+          opacity: 1;
345
+        }
346
+      }
347
+    }
348
+  }
349
+  
350
+  .area,
351
+  .category,
352
+  .acceptDate{
353
+    display: flex;
354
+    justify-content: space-between;
355
+    align-items: center;
356
+    padding: 24rpx;
357
+    background-color: #fff;
358
+    margin-top: 24rpx;
359
+    .name{
360
+      font-size: 28rpx;
361
+      flex-shrink: 0;
362
+      margin-right: 24rpx;
363
+    }
364
+  }
365
+  
366
+  .container_foot{
367
+    .clear{
368
+      padding: 24rpx;
369
+      font-size: 28rpx;
370
+      background-color: #fff;
371
+      margin: 0 16rpx;
372
+      display: flex;
373
+      align-items: center;
374
+      justify-content: center;
375
+    }
376
+    .foot_btns{
377
+      margin-top: 24rpx;
378
+      display: flex;
379
+      border-top: 1rpx solid #BFBFBF;
380
+      .cancel{
381
+        flex: 1;
382
+        background-color: #fff;
383
+        font-size: 32rpx;
384
+        padding: 24rpx;
385
+        display: flex;
386
+        justify-content: center;
387
+      }
388
+      .confirm{
389
+        flex: 1;
390
+        font-size: 32rpx;
391
+        padding: 24rpx;
392
+        background-color: $uni-primary;
393
+        display: flex;
394
+        justify-content: center;
395
+        color: #fff;
396
+      }
397
+    }
398
+  }
399
+}
400
+</style>

+ 49 - 2
http/api.js

@@ -216,6 +216,54 @@ export function api_loginEncrypt(data){
216 216
 }
217 217
 
218 218
 /**
219
+ * 获取巡检执行列表
220
+ */
221
+export function api_inspectionTask(data){
222
+  return post("/hsms/fetchDataList/inspectionTask", data);
223
+}
224
+
225
+/**
226
+ * 获取巡检执行列表-数量
227
+ */
228
+export function api_listCount(data){
229
+  return post("/hsms/listCount", data);
230
+}
231
+
232
+/**
233
+ * 获取字典列表
234
+ */
235
+export function api_hsms_getDictionary(data){
236
+  return post("/hsms/common/getDictionary", data);
237
+}
238
+
239
+/**
240
+ * 获取巡检单列表
241
+ */
242
+export function api_inspectionForm(data){
243
+  return post("/hsms/fetchDataList/inspectionForm", data);
244
+}
245
+
246
+/**
247
+ * 获取楼栋列表
248
+ */
249
+export function api_building(data){
250
+  return post("/hsms/fetchDataList/building", data);
251
+}
252
+
253
+/**
254
+ * 巡检签到
255
+ */
256
+export function api_scanCode(data){
257
+  return post("/hsms/scanCode", data);
258
+}
259
+/**
260
+ * 巡检执行项保存
261
+ */
262
+export function api_addModel(data){
263
+  return post("/hsms/addModel", data);
264
+}
265
+
266
+/**
219 267
  * 报修端-公告
220 268
  */
221 269
 export function api_getNotice(data){
@@ -227,5 +275,4 @@ export function api_getNotice(data){
227 275
  */
228 276
 export function api_getCount(data){
229 277
   return post("/repair/incident/count", data);
230
-}
231
-
278
+}

+ 4 - 1
http/http.js

@@ -67,7 +67,10 @@ export function post(url, data = {}) {
67 67
 }
68 68
 
69 69
 // 扫一扫
70
-export function SM() {
70
+export function SM(code = '') {
71
+  if(code){
72
+    return Promise.resolve(code);
73
+  }
71 74
   // #ifndef H5
72 75
   return new Promise((resolve, reject) => {
73 76
     uni.scanCode({

+ 8 - 7
main.js

@@ -1,12 +1,13 @@
1
-import {
2
-  createSSRApp
3
-} from 'vue'
1
+import { createSSRApp } from 'vue'
4 2
 import App from './App.vue'
5 3
 import * as Pinia from "pinia"
6
-import {
7
-  createUnistorage
8
-} from "./uni_modules/pinia-plugin-unistorage"
9
-console.info('v3.5.0');
4
+import { createUnistorage } from "./uni_modules/pinia-plugin-unistorage"
5
+
6
+console.info(`%c%c v3.5.0 %c 武汉大势恒通科技有限责任公司 `,
7
+  'color: #3eaf7c; font-size: 16px;line-height:30px;',
8
+  'background: #35495e; padding: 4px; border-radius: 3px 0 0 3px; color: #fff',
9
+  'background: #41b883; padding: 4px; border-radius: 0 3px 3px 0; color: #fff',
10
+);
10 11
 
11 12
 export function createApp() {
12 13
   const app = createSSRApp(App)

+ 27 - 2
pages.json

@@ -182,6 +182,7 @@
182 182
 	     }
183 183
 	   }
184 184
 	 },
185
+<<<<<<< HEAD
185 186
 	 {
186 187
 		 "path": "pages/repair/home",
187 188
 		 "style": {
@@ -214,6 +215,25 @@
214 215
 			 }
215 216
 		 }
216 217
 	 }
218
+=======
219
+   {
220
+     "path": "pages/inspection/inspectionExecute/inspectionExecute",
221
+     "style": {
222
+       "h5": {
223
+         "titleNView": false
224
+       },
225
+       "enablePullDownRefresh": true
226
+     }
227
+   },
228
+   {
229
+     "path": "pages/inspection/inspectionValue/inspectionValue",
230
+     "style": {
231
+       "h5": {
232
+         "titleNView": false
233
+       }
234
+     }
235
+   }
236
+>>>>>>> f04f9a92e4933a3c5cda21806e1a8f4c5698e134
217 237
   ],
218 238
   "globalStyle": {
219 239
     "navigationBarTextStyle": "black",
@@ -243,8 +263,13 @@
243 263
 			"iconPath": "static/img/icon_repairList.png",
244 264
 			"selectedIconPath": "static/img/icon_repairList_active.png",
245 265
 			"text": "我的报修"
246
-			},
247
-			{
266
+			}, {
267
+      "pagePath": "pages/inspection/inspectionExecute/inspectionExecute",
268
+      "iconPath": "static/img/icon_inspectionExecute.png",
269
+      "visible": false,
270
+      "selectedIconPath": "static/img/icon_inspectionExecute_active.png",
271
+      "text": "巡检"
272
+    }, {
248 273
       "pagePath": "pages/my/my",
249 274
       "iconPath": "static/img/icon_my.png",
250 275
       "selectedIconPath": "static/img/icon_my_active.png",

+ 1 - 1
pages/incidentDetail/incidentDetail.vue

@@ -371,7 +371,7 @@
371 371
         dataInfo.callbackLogs = logs.filter(v => v.logType.value == 'callback').slice(0, 1);
372 372
 
373 373
         // 维修汇总单
374
-        if(dataInfo.incidentData.state.value == 'close' && dataInfo.incidentData.duty.addSummary == 1 && dataInfo.incidentData.repairSummary == 1){
374
+        if(dataInfo.incidentData.state.value == 'close' && dataInfo.incidentData.duty.addSummary == 1 && dataInfo.incidentData.summaryId){
375 375
           let flag = dataInfo.tabs.some(v => v.value === '2');
376 376
           !flag && dataInfo.tabs.splice(1, 0, {id: 2, name: '维修汇总单', value: '2', num: ''});
377 377
         }

+ 4 - 0
pages/incidentList/incidentList.vue

@@ -77,6 +77,7 @@
77 77
   import { defaultColor } from '@/static/js/theme.js'
78 78
   import { useSetTitle } from '@/share/useSetTitle.js'
79 79
   import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
80
+  import { useSetTabbar } from '@/share/useSetTabbar.js'
80 81
   import { useLoginUserStore } from '@/stores/loginUser'
81 82
   import { useIncidentNumStore } from '@/stores/incidentNum'
82 83
   import { useIncidentListSearchStore } from '@/stores/incidentListSearch'
@@ -90,6 +91,7 @@
90 91
   const { stateStyle }  = computedStateStyle();
91 92
   const { currentLogOverTime }  = computedCurrentLogOverTime();
92 93
   const { makePhoneCall }  = useMakePhoneCall();
94
+  const { setTabbar }  = useSetTabbar();
93 95
 
94 96
   // 主题颜色
95 97
   const primaryColor = ref(defaultColor)
@@ -375,6 +377,8 @@
375 377
   }
376 378
 
377 379
   onLoad((option) => {
380
+    // 巡检tabbar
381
+    setTabbar(1);
378 382
     onLoadFn();
379 383
   })
380 384
 

+ 410 - 0
pages/inspection/inspectionExecute/inspectionExecute.vue

@@ -0,0 +1,410 @@
1
+<template>
2
+  <view class="incidentList">
3
+    <view class="head">
4
+      <view class="tab" :class="{active: tab.id === dataInfo.tabActiveId}" v-for="tab in dataInfo.tabs" :key="tab.id" @click="clickTab(tab.id)">
5
+        {{tab.name}}<text v-if="tab.num !== ''">({{tab.num}})</text>
6
+      </view>
7
+      <view class="filter" @click="filterClick">
8
+        <text class="newicon newicon-shaixuan"></text>
9
+      </view>
10
+    </view>
11
+    <view class="body" v-if="dataInfo.list.length">
12
+      <view class="body_item" v-for="data in dataInfo.list" :key="data.id">
13
+        <view class="body_item_head ellipsis-multiline">
14
+          {{ data.inspectionDTO?.inspectionFormDTO?.name }}-{{ data.inspectionNodeDTO?.name }}-{{ data.batchNo }}
15
+        </view>
16
+
17
+        <view class="body_item_content">
18
+          <view class="body_item_content_p" v-if="data.inspectionDTO">
19
+            <text class="name ellipsis">计划标题:{{data.inspectionDTO.name}}</text>
20
+          </view>
21
+          <view class="body_item_content_p" v-if="data.signType">
22
+            <text class="name ellipsis">签到方式:{{data.signType.name}}</text>
23
+          </view>
24
+          <view class="body_item_content_p" v-if="data.userDTO || data.groupDTO">
25
+            <text class="name ellipsis">执行人或组:{{ data.userDTO?.name || data.groupDTO?.groupName }}</text>
26
+          </view>
27
+          <view class="body_item_content_p" v-if="data.status || data.addTime">
28
+            <text class="name ellipsis">状态:{{ data.status?.name}}</text>
29
+            <text class="date">{{formatDate(data.addTime, 'yyyy-MM-dd HH:mm')}}</text>
30
+          </view>
31
+        </view>
32
+
33
+        <view class="body_item_foot">
34
+          <view class="btns pt0">
35
+            <button v-if="data.status.value === '1'" @click.stop="toInspectionValue(data)" type="default" class="primaryButton btn">执行</button>
36
+          </view>
37
+        </view>
38
+      </view>
39
+    </view>
40
+    <view class="zanwu" v-else>
41
+      <text class="newicon newicon-zanwu"></text>
42
+    </view>
43
+    <InspectionListFilter v-if="dataInfo.isFilter" @cancelEmit="cancelFilter" @confirmEmit="conformFilter" :evt="dataInfo.evtFilter"></InspectionListFilter>
44
+  </view>
45
+</template>
46
+
47
+<script setup>
48
+  import InspectionListFilter from '@/components/InspectionListFilter.vue';
49
+  import { startOfDay, endOfDay, format, add } from 'date-fns'
50
+  import { ref, reactive, computed } from 'vue'
51
+  import { onLoad, onPullDownRefresh, onReachBottom, onTabItemTap } from '@dcloudio/uni-app'
52
+  import { SM } from "@/http/http.js"
53
+  import { api_hsms_getDictionary, api_inspectionTask, api_listCount, api_scanCode } from "@/http/api.js"
54
+  import { filterFormatDate } from '@/filters/filterFormatDate.js'
55
+  import { computedPriorityStyle } from '@/filters/computedPriorityStyle.js'
56
+  import { computedStateStyle } from '@/filters/computedStateStyle.js'
57
+  import { computedCurrentLogOverTime } from '@/filters/computedCurrentLogOverTime.js'
58
+  import { defaultColor } from '@/static/js/theme.js'
59
+  import { useSetTitle } from '@/share/useSetTitle.js'
60
+  import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
61
+  import { useLoginUserStore } from '@/stores/loginUser'
62
+  import { useIncidentNumStore } from '@/stores/incidentNum'
63
+  import { useInspectionListSearchStore } from '@/stores/inspectionListSearch'
64
+  import { useInspectionValueStore } from '@/stores/inspectionValue'
65
+  import { useSetTabbar } from '@/share/useSetTabbar.js'
66
+
67
+  useSetTitle();
68
+  const loginUserStore = useLoginUserStore();
69
+  const incidentNumStore = useIncidentNumStore();
70
+  const inspectionListSearchStore = useInspectionListSearchStore();
71
+  const inspectionValueStore = useInspectionValueStore();
72
+  const { formatDate }  = filterFormatDate();
73
+  const { priorityStyle }  = computedPriorityStyle();
74
+  const { stateStyle }  = computedStateStyle();
75
+  const { currentLogOverTime }  = computedCurrentLogOverTime();
76
+  const { makePhoneCall }  = useMakePhoneCall();
77
+  const { setTabbar }  = useSetTabbar();
78
+
79
+  // 主题颜色
80
+  const primaryColor = ref(defaultColor)
81
+
82
+  const assignFlag = ref(false);//指派权限
83
+  const qiangdan = ref(false);//接单权限
84
+
85
+  // 转换协同人
86
+  const computedSynergetic = computed(() => (synergetic) => {
87
+    return (synergetic && synergetic.length) ? synergetic.map(v => v.name).join(',') : ''
88
+  })
89
+
90
+  // 数据
91
+  const dataInfo = reactive({
92
+    tabs: [{id: 0, name: '全部', value: 'all', num: ''}],
93
+    tabActiveId: 0,//当前选择的tab
94
+    list: [],//工单列表
95
+    idx: 0,//页码
96
+    hasMore: true,//是否有更多数据
97
+    isFilter: false,//筛选框开关
98
+    evtFilter: {
99
+      area: {id: 0, area: '全部'},
100
+      inspectionForm: {id: 0, name: '全部'},
101
+      acceptDate: [],
102
+    },//筛选框数据
103
+  })
104
+
105
+  // 巡检项
106
+  function toInspectionValue(data){
107
+    uni.showLoading({
108
+      title: "加载中",
109
+      mask: true,
110
+    });
111
+    // 'inspection|$|1bd0c704-0962-4ed4-b5a6-b5bda3d78231'
112
+    // 'inspection|$|bc9f61af-99c8-4c86-88f9-f29dd3fc43c0'
113
+    SM().then((ress1) => {
114
+      let postData = {
115
+        code: ress1,
116
+        taskId: data.id,
117
+        account: loginUserStore.loginUser.user.account,
118
+      };
119
+      api_scanCode(postData).then((res) => {
120
+        uni.hideLoading();
121
+        if (res.status == 200) {
122
+          inspectionValueStore.setInspectionValueData(res.data);
123
+          uni.navigateTo({
124
+            url: `/pages/inspection/inspectionValue/inspectionValue?inspectionExecuteId=${data.id}`
125
+          })
126
+        } else {
127
+          uni.showToast({
128
+            icon: 'none',
129
+            title: res.msg || '请求数据失败!'
130
+          });
131
+        }
132
+      });
133
+    }).catch(err=>{
134
+      uni.hideLoading();
135
+    });
136
+  }
137
+
138
+  // 获取tab选项
139
+  function getTabs(){
140
+    uni.showLoading({
141
+      title: "加载中",
142
+      mask: true,
143
+    });
144
+    api_hsms_getDictionary({
145
+      "type": "list",
146
+      "key": "inspection_task_status"
147
+    }).then(res => {
148
+      uni.hideLoading();
149
+      let list = res.data || [];
150
+      let todo = list.find(v => v.value === '1');
151
+      let close = list.find(v => v.value === '2');
152
+      dataInfo.tabs = [{id: 0, name: '全部', value: 'all', num: ''}];
153
+      todo && dataInfo.tabs.push({...todo, ...{num: '', value: 'todo'}});
154
+      close && dataInfo.tabs.push({...close, ...{num: '', value: 'close'}});
155
+      getList(0);
156
+    })
157
+  }
158
+
159
+  // 点击tab
160
+  function clickTab(tabId){
161
+    dataInfo.tabActiveId = tabId;
162
+    getList(0);
163
+  }
164
+
165
+  // 点击筛选
166
+  function filterClick(){
167
+    dataInfo.isFilter = true;
168
+  }
169
+
170
+  // 确认筛选
171
+  function conformFilter(evtFilter){
172
+    dataInfo.evtFilter = evtFilter;
173
+    dataInfo.isFilter = false;
174
+    getList(0);
175
+  }
176
+
177
+  // 关闭筛选
178
+  function cancelFilter(){
179
+    dataInfo.isFilter = false;
180
+  }
181
+
182
+  // 获取列表信息
183
+  function getList(idx){
184
+    uni.showLoading({
185
+      title: "加载中",
186
+      mask: true,
187
+    });
188
+    dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
189
+    if(dataInfo.idx === 0){
190
+      dataInfo.list = [];
191
+    }
192
+    let tabActiveObj = dataInfo.tabs.find(v => v.id == dataInfo.tabActiveId);
193
+    let postData = {
194
+        "idx": dataInfo.idx,
195
+        "sum": 10,
196
+        "account": loginUserStore.loginUser.user.account,
197
+        "inspectionTask": {
198
+          "queryTask": tabActiveObj ? tabActiveObj.value : undefined,
199
+          "assignAccount": loginUserStore.loginUser.user.account,
200
+        }
201
+    }
202
+
203
+    if(dataInfo.evtFilter && dataInfo.evtFilter.inspectionForm && dataInfo.evtFilter.inspectionForm.id){
204
+      postData.inspectionTask.formId = dataInfo.evtFilter.inspectionForm.id;
205
+    }
206
+
207
+    if(dataInfo.evtFilter && Array.isArray(dataInfo.evtFilter.acceptDate) && dataInfo.evtFilter.acceptDate.length){
208
+      postData.inspectionTask.addTimeStart = format(startOfDay(new Date(dataInfo.evtFilter.acceptDate[0])), 'yyyy-MM-dd HH:mm:ss');
209
+      postData.inspectionTask.addTimeEnd = format(endOfDay(dataInfo.evtFilter.acceptDate[1]), 'yyyy-MM-dd HH:mm:ss');
210
+    }
211
+
212
+    if(dataInfo.evtFilter && dataInfo.evtFilter.area && dataInfo.evtFilter.area.id){
213
+      postData.inspectionTask.buildId = dataInfo.evtFilter.area.id;
214
+    }
215
+
216
+    inspectionListSearchStore.setInspectionListSearchData(dataInfo);
217
+    api_inspectionTask(postData).then(res => {
218
+      uni.hideLoading();
219
+      uni.stopPullDownRefresh();
220
+      if(res.status == 200){
221
+        let list = res.list || [];
222
+        if(list.length){
223
+          dataInfo.hasMore = true;
224
+          dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
225
+        }else{
226
+          dataInfo.hasMore = false;
227
+        }
228
+      }else{
229
+        uni.showToast({
230
+          icon: 'none',
231
+          title: res.msg || '请求数据失败!'
232
+        });
233
+      }
234
+    })
235
+
236
+    getCount(postData.inspectionTask);
237
+  }
238
+
239
+  // 获取列表数量
240
+  function getCount(inspectionTask = {}){
241
+    let postData = {
242
+      account: loginUserStore.loginUser.user.account,
243
+      taskList: [],
244
+    }
245
+    dataInfo.tabs.forEach(v => {
246
+        postData.taskList.push({...inspectionTask, ...{ queryTask: v.value }});
247
+    })
248
+
249
+    api_listCount(postData).then(res => {
250
+      if(res.state == 200){
251
+        let myData = res.data || [];
252
+        dataInfo.tabs.forEach((v) => {
253
+            v.num = myData[v.value];
254
+        })
255
+      }else{
256
+        uni.showToast({
257
+          icon: 'none',
258
+          title: res.msg || '请求数据失败!'
259
+        });
260
+      }
261
+    })
262
+  }
263
+
264
+  // 初始化
265
+  function onLoadFn(){
266
+    // 我的-数量跳转
267
+    if(inspectionListSearchStore.inspectionListSearch.data){
268
+      // 缓存的搜索条件
269
+      Object.assign(dataInfo, inspectionListSearchStore.inspectionListSearch.data);
270
+    }
271
+    getTabs();
272
+  }
273
+
274
+  onLoad((option) => {
275
+    // 巡检tabbar
276
+    setTabbar(1);
277
+    onLoadFn();
278
+  })
279
+
280
+  onTabItemTap(e => {
281
+    onLoadFn();
282
+  })
283
+
284
+  onPullDownRefresh(() => {
285
+    getList(0)
286
+  })
287
+
288
+  onReachBottom(() => {
289
+    dataInfo.idx += 1;
290
+    if (dataInfo.hasMore) {
291
+      getList(); // 当触底时加载更多数据
292
+    }
293
+  })
294
+</script>
295
+
296
+<style lang="scss" scoped>
297
+page{
298
+  height: calc(100vh - var(--window-bottom));
299
+}
300
+.incidentList{
301
+  display: flex;
302
+  flex-direction: column;
303
+  justify-content: space-between;
304
+  .head{
305
+    height: 88rpx;
306
+    display: flex;
307
+    position: fixed;
308
+    z-index: 99;
309
+    width: 100%;
310
+    background-color: #fff;
311
+    font-size: 30rpx;
312
+    .tab{
313
+      flex: 1;
314
+      display: flex;
315
+      justify-content: center;
316
+      align-items: center;
317
+      border-bottom: 4rpx solid transparent;
318
+      &.active{
319
+        color: $uni-primary;
320
+        border-color: $uni-primary;
321
+      }
322
+    }
323
+    .filter{
324
+      width: 84rpx;
325
+      display: flex;
326
+      justify-content: center;
327
+      align-items: center;
328
+      .newicon-shaixuan{
329
+        font-size: 36rpx;
330
+        color: #2C2C2C;
331
+      }
332
+    }
333
+  }
334
+  .body{
335
+    margin-bottom: var(--window-bottom);
336
+    margin-top: 88rpx;
337
+    border-top: 6rpx solid #EBEBEB;
338
+    .body_item{
339
+      border-bottom: 8rpx solid #EBEBEB;
340
+      .body_item_head{
341
+        word-break: break-all;
342
+        text-align: justify;
343
+        text-align: left;
344
+        margin: 24rpx;
345
+        font-size: 30rpx;
346
+      }
347
+      .body_item_content{
348
+        border-top: 1rpx solid #D8D8D8;
349
+        padding: 24rpx 24rpx 24rpx 48rpx;
350
+        .body_item_content_p{
351
+          color: #6A6A6A;
352
+          font-size: 26rpx;
353
+          display: flex;
354
+          justify-content: space-between;
355
+          align-items: center;
356
+          margin-bottom: 24rpx;
357
+          &:last-of-type{
358
+            margin-bottom: 0;
359
+          }
360
+          .name{
361
+            flex: 1;
362
+          }
363
+          .status{
364
+            padding: 4rpx 10rpx;
365
+            border-radius: 20rpx;
366
+            background-color: #DBE8FE;
367
+            font-size: 22rpx;
368
+            color: #006CF9;
369
+          }
370
+          .icon_all{
371
+            .mic-filled,
372
+            .image-filled
373
+            {
374
+              margin-left: 16rpx;
375
+            }
376
+          }
377
+        }
378
+      }
379
+      .body_item_foot{
380
+        border-top: 1rpx solid #D8D8D8;
381
+        font-size: 26rpx;
382
+        padding: 24rpx;
383
+        .foot_info{
384
+          display: flex;
385
+          justify-content: space-between;
386
+          align-items: center;
387
+          .phone-filled{
388
+            margin-left: 5rpx;
389
+          }
390
+        }
391
+      }
392
+    }
393
+  }
394
+  .zanwu{
395
+    box-sizing: border-box;
396
+    margin-bottom: var(--window-bottom);
397
+    margin-top: 88rpx;
398
+    border-top: 6rpx solid #EBEBEB;
399
+    height: calc(100vh - var(--window-bottom) - 88rpx);
400
+    display: flex;
401
+    justify-content: center;
402
+    background-color: #F7F7F7;
403
+    .newicon-zanwu{
404
+      font-size: 256rpx;
405
+      color: #D6D6D6;
406
+      margin-top: 140rpx;
407
+    }
408
+  }
409
+}
410
+</style>

+ 371 - 0
pages/inspection/inspectionValue/inspectionValue.vue

@@ -0,0 +1,371 @@
1
+<template>
2
+  <view class="inspectionValue">
3
+    <scroll-view scroll-y class="body">
4
+      <uni-forms ref="baseForm" :model="formValues" :rules="rules" class="form" label-position="top">
5
+        <template v-for="(item, index) of baseFormData" :key="index">
6
+          <!-- 下拉 -->
7
+          <uni-forms-item v-if="item.type === '1'" class="formItem" :required="item.required" :name="item.key">
8
+            <template v-slot:label>
9
+              <view class="customLabelWrap">
10
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
11
+              </view>
12
+            </template>
13
+            <uni-data-picker :placeholder="'请选择' + item.name" :popup-title="'请选择' + item.name" :localdata="item.list" v-model="formValues[item.key]" @change="changeForm()">
14
+            </uni-data-picker>
15
+          </uni-forms-item>
16
+          <!-- 单选 -->
17
+          <uni-forms-item v-if="item.type === '2'" class="formItem" :required="item.required" :name="item.key">
18
+            <template v-slot:label>
19
+              <view class="customLabelWrap">
20
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
21
+              </view>
22
+            </template>
23
+            <uni-data-checkbox v-model="formValues[item.key]" @change="changeForm()" :localdata="item.list" />
24
+          </uni-forms-item>
25
+          <!-- 多选 -->
26
+          <uni-forms-item v-if="item.type === '3'" class="formItem" :required="item.required" :name="item.key">
27
+            <template v-slot:label>
28
+              <view class="customLabelWrap">
29
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
30
+              </view>
31
+            </template>
32
+            <uni-data-checkbox v-model="formValues[item.key]" @change="changeForm()" multiple :localdata="item.list" />
33
+          </uni-forms-item>
34
+          <!-- 数字 -->
35
+          <uni-forms-item v-if="item.type === '4'" class="formItem" :required="item.required" :name="item.key">
36
+            <template v-slot:label>
37
+              <view class="customLabelWrap">
38
+                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
39
+              </view>
40
+            </template>
41
+            <uni-number-box v-model="formValues[item.key]" @change="changeForm()" :min="-9999" :max="9999" :placeholder="'请输入' + item.name"></uni-number-box>
42
+          </uni-forms-item>
43
+          <!-- 单行 -->
44
+          <uni-forms-item v-if="item.type === '5' && item.isException" class="formItem" :label="item.name" :required="item.required" :name="item.key">
45
+            <uni-easyinput v-model="formValues[item.key]" :placeholder="'请输入' + item.name" />
46
+          </uni-forms-item>
47
+          <!-- 多行 -->
48
+          <uni-forms-item v-if="item.type === '6' && item.isException" class="formItem" :label="item.name" :required="item.required" :name="item.key">
49
+            <uni-easyinput type="textarea" v-model="formValues[item.key]" :placeholder="'请输入' + item.name" />
50
+          </uni-forms-item>
51
+          <!-- 图片上传 -->
52
+          <uni-forms-item v-if="item.type === '7' && item.isException" class="formItem" :label="item.name" :required="item.required" :name="item.key">
53
+            <DsFilePicker v-model="formValues[item.key]"></DsFilePicker>
54
+          </uni-forms-item>
55
+          <!-- 分割线 -->
56
+          <view class="detail_head" v-if="item.type === '8'">
57
+            <text class="title">{{ item.name }}</text>
58
+          </view>
59
+        </template>
60
+      </uni-forms>
61
+    </scroll-view>
62
+    <view class="foot_common_btns">
63
+      <button @click="goBack" type="default" class="cancelButton btn">返回</button>
64
+      <button @click="submit" type="default" class="primaryButton btn">保存</button>
65
+    </view>
66
+  </view>
67
+</template>
68
+
69
+<script setup>
70
+  import fromPairs from 'lodash-es/fromPairs'
71
+  import keyBy from 'lodash-es/keyBy'
72
+  import DsFilePicker from '@/components/DsFilePicker.vue';
73
+  import { ref, reactive } from 'vue'
74
+  import { onLoad } from '@dcloudio/uni-app'
75
+  import { api_addModel } from "@/http/api.js"
76
+  import { defaultColor } from '@/static/js/theme.js'
77
+  import { useSetTitle } from '@/share/useSetTitle.js'
78
+  import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
79
+  import { useGoBack } from '@/share/useGoBack.js'
80
+  import { useLoginUserStore } from '@/stores/loginUser'
81
+  import { useInspectionValueStore } from '@/stores/inspectionValue'
82
+import { forIn } from 'lodash-es';
83
+
84
+  useSetTitle();
85
+  const loginUserStore = useLoginUserStore();
86
+  const { goBack }  = useGoBack();
87
+  const inspectionValueStore = useInspectionValueStore();
88
+
89
+  // 主题颜色
90
+  const primaryColor = ref(defaultColor)
91
+
92
+  // 所有页码数据
93
+  const formPageList = reactive([]);
94
+
95
+  // 表单
96
+  const baseForm = ref()
97
+
98
+  const inspectionExecuteId = ref()
99
+
100
+  // 数据-原始
101
+  const dataInfo = reactive({})
102
+
103
+  // 数据-检验
104
+  const rules = reactive({})
105
+
106
+  // 数据-填写值
107
+  const formValues = reactive({})
108
+
109
+  // 表单数据-渲染
110
+  // 下拉框	1
111
+  // 单选	2
112
+  // 多选	3
113
+  // 数值	4
114
+  // 单行文本	5
115
+  // 多行文本	6
116
+  // 照片上传	7
117
+  // 分割线	8
118
+  const baseFormData = reactive([
119
+    // { type: 1, name: '', value: '', list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
120
+    // { type: 2, name: '', value: '', list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
121
+    // { type: 3, name: '', value: [], list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
122
+    // { type: 4, name: '', value: '', list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
123
+    // { type: 5, name: '', value: '', list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
124
+    // { type: 6, name: '', value: '', list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
125
+    // { type: 7, name: '', value: [], list: [], required: false, checkType: 0, valueMin: '', valueMax: '', },
126
+  ])
127
+
128
+  // 修改
129
+  function changeForm(){
130
+    handleData(true);
131
+  }
132
+
133
+  // 保存
134
+  function submit(){
135
+    baseForm.value.validate().then(res => {
136
+      console.log('success', res);
137
+      uni.showLoading({
138
+        title: "加载中",
139
+        mask: true,
140
+      });
141
+      console.log(formValues);
142
+      let postData = {
143
+        account: loginUserStore.loginUser.user.account,
144
+        valuesList: [],
145
+      };
146
+      // baseFormData
147
+      for(let key in formValues){
148
+        let obj = baseFormData.find(v => v.key === key);
149
+        if(!((obj.type === '5' && !obj.isException) || (obj.type === '6' && !obj.isException) || (obj.type === '7' && !obj.isException))){
150
+          let name = obj.name;
151
+          let itemId = obj.id;
152
+          let _formPageList = dataInfo.inspectionFormDTO?.formPageList || [];
153
+          _formPageList = _formPageList.map(v => v.formItemList).flat();
154
+          let formItem = _formPageList.find(v => v.id === itemId);
155
+          postData.valuesList.push({
156
+            taskId: inspectionExecuteId.value,
157
+            nodeId: dataInfo.id,
158
+            formId: dataInfo.inspectionFormDTO.id,
159
+            itemId: formItem.id,
160
+            pageId: formItem.pageId,
161
+            orders: formItem.orders,
162
+            name,
163
+            valuex: (formItem.type.value === '1' || formItem.type.value === '2' || formItem.type.value === '3') ? '' : formValues[key].toString(),
164
+            configIds: (formItem.type.value === '1' || formItem.type.value === '2' || formItem.type.value === '3') ? formValues[key].toString() : undefined,
165
+            hosId: dataInfo.inspectionFormDTO.hosId,
166
+          })
167
+        }
168
+      }
169
+      console.log(postData);
170
+      api_addModel(postData).then((res) => {
171
+        uni.hideLoading();
172
+        if (res.status == 200) {
173
+          inspectionValueStore.clearInspectionValueData();
174
+          uni.reLaunch({
175
+            url: `/pages/inspection/inspectionExecute/inspectionExecute`
176
+          })
177
+        } else {
178
+          uni.showToast({
179
+            icon: 'none',
180
+            title: res.msg || '请求数据失败!'
181
+          });
182
+        }
183
+      });
184
+    }).catch(err => {
185
+      console.log('err', err);
186
+    })
187
+  }
188
+
189
+  // 处理数据
190
+  function handleData(isException = false){
191
+    // 目前只取第一页
192
+    let firstPage = formPageList[0]?.formItemList || [];
193
+
194
+    firstPage = firstPage.filter( v => v.display === 1);
195
+
196
+    firstPage = firstPage.map((v, i) => {
197
+      let value = '';
198
+      v.formItemConfigList = v.formItemConfigList || [];
199
+
200
+      // value
201
+      if(v.type.value === '3'){
202
+        // 多选
203
+        let arr = v.formItemConfigList.filter(v => v.checkDefault === 1);
204
+        value = arr.length ? arr.map(v => v.id) : [];
205
+        console.log('多选', value)
206
+      } else if(v.type.value === '7'){
207
+        // 图片
208
+        value = [];
209
+      } else if(v.type.value === '1' || v.type.value === '2') {
210
+        // 单选或下拉
211
+        let defaultValue = v.formItemConfigList.find(v => v.checkDefault === 1);
212
+        value = defaultValue ? defaultValue.id : '';
213
+        console.log('单选或下拉', value)
214
+      } else{
215
+        // 其他
216
+        value = v.defaultValue;
217
+      }
218
+
219
+      return {
220
+        id: v.id,
221
+        key: `field${i}`,
222
+        type: v.type.value,
223
+        name: v.name,
224
+        value: isException ? formValues[`field${i}`] : value,
225
+        list: v.formItemConfigList ? v.formItemConfigList.map(v => ({text: v.name, value: v.id, checkException: v.checkException, uncheckException: v.uncheckException})) : [],
226
+        required: v.required === 1,
227
+        checkType: v.checkType,
228
+        showError: v.showError,
229
+        orders: v.orders,
230
+        valueMin: v.checkType === 2 ? v.valueLow : ( v.checkType === 1 ? (v.valuex - v.valueGap) : undefined),
231
+        valueMax: v.checkType === 2 ? v.valueUp : ( v.checkType === 1 ? (v.valuex + v.valueGap) : undefined),
232
+      }
233
+    });
234
+
235
+    let firstPageBottom = firstPage.filter(v => v.type === '5' || v.type === '6');
236
+    firstPage = firstPage.filter(v => v.type !== '5' && v.type !== '6' && v.type !== '7');
237
+
238
+    // 其他项
239
+    if(isException){
240
+      firstPage.forEach(v => {
241
+        // 下拉,单选
242
+        if(v.type === '1' || v.type === '2'){
243
+          let obj = v.list.find(vv => formValues[v.key] === vv.value);
244
+          v.isException = obj ? obj.checkException === 1 : false;
245
+        } else if(v.type === '3'){
246
+          // 多选
247
+          v.isException = v.list.some(vv => {
248
+            if(formValues[v.key].includes(vv.value)){
249
+              return vv.checkException === 1;
250
+            }else{
251
+              return false;
252
+            }
253
+          })
254
+        } else if(v.type === '4'){
255
+          v.isException = (v.value < v.valueMin) || (v.value > v.valueMax);
256
+        }
257
+      })
258
+    }else{
259
+      firstPage.forEach(v => {
260
+        if(v.type === '1' || v.type === '2'){
261
+          // 下拉,单选
262
+          let obj = v.list.find(vv => v.value === vv.value);
263
+          v.isException = obj ? obj.checkException === 1 : false;
264
+        } else if(v.type === '3'){
265
+          // 多选
266
+          v.isException = v.list.some(vv => {
267
+            if(v.value.includes(vv.value)){
268
+              return vv.checkException === 1;
269
+            }else{
270
+              return false;
271
+            }
272
+          })
273
+        } else if(v.type === '4'){
274
+          // 数值
275
+          v.isException = (formValues[v.key] < v.valueMin) || (formValues[v.key] > v.valueMax);
276
+        }
277
+      })
278
+    }
279
+
280
+    // 单行|多行|图片上传
281
+    let someIsException = firstPage.filter(v => v.type !== '8').some(v => v.isException);
282
+    console.log('someIsException=>', someIsException)
283
+    firstPageBottom.forEach(v => {
284
+      console.log('v.showError=>', v.showError)
285
+      v.isException = (v.showError === 1 && someIsException) || v.showError === 0;
286
+    })
287
+
288
+    firstPage = firstPage.concat(firstPageBottom).sort((a, b) => a.orders - b.orders);
289
+    console.log('firstPage=>', firstPage);
290
+
291
+    Object.assign(baseFormData, firstPage);
292
+    console.log('baseFormData=>', baseFormData);
293
+
294
+    Object.assign(formValues, fromPairs(firstPage.filter(v => v.type !== '8').map(v => ([v.key, v.value]))));
295
+    console.log('formValues=>', formValues);
296
+
297
+    let rulesObj = keyBy(firstPage.filter(v => v.type !== '8'), 'key');
298
+    console.log(rulesObj)
299
+
300
+    for(let key in rulesObj){
301
+      rulesObj[key] = {
302
+        rules: [
303
+          { required: rulesObj[key].required, errorMessage: `${rulesObj[key].name}不能为空` }
304
+        ]
305
+      }
306
+    }
307
+    Object.assign(rules, rulesObj);
308
+    console.log('rules=>', rules);
309
+  }
310
+
311
+  onLoad((option) => {
312
+    inspectionExecuteId.value = +option.inspectionExecuteId;
313
+    // 巡检项
314
+    if(inspectionValueStore.inspectionValue.data){
315
+      Object.assign(dataInfo, inspectionValueStore.inspectionValue.data);
316
+      Object.assign(formPageList, dataInfo.inspectionFormDTO?.formPageList || []);
317
+      handleData()
318
+    }
319
+  })
320
+</script>
321
+
322
+<style lang="scss" scoped>
323
+.inspectionValue{
324
+  height: 100%;
325
+  display: flex;
326
+  flex-direction: column;
327
+  justify-content: space-between;
328
+  .body{
329
+    box-sizing: border-box;
330
+    flex: 1;
331
+    min-height: 0;
332
+    padding-bottom: 24rpx;
333
+    .formItem{
334
+      padding: 24rpx 24rpx 0;
335
+      margin-bottom: 0;
336
+    }
337
+    ::v-deep .uni-forms-item__label{
338
+      width: auto!important;
339
+    }
340
+    .detail_head{
341
+      padding: 24rpx;
342
+      border-top: 1rpx solid #D2D2D2;
343
+      border-bottom: 1rpx solid #D2D2D2;
344
+      display: flex;
345
+      justify-content: space-between;
346
+      align-items: center;
347
+      margin-top: 24rpx;
348
+      &:first-of-type{
349
+        border-top: none;
350
+        margin-top: 0;
351
+      }
352
+      .title{
353
+        font-size: 26rpx;
354
+        color: $uni-primary;
355
+        padding-left: 18rpx;
356
+        position: relative;
357
+        &:before{
358
+          content: '';
359
+          width: 8rpx;
360
+          height: 25rpx;
361
+          background-color: $uni-primary;
362
+          position: absolute;
363
+          left: 0;
364
+          top: 50%;
365
+          transform: translateY(-50%);
366
+        }
367
+      }
368
+    }
369
+  }
370
+}
371
+</style>

+ 4 - 0
pages/my/my.vue

@@ -62,12 +62,14 @@
62 62
   import { useLoginUserStore } from '@/stores/loginUser'
63 63
   import { useIncidentNumStore } from '@/stores/incidentNum'
64 64
   import { repositoryListSearchStore } from '@/stores/repositorySearch'
65
+  import { useSetTabbar } from '@/share/useSetTabbar.js'
65 66
 	
66 67
   useSetTitle();
67 68
   const loginUserStore = useLoginUserStore();
68 69
   const incidentNumStore = useIncidentNumStore();
69 70
   const { makePhoneCall }  = useMakePhoneCall();
70 71
   const repositorySearchStore = repositoryListSearchStore();
72
+  const { setTabbar }  = useSetTabbar();
71 73
 	
72 74
   // 主题颜色
73 75
   const primaryColor = ref(defaultColor)
@@ -156,6 +158,8 @@
156 158
   }
157 159
   
158 160
   onLoad((option) => {
161
+    // 巡检tabbar
162
+    setTabbar(1);
159 163
     onLoadFn();
160 164
   })
161 165
   

+ 18 - 5
pages/repair/home.vue

@@ -121,11 +121,24 @@
121 121
 	// 扫资产报修
122 122
 	function scanCodes(){
123 123
 		SM().then((res) => {
124
-		  uni.showLoading({
125
-		    title: "加载中",
126
-		    mask: true,
127
-		  });
128
-			uni.hideLoading();
124
+		  let postData = {
125
+		    code: ress1,
126
+		    account: loginUserStore.loginUser.user.account,
127
+		  };
128
+		  // api_scanCode(postData).then((res) => {
129
+		  //   uni.hideLoading();
130
+		  //   if (res.status == 200) {
131
+		  //     inspectionValueStore.setInspectionValueData(res.data);
132
+		  //     uni.navigateTo({
133
+		  //       url: `/pages/inspection/inspectionValue/inspectionValue?inspectionExecuteId=${data.id}`
134
+		  //     })
135
+		  //   } else {
136
+		  //     uni.showToast({
137
+		  //       icon: 'none',
138
+		  //       title: res.msg || '请求数据失败!'
139
+		  //     });
140
+		  //   }
141
+		  // });
129 142
 		})
130 143
 	}
131 144
 	

+ 18 - 5
pages/repair/rapidRep.vue

@@ -219,11 +219,24 @@
219 219
 	// 扫码资产码
220 220
 	function scanCodes(){
221 221
 		SM().then((res) => {
222
-		  uni.showLoading({
223
-		    title: "加载中",
224
-		    mask: true,
225
-		  });
226
-			uni.hideLoading();
222
+		  let postData = {
223
+		    code: ress1,
224
+		    account: loginUserStore.loginUser.user.account,
225
+		  };
226
+		  // api_scanCode(postData).then((res) => {
227
+		  //   uni.hideLoading();
228
+		  //   if (res.status == 200) {
229
+		  //     inspectionValueStore.setInspectionValueData(res.data);
230
+		  //     uni.navigateTo({
231
+		  //       url: `/pages/inspection/inspectionValue/inspectionValue?inspectionExecuteId=${data.id}`
232
+		  //     })
233
+		  //   } else {
234
+		  //     uni.showToast({
235
+		  //       icon: 'none',
236
+		  //       title: res.msg || '请求数据失败!'
237
+		  //     });
238
+		  //   }
239
+		  // });
227 240
 		})
228 241
 	}
229 242
 	

+ 1 - 2
readme.md

@@ -9,6 +9,5 @@
9 9
 - filters      存放过滤器
10 10
 
11 11
 # uni-ui源码修改记录
12
-- uni-forms-item.vue增加exception参数 
13 12
 - uni_modules\uni-data-picker\components\uni-data-picker 添加 @touchmove.stop.prevent 
14
-- uni_modules\uni-data-picker\components\uni-data-pickerview 添加 @touchmove.stop.prevent 
13
+- uni_modules\uni-data-picker\components\uni-data-pickerview 添加 @touchmove.stop.prevent 

+ 30 - 0
share/useSetTabbar.js

@@ -0,0 +1,30 @@
1
+import { useLoginUserStore } from '@/stores/loginUser'
2
+const loginUserStore = useLoginUserStore();
3
+export function useSetTabbar() {
4
+  /**
5
+   * 设置tabbar
6
+   */
7
+  const setTabbar = (index) => {
8
+    let flag = false;
9
+    
10
+    switch(index){
11
+      case 1:
12
+        // 巡检
13
+        if(loginUserStore.loginUser.menu.some(v => v.link === 'app.inspection.inspectList')){
14
+          flag = true;
15
+        }
16
+        break;
17
+    }
18
+    
19
+    if(flag){
20
+      uni.setTabBarItem({
21
+        index,
22
+        visible: true,
23
+      });
24
+    }
25
+  }
26
+
27
+  return {
28
+    setTabbar
29
+  };
30
+}

static/img/icon_repairList.png → static/img/icon_inspectionExecute.png


static/img/icon_repairList_active.png → static/img/icon_inspectionExecute_active.png


+ 29 - 0
static/scss/common.scss

@@ -5,6 +5,30 @@ page{
5 5
   height: 100vh;
6 6
 }
7 7
 
8
+.red{
9
+  color:red!important;
10
+}
11
+
12
+.customLabelWrap{
13
+  display: flex;
14
+}
15
+
16
+.customLabel{
17
+  display: flex;
18
+  flex-direction: row;
19
+  align-items: center;
20
+  text-align: left;
21
+  font-size: 14px;
22
+  color: #606266;
23
+  height: 36px;
24
+  padding: 0 12px 0 0;
25
+  vertical-align: middle;
26
+  flex-shrink: 0;
27
+  box-sizing: border-box;
28
+  padding: 0 0 8px;
29
+  line-height: 1.5715;
30
+}
31
+
8 32
 uni-toast,
9 33
 [longpressactions]{
10 34
   z-index: 99999!important;
@@ -209,6 +233,11 @@ uni-toast,
209 233
   margin-top: 0!important;
210 234
 }
211 235
 
236
+// 内边距-top
237
+.pt0{
238
+  padding-top: 0!important;
239
+}
240
+
212 241
 .no-scroll{
213 242
 	overflow-y: hidden;
214 243
 }

+ 31 - 0
stores/inspectionListSearch.js

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

+ 31 - 0
stores/inspectionValue.js

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