|
@@ -12,7 +12,7 @@
|
|
|
<image v-if="imageSrc" style="width:300px;" :src="imageSrc" mode="aspectFit" @click="getPreview">
|
|
|
</image>
|
|
|
</view>
|
|
|
- <view>
|
|
|
+ <!-- <view>
|
|
|
<u-modal :show="imgPreShow" @confirm="closePreImg">
|
|
|
<view class="slot-content">
|
|
|
<image @touchmove="touchEvent" @touchend="touchEnd" @dblclick="dblclickEvent"
|
|
@@ -20,7 +20,7 @@
|
|
|
:src="imageSrc" mode="aspectFit"></image>
|
|
|
</view>
|
|
|
</u-modal>
|
|
|
- </view>
|
|
|
+ </view> -->
|
|
|
<view style="width:100%;display: flex;justify-content: space-between;margin: 2px 0px;">
|
|
|
<u-button icon="eye" type="primary" size="small" :loading="loading" loadingText="识别中"
|
|
|
style="width:49%;margin:0" @click="getGasIdentify">识别</u-button>
|
|
@@ -269,6 +269,7 @@ import api from "@/api/api";
|
|
|
import moment from 'moment'
|
|
|
import configService from '@/common/service/config.service.js'
|
|
|
// import stringSimilarity from 'string-similarity'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'gasFill',
|
|
|
props: {
|
|
@@ -306,6 +307,7 @@ export default {
|
|
|
|
|
|
data() {
|
|
|
return {
|
|
|
+ tempFilePaths: [],
|
|
|
gasTitle: '数据采集',//标题
|
|
|
backPic0: "url(/static/topnavbar0.png)",
|
|
|
backPic: "url(../../static/topnavbar.png)",
|
|
@@ -328,7 +330,7 @@ export default {
|
|
|
},
|
|
|
isFirst: true, // 是否是第一次缩放
|
|
|
loading: false,
|
|
|
- imgPreShow: false,
|
|
|
+ // imgPreShow: false,
|
|
|
paramData: {},
|
|
|
statusShow: '',
|
|
|
editData: {},
|
|
@@ -372,7 +374,7 @@ export default {
|
|
|
count: '第一次',
|
|
|
jcdd: '',
|
|
|
jcy: '',
|
|
|
- time: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
+ time: '',
|
|
|
ch4: '',
|
|
|
co2: '',
|
|
|
co: '',
|
|
@@ -380,7 +382,7 @@ export default {
|
|
|
jw: '',
|
|
|
gw: '',
|
|
|
bxy: '',
|
|
|
- tbrq: moment(new Date()).format('YYYY-MM-DD'),
|
|
|
+ tbrq: '',
|
|
|
temp: '',
|
|
|
// mcgzm: '',
|
|
|
},
|
|
@@ -390,6 +392,7 @@ export default {
|
|
|
username: function () {
|
|
|
return uni.getStorageSync('login_user_info')['realname']
|
|
|
},
|
|
|
+
|
|
|
},
|
|
|
watch: {
|
|
|
checkState: {
|
|
@@ -436,79 +439,84 @@ export default {
|
|
|
handlerToggle() {
|
|
|
this.$emit('getBackAddress')
|
|
|
},
|
|
|
- touchEvent(e) {
|
|
|
- let that = this
|
|
|
- // 双指缩放
|
|
|
- if (e.touches.length === 2) {
|
|
|
- that.fingers = true
|
|
|
- // 需要动画可以自行设置时间,个人觉得不需要动画更丝滑,所以设置为0
|
|
|
- that.animationTime = 0
|
|
|
- let touch1 = e.touches[0]
|
|
|
- let touch2 = e.touches[1]
|
|
|
- let distance = Math.floor(Math.sqrt(Math.pow(touch1.clientX - touch2.clientX, 2) + Math.pow(touch1.clientY - touch2.clientY, 2)))
|
|
|
- if (that.isFirst) {
|
|
|
- // 首次缩放 给予初始值
|
|
|
- that.lastDistance = distance
|
|
|
- that.isFirst = false
|
|
|
- } else {
|
|
|
- // 非首次缩放 计算缩放比例
|
|
|
- let scale = distance / that.lastDistance
|
|
|
- if (scale > 1) {
|
|
|
- if (that.scaleImg < 3) that.scaleImg = that.scaleImg + 0.05
|
|
|
- } else {
|
|
|
- if (that.scaleImg > 0.5) that.scaleImg = that.scaleImg - 0.05
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // 单指移动 fingers(解决双指缩放,手指松开时会导致图片乱移动问题)
|
|
|
- if (e.touches.length === 1 && that.fingers === false) {
|
|
|
- that.animationTime = 0
|
|
|
- const touch = e.touches[0]
|
|
|
- if (that.isFirst) {
|
|
|
- // 记录初始位置
|
|
|
- that.move.x = touch.clientX
|
|
|
- that.move.y = touch.clientY
|
|
|
- that.isFirst = false
|
|
|
- } else {
|
|
|
- //计算偏移量 (当前位置 - 上一次位置)
|
|
|
- that.offset.x = touch.clientX - that.move.x
|
|
|
- that.offset.y = touch.clientY - that.move.y
|
|
|
- that.move.x = touch.clientX
|
|
|
- that.move.y = touch.clientY
|
|
|
- // 通过偏移量设置图片位置
|
|
|
- that.imgLocation.x = that.imgLocation.x + that.offset.x
|
|
|
- that.imgLocation.y = that.imgLocation.y + that.offset.y
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- touchEnd(e) {
|
|
|
- let that = this
|
|
|
- // 手指离开时重置
|
|
|
- if (e.touches.length == 0) {
|
|
|
- that.isFirst = true
|
|
|
- that.fingers = false
|
|
|
- }
|
|
|
- },
|
|
|
- dblclickEvent() {
|
|
|
- let that = this
|
|
|
- that.animationTime = 1
|
|
|
- if (that.scaleImg > 1) {
|
|
|
- that.scaleImg = 1
|
|
|
- that.imgLocation.x = 0
|
|
|
- that.imgLocation.y = 0
|
|
|
- } else {
|
|
|
- that.scaleImg = 2
|
|
|
- that.imgLocation.x = 0
|
|
|
- that.imgLocation.y = 0
|
|
|
- }
|
|
|
- },
|
|
|
- //图片点击
|
|
|
+ // touchEvent(e) {
|
|
|
+ // let that = this
|
|
|
+ // // 双指缩放
|
|
|
+ // if (e.touches.length === 2) {
|
|
|
+ // that.fingers = true
|
|
|
+ // // 需要动画可以自行设置时间,个人觉得不需要动画更丝滑,所以设置为0
|
|
|
+ // that.animationTime = 0
|
|
|
+ // let touch1 = e.touches[0]
|
|
|
+ // let touch2 = e.touches[1]
|
|
|
+ // let distance = Math.floor(Math.sqrt(Math.pow(touch1.clientX - touch2.clientX, 2) + Math.pow(touch1.clientY - touch2.clientY, 2)))
|
|
|
+ // if (that.isFirst) {
|
|
|
+ // // 首次缩放 给予初始值
|
|
|
+ // that.lastDistance = distance
|
|
|
+ // that.isFirst = false
|
|
|
+ // } else {
|
|
|
+ // // 非首次缩放 计算缩放比例
|
|
|
+ // let scale = distance / that.lastDistance
|
|
|
+ // if (scale > 1) {
|
|
|
+ // if (that.scaleImg < 3) that.scaleImg = that.scaleImg + 0.05
|
|
|
+ // } else {
|
|
|
+ // if (that.scaleImg > 0.5) that.scaleImg = that.scaleImg - 0.05
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // // 单指移动 fingers(解决双指缩放,手指松开时会导致图片乱移动问题)
|
|
|
+ // if (e.touches.length === 1 && that.fingers === false) {
|
|
|
+ // that.animationTime = 0
|
|
|
+ // const touch = e.touches[0]
|
|
|
+ // if (that.isFirst) {
|
|
|
+ // // 记录初始位置
|
|
|
+ // that.move.x = touch.clientX
|
|
|
+ // that.move.y = touch.clientY
|
|
|
+ // that.isFirst = false
|
|
|
+ // } else {
|
|
|
+ // //计算偏移量 (当前位置 - 上一次位置)
|
|
|
+ // that.offset.x = touch.clientX - that.move.x
|
|
|
+ // that.offset.y = touch.clientY - that.move.y
|
|
|
+ // that.move.x = touch.clientX
|
|
|
+ // that.move.y = touch.clientY
|
|
|
+ // // 通过偏移量设置图片位置
|
|
|
+ // that.imgLocation.x = that.imgLocation.x + that.offset.x
|
|
|
+ // that.imgLocation.y = that.imgLocation.y + that.offset.y
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // touchEnd(e) {
|
|
|
+ // let that = this
|
|
|
+ // // 手指离开时重置
|
|
|
+ // if (e.touches.length == 0) {
|
|
|
+ // that.isFirst = true
|
|
|
+ // that.fingers = false
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ // dblclickEvent() {
|
|
|
+ // let that = this
|
|
|
+ // that.animationTime = 1
|
|
|
+ // if (that.scaleImg > 1) {
|
|
|
+ // that.scaleImg = 1
|
|
|
+ // that.imgLocation.x = 0
|
|
|
+ // that.imgLocation.y = 0
|
|
|
+ // } else {
|
|
|
+ // that.scaleImg = 2
|
|
|
+ // that.imgLocation.x = 0
|
|
|
+ // that.imgLocation.y = 0
|
|
|
+ // }
|
|
|
+ // },
|
|
|
+ //图片点击预览
|
|
|
getPreview() {
|
|
|
- this.imgPreShow = true
|
|
|
- },
|
|
|
- closePreImg() {
|
|
|
- this.imgPreShow = false
|
|
|
+ // this.imgPreShow = true
|
|
|
+ // 预览图片
|
|
|
+ uni.previewImage({
|
|
|
+ urls: this.tempFilePaths,
|
|
|
+ current: 0
|
|
|
+ });
|
|
|
},
|
|
|
+ // closePreImg() {
|
|
|
+ // // this.imgPreShow = false
|
|
|
+ // },
|
|
|
//获取图片识别数据
|
|
|
getGasIdentify() {
|
|
|
let that = this
|
|
@@ -539,21 +547,20 @@ export default {
|
|
|
that.deviceId = that.deviceID
|
|
|
that.formState = {
|
|
|
id: '',
|
|
|
- bc: that.classType,
|
|
|
+ bc: that.classType || '',
|
|
|
count: that.checkNum == '1' ? '第一次' : that.checkNum == '2' ? '第二次' : '',
|
|
|
- jcdd: that.deviceName,
|
|
|
- jcy: that.indexParam['检查人'],
|
|
|
- time: that.indexParam['检查时间'],
|
|
|
- ch4: that.indexParam['CH4%'],
|
|
|
- co2: that.indexParam['CO2%'],
|
|
|
- co: that.indexParam['CO(ppm)'],
|
|
|
- o2: that.indexParam['O2%'],
|
|
|
+ jcdd: that.deviceName || '',
|
|
|
+ jcy: that.indexParam && that.indexParam['检查人'] ? that.indexParam['检查人'] : that.username,
|
|
|
+ time:that.indexParam && that.indexParam['检查时间'] ? that.indexParam['检查时间'] : '',
|
|
|
+ ch4: that.indexParam && that.indexParam['CH4%'] ? that.indexParam['CH4%'] : '',
|
|
|
+ co2: that.indexParam && that.indexParam['CO2%'] ? that.indexParam['CO2%'] : '',
|
|
|
+ co: that.indexParam && that.indexParam['CO(ppm)'] ? that.indexParam['CO(ppm)'] : '',
|
|
|
+ o2: that.indexParam && that.indexParam['O2%'] ? that.indexParam['O2%'] : '',
|
|
|
jw: that.isSensor == '1' ? '0' : '-',
|
|
|
- gw: that.indexParam['CH4%'],
|
|
|
+ gw: that.indexParam && that.indexParam['CH4%'] ? that.indexParam['CH4%'] : '',
|
|
|
bxy: '0',
|
|
|
- tbrq: that.indexParam['检查时间'].substring(0, that.indexParam['检查时间'].indexOf(' ')),
|
|
|
- temp: that.indexParam['温度(℃)'],
|
|
|
- // mcgzm: '',
|
|
|
+ tbrq: that.indexParam && that.indexParam['检查时间'] ? that.indexParam['检查时间'].substring(0, that.indexParam['检查时间'].indexOf(' ')) : '',
|
|
|
+ temp: that.indexParam && that.indexParam['温度(℃)'] ? that.indexParam['温度(℃)'] : '',
|
|
|
}
|
|
|
|
|
|
new Promise((resolve, reject) => {
|
|
@@ -798,7 +805,7 @@ export default {
|
|
|
}
|
|
|
|
|
|
},
|
|
|
- fail: (errpr) => {
|
|
|
+ fail: (error) => {
|
|
|
uni.showToast({
|
|
|
title: '识别失败!',
|
|
|
icon: 'none' // 可选图标,'success', 'loading', 'none'
|
|
@@ -823,6 +830,7 @@ export default {
|
|
|
console.log(res, 'res===')
|
|
|
// 获取选中的图片路径,这里我们只取第一张图进行预览
|
|
|
this.imageSrc = res.tempFilePaths[0];
|
|
|
+ this.tempFilePaths = res.tempFilePaths
|
|
|
this.imageSrcList = res.tempFiles
|
|
|
},
|
|
|
fail: (err) => {
|
|
@@ -2234,11 +2242,19 @@ export default {
|
|
|
that.$emit('getBackAddress')
|
|
|
} else {
|
|
|
reject(response);
|
|
|
+ uni.showToast({
|
|
|
+ title: response.data,
|
|
|
+ icon: 'none' // 可选图标,'success', 'loading', 'none'
|
|
|
+ });
|
|
|
}
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
console.log("catch===>response", response);
|
|
|
reject(error);
|
|
|
+ uni.showToast({
|
|
|
+ title: '保存失败!',
|
|
|
+ icon: 'none' // 可选图标,'success', 'loading', 'none'
|
|
|
+ });
|
|
|
});
|
|
|
});
|
|
|
|