소스 검색

feat: 发布v1.15.21版本,调整配置与设备列表展示逻辑

1.  调整neutral配置默认值为云飞智控,更新应用名称
2.  切换API默认指向生产环境
3.  封装设备数据获取方法优化模板代码
4.  调整滑块取值范围为10-100,新增进度弹窗遮罩不可关闭逻辑
5.  新增阀门控制百分比修改接口请求方法
allen 5 일 전
부모
커밋
ce50a25668
4개의 변경된 파일63개의 추가작업 그리고 31개의 파일을 삭제
  1. 3 3
      manifest.json
  2. 56 24
      pages/equipList2/index.vue
  3. 2 2
      util/api.js
  4. 2 2
      util/neutral.js

+ 3 - 3
manifest.json

@@ -1,9 +1,9 @@
 {
-    "name" : "智控",
+    "name" : "云飞智控",
     "appid" : "__UNI__DBA6730",
     "description" : "",
-    "versionName" : "1.15.20",
-    "versionCode" : 11520,
+    "versionName" : "1.15.21",
+    "versionCode" : 11521,
     "transformPx" : false,
     "sassImplementationName" : "node-sass",
     /* 5+App特有相关 */

+ 56 - 24
pages/equipList2/index.vue

@@ -101,21 +101,21 @@
 								<view class="action-item">
 									<image :src="lightning" alt="" class="item-icon">
 									</image>
-            			<text>{{item.sensor_params.charging_vol || 0}}v</text>
+            			<text>{{getcharging_vol(item.sensor_params)}}</text>
 								</view>
 								<view class="action-item">
-									<image :src="getSignal(item.sensor_params.rssl)" alt="" class="item-icon">
+									<image :src="getSignal(item.sensor_params)" alt="" class="item-icon">
 									</image>
-            			<text>{{item.sensor_params.rssl}}</text>
+            			<text>{{getrssl(item.sensor_params)}}</text>
 								</view>
 								<view class="action-item">
 									<image :src="battery" alt="" class="item-icon">
 									</image>
-            			<text>{{item.sensor_params.kwh}}%</text>
+            			<text>{{getopeningValue(item.sensor_params)}}%</text>
 								</view>
 							</view>
 							<view class="action-container" v-if="type_id == 49">
-								<view class="action-container-item" :class="n.switchValue?'action-container-container-item-active':''" v-for="(n,key) in item.valve_params" :key="key">
+								<view class="action-container-item" :class="n.switchValue?'action-container-container-item-active':''" v-for="(n,key) in getvalve_params(item)" :key="key">
 									<view class="action-open">
 										<view class="item-number" :class="{'item-number-active':n.switchValue}">{{n.name}}</view>
 										<u-switch 
@@ -147,9 +147,8 @@
 		<u-popup v-model="showPopup" mode="bottom">
 			<u-form :model="form" label-width="160rpx" :label-style="{marginLeft:'20rpx'}">
 				<u-form-item label="开启状态">
-					<u-radio-group v-model="value" @change="radioGroupChange">
+					<u-radio-group v-model="value">
 						<u-radio 
-							@change="radioChange" 
 							v-for="(item, index) in radioList" :key="index" 
 							:name="item.value"
 							active-color="#0BBC58"
@@ -167,14 +166,14 @@
           <view class="slider-min-value">10</view>
           <view
             class="custom-progress"
-            @touchstart.stop="onSliderTouchStart($event, 'openingValue', 10, 120)"
-            @touchmove.stop.prevent="onSliderTouchMove($event, 10, 120)"
+            @touchstart.stop="onSliderTouchStart($event, 'openingValue', 10, 100)"
+            @touchmove.stop.prevent="onSliderTouchMove($event, 10, 100)"
             @touchend.stop="onSliderTouchEnd"
-            @tap.stop="onSliderTap($event, 'openingValue', 10, 120)"
+            @tap.stop="onSliderTap($event, 'openingValue', 10, 100)"
           >
             <view class="progress-track">
-              <view class="progress-fill" :style="{ width: getProgressWidth(equipContrlForm.openingValue, 10, 120) + '%' }"></view>
-              <view class="progress-thumb" :style="{ left: getProgressWidth(equipContrlForm.openingValue, 10, 120) + '%' }"></view>
+              <view class="progress-fill" :style="{ width: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
+              <view class="progress-thumb" :style="{ left: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
             </view>
           </view>
           <view class="slider-max-value">100</view>
@@ -191,14 +190,14 @@
           <view class="slider-min-value">10</view>
           <view
             class="custom-progress"
-            @touchstart.stop="onSliderTouchStart($event, 'openingValue', 10, 120)"
-            @touchmove.stop.prevent="onSliderTouchMove($event, 10, 120)"
+            @touchstart.stop="onSliderTouchStart($event, 'openingValue', 10, 100)"
+            @touchmove.stop.prevent="onSliderTouchMove($event, 10, 100)"
             @touchend.stop="onSliderTouchEnd"
-            @tap.stop="onSliderTap($event, 'openingValue', 10, 120)"
+            @tap.stop="onSliderTap($event, 'openingValue', 10, 100)"
           >
             <view class="progress-track">
-              <view class="progress-fill" :style="{ width: getProgressWidth(equipContrlForm.openingValue, 10, 120) + '%' }"></view>
-              <view class="progress-thumb" :style="{ left: getProgressWidth(equipContrlForm.openingValue, 10, 120) + '%' }"></view>
+              <view class="progress-fill" :style="{ width: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
+              <view class="progress-thumb" :style="{ left: getProgressWidth(equipContrlForm.openingValue, 10, 100) + '%' }"></view>
             </view>
           </view>
           <view class="slider-max-value">100</view>
@@ -210,11 +209,12 @@
 		</u-popup>
 		<u-modal v-model="show3" :content="content" @confirm="confirmClose" @cancel="cancelClose"></u-modal>
 		<u-select v-model="show1" :list="hours" @confirm="changeHour"></u-select>
-		<u-select v-model="show2" :list="minutes" @confirm="changeMinute"></u-select><u-popup v-model="show4" mode="center" width="80%">
-		<view class="progress-container">
-			<u-line-progress :percent="percentage" style="width: 90%;"></u-line-progress>
-		</view>
-	</u-popup>
+		<u-select v-model="show2" :list="minutes" @confirm="changeMinute"></u-select>
+		<u-popup v-model="show4" mode="center" width="80%" :mask-close-able="false">
+			<view class="progress-container">
+				<u-line-progress :percent="percentage" style="width: 90%;"></u-line-progress>
+			</view>
+		</u-popup>
 	</view>
 </template>
 
@@ -310,6 +310,21 @@ import openingDegree from '../assets/openingDegree.png';
 			};
 		},
 		methods: {
+			getvalve_params(item){
+				return item?.valve_params || [];
+			},
+			getcharging_vol(item){
+				return item?.charging_vol || 0;
+			},
+			getrssl(item){
+				return item?.rssl || 0;
+			},
+			getopeningValue(item){
+				return item?.kwh || 0;
+			},
+			getRadioValue(){
+				return this.value;
+			},
 			setPercentage(msg){
 				this.timer = setInterval(() => {
 					this.percentage += 1;
@@ -326,7 +341,8 @@ import openingDegree from '../assets/openingDegree.png';
 					}
 				}, 125);
 			},
