|
|
|
|
@ -1,9 +1,15 @@ |
|
|
|
|
<template> |
|
|
|
|
<view> |
|
|
|
|
<ifrm ref="ifrm"> |
|
|
|
|
<!-- 安全巡检--> |
|
|
|
|
<uni-forms ref="form" err-show-type="toast"> |
|
|
|
|
<uni-forms-item> |
|
|
|
|
<input type="text" v-model="insNum" @confirm="insConfirm" class="uni-input-border" placeholder="巡检点编码" /> |
|
|
|
|
<input |
|
|
|
|
type="text" |
|
|
|
|
v-model="insNum" |
|
|
|
|
@confirm="insConfirm" |
|
|
|
|
class="uni-input-border" |
|
|
|
|
placeholder="巡检点编码" |
|
|
|
|
/> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</uni-forms> |
|
|
|
|
<uni-table border stripe emptyText="暂无更多数据" class="table"> |
|
|
|
|
@ -17,51 +23,67 @@ |
|
|
|
|
</uni-tr> |
|
|
|
|
</uni-table> |
|
|
|
|
|
|
|
|
|
<view style="font-size: 36rpx; margin: 20rpx 0">巡检备注:</view> |
|
|
|
|
<view style="font-size: 36rpx">巡检备注:</view> |
|
|
|
|
<uni-forms ref="form" err-show-type="toast"> |
|
|
|
|
<uni-forms-item> |
|
|
|
|
<uni-easyinput type="textarea" autoHeight v-model="memo" placeholder="请输入内容" /> |
|
|
|
|
<uni-easyinput |
|
|
|
|
type="textarea" |
|
|
|
|
autoHeight |
|
|
|
|
v-model="memo" |
|
|
|
|
placeholder="请输入内容" |
|
|
|
|
/> |
|
|
|
|
</uni-forms-item> |
|
|
|
|
</uni-forms> |
|
|
|
|
|
|
|
|
|
<view class="photoTitleSize">{{ uploader.length }}/9</view> |
|
|
|
|
<view class="showImage"> |
|
|
|
|
<view v-for="(item, i) in uploader" :key="i" class="showImage-for"> |
|
|
|
|
<view class="view-image"> |
|
|
|
|
<image :src="item.imageUrl" @tap="previewImage(i)" mode="widthFix" /> |
|
|
|
|
<image :src="item.imageUrl" @tap="previewImage(i)" /> |
|
|
|
|
</view> |
|
|
|
|
<view class="view-icon"> |
|
|
|
|
<uni-icons type="trash" size="14" color="gray" @click="removeScene(item, i)"></uni-icons> |
|
|
|
|
<uni-icons |
|
|
|
|
type="trash" |
|
|
|
|
size="14" |
|
|
|
|
color="gray" |
|
|
|
|
@click="removeScene(item, i)" |
|
|
|
|
></uni-icons> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="view-center" v-if="uploader.length < 9"> |
|
|
|
|
<image src="../../static/images/photo.png" @click="chooseImage"></image> |
|
|
|
|
<image |
|
|
|
|
src="../../static/images/photo.png" |
|
|
|
|
@click="chooseImage()" |
|
|
|
|
></image> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
<view class="buttonBox"> |
|
|
|
|
<button class="button" type="primary" :disabled="!(insList.length > 0)" @click="submitClick"> |
|
|
|
|
<button |
|
|
|
|
class="button" |
|
|
|
|
type="primary" |
|
|
|
|
:disabled="!(insList.length > 0)" |
|
|
|
|
@click="submitClick" |
|
|
|
|
> |
|
|
|
|
提交 |
|
|
|
|
</button> |
|
|
|
|
</view> |
|
|
|
|
</view> |
|
|
|
|
</ifrm> |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import ifrm from "@/pages/index/ifrm"; |
|
|
|
|
import scan from "../../mixin/scan.js"; |
|
|
|
|
import { |
|
|
|
|
options |
|
|
|
|
} from '@/http/config.js'; |
|
|
|
|
import { options } from "@/http/config.js"; |
|
|
|
|
export default { |
|
|
|
|
mixins: [scan], |
|
|
|
|
components: { |
|
|
|
|
ifrm, |
|
|
|
|
}, |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
|
insNum: "", |
|
|
|
|
insList: [], |
|
|
|
|
uploader: [], // 存放 { imageUrl, upId } |
|
|
|
|
uploader: [], |
|
|
|
|
memo: "", |
|
|
|
|
uploadCount: 0, // 上传计数 |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
methods: { |
|
|
|
|
@ -69,7 +91,7 @@ export default { |
|
|
|
|
this.getData(code); |
|
|
|
|
}, |
|
|
|
|
insConfirm(e) { |
|
|
|
|
this.insList = [] |
|
|
|
|
this.insList = []; |
|
|
|
|
this.getBarCode(e.target.value); |
|
|
|
|
}, |
|
|
|
|
getData(code) { |
|
|
|
|
@ -100,8 +122,8 @@ export default { |
|
|
|
|
chooseImage: async function () { |
|
|
|
|
if (this.insList.length == 0) { |
|
|
|
|
return uni.showToast({ |
|
|
|
|
title: '请先查询巡检点', |
|
|
|
|
icon: 'none' |
|
|
|
|
title: "请先查询巡检点", |
|
|
|
|
icon: "none", |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
uni.chooseImage({ |
|
|
|
|
@ -110,32 +132,34 @@ export default { |
|
|
|
|
// sourceType: ['album', 'camera'], |
|
|
|
|
success: (res) => { |
|
|
|
|
uni.showLoading({ |
|
|
|
|
title: '上传中,请稍候' |
|
|
|
|
title: "上传中,请稍候", |
|
|
|
|
}); |
|
|
|
|
res.tempFilePaths.forEach(filePath => { |
|
|
|
|
console.log('file-----------',filePath) |
|
|
|
|
console.log('options.baseURL------',options.baseURL) |
|
|
|
|
res.tempFilePaths.forEach((filePath) => { |
|
|
|
|
console.log("file-----------", filePath); |
|
|
|
|
console.log("options.baseURL------", options.baseURL); |
|
|
|
|
uni.uploadFile({ |
|
|
|
|
url: options.baseURL + '/blade-resource/oss/endpoint/put-file-attach', |
|
|
|
|
url: |
|
|
|
|
options.baseURL + |
|
|
|
|
"/blade-resource/oss/endpoint/put-file-attach", |
|
|
|
|
filePath: filePath, |
|
|
|
|
name: 'file', |
|
|
|
|
name: "file", |
|
|
|
|
header: { |
|
|
|
|
'token': 'bearer ' + uni.getStorageSync('accessToken'), |
|
|
|
|
'Blade-Auth': 'bearer ' + uni.getStorageSync('accessToken'), |
|
|
|
|
'Blade-Requested-With': 'BladeHttpRequest' |
|
|
|
|
token: "bearer " + uni.getStorageSync("accessToken"), |
|
|
|
|
"Blade-Auth": "bearer " + uni.getStorageSync("accessToken"), |
|
|
|
|
"Blade-Requested-With": "BladeHttpRequest", |
|
|
|
|
}, |
|
|
|
|
success: (uploadRes) => { |
|
|
|
|
uni.hideLoading(); |
|
|
|
|
uni.showToast({ title: '上传成功' }); |
|
|
|
|
uni.showToast({ title: "上传成功" }); |
|
|
|
|
this.uploader.push({ |
|
|
|
|
upId: JSON.parse(uploadRes.data).data.attachId, |
|
|
|
|
imageUrl: JSON.parse(uploadRes.data).data.link |
|
|
|
|
imageUrl: JSON.parse(uploadRes.data).data.link, |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
fail: (err) => { |
|
|
|
|
console.error('❌ 上传失败', err); |
|
|
|
|
uni.showToast({ title: '上传失败', icon: 'none' }); |
|
|
|
|
} |
|
|
|
|
console.error("❌ 上传失败", err); |
|
|
|
|
uni.showToast({ title: "上传失败", icon: "none" }); |
|
|
|
|
}, |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
@ -158,7 +182,7 @@ export default { |
|
|
|
|
onNavigationBarButtonTap(btn) { |
|
|
|
|
this.$refs.ifrm.topMenuClick(btn); |
|
|
|
|
}, |
|
|
|
|
onShow() { }, |
|
|
|
|
onShow() {}, |
|
|
|
|
}; |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
@ -167,7 +191,7 @@ export default { |
|
|
|
|
color: #a1a1a1; |
|
|
|
|
text-align: right; |
|
|
|
|
margin-right: 30rpx; |
|
|
|
|
margin-top: 20rpx; |
|
|
|
|
margin-top: -30rpx; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.showImage { |
|
|
|
|
@ -214,10 +238,4 @@ export default { |
|
|
|
|
height: 190rpx; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
.buttonBox { |
|
|
|
|
margin-top: 30rpx; |
|
|
|
|
display: flex; |
|
|
|
|
justify-content: center; |
|
|
|
|
} |
|
|
|
|
</style> |