修改后端API,完成天然气差压式计算,
This commit is contained in:
parent
399b0456d0
commit
150d195f23
@ -3,7 +3,18 @@ import request from '@/utils/request'
|
|||||||
// 天然气物性参数计算
|
// 天然气物性参数计算
|
||||||
export function calcNGPar(data) {
|
export function calcNGPar(data) {
|
||||||
return request({
|
return request({
|
||||||
url: '/NGCalcTools/calculate',
|
url: '/NGCalcTools/ngCalc',
|
||||||
|
method: 'post',
|
||||||
|
data: data,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
// 天然气物性参数计算
|
||||||
|
export function calcFlow(data) {
|
||||||
|
return request({
|
||||||
|
url: '/flowCalcTools/flowCalc',
|
||||||
method: 'post',
|
method: 'post',
|
||||||
data: data,
|
data: data,
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -111,6 +111,7 @@ export default {
|
|||||||
const result = this.calculateSum(newVal);
|
const result = this.calculateSum(newVal);
|
||||||
this.sumzf = result.sum;
|
this.sumzf = result.sum;
|
||||||
const valuesStr = result.valuesStr;
|
const valuesStr = result.valuesStr;
|
||||||
|
console.log(this.sumzf, valuesStr);
|
||||||
const diff = Math.abs(this.sumzf - 100);
|
const diff = Math.abs(this.sumzf - 100);
|
||||||
if (diff < 0.0001) {
|
if (diff < 0.0001) {
|
||||||
this.$emit('update:strZf', valuesStr);
|
this.$emit('update:strZf', valuesStr);
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<div>
|
<div>
|
||||||
<button @click="calc">计算组分参数</button>
|
<button @click="calc" type="primary" class="animated-button">计算组分参数</button>
|
||||||
|
<button @click="calcFlow" type="primary" class="animated-button">计算流量</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-tabs v-model="activeTab">
|
<el-tabs v-model="activeTab">
|
||||||
@ -10,7 +11,7 @@
|
|||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
|
|
||||||
<el-tab-pane label="天然气组分" name="ngComponents">
|
<el-tab-pane label="天然气组分" name="ngComponents">
|
||||||
<ngComponents v-model="componentString" />
|
<ngComponents v-model="parentMeterPar.dngComponents" />
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
<el-tab-pane label="流量计算结果" name="meterresult">
|
<el-tab-pane label="流量计算结果" name="meterresult">
|
||||||
<meterResult v-model:meterResult="parentMeterResult" />
|
<meterResult v-model:meterResult="parentMeterResult" />
|
||||||
@ -24,7 +25,7 @@ import meterPar from '@/components/NGTools/meterPar';
|
|||||||
import ngComponents from '@/components/NGTools/NGCom';
|
import ngComponents from '@/components/NGTools/NGCom';
|
||||||
import meterResult from '@/components/NGTools/meterResult';
|
import meterResult from '@/components/NGTools/meterResult';
|
||||||
|
|
||||||
import { calcNGPar } from '@/api/ngtools/NGCalcTools.js';
|
import { calcNGPar, calcFlow } from '@/api/ngtools/NGCalcTools.js';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TabbedComponentWrapper',
|
name: 'TabbedComponentWrapper',
|
||||||
@ -46,7 +47,7 @@ export default {
|
|||||||
dtbE: 0,
|
dtbE: 0,
|
||||||
dPatm: 0.101325,
|
dPatm: 0.101325,
|
||||||
dPatmUnit: 2,
|
dPatmUnit: 2,
|
||||||
dngComponents: this.componentString,
|
dngComponents: '',
|
||||||
dMeterType: '0',
|
dMeterType: '0',
|
||||||
dCoreType: '0',
|
dCoreType: '0',
|
||||||
dPtmode: '0',
|
dPtmode: '0',
|
||||||
@ -129,11 +130,40 @@ export default {
|
|||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.error('Request error:', error);
|
console.error('Request error:', error);
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
calcFlow() {
|
||||||
|
console.log(this.parentMeterPar);
|
||||||
|
calcFlow(this.parentMeterPar)
|
||||||
|
.then((res) => {
|
||||||
|
console.log('Response:', res);
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
console.error('Request error:', error);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
/* 可按需添加样式 */
|
.animated-button {
|
||||||
|
background-color: #007bff;
|
||||||
|
color: white;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border: none;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
margin-right: 10px;
|
||||||
|
transition: background-color 0.3s ease;
|
||||||
|
}
|
||||||
|
.animated-button:last-child {
|
||||||
|
margin-right: 0;
|
||||||
|
}
|
||||||
|
.animated-button:hover {
|
||||||
|
background-color: #0056b3;
|
||||||
|
transform: scale(1.05);
|
||||||
|
}
|
||||||
|
.animated-button:active {
|
||||||
|
transform: scale(0.95);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Loading…
Reference in New Issue
Block a user