liuqiao пре 2 година
родитељ
комит
e3067b5800
1 измењених фајлова са 191 додато и 575 уклоњено
  1. 191 575
      src/views/index/HCFDLab/index.vue

+ 191 - 575
src/views/index/HCFDLab/index.vue

@@ -1276,7 +1276,7 @@
       </el-form>
       <div slot="footer" class="dialog-footer">
         <el-button type="info"  @click="runcvisiable()"> {{ $t("HCFD.file.cancel")}} </el-button>
-        <el-button type="primary" @click="dialog.runc_visiable = false"
+        <el-button type="primary" @click="Runsolve()"
           >{{ $t("HCFD.file.ok")}}</el-button
         >
       </div>
@@ -1872,7 +1872,7 @@ export default {
     echartsHFCD,
     TFileStream,},
     // websocket,},
-    props:["objopp"],
+    props:["objopp","pid", "exLoading"],
   data() {
     return {
       checked:false,
@@ -2124,7 +2124,7 @@ export default {
       newload: true,
       runMonitor: true,
       contourLevel: 3,
-      exLoading:"hidden",
+      //exLoading:"hidden",
 
       form: {
         u_freestream: "",
@@ -2398,7 +2398,7 @@ export default {
           angle_of_yaw: 0,
           x_moment_center: 0,
           eqn_type: "cal_perf_incompress",
-          schedule_cfl: [200, 200],
+          schedule_cfl: [0, 0],
           swap_yz_axes: "false",
           v_vort_mag: "false",
           pseudo_time_stepping: "on",
@@ -2421,7 +2421,7 @@ export default {
           volume_animation_freq: 100,
           steps: 1500,
           flux_construction_lhs: "roe",
-          stopping_tolerance: 1.0e-15,
+          stopping_tolerance: 2.0e-1,
           prandtlnumber_molecular: 0.72,
           restart_write_freq: 250,
           v_vort_x: "false",
@@ -2515,6 +2515,131 @@ hcfdparam(){
           .catch((err) => {
           })
 },
+// 新版求解控制
+        Runsolve(){
+          this.hcfdparam();
+          this.dialog.runc_visiable = false;
+          //  this.hcfdExe();
+          this.hcfdrun();
+
+        },
+        hcfdExe(){
+  var _this = this;
+      let params = {
+        transCode: "C00005",
+        solverConfigId:this.solverConfigid,
+      };
+      request(params)
+        .then((res) => {
+        Message({
+                  type: "success",
+                  message:res.returnMsg,
+                });
+           
+        })
+        .catch((err) => {
+          setTimeout(function () {
+            _this.$refs.loading.visiable = false;
+          }, 4000);
+
+          if (err.returnCode == "EB8100017") {
+         
+            MessageBox.confirm("你还未分配资源?", "提示", {
+              confirmButtonText: "分配资源",
+              cancelButtonText: "取消",
+              type: "warning",
+            })
+              .then(() => {
+                let errUril =
+                
+                  _this.$store.getters.proUrl +
+                  "?projectId=" +
+                  _this.project.projectId;
+                let params2 = {
+                  transCode: "A00118",
+                  lesseeId: _this.$store.getters.lesseeId
+                };
+                request(params2)
+                  .then((res) => {
+                    window.location.href =
+                      errUril + "&authCode=" + res.authCode;
+                  })
+                  .catch((err) => {});
+              })
+              .catch(() => {
+                _this.$refs.loading.visiable = false;
+                Message({
+                  type: "info",
+                  message: "已取消",
+                });
+              });
+          }
+        });
+        },
+         /**
+     * 更新配置 并求解
+     */
+    async hcfdrun() {
+      console.log(1111)
+
+      if (this.solverState == "2") {
+        //上次求解完成
+        MessageBox.confirm(
+          "已完成计算,是否放弃上次计算结果,重新计算? 如果不放弃请自行下载上次结果文件!",
+          "提示",
+          {
+            confirmButtonText: "重新计算",
+            cancelButtonText: "取消",
+            type: "warning",
+          }
+        )
+          .then(() => {
+            MessageBox.close();
+            this.exLoading='visible';
+             
+            this.isSolverEnd = false;
+            this.hcfdExe();
+            let _this = this;
+            let isStop = false;
+              if (!isStop && !_this.isSolverEnd) {
+              this.$parent.fun();
+              }
+       
+          })
+          .catch(() => {
+            Message.info("已取消!");
+            MessageBox.close();
+            this.exLoading='hidden';
+          });
+      } else {
+        this.exLoading='visible';
+        this.isSolverEnd = false;
+        this.hcfdExe();
+        let _this = this;
+        let isStop = false;
+          if (!isStop && !_this.isSolverEnd) {
+            isStop = true;
+             this.$parent.fun();
+          }
+      }
+    },
+    // 求解的日志
+  getlog(){
+   let params = {
+            transCode: "C00006",
+            pid:this.project.projectId,
+       
+          };
+          request(params)
+            .then((res) => {
+              let rows = res.rows;
+              console.log(rows);
+         
+            })
+            .catch((err) => {
+        
+            });
+  },
    handleClick(tab, event) {
     if(this.activeName=='five'){
       let params = {
@@ -2666,10 +2791,8 @@ this.styX.left=e.clientX+'px';
     },
     init() {
   
-     // this.project.projectId ='81797100f859485e8aad9492a18904a7'
-      this.project.projectId = this.$route.query.projectId; //获取url 参数
+      this.project.projectId = this.pid; //获取url 参数
       this.project.lesseeId = this.$store.getters.lesseeId; //获取url 参数
-    // this.project.projectId = '86d0d4a3f85c40bea218936b6bad59ca';
       
       if (
         this.project.projectId != undefined &&
@@ -2709,44 +2832,7 @@ this.styX.left=e.clientX+'px';
             });
         }
     },
-    getlogs(){
-      var self = this;
-      let logtime=setInterval(getLog, 10000);
-      function getLog() {
-        let projectId = self.project.projectId;
-        if (projectId != null && projectId != "" && self.islogload) {
-          self.islogload = false;
-          let params = {
-            transCode: "A00112",
-            projectId: projectId,
-            page: 0,
-            count: 30,
-          };
-          request(params)
-            .then((res) => {
-              let rows = res.rows;
-              console.log(rows);
-              self.logs = ""; //只显示最新的数据
-              rows.forEach((row) => {
-                self.logs = row.log + "\n" + self.logs;
-                if (row.log.indexOf("Solver end") >= 0) {
-                  // console.log(row.log)
-                  self.exLoading='hidden';
-                  clearInterval(logtime)
-                  self.isSolverEnd = true;
-                }
-              });
-              self.islogload = true;
-            })
-            .catch((err) => {
-              self.islogload = true;
-               self.exLoading='hidden';
-              clearInterval(logtime)
-            });
-        }
-      }
-      getLog();
-    },
+
 
     setVolumScalars(scalars) {
       console.log(scalars)
@@ -2984,62 +3070,62 @@ this.styX.left=e.clientX+'px';
       this.restime=time;
     },
     //求解
-    hcfdExe() {
-      var _this = this;
-      let params = {
-        transCode: "A00105",
-        projectId: this.project.projectId,
-        lesseeId:this.$store.getters.lesseeId,
-        userName:this.$store.getters.name
-      };
-      request(params)
-        .then((res) => {
-        })
-        .catch((err) => {
-          //  console.log("hcfdExe" + err);
-          setTimeout(function () {
-            _this.$refs.loading.visiable = false;
-          }, 4000);
+    // hcfdExe() {
+    //   var _this = this;
+    //   let params = {
+    //     transCode: "A00105",
+    //     projectId: this.project.projectId,
+    //     lesseeId:this.$store.getters.lesseeId,
+    //     userName:this.$store.getters.name
+    //   };
+    //   request(params)
+    //     .then((res) => {
+    //     })
+    //     .catch((err) => {
+    //       //  console.log("hcfdExe" + err);
+    //       setTimeout(function () {
+    //         _this.$refs.loading.visiable = false;
+    //       }, 4000);
 
-          if (err.returnCode == "EB8100017") {
-            //资源未分配
+    //       if (err.returnCode == "EB8100017") {
+    //         //资源未分配
         
-            MessageBox.confirm("你还未分配资源?", "提示", {
-              confirmButtonText: "分配资源",
-              cancelButtonText: "取消",
-              type: "warning",
-            })
-              .then(() => {
-                // const errUril = Caegw_ProUrl +"?projectId="+_this.project.projectId;
-                let errUril =
-                  // window.location.protocol +
-                  // "//" +
-                  // window.location.host +
-                  // "/" +
-                  _this.$store.getters.proUrl +
-                  "?projectId=" +
-                  _this.project.projectId;
-                let params2 = {
-                  transCode: "A00118",
-                  lesseeId: _this.$store.getters.lesseeId
-                };
-                request(params2)
-                  .then((res) => {
-                    window.location.href =
-                      errUril + "&authCode=" + res.authCode;
-                  })
-                  .catch((err) => {});
-              })
-              .catch(() => {
-                _this.$refs.loading.visiable = false;
-                Message({
-                  type: "info",
-                  message: "已取消",
-                });
-              });
-          }
-        });
-    },
+    //         MessageBox.confirm("你还未分配资源?", "提示", {
+    //           confirmButtonText: "分配资源",
+    //           cancelButtonText: "取消",
+    //           type: "warning",
+    //         })
+    //           .then(() => {
+    //             // const errUril = Caegw_ProUrl +"?projectId="+_this.project.projectId;
+    //             let errUril =
+    //               // window.location.protocol +
+    //               // "//" +
+    //               // window.location.host +
+    //               // "/" +
+    //               _this.$store.getters.proUrl +
+    //               "?projectId=" +
+    //               _this.project.projectId;
+    //             let params2 = {
+    //               transCode: "A00118",
+    //               lesseeId: _this.$store.getters.lesseeId
+    //             };
+    //             request(params2)
+    //               .then((res) => {
+    //                 window.location.href =
+    //                   errUril + "&authCode=" + res.authCode;
+    //               })
+    //               .catch((err) => {});
+    //           })
+    //           .catch(() => {
+    //             _this.$refs.loading.visiable = false;
+    //             Message({
+    //               type: "info",
+    //               message: "已取消",
+    //             });
+    //           });
+    //       }
+    //     });
+    // },
     async reUpload() {
       this.$refs.mapbc.uploader.upload();
       this.$refs.ugrid.uploader.upload();
@@ -3160,403 +3246,7 @@ this.styX.left=e.clientX+'px';
         });
       });
     },
-   
-  // 文件渲染websoket
-    initWebSocket(){ //初始化weosocket
-    this.newlog='';
-        const wsuri = "ws://192.168.0.44:8082/websocket?vdioId="+this.project.projectId+this.servertype+this.tstep;
-        this.websock = new WebSocket(wsuri);
-        this.websock.onmessage = this.websocketonmessage;
-        this.websock.onopen = this.websocketonopen;
-        this.websock.onerror = this.websocketonerror;
-        this.websock.onclose = this.websocketclose;
-      },
-      websocketonopen(e){ //连接建立之后执行send方法发送数据
-      this.loadingopen()
-      let params = {
-        transCode: "VD0001",// 服务器渲染实例接口创建推流
-        projectId:this.project.projectId,
-        projectType: "hcfd",
-        fileType:this.servertype,
-        step:this.tstep,
-        flagDown:'1',
-        lesseeId: this.$store.getters.lesseeId
-      };
-      this.loading = true;
-      request(params)
-        .then((res) => {
-            console.log(res);
-           
-        })
-        .catch((err) => {
-            console.log(err);
-               this.loadingend(this.loadingopen());
 
-        }); 
-      },
-      websocketonerror(){//连接建立失败重连
-              this.websock.close() 
-      },
-      websocketonmessage(e){ //数据接收
-        try{
-              const redata = JSON.parse(e.data); 
-                   if(typeof redata==='object'&& redata){
-            const redata = JSON.parse(e.data);              
-            if(redata.hasOwnProperty("data")){          
-            }else{
-           
-                this.newlog =this.newlog+"\n" +JSON.stringify(redata);
-                  this.logs=this.newlog;
-            }
-           if(redata.data!=undefined){
-                this.$refs.monitor.hiden();
-              this.$refs.TFileStream.imgtupian=true;
-              this.$refs.TFileStream.fetchData(redata.data);
-           }
-          var state=redata.state;
-          if(state=='success'){
-            let params = { // 服务器 boundary 渲染
-        transCode: "VD0002",
-        projectId: this.project.projectId,
-        projectType: "hcfd",
-         fileType:this.servertype,
-        step:this.tstep,
-        lesseeId: this.$store.getters.lesseeId
-      };
-      this.loading = true;
-      request(params)
-        .then((res) => {
-            console.log(res);   
-
-        })
-        .catch((err) => {});
-          }else if(state=='fail'){
-              Message({
-            type: "error",
-            message: "返回错误请重试",
-          });
-               this.loadingend(this.loadingopen());
-          }
-      }
-        return true;       
-        }catch(error){
-          return false;
-        }
-       
- 
-      },
-      websocketsend(Data){//数据发送
-        this.websock.send(Data);
-      },
-      websocketclose(e){  //关闭
-        Message({
-            type: "error",
-            message: "websock断开连接",
-          });
-       
-      this.websock.close() 
-           this.loadingend(this.loadingopen());
-      },
-      // 新建完成后的OK
-  async ugridShowOK(){
-             await this.findParam();
-     this.dialog.new_visiable = false;
-       this.servertype='ugrid'
-      this.tstep=0;
-      this.initWebSocket();
-  },
-  //调状态求解状态(0-未求解 1-求解中 2-求解完成)
- getstatus(){
-    let params = {
-            transCode: "A00107",
-            projectId: this.project.projectId,
-          };
-        request(params)
-            .then((res) => {
-            console.log(res);
-            this.lsolverState=res.solverState;
-
-      
-            })
-            .catch((err) => {});
-      },
-      // 折线图按钮选择
-     getbtnmonitor(){
-       this.activecleer()
-       this.$refs.TFileStream.imgtupian=false;  
-       this.getstatus()
-       if(this.lsolverState=='2'){
-         this.numzhexian='1'
-       }else{
-              this.numzhexian='';
-
-       }
-        this.$refs.monitor.nhiden();
-       this.$refs.monitor.getwebsocket();
-     },
-//开起loading
-loadingopen(){
- const loading = this.$loading({
-          lock: true,
-          text: 'Loading',
-          spinner: 'el-icon-loading',
-          background: 'rgba(0, 0, 0, 0.7)'
-        });
-        return loading;
-},
-   // 关闭lodind
-loadingend(loading){
-  loading.close()
-
-},
-showboundary(){//表面加载
-
-if(this.lsolverState=='2'){
-    this.$refs.monitor.container_show=false;
-   this.clearserver();
-  this.servertype='boundary'
-   // this.project.projectId='81797100f859485e8aad9492a18904a7';
-      this.project.projectId= this.project.projectId;
-    this.tstep= this.bStep;
-    this.initWebSocket();
-   }else{
-       Message({
-            type: "warning",
-            message: "请先求解",
-          });
-   }
-
-},
-//anniu
-btnshowboundary(){
- this.getstatus();
- this.resultdata();
- if(this.lsolverState=='2'){
-   this.active='five-1';
-     this.dialog.SurfaceGrid_visiable = true;
-    this.$refs.monitor.container_show=false;
-   }else{
-       Message({
-            type: "warning",
-            message: "请先求解",
-          });
-   }
-
-},
-btnVolumeshow(){
-   this.getstatus();
-    this.resultdata();
-  if(this.lsolverState=='2'){
-        this.active='five-2';
-  this.$refs.monitor.hiden();
-   this.dialog.VolumeGrid_visiable = true;
-   }else{
-       Message({
-            type: "warning",
-            message: "请先求解",
-          });
-   }
-  
-},
-//表面 色条插值
-boundaryShow(){
-  if( this.project.projectId==''){
-       Message({
-            type: "warning",
-            message: "请选择项目",
-          });
-  }
-  if(this.bStep==0){
-    Message({
-            type: "warning",
-            message: "请选择setp有效值",
-          });
-  }else{
-    this.loadingopen()
-this.boundaryval(this.bMesh,this.bContour,this.bStep,this.Surfacenum,this.bScalar,this.servertype);
-    }
-},
- boundaryval(Mesh,Contour,Step,num,Scalar, servertype){
- let params = { 
-        transCode: "VDT0004",
-        projectId: this.project.projectId,
-        projectType: "hcfd",
-        fileType:servertype,
-        isMesh:Mesh,
-        isContour:Contour,
-        step:Step,
-        colorSize:num ,
-        tmp:Scalar,
-        lesseeId: this.$store.getters.lesseeId
-      };
-      console.log(params);
-      this.loading = true;
-      request(params)
-        .then((res) => {
-            console.log(res);
-              
-        })
-        .catch((err) => {});
-},
-
- Contourval(val) {
-if(this.belementCheckeds.length==2){
-      this.bMesh=1;
-      this.bContour=1;
-      console.log(222)
-} else if(this.belementCheckeds.length==0){
-    this.bMesh=0;
-      this.bContour=0;
-}
-else{
-    this.belementCheckeds.forEach((ele) => {
-            if ("Mesh" == ele) {
-         this.bMesh=1;
-      this.bContour=0;
-            }
-            if ("Contour" == ele) {
-             this.bMesh=0;
-      this.bContour=1;
-            }
-          });
-}
-  
-    },
-    ContourvalVolume(val) {
-      if(this.velementCheckeds.length==2){
-      this.vMesh=1;
-      this.vContour=1;
-      console.log(222)
-} else if(this.velementCheckeds.length==0){
-    this.vMesh=0;
-      this.vContour=0;
-}
-else{
-    this.velementCheckeds.forEach((ele) => {
-            if ("Mesh" == ele) {
-         this.vMesh=1;
-      this.vContour=0;
-            }
-            if ("Contour" == ele) {
-             this.vMesh=0;
-      this.vContour=1;
-            }
-          });
-}
-    },
-    // 体积加载
-Volumeshow(){
-
-if(this.lsolverState=='2'){
-
-  this.$refs.monitor.hiden();
- this.clearserver();
-  this.servertype='volume'
-     this.project.projectId= this.project.projectId;
-    this.tstep= this.vStep;
-   this.initWebSocket();
-   }else{
-       Message({
-            type: "warning",
-            message: "请先求解",
-          });
-   }
- },   
-showVolume(){//体积加载
-
-if(this.vStep==0){
-    Message({
-            type: "warning",
-            message: "setp为零没有,请选择有效值",
-          });
-  }else{
-    this.loadingopen()
-   this.boundaryval(this.vMesh,this.vContour,this.vStep,this.Volumenum,this.vSalar,this.servertype);
-}
-},
-//选择step
-bStepChange(val){
-  this.bStep=val;
-   if(this.bStep==0){
-    Message({
-            type: "warning",
-            message: "请选择setp有效值",
-          });
-  }else{
-      this.showboundary();
-  }
-
-},
-//选择step
-vStepChange(val){
-  this.vStep=val;
-    if(val==0){
-    Message({
-            type: "warning",
-            message: "请选择setp有效值",
-          });
-  }else{
-this.Volumeshow();
-}
-},
-// 表面加载
-SurfaceChange(value){// 选择色条个数
-  this.Surfacenum=value;
-
-},
-// 体积
-VolumenumChange(value){// 选择色条个数
-  this.Volumenum=value;
-
-},
-
-// 获取求解结果下拉数据
-resultdata(){
-   let params = { 
-        transCode: "VDT0005",
-        projectId: this.project.projectId,
-        //projectId: '81797100f859485e8aad9492a18904a7',
-        projectType: "hcfd",
-        lesseeId: this.$store.getters.lesseeId
-      };
-      this.loading = true;
-      request(params)
-        .then((res) => {
-             this.boundaryStep=(res.steps.split(" ")).map(Number);
-            let boundaryVars=res.boundaryVars.split(" ");
-             this.boundaryScalars=boundaryVars;
-             this.volumStep=(res.steps.split(" ")).map(Number);
-             this.volumScalars=res.volumeVars.split(" ");
-            console.log(   this.boundaryStep);
-        })
-        .catch((err) => {});
-},
-// 清除接口
-clearserver(){
-  if(this.servertype=='boundary'){
-        this.tstep=this.bStep;
-      }else if(this.servertype=='volume'){
-            this.tstep=this.vStep;
-      }
-      else{
-        this.tstep=0;
-      }
-        console.log( this.project.projectId);
- let params = {
-        transCode: "VD0003",
-        projectId: this.project.projectId,
-        projectType: "hcfd",
-        fileType:this.servertype,
-        step:this.tstep,
-        lesseeId: this.$store.getters.lesseeId
-      };
-      this.loading = true;
-      request(params)
-        .then((res) => {
-            console.log(res);
-        })
-        .catch((err) => {});
-},
     boundaryChange(boundaryid) {
       this.parameterObj.hcfdBoundarys.forEach((hcfdBoundary) => {
         if (hcfdBoundary.id === boundaryid) {
@@ -3656,30 +3346,7 @@ if(val==true){
       });
      
     },
-    clickNew(){
-      if(this.name=='amend'){
-                 let rse=this.xiugai;
-                 console.log(rse.projectId);
-        if( rse.projectId ==""|| rse.projectId ==undefined){
-            Message({
-          type: "info",
-          message: "请选择你要修改的项目",
-        });
-        }else{
-             this.project.projectId = rse.projectId;
-            this.project.projectName = rse.projectName;
-            this.project.projectDesc = rse.projectDesc;
-             this.dialog.new_visiable = true;
-}     
-         
-      }else{
-            this.project.projectId = '';
-         this.project.projectName ='';
-        this.project.projectDesc = '';
-      this.dialog.new_visiable = true;
-      }
-     
-    },
+ 
     solutionvCheckAllChange(val) {
       // this.Solution.volumout.checkeds = val ? this.Solution.volumout.lists : [];
       // this.Solution.volumout.isIndeterminate = false;
@@ -3830,60 +3497,9 @@ if(val==true){
       }
     },
 
-    //通过 volume 解析文件,不显示图像
-    async showVolumers() {
-      let mesh = false;
-      let contour = false;
-      this.velementCheckeds.forEach((ele) => {
-        if ("Mesh" == ele) {
-          mesh = true;
-        } else if ("Contour" == ele) {
-          contour = true;
-        }
-      });
-      if (!this.showVolumeflage) {
-        this.$refs.volumLoad.clear();
-        if (this.project.solverfiles.length == 0) {
-          await this.gethcfdsolverfiles();
-        }
-        let urls = [];
-        this.project.solverVolumUrls.forEach((url) => {
-          if (url.indexOf(this.bStep + ".dat") > 0) {
-            urls.push(url);
-          }
-        });
-        if (mesh) {
-          this.$refs.volumLoad.loadVolumHiden(urls, 1, this.vSalar);
-        }
-        if (contour) {
-          this.$refs.boundaryLoad.divb = false;
-          this.$refs.volumLoad.vdivb = true;
-          this.$refs.volumLoad.loadVolumHiden(urls, 2, this.vSalar);
-        }
-      } else {
-        this.$refs.volumLoad.clear();
-        this.$refs.volumLoad.nhiden();
-        if (mesh) {
-          this.$refs.volumLoad.mesh(this.vSalar);
-        }
-
-        if (contour) {
-          this.$refs.boundaryLoad.divb = false;
-          this.$refs.volumLoad.vdivb = true;
-          this.$refs.volumLoad.contour(this.vSalar);
-        }
-      }
-    },
+   
   
-    async showMonitor() {
-      if (!this.showMonitorflage) {
-        let convergeUrl = this.project.converge;
-        this.$refs.monitor.loadConverge("http://192.168.0.43:6868/8525e93c277749e7a54dde92fc31405d/tf/test/data_out/converge.dat");
-      } else {
-        this.$refs.monitor.nhiden();
-      }
-      this.showMonitorflage = true;
-    },
+ 
     large() {
       this.$refs.ugridLoad.large();
       this.$refs.boundaryLoad.large();
@@ -4035,8 +3651,8 @@ if(val==true){
           this.Consoleshow=false;
           this.openshow=true;
         }
-        }
-        
+        },
+
  
 
       }