Преглед изворни кода

上湾,大海则瓦斯巡检-更新

lxh пре 4 дана
родитељ
комит
be5168ba03

+ 1 - 1
.hbuilderx/launch.json

@@ -2,7 +2,7 @@
     "version" : "1.0",
     "configurations" : [
         {
-            "playground" : "standard",
+            "playground" : "custom",
             "type" : "uni-app:app-android"
         },
         {

+ 5 - 0
api/api.js

@@ -264,6 +264,11 @@ const apiService = {
       return configService.staticDomainURL + "/" + avatar;
     }
   },
+  // 获取瓦斯巡检详情图片
+  gasServerImg(params) {
+    const url = buildURL("/gasServerImg", params);
+    return http.post(url);
+  },
 };
 
 export default apiService;

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

@@ -18,7 +18,7 @@ if (process.env.NODE_ENV == "development") {
 let staticDomainURL = BASE_URL + "/sys/common/static";
 const configService = {
   apiUrl: uni.getStorageSync("apiUrl"),
-  apiUrlP: "http://10.246.167.205:6006",
+  apiUrlP: "http://10.246.167.205",
   // apiUrlP: 'http://182.92.126.35:6006',
   staticDomainURL: staticDomainURL,
 };

+ 10 - 3
pages/gasreport/components/gasFill.vue

@@ -253,6 +253,7 @@ export default {
             zcList: [],//暂存列表
             zcShow: false,//是否显示暂存列表
             isShowSave: false,//控制保存提示弹窗显示隐藏
+            zcParamData: {},//当前所选中暂存数据
         };
     },
     computed: {
@@ -1547,7 +1548,7 @@ export default {
             that.isStatus = 'add'
             that.formState.jcy = this.username
             that.formState.time = moment(new Date()).format('YYYY-MM-DD HH:mm:ss')
-            that.formState. tbrq = moment(new Date()).format('YYYY-MM-DD')
+            that.formState.tbrq = moment(new Date()).format('YYYY-MM-DD')
             if (that.nfcShow) {
                 testNfc.listenNFCStatus()
                 testNfc.readData();
@@ -1557,7 +1558,6 @@ export default {
         getAddSave() {
             let that = this
             let param = {}
-
             if (that.formState.bc == '早班' && that.formState.count == '第一次') {
                 param = {
                     // id: that.formState.id,
@@ -1676,6 +1676,8 @@ export default {
                             that.isShowAdd = false
                             that.isDisabled = false
                             that.saveShowList = {}
+                            that.zcList = that.zcList.filter(v => v.cardId != that.zcParamData.cardId) || []
+                            uni.setStorageSync('zcList', that.zcList)
                             that.clearData()
                         } else {
                             reject(response);
@@ -1692,7 +1694,6 @@ export default {
         getEditSave() {
             let that = this
             let param = {}
-
             if (that.formState.bc == '早班' && that.formState.count == '第一次') {
                 param = {
                     id: that.saveShowList.id,
@@ -2136,6 +2137,8 @@ export default {
                             that.isShowAdd = false
                             that.isDisabled = false
                             that.saveShowList = {}
+                            that.zcList = that.zcList.filter(v => v.cardId != that.zcParamData.cardId) || []
+                            uni.setStorageSync('zcList', that.zcList)
                             that.clearData()
                         } else {
                             reject(response);
@@ -2276,6 +2279,7 @@ export default {
             that.zcList.push({ cardId: that.cardIds, bc: that.formState.bc, count: that.formState.count, info: that.formState })
             uni.setStorageSync('zcList', that.zcList)
             that.isShowAdd = false
+            that.clearData()
         },
         //进入暂存列表
         openZc() {
@@ -2290,6 +2294,9 @@ export default {
                 that.zcShow = false
                 that.isShowAdd = true
                 that.formState = Object.assign({}, param.info)
+                that.zcParamData = Object.assign({}, param)
+                // that.zcList = that.zcList.filter(v => v.cardId != that.zcParamData.cardId) || []
+                // uni.setStorageSync('zcList', that.zcList)
                 that.getCardLists(param.cardId)
             } else {
                 that.zcShow = false

+ 135 - 23
pages/gasreport/components/gasImgIdentify.vue

@@ -9,8 +9,8 @@
                     style="margin: 2px 0px;">图片选取</u-button>
                 <!-- 图片预览 -->
                 <view class="imgView">
-                    <image v-if="saveImg || imageSrc" style="width:300px;" :src="imageSrc ? imageSrc : saveImg"
-                        mode="aspectFit" @click="getPreview">
+                    <image v-if="saveImg || imageSrc" style="width:100%" :src="imageSrc ? imageSrc : saveImg"
+                        @click="getPreview">
                     </image>
                 </view>
 
@@ -24,8 +24,21 @@
             </view>
         </view>
 
+        <view v-if="statusShow == 'edit'">
+            <view class="top-gas-list">
+                <u-button type="primary" icon="camera-fill" size="small" @click="GalleryFile"
+                    style="margin: 2px 0px;">图片更新</u-button>
+                <!-- 图片预览 -->
+                <view class="imgView">
+                    <image v-if="imageSrcView" style="width:100%" :src="imageSrcView" @click="getPreview">
+                    </image>
+                </view>
+            </view>
+        </view>
+
         <!-- 新增弹窗 -->
-        <view v-if="isShowAdd" :class="statusShow == 'edit' ? 'bot-gas-list1' : 'bot-gas-list'">
+        <view v-if="isShowAdd" :style="{ padding: imageSrcView ? '295px 0px 10px 0px' : '54px 0px 10px 0px' }"
+            :class="statusShow == 'edit' ? 'bot-gas-list1' : 'bot-gas-list'">
             <view class="top-dialog-area">
                 <view class="dialog-item">
                     <text class="dialog-label">班次:</text>
@@ -54,7 +67,7 @@
                         :disabled="statusShow == 'edit'"></u--input>
                 </view>
                 <view class="dialog-item">
-                    <text class="dialog-label">瓦斯检查工:</text>
+                    <text class="dialog-label">检查工:</text>
                     <u--input inputAlign="center" disabled v-model="formState.jcy" placeholder="请输入"></u--input>
                 </view>
             </view>
@@ -99,13 +112,13 @@
                             @input="changeInput($event, 'jw')"></u--input>
                     </view>
                     <view class="dialog-item">
-                        <text class="dialog-label">光瓦测量数据:</text>
+                        <text class="dialog-label">光瓦:</text>
 
                         <u--input inputAlign="center" type="number" v-model="formState.ch4" placeholder="请输入" clearable
                             @input="changeInput($event, 'ch4')"></u--input>
                     </view>
                     <view class="dialog-item">
-                        <text class="dialog-label">便携仪测量数据:</text>
+                        <text class="dialog-label">便携仪:</text>
                         <u--input inputAlign="center" :placeholderStyle="isRule3 ? 'color:#c0c4cc' : 'color:#ff0000'"
                             :placeholder="isRule3 ? '请输入' : '数据有误'" type="number" v-model="formState.bxy" clearable
                             @blur="getBlurBxy" @input="changeInput($event, 'bxy')"></u--input>
@@ -172,6 +185,7 @@ export default {
 
     data() {
         return {
+            imageSrcView: '',//任务明细查看图片详情
             tempFilePaths: [],
             gasTitle: '数据采集',//标题
             backPic0: "url(/static/topnavbar0.png)",
@@ -183,7 +197,6 @@ export default {
             indexList: [],//识别数据
             indexParam: {},//当前选中识别的数据
             imageSrc: '',
-            imageSrcList: '',
             deviceId: '',
             rangeBc: [
                 { value: '夜班', text: "夜班" },
@@ -250,6 +263,8 @@ export default {
                     this.statusShow = 'edit'
                     this.gasTitle = '数据详情'
                     this.getGasList()
+                    //获取任务详情图片
+                    this.getTaskImg()
                 } else {
                     that.isShowAdd = false
                     that.statusShow = 'add'
@@ -297,13 +312,19 @@ export default {
                 }
             }
             RHFselcet.getPicture(parameter, (data) => {
+                that.tempFilePaths = []
                 let arrData = data.mediaArray
                 console.log(arrData)
-                that.imageSrc = arrData[0].Pathurl
-                that.imageSrcList = arrData[0].path
-                that.tempFilePaths = []
-                that.tempFilePaths.push(that.imageSrc)
-                uni.setStorageSync(that.deviceID, that.imageSrc);
+                if (that.statusShow == 'edit') {
+                    that.imageSrcView = arrData[0].Pathurl
+                    that.tempFilePaths.push(that.imageSrcView)
+                    //更新图片
+                    that.getUpdateImg()
+                } else {
+                    that.imageSrc = arrData[0].Pathurl
+                    that.tempFilePaths.push(that.imageSrc)
+                    uni.setStorageSync(that.deviceID, that.imageSrc);
+                }
             });
         },
         //点击返回上一级
@@ -312,11 +333,19 @@ export default {
         },
         //图片点击预览
         getPreview() {
+            let that = this
             // 预览图片
-            uni.previewImage({
-                urls: this.saveImg ? [this.saveImg] : this.tempFilePaths,
-                current: 0
-            });
+            if (statusShow == 'edit') {
+                uni.previewImage({
+                    urls: this.tempFilePaths,
+                    current: 0
+                });
+            } else {
+                uni.previewImage({
+                    urls: this.saveImg ? [this.saveImg] : this.tempFilePaths,
+                    current: 0
+                });
+            }
         },
         //先压缩后识别
         getScale() {
@@ -334,7 +363,7 @@ export default {
                 // 压缩成功回调
                 that.loading = true
                 let jcNum = that.deviceName.indexOf('第三次') != -1 ? 3 : null
-                let apiUrlImg = `${configService.apiUrlP.substring(0, configService.apiUrlP.lastIndexOf(':'))}:6006`
+                let apiUrlImg = `${configService.apiUrlP}:6008`
                 uni.uploadFile({
                     url: `${apiUrlImg}/gasIdentify`,
                     filePath: that.imageSrc,
@@ -343,7 +372,9 @@ export default {
                         'user': that.username,
                         'order': that.classType,
                         'reportdate': that.searchTime,
-                        'checkorder': jcNum ? jcNum : Number(that.checkNum)
+                        'checkorder': jcNum ? jcNum : Number(that.checkNum),
+                        'checkpath': that.deviceName,
+                        'imgpath': that.imageSrc,
                     },
 
                     success: (res) => {
@@ -659,7 +690,7 @@ export default {
             let that = this
             that.loading = true
             let jcNum = that.deviceName.indexOf('第三次') != -1 ? 3 : null
-            let apiUrlImg = `${configService.apiUrlP.substring(0, configService.apiUrlP.lastIndexOf(':'))}:6006`
+            let apiUrlImg = `${configService.apiUrlP}:6008`
             uni.uploadFile({
                 url: `${apiUrlImg}/gasIdentify`,
                 filePath: that.saveImg,
@@ -668,7 +699,9 @@ export default {
                     'user': that.username,
                     'order': that.classType,
                     'reportdate': that.searchTime,
-                    'checkorder': jcNum ? jcNum : Number(that.checkNum)
+                    'checkorder': jcNum ? jcNum : Number(that.checkNum),
+                    'checkpath': that.deviceName,
+                    'imgpath': that.saveImg,
                 },
                 success: (res) => {
                     if (res) {
@@ -1683,6 +1716,7 @@ export default {
                             that.indexParam = {}
                             that.imageSrc = ''
                             that.clearData()
+                            uni.removeStorageSync(that.deviceID)
                             that.$emit('clearImg', true)
                             that.$emit('getBackAddress')
                         } else {
@@ -2187,7 +2221,6 @@ export default {
                 } else {
                     that.getEditSave()
                 }
-
             }
         },
 
@@ -2362,6 +2395,81 @@ export default {
 
             });
         },
+        //获取任务详情图片
+        getTaskImg() {
+            let that = this
+            let apiUrlImg = `${configService.apiUrlP}:6008`
+            let form = new FormData()
+            // form.append('reportdate', '2025-04-10')
+            // form.append('checkpath', '22106工作面')
+            // form.append('order', '中班')
+            // form.append('checkorder', 1)
+            form.append('reportdate', that.searchTime)
+            form.append('checkpath', that.deviceName)
+            form.append('order', that.classType)
+            form.append('checkorder', Number(that.checkNum))
+            let formDataStr = ''
+            form.forEach((value, key) => {
+                if (formDataStr != '') {
+                    formDataStr += '&'
+                }
+                formDataStr += encodeURIComponent(key) + '=' + encodeURIComponent(value)
+            })
+            uni.request({
+                url: `${apiUrlImg}/gasServerImg`,
+                method: 'post',
+                responseType: 'arraybuffer', // 或者 'blob'
+                data: formDataStr,
+                header: {
+                    'content-type': 'application/x-www-form-urlencoded'
+                },
+                success: (res) => {
+                    if (res.statusCode === 200) {
+                        let imageData = res.data; // 这里是二进制数据
+                        // 接下来你可以使用这个二进制数据来显示图片
+                        // 例如,创建一个Image对象并设置src为imageData的URL
+                        let img = new Image();
+                        let blob = new Blob([imageData]); // 如果是arraybuffer,需要转换为Blob
+                        let url = URL.createObjectURL(blob);
+                        that.imageSrcView = url;
+                        // document.body.appendChild(img); // 或者添加到你的页面中
+                    }
+                },
+                fail: (err) => {
+                    console.error('请求失败:', err);
+                }
+            });
+        },
+        //更新图片
+        getUpdateImg() {
+            let that = this
+            let apiUrlImg = `${configService.apiUrlP}:6008`
+            uni.uploadFile({
+                url: `${apiUrlImg}/gasImgUpdate`,
+                filePath: that.imageSrcView,
+                name: 'img',
+                formData: {
+                    'order': that.classType,
+                    'checkorder': Number(that.checkNum),
+                    'reportdate': that.searchTime,
+                    'checkpath': that.deviceName,
+                },
+                success: (res) => {
+                    if (res.statusCode==200) {
+                        uni.showToast({
+                            title: JSON.parse(res.data).res,
+                            icon: 'none' // 可选图标,'success', 'loading', 'none'
+                        });
+                    }
+                },
+                fail: (error) => {
+                    uni.showToast({
+                        title: '图片更新失败!',
+                        icon: 'none' // 可选图标,'success', 'loading', 'none'
+                    });
+                }
+            });
+        }
     },
 
 };
@@ -2463,6 +2571,7 @@ export default {
     }
 
     .top-gas-list {
+        position: fixed;
         display: flex;
         flex-direction: column;
         align-items: center;
@@ -2471,6 +2580,7 @@ export default {
         box-sizing: border-box;
         background-color: #FFF;
         margin-bottom: 2px;
+        z-index: 999;
     }
 
 
@@ -2487,7 +2597,7 @@ export default {
     .bot-gas-list1 {
         width: 100%;
         height: 100%;
-        padding: 10px;
+        // padding: 10px;
         margin-bottom: 2px;
         box-sizing: border-box;
         background-color: #FFF;
@@ -2524,7 +2634,8 @@ export default {
         margin-bottom: 10px;
 
         .dialog-label {
-            width: 120px;
+            // width: 120px;
+            width: 84px;
             text-align: right;
         }
     }
@@ -2559,6 +2670,7 @@ export default {
     }
 
     .imgView {
+        width: 100%;
         overflow: hidden;
     }
 

+ 3 - 3
pages/gasreport/components/popupModal.vue

@@ -32,8 +32,8 @@ export default {
     data() {
         return {
             indexList: [
-                { id: 1, label: '瓦斯巡检记录卡管理', },
-                // { id: 1, label: '图片识别', },
+                // { id: 1, label: '瓦斯巡检记录卡管理', },
+                { id: 1, label: '图片识别', },
                 {
                     id: 2, label: '巡检任务面板', children: [
                         { label: '早班', },
@@ -41,7 +41,7 @@ export default {
                         { label: '夜班' },
                     ]
                 },
-                { id: 3, label: '瓦斯巡检填报' },
+                // { id: 3, label: '瓦斯巡检填报' },
             ],
         }
     },

+ 0 - 1
pages/gasreport/components/save-component.vue

@@ -25,7 +25,6 @@
 
 <script>
 import api from "@/api/api";
-
 import moment from 'moment'
 export default {
     name: 'save-component',

+ 26 - 14
pages/gasreport/components/taskBoardAddress.vue

@@ -14,7 +14,7 @@
                     <view slot="value" style="display: flex;align-items: center;">
                         <u-icon :name="item.checkState == '0' ? 'plus' : 'checkmark'" size="16"
                             @click="getBoradAddress(item, index)"></u-icon>
-                        <u-icon style="margin-left:10px" name="photo" size="16" @click="getView(item)"></u-icon>
+                        <u-icon v-if="item.zcShow" style="margin-left:10px" name="photo" size="16"></u-icon>
                     </view>
                 </u-cell>
             </u-list-item>
@@ -64,7 +64,8 @@ export default {
     computed: {
         searchTime: function () {
             return uni.getStorageSync('searchTime')
-        }
+        },
+
     },
     mounted() {
         this.taskDetailsLists()
@@ -75,19 +76,19 @@ export default {
             this.$emit('getBackBoard')
         },
         //暂存图片预览
-        getView(item) {
-            let imgList = []
-            imgList.push(uni.getStorageSync(item.deviceId))
-            // 预览图片
-            uni.previewImage({
-                urls: imgList,
-                current: 0
-            });
-        },
+        // getView(item) {
+        //     let imgList = []
+        //     imgList.push(uni.getStorageSync(item.deviceId))
+        //     // 预览图片
+        //     uni.previewImage({
+        //         urls: imgList,
+        //         current: 0
+        //     });
+        // },
         //清除暂存图片
-        clearImg(data){
-            if(data){
-                this.saveImg=''
+        clearImg(data) {
+            if (data) {
+                this.saveImg = ''
             }
         },
 
@@ -108,6 +109,7 @@ export default {
             } else {
                 that.isShow = false
                 that.checkState = item.checkState
+                that.deviceName = item.deviceName
                 that.checkNum = item.checkNum
                 that.deviceID = item.deviceId
                 that.classType = item.classType_dictText
@@ -132,6 +134,16 @@ export default {
                         if (response.data.code == 200) {
                             console.log(response, '地点列表---')
                             that.indexList = response.data.result.records || []
+                            if (that.indexList.length != 0) {
+                                that.indexList.forEach(el => {
+                                    if (uni.getStorageSync(el.deviceId)) {
+                                        el.zcShow = true
+                                    } else {
+                                        el.zcShow = false
+                                    }
+                                })
+                            }
+                            console.log(that.indexList, '999000=====')
                             // that.indexList = [
                             //     { deviceName: '测试地址1' },
                             //     { deviceName: '测试地址2' },

+ 2 - 2
pages/gasreport/gasreport.vue

@@ -37,9 +37,9 @@ export default {
             backPic: "url(../../static/topnavbar.png)",
             gasTitle: '瓦斯日报',//标题
             showModel: false,//是否打开弹出层
-            loadComponent: 'gasFill',//默认加载组件
+            // loadComponent: 'gasFill',//默认加载组件
             // loadComponent: 'gasImgIdentify',//默认加载组件
-            // loadComponent: 'taskBoard',//默认加载组件
+            loadComponent: 'taskBoard',//默认加载组件
             taskTj: {},
             firstAddress: '',//一次线路
             secondAddress: '',//二次线路

+ 1 - 1
pages/ipConfig/ipConfig.vue

@@ -21,7 +21,7 @@ export default {
       IPSet: "",
       IpConfig: [
         [
-          { label: "大海煤矿", value: "http://172.16.53.16:9999" },
+          { label: "大海煤矿", value: "http://172.16.53.16:9999" },
           { label: "大柳塔井", value: "http://10.248.135.10:9999" },
           { label: "活鸡兔井", value: "http://10.248.135.121:9999" },
           { label: "寸草塔二矿", value: "http://10.246.63.5:9999" },

+ 1 - 1
pages/login/login.vue

@@ -106,7 +106,7 @@ export default {
       IPSet: "",
       IpConfig: [
         [
-          { label: "大海煤矿", value: "http://172.16.53.16:9999" },
+          { label: "大海煤矿", value: "http://172.16.53.16:9999" },
           { label: "大柳塔井", value: "http://10.248.135.10:9999" },
           { label: "活鸡兔井", value: "http://10.248.135.121:9999" },
           { label: "寸草塔二矿", value: "http://10.246.63.5:9999" },