Commit 7d2eddf3 authored by xinzhedeai's avatar xinzhedeai

better: 检查单+隐患整改图片camera

parent 876c229d
......@@ -547,3 +547,21 @@ body {
font-size: 0.28rem;
color: #545454;
}
/* 图片上传camera 样式 */
.form-label-div {
width: 100% !important;
height: 50px;
line-height: 50px;
padding: 0 12px;
font-size: .28rem;
font-weight: 500;
margin-bottom: -.3rem;
}
.img-wrapper {
display: flex;
gap: .16rem;
margin-top: 0.25rem;
margin-bottom: 0.15rem;
flex-wrap: wrap;
}
......@@ -72,7 +72,7 @@
</van-cell-group>
<!-- 照片上传 -->
<van-cell-group v-if="flag=='ADD'">
<!-- <van-cell-group v-if="flag=='ADD'">
<van-cell><span class="title_require">请上传隐患图片:</span><span
style="color: red">(格式png/jpg/jpeg,最多4张)</span>
<div>
......@@ -80,7 +80,29 @@
class="uploader-wrapper" />
</div>
</van-cell>
</van-cell-group>
</van-cell-group> -->
<!-- 新增检查单 隐患图片上传 2025年7月31日13:07:28新增逻辑修改 -->
<div v-if="flag=='ADD'">
<div class="form-label form-label-div title_require title_requirediv">
请上传隐患图片:<span
style="color: red">(格式png/jpg/jpeg,最多4张)</span></div>
<div class="img-wrapper">
<div style="position: relative;" v-for="(imgItem, index) in item.photos">
<img :src="previewUrl + imgItem" style="width: 1.6rem; height: 1.6rem;"
@click="showImage4camera(item.photos, index)" />
<div class="van-uploader__preview-delete"
@click="handleDeleteFloorPlan(item, index)"><i
class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i></div>
</div>
<div v-if="item.photos.length < 4">
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;" alt="" srcset="" @click="paizhao(item)">
</div>
</div>
</div>
<van-cell-group v-if="flag!='ADD'">
<van-cell>
......@@ -189,16 +211,36 @@
</div>
<!-- 2025年6月18日 位置调整。 -->
<van-cell-group v-if="(flag=='0' || flag=='3') && userType=='shop'">
<!-- 2025年7月31日13:15:42 弃用 原vant图片上传组件方式 -->
<!-- <van-cell-group v-if="(flag=='0' || flag=='3') && userType=='shop'">
<van-cell><span class="title_require">请上传整改图片:</span><span
style="color: red">(格式png/jpg/jpeg,最多4张)</span>
<!-- <div>
<van-uploader style="width: 80px; height:80px;" v-model="item.photos" multiple
:max-count="4" :after-read="handleFileUpload" class="uploader-wrapper" />
</div> -->
<van-uploader v-model="item.photos" multiple :max-count="4" />
</van-cell>
</van-cell-group>
</van-cell-group> -->
<!-- 隐患详情 整改图片图片上传 2025年7月31日13:07:28新增逻辑修改 -->
<div v-if="(flag=='0' || flag=='3') && userType=='shop'">
<div class="form-label form-label-div title_require title_requirediv">
请上传整改图片:<span
style="color: red">(格式png/jpg/jpeg,最多4张)</span></div>
<div class="img-wrapper">
<div style="position: relative;" v-for="(imgItem, index) in item.photos">
<img :src="previewUrl + imgItem" style="width: 1.6rem; height: 1.6rem;"
@click="showImage4camera(item.photos, index)" />
<div class="van-uploader__preview-delete"
@click="handleDeleteFloorPlan(item, index)"><i
class="van-icon van-icon-cross van-uploader__preview-delete-icon"></i></div>
</div>
<div v-if="item.photos.length < 4">
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;" alt="" srcset="" @click="paizhao(item)">
</div>
</div>
</div>
<!-- 整改期限 -->
<van-cell-group v-if="flag=='ADD'">
......
......@@ -213,6 +213,83 @@ window.onload = function () {
// }
// })
// },
showImage4camera(list, index) {
const images = list.map((item) => {
return this.previewUrl + item
})
vant.ImagePreview({
images,
startPosition: index,
closeable: true,
});
},
// 处理平面图删除
handleDeleteFloorPlan(item, type) {
item.photos.splice(index, 1);
},
paizhao(item) {
var data = ["相册", "相机"];
var maxSelectNum = 4;
lightAppJssdk.notification.showMediaAlert({
arg0: data,
success: function(data) {
console.log('选择菜单的数据', data)
// formData.append('file', file.file); // 通过FormData构建要上传的文件数据
// alert(data);
var pam1 = {
"url": BASE_URL + '/common/uploads',
// url:'sdfsdfsd',
"fileKey": "files",
// "fileKey": "files",
"params": {
},
"header": {
'Authorization': gemhoUtil.getCookie('token'),
},
"chooseType": "chooseFileUpload",
"transmissionType": 0, //1-base64 0-图片地址"maxSize": 10, "maxSelectNum": 9,
"maxSize": 10,
"maxSelectNum": maxSelectNum,
}
if (data.index == 0) {
pam1.chooseType = "chooseImageUpload" // pam1.fileKey = "file"
} else if (data.index == 1) {
pam1.chooseType ="takingPicturesUpload" // pam1.fileKey = "picfile"
}
console.log('请求接口i偶路径', pam1)
chooseFileUploadTest(pam1)
// setTimeout('onHidePreloaders()', 2000);
},
fail: function(data) {
console.log(data);
}
});
function chooseFileUploadTest(pam) {
lightAppJssdk.uploadFile.chooseFileUpload({
arg0: pam,
success: function(value) {
console.log(value, 'chooseFileUploadTest图片上传回调')
if(value){
item.photos.push(...JSON.parse(value).fileNames)
if(item.photos.length > maxSelectNum){
const result = item.photos.slice(0, maxSelectNum)
item.photos = result
}
}
},
fail: function(data1) {
console.log(data1);
}
});
};
},
extendShow(item){ // 特殊检查项综合处理方法 选择是现实表单
if(YES_YH_NO.includes(item.id)){
return item.itemAnswer === 1
......@@ -683,10 +760,16 @@ window.onload = function () {
http3.post('/gq/checkRecord/safeCheckRecord', reqParam).then((res) => {
console.log('添加结果', res)
vant.Toast({
message: '操作成功',
})
gemhoUtil.navigatePage(`${this.pageName}.html${window.location.search}`, '操作完成,跳转中...')
if (res.code === 200) {
vant.Toast({
message: '操作成功',
})
gemhoUtil.navigatePage(`${this.pageName}.html${window.location.search}`, '操作完成,跳转中...')
} else {
vant.Toast({
message: '操作失败',
})
}
})
}
}
......
......@@ -221,7 +221,7 @@
<img src="../image/code/upload.png" style="width:1.6rem;height: 1.6rem;" alt="" srcset="" @click="paizhao()">
</div>
</div> -->
<!-- 详情模式 -->
<!-- 新增检查单 隐患图片上传 2025年7月31日13:07:28新增逻辑修改 -->
<div class="form-label form-label-div title_require title_requirediv" style="width: 4rem;">上传作业证件(最多4张)</div>
<div class="img-wrapper">
<div style="position: relative;" v-for="(imgItem, index) in formData.photos">
......
......@@ -49,6 +49,17 @@ window.addEventListener("load", function () {
// }
// },
methods: {
showImage(list, index) {
const images = list.map((item) => {
return this.previewUrl + item
})
vant.ImagePreview({
images,
startPosition: index,
closeable: true,
});
},
// 处理平面图删除
handleDeleteFloorPlan(index, type) {
this.formData.photos.splice(index, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment