|
|
@@ -101,6 +101,42 @@
|
|
|
<text class="label">设备位置</text>
|
|
|
<text class="nav-label">{{ (item.address|| '无') }}</text>
|
|
|
</view>
|
|
|
+ <view class="action-list" style="display:flex;align-items: center;" v-if="type_id == 53">
|
|
|
+ <view class="action-item" v-if="item.fa_v != null">
|
|
|
+ <image :src="lightning" alt="" class="item-icon">
|
|
|
+ </image>
|
|
|
+ <text>{{item.fa_v}}v</text>
|
|
|
+ </view>
|
|
|
+ <view class="action-item" v-if="item.fa_a != null">
|
|
|
+ <text>{{item.fa_a}}A</text>
|
|
|
+ </view>
|
|
|
+ <view class="action-item" v-if="item.fa_v_signal != null">
|
|
|
+ <image :src="getSignal2(item.fa_v_signal)" alt="" class="item-icon">
|
|
|
+ </image>
|
|
|
+ <text>{{item.fa_v_signal}}</text>
|
|
|
+ </view>
|
|
|
+ <u-icon
|
|
|
+ name="reload"
|
|
|
+ color="#0bbc58"
|
|
|
+ size="28"
|
|
|
+ style="margin-left: auto;"
|
|
|
+ @click.native="()=>refreshFaData(item)"
|
|
|
+ ></u-icon>
|
|
|
+ </view>
|
|
|
+ <view class="action-container" style="display:flex;align-items: center;" v-if="type_id == 53 && item.fa && item.fa.length">
|
|
|
+ <view class="action-container-item" :class="n.value != '0' ? 'action-container-container-item-active':''" v-for="(n,key) in item.fa" :key="key">
|
|
|
+ <view class="action-open">
|
|
|
+ <view class="item-number fa-item-number" :class="n.value != '0' ? 'item-number-active':''">{{n.name}}</view>
|
|
|
+ <u-switch
|
|
|
+ :value="n.value != '0'"
|
|
|
+ active-color="#0BBC58"
|
|
|
+ inactiveColor="#C3CAD8"
|
|
|
+ @click.native="()=>changeFaSwitchStatus(n)"
|
|
|
+ size="36"
|
|
|
+ ></u-switch>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
<view class="action-list" style="display:flex;align-items: center;" v-if="type_id == 49">
|
|
|
<view class="action-item">
|
|
|
<image :src="lightning" alt="" class="item-icon">
|
|
|
@@ -371,6 +407,16 @@ import { wgs84togcj02, bd09togcj02 } from '../../util/coordtransform_utils.js';
|
|
|
}
|
|
|
return this['signal' + val];
|
|
|
},
|
|
|
+ getSignal2(item){
|
|
|
+ const val = +item || 0;
|
|
|
+ if(val < 0){
|
|
|
+ return this.signal0;
|
|
|
+ }
|
|
|
+ if(val > 5){
|
|
|
+ return this.signal5;
|
|
|
+ }
|
|
|
+ return this['signal' + val];
|
|
|
+ },
|
|
|
confirmClose(){
|
|
|
this.closeValve();
|
|
|
},
|
|
|
@@ -536,6 +582,107 @@ import { wgs84togcj02, bd09togcj02 } from '../../util/coordtransform_utils.js';
|
|
|
this.type_id,
|
|
|
});
|
|
|
},
|
|
|
+ // fa 单路开关控制:device_id 用 point_id 指定 30/60/90 度某一路,status 0=关 1=开
|
|
|
+ async changeFaSwitchStatus(fa){
|
|
|
+ if(fa.operating) return;
|
|
|
+ const oldStatus = fa.value;
|
|
|
+ const status = oldStatus == 1 ? 0 : 1; // 0关 1开
|
|
|
+ this.$set(fa, 'operating', true);
|
|
|
+ // 先切换开关显示,请求失败再回滚
|
|
|
+ this.$set(fa, 'value', String(status));
|
|
|
+ let res;
|
|
|
+ try{
|
|
|
+ res = await this.$myRequest({
|
|
|
+ url: '/api/api_gateway?method=hran.tz.operate_device',
|
|
|
+ method: 'POST',
|
|
|
+ data: {
|
|
|
+ device_id: fa.point_id,
|
|
|
+ status,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }catch(e){
|
|
|
+ // 失败 toast 已在 myRequest 中弹出,这里只回滚开关状态
|
|
|
+ this.$set(fa, 'value', oldStatus);
|
|
|
+ this.$set(fa, 'operating', false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.$set(fa, 'operating', false);
|
|
|
+ // 该接口 data: true=成功 false=失败(errorCode 恒为 0)
|
|
|
+ if(res === true){
|
|
|
+ uni.showToast({
|
|
|
+ title: status == 1 ? '已开启' : '已关闭',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.$set(fa, 'value', oldStatus);
|
|
|
+ uni.showToast({
|
|
|
+ title: res?.message || '操作失败',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 刷新单台设备最新数据(电压/电流/信号/开关状态等),device_id 用设备 id
|
|
|
+ async refreshFaData(item){
|
|
|
+ if(item.refreshing) return;
|
|
|
+ this.$set(item, 'refreshing', true);
|
|
|
+ try{
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/api_gateway?method=hran.tz.get_now_data',
|
|
|
+ method: 'POST',
|
|
|
+ data: {
|
|
|
+ device_id: item.id,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ // 该接口 errorCode 恒为 0,data 有值(true/最新数据)即成功
|
|
|
+ if(res && (res === true || res.data !== false)){
|
|
|
+ uni.showToast({
|
|
|
+ title: '刷新成功',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ // 重新拉取列表,更新电压/电流/信号/开关状态
|
|
|
+ this.page = 1;
|
|
|
+ this.eqlist();
|
|
|
+ }else{
|
|
|
+ uni.showToast({
|
|
|
+ title: '刷新失败',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }catch(e){
|
|
|
+ // 失败 toast 已在 myRequest 中弹出
|
|
|
+ }finally{
|
|
|
+ this.$set(item, 'refreshing', false);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ async changeDfSwitchStatus(item){
|
|
|
+ if(item.operating) return;
|
|
|
+ const oldStatus = item.irr_status;
|
|
|
+ const status = oldStatus == 1 ? 0 : 1; // 0关 1开
|
|
|
+ this.$set(item, 'operating', true);
|
|
|
+ // 先切换开关显示,请求失败再回滚
|
|
|
+ this.$set(item, 'irr_status', status);
|
|
|
+ const res = await this.$myRequest({
|
|
|
+ url: '/api/api_gateway?method=hran.tz.operate_device',
|
|
|
+ method: 'POST',
|
|
|
+ data: {
|
|
|
+ device_id: item.id,
|
|
|
+ status,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ this.$set(item, 'operating', false);
|
|
|
+ if(res.code == 0){
|
|
|
+ uni.showToast({
|
|
|
+ title: status == 1 ? '已开启' : '已关闭',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ this.$set(item, 'irr_status', oldStatus);
|
|
|
+ uni.showToast({
|
|
|
+ title: res?.message || '操作失败',
|
|
|
+ icon: 'none',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
changeSwitchStatus(status,item,device){
|
|
|
this.valve_param_key = item.key;
|
|
|
this.current_device_id = device.id;
|
|
|
@@ -721,6 +868,7 @@ import { wgs84togcj02, bd09togcj02 } from '../../util/coordtransform_utils.js';
|
|
|
switch (type_id) {
|
|
|
// 水肥新设备
|
|
|
case 49:
|
|
|
+ case 53:
|
|
|
return;
|
|
|
case 22:
|
|
|
var obj = {};
|
|
|
@@ -1388,16 +1536,19 @@ import { wgs84togcj02, bd09togcj02 } from '../../util/coordtransform_utils.js';
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
gap: 16rpx;
|
|
|
+ border-radius: 8rpx;
|
|
|
+ border: 2rpx solid #999999;
|
|
|
.action-container-item{
|
|
|
flex:1;
|
|
|
height: 90rpx;
|
|
|
- border-radius: 8rpx;
|
|
|
background: #ffffff;
|
|
|
padding: 8rpx;
|
|
|
- border: 2rpx solid #999999;
|
|
|
- }
|
|
|
- .action-container-container-item-active{
|
|
|
- border: 2rpx solid #0BBC58;
|
|
|
+ display:flex;
|
|
|
+ align-items: center;
|
|
|
+ margin-right: 16rpx;
|
|
|
+ &:last-child{
|
|
|
+ margin-right: 0;
|
|
|
+ }
|
|
|
}
|
|
|
.action-open{
|
|
|
width: 100%;
|
|
|
@@ -1426,6 +1577,13 @@ import { wgs84togcj02, bd09togcj02 } from '../../util/coordtransform_utils.js';
|
|
|
border: 2rpx solid #0BBC58;
|
|
|
color: #0BBC58;
|
|
|
}
|
|
|
+ // 天正开关(53)的 fa 路数名为"30度/60度/90度",用自适应宽度的胶囊样式
|
|
|
+ .fa-item-number{
|
|
|
+ width: auto;
|
|
|
+ min-width: 30rpx;
|
|
|
+ padding: 0 10rpx;
|
|
|
+ border-radius: 30rpx;
|
|
|
+ }
|
|
|
.action-open-value{
|
|
|
margin-top: 8rpx;
|
|
|
display: flex;
|