Quellcode durchsuchen

Merge branch 'new-itsm-wx-handle' of http://git.dashitech.com/seimin/itsm-wx-handle into new-itsm-wx-handle

maotao vor 1 Monat
Ursprung
Commit
44a3adad21

+ 32 - 18
components/DsFilePicker.vue

@@ -3,16 +3,19 @@
3 3
 </template>
4 4
 
5 5
 <script setup>
6
-  import { defineEmits, ref, reactive, defineProps } from 'vue'
6
+  import { defineEmits, ref, reactive, defineProps, defineExpose } from 'vue'
7 7
   import { onLoad } from '@dcloudio/uni-app'
8 8
   import { useLoginUserStore } from '@/stores/loginUser'
9 9
   import { useUploadFile } from '@/share/useUploadFile.js'
10 10
 
11 11
   const emit = defineEmits(['cancelEmit', 'knowEmit']);
12
-  const { inspectionExecuteId } = defineProps({
12
+  const { inspectionExecuteId, extra } = defineProps({
13 13
     inspectionExecuteId: {
14 14
       type: Number,
15
-    }
15
+    },
16
+    extra: {
17
+      type: Number,
18
+    },
16 19
   });
17 20
   const loginUserStore = useLoginUserStore();
18 21
   const { uploadFile }  = useUploadFile();
@@ -24,11 +27,22 @@
24 27
   
25 28
   // 处理图片
26 29
   const handlerImgRef = ref(null)
27
-  // handlerImgRef.value.upload();
30
+  
31
+  // 上传图片
32
+  const uploadFn = () => {
33
+    handlerImgRef.value.upload();
34
+  }
35
+  
36
+  defineExpose({
37
+    uploadFn,
38
+    baseFormData,
39
+    extra,
40
+    inspectionExecuteId,
41
+  })
28 42
   
29 43
   // 处理图片
30 44
   function handlerOrderImg(imgObj){
31
-    return uploadFile(imgObj, 'incident', inspectionExecuteId.value)
45
+    return uploadFile(imgObj, 'inspection', inspectionExecuteId, extra)
32 46
   }
33 47
   
34 48
   // 上传报修图片成功
@@ -46,18 +60,18 @@
46 60
     })
47 61
     
48 62
     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)
63
+      // uni.hideLoading();
64
+      // console.log(resList);
65
+      // uni.showToast({
66
+      // 	icon: 'none',
67
+      //   title: '建单成功',
68
+      //   mask: true,
69
+      // });
70
+      // setTimeout(() => {
71
+      //   uni.reLaunch({
72
+      //     url: '/pages/incidentList/incidentList',
73
+      //   })
74
+      // }, 1500)
61 75
     })
62 76
   }
63 77
   
@@ -79,7 +93,7 @@
79 93
   }
80 94
   
81 95
   onLoad((option) => {
82
-    console.log(inspectionExecuteId)
96
+    console.log(extra)
83 97
   })
84 98
 </script>
85 99
 

+ 20 - 2
http/api.js

