liuqiao hai 11 meses
pai
achega
a637f4721c
Modificáronse 1 ficheiros con 171 adicións e 60 borrados
  1. 171 60
      src/views/home.vue

+ 171 - 60
src/views/home.vue

@@ -1020,7 +1020,7 @@
                 <div  class="maxh221">
              <!-- 中间部分 -->
              <div  class="conter_mian classtable " v-if="activeName=='Three'&&tabactive=='列表监控'">
-               <el-table :data="tableDatalieb" border  style="display: flex; flex: 1; overflow: auto;"  max-height="600">
+               <!-- <el-table :data="tableDatalieb" border  style="display: flex; flex: 1; overflow: auto;"  max-height="600">
                 <el-table-column  type="index" width="30" />
                 <el-table-column prop="x1" label="x1"  />
                 <el-table-column prop="x2" label="x2"  />
@@ -1038,7 +1038,16 @@
                 <el-table-column prop="x14" label="x14"  />
                 <el-table-column prop="x15" label="x15"  />
                 <el-table-column prop="cd" label="cd/cl"  />
-                </el-table> 
+                </el-table>  -->
+                <el-table :data="tableDatalieb">
+                  <el-table-column
+                    v-for="(header, index) in tableHeaders"
+                    :key="index"
+                    :prop="header.prop"
+                    :label="header.label">
+                  </el-table-column>
+                </el-table>
+                <div @click="tablefun()">点击</div>
              </div>
              <!--   曲线监控 -->
              <div  class="conter_mian classtable " v-if="activeName=='Three'&&tabactive=='曲线监控'">
@@ -1137,6 +1146,16 @@
                     <el-input v-model="row.remark" @change="handleEdit(row)" />
                   </template>
                 </el-table-column>
+                <el-table-column label="操作"  width="140">
+                          <template #default="scope">
+                            <el-button
+                            size="small"
+                              type="danger"
+                              @click.stop="sjdelete(scope.$index, scope.row)"
+                              >删除</el-button
+                            >
+                          </template>
+                        </el-table-column>
                 </el-table>
                 
                 </div>
@@ -1179,6 +1198,16 @@
                           <el-input v-model.Number="row.reference"    oninput ="value=value.replace(/^|[^0-9]/g,'')"  @change="handleEdit(row)" />
                         </template>
                       </el-table-column>
+                      <el-table-column label="操作"  width="140">
+                          <template #default="scope">
+                            <el-button
+                            size="small"
+                              type="danger"
+                              @click.stop="ysdelete(scope.$index, scope.row)"
+                              >删除</el-button
+                            >
+                          </template>
+                        </el-table-column>
                     </el-table>
                 
                 </div>
@@ -1243,6 +1272,16 @@
                           <el-input v-model="row.remark" @change="handleEdit(row)" />
                         </template>
                   </el-table-column>
+                  <el-table-column label="操作"  width="140">
+                          <template #default="scope">
+                            <el-button
+                            size="small"
+                              type="danger"
+                              @click.stop="mbdelete(scope.$index, scope.row)"
+                              >删除</el-button
+                            >
+                          </template>
+                        </el-table-column>
                 </el-table>
                 
                 </div>
@@ -1315,6 +1354,15 @@
     operator:'倒位变异',
     gpu:'YES'
   })
