|
@@ -248,16 +248,31 @@
|
|
|
<div class="btn" :class="{chuactive: isActive === 3}" @click="changeClass(3)" ><span class="spantext" >停止计算</span></div>
|
|
|
<div class="btn" :class="{chuactive: isActive === 2}" @click="changeClass(2)"><span class="spantext" @click="calculate();">开始计算</span></div>
|
|
|
</div>
|
|
|
-
|
|
|
- <div class=" logs" >
|
|
|
+ <div class=" logs">
|
|
|
<div class="logs_pading">
|
|
|
- <h4>模拟日志</h4>
|
|
|
- <div class="footerTextBox">
|
|
|
+ <h4>模拟日志
|
|
|
+
|
|
|
+ </h4>
|
|
|
+ <div class="lookdiv"><span class="lookrz" @click="lookclick()">{{looktxt }}</span></div>
|
|
|
+ <el-progress :percentage="percentage" />
|
|
|
+ <div class="footerTextBox" v-show="rizhishow" >
|
|
|
<el-input class="footerText" type="textarea" id="textarea_id"
|
|
|
v-model="rizhi.logs"></el-input>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <!-- <div class=" logs" >
|
|
|
+ <div class="logs_pading">
|
|
|
+ <h4>模拟日志
|
|
|
+ <span></span>
|
|
|
+ </h4>
|
|
|
+ <el-progress :percentage="percentage" />
|
|
|
+ <div class="footerTextBox">
|
|
|
+ <el-input class="footerText" type="textarea" id="textarea_id"
|
|
|
+ v-model="rizhi.logs"></el-input>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div> -->
|
|
|
</el-form>
|
|
|
|
|
|
</div>
|
|
@@ -347,8 +362,12 @@
|
|
|
|
|
|
<div class=" logs">
|
|
|
<div class="logs_pading">
|
|
|
- <h4>模拟日志</h4>
|
|
|
- <div class="footerTextBox">
|
|
|
+ <h4>模拟日志
|
|
|
+
|
|
|
+ </h4>
|
|
|
+ <div class="lookdiv"><span class="lookrz" @click="lookclick()">{{looktxt }}</span></div>
|
|
|
+ <el-progress :percentage="percentage" />
|
|
|
+ <div class="footerTextBox" v-show="rizhishow" >
|
|
|
<el-input class="footerText" type="textarea" id="textarea_id"
|
|
|
v-model="rizhi.logs"></el-input>
|
|
|
</div>
|
|
@@ -453,6 +472,8 @@ import { vtkmodel } from "@/control/vtkModel.js";
|
|
|
import emitter from "@/utils/emitter";
|
|
|
import { useRoute } from 'vue-router';
|
|
|
const route = useRoute();
|
|
|
+let percentage=ref(0)
|
|
|
+//const format = (percentage) => (percentage === 100 ? 'Full' : `${percentage}%`)
|
|
|
const changeModel= ()=> {
|
|
|
vtkmodel.clearJgAddMode();
|
|
|
vtkmodel.renderWindow.render();
|
|
@@ -609,6 +630,8 @@ let tuiyanobj5 = ref({
|
|
|
let tableobj = ref({});
|
|
|
let coolactiveName = ref(["1", "2"]);
|
|
|
let newlog = ref("");
|
|
|
+let looktxt=ref("查看日志");
|
|
|
+let rizhishow=ref(false);
|
|
|
let rizhi = ref({
|
|
|
top: "50px",
|
|
|
logs: '',
|
|
@@ -1023,14 +1046,10 @@ const initial = () => {
|
|
|
|
|
|
}
|
|
|
const addinitial=()=>{
|
|
|
- console.log(classradio.value);
|
|
|
if (classradio.value == "Fire") {
|
|
|
tuiyanobj2.value.pickertime = inititimeDefaultal();
|
|
|
tuiyanobj2.value.acctime = inititimeDefaultal();
|
|
|
- tuiyanobj2.value.cocodes = options.value[0].code;
|
|
|
- tuiyanobj2.value.coids=options.value[0].coid;
|
|
|
tuiyanobj.value = { ...tuiyanobj2.value }
|
|
|
- console.log( tuiyanobj.value)
|
|
|
arrvalue.value=tuiyanobj.value.cocodes.split(',');
|
|
|
value.value=arrvalue.value;
|
|
|
value.value=[];
|
|
@@ -1051,7 +1070,7 @@ const addinitial=()=>{
|
|
|
tuiyanobj.value ={ ...tuiyanobj4.value }
|
|
|
arrvalue.value=tuiyanobj.value.cocodes.split(',');
|
|
|
value.value=arrvalue.value;
|
|
|
- value.value=[];
|
|
|
+ value.value=[];
|
|
|
for (let i = 0; i <options.value.length; i++){
|
|
|
for (let j = 0; j < arrvalue.value.length; j++){
|
|
|
if(options.value[i].code==arrvalue.value[j]){
|
|
@@ -1059,14 +1078,10 @@ const addinitial=()=>{
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}else if(classradio.value == "Gass1"){
|
|
|
tuiyanobj5.value.pickertime = inititimeDefaultal();
|
|
|
tuiyanobj5.value.acctime = inititimeDefaultal();
|
|
|
- tuiyanobj5.value.cocodes = options.value[0].code;
|
|
|
- tuiyanobj5.value.coids=options.value[0].coid;
|
|
|
tuiyanobj.value ={ ...tuiyanobj5.value }
|
|
|
- console.log( tuiyanobj.value);
|
|
|
arrvalue.value=tuiyanobj.value.cocodes.split(',');
|
|
|
value.value=arrvalue.value;
|
|
|
value.value=[];
|
|
@@ -1106,6 +1121,8 @@ const selectchange = (val) => {
|
|
|
}
|
|
|
//推演的开始计算
|
|
|
const calculate = () => {
|
|
|
+ percentage.value=0;
|
|
|
+ ElMessage.success('开始计算中....')
|
|
|
vtkmodel.clearJgAddMode();
|
|
|
vtkmodel.renderWindow.render();
|
|
|
rizhi.value.logs='';
|
|
@@ -1137,8 +1154,18 @@ const projectsSelectionSelect = () => {
|
|
|
}
|
|
|
// 日志获取
|
|
|
function getthislog(val) {
|
|
|
+ // console.log(val);
|
|
|
if (val.includes("msg=heartCheck")) {
|
|
|
} else {
|
|
|
+ if(val.includes("%")){
|
|
|
+ if(val.includes("100%")){
|
|
|
+ percentage.value=100;
|
|
|
+ }else{
|
|
|
+ let nums=extractPercentage(val);
|
|
|
+ let num=parseFloat(nums);
|
|
|
+ percentage.value=num;
|
|
|
+ }
|
|
|
+ }
|
|
|
newlog.value = newlog.value + "\n" + val;
|
|
|
rizhi.value.logs = newlog.value;
|
|
|
|
|
@@ -1158,15 +1185,58 @@ async function fetchFileContent() {
|
|
|
await request(params)
|
|
|
.then((res) => {
|
|
|
if (res.returnCode == "000000000") {
|
|
|
- getthislog(res.logs);
|
|
|
+ let arr = res.logs.split('Calculating................................');
|
|
|
+ for(let i=1;i<arr.length;i++){
|
|
|
+ let nums1= arr[i].replace(/(\r\n|\n|\r)/gm, "");
|
|
|
+ if(nums1.indexOf("100%")>1){
|
|
|
+ console.log(111)
|
|
|
+ var index1 = nums1.indexOf("100%");
|
|
|
+ var result = nums1.substring(index1, index1 + "100%".length);
|
|
|
+ arr[i]=result;
|
|
|
+ }
|
|
|
+ let nums= extractNumberBeforePercent(arr[i]);
|
|
|
+ let num=parseFloat(nums);
|
|
|
+ if(arr[i].includes("%")){
|
|
|
+ percentage.value=num;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(res.logs.includes('求解——————————————————成功')){
|
|
|
+ percentage.value=100;
|
|
|
+ }else{
|
|
|
+
|
|
|
+ }
|
|
|
+ newlog.value = newlog.value + "\n" + res.logs;
|
|
|
+ rizhi.value.logs = newlog.value;
|
|
|
+
|
|
|
} else {
|
|
|
+
|
|
|
+ percentage.value=0;
|
|
|
ElMessage({
|
|
|
message: res.returnMsg,
|
|
|
type: "error",
|
|
|
});
|
|
|
}
|
|
|
})
|
|
|
- .catch((err) => { });
|
|
|
+ .catch((err) => {
|
|
|
+ percentage.value=0;
|
|
|
+ });
|
|
|
+}
|
|
|
+// 百分号截取
|
|
|
+
|
|
|
+function extractPercentage(str) {
|
|
|
+ const lastIndex = str.lastIndexOf("..");
|
|
|
+ if (lastIndex === -1) {
|
|
|
+ return null; // 没有找到".."
|
|
|
+ }
|
|
|
+ const numberPattern = (/^[\d.]+%?/);
|
|
|
+ const match = str.slice(lastIndex + 2).match(numberPattern);
|
|
|
+ return match ? match[0] : null; // 返回数字或null
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+function extractNumberBeforePercent(str) {
|
|
|
+ const match = str.match(/^[\d.]+%?/);
|
|
|
+ return match ? match[0].replace(/%$/, '') : null;
|
|
|
}
|
|
|
// 日志
|
|
|
function initWebSocket() {
|
|
@@ -1197,12 +1267,15 @@ const websocketonmessage = (res) => {
|
|
|
// rewu()
|
|
|
emit('websockfrist');
|
|
|
}
|
|
|
+ // if(rval.includes("100%")){
|
|
|
+ // emit('websockfrist');
|
|
|
+ // }
|
|
|
reset();
|
|
|
};
|
|
|
// Websoket连接错误事件
|
|
|
const websocketonerror = (res) => {
|
|
|
console.log("连接错误", res);
|
|
|
- initWebSocket();
|
|
|
+ // initWebSocket();
|
|
|
|
|
|
};
|
|
|
// Websoket断开事件
|
|
@@ -1248,6 +1321,13 @@ const start = () => {
|
|
|
}, times.value.timeout);
|
|
|
}, times.value.timeout);
|
|
|
}
|
|
|
+const lookclick=()=>{
|
|
|
+ rizhishow.value=!rizhishow.value;
|
|
|
+ looktxt.value=rizhishow.value?'收起日志':'查看日志'
|
|
|
+
|
|
|
+ // rizhishow.value =true;
|
|
|
+
|
|
|
+}
|
|
|
// 组件被销毁之前,清空 sock 对象
|
|
|
onBeforeUnmount(() => {
|
|
|
// 关闭连接
|