Browse Source

4g,wifi设置

wenb 1 year ago
parent
commit
f1eea93b18

+ 8 - 1
web/三相/public/i18n/i18n_zh_CN.js

@@ -463,7 +463,14 @@ const i18n_zh_CN = {
   "zc":"正常",
   "stwdcgq":"双头温度传感器",
   "ylcgq":"压力传感器",
-"RS485adress":"RS485地址"
+"RS485adress":"RS485地址",
+  "wifiwl":"WIFI网络",
+  "fourgwl":"4G网络",
+  "fourgwlsz":"4G网络设置",
+  "qy":"启用",
+  "xhqd":"信号强度",
+  "yys":"运营商",
+  "tel":"电话号码"
 
 
 

+ 15 - 1
web/三相/src/layout/components/Navbar.vue

@@ -300,12 +300,26 @@ export default {
         if (result.type === 'switchEquipmentMintenance') {
           that.$bus.$emit('SWITH_STATUS_MONITORING', result)
           return false
-        }  //控制板升级
+        }
+        //控制板升级
         if (result.type === 'controlBoardUpgrade') {
           that.$bus.$emit('CONTROL_BOARD_UPGRADE', result)
           return false
         }
 
+        //wifi设置状态推送
+        if (result.type === 'wifiStatus') {
+          that.$bus.$emit('WIFI_STATUS', result)
+          return false
+        }
+
+        //4G网络设置状态推送
+        if (result.type === 'fourgStatus') {
+          that.$bus.$emit('FOURG_STATUS', result)
+          return false
+        }
+
+
 
       }
 

+ 343 - 0
web/三相/src/views/txgl/fourgsz/index.vue

