seimin 8 月之前
父節點
當前提交
7c7e1b3268

+ 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>

+ 398 - 0
components/InspectionListFilter.vue

@@ -0,0 +1,398 @@
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
+    }
195
+    
196
+    api_inspectionForm(postData).then(res => {
197
+      uni.hideLoading();
198
+      if(res.status == 200){
199
+        let list = res.list || [];
200
+        pageData.inspectionFormList = [{ id:0, name: '全部' }, ...list];
201
+      }else{
202
+        uni.showToast({
203
+          icon: 'none',
204
+          title: res.msg || '请求数据失败!'
205
+        });
206
+      }
207
+    })
208
+  }
209
+  
210
+  // 页面路由跳转
211
+  function clickPageRouter(type){
212
+    pageData.pageRouter = type;
213
+    switch(type){
214
+      case 'area':
215
+        getAreaList();
216
+      break;
217
+      case 'inspectionForm':
218
+        getInspectionFormList();
219
+      break;
220
+    }
221
+  }
222
+  
223
+  // 显示登记时间
224
+  function changeIsShowDate(type){
225
+    isShowDate.value = true;
226
+  }
227
+  
228
+  onLoad((option) => {
229
+    searchData.area = evt.area;
230
+    searchData.inspectionForm = evt.inspectionForm;
231
+    searchData.acceptDate = evt.acceptDate;
232
+  })
233
+</script>
234
+
235
+<style lang="scss" scoped>
236
+.mask{
237
+  position: fixed;
238
+  left: 0;
239
+  top: 0;
240
+  right: 0;
241
+  bottom: 0;
242
+  background-color: rgba(0, 0, 0, 0.4);
243
+  z-index: 999;
244
+}
245
+.line{
246
+  content: '';
247
+  position: fixed;
248
+  top: 0;
249
+  left: 0;
250
+  z-index: 9999;
251
+  height: 8rpx;
252
+  width: 100%;
253
+  background-color: #EBEBEB;
254
+}
255
+.container{
256
+  position: fixed;
257
+  left: 125rpx;
258
+  top: 0;
259
+  right: 0;
260
+  bottom: 0;
261
+  z-index: 9999;
262
+  background-color: #F7F7F7;
263
+  display: flex;
264
+  flex-direction: column;
265
+  justify-content: space-between;
266
+  
267
+  .container_form{
268
+    height: 100%;
269
+    display: flex;
270
+    flex-direction: column;
271
+    flex: 1;
272
+    min-height: 0;
273
+  }
274
+  
275
+  .hospital{
276
+    display: flex;
277
+    justify-content: space-between;
278
+    align-items: center;
279
+    padding: 32rpx 24rpx 24rpx;
280
+    background-color: #fff;
281
+    .name{
282
+      font-size: 30rpx;
283
+      flex-shrink: 0;
284
+      margin-right: 24rpx;
285
+    }
286
+    .value{
287
+      font-size: 26rpx;
288
+      color: #5DAAB6;
289
+    }
290
+  }
291
+  
292
+  .areas{
293
+    flex: 1;
294
+    min-height: 0;
295
+    margin-top: 16rpx;
296
+    background-color: #fff;
297
+    .areas_item{
298
+      padding: 24rpx;
299
+      border-bottom: 1rpx solid #DEDEDE;
300
+    }
301
+  }
302
+  
303
+  .categorys{
304
+    flex: 1;
305
+    min-height: 0;
306
+    margin-top: 16rpx;
307
+    background-color: #fff;
308
+    .categorys_item{
309
+      padding: 24rpx;
310
+      border-bottom: 1rpx solid #DEDEDE;
311
+    }
312
+  }
313
+  
314
+  .tabs{
315
+    margin-top: 16rpx;
316
+    background-color: #FBFBFB;
317
+    display: flex;
318
+    flex-wrap: wrap;
319
+    justify-content: space-between;
320
+    gap: 16rpx 0;
321
+    padding: 24rpx 16rpx;
322
+    .tab{
323
+      width: 180rpx;
324
+      height: 60rpx;
325
+      display: flex;
326
+      justify-content: center;
327
+      align-items: center;
328
+      background-color: #F7F7F7;
329
+      font-size: 28rpx;
330
+      position: relative;
331
+      .newicon-xuanzejiaobiao{
332
+        opacity: 0;
333
+        position: absolute;
334
+        right: 0;
335
+        bottom: 0;
336
+        font-size: 38rpx;
337
+        color: #53B9BB;
338
+      }
339
+      &.active{
340
+        background-color: rgba(149, 220, 231, 0.30);
341
+        .newicon-xuanzejiaobiao{
342
+          opacity: 1;
343
+        }
344
+      }
345
+    }
346
+  }
347
+  
348
+  .area,
349
+  .category,
350
+  .acceptDate{
351
+    display: flex;
352
+    justify-content: space-between;
353
+    align-items: center;
354
+    padding: 24rpx;
355
+    background-color: #fff;
356
+    margin-top: 24rpx;
357
+    .name{
358
+      font-size: 28rpx;
359
+      flex-shrink: 0;
360
+      margin-right: 24rpx;
361
+    }
362
+  }
363
+  
364
+  .container_foot{
365
+    .clear{
366
+      padding: 24rpx;
367
+      font-size: 28rpx;
368
+      background-color: #fff;
369
+      margin: 0 16rpx;
370
+      display: flex;
371
+      align-items: center;
372
+      justify-content: center;
373
+    }
374
+    .foot_btns{
375
+      margin-top: 24rpx;
376
+      display: flex;
377
+      border-top: 1rpx solid #BFBFBF;
378
+      .cancel{
379
+        flex: 1;
380
+        background-color: #fff;
381
+        font-size: 32rpx;
382
+        padding: 24rpx;
383
+        display: flex;
384
+        justify-content: center;
385
+      }
386
+      .confirm{
387
+        flex: 1;
388
+        font-size: 32rpx;
389
+        padding: 24rpx;
390
+        background-color: $uni-primary;
391
+        display: flex;
392
+        justify-content: center;
393
+        color: #fff;
394
+      }
395
+    }
396
+  }
397
+}
398
+</style>