@@ -161,8 +161,12 @@ export function api_workHourManagement(data){
161 161
 /**
162 162
  * 上传附件
163 163
  */
164
-export function api_uploadAttachment(type, id){
165
-  return `${path}/common/common/uploadAttachment/${type}/${id}/${id}`
164
+export function api_uploadAttachment(type, id, extra){
165
+  if(extra){
166
+    return `${path}/common/common/uploadAttachment/${type}/${id}/${extra}`
167
+  }else{
168
+    return `${path}/common/common/uploadAttachment/${type}/${id}/${id}`
169
+  }
166 170
 }
167 171
 
168 172
 /**
@@ -234,6 +238,13 @@ export function api_inspectionTask(data){
234 238
 }
235 239
 
236 240
 /**
241
+ * 获取巡检点列表
242
+ */
243
+export function api_inspectionNode(data){
244
+  return post("/simple/data/fetchDataList/inspectionNode", data);
245
+}
246
+
247
+/**
237 248
  * 获取巡检执行列表-数量
238 249
  */
239 250
 export function api_listCount(data){
@@ -275,6 +286,13 @@ export function api_addModel(data){
275 286
 }
276 287
 
277 288
 /**
289
+ * 巡检扫一扫
290
+ */
291
+export function api_scanNodeCode(data){
292
+  return post("/inspection/scanNodeCode", data);
293
+}
294
+
295
+/**
278 296
  * 报修端-公告
279 297
  */
280 298
 export function api_getNotice(data){

+ 9 - 0
pages.json

@@ -248,6 +248,15 @@
248 248
      }
249 249
    },
250 250
    {
251
+     "path": "pages/inspection/inspectionScanning/inspectionScanning",
252
+     "style": {
253
+       "h5": {
254
+         "titleNView": false
255
+       },
256
+       "enablePullDownRefresh": true
257
+     }
258
+   },
259
+   {
251 260
      "path": "pages/inspection/inspectionValue/inspectionValue",
252 261
      "style": {
253 262
        "h5": {

+ 91 - 5
pages/inspection/inspectionExecute/inspectionExecute.vue

@@ -40,6 +40,10 @@
40 40
     <view class="zanwu" v-else>
41 41
       <text class="newicon newicon-zanwu"></text>
42 42
     </view>
43
+    <view class="toolbar" @click="scanning()">
44
+      <text class="toolbar-icon newicon newicon-saoma"></text>
45
+      <text class="toolbar-sao">扫一扫</text>
46
+    </view>
43 47
     <InspectionListFilter v-if="dataInfo.isFilter" @cancelEmit="cancelFilter" @confirmEmit="conformFilter" :evt="dataInfo.evtFilter"></InspectionListFilter>
44 48
   </view>
45 49
 </template>
@@ -50,7 +54,7 @@
50 54
   import { ref, reactive, computed } from 'vue'
51 55
   import { onLoad, onPullDownRefresh, onReachBottom, onTabItemTap } from '@dcloudio/uni-app'
52 56
   import { SM } from "@/http/http.js"
53
-  import { api_getDictionary, api_inspectionTask, api_listCount, api_scanCode } from "@/http/api.js"
57
+  import { api_getDictionary, api_inspectionTask, api_listCount, api_scanCode, api_scanNodeCode } from "@/http/api.js"
54 58
   import { filterFormatDate } from '@/filters/filterFormatDate.js'
55 59
   import { computedPriorityStyle } from '@/filters/computedPriorityStyle.js'
56 60
   import { computedStateStyle } from '@/filters/computedStateStyle.js'
@@ -81,7 +85,7 @@
81 85
 
82 86
   const assignFlag = ref(false);//指派权限
83 87
   const qiangdan = ref(false);//接单权限
84
-
88
+  
85 89
   // 转换协同人
86 90
   const computedSynergetic = computed(() => (synergetic) => {
87 91
     return (synergetic && synergetic.length) ? synergetic.map(v => v.name).join(',') : ''
@@ -101,6 +105,63 @@
101 105
       acceptDate: [],
102 106
     },//筛选框数据
103 107
   })
108
+  
109
+  // 扫一扫
110
+  function scanning(){
111
+    uni.showLoading({
112
+      title: "加载中",
113
+      mask: true,
114
+    });
115
+    SM().then((ress1) => {
116
+      // ----------------------------------
117
+      let postData = {
118
+        queryTask: 'all',
119
+        code: ress1,
120
+        idx: 0,
121
+        sum: 1,
122
+        assignAccount: loginUserStore.loginUser.user.account,
123
+      };
124
+      api_scanNodeCode(postData).then((res) => {
125
+        if (res.status == 200) {
126
+          if(res.totalNum == 1){
127
+            let data = res.list[0];
128
+            let postData = {
129
+              code: ress1,
130
+              taskId: data.id,
131
+              account: loginUserStore.loginUser.user.account,
132
+            };
133
+            api_scanCode(postData).then((res) => {
134
+              uni.hideLoading();
135
+              if (res.status == 200) {
136
+                inspectionValueStore.setInspectionValueData(res.data);
137
+                uni.navigateTo({
138
+                  url: `/pages/inspection/inspectionValue/inspectionValue?inspectionExecuteId=${data.id}`
139
+                })
140
+              } else {
141
+                uni.showToast({
142
+                  icon: 'none',
143
+                  title: res.msg || '请求数据失败!'
144
+                });
145
+              }
146
+            });
147
+          }else{
148
+            uni.hideLoading();
149
+            uni.navigateTo({
150
+              url: `/pages/inspection/inspectionScanning/inspectionScanning?inspectionNodeCode=${res.data.code}&inspectionNodeName=${res.data.name}`
151
+            })
152
+          }
153
+        } else {
154
+          uni.hideLoading();
155
+          uni.showToast({
156
+            icon: 'none',
157
+            title: res.msg || '请求数据失败!'
158
+          });
159
+        }
160
+      });
161
+    }).catch(err=>{
162
+      uni.hideLoading();
163
+    });
164
+  }
104 165
 
105 166
   // 巡检项
106 167
   function toInspectionValue(data){
@@ -296,6 +357,31 @@
296 357
 </script>
297 358
 
298 359
 <style lang="scss" scoped>
360
+.toolbar {
361
+  position: fixed;
362
+  left: 0;
363
+  bottom: var(--window-bottom);
364
+  z-index: 99;
365
+  width: 100%;
366
+  height: 88rpx;
367
+  display: flex;
368
+  justify-content: center;
369
+  align-items: center;
370
+  box-sizing: border-box;
371
+  border-radius: 4rpx;
372
+  background-color: #E5E8ED;
373
+
374
+  .toolbar-icon {
375
+    font-size: 52rpx;
376
+    margin-right: 16rpx;
377
+    color: #49B856;
378
+  }
379
+
380
+  .toolbar-sao {
381
+    font-size: 36rpx;
382
+    color: #333;
383
+  }
384
+}
299 385
 page{
300 386
   height: calc(100vh - var(--window-bottom));
301 387
 }
@@ -334,7 +420,7 @@ page{
334 420
     }
335 421
   }
336 422
   .body{
337
-    margin-bottom: var(--window-bottom);
423
+    margin-bottom: calc(var(--window-bottom) + 88rpx);
338 424
     margin-top: 88rpx;
339 425
     border-top: 6rpx solid #EBEBEB;
340 426
     .body_item{
@@ -395,10 +481,10 @@ page{
395 481
   }
396 482
   .zanwu{
397 483
     box-sizing: border-box;
398
-    margin-bottom: var(--window-bottom);
484
+    margin-bottom: calc(var(--window-bottom) + 88rpx);
399 485
     margin-top: 88rpx;
400 486
     border-top: 6rpx solid #EBEBEB;
401
-    height: calc(100vh - var(--window-bottom) - 88rpx);
487
+    height: calc(100vh - var(--window-bottom) - 176rpx);
402 488
     display: flex;
403 489
     justify-content: center;
404 490
     background-color: #F7F7F7;

+ 382 - 0
pages/inspection/inspectionScanning/inspectionScanning.vue

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

+ 92 - 58
pages/inspection/inspectionValue/inspectionValue.vue

@@ -7,7 +7,7 @@
7 7
           <uni-forms-item v-if="item.type === '1'" class="formItem" :required="item.required" :name="item.key">
8 8
             <template v-slot:label>
9 9
               <view class="customLabelWrap">
10
-                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
10
+                <text :class="{'is-required': item.required}">*</text><text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
11 11
               </view>
12 12
             </template>
13 13
             <uni-data-picker :placeholder="'请选择' + item.name" :popup-title="'请选择' + item.name" :localdata="item.list" v-model="formValues[item.key]" @change="changeForm()">
@@ -17,7 +17,7 @@
17 17
           <uni-forms-item v-if="item.type === '2'" class="formItem" :required="item.required" :name="item.key">
18 18
             <template v-slot:label>
19 19
               <view class="customLabelWrap">
20
-                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
20
+                <text :class="{'is-required': item.required}">*</text><text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
21 21
               </view>
22 22
             </template>
23 23
             <uni-data-checkbox v-model="formValues[item.key]" @change="changeForm()" :localdata="item.list" />
@@ -26,7 +26,7 @@
26 26
           <uni-forms-item v-if="item.type === '3'" class="formItem" :required="item.required" :name="item.key">
27 27
             <template v-slot:label>
28 28
               <view class="customLabelWrap">
29
-                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
29
+                <text :class="{'is-required': item.required}">*</text><text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
30 30
               </view>
31 31
             </template>
32 32
             <uni-data-checkbox v-model="formValues[item.key]" @change="changeForm()" multiple :localdata="item.list" />
@@ -35,7 +35,7 @@
35 35
           <uni-forms-item v-if="item.type === '4'" class="formItem" :required="item.required" :name="item.key">
36 36
             <template v-slot:label>
37 37
               <view class="customLabelWrap">
38
-                <text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
38
+                <text :class="{'is-required': item.required}">*</text><text class="customLabel">{{item.name}}</text><text v-if="item.isException" class="customLabel red">&nbsp;异</text>
39 39
               </view>
40 40
             </template>
41 41
             <uni-number-box v-model="formValues[item.key]" @change="changeForm()" :min="-9999" :max="9999" :placeholder="'请输入' + item.name"></uni-number-box>
@@ -50,7 +50,7 @@
50 50
           </uni-forms-item>
51 51
           <!-- 图片上传 -->
52 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>
53
+            <DsFilePicker :extra="item.id" :inspectionExecuteId="inspectionExecuteId" :ref="(el) => itemRefs[item.id] = el"></DsFilePicker>
54 54
           </uni-forms-item>
55 55
           <!-- 分割线 -->
56 56
           <view class="detail_head" v-if="item.type === '8'">
@@ -70,7 +70,7 @@
70 70
   import fromPairs from 'lodash-es/fromPairs'
71 71
   import keyBy from 'lodash-es/keyBy'
72 72
   import DsFilePicker from '@/components/DsFilePicker.vue';
73
-  import { ref, reactive } from 'vue'
73
+  import { ref, reactive, nextTick } from 'vue'
74 74
   import { onLoad } from '@dcloudio/uni-app'
75 75
   import { api_addModel } from "@/http/api.js"
76 76
   import { defaultColor } from '@/static/js/theme.js'
@@ -79,7 +79,7 @@
79 79
   import { useGoBack } from '@/share/useGoBack.js'
80 80
   import { useLoginUserStore } from '@/stores/loginUser'
81 81
   import { useInspectionValueStore } from '@/stores/inspectionValue'
82
-import { forIn } from 'lodash-es';
82
+  import { forIn } from 'lodash-es';
83 83
 
84 84
   useSetTitle();
85 85
   const loginUserStore = useLoginUserStore();
@@ -94,6 +94,9 @@ import { forIn } from 'lodash-es';
94 94
 
95 95
   // 表单
96 96
   const baseForm = ref()
97
+  
98
+  // 图片上传ref数组
99
+  const itemRefs = ref({});
97 100
 
98 101
   const inspectionExecuteId = ref()
99 102
 
@@ -132,57 +135,81 @@ import { forIn } from 'lodash-es';
132 135
 
133 136
   // 保存
134 137
   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
-        }
138
+    console.log(itemRefs.value);
139
+    console.log(formValues);
140
+    console.log(baseFormData);
141
+    // 处理图片上传检验问题
142
+    Object.values(itemRefs.value).forEach(v => {
143
+      console.log(v.inspectionExecuteId);
144
+      console.log(v.extra);
145
+      if(v && v.baseFormData.handlerImgList.length){
146
+        baseFormData.forEach(vv => {
147
+          if(vv.id == v.extra){
148
+            formValues[vv.key] = v.inspectionExecuteId;
149
+            vv.value = v.inspectionExecuteId;
150
+          }
151
+        })
168 152
       }
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
-          });
153
+    })
154
+    
155
+    nextTick(() => {
156
+      baseForm.value.validate().then(res => {
157
+        console.log('success', res);
158
+        uni.showLoading({
159
+          title: "加载中",
160
+          mask: true,
161
+        });
162
+        console.log(formValues);
163
+        let postData = {
164
+          account: loginUserStore.loginUser.user.account,
165
+          valuesList: [],
166
+        };
167
+        // baseFormData
168
+        for(let key in formValues){
169
+          let obj = baseFormData.find(v => v.key === key);
170
+          if(!((obj.type === '5' && !obj.isException) || (obj.type === '6' && !obj.isException) || (obj.type === '7' && !obj.isException))){
171
+            let name = obj.name;
172
+            let itemId = obj.id;
173
+            let _formPageList = dataInfo.inspectionFormDTO?.formPageList || [];
174
+            _formPageList = _formPageList.map(v => v.formItemList).flat();
175
+            let formItem = _formPageList.find(v => v.id === itemId);
176
+            postData.valuesList.push({
177
+              taskId: inspectionExecuteId.value,
178
+              nodeId: dataInfo.id,
179
+              formId: dataInfo.inspectionFormDTO.id,
180
+              itemId: formItem.id,
181
+              pageId: formItem.pageId,
182
+              orders: formItem.orders,
183
+              name,
184
+              valuex: (formItem.type.value === '1' || formItem.type.value === '2' || formItem.type.value === '3') ? '' : formValues[key].toString(),
185
+              configIds: (formItem.type.value === '1' || formItem.type.value === '2' || formItem.type.value === '3') ? formValues[key].toString() : undefined,
186
+              hosId: dataInfo.inspectionFormDTO.hosId,
187
+            })
188
+          }
182 189
         }
183
-      });
184
-    }).catch(err => {
185
-      console.log('err', err);
190
+        console.log(postData);
191
+        console.log(itemRefs.value);
192
+        // return;
193
+        api_addModel(postData).then((res) => {
194
+          uni.hideLoading();
195
+          if (res.status == 200) {
196
+            Object.values(itemRefs.value).forEach(v => {
197
+              v && v.uploadFn();
198
+            })
199
+            inspectionValueStore.clearInspectionValueData();
200
+            uni.reLaunch({
201
+              url: `/pages/inspection/inspectionExecute/inspectionExecute`
202
+            })
203
+          } else {
204
+            uni.showToast({
205
+              icon: 'none',
206
+              title: res.msg || '请求数据失败!'
207
+            });
208
+          }
209
+        });
210
+      }).catch(err => {
211
+        console.log('err', err);
212
+      })
186 213
     })
187 214
   }
188 215
 
@@ -232,11 +259,11 @@ import { forIn } from 'lodash-es';
232 259
       }