-			getSignal(val){
+			getSignal(item){
+				const val = item?.rssl || 0;
 				if(val < 0){
 					return this.signal0;
 				}
@@ -395,6 +411,22 @@ import openingDegree from '../assets/openingDegree.png';
 					});
 				}
 			},
+			async setEditAction(data){
+				const res = await this.$myRequest({
+					url: '/api/api_gateway?method=irrigation_system.valvecontrol.alter_valvecontrol_valve_percentage',
+					method: 'POST',
+					data,
+				});
+				if(res.code == 0){
+					this.show4 = true;
+					this.setPercentage(res.message);
+				}else{
+					uni.showToast({
+						title: res?.message,
+						icon: 'none',
+					});
+				}
+			},
 			onSliderTouchStart(e, field, min, max) {
 				this.sliderField = field
 				this.sliderMin = min
@@ -436,7 +468,7 @@ import openingDegree from '../assets/openingDegree.png';
 				this.showPopup = false;
 			},
 			submit2(){
-				this.setAction({
+				this.setEditAction({
 					device_id: this.current_device_id,
 					valve_param_key: this.valve_param_key,
 					var_value: this.equipContrlForm.openingValue,

+ 2 - 2
util/api.js

@@ -9,10 +9,10 @@ export const myRequest = (options) => {
     //      ? 'https://uat.hnyfwlw.com'
     //      : 'https://web.hnyfwlw.com';
     // BASE_URL = 'http://192.168.1.107:8000'
-    BASE_URL = 'http://218.28.198.186:10508';
+    // BASE_URL = 'http://218.28.198.186:10508';
     // BASE_URL = 'http://8.136.98.49:8002';
   }
-  // BASE_URL = config.productAPI;
+  BASE_URL = config.productAPI;
   // BASE_URL = config.developAPI;
   var session_key = '';
   session_key = uni.getStorageSync('session_key');

+ 2 - 2
util/neutral.js

@@ -1,6 +1,6 @@
 export default {
-  // isneutral:true,//云飞智控
-  isneutral: false, //智控
+  isneutral:true,//云飞智控
+  // isneutral: false, //智控
   developAPI:'https://uat.hnyfwlw.com',//测试环境访问地址
   // productAPI:'http://8.136.98.49:8002',//生产环境
   productAPI:'https://web.hnyfwlw.com',//生产环境