+ 48 - 0
http/api.js

@@ -214,3 +214,51 @@ export function api_getSolution(data){
214 214
 export function api_loginEncrypt(data){
215 215
   return post("/auth/loginEncrypt", data);
216 216
 }
217
+
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
+}

+ 63 - 0
http/http.js

@@ -1,3 +1,7 @@
1
+// #ifdef H5
2
+import wx from 'weixin-jsapi'
3
+// #endif
4
+
1 5
 export const path = `${location.origin}/service`
2 6
 // get方法
3 7
 export function get(url, data = {}) {
@@ -62,3 +66,62 @@ export function post(url, data = {}) {
62 66
     })
63 67
   });
64 68
 }
69
+
70
+// 扫一扫
71
+export function SM(code = '') {
72
+  if(code){
73
+    return Promise.resolve(code);
74
+  }
75
+  // #ifndef H5
76
+  return new Promise((resolve, reject) => {
77
+    uni.scanCode({
78
+      onlyFromCamera: true,
79
+      success: function(res) {
80
+        let str = res.result.replace(/[\s\/]/g, '') || 'none';
81
+        str = str.replace(/CODABAR,/i, '');
82
+        str = str.replace(/CODE_128,/i, '');
83
+        resolve(str);
84
+      },
85
+      fail(err) {
86
+        reject(err);
87
+      }
88
+    });
89
+  });
90
+  // #endif
91
+  // #ifdef H5
92
+  return new Promise((resolve, reject) => {
93
+    let param = {
94
+      requestUrl: location.href.split('#')[0]
95
+    };
96
+    post("/wechat/getJsConfig", param).then(res => {
97
+      if (res) {
98
+        wx.config({
99
+          debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
100
+          appId: res.appId, // 必填,企业号的唯一标识,此处填写企业号corpid
101
+          timestamp: res.timestamp, // 必填,生成签名的时间戳
102
+          nonceStr: res.nonceStr, // 必填,生成签名的随机串
103
+          signature: res.signature, // 必填,签名,见附录1
104
+          jsApiList: res.jsApiList // 必填,需要使用的JS接口列表,所有JS接口列表见附录2
105
+        });
106
+        wx.ready(function() {
107
+          wx.scanQRCode({
108
+            desc: "scanQRCode desc",
109
+            needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
110
+            scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
111
+            success: function(res) {
112
+              // 当needResult 为 1 时,扫码返回的结果
113
+              let str = res.resultStr.replace(/[\s\/]/g, '') || 'none';
114
+              str = str.replace(/CODABAR,/i, '');
115
+              str = str.replace(/CODE_128,/i, '');
116
+              resolve(str);
117
+            },
118
+            cancel(err){
119
+              reject(err);
120
+            }
121
+          });
122
+        });
123
+      }
124
+    })
125
+  });
126
+  // #endif
127
+}

