Explorar o código

固件升级优化

wenb hai 1 ano
pai
achega
ac8e533011

+ 1 - 1
web/三相/src/views/power/monitorhistory/index.vue

@@ -1,4 +1,4 @@
-<template>
+s<template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="auto">
       <el-form-item :label="this.$t('el.datepicker.startTime')" prop="startTime">

+ 8 - 2
web/三相/src/views/sbwh/gjsj/index.vue

@@ -86,7 +86,7 @@
           <el-card  >
             <el-collapse accordion v-model="activeNames">
               <el-collapse-item  v-for="(item, index) in hisData" :name="index"  :title="item.productVersion+' -  '+item.versionDate">
-                  <li>{{item.updateContent}}</li>
+                  <li style="white-space: pre-line;">{{item.updateContent}}</li>
               </el-collapse-item>
             </el-collapse>
           </el-card>
@@ -293,7 +293,13 @@ if(file==null){
         // console.log(this.queryParams)
         equipmentMintenance(params).then(response => {
           if(response.data!=null){
-              this.hisData=response.data;
+          let list=[];
+            for(var i=0;i<response.data.length;i++){
+              var aa=response.data[i];
+              aa.updateContent=aa.updateContent.replace(/<br>/g, '\n')
+              list.push(aa);
+            }
+              this.hisData=list;
           }
          // this.channelList = response.data;
       }).catch(() => {});

+ 25 - 9
web/三相/src/views/sbwh/kzbsj/index.vue

@@ -15,10 +15,10 @@
 
     </el-form>
     <el-card style="min-height: 700px ;border-radius: 15px">
-    <el-table max-height="700"  :data="channelList"  @selection-change="handleSelectionChange"  :header-cell-style="{ background:'#FFFFFF',color:'#000000'}">
+    <el-table max-height="700" ref="multipleTable"  :data="channelList"  @selection-change="handleSelectionChange"  :header-cell-style="{ background:'#FFFFFF',color:'#000000'}">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column align="center" :label="this.$t('sbmc')" prop="productName"  />
-      <el-table-column align="center" label="产品ID" v-if="false" prop="productId"  />
+      <el-table-column align="center" label="产品ID"   prop="productId"  />
       <el-table-column align="center" :label="this.$t('kzbh')" prop="productNumber"  />
       <el-table-column align="center" :label="this.$t('tdsl')" prop="productChNumber" :show-overflow-tooltip="true"   />
       <el-table-column align="center" :label="this.$t('gjbbh')" prop="productVersion" :show-overflow-tooltip="true"   />
@@ -140,7 +140,7 @@
           // 是否禁用上传
           isUploading: false,
           // 上传的地址
-          url:  window.location.origin+":8084/pdu/controlBoardUpgradeUpload" // todo
+          url:  window.location.origin+"/pdu/controlBoardUpgradeUpload" // todo
         },
         productChTypes:[{"id":"1","name":"sblx1"},{"id":"2","name":"sblx2"},{"id":"3","name":"sblx3"},{"id":"4","name":"sblx4"},{"id":"5","name":"sblx5"}],
         statuss:[{"id":"0","name":"lix"},{"id":"1","name":"zx"},{"id":"2","name":"sjz"}],
@@ -230,26 +230,40 @@
       },
 // 升级
       handleUpdate(row) {
+        this.$refs.multipleTable.clearSelection();
+
         if( this.fileName==""){
-          alert(this.$t("qxzgj"))
+          this.$modal.alert(this.$t("qxzgj"))
           return
         }
         this.validate="1";
-        this.$refs.upload.submit();
+        this.$refs.multipleTable.toggleRowSelection(row)
+        var aa=this;
+        this.$modal.confirm(this.$t('qdycqm')).then(function() {
+
+          aa.$refs.upload.submit();
+        }).then(() => {
+
+        }).catch(() => {});
 
       },
       //批量升级
       handleUpdateAll(){
         if( this.fileName==""){
-          alert(this.$t("qxzgj"))
+          this.$modal.alert(this.$t("qxzgj"))
           return
         }
         if(this.productId==""){
-          alert(this.$t("qxzkzb"))
+          this.$modal.alert(this.$t("qxzkzb"))
           return
         }
         this.validate="1";
-        this.$refs.upload.submit();
+        var aa=this;
+        this.$modal.confirm(this.$t('qdycqm')).then(function() {
+          aa.$refs.upload.submit();
+        }).then(() => {
+
+        }).catch(() => {});
 
   },
       beforeUpload(file){
@@ -274,7 +288,8 @@
         this.$refs.upload.clearFiles();
         this.$modal.alert( response.msg);
         this.cancel();
-        this.handleQuery();
+        this.$refs.multipleTable.clearSelection();
+      //  this.handleQuery();
       },
 // 提交上传文件
       submitFileForm() {
@@ -317,6 +332,7 @@
        // console.log(this.queryParams)
           controlBoardUpgrade(this.queryParams).then(response => {
             this.channelList = response.data;
+        this.$refs.multipleTable.toggleAllSelection();
         }).catch(() => {});
         this.loading = false;
       },

