Browse Source

瓦斯巡检-图片识别更新

lxh 6 days ago
parent
commit
f14b56a785
3 changed files with 69 additions and 229 deletions
  1. 2 2
      common/service/config.service.js
  2. 1 0
      package.json
  3. 66 227
      pages/gasreport/components/gasImgIdentify.vue

+ 2 - 2
common/service/config.service.js

@@ -12,8 +12,8 @@ if (process.env.NODE_ENV == "development") {
   // BASE_URL = "http://10.120.120.164:9999"; // 察哈素
   // BASE_URL = "http://182.92.126.35:9999"; // 生产环境
   // BASE_URL = "http://172.16.53.16:9999"; // 
-  // BASE_URL = "http://10.246.167.205:9999"; //上湾
-  BASE_URL = "172.30.157.9:8092"; //元子沟
+  BASE_URL = "http://10.246.167.205:9999"; //上湾
+  // BASE_URL = "172.30.157.9:8092"; //元子沟
 
 }
 let staticDomainURL = BASE_URL + "/sys/common/static";

+ 1 - 0
package.json

@@ -5,6 +5,7 @@
     "echarts": "^5.5.1",
     "flv.js": "^1.6.2",
     "moment": "^2.30.1",
+    "string-similarity": "^4.0.4",
     "uview-ui": "^2.0.36",
     "vuex": "^3.6.2",
     "zrender": "^5.6.0"

+ 66 - 227
pages/gasreport/components/gasImgIdentify.vue

@@ -7,14 +7,20 @@
                     style="margin: 2px 0px;">图片选取</u-button>
                 <!-- 图片预览 -->
                 <view class="imgView">
-                    <image v-if="imageSrc" style="width:150px" :src="imageSrc" mode="widthFix"></image>
+                    <image v-if="imageSrc" style="width:150px" :src="imageSrc" mode="widthFix" @click="getPreview">
+                    </image>
+                </view>
+                <view>
+                    <u-modal :show="imgPreShow" @confirm="closePreImg">
+                        <view class="slot-content">
+                            <image style="width:200px" :src="imageSrc" mode="heightFix"></image>
+                        </view>
+                    </u-modal>
                 </view>
                 <view style="width:100%;display: flex;justify-content: space-between;margin: 2px 0px;">
-                    <u-button icon="plus" v-if="hasPermission('gasReport:add')" type="primary" size="small"
-                        style="width:32%;margin:0" @click="getAdd">新增</u-button>
-                    <u-button icon="eye" type="primary" size="small" style="width:32%;margin:0"
-                        @click="getGasIdentify">识别</u-button>
-                    <u-button icon="trash" type="primary" size="small" style="width:32%;margin:0"
+                    <u-button icon="eye" type="primary" size="small" :loading="loading" loadingText="识别中"
+                        style="width:49%;margin:0" @click="getGasIdentify">识别</u-button>
+                    <u-button icon="trash" type="primary" size="small" style="width:49%;margin:0"
                         @click="delSb">删除</u-button>
                 </view>
             </view>
@@ -40,6 +46,12 @@
             <view :class="indexList.length != 0 ? 'bot-gas-list1' : 'bot-gas-list'">
                 <view class="top-title">
                     <view style="font-weight: bold;">瓦斯填报列表</view>
+                    <view style="width:80px;height:20px;display: flex;justify-content: center;align-items: center;font-size: 12px;">
+                        <text style="margin-right:5px" @click="getAll">显示全部</text>
+                        <text>
+                            <u-icon name="arrow-right-double" size="12" top="2px" color="#000"></u-icon>
+                        </text>
+                    </view>
                 </view>
                 <view class="top-content" v-for="(item, index) in gasList" :key="index">
                     <view class="content-title-gas">
@@ -152,11 +164,6 @@
                         :disabled="statusShow == 'edit'" :localdata="rangeCount"
                         @change="changeCount"></uni-data-select>
                 </view>