+ 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)

+ 1 - 1
manifest.json

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

+ 24 - 1
pages.json

@@ -181,7 +181,24 @@
181 181
 	       "titleNView": false
182 182
 	     }
183 183
 	   }
184
-	 }
184
+	 },
185
+   {
186
+     "path": "pages/inspection/inspectionExecute/inspectionExecute",
187
+     "style": {
188
+       "h5": {
189
+         "titleNView": false
190
+       },
191
+       "enablePullDownRefresh": true
192
+     }
193
+   },
194
+   {
195
+     "path": "pages/inspection/inspectionValue/inspectionValue",
196
+     "style": {
197
+       "h5": {
198
+         "titleNView": false
199
+       }
200
+     }
201
+   }
185 202
   ],
186 203
   "globalStyle": {
187 204
     "navigationBarTextStyle": "black",
@@ -199,6 +216,12 @@
199 216
       "selectedIconPath": "static/img/icon_incidentList_active.png",
200 217
       "text": "故障"
201 218
     }, {
219
+      "pagePath": "pages/inspection/inspectionExecute/inspectionExecute",
220
+      "iconPath": "static/img/icon_inspectionExecute.png",
221
+      "visible": false,
222
+      "selectedIconPath": "static/img/icon_inspectionExecute_active.png",
223
+      "text": "巡检"
224
+    }, {
202 225
       "pagePath": "pages/my/my",
203 226
       "iconPath": "static/img/icon_my.png",
204 227
       "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
 

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

@@ -0,0 +1,408 @@
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
+    SM().then((ress1) => {
112
+      let postData = {
113
+        code: ress1,
114
+        taskId: data.id,
115
+        account: loginUserStore.loginUser.user.account,
116
+      };
117
+      api_scanCode(postData).then((res) => {
118
+        uni.hideLoading();
119
+        if (res.status == 200) {
120
+          inspectionValueStore.setInspectionValueData(res.data);
121
+          uni.navigateTo({
122
+            url: `/pages/inspection/inspectionValue/inspectionValue?inspectionExecuteId=${data.id}`
123
+          })
124
+        } else {
125
+          uni.showToast({
126
+            icon: 'none',
127
+            title: res.msg || '请求数据失败!'
128
+          });
129
+        }
130
+      });
131
+    }).catch(err=>{
132
+      uni.hideLoading();
133
+    });
134
+  }
135
+
136
+  // 获取tab选项
137
+  function getTabs(){
138
+    uni.showLoading({
139
+      title: "加载中",
140
+      mask: true,
141
+    });
142
+    api_hsms_getDictionary({
143
+      "type": "list",
144
+      "key": "inspection_task_status"
145
+    }).then(res => {
146
+      uni.hideLoading();
147
+      let list = res.data || [];
148
+      let todo = list.find(v => v.value === '1');
149
+      let close = list.find(v => v.value === '2');
150
+      dataInfo.tabs = [{id: 0, name: '全部', value: 'all', num: ''}];
151
+      todo && dataInfo.tabs.push({...todo, ...{num: '', value: 'todo'}});
152
+      close && dataInfo.tabs.push({...close, ...{num: '', value: 'close'}});
153
+      getList(0);
154
+    })
155
+  }
156
+
157
+  // 点击tab
158
+  function clickTab(tabId){
159
+    dataInfo.tabActiveId = tabId;
160
+    getList(0);
161
+  }
162
+
163
+  // 点击筛选
164
+  function filterClick(){
165
+    dataInfo.isFilter = true;
166
+  }
167
+
168
+  // 确认筛选
169
+  function conformFilter(evtFilter){
170
+    dataInfo.evtFilter = evtFilter;
171
+    dataInfo.isFilter = false;
172
+    getList(0);
173
+  }
174
+
175
+  // 关闭筛选
176
+  function cancelFilter(){
177
+    dataInfo.isFilter = false;
178
+  }
179
+
180
+  // 获取列表信息
181
+  function getList(idx){
182
+    uni.showLoading({
183
+      title: "加载中",
184
+      mask: true,
185
+    });
186
+    dataInfo.idx = idx === undefined ? dataInfo.idx : idx;
187
+    if(dataInfo.idx === 0){
188
+      dataInfo.list = [];
189
+    }
190
+    let tabActiveObj = dataInfo.tabs.find(v => v.id == dataInfo.tabActiveId);
191
+    let postData = {
192
+        "idx": dataInfo.idx,
193
+        "sum": 10,
194
+        "account": loginUserStore.loginUser.user.account,
195
+        "inspectionTask": {
196
+          "queryTask": tabActiveObj ? tabActiveObj.value : undefined,
197
+          "assignAccount": loginUserStore.loginUser.user.account,
198
+        }
199
+    }
200
+
201
+    if(dataInfo.evtFilter && dataInfo.evtFilter.inspectionForm && dataInfo.evtFilter.inspectionForm.id){
202
+      postData.inspectionTask.formId = dataInfo.evtFilter.inspectionForm.id;
203
+    }
204
+
205
+    if(dataInfo.evtFilter && Array.isArray(dataInfo.evtFilter.acceptDate) && dataInfo.evtFilter.acceptDate.length){
206
+      postData.inspectionTask.addTimeStart = format(startOfDay(new Date(dataInfo.evtFilter.acceptDate[0])), 'yyyy-MM-dd HH:mm:ss');
207
+      postData.inspectionTask.addTimeEnd = format(endOfDay(dataInfo.evtFilter.acceptDate[1]), 'yyyy-MM-dd HH:mm:ss');
208
+    }
209
+
210
+    if(dataInfo.evtFilter && dataInfo.evtFilter.area && dataInfo.evtFilter.area.id){
211
+      postData.inspectionTask.buildId = dataInfo.evtFilter.area.id;
212
+    }
213
+
214
+    inspectionListSearchStore.setInspectionListSearchData(dataInfo);
215
+    api_inspectionTask(postData).then(res => {
216
+      uni.hideLoading();
217
+      uni.stopPullDownRefresh();
218
+      if(res.status == 200){
219
+        let list = res.list || [];
220
+        if(list.length){
221
+          dataInfo.hasMore = true;
222
+          dataInfo.list = dataInfo.idx === 0 ? list : dataInfo.list.concat(list);
223
+        }else{
224
+          dataInfo.hasMore = false;
225
+        }
226
+      }else{
227
+        uni.showToast({
228
+          icon: 'none',
229
+          title: res.msg || '请求数据失败!'
230
+        });
231
+      }
232
+    })
233
+
234
+    getCount(postData.inspectionTask);
235
+  }
236
+
237
+  // 获取列表数量
238
+  function getCount(inspectionTask = {}){
239
+    let postData = {
240
+      account: loginUserStore.loginUser.user.account,
241
+      taskList: [],
242
+    }
243
+    dataInfo.tabs.forEach(v => {
244
+        postData.taskList.push({...inspectionTask, ...{ queryTask: v.value }});
245
+    })
246
+
247
+    api_listCount(postData).then(res => {
248
+      if(res.state == 200){
249
+        let myData = res.data || [];
250
+        dataInfo.tabs.forEach((v) => {
251
+            v.num = myData[v.value];
252
+        })
253
+      }else{
254
+        uni.showToast({
255
+          icon: 'none',
256
+          title: res.msg || '请求数据失败!'
257
+        });
258
+      }
259
+    })
260
+  }
261
+
262
+  // 初始化
263
+  function onLoadFn(){
264
+    // 我的-数量跳转
265
+    if(inspectionListSearchStore.inspectionListSearch.data){
266
+      // 缓存的搜索条件
267
+      Object.assign(dataInfo, inspectionListSearchStore.inspectionListSearch.data);
268
+    }
269
+    getTabs();
270
+  }
271
+
272
+  onLoad((option) => {
273
+    // 巡检tabbar
274
+    setTabbar(1);
275
+    onLoadFn();
276
+  })
277
+
278
+  onTabItemTap(e => {
279
+    onLoadFn();
280
+  })
281
+
282
+  onPullDownRefresh(() => {
283
+    getList(0)
284
+  })
285
+
286
+  onReachBottom(() => {
287
+    dataInfo.idx += 1;
288
+    if (dataInfo.hasMore) {
289
+      getList(); // 当触底时加载更多数据
290
+    }
291
+  })
292
+</script>
293
+
294
+<style lang="scss" scoped>
295
+page{
296
+  height: calc(100vh - var(--window-bottom));
297
+}
298
+.incidentList{
299
+  display: flex;
300
+  flex-direction: column;
301
+  justify-content: space-between;
302
+  .head{
303
+    height: 88rpx;
304
+    display: flex;
305
+    position: fixed;
306
+    z-index: 99;
307
+    width: 100%;
308
+    background-color: #fff;
309
+    font-size: 30rpx;
310
+    .tab{
311
+      flex: 1;
312
+      display: flex;
313
+      justify-content: center;
314
+      align-items: center;
315
+      border-bottom: 4rpx solid transparent;
316
+      &.active{
317
+        color: $uni-primary;
318
+        border-color: $uni-primary;
319
+      }
320
+    }
321
+    .filter{
322
+      width: 84rpx;
323
+      display: flex;
324
+      justify-content: center;
325
+      align-items: center;
326
+      .newicon-shaixuan{
327
+        font-size: 36rpx;
328
+        color: #2C2C2C;
329
+      }
330
+    }
331
+  }
332
+  .body{
333
+    margin-bottom: var(--window-bottom);
334
+    margin-top: 88rpx;
335
+    border-top: 6rpx solid #EBEBEB;
336
+    .body_item{
337
+      border-bottom: 8rpx solid #EBEBEB;
338
+      .body_item_head{
339
+        word-break: break-all;
340
+        text-align: justify;
341
+        text-align: left;
342
+        margin: 24rpx;
343
+        font-size: 30rpx;
344
+      }
345
+      .body_item_content{
346
+        border-top: 1rpx solid #D8D8D8;
347
+        padding: 24rpx 24rpx 24rpx 48rpx;
348
+        .body_item_content_p{
349
+          color: #6A6A6A;
350
+          font-size: 26rpx;
351
+          display: flex;
352
+          justify-content: space-between;
353
+          align-items: center;
354
+          margin-bottom: 24rpx;
355
+          &:last-of-type{
356
+            margin-bottom: 0;
357
+          }
358
+          .name{
359
+            flex: 1;
360
+          }
361
+          .status{
362
+            padding: 4rpx 10rpx;
363
+            border-radius: 20rpx;
364
+            background-color: #DBE8FE;
365
+            font-size: 22rpx;
366
+            color: #006CF9;
367
+          }
368
+          .icon_all{
369
+            .mic-filled,
370
+            .image-filled
371
+            {
372
+              margin-left: 16rpx;
373
+            }
374
+          }
375
+        }
376
+      }
377
+      .body_item_foot{
378
+        border-top: 1rpx solid #D8D8D8;
379
+        font-size: 26rpx;
380
+        padding: 24rpx;
381
+        .foot_info{
382
+          display: flex;
383
+          justify-content: space-between;
384
+          align-items: center;
385
+          .phone-filled{
386
+            margin-left: 5rpx;
387
+          }
388
+        }
389
+      }
390
+    }
391
+  }
392
+  .zanwu{
393
+    box-sizing: border-box;
394
+    margin-bottom: var(--window-bottom);
395
+    margin-top: 88rpx;
396
+    border-top: 6rpx solid #EBEBEB;
397
+    height: calc(100vh - var(--window-bottom) - 88rpx);
398
+    display: flex;
399
+    justify-content: center;
400
+    background-color: #F7F7F7;
401
+    .newicon-zanwu{
402
+      font-size: 256rpx;
403
+      color: #D6D6D6;
404
+      margin-top: 140rpx;
405
+    }
406
+  }
407
+}
408
+</style>

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

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

+ 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


+ 5 - 0
static/scss/common.scss

@@ -208,6 +208,11 @@ uni-toast,
208 208
   margin-top: 0!important;
209 209
 }
210 210
 
211
+// 内边距-top
212
+.pt0{
213
+  padding-top: 0!important;
214
+}
215
+
211 216
 .no-scroll{
212 217
 	overflow-y: hidden;
213 218
 }

+ 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
+);