|
@@ -120,6 +120,8 @@ import { request, uploadFile } from "@/utils/request";
|
|
|
import { ElMessage, ElButton, ElDialog, ElSelect } from 'element-plus'
|
|
|
import * as echarts from 'echarts'
|
|
|
import { createFireControl } from "@/control/fireControl.js";
|
|
|
+import { vtkmodel } from "@/control/vtkModel.js";
|
|
|
+import vtkDataArray from "@kitware/vtk.js/Common/Core/DataArray.js";
|
|
|
import bt4 from "@/assets/img/Group1376.png"
|
|
|
import bt1 from "@/assets/img/Group1377.png"
|
|
|
import bt3 from "@/assets/img/Group1395.png"
|
|
@@ -132,8 +134,9 @@ let firstshow = ref(false);
|
|
|
let activeNames = ref(["1"]);
|
|
|
let tableHeight = ref(130);
|
|
|
let playshow=ref(true);
|
|
|
-let showfalse=ref(false);
|
|
|
let suspendshow=ref(false);
|
|
|
+let showfalse=ref(false);
|
|
|
+
|
|
|
const isstop = ref(false);
|
|
|
let count=ref(1);
|
|
|
let starttime = ref(1);
|
|
@@ -155,6 +158,26 @@ let warnin2=ref(0);
|
|
|
const dynamicHeaders = ref([
|
|
|
|
|
|
]);
|
|
|
+const job = ref({
|
|
|
+ jid: 0, // 任务ID
|
|
|
+ aid: 0, // 事故ID
|
|
|
+ starttime: "", // 结束时间
|
|
|
+ endtime: "", // 开始时间
|
|
|
+ state: "", // 状态
|
|
|
+ faildes: "", // 失败原因
|
|
|
+ dt: "", // 时间步长
|
|
|
+ dx: "", // 空间步长
|
|
|
+ reportstep: "", // 输出步长
|
|
|
+ interactionstep: "", // 交互步长
|
|
|
+ acctime: "", // 事故开始时间
|
|
|
+ totaltime: "", // 模拟时长
|
|
|
+ coids: "", // 物理属性ID逗号分隔
|
|
|
+ cocodes: "", //物理属性code逗号分隔
|
|
|
+});
|
|
|
+const formInline = ref({
|
|
|
+ region: "shanghai",
|
|
|
+});
|
|
|
+
|
|
|
const tableData =ref( [
|
|
|
// {
|
|
|
// date: '检测点',
|
|
@@ -193,7 +216,57 @@ const indexinit= (id)=>{
|
|
|
aid.value=id;
|
|
|
fcon.step=count.value;
|
|
|
getMonitor();
|
|
|
- lineChart();
|
|
|
+ vtkmodel.clearModeAddJg();
|
|
|
+ vtkGridRead()
|
|
|
+ // readJob()
|
|
|
+
|
|
|
+}
|
|
|
+//获取任务信息
|
|
|
+async function readJob() {
|
|
|
+
|
|
|
+
|
|
|
+const params = {
|
|
|
+ transCode: "D10017",
|
|
|
+ aid: aid.value,
|
|
|
+};
|
|
|
+await request(params)
|
|
|
+ .then((res) => {
|
|
|
+ if (res.returnCode == "000000000") {
|
|
|
+ //成功
|
|
|
+ if(res.state=='1'){
|
|
|
+ // vtkmodel.clearModeAddJg(); //隐藏模版显示结果
|
|
|
+ monitor.value = true;
|
|
|
+ job.value = res;
|
|
|
+ reddate(new Date());
|
|
|
+ vtkGridRead();
|
|
|
+ endtime.value= Number(res.totaltime)/Number(res.reportstep);
|
|
|
+ console.log( endtime.value);
|
|
|
+ }else if(res.state=='-1'){
|
|
|
+ ElMessage({
|
|
|
+ message: " 求解失败",
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }else if(res.state=='0'){
|
|
|
+ ElMessage({ message: "求解未完成", type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ ElMessage({
|
|
|
+ message: res.returnMsg,
|
|
|
+ type: "error",
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ if(err.returnMsg=="任务不存在!"){
|
|
|
+ monitor.value=false;
|
|
|
+ console.log(1111)
|
|
|
+ ElMessage({
|
|
|
+ message: "未求解",
|
|
|
+ type: 'error',
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
//监测点数据获取
|
|
|
async function getMonitor() {
|
|
@@ -277,8 +350,7 @@ function Prev() {
|
|
|
count.value--;
|
|
|
fcon.step = count.value;
|
|
|
newcount.value = count.value;
|
|
|
- // vtkScalarRead();
|
|
|
- // getMonitor();
|
|
|
+
|
|
|
}
|
|
|
// 下一页
|
|
|
function increment() {
|
|
@@ -291,8 +363,7 @@ function increment() {
|
|
|
newcount.value = count.value;
|
|
|
fcon.step = count.value;
|
|
|
console.log( newcount.value );
|
|
|
- // vtkScalarRead();
|
|
|
- //getMonitor();
|
|
|
+
|
|
|
}
|
|
|
// 播放暂停
|
|
|
const play =(time)=>{
|
|
@@ -313,9 +384,7 @@ const play =(time)=>{
|
|
|
count.value++;
|
|
|
fcon.step = count.value;
|
|
|
newcount.value = count.value;
|
|
|
- // vtkScalarRead();
|
|
|
- // getMonitor();
|
|
|
- // getMonitor();
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -334,9 +403,7 @@ function sliderchange(val) {
|
|
|
newcount.value = count.value;
|
|
|
fcon.step = count.value;
|
|
|
console.log(count.value);
|
|
|
- // console.log(count.value);
|
|
|
- // vtkScalarRead();
|
|
|
- // getMonitor();
|
|
|
+
|
|
|
}
|
|
|
const tableRowClassName=()=>{
|
|
|
|
|
@@ -501,25 +568,117 @@ const lineChart=()=>{
|
|
|
// 让图表自适应大小
|
|
|
myChart.resize();
|
|
|
};
|
|
|
+}
|
|
|
+function reddate(date) {
|
|
|
+ //当前时间
|
|
|
+ const timestamp = date.getTime();
|
|
|
+ // newtime.value = timestampToTime(timestamp);
|
|
|
+ const accstamp = Date.parse(job.value.acctime);
|
|
|
+ var timeDifference = parseInt((timestamp - accstamp) / 1000);
|
|
|
+ fcon.stepsum = parseInt(job.value.totaltime) / parseInt(job.value.reportstep);
|
|
|
+ max.value = fcon.stepsum;
|
|
|
+ if (timeDifference < parseInt(job.value.totaltime)) {
|
|
|
+ //最长时间范围
|
|
|
+ fcon.step = parseInt(timeDifference / parseInt(job.value.reportstep));
|
|
|
+ } else {
|
|
|
+ fcon.step = fcon.stepsum;
|
|
|
+ }
|
|
|
+ count.value = fcon.step;
|
|
|
+ newcount.value = count.value;
|
|
|
+}
|
|
|
+function velocityRead() {
|
|
|
+ return;
|
|
|
+ // clearInterval(arrowtime.value);
|
|
|
+ fcon
|
|
|
+ .getVelocityByStep(fcon.step)
|
|
|
+ .then((result) => {
|
|
|
+ vtkmodel.addArrow(fcon.velocitys);
|
|
|
+ // arrowtimeStart();
|
|
|
+ })
|
|
|
+ .catch((err) => {
|
|
|
+ console.log(err);
|
|
|
+ });
|
|
|
+}
|
|
|
+function getMinMax(scalars) {
|
|
|
+ // console.log("getMinMax:",scalars);
|
|
|
+ min.value = scalars[0];
|
|
|
+ max.value = scalars[0];
|
|
|
+ for (let index = 0; index <= scalars.length; index++) {
|
|
|
+ let scalar = scalars[index];
|
|
|
+ if (min.value > scalar) {
|
|
|
+ min.value = scalar;
|
|
|
+ }
|
|
|
+ if (max.value < scalar) {
|
|
|
+ max.value = scalar;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // console.log("max,min:", max.value, min.value);
|
|
|
+}
|
|
|
+function vtkShow() {
|
|
|
+
|
|
|
+ const scalarBarActor = vtkmodel.scalarBarActor;
|
|
|
+ const mapper = vtkmodel.jgMapper;
|
|
|
+ const actor = vtkmodel.jgActor;
|
|
|
+
|
|
|
+ // console.log(formInline.value.region);
|
|
|
+
|
|
|
+ if (!fcon.scalar) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ const scalarArray = fcon.scalar.get(formInline.value.region);
|
|
|
+ console.log("执行了");
|
|
|
+ if (!scalarArray || !fcon.polydata) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // console.log("scalarArray:", scalarArray);
|
|
|
+ const dataArray = vtkDataArray.newInstance({
|
|
|
+ name: formInline.value.region,
|
|
|
+ size: fcon.polydata.getNumberOfPoints(),
|
|
|
+ });
|
|
|
+ // console.log(dataArray);
|
|
|
+ dataArray.setData(scalarArray);
|
|
|
+ fcon.polydata.getPointData().setScalars(dataArray);
|
|
|
+ // fcon.polydata.getPointData().setOpacity(dataArray);
|
|
|
+ mapper.setInputData(fcon.polydata);
|
|
|
+ getMinMax(scalarArray);
|
|
|
+ mapper.setScalarRange(
|
|
|
+ parseFloat(min.value.toFixed(3)),
|
|
|
+ parseFloat(max.value.toFixed(3))
|
|
|
+ ); //设置范围
|
|
|
+ // actor.setMapper(mapper);
|
|
|
+ scalarBarActor.setAxisLabel(formInline.value.region);
|
|
|
+ mapper.clearColorArrays(); //强制重建颜色
|
|
|
+ actor.getProperty().setOpacity(count.value); //设置错误的透明度使得页面重新加载 不设置不刷新页面
|
|
|
+ actor.getProperty().setOpacity(0.5);
|
|
|
+ // vtkmodel.renderer.resetCamera();
|
|
|
+ vtkmodel.renderWindow.render();
|
|
|
|
|
|
-
|
|
|
-// // 监听窗口大小变化
|
|
|
-// myChart.dispatchAction({ //设置激活第一个选项
|
|
|
-// type: 'showTip',
|
|
|
-// seriesIndex: 0,
|
|
|
-// dataIndex: 0
|
|
|
-// });
|
|
|
+}
|
|
|
+
|
|
|
+function vtkGridRead() {
|
|
|
+ fcon.aid = aid.value;
|
|
|
+ fcon
|
|
|
+ .initGemetry()
|
|
|
+ .then((result) => {
|
|
|
+ console.log(result);
|
|
|
+ vtkScalarRead();
|
|
|
+
|
|
|
+ })
|
|
|
+ .catch((err) => {});
|
|
|
}
|
|
|
function vtkScalarRead() {
|
|
|
fcon
|
|
|
.getScalrsByStep(fcon.step)
|
|
|
.then((result) => {
|
|
|
- // console.log(fcon.scalar);
|
|
|
+ console.log(fcon.scalar);
|
|
|
+ console.log(123444);
|
|
|
velocityRead() ;
|
|
|
vtkShow();
|
|
|
})
|
|
|
.catch((err) => {
|
|
|
- console.log(err);
|
|
|
+ // console.log(err);
|
|
|
});
|
|
|
}
|
|
|
watch(
|
|
@@ -528,7 +687,7 @@ watch(
|
|
|
console.log("值改变了", newVal, oldVal);
|
|
|
fcon.step = newVal;
|
|
|
getMonitor();
|
|
|
- vtkScalarRead();
|
|
|
+ vtkScalarRead();
|
|
|
|
|
|
},
|
|
|
{ deep: true }
|