+  let tableHeaders=ref([
+        // { label: '日期', prop: 'date' },
+        // { label: '姓名', prop: 'name' },
+        // 可以根据需要动态添加或删除表头信息
+      ]) 
+  let arrobj=ref([]);
+ let tableDatalieb=ref([
+        // { date: '2016-05-02', name: '王小虎' },
+      ])
   let websock=ref(null);
   let times=ref({
       lockReconnect: false, //是否真正建立连接
@@ -1336,8 +1384,8 @@
   const tabs = ['信息栏', '优化问题'];
   const listli = ['设计变量', '约束条件', '目标函数'];
   const xfoil = ['输入', '执行', '输出'];
-  let srtable=ref();
-  let sctable=ref();
+  let srtable=ref([]);
+  let sctable=ref([]);
   // let quxian=ref([{
   //   val:'1',name:"设计变量",
   //   val:'2',name:"约束条件",
@@ -1598,7 +1646,7 @@ let options3=ref([
     },
   ]
   const eloptimize = ref([])
-  const tableData = ref([])
+  let tableData = ref([])
   const designtable = ref([])
   const tasktable = ref([
   {
@@ -1618,43 +1666,43 @@ let options3=ref([
       
     }, 
   ])
-  let tableDatalieb=ref([
-  {
-      x1:"02",
-      x2: '33456833',
-      x3:"02",
-      x4: '20160503',
-      x5:"02",
-      x6: '20160503',
-      x7:"02",
-      x8: '20160503',
-      x9:"02",
-      x10: '20160503',
-      x11:"02",
-      x12: '20160503',
-      x13:"02",
-      x14: '20160503',
-      x15: '20160503',
-      cd: '20160503',
-    }, 
-    {
-      x1:"02",
-      x2: '33456833',
-      x3:"02",
-      x4: '20160503',
-      x5:"02",
-      x6: '20160503',
-      x7:"02",
-      x8: '20160503',
-      x9:"02",
-      x10: '20160503',
-      x11:"02",
-      x12: '20160503',
-      x13:"02",
-      x14: '20160503',
-      cd: '20160503',
-    },
-  ])
+  // let tableDatalieb=ref([
+  // {
+  //     x1:"02",
+  //     x2: '33456833',
+  //     x3:"02",
+  //     x4: '20160503',
+  //     x5:"02",
+  //     x6: '20160503',
+  //     x7:"02",
+  //     x8: '20160503',
+  //     x9:"02",
+  //     x10: '20160503',
+  //     x11:"02",
+  //     x12: '20160503',
+  //     x13:"02",
+  //     x14: '20160503',
+  //     x15: '20160503',
+  //     cd: '20160503',
+  //   }, 
+  //   {
+  //     x1:"02",
+  //     x2: '33456833',
+  //     x3:"02",
+  //     x4: '20160503',
+  //     x5:"02",
+  //     x6: '20160503',
+  //     x7:"02",
+  //     x8: '20160503',
+  //     x9:"02",
+  //     x10: '20160503',
+  //     x11:"02",
+  //     x12: '20160503',
+  //     x13:"02",
+  //     x14: '20160503',
+  //     cd: '20160503',
+  //   },
+  // ])
   let name = ref("1")
   let num = ref(1)
   const getImgPath = (url) => {
@@ -1668,6 +1716,19 @@ let options3=ref([
   // childfun();
 
 });
+
+const sjdelete=(index,row)=>{
+  console.log(index);
+  designtable.value.splice(index, 1)
+
+
+}
+const ysdelete=(index,row)=>{
+  tableData.value.splice(index, 1)
+}
+const mbdelete=(index,row)=>{
+  eloptimize.value.splice(index, 1)
+}
   // 初始值
 const init=()=>{
 
@@ -1833,7 +1894,7 @@ console.log(route.query.pid);
          // youhua=res;
          
          }else{
-          youhua=res;
+        //  youhua=res;
          }
         
         })
@@ -1952,11 +2013,10 @@ const getissue=()=>{
     }
     request(params)
         .then((res) => {
-       
           res.rows = res.rows.map(item => {
-          item.lower = Number(item.lower); // 将id属性转换为数字
+          item.lower = Number(item.lower); // 将属性转换为数字
           item.upper = Number(item.upper); 
-          item.upper = Number(item.reference); 
+          item.reference = Number(item.reference); 
           return item;
         })
         designtable.value=res.rows;
@@ -2135,10 +2195,11 @@ const initialize=()=>{
     }
     request(params)
         .then((res) => {
-          ElMessage({
-                  message: res.returnMsg,
-                  type: 'success',
-              })
+          // ElMessage({
+          //         message: res.returnMsg,
+          //         type: 'success',
+          //     })
+              importget();
         })
         .catch((err) => {
             ElMessage.error(err.returnMsg)
@@ -2184,8 +2245,11 @@ const params = {
 }
 // 输入的删除
 
-const suelete=(index,row)=>{
-console.log(row);
+const sudelete=(index,row)=>{
+  if(row.hasOwnProperty('outid')==false){
+      srtable.value.splice(index, 1)
+}else{
+
 const params = {
         transCode: 'MDO0014',
         inid:row.inid,
@@ -2201,6 +2265,7 @@ const params = {
         .catch((err) => {
             ElMessage.error(err.returnMsg)
         })
+      }
 }
 //输入输出的新建
 const newxfiol=()=>{
@@ -2210,16 +2275,13 @@ if(activeIndex3.value==0){
           v1:'0',
           v2:'0',
           enable:'0'
-       
         })
 }else if(activeIndex3.value==2){
-  console.log( sctable.value);
   sctable.value.push({
           name:"",
           v1:'',
           v2:'',
           enable:'0'
-       
         })
 }
    
@@ -2285,7 +2347,7 @@ const params = {
 const scdelete=(index,row)=>{
 console.log(row);
 if(row.hasOwnProperty('outid')==false){
-  console.log(2222)
+  sctable.value.splice(index, 1)
 }else{
 const params = {
         transCode: 'MDO0017',
@@ -2303,11 +2365,25 @@ const params = {
             ElMessage.error(err.returnMsg)
         })
       }
+}
+// 表格
+function tablefun(){
+  let varsobj={}
+ let heaarr= arrobj.value[0].vars.split(",");
+ tableHeaders.value=[];
+heaarr.forEach(function(item) {
+  let obj = { label: item ,prop:item}; // 创建新对象
+  tableHeaders.value.push(obj);
+
+});
+
+
 }
 //websockct的连接
 function initWebSocket() {
-      //初始化weosocket
 
+      //初始化weosocket
+    arrobj.value=[];
       // const wsuri = "ws://192.168.0.43:8087//websocket?projectId="+this.pid; ws://192.168.0.131/diswebsocket?projectId=5
        const wsurl = "ws://192.168.104:8188//websocket?projectId="+pid.value;
       // const wsurl =
@@ -2325,17 +2401,52 @@ function initWebSocket() {
  	// Websoket连接成功事件
    const websocketonopen = (res) => {
       console.log("WebSocket连接成功", res);
-  console.log(res.data);
       start();
     };
     // Websoket接收消息事件
     const websocketonmessage = (res) => {
-     // console.log("数据", res);
-      //logs.value=res.data;
+     
+      if(res.data.indexOf('{') !== -1){
+         arrobj.value.push(JSON.parse(res.data));
+        let vals=(JSON.parse(res.data).vals).split(",");
+        let varsobj={};
+        let valsobj={};
+        let heaarr= arrobj.value[0].vars.split(",");
+        tableHeaders.value=[];
+        // heaarr.forEach(function(item) {
+          for(i=0;i<heaarr.length;i++){
+            let obj = { label: item ,prop:item}; // 创建新对象
+             tableHeaders.value.push(obj);
+             vals.forEach((vals)=> {
+              valsobj.heaarr[i]=vals;
+              tableDatalieb.value.push(valsobj);
+        })
+          }
+          
+        
+        // });
+//         heaarr.forEach(function(item) {
+
+// });
+//         vals.forEach((item)=> {
+//           valsobj.
+
+//         })
+        valsobj={ label: item ,prop:item};
+         tablefun();
+         //console.log(   arrobj.value);
+    //    let header=(arrobj.vars).split(',');
+       
+      }else{
+        logs.value=logs.value+'"\n"'+res.data;
+        let textarea = document.getElementById("textarea_id");
+        textarea.scrollTop = textarea.scrollHeight;
+      }
     
       
       reset();
     };
+  
     // Websoket连接错误事件
     const websocketonerror = (res) => {
       console.log("连接错误", res);