|
|
@ -1,6 +1,6 @@ |
|
|
|
<template> |
|
|
|
<view class=""> |
|
|
|
<uni-popup ref="editPopup" class="nopadpop camera_pop"> |
|
|
|
<uni-popup ref="editPopup" class="nopadpop camera_pop" :maskClick="false"> |
|
|
|
<view class="uni-list popuni_list camera_list"> |
|
|
|
<view class="list_cell uni-flex uni-row space-between"> |
|
|
|
<view class="title">箱码</view> |
|
|
@ -49,8 +49,8 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<uploadCamera ref="uploadImage" style="margin: 10rpx;" :disabled="disabled"></uploadCamera> |
|
|
|
|
|
|
|
<uploadCamera ref="uploadImage" style="margin: 10rpx;" :disabled="disabled" @delete="deleteImg" |
|
|
|
@select="select"></uploadCamera> |
|
|
|
</view> |
|
|
|
<view class="pop_btn uni-flex uni-row space-between" v-if="!disabled"> |
|
|
|
<button class="cancel" @click="back">返回</button> |
|
|
@ -65,6 +65,12 @@ |
|
|
|
import { |
|
|
|
getInspectFailedReasonList, |
|
|
|
} from '@/common/directory.js'; |
|
|
|
import { |
|
|
|
uploadFile, |
|
|
|
getFileList, |
|
|
|
deleteFileById |
|
|
|
} from '@/api/request2.js'; |
|
|
|
|
|
|
|
import comMessage from '@/mycomponents/common/comMessage.vue' |
|
|
|
import uploadCamera from '@/pages/inspect/coms/uploadCamera.vue' |
|
|
|
import uom from '@/mycomponents/qty/uom.vue' |
|
|
@ -81,7 +87,8 @@ |
|
|
|
failedReasonIndex: 0, |
|
|
|
failedReasonArray: [], |
|
|
|
dataContent: {}, |
|
|
|
failedReasonArray: [] |
|
|
|
failedReasonArray: [], |
|
|
|
picInfoList: [] |
|
|
|
} |
|
|
|
}, |
|
|
|
props: { |
|
|
@ -101,11 +108,93 @@ |
|
|
|
this.failedReasonArray = getInspectFailedReasonList(); |
|
|
|
//拷贝数据到页面显示,防止修改数据原数据修改 |
|
|
|
this.dataContent = Object.assign({}, item) |
|
|
|
this.getFileList(); |
|
|
|
this.$refs['editPopup'].open("bottom"); |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
getFileList() { |
|
|
|
getFileList("jobInspectDetail", this.dataContent.id).then(res => { |
|
|
|
if(res.data){ |
|
|
|
var imageFiles = []; |
|
|
|
res.data.forEach(item=>{ |
|
|
|
var image = this.createImage(item.id, item.url, item.path, item.size) |
|
|
|
imageFiles.push(image) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
if (imageFiles.length > 0) { |
|
|
|
this.$nextTick(function() { |
|
|
|
this.$refs.uploadImage.setFiles(imageFiles); |
|
|
|
this.setPhotosInfo(); |
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
setPhotosInfo(){ |
|
|
|
var list = this.$refs.uploadImage.getFiles() |
|
|
|
var photoItem = ""; |
|
|
|
for (var i = 0; i < list.length; i++) { |
|
|
|
if (list.length - 1 == i) { |
|
|
|
photoItem = photoItem + list[i].url |
|
|
|
} else { |
|
|
|
photoItem = photoItem + list[i].url + "," |
|
|
|
} |
|
|
|
} |
|
|
|
this.dataContent.photos = photoItem; |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
createImage(id, url, fileName, size) { |
|
|
|
|
|
|
|
let image = { |
|
|
|
id: id, |
|
|
|
name: fileName, |
|
|
|
extname: "png", |
|
|
|
fileType: "image", |
|
|
|
url: url, |
|
|
|
size: size, |
|
|
|
image: { |
|
|
|
width: 175, |
|
|
|
height: 175, |
|
|
|
location: url, |
|
|
|
}, |
|
|
|
path: url, |
|
|
|
progress: 100, |
|
|
|
status: "ready" |
|
|
|
} |
|
|
|
|
|
|
|
return image; |
|
|
|
}, |
|
|
|
|
|
|
|
deleteImg(content) { |
|
|
|
var id = content.id |
|
|
|
if (id != undefined) { |
|
|
|
deleteFileById(id).then(res => { |
|
|
|
if (res.data) { |
|
|
|
uni.showToast({ |
|
|
|
title: "删除成功" |
|
|
|
}) |
|
|
|
} |
|
|
|
}).catch(error => { |
|
|
|
console.log(error) |
|
|
|
}) |
|
|
|
} else { |
|
|
|
this.getFileList(); |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
select(content) { |
|
|
|
this.uploadFile(content); |
|
|
|
}, |
|
|
|
|
|
|
|
back() { |
|
|
|
this.$refs['editPopup'].close(); |
|
|
|
this.afterSave() |
|
|
|
}, |
|
|
|
maskClick() { |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
afterSave() { |
|
|
@ -119,6 +208,8 @@ |
|
|
|
} |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
save() { |
|
|
|
var failedQty = Number(this.dataContent.failedQty); |
|
|
|
var crackQty = Number(this.dataContent.crackQty); |
|
|
@ -141,8 +232,21 @@ |
|
|
|
this.afterSave() |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
uploadFile(content) { |
|
|
|
uploadFile("jobInspectDetail", this.dataContent.id, content.path, res => { |
|
|
|
if (res != undefined) { |
|
|
|
uni.showToast({ |
|
|
|
title: "上传成功" |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: "上传失败" |
|
|
|
}) |
|
|
|
} |
|
|
|
this.getFileList(); |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|