@@ -0,0 +1,343 @@
+<template>
+  <div class="app-container">
+
+    <el-row>
+      <el-col :span="8" class="card-box">
+        <el-card>
+          <div slot="header"><span style=" font-size: 20px; font-weight: bold;"><i class="el-icon-monitor"></i> {{$t('fourgwlsz')}}</span>
+          </div>
+
+          <div class="el-table el-table--enable-row-hover el-table--medium">
+            <template cellspacing="0" style="width: 100%;">
+
+              <el-form ref="form3"  :model="form3" :rules="rules1" label-width="auto">
+                <el-form-item     :label="this.$t('fourgwl')"  prop="czmode"  >
+                  <el-select style="width: 100%" v-model="form3.czmode"  allow-create     :filterable="false">
+                    <el-option v-for="item in czmodes" :key="item.id" :label="$t(item.name)" :value="item.id">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+
+                  <el-form-item      :label="this.$t('ljzt')"  >
+                    <el-input :readonly="true"   >
+                      <template slot="prefix">
+                        <span v-if="form3.ljzt=='未连接'" style=" color:red ">{{ form3.ljzt }}</span>
+                        <span v-else  style="  color:  green  ">{{ form3.ljzt }}</span>
+                      </template>
+                    </el-input>
+                  </el-form-item>
+                <el-form-item    :label="this.$t('xhqd')+'(dB)'" prop="xhqd">
+                  <el-input :readonly="true" v-model="form3.xhqd"   />
+                </el-form-item>
+                <el-form-item    :label="this.$t('yys')" prop="yys">
+                  <el-input :readonly="true" v-model="form3.yys"   />
+                </el-form-item>
+                <el-form-item    :label="this.$t('tel')" prop="tel">
+                  <el-input :readonly="true" v-model="form3.tel"   />
+                </el-form-item>
+
+              </el-form>
+              <div slot="footer" style="float: right;" class="dialog-footer">
+                <el-button type="primary" @click="submitForm3">{{$t('sz')}}</el-button>
+              </div>
+            </template>
+          </div>
+        </el-card>
+      </el-col>
+    </el-row>
+
+  </div>
+</template>
+
+<script>
+  import {  communicationManagement } from "@/api/pdu/pduServer";
+
+  export default {
+    name: "Server",
+    data() {
+      return {
+        // 服务器信息
+        server: [],
+        // 总体状态监控
+        totalStatus:{},
+        // 通道列表
+        channelList:[],
+        // 弹出层标题
+        title: "",
+        sensorStatusTitle: "", // 传感器标题
+        // 是否显示弹出层
+        open: false,
+        usertoken:"",
+
+        // 表单参数
+        form: {},
+        form2: {},
+        form3: {},
+        sensorStatusForm: {}, // 传感器表单数据
+        czmodes:[{"id":"0","name":"gb"},{"id":"1","name":"qy"}],
+        modes:[{"id":"0","name":"zd"},{"id":"1","name":"sd"}],
+        types:[{"id":"WIFIIPV4Save","name":"IPV4"},{"id":"WIFIIPV6Save","name":"IPV6"}],
+        activeName: '温湿度传感器', // 当前激活的标签页的 name
+        sensorStatusTabs:[],
+        sensorStatusOpen: false, // 配置传感器
+        sensorStatusList:[],
+        showClass: true,
+        showClass2: true,
+        productParams:{},
+        rules1: {
+          czmode: [
+            { required: true, message: this.$i18n.t('fourgwl')+" "+this.$i18n.t('bnwk'), trigger: "blur" }
+          ],
+        },
+        rules2: {
+          mode: [
+            { required: true, message: this.$i18n.t('xzms')+" "+this.$i18n.t('bnwk'), trigger: "blur" }
+          ],
+          type: [
+            { required: true, message: this.$i18n.t('IPbb')+" "+this.$i18n.t('bnwk'), trigger: "blur" }
+          ]
+
+        },
+        rules3: {
+          mode: [
+            { required: true, message: this.$i18n.t('xzms')+" "+this.$i18n.t('bnwk'), trigger: "blur" }
+          ],
+        },
+        passwordVisible: false
+      };
+    },
+    mounted() {
+      //监听websocket消息
+      this.$bus.$on('FOURG_STATUS', this.onSocketMessageTofourgStatus);
+    },
+    created() {
+      this.usertoken= this.$store.state.user.usertoken;
+      this.productParams= this.$store.state.user.productParams;
+      this.queryIp3();
+    },
+    methods: {
+      //4G状态
+      onSocketMessageTofourgStatus(recvMessage) {
+        if (recvMessage.success && recvMessage.data!=null && recvMessage.data.data!='' && recvMessage.data.data!=null) {
+          if(recvMessage.data!=null){
+            this.form3.ljzt=recvMessage.data.ljzt;
+            this.form3.xhqd=recvMessage.data.xhqd;
+            this.form3.yys=recvMessage.data.yys;
+            this.form3.tel=recvMessage.data.tel;
+          }
+          //  this.queryTotalStatus();
+        }
+      },
+      togglePasswordVisibility() {
+        this.passwordVisible = !this.passwordVisible;
+      },
+      handleClick(tab, event) {
+        console.log(tab, event);
+      },
+      handleSelectChange(type){
+        if(type == '1') {  // 自动获取
+          this.showClass = false;
+        }else{
+          this.showClass = true;
+          // this.form={}
+          this.form.mode=type
+          //   const params={};
+          //   params.token=this.usertoken;
+          //   params.type="WifiIPV4automatic";
+          //   communicationManagement(params).then(response => {
+          //     this.form=response.data;
+          // });
+        }
+        // if(type=='0'){
+        //   const params={};
+        //   params.token=this.usertoken;
+        //   params.type="automatic";
+        //   communicationManagement(params).then(response => {
+        //     this.form=response.data;
+        // });
+        // }else{
+        //   this.form={}
+        //   this.form.mode=type
+        // }
+      },
+      handleSelectChange2(type){
+        if(type == '1') {  // 自动获取
+          this.showClass2 = false;
+        }else{
+          this.showClass2 = true;
+          this.form2={}
+          this.form2.mode=type
+          //   const params={};
+          //   params.token=this.usertoken;
+          //   params.type="WifiIPV6automatic";
+          //   communicationManagement(params).then(response => {
+          //     this.form=response.data;
+          // });
+        }
+        // if(type=='0'){
+        //   const params={};
+        //   params.token=this.usertoken;
+        //   params.type="automatic";
+        //   communicationManagement(params).then(response => {
+        //     this.form=response.data;
+        // });
+        // }else{
+        //   this.form={}
+        //   this.form.mode=type
+        // }
+      },
+      //IPV4查询
+      queryIp(){
+        if(this.productParams.ip4sz=='1'){
+          const params={};
+          params.token=this.usertoken;
+          params.type="listWIFIIPV4Query";
+          communicationManagement(params).then(response => {
+            if(response.data!=null){
+            if( response.data.mode=='1'){
+              this.showClass = false;
+            }
+            this.form=response.data;
+          }
+
+        });
+        }
+
+      },
+      //IPV6查询
+      queryIp2(){
+        if(this.productParams.ip6sz=='1'){
+          const params={};
+          params.token=this.usertoken;
+          params.type="listWIFIIPV6Query";
+          communicationManagement(params).then(response => {
+            if(response.data!=null){
+            if( response.data.mode=='1'){
+              this.showClass2 = false;
+            }
+            this.form2=response.data;
+          }
+
+
+        });
+        }
+
+      },
+
+      queryIp3(){
+        const params={};
+        params.token=this.usertoken;
+        params.type="listfourgPZQuery";
+        communicationManagement(params).then(response => {
+          if(response.data!=null){
+          this.form3=response.data;
+        }
+
+      });
+      },
+      /** 提交按钮 */
+      submitForm: function() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            const params={};
+            params.token=this.usertoken;
+            params.type="WIFIIPV4Save";
+            params.mode=this.form.mode;
+            params.ipaddress=this.form.ipaddress;
+            params.mask=this.form.mask;
+            params.gateway=this.form.gateway;
+            params.dns1=this.form.dns1;
+            params.dns2=this.form.dns2;
+            params.mac=this.form.mac;
+            this.$modal.confirm(this.$t('qdybcm')).then(function() {
+              communicationManagement(params);
+            }).then(() => {
+              this.$modal.msgSuccess(this.$t('zxcg'));
+          }).catch(() => {});
+
+
+          }
+        });
+
+
+      },
+      submitForm2: function() {
+        this.$refs["form2"].validate(valid => {
+          if (valid) {
+            const params={};
+            params.token=this.usertoken;
+            params.type="WIFIIPV6Save";
+            params.mode=this.form2.mode;
+            params.ipaddress=this.form2.ipaddress;
+            params.mask=this.form2.mask;
+            params.gateway=this.form2.gateway;
+            params.dns1=this.form2.dns1;
+            params.dns2=this.form2.dns2;
+            // params.mac=this.form2.mac;
+            this.$modal.confirm(this.$t('qdybcm')).then(function() {
+              communicationManagement(params);
+            }).then(() => {
+              this.$modal.msgSuccess(this.$t('zxcg'));
+          }).catch(() => {});
+
+
+          }
+        });
+
+
+      },
+      submitForm3: function() {
+        this.$refs["form3"].validate(valid => {
+          if (valid) {
+            const params={};
+            params.token=this.usertoken;
+            params.type="fourgPZSave";
+            params.czmode=this.form3.czmode;
+            // params.mac=this.form2.mac;
+            this.$modal.confirm(this.$t('qdybcm')).then(function() {
+              communicationManagement(params);
+            }).then(() => {
+              this.$modal.msgSuccess(this.$t('zxcg'));
+          }).catch(() => {});
+
+
+          }
+        });
+
+
+      },
+      // 打开加载层
+      openLoading() {
+        this.$modal.loading(this.$t('zzjzqsh'));
+      }
+    }
+  };
+</script>
+
+
+<style scoped>
+  .row-item {
+    display: -webkit-box;
+    line-height: 40px;
+  }
+  .row-item-title {
+    font-weight: bold;
+
+    padding-right: 10px;
+    /*border-left: 1px solid #e4e7ed;*/
+    /*border-top: 1px solid #e4e7ed;*/
+  }
+  .row-item-content {
+    /*border-left: 1px solid #e4e7ed;*/
+    /*border-right: 1px solid #e4e7ed;*/
+    /*border-top: 1px solid #e4e7ed;*/
+    width: 50%;
+    /* padding-left: 10px;*/
+    white-space: nowrap;
+    word-wrap: normal;
+    word-break: keep-all;
+    text-overflow: ellipsis;
+    overflow: hidden;
+  }
+
+</style>

