|
@@ -81,12 +81,14 @@
|
81
|
81
|
import { useInspectionValueStore } from '@/stores/inspectionValue'
|
82
|
82
|
import { forIn } from 'lodash-es';
|
83
|
83
|
import { useIncidentBuildStore } from '@/stores/incidentBuild'
|
|
84
|
+ import { useUploadFile } from '@/share/useUploadFile.js'
|
84
|
85
|
|
85
|
86
|
useSetTitle();
|
86
|
87
|
const loginUserStore = useLoginUserStore();
|
87
|
88
|
const { goBack } = useGoBack();
|
88
|
89
|
const inspectionValueStore = useInspectionValueStore();
|
89
|
90
|
const incidentBuildStore = useIncidentBuildStore();
|
|
91
|
+ const { uploadFile } = useUploadFile();
|
90
|
92
|
|
91
|
93
|
// 主题颜色
|
92
|
94
|
const primaryColor = ref(defaultColor)
|
|
@@ -163,17 +165,19 @@
|
163
|
165
|
|
164
|
166
|
// 跳转新建事件
|
165
|
167
|
function toBuildIncident(res){
|
166
|
|
- let imgList = Object.values(itemRefs.value);
|
|
168
|
+ let imgList = Object.values(itemRefs.value).filter(Boolean);
|
167
|
169
|
let repairImgList = [];
|
168
|
170
|
if(imgList.length){
|
169
|
|
- repairImgList = imgList[0].baseFormData.handlerImgList;
|
|
171
|
+ let firstOne = baseFormData.find(v => v.type == '7');
|
|
172
|
+ let index = imgList.findIndex(v => v.extra == firstOne.id);
|
|
173
|
+ repairImgList = index > -1 ? imgList[index].baseFormData.handlerImgList : [];
|
170
|
174
|
}
|
171
|
175
|
|
172
|
176
|
let incidentData = {
|
173
|
177
|
place: res.inspectionNode.floorDTO,
|
174
|
178
|
houseNumber: res.inspectionNode.address,
|
175
|
179
|
source: defaultSourceValue.value,
|
176
|
|
- description: res.inspectionValuesList.filter(v => v.exception == 1).map(v => `${v.name}填写值为${v.valuex ? v.valuex : (v.formItemConfigList ? v.formItemConfigList.map(vv => v.name).join(',') : '')}`).join(';'),
|
|
180
|
+ description: res.inspectionValuesList.filter(v => v.exception == 1).map(v => `${v.name}填写值为${v.valuex ? v.valuex : (v.formItemConfigList ? v.formItemConfigList.map(vv => vv.name).join(',') : '')}`).join(';'),
|
177
|
181
|
requester: loginUserStore.loginUser.user,
|
178
|
182
|
branch: loginUserStore.loginUser.user.currentHospital.parent ? loginUserStore.loginUser.user.currentHospital.parent.id : loginUserStore.loginUser.user.currentHospital.id,
|
179
|
183
|
contacts: loginUserStore.loginUser.user.name,
|
|
@@ -192,7 +196,12 @@
|
192
|
196
|
url: `/pages/buildIncident/buildIncident?type=inspection`
|
193
|
197
|
})
|
194
|
198
|
}
|
195
|
|
-
|
|
199
|
+
|
|
200
|
+ // 报修图片
|
|
201
|
+ function repairOrderImg(imgObj, incidentId){
|
|
202
|
+ return uploadFile(imgObj, 'wechatRequesterIncident', incidentId, incidentId)
|
|
203
|
+ }
|
|
204
|
+
|
196
|
205
|
// 保存
|
197
|
206
|
function submit(){
|
198
|
207
|
console.log(itemRefs.value);
|
|
@@ -218,9 +227,19 @@
|
218
|
227
|
mask: true,
|
219
|
228
|
});
|
220
|
229
|
console.log(formValues);
|
|
230
|
+
|
|
231
|
+ let imgList = Object.values(itemRefs.value).filter(Boolean);
|
|
232
|
+ let repairImgList = [];
|
|
233
|
+ if(imgList.length){
|
|
234
|
+ let firstOne = baseFormData.find(v => v.type == '7');
|
|
235
|
+ let index = imgList.findIndex(v => v.extra == firstOne.id);
|
|
236
|
+ repairImgList = index > -1 ? imgList[index].baseFormData.handlerImgList : [];
|
|
237
|
+ }
|
|
238
|
+
|
221
|
239
|
let postData = {
|
222
|
240
|
account: loginUserStore.loginUser.user.account,
|
223
|
241
|
valuesList: [],
|
|
242
|
+ inspectionPhotos: repairImgList.length ? repairImgList : undefined,
|
224
|
243
|
};
|
225
|
244
|
// baseFormData
|
226
|
245
|
for(let key in formValues){
|
|
@@ -270,6 +289,15 @@
|
270
|
289
|
}
|
271
|
290
|
}
|
272
|
291
|
});
|
|
292
|
+
|
|
293
|
+ // 上传图片到故障工单
|
|
294
|
+ let requestList = [];
|
|
295
|
+ repairImgList.map((imgObj) => {
|
|
296
|
+ let repairOrderImg$ = repairOrderImg(imgObj, res.incidentId);
|
|
297
|
+ requestList.push(repairOrderImg$);
|
|
298
|
+ })
|
|
299
|
+
|
|
300
|
+ Promise.all(requestList).then(resList => {})
|
273
|
301
|
} else if(res.inspectionForm.showOrder == 1){
|
274
|
302
|
// 是否显示生成维修单
|
275
|
303
|
uni.showModal({
|