-                <!-- <view class="dialog-item">
-                    <text class="dialog-label">煤层工作面:</text>
-                    <uni-data-select placeholder="请选择煤层工作面" align="center" :clear="true" v-model="formState.mcgzm"
-                        :localdata="rangeMcgzm" @change="changeMc"></uni-data-select>
-                </view> -->
                 <view class="dialog-item">
                     <text class="dialog-label">检测地点:</text>
                     <uni-data-select placeholder="请选择检测地点" align="center" :clear="true" v-model="formState.jcdd"
@@ -222,10 +229,7 @@
                     </view>
                     <view class="dialog-item">
                         <text class="dialog-label">光瓦测量数据:</text>
-                        <!-- <u--input inputAlign="center"  v-model="formState.gw"
-                            :placeholder="isRule1 ? '请输入' : '数据有误'" type="number" @blur="getBlur" clearable
-                            @input="changeInput($event, 'ch4')"
-                            :placeholderStyle="isRule1 ? 'color:#c0c4cc' : 'color:#ff0000'"></u--input> -->
+
                         <u--input inputAlign="center" type="number" v-model="formState.ch4" placeholder="请输入" clearable
                             @input="changeInput($event, 'ch4')"></u--input>
                     </view>
@@ -252,14 +256,17 @@
 <script>
 import api from "@/api/api";
 import moment from 'moment'
-import { mapGetters } from "vuex";
 import configService from '@/common/service/config.service.js'
