Quellcode durchsuchen

瓦斯日报修改提交

lxh vor 3 Monaten
Ursprung
Commit
0010348bd7
5 geänderte Dateien mit 215 neuen und 113 gelöschten Zeilen
  1. 6 0
      api/api.js
  2. 5 0
      manifest.json
  3. 102 29
      pages/gasreport/gasreport.vue
  4. 29 40
      pages/index/index.vue
  5. 73 44
      pages/login/login.vue

+ 6 - 0
api/api.js

@@ -9,6 +9,12 @@ const apiService = {
     return http.post("/sys/mLogin", params);
   },
   /**
+   * 获取权限菜单
+   */
+  getPermission(params) {
+    return http.get("/sys/permissionNew/getUserPermissionByToken", params);
+  },
+  /**
    * 单点登录
    */
   validateCasLogin(params) {

+ 5 - 0
manifest.json

@@ -6,6 +6,11 @@
     "versionCode" : 1,
     "transformPx" : false,
     "app-plus" : {
+        "compatible" : {
+            "ignoreVersion" : false,
+            "runtimeVersion" : "4.23,4.29",
+            "compilerVersion" : "4.29"
+        },
         "orientation" : [
             //竖屏正方向
             "portrait-primary",

+ 102 - 29
pages/gasreport/gasreport.vue

@@ -13,7 +13,7 @@
                             @confirm="confirmTb" @cancel="showCalendarTb = false" @change="changeTb"
                             @close="showCalendarTb = false"></u-datetime-picker>
                     </view>
-                    <u-button type="primary" size="small" style="margin: 2px 0px;" @click="getAdd">新增</u-button>
+                    <u-button v-if="hasPermission('gasReport:add')" type="primary" size="small" style="margin: 2px 0px;"  @click="getAdd">新增</u-button>
                 </view>
                 <view class="bot-gas-list">
                     <view class="top-title">
@@ -109,35 +109,38 @@
                 </view>
                 <view>
                     <view class="center-dialog-area">
-                        <div class="dialog-title">气体测数据</div>
+                        <div class="dialog-title">气体测数据</div>
 
                         <view class="dialog-item">
-                            <text class="dialog-label">CH₄:</text>
+                            <text class="dialog-label">CH₄(%):</text>
                             <u--input inputAlign="center" :disabled="isDisabled" v-model="formState.ch4"
                                 :placeholder="isRule2 ? '请输入' : '数据有误'" type="number" @blur="getBlurCH4"
+                                @input="changeInput($event, 'ch4')" clearable
                                 :placeholderStyle="isRule2 ? 'color:#c0c4cc' : 'color:#ff0000'"></u--input>
                         </view>
                         <view class="dialog-item">
-                            <text class="dialog-label">CO₂:</text>
+                            <text class="dialog-label">CO₂(%):</text>
                             <u--input inputAlign="center" :disabled="isDisabled" v-model="formState.co2"
                                 :placeholder="isRule ? '请输入' : '数据有误'" type="number" @blur="getBlurCO2"
+                                @input="changeInput($event, 'co2')" clearable
                                 :placeholderStyle="isRule ? 'color:#c0c4cc' : 'color:#ff0000'"></u--input>
                         </view>
                         <view class="dialog-item">
-                            <text class="dialog-label">CO:</text>
+                            <text class="dialog-label">CO(ppm):</text>
                             <u--input inputAlign="center" :disabled="isDisabled" v-model="formState.co"
-                                :placeholder="isRule14 ? '请输入' : '数据有误'"
+                                :placeholder="isRule14 ? '请输入' : '数据有误'" clearable
                                 :placeholderStyle="isRule14 ? 'color:#c0c4cc' : 'color:#ff0000'" type="number"
-                                @blur="getBlurCO"></u--input>
+                                @blur="getBlurCO" @input="changeInput($event, 'co')"></u--input>
                         </view>
                         <view class="dialog-item">
-                            <text class="dialog-label">O₂:</text>
-                            <u--input inputAlign="center" :disabled="isDisabled" type="number" v-model="formState.o2"
-                                placeholder="请输入"></u--input>
+                            <text class="dialog-label">O₂(%):</text>
+                            <u--input inputAlign="center" :disabled="isDisabled" clearable type="number"
+                                v-model="formState.o2" placeholder="请输入" @input="changeInput($event, 'o2')"></u--input>
                         </view>
                         <view class="dialog-item">
-                            <text class="dialog-label">温度:</text>
-                            <u--input inputAlign="center" :disabled="isDisabled" type="number" v-model="formState.temp"
+                            <text class="dialog-label">T(℃):</text>
+                            <u--input inputAlign="center" :disabled="isDisabled" clearable type="number"
+                                @input="changeInput($event, 'temp')" v-model="formState.temp"
                                 placeholder="请输入"></u--input>
                         </view>
                     </view>
@@ -147,19 +150,22 @@
                             <text class="dialog-label">甲烷传感器:</text>
                             <!-- <u--input inputAlign="center" :disabled="isDisabled" type="number" v-model="formState.jw"
                                 placeholder="请输入"></u--input> -->
-                                <u--input inputAlign="center" :disabled="isDisabled" type="number" v-model="formState.ch4"
-                                placeholder="请输入"></u--input>
+                            <u--input inputAlign="center" :disabled="isDisabled" type="number" v-model="formState.ch4"
+                                placeholder="请输入" clearable @input="changeInput($event, 'ch4')"></u--input>
                         </view>
                         <view class="dialog-item">
                             <text class="dialog-label">光瓦测量数据:</text>
                             <u--input inputAlign="center" :disabled="isDisabled" v-model="formState.gw"
-                                :placeholder="isRule1 ? '请输入' : '数据有误'" type="number" @blur="getBlur"
+                                :placeholder="isRule1 ? '请输入' : '数据有误'" type="number" @blur="getBlur" clearable
+                                @input="changeInput($event, 'gw')"
                                 :placeholderStyle="isRule1 ? 'color:#c0c4cc' : 'color:#ff0000'"></u--input>
                         </view>
                         <view class="dialog-item">
                             <text class="dialog-label">便携仪测量数据:</text>
-                            <u--input inputAlign="center" :disabled="isDisabled" type="number" v-model="formState.bxy"
-                                placeholder="请输入"></u--input>
+                            <u--input inputAlign="center" :disabled="isDisabled"
+                                :placeholderStyle="isRule3 ? 'color:#c0c4cc' : 'color:#ff0000'"
+                                :placeholder="isRule3 ? '请输入' : '数据有误'" type="number" v-model="formState.bxy" clearable
+                                @blur="getBlurBxy" @input="changeInput($event, 'bxy')"></u--input>
                         </view>
 
                     </view>
@@ -203,6 +209,7 @@ export default {
             isRule1: true,
             isRule14: true,
             isRule2: true,
+            isRule3: true,
             //新增参数信息
             isShowAdd: false,//是否显示新增弹窗
 
@@ -235,7 +242,7 @@ export default {
     computed: {
         username: function () {
             return uni.getStorageSync('login_user_info')['realname']
-        }
+        },
     },
     mounted() {
         console.log(uni.getStorageSync('login_user_info'), 'ceshi00-----------')
@@ -243,6 +250,10 @@ export default {
         this.getMcList()
     },
     methods: {
+        hasPermission(param){
+            let permission= uni.getStorageSync('btnPermission')
+            return permission.filter(v=>v.action==param).length!=0 ? true : false
+        },
         //班次下拉选项切换
         changeBc(e) {
             let that = this
@@ -1376,12 +1387,44 @@ export default {
             this.showCalendarTb = false
             this.getGasList()
         },
-
+        //输入框内容变换
+        changeInput(val, data) {
+            if (/^00/.test(val)) {
+                this.formState[data] = val.replace(/^00/, '0');
+            } else {
+                this.formState[data] = val
+            }
+        },
+        //便携仪失去焦点时参数校验
+        getBlurBxy(val) {
+            let str = val.substring(val.indexOf('.') + 1).split('')
+            if (/^(\-|\+)?\d+$/.test(val)) {
+                this.formState.bxy = val
+                this.isRule3 = true
+            } else if (/^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/.test(val) && str.length <= 2) {
+                this.formState.bxy = val
+                this.isRule3 = true
+            } else {
+                this.formState.bxy = ''
+                this.isRule3 = false
+            }
+        },
         //新增光瓦失去焦点时参数校验
         getBlur(val) {
-            if (val.slice(-1) === '0' || val.slice(-1) === '2' || val.slice(-1) === '4' || val.slice(-1) === '6' || val.slice(-1) === '8') {
-                this.formState.gw = val
-                this.isRule1 = true
+            let str = val.substring(val.indexOf('.') + 1).split('')
+            if (val.slice(-1) == '0' || val.slice(-1) == '2' || val.slice(-1) == '4' || val.slice(-1) == '6' || val.slice(-1) == '8') {
+                if (/^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/.test(val)) {
+                    if (str.length <= 2) {
+                        this.formState.gw = val
+                        this.isRule1 = true
+                    } else {
+                        this.formState.gw = ''
+                        this.isRule1 = false
+                    }
+                } else {
+                    this.formState.gw = val
+                    this.isRule1 = true
+                }
             } else {
                 this.formState.gw = ''
                 this.isRule1 = false
@@ -1389,26 +1432,55 @@ export default {
         },
         //新增CO2失去焦点时参数校验
         getBlurCO2(val) {
+            console.log(val, '000')
+            let str = val.substring(val.indexOf('.') + 1).split('')
             if (val.slice(-1) == '0' || val.slice(-1) == '2' || val.slice(-1) == '4' || val.slice(-1) == '6' || val.slice(-1) == '8') {
-                this.formState.co2 = val
-                this.isRule = true
+                if (/^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/.test(val)) {
+                    if (str.length <= 2) {
+                        this.formState.co2 = val
+                        this.isRule = true
+                    } else {
+                        console.log(111)
+                        this.formState.co2 = ''
+                        this.isRule = false
+                    }
+                } else {
+                    this.formState.co2 = val
+                    this.isRule = true
+                }
             } else {
+                console.log(222)
                 this.formState.co2 = ''
                 this.isRule = false
             }
         },
         //新增CH4失去焦点时参数校验
         getBlurCH4(val) {
+            let str = val.substring(val.indexOf('.') + 1).split('')
             if (val.slice(-1) == '0' || val.slice(-1) == '2' || val.slice(-1) == '4' || val.slice(-1) == '6' || val.slice(-1) == '8') {
-                this.formState.ch4 = val
-                this.isRule2 = true
+                if (/^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/.test(val)) {
+                    if (str.length <= 2) {
+                        this.formState.ch4 = val
+                        this.isRule2 = true
+                    } else {
+                        this.formState.ch4 = ''
+                        this.isRule2 = false
+                    }
+                } else {
+                    this.formState.ch4 = val
+                    this.isRule2 = true
+                }
             } else {
                 this.formState.ch4 = ''
                 this.isRule2 = false
             }
         },
         getBlurCO(val) {
-            if (parseFloat(val) <= 24) {
+            let str = val.substring(val.indexOf('.') + 1).split('')
+            if (/^(\-|\+)?\d+$/.test(val) && parseFloat(val) <= 24) {
+                this.formState.co = val
+                this.isRule14 = true
+            } else if (/^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$/.test(val) && str.length <= 2 && parseFloat(val) <= 24) {
                 this.formState.co = val
                 this.isRule14 = true
             } else {
@@ -1437,7 +1509,7 @@ export default {
                     co2Early1: that.formState.co2,
                     coEarly1: that.formState.co,
                     gwSdzEarly1: that.formState.gw,
-                    jwSdzEarly1:that.formState.ch4,
+                    jwSdzEarly1: that.formState.ch4,
                     o2Early1: that.formState.o2,
                     strInstallPos: that.formState.jcdd,
                     timeEarly1: that.formState.time,
@@ -1814,7 +1886,7 @@ export default {
                     co2Noon2: that.formState.co2,
                     coNoon2: that.formState.co,
                     gwSdzNoon2: that.formState.gw,
-                    jwSdzNoon2:that.formState.ch4,
+                    jwSdzNoon2: that.formState.ch4,
                     o2Noon2: that.formState.o2,
                     strInstallPos: that.formState.jcdd,
                     timeNoon2: that.formState.time,
@@ -2044,6 +2116,7 @@ export default {
             this.isRule = true
             this.isRule2 = true
             this.isRule1 = true
+            this.isRule3 = true
             this.isRule14 = true
         },
 

+ 29 - 40
pages/index/index.vue

@@ -1,45 +1,28 @@
 <template>
   <view class="app-container">
-    <view
-      v-if="iframeloading"
-      class="loadding-box"
-      :style="{
-        height: wvHeight + 'px',
-        width: wvWidth + 'px',
-        marginTop: wvTop + 'px',
-        border: 'none'
-      }"
-    >
+    <view v-if="iframeloading" class="loadding-box" :style="{
+      height: wvHeight + 'px',
+      width: wvWidth + 'px',
+      marginTop: wvTop + 'px',
+      border: 'none'
+    }">
       <u-loading-icon></u-loading-icon>
     </view>
-    <iframe
-      v-if="PageCur == 'tun2D'"
-      ref="iframe"
-      src="http://182.92.126.35:8098/"
-      @load="viewLoad"
-      :style="{
-        height: wvHeight + 'px',
-        width: wvWidth + 'px',
-        marginTop: wvTop + 'px',
-        border: 'none',
-        background: '#000',
-      }"
-    ></iframe>
-    <Device
-      v-if="PageCur == 'device'"
-      :style="{ marginTop: wvTop + 20 + 'px' }"
-    ></Device>
+    <iframe v-if="PageCur == 'tun2D'" ref="iframe" src="http://182.92.126.35:8098/" @load="viewLoad" :style="{
+      height: wvHeight + 'px',
+      width: wvWidth + 'px',
+      marginTop: wvTop + 'px',
+      border: 'none',
+      background: '#000',
+    }"></iframe>
+    <Device v-if="PageCur == 'device'" :style="{ marginTop: wvTop + 20 + 'px' }"></Device>
     <filecenter :cur="PageCur" v-if="PageCur == 'filecenter'"></filecenter>
     <warndata v-if="PageCur == 'warndata'" :cur="PageCur"></warndata>
     <gasreport :cur="PageCur" v-if="PageCur == 'gasreport'"></gasreport>
-    <u-tabbar
-      :value="PageCur"
-      @change="NavChange"
-      :fixed="true"
-      :placeholder="true"
-      :safeAreaInsetBottom="true"
-    >
-      <u-tabbar-item
+    <u-tabbar :value="PageCur" @change="NavChange" :fixed="true" :placeholder="true" :safeAreaInsetBottom="true">
+      <u-tabbar-item v-for="(item, index) in permission " :key="index" :text="item.name" :name="item.component"
+        :icon="index = 0 ? 'list-dot' : index == 1 ? 'calendar' : index == 2 ? 'plus-circle' : index == 3 ? 'file-text' : index == 4 ? 'bell' : 'list-dot'"></u-tabbar-item>
+      <!-- <u-tabbar-item
         text="通风系统图"
         name="tun2D"
         icon="list-dot"
@@ -63,7 +46,7 @@
         text="瓦斯日报"
         name="gasreport"
         icon="bell"
-      ></u-tabbar-item>
+      ></u-tabbar-item> -->
     </u-tabbar>
   </view>
 </template>
@@ -86,10 +69,15 @@ export default {
       iframeloading: true,
     };
   },
+  computed: {
+    permission: function () {
+      return uni.getStorageSync('menuPermission')
+    }
+  },
   onLoad() {
     this.changeWV();
   },
-  mounted() {},
+  mounted() { },
   onShow() {
     // this.changeWV()
   },
@@ -127,9 +115,9 @@ export default {
           _this.wvHeight = _this.isLandScape
             ? sysinfo.windowHeight - sysinfo.statusBarHeight - 20
             : sysinfo.windowHeight -
-              sysinfo.statusBarHeight -
-              sysinfo.statusBarHeight -
-              38;
+            sysinfo.statusBarHeight -
+            sysinfo.statusBarHeight -
+            38;
           _this.wvWidth = _this.isLandScape
             ? sysinfo.windowWidth
             : sysinfo.windowWidth;
@@ -148,6 +136,7 @@ export default {
   width: 100%;
   height: 100%;
 }
+
 .loadding-box {
   position: absolute;
   display: flex;

+ 73 - 44
pages/login/login.vue

@@ -1,56 +1,57 @@
   <template>
-	<view class="zai-box">
-        <scroll-view scroll-y class="page">
-            <view class="text-center" :style="[{animation: 'show ' + 0.4+ 's 1'}]">
-				<image src="/static/desk-img/144.png" mode='aspectFit' class="zai-logo "></image>
-				<view class="zai-title text-shadow ">登 录</view>
-			</view>
-			<view class="text-center" :style="[{animation: 'show ' + 0.4+ 's 1'}]">
-				<!--<u-link  class="zai-title2 text-shadow " href="http://localhost:8080?ticket=234" >切换单点登录</u-link>
+    <view class="zai-box">
+      <scroll-view scroll-y class="page">
+        <view class="text-center" :style="[{ animation: 'show ' + 0.4 + 's 1' }]">
+          <image src="/static/desk-img/144.png" mode='aspectFit' class="zai-logo "></image>
+          <view class="zai-title text-shadow ">登 录</view>
+        </view>
+        <view class="text-center" :style="[{ animation: 'show ' + 0.4 + 's 1' }]">
+          <!--<u-link  class="zai-title2 text-shadow " href="http://localhost:8080?ticket=234" >切换单点登录</u-link>
 				<view class="zai-title2 text-shadow " @click="changeloginType">切换单点登录</view>-->
-			</view>
-            <view class="box padding-lr-xl login-paddingtop" :style="[{animation: 'show ' + 0.6+ 's 1'}]">
-				<block>
-					<view class="cu-form-group margin-top  shadow-warp" :class="[shape=='round'?'round':'']">
-						<view class="title"><text class="cuIcon-people margin-right-xs"></text>账号:</view>
-						<input placeholder="请输入账号" name="input" v-model="userName"></input>
-					</view>
-					<view class="cu-form-group margin-top shadow-warp" :class="[shape=='round'?'round':'']">
-						<view class="title"><text class="cuIcon-lock margin-right-xs"></text>密码:</view>
-						<input class="uni-input" placeholder="请输入密码" :password="!showPassword" v-model="password" />
-						<view class="action text-lg">
-						    <text :class="[showPassword ? 'cuIcon-attention' : 'cuIcon-attentionforbid']" @click="changePassword"></text>
-						</view>
-					</view>
-					<view class="padding text-center margin-top">
-						<button class="cu-btn bg-blue lg margin-right shadow" :loading="loading" :class="[shape=='round'?'round':'']"
-							@tap="onLogin"><text space="emsp">{{loading ? "登录中...":" 登录 "}}</text>
-						</button>
-					</view>
-				</block>
-				<!-- #ifdef APP-PLUS -->
-				<view class="padding flex flex-direction  text-center">
-					当前版本:{{version}}
-				</view>
-				<!-- #endif -->
-				
+        </view>
+        <view class="box padding-lr-xl login-paddingtop" :style="[{ animation: 'show ' + 0.6 + 's 1' }]">
+          <block>
+            <view class="cu-form-group margin-top  shadow-warp" :class="[shape == 'round' ? 'round' : '']">
+              <view class="title"><text class="cuIcon-people margin-right-xs"></text>账号:</view>
+              <input placeholder="请输入账号" name="input" v-model="userName"></input>
             </view>
-        </scroll-view>
-		<!-- 登录加载弹窗 -->
-		<view class="cu-load load-modal" v-if="loading">
-			<!-- <view class="cuIcon-emojifill text-orange"></view> -->
-			<image src="/static/desk-img/144.png" mode="aspectFit" class="round"></image>
-			<view class="gray-text">登录中...</view>
-		</view>
+            <view class="cu-form-group margin-top shadow-warp" :class="[shape == 'round' ? 'round' : '']">
+              <view class="title"><text class="cuIcon-lock margin-right-xs"></text>密码:</view>
+              <input class="uni-input" placeholder="请输入密码" :password="!showPassword" v-model="password" />
+              <view class="action text-lg">
+                <text :class="[showPassword ? 'cuIcon-attention' : 'cuIcon-attentionforbid']"
+                  @click="changePassword"></text>
+              </view>
+            </view>
+            <view class="padding text-center margin-top">
+              <button class="cu-btn bg-blue lg margin-right shadow" :loading="loading"
+                :class="[shape == 'round' ? 'round' : '']" @tap="onLogin"><text space="emsp">{{ loading ? "登录中..." : "登录"}}</text>
+              </button>
+            </view>
+          </block>
+          <!-- #ifdef APP-PLUS -->
+          <view class="padding flex flex-direction  text-center">
+            当前版本:{{ version }}
+          </view>
+          <!-- #endif -->
+
+        </view>
+      </scroll-view>
+      <!-- 登录加载弹窗 -->
+      <view class="cu-load load-modal" v-if="loading">
+        <!-- <view class="cuIcon-emojifill text-orange"></view> -->
+        <image src="/static/desk-img/144.png" mode="aspectFit" class="round"></image>
+        <view class="gray-text">登录中...</view>
+      </view>
     </view>
 
-</template>
+  </template>
 
 <script>
 import { ACCESS_TOKEN, USER_NAME, USER_INFO } from "@/common/util/constants";
 import { mapActions } from "vuex";
 import configService from "@/common/service/config.service.js";
-
+import api from "@/api/api";
 export default {
   data() {
     return {
@@ -124,9 +125,12 @@ export default {
             // #endif
             // #ifndef APP-PLUS
             this.$tip.success("登录成功!");
+
             uni.navigateTo({
               url: "/pages/index/index",
             });
+            //获取权限菜单
+            this.getPermissionList()
             // #endif
           } else {
             this.$tip.alert(res.data.message);
@@ -141,6 +145,28 @@ export default {
           this.loading = false;
         });
     },
+    //获取权限菜单
+    getPermissionList() {
+      new Promise((resolve, reject) => {
+        api
+          .getPermission({})
+          .then((response) => {
+            console.log(response, '权限菜单----------------')
+            if (response.statusCode == 200) {
+              let data=response.data.result.menuApp
+              let dataBtn=response.data.result.appauth
+              uni.setStorageSync('menuPermission',data);
+              uni.setStorageSync('btnPermission',dataBtn);
+            } else {
+              reject(response);
+            }
+          })
+          .catch((error) => {
+            console.log("catch===>response", response);
+            reject(error);
+          });
+      });
+    },
     saveClientId() {
       var info = plus.push.getClientInfo();
       var cid = info.clientid;
@@ -293,16 +319,19 @@ export default {
 .zai-input {
   color: #94afce;
 }
-======= .zai-title2 {
+
+=======.zai-title2 {
   margin-top: 20upx;
   font-size: 28upx;
   color: #000000;
   text-align: center;
 }
+
 .input-placeholder,
 .zai-input {
   color: #94afce;
 }
+
 >>>>>>>f9a901e3f950200c21f1645c7cafe558c314d958 .zai-label {
   padding: 60upx 0;
   text-align: center;