+ 56 - 5
web/三相/src/views/txgl/wifisz/index.vue

@@ -9,19 +9,46 @@
 
           <div class="el-table el-table--enable-row-hover el-table--medium">
             <template cellspacing="0" style="width: 100%;">
-              <el-form ref="form3" :model="form3" :rules="rules1" label-width="auto">
+
+              <el-form ref="form3"  :model="form3" :rules="rules1" label-width="auto">
+                <el-form-item     :label="this.$t('wifiwl')"  prop="czmode"  >
+                  <el-select style="width: 100%" v-model="form3.czmode"  allow-create     :filterable="false">
+                    <el-option v-for="item in czmodes" :key="item.id" :label="$t(item.name)" :value="item.id">
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+
+                <el-form-item      :label="this.$t('ljzt')"  >
+                  <el-input :readonly="true"   >
+                    <template slot="prefix">
+                      <span v-if="form3.ljzt=='未连接'" style=" color:red ">{{ form3.ljzt }}</span>
+                      <span v-else  style="  color:  green  ">{{ form3.ljzt }}</span>
+                    </template>
+                  </el-input>
+
+                </el-form-item>
                 <el-form-item    :label="'SSID'" prop="ssid">
                   <el-input v-model="form3.ssid"   />
                 </el-form-item>
 