233 260
     });
234 261
 
235
-    let firstPageBottom = firstPage.filter(v => v.type === '5' || v.type === '6');
262
+    let firstPageBottom = firstPage.filter(v => v.type === '5' || v.type === '6' || v.type === '7');
236 263
     firstPage = firstPage.filter(v => v.type !== '5' && v.type !== '6' && v.type !== '7');
237 264
 
238 265
     // 其他项
239
-    if(isException){
266
+    if(!isException){
240 267
       firstPage.forEach(v => {
241 268
         // 下拉,单选
242 269
         if(v.type === '1' || v.type === '2'){
@@ -320,6 +347,13 @@ import { forIn } from 'lodash-es';
320 347
 </script>
321 348
 
322 349
 <style lang="scss" scoped>
350
+.customLabelWrap{
351
+  .is-required{
352
+    color: #dd524d;
353
+    font-weight: bold;
354
+    margin-top: 8rpx;
355
+  }
356
+}
323 357
 .inspectionValue{
324 358
   height: 100%;
325 359
   display: flex;

+ 3 - 3
share/useUploadFile.js

@@ -42,13 +42,13 @@ export function useUploadFile() {
42 42
   /**
43 43
    * 上传图片
44 44
    */
45
-  const uploadFile = async (imgObj, type, incidentId) => {
45
+  const uploadFile = async (imgObj, type, incidentId, extra) => {
46 46
 		console.log('44444', type)
47 47
 		if(imgObj.extname=='mp4' || imgObj.extname=='avi' || imgObj.extname=='mpeg' || 
48 48
 			imgObj.extname=='wmv' || imgObj.extname=='mov' || imgObj.extname=='3gp' ||
49 49
 			imgObj.extname=='flv' || imgObj.extname=='mkv'){
50 50
 			return uni.uploadFile({
51
-			  url: api_uploadAttachment(type, incidentId),
51
+			  url: api_uploadAttachment(type, incidentId, extra),
52 52
 			  filePath: imgObj.path,
53 53
 			  name: 'file',
54 54
 			  formData: {
@@ -74,7 +74,7 @@ export function useUploadFile() {
74 74
 			let tp = window.URL.createObjectURL(fileSrc)
75 75
 			console.log('压缩后', tp);
76 76
 			return uni.uploadFile({
77
-			  url: api_uploadAttachment(type, incidentId),
77
+			  url: api_uploadAttachment(type, incidentId, extra),
78 78
 			  filePath: tp,
79 79
 			  name: 'file',
80 80
 			  formData: {