|
@@ -66,17 +66,10 @@
|
|
|
@pagination="getList" />
|
|
|
|
|
|
<!-- 添加或修改测量环境数据对话框 -->
|
|
|
- <el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
|
|
|
+ <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="70%" append-to-body >
|
|
|
<dialogContent ref="dialogContent" :form="form" :TIForm="TIForm" :TransmittanceForm="TransmittanceForm" :envSaveBtn="true" :radiationForm="radiationForm" :isCheck="isCheck" :addFlag="addFlag" :engineModelList="engineOptions" :measureBatchList="measureBatchOptions" :angleList="angleOptions" :engineStatusList="engineStatusOptions" @env-data-save="envDataSave" @on-click-btn="onClickBtn" @submit-form="submitForm" @cancel="cancel"/>
|
|
|
- <!-- <div v-if="!isCheck" slot="footer" class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm">确 定</el-button>
|
|
|
- <el-button @click="cancel">取 消</el-button>
|
|
|
- </div> -->
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="增加发动机型号" :visible.sync="addDialogVisible" width="400px" append-to-body>
|
|
|
- <!-- <el-input v-model="engineModel" placeholder="请输入发动机型号">
|
|
|
- <template slot="prepend">发动机型号</template>
|
|
|
- </el-input> -->
|
|
|
+ <el-dialog :close-on-click-modal="false" title="增加发动机型号" :visible.sync="addDialogVisible" width="400px" append-to-body>
|
|
|
<el-form ref="addEngineForm" :model="addEngineForm" :disabled="isCheck" :rules="rules" label-width="100px">
|
|
|
<el-form-item label="发动机型号" prop="model">
|
|
|
<el-input v-model="addEngineForm.model" placeholder="请输入发动机型号" />
|
|
@@ -93,7 +86,7 @@
|
|
|
<el-button @click="addDialogVisible = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="增加测量批次" :visible.sync="addMeasVisible" width="400px" append-to-body>
|
|
|
+ <el-dialog :close-on-click-modal="false" title="增加测量批次" :visible.sync="addMeasVisible" width="400px" append-to-body>
|
|
|
<el-form ref="form" :model="addMeasBatchForm" :rules="rules" label-width="110px">
|
|
|
<el-form-item label="发动机型号" prop="engineId">
|
|
|
<el-select v-model="addMeasBatchForm.engineId" placeholder="请选择发动机型号" @change="engineChange">
|
|
@@ -112,7 +105,7 @@
|
|
|
<el-button @click="addMeasVisible = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="增加发动机状态" :visible.sync="addStatusVisible" width="400px" append-to-body>
|
|
|
+ <el-dialog :close-on-click-modal="false" title="增加发动机状态" :visible.sync="addStatusVisible" width="400px" append-to-body>
|
|
|
<el-form ref="addStatusForm" :model="addStatusForm" :rules="rules" label-width="80px">
|
|
|
<el-form-item label="状态" prop="status">
|
|
|
<el-input v-model="addStatusForm.status" placeholder="请输入状态" />
|
|
@@ -126,7 +119,7 @@
|
|
|
<el-button @click="addStatusVisible = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="增加发动机角度" :visible.sync="addAngleVisible" width="400px" append-to-body>
|
|
|
+ <el-dialog :close-on-click-modal="false" title="增加发动机角度" :visible.sync="addAngleVisible" width="400px" append-to-body>
|
|
|
<el-form ref="addAngleForm" :model="addAngleForm" :rules="rules" label-width="80px">
|
|
|
<el-form-item label="角度" prop="angle">
|
|
|
<el-input v-model="addAngleForm.angle" placeholder="请输入角度" />
|
|
@@ -137,9 +130,7 @@
|
|
|
<el-button @click="addAngleVisible = false">取 消</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="数据可视化" :visible.sync="fileVisible" width="70%" append-to-body>
|
|
|
- <ECharts :class="chartType === 'heatmap'?'heatmapChart':''" :chartData="chartData" :width="chartType === 'heatmap'?'400px':'100%'" />
|
|
|
- </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -180,12 +171,12 @@ import {
|
|
|
} from "@/api/meas/transmissionRate";
|
|
|
import { angleOption,addAngle } from "@/api/meas/angle";
|
|
|
import { statusOption,addStatus } from "@/api/meas/status";
|
|
|
-import ECharts from "./ECharts.vue";
|
|
|
+
|
|
|
import dialogContent from "@/views/meas/components/dialogContent";
|
|
|
|
|
|
export default {
|
|
|
name: "EnvData",
|
|
|
- components: { ECharts,dialogContent},
|
|
|
+ components: { dialogContent},
|
|
|
data() {
|
|
|
return {
|
|
|
// 遮罩层
|
|
@@ -210,7 +201,6 @@ export default {
|
|
|
addMeasVisible: false,
|
|
|
addStatusVisible: false,
|
|
|
addAngleVisible: false,
|
|
|
- fileVisible: false,
|
|
|
// 查询参数
|
|
|
queryParams: {
|
|
|
pageNum: 1,
|
|
@@ -265,9 +255,8 @@ export default {
|
|
|
},
|
|
|
fileShowData: [],
|
|
|
disabled: false,
|
|
|
- chartData: {},
|
|
|
- chartType: "",
|
|
|
- addFlag:false
|
|
|
+ addFlag:false,
|
|
|
+ formIsChange:false
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
@@ -330,7 +319,6 @@ export default {
|
|
|
envDataSave(val) {
|
|
|
// 保存环境参数,返回一个环境数据ID
|
|
|
val.validate((valid) => {
|
|
|
- console.log("11", valid, this.form);
|
|
|
if (valid) {
|
|
|
if (this.form.id != null) {
|
|
|
updateEnvData(this.form).then((response) => {
|
|
@@ -512,15 +500,12 @@ export default {
|
|
|
const id = row.measurementBatchId;
|
|
|
getRadiationByEnvData(id).then((response) => {
|
|
|
this.radiationForm = response.data;
|
|
|
- console.log("this.radiationForm",this.radiationForm);
|
|
|
});
|
|
|
getTIDataByEnvData(id).then((response) => {
|
|
|
this.TIForm = response.data;
|
|
|
- console.log("this.TIForm",this.TIForm);
|
|
|
});
|
|
|
getTRateByEnvData(id).then((response) => {
|
|
|
this.TransmittanceForm = response.data;
|
|
|
- console.log("this.TransmittanceForm",this.TransmittanceForm);
|
|
|
});
|
|
|
getEnvData(row.id).then((response) => {
|
|
|
this.form = response.data;
|
|
@@ -529,27 +514,71 @@ export default {
|
|
|
});
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
- submitForm(value) {
|
|
|
- console.log(value);
|
|
|
+ submitForm(value,changeFlag) {
|
|
|
+ console.log("changeFlag",changeFlag);
|
|
|
value['formData'].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
- if (value['formData']['_props']['model']['id'] != null) {
|
|
|
- updateRadiation(value['radiationData']['_props']['model']).then((response) => { });
|
|
|
- updateThermalImagerTesDdata(value['TIData']['_props']['model']).then((response) => { });
|
|
|
- updateTransmissionRate(value['TransmittanceData']['_props']['model']).then(
|
|
|
- (response) => { }
|
|
|
- );
|
|
|
- updateEnvData(value['formData']['_props']['model']).then((response) => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
+ if (valid && changeFlag.includes(1)) {
|
|
|
+ if (this.form.id!= null) {
|
|
|
+ updateEnvData(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("修改测量环境数据成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
|
} else {
|
|
|
- addRadiation(value['radiationData']['_props']['model']).then((response) => { });
|
|
|
- addThermalImagerTesDdata(value['TIData']['_props']['model']).then((response) => { });
|
|
|
- addTransmissionRate(value['TransmittanceData']['_props']['model']).then((response) => { });
|
|
|
- addEnvData(value['formData']['_props']['model']).then((response) => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
+ addEnvData(this.form).then((response) => {
|
|
|
+ this.$modal.msgSuccess("新增测量环境数据成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ value["radiationData"].validate(valid => {
|
|
|
+ console.log("22",this.radiationForm);
|
|
|
+ if (valid && changeFlag.includes(2)) {
|
|
|
+ if (this.radiationForm.id != null) {
|
|
|
+ updateRadiation(this.radiationForm).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改光谱辐射数据成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addRadiation(this.radiationForm).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增光谱辐射数据成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ value["TIData"].validate(valid => {
|
|
|
+ if (valid && changeFlag.includes(3)) {
|
|
|
+ if (this.TIForm.id != null) {
|
|
|
+ updateThermalImagerTesDdata(this.TIForm).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改热像仪数据成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addThermalImagerTesDdata(this.TIForm).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增热像仪数据成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ value["TransmittanceData"].validate(valid => {
|
|
|
+ if (valid && changeFlag.includes(4)) {
|
|
|
+ if (this.TransmittanceForm.id != null) {
|
|
|
+ updateTransmissionRate(this.TransmittanceForm).then(response => {
|
|
|
+ this.$modal.msgSuccess("修改透过率数据成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addTransmissionRate(this.TransmittanceForm).then(response => {
|
|
|
+ this.$modal.msgSuccess("新增透过率数据成功");
|
|
|
this.open = false;
|
|
|
this.getList();
|
|
|
});
|
|
@@ -557,6 +586,19 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ objectsAreEqual(obj1, obj2) {
|
|
|
+ const obj1Keys = Object.keys(obj1);
|
|
|
+ const obj2Keys = Object.keys(obj2);
|
|
|
+ if (obj1Keys.length !== obj2Keys.length) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (let key of obj1Keys) {
|
|
|
+ if (obj1[key] !== obj2[key]) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ },
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|
|
@@ -581,170 +623,7 @@ export default {
|
|
|
`envData_${new Date().getTime()}.xlsx`
|
|
|
);
|
|
|
},
|
|
|
- // 查看文件可视化
|
|
|
- fileView(url1) {
|
|
|
- const url = `${process.env.VUE_APP_BASE_API}${url1}`;
|
|
|
- this.fetchLogFile(url)
|
|
|
- .then((text) => {
|
|
|
- this.fileShowData = text.split("\r\n");
|
|
|
- this.handleLineChart(this.fileShowData);
|
|
|
- this.fileVisible = true;
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- console.error("Failed to fetch the log file:", error);
|
|
|
- this.$modal.msgSuccess("文件读取错误");
|
|
|
- });
|
|
|
- },
|
|
|
- fileView2(url1) {
|
|
|
- const url = `${process.env.VUE_APP_BASE_API}${url1}`;
|
|
|
- this.fetchLogFile(url)
|
|
|
- .then((text) => {
|
|
|
- this.fileShowData = text.split("\r\n");
|
|
|
- this.handleHeatmapChart(this.fileShowData);
|
|
|
- this.fileVisible = true;
|
|
|
- })
|
|
|
- .catch((error) => {
|
|
|
- console.error("Failed to fetch the log file:", error);
|
|
|
- this.$modal.msgSuccess("文件读取错误");
|
|
|
- });
|
|
|
- },
|
|
|
- // 读取文件内容
|
|
|
- async fetchLogFile(url) {
|
|
|
- try {
|
|
|
- const response = await fetch(url, { method: "GET" });
|
|
|
- if (!response.ok) {
|
|
|
- throw new Error(`HTTP error! status: ${response.status}`);
|
|
|
- }
|
|
|
- return await response.text();
|
|
|
- } catch (error) {
|
|
|
- throw error;
|
|
|
- }
|
|
|
- },
|
|
|
- // echarts数据
|
|
|
- handleLineChart(data) {
|
|
|
- this.chartType = "line";
|
|
|
- const data1 = data[0].replace(/\s+/g, " ").split(" ");
|
|
|
- const customName= data1.map(label => ({ [label + 'Data']: [] }))
|
|
|
- let yAxis=[],series=[]
|
|
|
- for (let i = 1; i < data.length; i++) {
|
|
|
- let row = data[i].split("\t");
|
|
|
- customName.forEach((item,index)=>{
|
|
|
- for (let key in item){
|
|
|
- item[key].push(parseFloat(row[index]))
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- console.log("customName",customName);
|
|
|
- // delete data1[Object.keys(data1)[0]]
|
|
|
- customName.forEach((item,index)=>{
|
|
|
- if(index===0) return
|
|
|
- else{
|
|
|
- yAxis.push({
|
|
|
- type: "value",
|
|
|
- name: data1[index],
|
|
|
- position: index===1?'left':'right',
|
|
|
- alignTicks: true,
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- },
|
|
|
- })
|
|
|
- series.push({
|
|
|
- name: data1[index],
|
|
|
- type: "line",
|
|
|
- data: item[Object.keys(item)[0]],
|
|
|
- },)
|
|
|
- }
|
|
|
- })
|
|
|
- console.log("11",Object.values(customName[0])[0]);
|
|
|
- const chartData = {
|
|
|
- tooltip: {
|
|
|
- trigger: "axis",
|
|
|
- axisPointer: {
|
|
|
- type: "cross",
|
|
|
- },
|
|
|
- },
|
|
|
- xAxis: [
|
|
|
- {
|
|
|
- type: "category",
|
|
|
- name:data1[0],
|
|
|
- axisTick: {
|
|
|
- alignWithLabel: true,
|
|
|
- },
|
|
|
- axisLine: {
|
|
|
- show: true,
|
|
|
- },
|
|
|
-
|
|
|
- data: Object.values(customName[0])[0] ,
|
|
|
- },
|
|
|
- ],
|
|
|
- yAxis: yAxis,
|
|
|
- series: series,
|
|
|
- };
|
|
|
- this.chartData=JSON.parse(JSON.stringify(chartData))
|
|
|
- },
|
|
|
- handleHeatmapChart(data) {
|
|
|
- this.chartType = "heatmap";
|
|
|
- // console.log("data",data);
|
|
|
- let dataSet = [],
|
|
|
- xData = [],
|
|
|
- yData = [];
|
|
|
- let min = Infinity; // 初始化最小值为无穷大
|
|
|
- let max = -Infinity; // 初始化最大值为负无穷大
|
|
|
- const num = Math.ceil(Math.sqrt(data.length));
|
|
|
- for (let i = 0; i < num; i++) {
|
|
|
- xData.push(i);
|
|
|
- }
|
|
|
- let x = 0,
|
|
|
- y = 0;
|
|
|
- for (let i = 15; i < data.length; i++) {
|
|
|
- let row = parseFloat(data[i].split(","));
|
|
|
- dataSet.push([y++, x, parseFloat(row)]);
|
|
|
- if (row > max) max = row;
|
|
|
- if (row < min) min = row;
|
|
|
- if (y === num) {
|
|
|
- yData.push(x);
|
|
|
- x++;
|
|
|
- y = 0;
|
|
|
- }
|
|
|
- }
|
|
|
- console.log("dataSet", dataSet);
|
|
|
- const chartData = {
|
|
|
- tooltip: {},
|
|
|
- xAxis: {
|
|
|
- type: "category",
|
|
|
- data: xData,
|
|
|
- },
|
|
|
- yAxis: {
|
|
|
- type: "category",
|
|
|
- data: yData,
|
|
|
- },
|
|
|
- visualMap: {
|
|
|
- min: min,
|
|
|
- max: max,
|
|
|
- calculable: true,
|
|
|
- precision: 4,
|
|
|
- inRange: {
|
|
|
- color: ["#FFFFFF", "#000000"],
|
|
|
- },
|
|
|
- },
|
|
|
- series: [
|
|
|
- {
|
|
|
- name: "辐射亮度",
|
|
|
- type: "heatmap",
|
|
|
- data: dataSet,
|
|
|
- emphasis: {
|
|
|
- itemStyle: {
|
|
|
- borderColor: "#333",
|
|
|
- borderWidth: 1,
|
|
|
- },
|
|
|
- },
|
|
|
- progressive: 1000,
|
|
|
- animation: false,
|
|
|
- },
|
|
|
- ],
|
|
|
- };
|
|
|
- this.chartData=JSON.parse(JSON.stringify(chartData))
|
|
|
- },
|
|
|
+
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
@@ -765,11 +644,6 @@ export default {
|
|
|
font-size: 1rem;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-.heatmapChart {
|
|
|
- transform: translateX(80%);
|
|
|
-}
|
|
|
-
|
|
|
::v-deep .el-form-item .el-select {
|
|
|
width: 200px;
|
|
|
}
|
|
@@ -781,4 +655,9 @@ export default {
|
|
|
::v-deep .el-form-item .upload-file {
|
|
|
width: 200px;
|
|
|
}
|
|
|
+// ::v-deep .el-form-item__label {
|
|
|
+// position: relative; /* 设置相对定位作为星号的定位基准 */
|
|
|
+// text-align: justify;
|
|
|
+// text-align-last: justify; /* 确保最后一行也两端对齐 */
|
|
|
+// }
|
|
|
</style>
|