-                <el-form-item :required="true" :label="this.$t('formPassword')" prop="password">
-                  <el-input v-model="form3.password"    />
+                <el-form-item :required="true" :label="this.$t('formPassword')"  prop="password">
+                  <el-input v-model="form3.password"     auto-complete="off"  :type="passwordVisible ? 'text' : 'password'" >
+                  <template slot="suffix">
+                  <span
+                    class="el-icon-view"
+                    @click="togglePasswordVisibility()"
+                  ></span>
+                  </template>
+                  </el-input>
                 </el-form-item>
 
+                <el-form-item :label="this.$t('IPadress')"  >
+                  <el-input :readonly="true" v-model="form3.IPadress"    />
+                </el-form-item>
 
               </el-form>
               <div slot="footer" style="float: right;" class="dialog-footer">
-                <el-button type="primary" @click="submitForm3">{{$t('qd')}}</el-button>
+                <el-button type="primary" @click="submitForm3">{{$t('sz')}}</el-button>
               </div>
             </template>
           </div>
@@ -151,6 +178,7 @@
         form2: {},
         form3: {},
         sensorStatusForm: {}, // 传感器表单数据
+        czmodes:[{"id":"0","name":"gb"},{"id":"1","name":"qy"}],
         modes:[{"id":"0","name":"zd"},{"id":"1","name":"sd"}],
         types:[{"id":"WIFIIPV4Save","name":"IPV4"},{"id":"WIFIIPV6Save","name":"IPV6"}],
         activeName: '温湿度传感器', // 当前激活的标签页的 name
@@ -167,6 +195,9 @@
           password: [
             { required: true, message: this.$i18n.t('formPassword')+" "+this.$i18n.t('bnwk'), trigger: "blur" }
           ],
+          czmode: [
+            { required: true, message: this.$i18n.t('wifiwl')+" "+this.$i18n.t('bnwk'), trigger: "blur" }
+          ],
         },
         rules2: {
           mode: [
@@ -182,8 +213,14 @@
             { required: true, message: this.$i18n.t('xzms')+" "+this.$i18n.t('bnwk'), trigger: "blur" }
           ],
         },
+        passwordVisible: false,
+
       };
     },
+    mounted() {
+      //监听websocket消息
+      this.$bus.$on('WIFI_STATUS', this.onSocketMessageToWifiStatus);
+    },
     created() {
       this.usertoken= this.$store.state.user.usertoken;
       this.productParams= this.$store.state.user.productParams;
@@ -196,7 +233,19 @@
       },1500)
     },
     methods: {
-
+      //wifi状态
+      onSocketMessageToWifiStatus(recvMessage) {
+        if (recvMessage.success && recvMessage.data!=null && recvMessage.data.data!='' && recvMessage.data.data!=null) {
+          if(recvMessage.data!=null){
+            this.form3.IPadress=recvMessage.data.IPadress;
+            this.form3.ljzt=recvMessage.data.ljzt;
+          }
+          //  this.queryTotalStatus();
+        }
+      },
+      togglePasswordVisibility() {
+        this.passwordVisible = !this.passwordVisible;
+      },
       handleClick(tab, event) {
         console.log(tab, event);
       },
@@ -360,6 +409,8 @@
             params.type="WIFIPZSave";
             params.ssid=this.form3.ssid;
             params.password=this.form3.password;
+            params.IPadress=this.form3.IPadress;
+            params.czmode=this.form3.czmode;
             // params.mac=this.form2.mac;
             this.$modal.confirm(this.$t('qdybcm')).then(function() {
               communicationManagement(params);