+ 9 - 0
web/安德森/src/api/pdu/pduServer.js

@@ -94,6 +94,15 @@ export function systemConfiguration(data) {
   })
 }
 
+// 控制板升级
+export function controlBoardUpgrade(data) {
+  return request({
+    url: '/pdu/controlBoardUpgrade',
+    method: 'post',
+    data: data
+  })
+}
+
 /**
  * * 获取信息
  * @param address

+ 8 - 2
web/安德森/src/views/sbwh/gjsj/index.vue

@@ -86,7 +86,7 @@
         <el-card  >
           <el-collapse accordion v-model="activeNames">
             <el-collapse-item  v-for="(item, index) in hisData" :name="index"  :title="item.productVersion+' -  '+item.versionDate">
-              <li>{{item.updateContent}}</li>
+              <li style="white-space: pre-line;">{{item.updateContent}}</li>
             </el-collapse-item>
           </el-collapse>
         </el-card>
@@ -293,7 +293,13 @@
         // console.log(this.queryParams)
         equipmentMintenance(params).then(response => {
           if(response.data!=null){
-          this.hisData=response.data;
+          let list=[];
+          for(var i=0;i<response.data.length;i++){
+            var aa=response.data[i];
+            aa.updateContent=aa.updateContent.replace(/<br>/g, '\n')
+            list.push(aa);
+          }
+          this.hisData=list;
         }
         // this.channelList = response.data;
       }).catch(() => {});

+ 442 - 0
web/安德森/src/views/sbwh/kzbsj/index.vue

@@ -0,0 +1,442 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="auto">
+
+
+      <el-form-item :label="this.$t('kzbgj')" prop="fileName" style="width: 400px">
+        <el-input :readonly="true" :disabled="true" style="width: 300px"    v-model="fileName" />
+      </el-form-item>
+
+      <el-form-item>
+        <el-button type="primary"   :min-width="getStringWidth($t('gjxz'))"  style="border-radius: 10px;background-color: #0E35FF;margin-left: 10px;"     @click="handleImport">{{$t('gjxz')}}</el-button>
+        <el-button type="primary"   :min-width="getStringWidth($t('plsj'))"  style="border-radius: 10px;background-color: #0E35FF;margin-left: 10px;"  @click="handleUpdateAll">{{$t('plsj')}}</el-button>
+        <!--<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{$t('czhi')}}</el-button>-->
+      </el-form-item>
+
+    </el-form>
+    <el-card style="min-height: 700px ;border-radius: 15px">
+    <el-table max-height="700" ref="multipleTable"  :data="channelList"  @selection-change="handleSelectionChange"  :header-cell-style="{ background:'#FFFFFF',color:'#000000'}">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column align="center" :label="this.$t('sbmc')" prop="productName"  />
+      <el-table-column align="center" label="产品ID"   prop="productId"  />
+      <el-table-column align="center" :label="this.$t('kzbh')" prop="productNumber"  />
+      <el-table-column align="center" :label="this.$t('tdsl')" prop="productChNumber" :show-overflow-tooltip="true"   />
+      <el-table-column align="center" :label="this.$t('gjbbh')" prop="productVersion" :show-overflow-tooltip="true"   />
+
+      <el-table-column align="center" :label="this.$t('sjrq')" prop="upgradeDate" :show-overflow-tooltip="true"   />
+      <el-table-column align="center" :label="this.$t('dqzt')" prop="status" :show-overflow-tooltip="true"   >
+        <template slot-scope="scope">
+          <span v-if="scope.row.status=='0'" style="color: red">{{getDity(scope.row,'status')}}</span>
+          <span v-else-if="scope.row.status=='1'" style="color: green">{{getDity(scope.row,'status')}}</span>
+          <span v-else style="color: #FFD966">{{getDity(scope.row,'status')}}</span>
+
+        </template>
+      </el-table-column>
+      <el-table-column :label="this.$t('cz')" align="center"  class-name="smfirmwareDateall-padding fixed-width">
+        <template slot-scope="scope" >
+          <el-button
+            size="mini"
+            type="text"
+            @click="handleUpdate(scope.row)"
+          >{{$t('sej')}}</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+    </el-card>
+    <!-- 编辑通道-->
+    <!-- 用户导入对话框 -->
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" :close-on-click-modal="false" :close-on-press-escape="false" append-to-body>
+      <el-form ref="form" :model="form"  label-width="auto" class="left-align-form">
+        <el-form-item style="display: none" label="设备id:" prop="productId">
+          <el-input :readonly="true" :disabled="true"  v-model="form.productId" />
+        </el-form-item>
+        <!--<el-form-item   :label="this.$t('bbh')" prop="productVersion">-->
+          <!--<el-input  v-model="form.productVersion" />-->
+        <!--</el-form-item>-->
+
+      </el-form>
+      <el-upload
+           ref="upload"
+        :limit="1"
+        :action="upload.url + '?productId=' + this.productId+'&type=importData&token='+this.usertoken"
+           accept=".bin, .hex"
+        :disabled="upload.isUploading"
+           :on-change="beforeUpload"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        :auto-upload="false"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">{{$t('drts')}}<em>{{$t('djsc')}}</em></div>
+        <div class="el-upload__tip text-center" slot="tip">
+          <span>{{$t('jyxdr')}}bin、hex{{$t('gswj')}}。</span>
+        </div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitFileForm">{{$t('qd')}}</el-button>
+        <el-button @click="cancel">{{$t('qx')}}</el-button>
+      </div>
+    </el-dialog>
+    <el-dialog :title="title" class="dialogClass" style="overflow-y: auto;" :visible.sync="open"  width="500px" :close-on-click-modal="false" :close-on-press-escape="false" append-to-body>
+        <el-col style="height: 500px;overflow-y: auto;"  >
+          <el-card  >
+            <el-collapse accordion v-model="activeNames">
+              <el-collapse-item  v-for="(item, index) in hisData" :name="index"  :title="item.productVersion+' -  '+item.versionDate">
+                  <li>{{item.updateContent}}</li>
+              </el-collapse-item>
+            </el-collapse>
+          </el-card>
+        </el-col>
+
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+  import { list, forceLogout } from "@/api/monitor/online";
+  import {controlBoardUpgrade ,serviceManagement} from "@/api/pdu/pduServer";
+
+  export default {
+    name: "Online",
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 总条数
+        total: 0,
+        // 表格数据
+        channelList: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        sortnoOpen: false,
+        // 通道配置表单参数
+        form: {},
+        sortnoForm: {},
+        modes:["开启","关闭"],
+        // 查询参数
+        queryParams: {
+          productName: "",
+          productNumber: "",
+          token: "",
+          type: "",
+        },
+        usertoken:"",
+        tableData: [],
+        tableProps: [
+          { prop: 'sortno', isShow: true, label: '序号', width: '55', minWidth: '100', align: 'center', type: 'index' },
+          { prop: 'productChId', isShow: true, label: '通道号', width: '150', minWidth: '100', align: 'center', type: 'index' },
+          { prop: 'productChName', isShow: true, label: '通道名称', width: '', minWidth: '100', align: 'center' },
+          { prop: 'status', isShow: true, label: '状态', width: '', minWidth: '100', align: 'center' },
+        ],
+        productList:[],
+        upload: {
+          // 是否显示弹出层(用户导入)
+          open: false,
+          // 弹出层标题(用户导入)
+          title: "",
+          // 是否禁用上传
+          isUploading: false,
+          // 上传的地址
+          url:  window.location.origin+"/pdu/controlBoardUpgradeUpload" // todo
+        },
+        productChTypes:[{"id":"1","name":"sblx1"},{"id":"2","name":"sblx2"},{"id":"3","name":"sblx3"},{"id":"4","name":"sblx4"},{"id":"5","name":"sblx5"}],
+        statuss:[{"id":"0","name":"lix"},{"id":"1","name":"zx"},{"id":"2","name":"sjz"}],
+        hisData:[],
+        activeNames:[],
+        productId:"",
+        file:null,
+        fileName:"",
+        validate:""
+      };
+    },
+    mounted() {
+      //监听websocket消息
+
+      this.$bus.$on('CONTROL_BOARD_UPGRADE', this.onSocketMessageToUpgrade);
+    },
+    created() {
+      console.log(window.location.origin)
+      this.usertoken= this.$store.state.user.usertoken;
+    //  this.queryProductList();
+      this.handleQuery();
+    },
+    methods: {
+      //推送通道状态
+      onSocketMessageToUpgrade(recvMessage) {
+        if (recvMessage.success) {
+          let resultData =recvMessage.data.data
+          if(recvMessage.data!=null && resultData!='' && resultData!=null){
+            this.channelList = resultData;
+          }
+
+          // this.handleQuery();
+        }
+      },
+      // 多选框选中数据
+      handleSelectionChange(selection) {
+        var ids = selection.map(item => item.productId);
+        this.productId=ids.join(",");
+      },
+      getStringWidth(text) {
+
+        //console.log('text', text)
+        const font = '14px Arial'
+        const canvas = document.createElement('canvas')
+        const context = canvas.getContext('2d')
+        context.font = font
+        const metrics = context.measureText(text)
+        // console.log('metrics.width', metrics.width)
+        return metrics.width + 40
+      },
+      //格式化培训形式
+      getDity(row,type) {
+        var name="";
+        var id="";
+        var formTrain=[];
+        if(type=='status'){
+          formTrain=this.statuss
+          id=row.status
+        }
+        for (var i = 0; i < formTrain.length; i++) {
+          let item = formTrain[i]
+          if (id== item.id) {
+            name=item.name;
+            return this.$t(item.name)
+          }
+        }
+        return name;
+      },
+      // 设备列表
+      queryProductList(){
+        const params={};
+        params.token= this.usertoken;
+        params.type= "listCbQuery";
+        controlBoardUpgrade(params).then(response => {
+          this.productList = response.data;
+        }).catch(() => {});
+      },
+      /** 导入按钮操作 */
+      handleImport(row) {
+        this.upload.title = this.$t('gjxz'); // todo
+        this.upload.open = true;
+        if(this.fileName!=""){
+          this.$refs.upload.clearFiles();
+        }
+        this.fileName ="";
+        this.validate="";
+      },
+// 升级
+      handleUpdate(row) {
+        this.$refs.multipleTable.clearSelection();
+
+        if( this.fileName==""){
+          this.$modal.alert(this.$t("qxzgj"))
+          return
+        }
+        this.validate="1";
+        this.$refs.multipleTable.toggleRowSelection(row)
+        var aa=this;
+        this.$modal.confirm(this.$t('qdycqm')).then(function() {
+
+          aa.$refs.upload.submit();
+        }).then(() => {
+
+        }).catch(() => {});
+
+      },
+      //批量升级
+      handleUpdateAll(){
+        if( this.fileName==""){
+          this.$modal.alert(this.$t("qxzgj"))
+          return
+        }
+        if(this.productId==""){
+          this.$modal.alert(this.$t("qxzkzb"))
+          return
+        }
+        this.validate="1";
+        var aa=this;
+        this.$modal.confirm(this.$t('qdycqm')).then(function() {
+          aa.$refs.upload.submit();
+        }).then(() => {
+
+        }).catch(() => {});
+
+  },
+      beforeUpload(file){
+        if(this.validate==""){
+          var name= file.name.split('.')[1].toLowerCase() ;
+          if ( name!='bin' && name!='hex' ) {
+            this.$modal.msgError(this.$t('jyxdr')+"bin、hex"+this.$t('gswj'));
+            this.$refs.upload.clearFiles();
+            return false;
+          }
+          this.fileName=file.name;
+        }
+      },
+// 文件上传中处理
+      handleFileUploadProgress(event, file, fileList) {
+        this.upload.isUploading = true;
+      },
+// 文件上传成功处理
+      handleFileSuccess(response, file, fileList) {
+        this.upload.open = false;
+        this.upload.isUploading = false;
+        this.$refs.upload.clearFiles();
+        this.$modal.alert( response.msg);
+        this.cancel();
+        this.$refs.multipleTable.clearSelection();
+      //  this.handleQuery();
+      },
+// 提交上传文件
+      submitFileForm() {
+        this.upload.open = false;
+        // this.$refs.upload.submit();
+      },
+
+
+      handleAdd(){
+        this.sortnoOpen=true;
+      },
+      // 更多操作触发
+      handleCommand(command, row) {
+        const params={};
+        params.token=this.usertoken;
+        params.productId=row.productId;
+        params.productNumber=row.productNumber;
+        switch (command) {
+          case "channelopen":
+            params.type="sBRestart";
+            this.$modal.confirm(this.$t('qdycqm')).then(function() {
+              controlBoardUpgrade(params);
+            }).then(() => {
+              //this.$modal.msgSuccess(this.$t('zxcg'));
+            }).catch(() => {});
+
+            break;
+          default:
+            break;
+        }
+      },
+
+
+      // 通道列表
+      queryChannelStatus(){
+
+        this.queryParams.token=this.usertoken;
+        this.queryParams.type="listCbQuery";
+        this.loading = true;
+       // console.log(this.queryParams)
+          controlBoardUpgrade(this.queryParams).then(response => {
+            this.channelList = response.data;
+        this.$refs.multipleTable.toggleAllSelection();
+        }).catch(() => {});
+        this.loading = false;
+      },
+
+      /** 搜索按钮操作 */
+      handleQuery() {
+        this.queryChannelStatus();
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      /** 版本历史 */
+      handleHis(row) {
+        this.form =row;
+        const params={};
+        params.token=this.usertoken;
+        params.type="listRtHisQuery";
+        params.productId=row.productId;
+        this.loading = true;
+        // console.log(this.queryParams)
+        controlBoardUpgrade(params).then(response => {
+          if(response.data!=null){
+              this.hisData=response.data;
+          }
+         // this.channelList = response.data;
+      }).catch(() => {});
+        this.loading = false;
+        this.open = true;
+        this.title = this.$t('bbls');
+        this.activeNames=[0];
+      },
+
+      /** 提交按钮 */
+      submitForm: function() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            const params={};
+            params.token=this.usertoken;
+            params.type="sXTimeSave";
+            params.productChName=this.form.productChName;
+            params.productChId=this.form.productChId;
+            params.firingInterval=this.form.firingInterval;
+            params.closeInterval=this.form.closeInterval;
+            params.productId=this.form.productId;
+            this.loading = true;
+            this.$modal.confirm(this.$t('qdybcm')).then(function() {
+              serviceManagement(params).then(response => {
+                this.open = false;
+              this.queryChannelStatus();
+            });
+
+            }).then(() => {
+              this.open = false;
+          }).catch(() => {});
+
+          }
+        });
+
+      },
+
+      // 取消按钮
+      cancel() {
+        if(this.fileName!=""){
+          this.$refs.upload.clearFiles();
+        }
+        this.fileName ="";
+        this.upload.open = false;
+        //  this.reset();
+      },
+      /** 强退按钮操作 */
+      handleForceLogout(row) {
+        this.$modal.confirm(this.$t('sfqztc') + row.userName + this.$t('yhm')).then(function() {
+          return forceLogout(row.tokenId);
+        }).then(() => {
+          this.getList();
+        this.$modal.msgSuccess(this.$t('qtcg'));
+      }).catch(() => {});
+      }
+    }
+  };
+</script>
+<style>
+  .left-align-form .el-form-item__label {
+    text-align: left;
+  }
+
+  .left-align-form .el-form-item {
+    margin-bottom: 0; /* 根据需要可以去掉或调整间距 */
+  }
+  .update-log {
+  ol {
+    display: block;
+    list-style-type: decimal;
+    margin-block-start: 1em;
+    margin-block-end: 1em;
+    margin-inline-start: 0;
+    margin-inline-end: 0;
+    padding-inline-start: 40px;
+  }
+  }
+  .dialogClass .el-dialog{
+    height: 600px;
+  }
+</style>
+