+import stringSimilarity from 'string-similarity'
 export default {
     name: 'gasFill',
     props: {},
 
     data() {
         return {
+            tableData:[],
+            loading: false,
+            imgPreShow: false,
             paramData: {},
             statusShow: '',
             editData: {},
@@ -300,7 +307,7 @@ export default {
             formState: {
                 id: '',
                 bc: '',
-                count: '',
+                count: '第一次',
                 jcdd: '',
                 jcy: '',
                 time: moment(new Date()).format('YYYY-MM-DD HH:mm:ss'),
@@ -331,10 +338,22 @@ export default {
             let permission = uni.getStorageSync('btnPermission')
             return permission.filter(v => v.action == param).length != 0 ? true : false
         },
+        //显示全部
+        getAll(){
+            let that=this
+            that.gasList=that.tableData
+        },
+        //图片点击
+        getPreview() {
+            this.imgPreShow = true
+        },
+        closePreImg() {
+            this.imgPreShow = false
+        },
         //获取图片识别数据
         getGasIdentify() {
             let that = this
-            console.log(that.imageSrcList[0])
+            that.loading = true
             let apiUrlImg = `${configService.apiUrlP.substring(0, configService.apiUrlP.lastIndexOf(':'))}:6006`
             uni.uploadFile({
                 url: `${apiUrlImg}/gasIdentify`,
@@ -345,12 +364,12 @@ export default {
                 },
                 success: (res) => {
                     if (res) {
-                        console.log(JSON.parse(res.data), '识别数据------')
                         that.indexList = JSON.parse(res.data).data || []
                         uni.showToast({
                             title: '识别成功!',
                             icon: 'none' // 可选图标,'success', 'loading', 'none'
                         });
+                        that.loading = false
                     }
 
                 },
@@ -361,7 +380,6 @@ export default {
                     });
                 }
             });
-           
         },
         // 选择图片的方法
         chooseImage() {
@@ -382,9 +400,32 @@ export default {
         },
         //进行选择识别
         choiceSb(item) {
+            let that=this
             console.log(item, '选择识别---')
             this.indexParam = Object.assign({}, item)
-            this.indexList = []
+                that.isShowAdd = true
+                that.statusShow = 'add'
+                let jcddList=that.rangeJcdd.map(el=>el.text)
+                let addressName= that.indexParam['检查地点']
+                let jcddData=stringSimilarity.findBestMatch(addressName,jcddList)
+                that.formState = {
+                    id: '',
+                    bc: that.indexParam['班次'],
+                    count: that.formState.count,
+                    jcdd: jcddData.bestMatch.target,
+                    jcy: that.indexParam['检查人'],
+                    time: that.indexParam['检查时间'],
+                    ch4: that.indexParam['CH4%'],
+                    co2: that.indexParam['CO2%'],
+                    co: that.indexParam['CO(ppm)'],
+                    o2: that.indexParam['O2%'],
+                    jw: '0',
+                    gw: that.indexParam['CH4%'],
+                    bxy: '0',
+                    tbrq: that.indexParam['检查时间'].substring(0, that.indexParam['检查时间'].indexOf(' ')),
+                    temp: that.indexParam['温度(℃)'],
+                    // mcgzm: '',
+                }
         },
         //删除
         delSb() {
@@ -548,24 +589,7 @@ export default {
             let that = this
             that.formState.count = e
             if (that.formState.bc == '早班' && that.formState.count == '第一次') {
-                // that.formState = {
-                //     id: '',
-                //     bc: that.indexParam['班次'],
-                //     count: that.formState.count || '',
-                //     jcdd: that.formState.jcdd || '',
-                //     jcy: that.indexParam['检查人'],
-                //     time: that.indexParam['检查时间'],
-                //     ch4: that.indexParam['CH4%'],
-                //     co2: that.indexParam['CO2%'],
-                //     co: that.indexParam['CO(ppm)'],
-                //     o2: that.indexParam['O2%'],
-                //     jw: '0',
-                //     gw: that.indexParam['CH4%'],
-                //     bxy: '0',
-                //     tbrq: that.indexParam['检查时间'].substring(0, that.indexParam['检查时间'].indexOf(' ')),
-                //     temp: that.indexParam['温度(℃)'],
-                //     // mcgzm: '',
-                // }
+          
                 let param = {
                     // deviceId: that.deviceId,
                     bxySdzEarly1: that.formState.bxy,
@@ -941,11 +965,6 @@ export default {
                     });
             });
         },
-        //工作面煤层选项切换
-        // changeMc(e) {
-        //     this.formState.mcgzm = e
-        //     this.getSelectList()
-        // },
         //检测时间下拉选项切换
         change(e) {
             let that = this
@@ -960,24 +979,6 @@ export default {
                             if (data.length != 0) {
                                 that.saveShowList = data[0]
                                 if (that.formState.bc == '早班' && that.formState.count == '第一次') {
-                                    // that.formState = {
-                                    //     id: '',
-                                    //     bc: that.indexParam['班次'],
-                                    //     count: that.formState.count || '',
-                                    //     jcdd: that.formState.jcdd || '',
-                                    //     jcy: that.indexParam['检查人'],
-                                    //     time: that.indexParam['检查时间'],
-                                    //     ch4: that.indexParam['CH4%'],
-                                    //     co2: that.indexParam['CO2%'],
-                                    //     co: that.indexParam['CO(ppm)'],
-                                    //     o2: that.indexParam['O2%'],
-                                    //     jw: '0',
-                                    //     gw: that.indexParam['CH4%'],
-                                    //     bxy: '0',
-                                    //     tbrq: that.indexParam['检查时间'].substring(0, that.indexParam['检查时间'].indexOf(' ')),
-                                    //     temp: that.indexParam['温度(℃)'],
-                                    //     // mcgzm: '',
-                                    // }
                                     let param = {
                                         // deviceId: that.deviceId,
                                         bxySdzEarly1: that.formState.bxy,
@@ -1209,20 +1210,10 @@ export default {
             });
 
         },
-        // changeTb(e) {
-        //     this.tbTime = moment(e.value).format('YYYY-MM-DD')
-        // },
         //点击弹出日期下拉选项
         getChangeTime() {
             this.showCalendar = true
         },
-        // getChangeTimeTb() {
-        //     this.showCalendarTb = true
-        // },
-        // confirmTb() {
-        //     this.showCalendarTb = false
-        //     this.getGasList()
-        // },
         //输入框内容变换
         changeInput(val, data) {
             if (/^00/.test(val)) {
@@ -1321,32 +1312,6 @@ export default {
                 this.isRule14 = false
             }
         },
-        //瓦斯新增
-        getAdd() {
-            let that = this
-            if (JSON.stringify(that.indexParam) != '{}') {
-                that.isShowAdd = true
-                that.statusShow = 'add'
-                that.formState = {
-                    id: '',
-                    bc: that.indexParam['班次'],
-                    count: that.formState.count,
-                    jcdd: that.formState.jcdd,
-                    jcy: that.indexParam['检查人'],
-                    time: that.indexParam['检查时间'],
-                    ch4: that.indexParam['CH4%'],
-                    co2: that.indexParam['CO2%'],
-                    co: that.indexParam['CO(ppm)'],
-                    o2: that.indexParam['O2%'],
-                    jw: '0',
-                    gw: that.indexParam['CH4%'],
-                    bxy: '0',
-                    tbrq: that.indexParam['检查时间'].substring(0, that.indexParam['检查时间'].indexOf(' ')),
-                    temp: that.indexParam['温度(℃)'],
-                    // mcgzm: '',
-                }
-            }
-        },
         //编辑
         getEdits(param, item) {
             let that = this
@@ -1472,112 +1437,6 @@ export default {
         getAddSave() {
             let that = this
             console.log(that.paramData, 'paramData---------')
-            // if (that.formState.bc == '早班' && that.formState.count == '第一次') {
-            //     param = {
-            //         id: that.formState.id,
-            //         deviceId: that.deviceId,
-            //         bxySdzEarly1: that.formState.bxy,
-            //         ch4Early1: that.formState.ch4,
-            //         checkPersonEarly: that.formState.jcy,
-            //         co2Early1: that.formState.co2,
-            //         coEarly1: that.formState.co,
-            //         gwSdzEarly1: that.formState.gw,
-            //         jwSdzEarly1: that.formState.ch4,
-            //         o2Early1: that.formState.o2,
-            //         strInstallPos: that.formState.jcdd,
-            //         timeEarly1: that.formState.time,
-            //         reportTime: that.formState.tbrq,
-            //         tearly1: that.formState.temp
-            //     }
-
-            // } else if (that.formState.bc == '早班' && that.formState.count == '第二次') {
-            //     param = {
-            //         deviceId: that.deviceId,
-            //         id: that.formState.id,
-            //         bxySdzEarly2: that.formState.bxy,
-            //         ch4Early2: that.formState.ch4,
-            //         checkPersonEarly: that.formState.jcy,
-            //         co2Early2: that.formState.co2,
-            //         coEarly2: that.formState.co,
-            //         gwSdzEarly2: that.formState.gw,
-            //         jwSdzEarly2: that.formState.ch4,
-            //         o2Early2: that.formState.o2,
-            //         strInstallPos: that.formState.jcdd,
-            //         timeEarly2: that.formState.time,
-            //         reportTime: that.formState.tbrq,
-            //         tearly2: that.formState.temp
-            //     }
-            // } else if (that.formState.bc == '中班' && that.formState.count == '第一次') {
-            //     param = {
-            //         deviceId: that.deviceId,
-            //         id: that.formState.id,
-            //         bxySdzNoon1: that.formState.bxy,
-            //         ch4Noon1: that.formState.ch4,
-            //         checkPersonNoon: that.formState.jcy,
-            //         co2Noon1: that.formState.co2,
-            //         coNoon1: that.formState.co,
-            //         gwSdzNoon1: that.formState.gw,
-            //         jwSdzNoon1: that.formState.ch4,
-            //         o2Noon1: that.formState.o2,
-            //         strInstallPos: that.formState.jcdd,
-            //         timeNoon1: that.formState.time,
-            //         reportTime: that.formState.tbrq,
-            //         tnoon1: that.formState.temp
-            //     }
-
-            // } else if (that.formState.bc == '中班' && that.formState.count == '第二次') {
-            //     param = {
-            //         deviceId: that.deviceId,
-            //         id: that.formState.id,
-            //         bxySdzNoon2: that.formState.bxy,
-            //         ch4Noon2: that.formState.ch4,
-            //         checkPersonNoon: that.formState.jcy,
-            //         co2Noon2: that.formState.co2,
-            //         coNoon2: that.formState.co,
-            //         gwSdzNoon2: that.formState.gw,
-            //         jwSdzNoon2: that.formState.ch4,
-            //         o2Noon2: that.formState.o2,
-            //         strInstallPos: that.formState.jcdd,
-            //         timeNoon2: that.formState.time,
-            //         reportTime: that.formState.tbrq,
-            //         tnoon2: that.formState.temp
-            //     }
-
-            // } else if (that.formState.bc == '夜班' && that.formState.count == '第一次') {
-            //     param = {
-            //         deviceId: that.deviceId,
-            //         id: that.formState.id,
-            //         bxySdzNight1: that.formState.bxy,
-            //         ch4Night1: that.formState.ch4,
-            //         checkPersonNight: that.formState.jcy,
-            //         co2Night1: that.formState.co2,
-            //         coNight1: that.formState.co,
-            //         gwSdzNight1: that.formState.gw,
-            //         jwSdzNight1: that.formState.ch4,
-            //         o2Night1: that.formState.o2,
-            //         strInstallPos: that.formState.jcdd,
-            //         timeNight1: that.formState.time,
-            //         reportTime: that.formState.tbrq,
-            //         tnight1: that.formState.temp
-            //     }
-            // } else if (that.formState.bc == '夜班' && that.formState.count == '第二次') {
-            //     param = {
-            //         deviceId: that.deviceId,
-            //         id: that.formState.id,
-            //         bxySdzNight2: that.formState.bxy,
-            //         ch4Night2: that.formState.ch4,
-            //         checkPersonNoon: that.formState.jcy,
-            //         co2Night2: that.formState.co2,
-            //         coNight2: that.formState.co,
-            //         gwSdzNight2: that.formState.gw,
-            //         jwSdzNight2: that.formState.ch4,
-            //         o2Night2: that.formState.o2,
-            //         strInstallPos: that.formState.jcdd,
-            //         timeNight2: that.formState.time,
-            //         reportTime: that.formState.tbrq,
-            //         tnight2: that.formState.temp
-            //     }
-            // }
             new Promise((resolve, reject) => {
                 api
                     .getAdd({ ...that.paramData })
@@ -2093,7 +1952,6 @@ export default {
         getCancel() {
             this.isShowAdd = false
             this.saveShowList = {}
-            this.indexList = []
             this.indexParam = {}
             this.clearData()
         },
@@ -2106,8 +1964,9 @@ export default {
                     .getGas({ reportTime: that.tbTime, })
                     .then((response) => {
                         if (response.data.code == 200) {
-                            let data = response.data.result.records
-                            that.gasList = data
+                             that.tableData= response.data.result.records
+                            that.gasList =  that.tableData.slice(that.tableData.length-1)
+
                         } else {
                             reject(response);
                         }
@@ -2118,26 +1977,6 @@ export default {
                     });
             });
         },
-        // //获取煤层工作面列表数据
-        // getMcList() {
-        //     new Promise((resolve, reject) => {
-        //         api
-        //             .getDictItems({ dictCode: 'coalseam' })
-        //             .then((response) => {
-        //                 let data = response.data
-        //                 this.rangeMcgzm = data.map(el => {
-        //                     return {
-        //                         text: el.label,
-        //                         value: el.value,
-        //                     }
-        //                 })
-        //             })
-        //             .catch((error) => {
-        //                 console.log("catch===>response", response);
-        //                 reject(error);
-        //             });
-        //     });
-        // },
         //获取安装位置下拉选项
         getSelectList() {
             new Promise((resolve, reject) => {