修改后端API,完成天然气差压式计算,
This commit is contained in:
parent
399b0456d0
commit
f265214459
@ -40,7 +40,7 @@
|
||||
"@riophae/vue-treeselect": "0.4.0",
|
||||
"axios": "0.28.1",
|
||||
"clipboard": "2.0.8",
|
||||
"core-js": "3.37.1",
|
||||
"core-js": "^3.40.0",
|
||||
"echarts": "5.4.0",
|
||||
"element-ui": "2.15.14",
|
||||
"file-saver": "2.0.5",
|
||||
|
@ -3,7 +3,18 @@ import request from '@/utils/request'
|
||||
// 天然气物性参数计算
|
||||
export function calcNGPar(data) {
|
||||
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',
|
||||
data: data,
|
||||
headers: {
|
||||
|
@ -1,164 +1,242 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form>
|
||||
<el-row>
|
||||
<!-- 常用组分选择框 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="常用组分">
|
||||
<el-select v-model="selectedComponent" @change="handleComponentChange" placeholder="请选择常用组分" clearable filterable>
|
||||
<el-option v-for="dict in dict.type.ngtools_cyzf" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 合计输入框 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="合计">
|
||||
<el-input :value="totalPercentage" readonly class="total-input" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form label-position="top" size="small" :inline="true" class="component-form">
|
||||
<!-- <el-row> -->
|
||||
<!-- 常用组分选择框 -->
|
||||
<!-- <el-col :span="10"> -->
|
||||
<el-form-item label="常用组分">
|
||||
<el-select v-model="selectedComponent" @change="handleComponentChange" placeholder="请选择常用组分" clearable
|
||||
filterable>
|
||||
<el-option v-for="dict in dict.type.ngtools_cyzf" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<!-- </el-col> -->
|
||||
<!-- 合计输入框 -->
|
||||
<!-- <el-col :span="6"> -->
|
||||
<el-form-item label="合计">
|
||||
<el-input :value="totalPercentage" readonly class="total-input" />
|
||||
</el-form-item>
|
||||
<!-- </el-col> -->
|
||||
<!-- </el-row> -->
|
||||
</el-form>
|
||||
|
||||
<el-form :model="formData" label-position="top" size="small" :inline="true" class="component-form">
|
||||
<el-form-item v-for="field in componentFields" :key="field.prop" :label="field.label" :prop="field.prop">
|
||||
<el-input v-model="formData[field.prop]" controls-position="right" @change="handleValueChange" />
|
||||
<el-input v-model="formData[field.prop]" controls-position="right" @change="handleValueChange"
|
||||
@focus="selectAllText" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listComponents, getComponents, delComponents, addComponents, updateComponents } from '@/api/ngtools/components';
|
||||
import {
|
||||
listComponents,
|
||||
getComponents,
|
||||
delComponents,
|
||||
addComponents,
|
||||
updateComponents
|
||||
} from '@/api/ngtools/components';
|
||||
|
||||
// 字段配置元数据
|
||||
const COMPONENT_FIELDS = [
|
||||
{ prop: 'ngC1', label: '甲烷C1' },
|
||||
{ prop: 'ngN2', label: '氮气N2' },
|
||||
{ prop: 'ngCo2', label: '二氧化碳CO2' },
|
||||
{ prop: 'ngC2', label: '乙烷C2' },
|
||||
{ prop: 'ngC3', label: '丙烷C3' },
|
||||
{ prop: 'ngH2o', label: '水H2O' },
|
||||
{ prop: 'ngH2s', label: '硫化氢H2S' },
|
||||
{ prop: 'ngH2', label: '氢气H2' },
|
||||
{ prop: 'ngCo', label: '一氧化碳CO' },
|
||||
{ prop: 'ngO2', label: '氧气O2' },
|
||||
{ prop: 'ngIc4', label: '异丁烷iC4' },
|
||||
{ prop: 'ngNc4', label: '正丁烷nC4' },
|
||||
{ prop: 'ngIc5', label: '异戊烷iC5' },
|
||||
{ prop: 'ngNc5', label: '正戊烷nC5' },
|
||||
{ prop: 'ngC6', label: '己烷C6' },
|
||||
{ prop: 'ngC7', label: '庚烷C7' },
|
||||
{ prop: 'ngC8', label: '辛烷C8' },
|
||||
{ prop: 'ngC9', label: '壬烷C9' },
|
||||
{ prop: 'ngC10', label: '癸烷C10' },
|
||||
{ prop: 'ngHe', label: '氦气He' },
|
||||
{ prop: 'ngAr', label: '氩气Ar' }
|
||||
];
|
||||
// 字段配置元数据
|
||||
const COMPONENT_FIELDS = [{
|
||||
prop: 'ngC1',
|
||||
label: '甲烷C1'
|
||||
},
|
||||
{
|
||||
prop: 'ngN2',
|
||||
label: '氮气N2'
|
||||
},
|
||||
{
|
||||
prop: 'ngCo2',
|
||||
label: '二氧化碳CO2'
|
||||
},
|
||||
{
|
||||
prop: 'ngC2',
|
||||
label: '乙烷C2'
|
||||
},
|
||||
{
|
||||
prop: 'ngC3',
|
||||
label: '丙烷C3'
|
||||
},
|
||||
{
|
||||
prop: 'ngH2o',
|
||||
label: '水H2O'
|
||||
},
|
||||
{
|
||||
prop: 'ngH2s',
|
||||
label: '硫化氢H2S'
|
||||
},
|
||||
{
|
||||
prop: 'ngH2',
|
||||
label: '氢气H2'
|
||||
},
|
||||
{
|
||||
prop: 'ngCo',
|
||||
label: '一氧化碳CO'
|
||||
},
|
||||
{
|
||||
prop: 'ngO2',
|
||||
label: '氧气O2'
|
||||
},
|
||||
{
|
||||
prop: 'ngIc4',
|
||||
label: '异丁烷iC4'
|
||||
},
|
||||
{
|
||||
prop: 'ngNc4',
|
||||
label: '正丁烷nC4'
|
||||
},
|
||||
{
|
||||
prop: 'ngIc5',
|
||||
label: '异戊烷iC5'
|
||||
},
|
||||
{
|
||||
prop: 'ngNc5',
|
||||
label: '正戊烷nC5'
|
||||
},
|
||||
{
|
||||
prop: 'ngC6',
|
||||
label: '己烷C6'
|
||||
},
|
||||
{
|
||||
prop: 'ngC7',
|
||||
label: '庚烷C7'
|
||||
},
|
||||
{
|
||||
prop: 'ngC8',
|
||||
label: '辛烷C8'
|
||||
},
|
||||
{
|
||||
prop: 'ngC9',
|
||||
label: '壬烷C9'
|
||||
},
|
||||
{
|
||||
prop: 'ngC10',
|
||||
label: '癸烷C10'
|
||||
},
|
||||
{
|
||||
prop: 'ngHe',
|
||||
label: '氦气He'
|
||||
},
|
||||
{
|
||||
prop: 'ngAr',
|
||||
label: '氩气Ar'
|
||||
}
|
||||
];
|
||||
|
||||
export default {
|
||||
name: 'NgComponentsForm',
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
dicts: ['ngtools_cyzf'],
|
||||
data() {
|
||||
return {
|
||||
selectedComponent: null,
|
||||
formData: this.initFormData(),
|
||||
componentFields: COMPONENT_FIELDS
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
totalPercentage() {
|
||||
return Object.values(this.formData)
|
||||
.reduce((sum, val) => sum + (parseFloat(val) || 0), 0)
|
||||
.toFixed(4);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
this.parseValueString(newVal);
|
||||
export default {
|
||||
name: 'NgComponentsForm',
|
||||
props: {
|
||||
value: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initFormData() {
|
||||
return COMPONENT_FIELDS.reduce((acc, field) => {
|
||||
acc[field.prop] = 0;
|
||||
return acc;
|
||||
}, {});
|
||||
},
|
||||
|
||||
parseValueString(valueStr) {
|
||||
const values = (valueStr || '').split('_');
|
||||
this.componentFields.forEach((field, index) => {
|
||||
const value = parseFloat(values[index]) || 0;
|
||||
this.$set(this.formData, field.prop, value);
|
||||
});
|
||||
dicts: ['ngtools_cyzf'],
|
||||
data() {
|
||||
return {
|
||||
selectedComponent: null,
|
||||
formData: this.initFormData(),
|
||||
componentFields: COMPONENT_FIELDS
|
||||
};
|
||||
},
|
||||
|
||||
generateValueString() {
|
||||
return Object.values(this.formData)
|
||||
.map((v) => v.toFixed(4))
|
||||
.join('_');
|
||||
computed: {
|
||||
totalPercentage() {
|
||||
return Object.values(this.formData)
|
||||
.reduce((sum, val) => sum + (parseFloat(val) || 0), 0)
|
||||
.toFixed(4);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
immediate: true,
|
||||
handler(newVal) {
|
||||
this.parseValueString(newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initFormData() {
|
||||
return COMPONENT_FIELDS.reduce((acc, field) => {
|
||||
acc[field.prop] = 0;
|
||||
return acc;
|
||||
}, {});
|
||||
},
|
||||
selectAllText(event) {
|
||||
// 通过 event.target 获取原生 DOM 元素
|
||||
const inputElement = event.target;
|
||||
// 调用 select() 方法全选文本
|
||||
inputElement.select();
|
||||
},
|
||||
|
||||
async handleComponentChange(value) {
|
||||
if (!value) return;
|
||||
console.log(value);
|
||||
try {
|
||||
const temp = value.replace(/\\'"/g, '"').replace(/'/g, '"'); // 替换剩余单引号;
|
||||
const componentData = Object.assign({}, this.formData, JSON.parse(temp));
|
||||
Object.keys(this.formData).forEach((key) => {
|
||||
this.formData[key] = parseFloat(componentData[key]) || 0;
|
||||
parseValueString(valueStr) {
|
||||
const values = (valueStr || '').split('_');
|
||||
this.componentFields.forEach((field, index) => {
|
||||
const value = parseFloat(values[index]) || 0;
|
||||
this.$set(this.formData, field.prop, value);
|
||||
});
|
||||
this.emitUpdate();
|
||||
} catch (error) {
|
||||
this.$message.error('获取标准组分失败');
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
handleValueChange() {
|
||||
this.$nextTick(() => {
|
||||
this.emitUpdate();
|
||||
});
|
||||
},
|
||||
generateValueString() {
|
||||
return Object.values(this.formData)
|
||||
.map((v) => v.toFixed(4))
|
||||
.join('_');
|
||||
},
|
||||
|
||||
emitUpdate() {
|
||||
if (Math.abs(this.totalPercentage - 100) > 0.0001) {
|
||||
this.$message.warning('组分合计不等于100%,请检查输入');
|
||||
}
|
||||
this.$emit('input', this.generateValueString());
|
||||
},
|
||||
async handleComponentChange(value) {
|
||||
if (!value) return;
|
||||
console.log(value);
|
||||
try {
|
||||
const temp = value.replace(/\\'"/g, '"').replace(/'/g, '"'); // 替换剩余单引号;
|
||||
const componentData = Object.assign({}, this.formData, JSON.parse(temp));
|
||||
Object.keys(this.formData).forEach((key) => {
|
||||
this.formData[key] = parseFloat(componentData[key]) || 0;
|
||||
});
|
||||
this.emitUpdate();
|
||||
} catch (error) {
|
||||
this.$message.error('获取标准组分失败');
|
||||
console.error(error);
|
||||
}
|
||||
},
|
||||
|
||||
async fetchComponentData(params) {
|
||||
try {
|
||||
const { data } = await getComponents(params);
|
||||
this.parseValueString(data.componentStr);
|
||||
} catch (error) {
|
||||
console.error('获取组分数据失败:', error);
|
||||
handleValueChange() {
|
||||
this.$nextTick(() => {
|
||||
this.emitUpdate();
|
||||
});
|
||||
},
|
||||
|
||||
emitUpdate() {
|
||||
if (Math.abs(this.totalPercentage - 100) > 0.0001) {
|
||||
this.$message.warning('组分合计不等于100%,请检查输入');
|
||||
}
|
||||
this.$emit('input', this.generateValueString());
|
||||
},
|
||||
|
||||
async fetchComponentData(params) {
|
||||
try {
|
||||
const {
|
||||
data
|
||||
} = await getComponents(params);
|
||||
this.parseValueString(data.componentStr);
|
||||
} catch (error) {
|
||||
console.error('获取组分数据失败:', error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.component-form {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
gap: 16px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.component-form {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
gap: 16px;
|
||||
/* margin-top: 20px; */
|
||||
}
|
||||
|
||||
.total-input >>> .el-input__inner {
|
||||
font-weight: bold;
|
||||
color: #409eff;
|
||||
}
|
||||
.total-input>>>.el-input__inner {
|
||||
font-weight: bold;
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,485 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="meterPar" ref="queryForm" label-position="top" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="流量计算标准" prop="dFlowCalbz" ref="selectRef">
|
||||
<el-select v-model="meterPar.dFlowCalbz" placeholder="请选择流量计算标准 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_lljsbz" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="压缩因子计算标准" prop="dZcalbz">
|
||||
<el-select v-model="meterPar.dZcalbz" placeholder="请选择压缩因子计算标准 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_ysyzjsbz" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计量参比条件压力" prop="dCbtj">
|
||||
<el-select v-model="meterPar.dCbtj" placeholder="请选择计量参比条件压力 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_cbtj" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="当地大气压" prop="dPatm">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPatm"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPatmUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="流量计类别" prop="dMeterType">
|
||||
<el-select v-model="meterPar.dMeterType" placeholder="请选择流量计类别 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_lljlx" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="节流装置类型" prop="dCoreType">
|
||||
<el-select v-model="meterPar.dCoreType" placeholder="请选择节流装置类型 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_jlzzlx" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="取压方式" prop="dPtmode">
|
||||
<el-select v-model="meterPar.dPtmode" placeholder="请选择取压方式 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_qyfs" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="管道类型" prop="dPipeType">
|
||||
<el-select v-model="meterPar.dPipeType" placeholder="请选择管道类型 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_gdlx" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="管道内径" prop="dPipeD">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPipeD"
|
||||
:unit-type="'length'"
|
||||
:unit-order.sync="meterPar.dLenUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="管道材料" prop="dPipeMaterial">
|
||||
<el-select v-model="meterPar.dPipeMaterial" placeholder="请选择管道材料 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_gdcz" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="孔板孔径" prop="dOrificeD">
|
||||
<unit-converter
|
||||
v-model="meterPar.dOrificeD"
|
||||
:unit-type="'length'"
|
||||
:unit-order.sync="meterPar.dOrificeUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="孔板材料" prop="dOrificeMaterial">
|
||||
<el-select v-model="meterPar.dOrificeMaterial" placeholder="请选择孔板材料 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_gdcz" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入压力" prop="dPf">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPf"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="压力类型" prop="dPfType">
|
||||
<el-select v-model="meterPar.dPfType" placeholder="请选择压力类型 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_yllx" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入温度" prop="dTf">
|
||||
<unit-converter
|
||||
v-model="meterPar.dTf"
|
||||
:unit-type="'temperature'"
|
||||
:unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入差压" prop="dDp">
|
||||
<unit-converter
|
||||
v-model="meterPar.dDp"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="体积流量单位" prop="dVFlowUnit">
|
||||
<el-input v-model="meterPar.dVFlowUnit" placeholder="请输入体积流量单位 " clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="质量流量单位" prop="dMFlowUnit">
|
||||
<el-input v-model="meterPar.dMFlowUnit" placeholder="请输入质量流量单位 " clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="能量流量单位" prop="dEFlowUnit">
|
||||
<el-input v-model="meterPar.dEFlowUnit" placeholder="请输入能量流量单位 " clearable />
|
||||
</el-form-item> -->
|
||||
|
||||
<el-form-item label="流出系数" prop="dCd">
|
||||
<el-input v-model="meterPar.dCd" placeholder="请输入流出系数 " clearable />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="流出系数计算方法" prop="dCdCalMethod">
|
||||
<el-select v-model="meterPar.dCdCalMethod" placeholder="请选择流出系数计算方法 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_lcxsjsff" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
<el-form-item label="仪表系数" prop="dMeterFactor">
|
||||
<el-input v-model="meterPar.dMeterFactor" placeholder="请输入仪表系数 " clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="脉冲数" prop="dPulseNum">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPulseNum"
|
||||
:unit-type="'user'"
|
||||
:unit-order.sync="meterPar.dVGscUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:user-defined="true"
|
||||
:user-definedunit-name="'个'"
|
||||
:enable-convert="false"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="管束车容积" prop="dVGsc">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVGsc"
|
||||
:unit-type="'volume'"
|
||||
:unit-order.sync="meterPar.dVGscUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="最大体积流量" prop="dVFlowMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVFlowMax"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="最小体积流量" prop="dVFlowMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVFlowMin"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="常用流量" prop="dVFlowCon">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVFlowCon"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:enable-convert="true"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="压力量程下限" prop="dPfRangeMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPfRangeMin"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="压力量程上限" prop="dPfRangeMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPfRangeMax"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="差压量程下限" prop="dDpRangeMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dDpRangeMin"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="差压量程上限" prop="dDpRangeMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dDpRangeMax"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="温度计量程下限" prop="dTfRangeMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dTfRangeMin"
|
||||
:unit-type="'temperature'"
|
||||
:unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="温度计量程上限" prop="dTfRangeMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dTfRangeMax"
|
||||
:unit-type="'temperature'"
|
||||
:unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listMeterpar, getMeterpar, delMeterpar, addMeterpar, updateMeterpar } from '@/api/ngtools/meterpar';
|
||||
import unitConverter from '@/components/inputValueUnit/index';
|
||||
|
||||
export default {
|
||||
name: 'meterPar',
|
||||
components: {
|
||||
unitConverter
|
||||
},
|
||||
props: {
|
||||
// 使用 v-model:meterPar 实现双向绑定
|
||||
meterPar: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
createName: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateName: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
dFlowCalbz: '0',
|
||||
dZcalbz: '0',
|
||||
dCbtj: '0',
|
||||
dpbM: null,
|
||||
dtbM: null,
|
||||
dpbE: null,
|
||||
dtbE: null,
|
||||
dPatm: 0.101325,
|
||||
dPatmUnit: 2,
|
||||
dngCompents: null,
|
||||
dMeterType: '0',
|
||||
dCoreType: '0',
|
||||
dPtmode: '0',
|
||||
dPipeType: '0',
|
||||
dPipeD: 259.38,
|
||||
dLenUnit: 3,
|
||||
dPipeDtemp: 20,
|
||||
dPileDtempU: 0,
|
||||
dPipeMaterial: '11.16',
|
||||
dOrificeD: 150.25,
|
||||
dOrificeUnit: 3,
|
||||
dOrificeDtemp: null,
|
||||
dOrificeDtempUnit: null,
|
||||
dOrificeMaterial: '16.6',
|
||||
dOrificeSharpness: null,
|
||||
dOrificeRk: null,
|
||||
dOrificeRkLenU: null,
|
||||
dPf: 1.48,
|
||||
dPfUnit: 2,
|
||||
dPfType: '0',
|
||||
dTf: 15,
|
||||
dTfUnit: 0,
|
||||
dDp: 12.5,
|
||||
dDpUnit: 1,
|
||||
dVFlowUnit: 0,
|
||||
dMFlowUnit: 0,
|
||||
dEFlowUnit: 0,
|
||||
dCd: null,
|
||||
dCdCalMethod: null,
|
||||
dMeterFactor: 2354,
|
||||
dPulseNum: 12000,
|
||||
dVFlowMax: 6,
|
||||
dVFlowMin: 3,
|
||||
dVFlowCon: 5,
|
||||
dPfRangeMin: null,
|
||||
dPfRangeMax: null,
|
||||
dDpRangeMin: null,
|
||||
dDpRangeMax: null,
|
||||
dTfRangeMin: null,
|
||||
dTfRangeMax: null,
|
||||
dVGsc: 30,
|
||||
dVGscUnit: 0,
|
||||
sampleno: null,
|
||||
meterno: null
|
||||
// 其他属性省略,可根据实际情况添加完整
|
||||
})
|
||||
}
|
||||
},
|
||||
dicts: [
|
||||
'ngtools_cbtj',
|
||||
'ngtools_jlzzlx',
|
||||
'ngtools_lljlx',
|
||||
'ngtools_qyfs',
|
||||
'ngtools_gdcz',
|
||||
'ngtools_lcxsjsff',
|
||||
'ngtools_gdlx',
|
||||
'ngtools_yllx',
|
||||
'ngtools_lljsbz',
|
||||
'ngtools_ysyzjsbz'
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
selectWidth: 0, //下拉选择组件的宽度
|
||||
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// 流量计参数表格数据
|
||||
meterparList: [],
|
||||
// 弹出层标题
|
||||
title: '',
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {}
|
||||
};
|
||||
},
|
||||
created() {},
|
||||
watch: {
|
||||
meterPar: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
// 当 meterPar 变化时触发事件通知父组件
|
||||
this.$emit('update:meterPar', newVal);
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.selectWidth = this.$refs.selectRef.$el.offsetWidth;
|
||||
},
|
||||
methods: {
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
createName: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateName: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
dFlowCalbz: null,
|
||||
dZcalbz: null,
|
||||
dCbtj: null,
|
||||
dpbM: null,
|
||||
dtbM: null,
|
||||
dpbE: null,
|
||||
dtbE: null,
|
||||
dPatm: null,
|
||||
dPatmUnit: null,
|
||||
dngCompents: null,
|
||||
dMeterType: null,
|
||||
dCoreType: null,
|
||||
dPtmode: null,
|
||||
dPipeType: null,
|
||||
dPipeD: null,
|
||||
dLenUnit: null,
|
||||
dPipeDtemp: null,
|
||||
dPileDtempU: null,
|
||||
dPipeMaterial: null,
|
||||
dOrificeD: null,
|
||||
dOrificeUnit: null,
|
||||
dOrificeDtemp: null,
|
||||
dOrificeDtempUnit: null,
|
||||
dOrificeMaterial: null,
|
||||
dOrificeSharpness: null,
|
||||
dOrificeRk: null,
|
||||
dOrificeRkLenU: null,
|
||||
dPf: null,
|
||||
dPfUnit: null,
|
||||
dPfType: null,
|
||||
dTf: null,
|
||||
dTfUnit: null,
|
||||
dDp: null,
|
||||
dDpUnit: null,
|
||||
dVFlowUnit: null,
|
||||
dMFlowUnit: null,
|
||||
dEFlowUnit: null,
|
||||
dCd: null,
|
||||
dCdCalMethod: null,
|
||||
dMeterFactor: null,
|
||||
dPulseNum: 0,
|
||||
dVFlowMax: null,
|
||||
dVFlowMin: null,
|
||||
dVFlowCon: null,
|
||||
dPfRangeMin: null,
|
||||
dPfRangeMax: null,
|
||||
dDpRangeMin: null,
|
||||
dDpRangeMax: null,
|
||||
dTfRangeMin: null,
|
||||
dTfRangeMax: null,
|
||||
dVGsc: null,
|
||||
sampleno: null,
|
||||
meterno: null
|
||||
// 其他属性省略,可根据实际情况添加完整
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 可根据需要添加样式 */
|
||||
</style>
|
@ -3,12 +3,14 @@
|
||||
<el-form :model="meterPar" ref="dataForm" label-position="top" size="small" :inline="true" label-width="160px">
|
||||
<el-form-item label="流量计算标准" prop="dFlowCalbz" ref="selectRef">
|
||||
<el-select v-model="meterPar.dFlowCalbz" placeholder="请选择流量计算标准 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_lljsbz" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-option v-for="dict in dict.type.ngtools_lljsbz" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="压缩因子计算标准" prop="dZcalbz">
|
||||
<el-select v-model="meterPar.dZcalbz" placeholder="请选择压缩因子计算标准 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_ysyzjsbz" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-option v-for="dict in dict.type.ngtools_ysyzjsbz" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="计量参比条件压力" prop="dCbtj">
|
||||
@ -18,25 +20,20 @@
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="当地大气压" prop="dPatm">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPatm"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPatmUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="6"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dPatm" :unit-type="'pressure'" :unit-order.sync="meterPar.dPatmUnit"
|
||||
:show-english-only="false" :decimal-places="6" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="流量计类别" prop="dMeterType">
|
||||
<el-select v-model="meterPar.dMeterType" placeholder="请选择流量计类别 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_lljlx" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-option v-for="dict in dict.type.ngtools_lljlx" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="节流装置类型" prop="dCoreType">
|
||||
<el-select v-model="meterPar.dCoreType" placeholder="请选择节流装置类型 " clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_jlzzlx" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
<el-option v-for="dict in dict.type.ngtools_jlzzlx" :key="dict.value" :label="dict.label"
|
||||
:value="dict.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="取压方式" prop="dPtmode">
|
||||
@ -50,15 +47,8 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="管道内径" prop="dPipeD">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPipeD"
|
||||
:unit-type="'length'"
|
||||
:unit-order.sync="meterPar.dLenUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dPipeD" :unit-type="'length'" :unit-order.sync="meterPar.dLenUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管道材料" prop="dPipeMaterial">
|
||||
<el-select v-model="meterPar.dPipeMaterial" placeholder="请选择管道材料 " clearable>
|
||||
@ -66,15 +56,8 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="孔板孔径" prop="dOrificeD">
|
||||
<unit-converter
|
||||
v-model="meterPar.dOrificeD"
|
||||
:unit-type="'length'"
|
||||
:unit-order.sync="meterPar.dOrificeUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dOrificeD" :unit-type="'length'" :unit-order.sync="meterPar.dOrificeUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="孔板材料" prop="dOrificeMaterial">
|
||||
@ -83,15 +66,8 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入压力" prop="dPf">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPf"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dPf" :unit-type="'pressure'" :unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="压力类型" prop="dPfType">
|
||||
@ -100,26 +76,12 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="输入温度" prop="dTf">
|
||||
<unit-converter
|
||||
v-model="meterPar.dTf"
|
||||
:unit-type="'temperature'"
|
||||
:unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dTf" :unit-type="'temperature'" :unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="输入差压" prop="dDp">
|
||||
<unit-converter
|
||||
v-model="meterPar.dDp"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dDp" :unit-type="'pressure'" :unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item label="体积流量单位" prop="dVFlowUnit">
|
||||
@ -144,241 +106,163 @@
|
||||
<el-input v-model="meterPar.dMeterFactor" placeholder="请输入仪表系数 " clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="脉冲数" prop="dPulseNum">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPulseNum"
|
||||
:unit-type="'user'"
|
||||
:unit-order.sync="meterPar.dVGscUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:user-defined="true"
|
||||
:user-definedunit-name="'个'"
|
||||
:enable-convert="false"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dPulseNum" :unit-type="'user'" :unit-order.sync="meterPar.dVGscUnit"
|
||||
:show-english-only="false" :decimal-places="5" :user-defined="true" :user-definedunit-name="'个'"
|
||||
:enable-convert="false" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="管束车容积" prop="dVGsc">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVGsc"
|
||||
:unit-type="'volume'"
|
||||
:unit-order.sync="meterPar.dVGscUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dVGsc" :unit-type="'volume'" :unit-order.sync="meterPar.dVGscUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="最大体积流量" prop="dVFlowMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVFlowMax"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dVFlowMax" :unit-type="'volumeflow'" :unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="最小体积流量" prop="dVFlowMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVFlowMin"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dVFlowMin" :unit-type="'volumeflow'" :unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="常用流量" prop="dVFlowCon">
|
||||
<unit-converter
|
||||
v-model="meterPar.dVFlowCon"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:enable-convert="true"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dVFlowCon" :unit-type="'volumeflow'" :unit-order.sync="meterPar.dVFlowUnit"
|
||||
:show-english-only="false" :decimal-places="5" :enable-convert="true" :width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="压力量程下限" prop="dPfRangeMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPfRangeMin"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dPfRangeMin" :unit-type="'pressure'" :unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="压力量程上限" prop="dPfRangeMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dPfRangeMax"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dPfRangeMax" :unit-type="'pressure'" :unit-order.sync="meterPar.dPfUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="差压量程下限" prop="dDpRangeMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dDpRangeMin"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dDpRangeMin" :unit-type="'pressure'" :unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="差压量程上限" prop="dDpRangeMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dDpRangeMax"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dDpRangeMax" :unit-type="'pressure'" :unit-order.sync="meterPar.dDpUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="温度计量程下限" prop="dTfRangeMin">
|
||||
<unit-converter
|
||||
v-model="meterPar.dTfRangeMin"
|
||||
:unit-type="'temperature'"
|
||||
:unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dTfRangeMin" :unit-type="'temperature'" :unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="温度计量程上限" prop="dTfRangeMax">
|
||||
<unit-converter
|
||||
v-model="meterPar.dTfRangeMax"
|
||||
:unit-type="'temperature'"
|
||||
:unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterPar.dTfRangeMax" :unit-type="'temperature'" :unit-order.sync="meterPar.dTfUnit"
|
||||
:show-english-only="false" :decimal-places="5" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import unitConverter from '@/components/inputValueUnit/index';
|
||||
export default {
|
||||
name: 'meterParComponents',
|
||||
components: {
|
||||
unitConverter
|
||||
},
|
||||
dicts: [
|
||||
'ngtools_cbtj',
|
||||
'ngtools_jlzzlx',
|
||||
'ngtools_lljlx',
|
||||
'ngtools_qyfs',
|
||||
'ngtools_gdcz',
|
||||
'ngtools_lcxsjsff',
|
||||
'ngtools_gdlx',
|
||||
'ngtools_yllx',
|
||||
'ngtools_lljsbz',
|
||||
'ngtools_ysyzjsbz'
|
||||
],
|
||||
mounted() {
|
||||
this.selectWidth = this.$refs.selectRef.$el.offsetWidth;
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
dFlowCalbz: null,
|
||||
dZcalbz: null,
|
||||
dCbtj: null,
|
||||
dpbM: null,
|
||||
dtbM: null,
|
||||
dpbE: null,
|
||||
dtbE: null,
|
||||
dPatm: null,
|
||||
dPatmUnit: null,
|
||||
dngCompents: null,
|
||||
dMeterType: null,
|
||||
dCoreType: null,
|
||||
dPtmode: null,
|
||||
dPipeType: null,
|
||||
dPipeD: null,
|
||||
dLenUnit: null,
|
||||
dPipeDtemp: null,
|
||||
dPileDtempU: null,
|
||||
dPipeMaterial: null,
|
||||
dOrificeD: null,
|
||||
dOrificeUnit: null,
|
||||
dOrificeDtemp: null,
|
||||
dOrificeDtempUnit: null,
|
||||
dOrificeMaterial: null,
|
||||
dOrificeSharpness: null,
|
||||
dOrificeRk: null,
|
||||
dOrificeRkLenU: null,
|
||||
dPf: null,
|
||||
dPfUnit: null,
|
||||
dPfType: null,
|
||||
dTf: null,
|
||||
dTfUnit: null,
|
||||
dDp: null,
|
||||
dDpUnit: null,
|
||||
dVFlowUnit: null,
|
||||
dMFlowUnit: null,
|
||||
dEFlowUnit: null,
|
||||
dCd: null,
|
||||
dCdCalMethod: null,
|
||||
dMeterFactor: null,
|
||||
dPulseNum: null,
|
||||
dVFlowMax: null,
|
||||
dVFlowMin: null,
|
||||
dVFlowCon: null,
|
||||
dPfRangeMin: null,
|
||||
dPfRangeMax: null,
|
||||
dDpRangeMin: null,
|
||||
dDpRangeMax: null,
|
||||
dTfRangeMin: null,
|
||||
dTfRangeMax: null,
|
||||
dVGsc: null
|
||||
})
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
selectWidth: 0, //下拉选择组件的宽度
|
||||
meterPar: _.cloneDeep(this.value)
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
this.formData = _.cloneDeep(newVal);
|
||||
import unitConverter from '@/components/inputValueUnit/index';
|
||||
export default {
|
||||
name: 'meterParComponents',
|
||||
components: {
|
||||
unitConverter
|
||||
},
|
||||
dicts: [
|
||||
'ngtools_cbtj',
|
||||
'ngtools_jlzzlx',
|
||||
'ngtools_lljlx',
|
||||
'ngtools_qyfs',
|
||||
'ngtools_gdcz',
|
||||
'ngtools_lcxsjsff',
|
||||
'ngtools_gdlx',
|
||||
'ngtools_yllx',
|
||||
'ngtools_lljsbz',
|
||||
'ngtools_ysyzjsbz'
|
||||
],
|
||||
mounted() {
|
||||
this.selectWidth = this.$refs.selectRef.$el.offsetWidth;
|
||||
},
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
dFlowCalbz: null,
|
||||
dZcalbz: null,
|
||||
dCbtj: null,
|
||||
dpbM: null,
|
||||
dtbM: null,
|
||||
dpbE: null,
|
||||
dtbE: null,
|
||||
dPatm: null,
|
||||
dPatmUnit: null,
|
||||
dngCompents: null,
|
||||
dMeterType: null,
|
||||
dCoreType: null,
|
||||
dPtmode: null,
|
||||
dPipeType: null,
|
||||
dPipeD: null,
|
||||
dLenUnit: null,
|
||||
dPipeDtemp: null,
|
||||
dPileDtempU: null,
|
||||
dPipeMaterial: null,
|
||||
dOrificeD: null,
|
||||
dOrificeUnit: null,
|
||||
dOrificeDtemp: null,
|
||||
dOrificeDtempUnit: null,
|
||||
dOrificeMaterial: null,
|
||||
dOrificeSharpness: null,
|
||||
dOrificeRk: null,
|
||||
dOrificeRkLenU: null,
|
||||
dPf: null,
|
||||
dPfUnit: null,
|
||||
dPfType: null,
|
||||
dTf: null,
|
||||
dTfUnit: null,
|
||||
dDp: null,
|
||||
dDpUnit: null,
|
||||
dVFlowUnit: 0,
|
||||
dVFlowWorkUnit: 0,
|
||||
dMFlowUnit: 0,
|
||||
dEFlowUnit: 6,
|
||||
dCd: null,
|
||||
dCdCalMethod: null,
|
||||
dMeterFactor: null,
|
||||
dPulseNum: null,
|
||||
dVFlowMax: null,
|
||||
dVFlowMin: null,
|
||||
dVFlowCon: null,
|
||||
dPfRangeMin: null,
|
||||
dPfRangeMax: null,
|
||||
dDpRangeMin: null,
|
||||
dDpRangeMax: null,
|
||||
dTfRangeMin: null,
|
||||
dTfRangeMax: null,
|
||||
dVGsc: null
|
||||
})
|
||||
}
|
||||
},
|
||||
meterPar: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
this.$emit('input', newVal);
|
||||
data() {
|
||||
return {
|
||||
selectWidth: 0, //下拉选择组件的宽度
|
||||
meterPar: _.cloneDeep(this.value)
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
value: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
this.formData = _.cloneDeep(newVal);
|
||||
}
|
||||
},
|
||||
meterPar: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
this.$emit('input', newVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 在这里可以添加一些样式 */
|
||||
/* 在这里可以添加一些样式 */
|
||||
</style>
|
||||
|
@ -1,176 +1,170 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="meterResult" label-position="top" ref="queryRef" :inline="false" label-width="160px">
|
||||
<el-form :model="meterResult" label-position="top" ref="queryRef" size="small" :inline="false" label-width="160px"
|
||||
class="result-form">
|
||||
<el-form-item label="求渐近速度系数 E" prop="dE" ref="selectRef">
|
||||
<el-input v-model="meterResult.dE" />
|
||||
<el-input disabled v-model="meterResult.dE" placeholder=" " />
|
||||
</el-form-item>
|
||||
<el-form-item label="求相对密度系数 FG" prop="dFG">
|
||||
<el-input v-model="meterResult.dFG" placeholder=" " />
|
||||
<el-input disabled v-model="meterResult.dFG" placeholder=" " />
|
||||
</el-form-item>
|
||||
<el-form-item label="求流动温度系数 FT" prop="dFT">
|
||||
<el-input v-model="meterResult.dFT" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dFT" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="求动力粘度dlnd" prop="dDViscosity">
|
||||
<el-input v-model="meterResult.dDViscosity" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dDViscosity" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="求可膨胀系数" prop="dDExpCoefficient">
|
||||
<el-input v-model="meterResult.dDExpCoefficient" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dDExpCoefficient" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管道雷诺数" prop="dRnPipe">
|
||||
<el-input v-model="meterResult.dRnPipe" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dRnPipe" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="孔板锐利度系数Bk" prop="dBk">
|
||||
<el-input v-model="meterResult.dBk" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dBk" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管道粗糙度系数 Gme" prop="dRoughNessPipe">
|
||||
<el-input v-model="meterResult.dRoughNessPipe" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dRoughNessPipe" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="修正后的流出系数" prop="dCdCorrect">
|
||||
<el-input v-model="meterResult.dCdCorrect" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dCdCorrect" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="喷嘴的流出系数" prop="dCdNozell">
|
||||
<el-input v-model="meterResult.dCdNozell" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dCdNozell" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标况体积流量m³/s" prop="dVFlowb">
|
||||
<unit-converter
|
||||
v-model="meterResult.dVFlowb"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterResult.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterResult.dVFlowb" :unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterResult.dVFlowUnit" :show-english-only="true" :decimal-places="5" :width="selectWidth"
|
||||
:input-disable="true" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工况体积流量" prop="dVFlowf">
|
||||
<unit-converter
|
||||
v-model="meterResult.dVFlowf"
|
||||
:unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterResult.dVFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterResult.dVFlowf" :unit-type="'volumeflow'"
|
||||
:unit-order.sync="meterResult.dVFlowWorkUnit" :show-english-only="true" :decimal-places="5"
|
||||
:input-disable="true" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标况质量流量" prop="dMFlowb">
|
||||
<unit-converter
|
||||
v-model="meterResult.dMFlowb"
|
||||
:unit-type="'massflow'"
|
||||
:unit-order.sync="meterResult.dMFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterResult.dMFlowb" :unit-type="'massflow'" :unit-order.sync="meterResult.dMFlowUnit"
|
||||
:input-disable="true" :show-english-only="true" :decimal-places="5" :width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标况能量流量" prop="dEFlowb">
|
||||
<unit-converter
|
||||
v-model="meterResult.dEFlowb"
|
||||
:unit-type="'energyflow'"
|
||||
:unit-order.sync="meterResult.dEFlowUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterResult.dEFlowb" :unit-type="'energyflow'"
|
||||
:unit-order.sync="meterResult.dEFlowUnit" :show-english-only="true" :decimal-places="5" :width="selectWidth"
|
||||
:input-disable="true" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管道内天然气流速" prop="dVelocityFlow">
|
||||
<unit-converter
|
||||
v-model="meterResult.dVelocityFlow"
|
||||
:unit-type="'speed'"
|
||||
:unit-order.sync="meterResult.dVelocityUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterResult.dVelocityFlow" :unit-type="'speed'"
|
||||
:unit-order.sync="meterResult.dVelocityUnit" :show-english-only="true" :decimal-places="5"
|
||||
:input-disable="true" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="压力损失" prop="dPressLost">
|
||||
<unit-converter
|
||||
v-model="meterResult.dPressLost"
|
||||
:unit-type="'pressure'"
|
||||
:unit-order.sync="meterResult.dPressLostUnit"
|
||||
:show-english-only="false"
|
||||
:decimal-places="5"
|
||||
:width="selectWidth"
|
||||
:style="{ width: selectWidth + 'px' }"
|
||||
/>
|
||||
<unit-converter v-model="meterResult.dPressLost" :unit-type="'pressure'"
|
||||
:unit-order.sync="meterResult.dPressLostUnit" :show-english-only="true" :decimal-places="5"
|
||||
:input-disable="true" :width="selectWidth" :style="{ width: selectWidth + 'px' }" />
|
||||
</el-form-item>
|
||||
<el-form-item label="直径比" prop="dBeta">
|
||||
<el-input v-model="meterResult.dBeta" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dBeta" placeholder="" />
|
||||
</el-form-item>
|
||||
<el-form-item label="等熵指数" prop="dKappa">
|
||||
<el-input v-model="meterResult.dKappa" placeholder="" />
|
||||
<el-input disabled v-model="meterResult.dKappa" placeholder="" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import unitConverter from '@/components/inputValueUnit/index';
|
||||
export default {
|
||||
name: 'MeterresultComponent',
|
||||
components: {
|
||||
unitConverter
|
||||
},
|
||||
import unitConverter from '@/components/inputValueUnit/index';
|
||||
export default {
|
||||
name: 'MeterresultComponent',
|
||||
components: {
|
||||
unitConverter
|
||||
},
|
||||
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
dE: null,
|
||||
dFG: null,
|
||||
dFT: null,
|
||||
dDViscosity: null,
|
||||
dDExpCoefficient: null,
|
||||
dRnPipe: null,
|
||||
dBk: null,
|
||||
dRoughNessPipe: null,
|
||||
dCdCorrect: null,
|
||||
dCdNozell: null,
|
||||
dVFlowb: null,
|
||||
dVFlowf: null,
|
||||
dVFlowUnit: null,
|
||||
dMFlowb: null,
|
||||
dMFlowUnit: null,
|
||||
dEFlowb: null,
|
||||
dEFlowUnit: null,
|
||||
dVelocityFlow: null,
|
||||
dVelocityUnit: null,
|
||||
dPressLost: null,
|
||||
dPressLostUnit: null,
|
||||
dBeta: null,
|
||||
dKappa: null
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return { meterResult: _.cloneDeep(this.value), selectWidth: 0 };
|
||||
},
|
||||
|
||||
watch: {
|
||||
value: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
this.meterResult = _.cloneDeep(newVal);
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
dE: 0,
|
||||
dFG: 0,
|
||||
dFT: 0,
|
||||
dDViscosity: 0,
|
||||
dDExpCoefficient: 0,
|
||||
dRnPipe: 0,
|
||||
dBk: 0,
|
||||
dRoughNessPipe: 0,
|
||||
dCdCorrect: 0,
|
||||
dCdNozell: 0,
|
||||
dVFlowb: 0,
|
||||
dVFlowf: 0,
|
||||
dVFlowUnit: 0,
|
||||
dMFlowb: 0,
|
||||
dMFlowUnit: 0,
|
||||
dEFlowb: 0,
|
||||
dEFlowUnit: 0,
|
||||
dVelocityFlow: 0,
|
||||
dVelocityUnit: 0,
|
||||
dPressLost: 0,
|
||||
dPressLostUnit: 0,
|
||||
dBeta: 0,
|
||||
dKappa: 0
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.selectWidth = this.$refs.selectRef.$el.offsetWidth;
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
meterResult: [],
|
||||
selectWidth: 180
|
||||
};
|
||||
},
|
||||
|
||||
watch: {
|
||||
value: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
console.log(newVal)
|
||||
for (const key in newVal) {
|
||||
if (newVal.hasOwnProperty(key)) {
|
||||
const value = newVal[key];
|
||||
// 判断是否为有效的数值
|
||||
if (typeof value === 'number' && !isNaN(value) && isFinite(value)) {
|
||||
// 使用 toFixed 方法设置小数点位数
|
||||
newVal[key] = parseFloat(value.toFixed(6));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.meterResult = JSON.parse(JSON.stringify(newVal));
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.selectWidth = this.$refs.selectRef.$el.offsetWidth;
|
||||
if (this.selectWidth === 0) this.selectWidth = 180
|
||||
console.log("wwww", this.selectWidth)
|
||||
})
|
||||
|
||||
},
|
||||
methods: {}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 可按需添加样式 */
|
||||
.app-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
position: relative;
|
||||
}
|
||||
/* 可按需添加样式 */
|
||||
.app-container {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.result-form {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.total-input>>>.el-input__inner {
|
||||
font-weight: bold;
|
||||
color: #409eff;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,229 +0,0 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-select v-model="NGCyzf" @change="handleChange()" placeholder="请选择常用组分" clearable>
|
||||
<el-option v-for="dict in dict.type.ngtools_cyzf" :key="dict.value" :label="dict.label" :value="dict.value" />
|
||||
</el-select>
|
||||
<el-form :model="ngComponentData" label-position="top" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="甲烷C1" prop="ngC1">
|
||||
<el-input v-model="ngComponentData.ngC1" placeholder="请输入甲烷C1" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="氮气N2" prop="ngN2">
|
||||
<el-input v-model="ngComponentData.ngN2" placeholder="请输入氮气N2" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="二氧化碳CO2" prop="ngCo2">
|
||||
<el-input v-model="ngComponentData.ngCo2" placeholder="请输入二氧化碳CO2" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="乙烷C2" prop="ngC2">
|
||||
<el-input v-model="ngComponentData.ngC2" placeholder="请输入乙烷C2" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="丙烷C3" prop="ngC3">
|
||||
<el-input v-model="ngComponentData.ngC3" placeholder="请输入丙烷C3" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="水H2O" prop="ngH2o">
|
||||
<el-input v-model="ngComponentData.ngH2o" placeholder="请输入水H2O" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="硫化氢H2S" prop="ngH2s">
|
||||
<el-input v-model="ngComponentData.ngH2s" placeholder="请输入硫化氢H2S" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="氢气H2" prop="ngH2">
|
||||
<el-input v-model="ngComponentData.ngH2" placeholder="请输入氢气H2" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="一氧化碳CO" prop="ngCo">
|
||||
<el-input v-model="ngComponentData.ngCo" placeholder="请输入一氧化碳CO" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="氧气O2" prop="ngO2">
|
||||
<el-input v-model="ngComponentData.ngO2" placeholder="请输入氧气O2" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="异丁烷iC4" prop="ngIc4">
|
||||
<el-input v-model="ngComponentData.ngIc4" placeholder="请输入异丁烷iC4" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="正丁烷nC4" prop="ngNc4">
|
||||
<el-input v-model="ngComponentData.ngNc4" placeholder="请输入正丁烷nC4" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="异戊烷iC5" prop="ngIc5">
|
||||
<el-input v-model="ngComponentData.ngIc5" placeholder="请输入异戊烷iC5" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="正戊烷nC5" prop="ngNc5">
|
||||
<el-input v-model="ngComponentData.ngNc5" placeholder="请输入正戊烷nC5" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="己烷C6" prop="ngC6">
|
||||
<el-input v-model="ngComponentData.ngC6" placeholder="请输入己烷C6" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="庚烷C7" prop="ngC7">
|
||||
<el-input v-model="ngComponentData.ngC7" placeholder="请输入庚烷C7" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="辛烷C8" prop="ngC8">
|
||||
<el-input v-model="ngComponentData.ngC8" placeholder="请输入辛烷C8" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="壬烷C9" prop="ngC9">
|
||||
<el-input v-model="ngComponentData.ngC9" placeholder="请输入壬烷C9" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="癸烷C10" prop="ngC10">
|
||||
<el-input v-model="ngComponentData.ngC10" placeholder="请输入癸烷C10" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="氦气He" prop="ngHe">
|
||||
<el-input v-model="ngComponentData.ngHe" placeholder="请输入氦气He" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="氩气Ar" prop="ngAr">
|
||||
<el-input v-model="ngComponentData.ngAr" placeholder="请输入氩气Ar" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="合计" prop="sum">
|
||||
<el-input v-model="sumzf" placeholder="请输入合计" clearable @keyup.enter.native="handleQuery" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listComponents, getComponents, delComponents, addComponents, updateComponents } from '@/api/ngtools/components';
|
||||
|
||||
export default {
|
||||
name: 'NgComponentsForm',
|
||||
props: {
|
||||
strZf: {
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
dicts: ['ngtools_cyzf'],
|
||||
data() {
|
||||
return {
|
||||
loading: true,
|
||||
ids: [],
|
||||
single: true,
|
||||
multiple: true,
|
||||
showSearch: true,
|
||||
total: 0,
|
||||
componentsList: [],
|
||||
title: '',
|
||||
open: false,
|
||||
form: {},
|
||||
rules: {},
|
||||
ngComponentData: {},
|
||||
NGCyzf: {},
|
||||
sumzf: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
ngComponentData: {
|
||||
deep: true,
|
||||
handler(newVal) {
|
||||
const result = this.calculateSum(newVal);
|
||||
this.sumzf = result.sum;
|
||||
const valuesStr = result.valuesStr;
|
||||
const diff = Math.abs(this.sumzf - 100);
|
||||
if (diff < 0.0001) {
|
||||
this.$emit('update:strZf', valuesStr);
|
||||
} else {
|
||||
Message.error('归一化错误:组分总和与 100 的差值超过 0.0001');
|
||||
}
|
||||
}
|
||||
},
|
||||
strZf: {
|
||||
handler(newVal) {
|
||||
const values = newVal.split(',');
|
||||
const keys = [
|
||||
'ngC1',
|
||||
'ngN2',
|
||||
'ngCo2',
|
||||
'ngC2',
|
||||
'ngC3',
|
||||
'ngH2o',
|
||||
'ngH2s',
|
||||
'ngH2',
|
||||
'ngCo',
|
||||
'ngO2',
|
||||
'ngIc4',
|
||||
'ngNc4',
|
||||
'ngIc5',
|
||||
'ngNc5',
|
||||
'ngC6',
|
||||
'ngC7',
|
||||
'ngC8',
|
||||
'ngC9',
|
||||
'ngC10',
|
||||
'ngHe',
|
||||
'ngAr'
|
||||
];
|
||||
this.ngComponentData = keys.reduce((obj, key, index) => {
|
||||
obj[key] = values[index] || '';
|
||||
return obj;
|
||||
}, {});
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.strZf && this.$options.watch.strZf.handler.call(this, this.strZf);
|
||||
},
|
||||
methods: {
|
||||
handleChange() {
|
||||
console.log(this.NGCyzf);
|
||||
try {
|
||||
const cleanJSON = this.NGCyzf.replace(/\\'"/g, '"').replace(/'/g, '"');
|
||||
const parsedData = JSON.parse(cleanJSON);
|
||||
this.ngComponentData = { ...this.ngComponentData, ...parsedData };
|
||||
} catch (error) {
|
||||
console.error('JSON 解析错误:', error);
|
||||
}
|
||||
},
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listComponents(this.ngComponentData).then((response) => {
|
||||
this.componentsList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
calculateSum(obj) {
|
||||
const sum = Object.values(obj)
|
||||
.map((v) => parseFloat(v) || 0)
|
||||
.reduce((acc, cur) => acc + cur, 0)
|
||||
.toFixed(4);
|
||||
const valuesStr = Object.values(obj).join(',');
|
||||
return { sum, valuesStr };
|
||||
},
|
||||
reset() {
|
||||
this.form = {
|
||||
id: null,
|
||||
createName: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateName: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
ngC1: null,
|
||||
ngN2: null,
|
||||
ngCo2: null,
|
||||
ngC2: null,
|
||||
ngC3: null,
|
||||
ngH2o: null,
|
||||
ngH2s: null,
|
||||
ngH2: null,
|
||||
ngCo: null,
|
||||
ngO2: null,
|
||||
ngIc4: null,
|
||||
ngNc4: null,
|
||||
ngIc5: null,
|
||||
ngNc5: null,
|
||||
ngC6: null,
|
||||
ngC7: null,
|
||||
ngC8: null,
|
||||
ngC9: null,
|
||||
ngC10: null,
|
||||
ngHe: null,
|
||||
ngAr: null,
|
||||
sum: null,
|
||||
sampleno: null,
|
||||
meterno: null,
|
||||
cyzf: null
|
||||
};
|
||||
this.resetForm('form');
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* 可以根据需要添加样式 */
|
||||
</style>
|
@ -1,19 +1,19 @@
|
||||
<template>
|
||||
<div class="unit-converter" :style="{ width: width + 'px' }">
|
||||
<!-- 数值输入框 -->
|
||||
|
||||
<input v-model.number="inputValue" class="input-field" type="number" ref="inputRef" :style="{ width: inputWidth + 'px', height: height + 'px' }" @change="handleInputChange" />
|
||||
|
||||
<input v-model.number="inputValue" :disabled="inputDisable" class="input-field" type="number" ref="inputRef"
|
||||
:style="{ width: inputWidth + 'px', height: height + 'px' }" @change="handleInputChange" @focus="selectAllText" />
|
||||
<!-- 单位标签 -->
|
||||
<span v-if="enableConvert" ref="unitLabel" @click="cycleUnit" @dblclick="toggleUnitSelector" class="unit-label" :style="{ color: 'blue', height: height + 'px' }">
|
||||
<span v-if="enableConvert" ref="unitLabel" @click="cycleUnit" @dblclick="toggleUnitSelector" class="unit-label"
|
||||
:style="{ color: 'blue', height: height + 'px' }">
|
||||
{{ textUnitName }}
|
||||
</span>
|
||||
<span v-else ref="unitLabel" class="unit-label" :style="{ color: 'blue', height: height + 'px' }">
|
||||
{{ textUnitName }}
|
||||
</span>
|
||||
|
||||
<!-- 单位选择弹出窗口 -->
|
||||
<div v-if="showUnitSelector" class="unit-selector" ref="unitSelector" :style="{ left: unitSelectorLeft + 'px', top: unitSelectorTop + 'px' }">
|
||||
<div v-if="showUnitSelector" class="unit-selector" ref="unitSelector"
|
||||
:style="{ left: unitSelectorLeft + 'px', top: unitSelectorTop + 'px' }">
|
||||
<div v-for="unit in sortedUnits" :key="unit.id" @click="selectUnit(unit)" class="unit-option">
|
||||
{{ showEnglishOnly ? unit.unitName.split('(')[0] : unit.unitName }}
|
||||
</div>
|
||||
@ -22,393 +22,414 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listSysUnitConvert } from '@/api/system/sysUnitConvert.js';
|
||||
import {
|
||||
listSysUnitConvert
|
||||
} from '@/api/system/sysUnitConvert.js';
|
||||
|
||||
export default {
|
||||
name: 'UnitConverter',
|
||||
props: {
|
||||
unitType: {
|
||||
// 当前单位类型 (required)
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
unitOrder: {
|
||||
// 当前单位序号 (sync)
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
value: {
|
||||
// 输入数值 (sync)
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
showEnglishOnly: {
|
||||
// 是否只显示英文
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
decimalPlaces: {
|
||||
// 小数位数
|
||||
type: Number,
|
||||
default: 5,
|
||||
validator: (v) => v >= 0 && v <= 10
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 180
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 32
|
||||
},
|
||||
enableConvert: {
|
||||
//是否能够进行单位换算
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
userDefined: {
|
||||
//自定义输入单位显示
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
userDefinedunitName: {
|
||||
//自定义输入单位显示
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// 在挂载时添加全局点击事件监听器
|
||||
document.addEventListener('click', this.handleClickOutside);
|
||||
},
|
||||
beforeUnmount() {
|
||||
// 在组件销毁前移除全局点击事件监听器
|
||||
document.removeEventListener('click', this.handleClickOutside);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
inputValue: this.value,
|
||||
unitData: [], // 原始单位数据
|
||||
showUnitSelector: false, // 显示选择器
|
||||
currentUnit: null, // 当前选中单位
|
||||
baseUnit: null, // 基准单位
|
||||
inputWidth: 100, //输入框的宽度
|
||||
textUnitName: '',
|
||||
unitSelectorLeft: 0,
|
||||
unitSelectorTop: 0,
|
||||
// 新增三个数据项
|
||||
originalValue: this.value, // 原始输入值
|
||||
originalUnit: null, // 原始输入单位
|
||||
isInternalUpdate: false // 更新锁定标志
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
// 显示的单位文本
|
||||
displayUnitText() {
|
||||
if (!this.currentUnit) return '';
|
||||
return this.showEnglishOnly ? this.currentUnit.unitName.split('(')[0].trim() : this.currentUnit.unitName;
|
||||
export default {
|
||||
name: 'UnitConverter',
|
||||
props: {
|
||||
unitType: {
|
||||
// 当前单位类型 (required)
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
unitOrder: {
|
||||
// 当前单位序号 (sync)
|
||||
type: Number,
|
||||
default: 0
|
||||
},
|
||||
value: {
|
||||
// 输入数值 (sync)
|
||||
type: Number,
|
||||
required: true
|
||||
},
|
||||
showEnglishOnly: {
|
||||
// 是否只显示英文
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
decimalPlaces: {
|
||||
// 小数位数
|
||||
type: Number,
|
||||
default: 5,
|
||||
validator: (v) => v >= 0 && v <= 10
|
||||
},
|
||||
width: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 180
|
||||
},
|
||||
height: {
|
||||
type: Number,
|
||||
required: false,
|
||||
default: 32
|
||||
},
|
||||
enableConvert: {
|
||||
//是否能够进行单位换算
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
userDefined: {
|
||||
//自定义输入单位显示
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
userDefinedunitName: {
|
||||
//自定义输入单位显示
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
inputDisable: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
});
|
||||
// 在挂载时添加全局点击事件监听器
|
||||
document.addEventListener('click', this.handleClickOutside);
|
||||
|
||||
// 当前类型的单位列表(按unitOrder排序)
|
||||
sortedUnits() {
|
||||
return this.unitData.filter((u) => u.unitType === this.unitType).sort((a, b) => a.unitOrder - b.unitOrder);
|
||||
},
|
||||
|
||||
// 弹窗定位样式
|
||||
popupPosition() {
|
||||
if (!this.$refs.unitLabel) return {};
|
||||
const rect = this.$refs.unitLabel.getBoundingClientRect();
|
||||
beforeUnmount() {
|
||||
// 在组件销毁前移除全局点击事件监听器
|
||||
document.removeEventListener('click', this.handleClickOutside);
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
top: `${rect.bottom + window.scrollY}px`,
|
||||
left: `${rect.left + window.scrollX}px`
|
||||
inputValue: this.value,
|
||||
unitData: [], // 原始单位数据
|
||||
showUnitSelector: false, // 显示选择器
|
||||
currentUnit: null, // 当前选中单位
|
||||
baseUnit: null, // 基准单位
|
||||
inputWidth: 120, //输入框的宽度
|
||||
textUnitName: '',
|
||||
unitSelectorLeft: 0,
|
||||
unitSelectorTop: 0,
|
||||
// 新增三个数据项
|
||||
originalValue: this.value, // 原始输入值
|
||||
originalUnit: null, // 原始输入单位
|
||||
isInternalUpdate: false // 更新锁定标志
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听单位类型变化
|
||||
unitType: {
|
||||
immediate: true,
|
||||
async handler(newType) {
|
||||
},
|
||||
computed: {
|
||||
// 显示的单位文本
|
||||
displayUnitText() {
|
||||
if (!this.currentUnit) return '';
|
||||
return this.showEnglishOnly ? this.currentUnit.unitName.split('(')[0].trim() : this.currentUnit.unitName;
|
||||
},
|
||||
|
||||
// 当前类型的单位列表(按unitOrder排序)
|
||||
sortedUnits() {
|
||||
return this.unitData.filter((u) => u.unitType === this.unitType).sort((a, b) => a.unitOrder - b.unitOrder);
|
||||
},
|
||||
|
||||
// 弹窗定位样式
|
||||
popupPosition() {
|
||||
if (!this.$refs.unitLabel) return {};
|
||||
const rect = this.$refs.unitLabel.getBoundingClientRect();
|
||||
return {
|
||||
top: `${rect.bottom + window.scrollY}px`,
|
||||
left: `${rect.left + window.scrollX}px`
|
||||
};
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
// 监听单位类型变化
|
||||
unitType: {
|
||||
immediate: true,
|
||||
async handler(newType) {
|
||||
if (this.userDefined) {
|
||||
this.textUnitName = this.userDefinedunitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
});
|
||||
} else {
|
||||
await this.loadUnits(newType);
|
||||
this.initCurrentUnit();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// 监听外部单位序号变化
|
||||
unitOrder(newOrder) {
|
||||
if (this.userDefined) {
|
||||
this.textUnitName = this.userDefinedunitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
});
|
||||
} else {
|
||||
await this.loadUnits(newType);
|
||||
this.initCurrentUnit();
|
||||
const target = this.sortedUnits.find((u) => u.unitOrder === newOrder);
|
||||
if (target) this.currentUnit = target;
|
||||
this.textUnitName = this.showEnglishOnly ? target.unitName.split('(')[0].trim() : target.unitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
// 监听输入值变化
|
||||
value(newVal) {
|
||||
if (!this.isInternalUpdate) {
|
||||
|
||||
// 外部更新时重置原始值
|
||||
this.originalValue = (newVal === "NaN" ? 0 : newVal);
|
||||
this.originalUnit = this.currentUnit;
|
||||
this.inputValue = (newVal === "" ? 0 : newVal);
|
||||
}
|
||||
this.isInternalUpdate = false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
// 监听外部单位序号变化
|
||||
unitOrder(newOrder) {
|
||||
if (this.userDefined) {
|
||||
this.textUnitName = this.userDefinedunitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
});
|
||||
} else {
|
||||
const target = this.sortedUnits.find((u) => u.unitOrder === newOrder);
|
||||
if (target) this.currentUnit = target;
|
||||
selectAllText(event) {
|
||||
// 通过 event.target 获取触发事件的 input 元素
|
||||
const input = event.target;
|
||||
// 调用 select() 方法全选文本
|
||||
input.select();
|
||||
},
|
||||
handleMouseMove(event) {
|
||||
if (this.showUnitSelector) {
|
||||
// 鼠标右下方偏移量
|
||||
const offsetX = 10;
|
||||
const offsetY = 10;
|
||||
this.unitSelectorLeft = event.clientX + offsetX;
|
||||
this.unitSelectorTop = event.clientY + offsetY;
|
||||
// 获取弹窗元素
|
||||
const unitSelector = this.$refs.unitSelector;
|
||||
if (unitSelector) {
|
||||
// 检查是否超出屏幕右边界
|
||||
if (this.unitSelectorLeft + unitSelector.offsetWidth > window.innerWidth) {
|
||||
this.unitSelectorLeft = window.innerWidth - unitSelector.offsetWidth;
|
||||
}
|
||||
// 检查是否超出屏幕下边界
|
||||
if (this.unitSelectorTop + unitSelector.offsetHeight > window.innerHeight) {
|
||||
this.unitSelectorTop = window.innerHeight - unitSelector.offsetHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateInputWidth() {
|
||||
|
||||
const spanWidth = this.$refs.unitLabel.offsetWidth + 5;
|
||||
console.log("widht", this.width, "spanWidth", spanWidth)
|
||||
this.inputWidth = this.width - spanWidth;
|
||||
},
|
||||
// 处理全局点击事件
|
||||
handleClickOutside(event) {
|
||||
if (this.$refs.unitSelector && !this.$refs.unitSelector.contains(event.target)) {
|
||||
this.showUnitSelector = false;
|
||||
}
|
||||
},
|
||||
// 切换单位选择器的显示状态
|
||||
toggleUnitSelector() {
|
||||
this.showUnitSelector = !this.showUnitSelector;
|
||||
|
||||
},
|
||||
// 加载单位数据
|
||||
async loadUnits(unitType) {
|
||||
try {
|
||||
const res = await listSysUnitConvert({
|
||||
unitType: unitType,
|
||||
status: 'Y'
|
||||
});
|
||||
// console.log(res);
|
||||
this.unitData = res.rows;
|
||||
this.baseUnit = this.unitData.find((u) => u.baseUnit === 'Y');
|
||||
// console.log(this.baseUnit.unitName);
|
||||
} catch (e) {
|
||||
console.error('单位数据加载失败:', e);
|
||||
}
|
||||
},
|
||||
|
||||
// 初始化当前单位
|
||||
initCurrentUnit() {
|
||||
const target = this.sortedUnits.find((u) => u.unitOrder === this.unitOrder);
|
||||
this.currentUnit = target || this.baseUnit || this.sortedUnits[0];
|
||||
// 初始化时设置原始单位(关键修复)
|
||||
this.originalUnit = this.currentUnit;
|
||||
this.textUnitName = this.showEnglishOnly ? target.unitName.split('(')[0].trim() : target.unitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
// 监听输入值变化
|
||||
value(newVal) {
|
||||
if (!this.isInternalUpdate) {
|
||||
// 外部更新时重置原始值
|
||||
this.originalValue = newVal;
|
||||
// 输入变化处理
|
||||
handleInputChange() {
|
||||
// 记录原始值和单位
|
||||
this.originalValue = this.inputValue;
|
||||
this.originalUnit = this.currentUnit;
|
||||
this.inputValue = newVal;
|
||||
}
|
||||
this.isInternalUpdate = false;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleMouseMove(event) {
|
||||
if (this.showUnitSelector) {
|
||||
// 鼠标右下方偏移量
|
||||
const offsetX = 10;
|
||||
const offsetY = 10;
|
||||
this.unitSelectorLeft = event.clientX + offsetX;
|
||||
this.unitSelectorTop = event.clientY + offsetY;
|
||||
// 获取弹窗元素
|
||||
const unitSelector = this.$refs.unitSelector;
|
||||
if (unitSelector) {
|
||||
// 检查是否超出屏幕右边界
|
||||
if (this.unitSelectorLeft + unitSelector.offsetWidth > window.innerWidth) {
|
||||
this.unitSelectorLeft = window.innerWidth - unitSelector.offsetWidth;
|
||||
}
|
||||
// 检查是否超出屏幕下边界
|
||||
if (this.unitSelectorTop + unitSelector.offsetHeight > window.innerHeight) {
|
||||
this.unitSelectorTop = window.innerHeight - unitSelector.offsetHeight;
|
||||
}
|
||||
// console.log(this.originalValue);
|
||||
this.$emit('input', this.inputValue);
|
||||
// this.convertAndEmit();
|
||||
},
|
||||
|
||||
// 循环切换单位
|
||||
// 修改单位切换方法
|
||||
cycleUnit() {
|
||||
const index = this.sortedUnits.findIndex((u) => u === this.currentUnit);
|
||||
const newUnit = this.sortedUnits[(index + 1) % this.sortedUnits.length];
|
||||
this.currentUnit = newUnit;
|
||||
this.textUnitName = this.showEnglishOnly ? newUnit.unitName.split('(')[0].trim() : newUnit.unitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
this.convertAndEmit(); // 触发转换
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// 选择单位
|
||||
selectUnit(unit) {
|
||||
this.currentUnit = unit;
|
||||
this.showUnitSelector = false;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
this.convertAndEmit(); // 触发转换
|
||||
});
|
||||
},
|
||||
|
||||
// 执行换算并提交事件
|
||||
convertAndEmit() {
|
||||
// 移除参数
|
||||
if (!this.currentUnit || !this.baseUnit || !this.originalUnit) return;
|
||||
|
||||
let newValue = 0;
|
||||
if (this.unitType === 'temperature') {
|
||||
newValue = this.handleTemperatureConversion(this.originalUnit, this.currentUnit);
|
||||
} else {
|
||||
// 通过基准单位进行两次精确转换
|
||||
const baseValue = this.originalValue / this.originalUnit.conversionFactor;
|
||||
newValue = baseValue * this.currentUnit.conversionFactor;
|
||||
}
|
||||
|
||||
const roundedValue = this.roundValue(newValue);
|
||||
this.isInternalUpdate = true; // 锁定更新
|
||||
this.inputValue = roundedValue;
|
||||
this.$emit('input', roundedValue);
|
||||
this.$emit('update:unitOrder', this.currentUnit.unitOrder);
|
||||
|
||||
this.$emit('conversion', {
|
||||
initialValue: this.originalValue,
|
||||
newValue: roundedValue,
|
||||
oldUnit: this.originalUnit.unitName,
|
||||
newUnit: this.currentUnit.unitName,
|
||||
oldOrder: this.originalUnit.unitOrder,
|
||||
newOrder: this.currentUnit.unitOrder
|
||||
});
|
||||
},
|
||||
|
||||
// 温度单位换算
|
||||
// 温度转换调整(使用原始值)
|
||||
handleTemperatureConversion(oldUnit, newUnit) {
|
||||
const oldOrder = oldUnit.unitOrder;
|
||||
const newOrder = newUnit.unitOrder;
|
||||
// console.log(1111, this.originalValue);
|
||||
// 使用原始值计算
|
||||
let celsius;
|
||||
switch (oldOrder) {
|
||||
case 0:
|
||||
celsius = this.originalValue;
|
||||
break;
|
||||
case 1:
|
||||
celsius = ((this.originalValue - 32) * 5) / 9;
|
||||
break;
|
||||
case 2:
|
||||
celsius = this.originalValue - 273.15;
|
||||
break;
|
||||
default:
|
||||
throw new Error('无效温度单位');
|
||||
}
|
||||
|
||||
switch (newOrder) {
|
||||
case 0:
|
||||
return celsius;
|
||||
case 1:
|
||||
return (celsius * 9) / 5 + 32;
|
||||
case 2:
|
||||
return celsius + 273.15;
|
||||
default:
|
||||
throw new Error('无效温度单位');
|
||||
}
|
||||
},
|
||||
|
||||
// 四舍六入五成双
|
||||
roundValue(value) {
|
||||
const multiplier = Math.pow(10, this.decimalPlaces);
|
||||
const val = value * multiplier;
|
||||
const intVal = Math.trunc(val);
|
||||
const decimalPart = val - intVal;
|
||||
if (decimalPart < 0.5) {
|
||||
return intVal / multiplier;
|
||||
} else if (decimalPart > 0.5) {
|
||||
return (intVal + 1) / multiplier;
|
||||
} else {
|
||||
return intVal % 2 === 0 ? intVal / multiplier : (intVal + 1) / multiplier;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
updateInputWidth() {
|
||||
const spanWidth = this.$refs.unitLabel.offsetWidth - 5;
|
||||
this.inputWidth = this.width - spanWidth;
|
||||
},
|
||||
// 处理全局点击事件
|
||||
handleClickOutside(event) {
|
||||
if (this.$refs.unitSelector && !this.$refs.unitSelector.contains(event.target)) {
|
||||
this.showUnitSelector = false;
|
||||
}
|
||||
},
|
||||
// 切换单位选择器的显示状态
|
||||
toggleUnitSelector() {
|
||||
this.showUnitSelector = !this.showUnitSelector;
|
||||
},
|
||||
// 加载单位数据
|
||||
async loadUnits(unitType) {
|
||||
try {
|
||||
const res = await listSysUnitConvert({ unitType: unitType, status: 'Y' });
|
||||
console.log(res);
|
||||
this.unitData = res.rows;
|
||||
this.baseUnit = this.unitData.find((u) => u.baseUnit === 'Y');
|
||||
// console.log(this.baseUnit.unitName);
|
||||
} catch (e) {
|
||||
console.error('单位数据加载失败:', e);
|
||||
}
|
||||
},
|
||||
|
||||
// 初始化当前单位
|
||||
initCurrentUnit() {
|
||||
const target = this.sortedUnits.find((u) => u.unitOrder === this.unitOrder);
|
||||
this.currentUnit = target || this.baseUnit || this.sortedUnits[0];
|
||||
// 初始化时设置原始单位(关键修复)
|
||||
this.originalUnit = this.currentUnit;
|
||||
this.textUnitName = this.showEnglishOnly ? target.unitName.split('(')[0].trim() : target.unitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
});
|
||||
},
|
||||
|
||||
// 输入变化处理
|
||||
handleInputChange() {
|
||||
// 记录原始值和单位
|
||||
this.originalValue = this.inputValue;
|
||||
this.originalUnit = this.currentUnit;
|
||||
console.log(this.originalValue);
|
||||
this.$emit('input', this.inputValue);
|
||||
// this.convertAndEmit();
|
||||
},
|
||||
|
||||
// 循环切换单位
|
||||
// 修改单位切换方法
|
||||
cycleUnit() {
|
||||
const index = this.sortedUnits.findIndex((u) => u === this.currentUnit);
|
||||
const newUnit = this.sortedUnits[(index + 1) % this.sortedUnits.length];
|
||||
this.currentUnit = newUnit;
|
||||
this.textUnitName = this.showEnglishOnly ? newUnit.unitName.split('(')[0].trim() : newUnit.unitName;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
this.convertAndEmit(); // 触发转换
|
||||
});
|
||||
},
|
||||
|
||||
// 切换单位选择器
|
||||
toggleUnitSelector() {
|
||||
this.showUnitSelector = !this.showUnitSelector;
|
||||
},
|
||||
|
||||
// 选择单位
|
||||
selectUnit(unit) {
|
||||
this.currentUnit = unit;
|
||||
this.showUnitSelector = false;
|
||||
this.$nextTick(() => {
|
||||
this.updateInputWidth();
|
||||
this.convertAndEmit(); // 触发转换
|
||||
});
|
||||
},
|
||||
|
||||
// 执行换算并提交事件
|
||||
convertAndEmit() {
|
||||
// 移除参数
|
||||
if (!this.currentUnit || !this.baseUnit || !this.originalUnit) return;
|
||||
|
||||
let newValue = 0;
|
||||
if (this.unitType === 'temperature') {
|
||||
newValue = this.handleTemperatureConversion(this.originalUnit, this.currentUnit);
|
||||
} else {
|
||||
// 通过基准单位进行两次精确转换
|
||||
const baseValue = this.originalValue / this.originalUnit.conversionFactor;
|
||||
newValue = baseValue * this.currentUnit.conversionFactor;
|
||||
}
|
||||
|
||||
const roundedValue = this.roundValue(newValue);
|
||||
this.isInternalUpdate = true; // 锁定更新
|
||||
this.inputValue = roundedValue;
|
||||
this.$emit('input', roundedValue);
|
||||
this.$emit('update:unitOrder', this.currentUnit.unitOrder);
|
||||
|
||||
this.$emit('conversion', {
|
||||
initialValue: this.originalValue,
|
||||
newValue: roundedValue,
|
||||
oldUnit: this.originalUnit.unitName,
|
||||
newUnit: this.currentUnit.unitName,
|
||||
oldOrder: this.originalUnit.unitOrder,
|
||||
newOrder: this.currentUnit.unitOrder
|
||||
});
|
||||
},
|
||||
|
||||
// 温度单位换算
|
||||
// 温度转换调整(使用原始值)
|
||||
handleTemperatureConversion(oldUnit, newUnit) {
|
||||
const oldOrder = oldUnit.unitOrder;
|
||||
const newOrder = newUnit.unitOrder;
|
||||
console.log(1111, this.originalValue);
|
||||
// 使用原始值计算
|
||||
let celsius;
|
||||
switch (oldOrder) {
|
||||
case 0:
|
||||
celsius = this.originalValue;
|
||||
break;
|
||||
case 1:
|
||||
celsius = ((this.originalValue - 32) * 5) / 9;
|
||||
break;
|
||||
case 2:
|
||||
celsius = this.originalValue - 273.15;
|
||||
break;
|
||||
default:
|
||||
throw new Error('无效温度单位');
|
||||
}
|
||||
|
||||
switch (newOrder) {
|
||||
case 0:
|
||||
return celsius;
|
||||
case 1:
|
||||
return (celsius * 9) / 5 + 32;
|
||||
case 2:
|
||||
return celsius + 273.15;
|
||||
default:
|
||||
throw new Error('无效温度单位');
|
||||
}
|
||||
},
|
||||
|
||||
// 四舍六入五成双
|
||||
roundValue(value) {
|
||||
const multiplier = Math.pow(10, this.decimalPlaces);
|
||||
const val = value * multiplier;
|
||||
const intVal = Math.trunc(val);
|
||||
const decimalPart = val - intVal;
|
||||
if (decimalPart < 0.5) {
|
||||
return intVal / multiplier;
|
||||
} else if (decimalPart > 0.5) {
|
||||
return (intVal + 1) / multiplier;
|
||||
} else {
|
||||
return intVal % 2 === 0 ? intVal / multiplier : (intVal + 1) / multiplier;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.unit-converter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
position: relative;
|
||||
}
|
||||
.unit-converter {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 2px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.input-field {
|
||||
border: 1px solid #d6d5d5;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.input-field {
|
||||
border: 1px solid #d6d5d5;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.unit-label {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
border: 1px solid #d6d5d5;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
padding-left: 10px;
|
||||
padding-right: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.unit-label {
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
border: 1px solid #d6d5d5;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
padding-left: 10px;
|
||||
padding-right: 5px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.unit-label:hover {
|
||||
background: #f0f8ff;
|
||||
}
|
||||
.unit-label:hover {
|
||||
background: #f0f8ff;
|
||||
}
|
||||
|
||||
.unit-selector {
|
||||
/* 设置容器的最大高度,当内容超出这个高度时会出现滚动条 */
|
||||
max-height: 200px;
|
||||
/* 超出内容时显示纵向滚动条 */
|
||||
overflow-y: auto;
|
||||
/* 横向内容不溢出,隐藏多余部分 */
|
||||
overflow-x: hidden;
|
||||
/* 其他样式保持不变 */
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
background-color: white;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 2px 0;
|
||||
min-width: 100px;
|
||||
list-style-type: none;
|
||||
margin-left: 100px;
|
||||
}
|
||||
.unit-selector {
|
||||
/* 设置容器的最大高度,当内容超出这个高度时会出现滚动条 */
|
||||
max-height: 100px;
|
||||
/* 超出内容时显示纵向滚动条 */
|
||||
overflow-y: auto;
|
||||
/* 横向内容不溢出,隐藏多余部分 */
|
||||
overflow-x: hidden;
|
||||
/* 其他样式保持不变 */
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
background-color: white;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
||||
padding: 2px 0;
|
||||
min-width: 200px;
|
||||
list-style-type: none;
|
||||
margin-left: 100px;
|
||||
}
|
||||
|
||||
.unit-option {
|
||||
padding: 2px 10px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
.unit-option {
|
||||
padding: 2px 10px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.unit-option:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
.unit-option:hover {
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,16 +1,17 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<button @click="calc">计算组分参数</button>
|
||||
<div style="text-align: center;margin-top: 10px;margin-bottom: 10px;">
|
||||
<button @click="calc" type="primary" class="animated-button">计算组分参数</button>
|
||||
<button @click="calcFlow" type="primary" class="animated-button">计算流量</button>
|
||||
</div>
|
||||
|
||||
<el-tabs v-model="activeTab">
|
||||
<el-tabs v-model="activeTab" style="width: 100%;">
|
||||
<el-tab-pane label="流量计参数" name="meterpar">
|
||||
<meterPar v-model="parentMeterPar" />
|
||||
</el-tab-pane>
|
||||
|
||||
<el-tab-pane label="天然气组分" name="ngComponents">
|
||||
<ngComponents v-model="componentString" />
|
||||
<ngComponents v-model="parentMeterPar.dngComponents" />
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="流量计算结果" name="meterresult">
|
||||
<meterResult v-model:meterResult="parentMeterResult" />
|
||||
@ -20,120 +21,180 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import meterPar from '@/components/NGTools/meterPar';
|
||||
import ngComponents from '@/components/NGTools/NGCom';
|
||||
import meterResult from '@/components/NGTools/meterResult';
|
||||
import meterPar from '@/components/NGTools/meterPar';
|
||||
import ngComponents from '@/components/NGTools/NGCom';
|
||||
import meterResult from '@/components/NGTools/meterResult';
|
||||
|
||||
import { calcNGPar } from '@/api/ngtools/NGCalcTools.js';
|
||||
import {
|
||||
calcNGPar,
|
||||
calcFlow
|
||||
} from '@/api/ngtools/NGCalcTools.js';
|
||||
|
||||
export default {
|
||||
name: 'TabbedComponentWrapper',
|
||||
components: {
|
||||
meterPar,
|
||||
ngComponents,
|
||||
meterResult
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'meterpar',
|
||||
parentMeterPar: {
|
||||
dFlowCalbz: '0',
|
||||
dZcalbz: '0',
|
||||
dCbtj: '0',
|
||||
dpbM: 0,
|
||||
dtbM: 0,
|
||||
dpbE: 0,
|
||||
dtbE: 0,
|
||||
dPatm: 0.101325,
|
||||
dPatmUnit: 2,
|
||||
dngComponents: this.componentString,
|
||||
dMeterType: '0',
|
||||
dCoreType: '0',
|
||||
dPtmode: '0',
|
||||
dPipeType: '0',
|
||||
dPipeD: 259.38,
|
||||
dLenUnit: 3,
|
||||
dPipeDtemp: 20,
|
||||
dPileDtempU: 0,
|
||||
dPipeMaterial: '11.16',
|
||||
dOrificeD: 150.25,
|
||||
dOrificeUnit: 3,
|
||||
dOrificeDtemp: 0,
|
||||
dOrificeDtempUnit: 0,
|
||||
dOrificeMaterial: '16.6',
|
||||
dOrificeSharpness: 0,
|
||||
dOrificeRk: 0,
|
||||
dOrificeRkLenU: 0,
|
||||
dPf: 1.48,
|
||||
dPfUnit: 2,
|
||||
dPfType: '0',
|
||||
dTf: 15,
|
||||
dTfUnit: 0,
|
||||
dDp: 12.5,
|
||||
dDpUnit: 1,
|
||||
dVFlowUnit: 0,
|
||||
dMFlowUnit: 0,
|
||||
dEFlowUnit: 0,
|
||||
dCd: 0,
|
||||
dCdCalMethod: 0,
|
||||
dMeterFactor: 2354,
|
||||
dPulseNum: 12000,
|
||||
dVFlowMax: 6,
|
||||
dVFlowMin: 3,
|
||||
dVFlowCon: 5,
|
||||
dPfRangeMin: 0,
|
||||
dPfRangeMax: 0,
|
||||
dDpRangeMin: 0,
|
||||
dDpRangeMax: 0,
|
||||
dTfRangeMin: 0,
|
||||
dTfRangeMax: 0,
|
||||
dVGsc: 300,
|
||||
dVGscUnit: 0
|
||||
export default {
|
||||
name: 'TabbedComponentWrapper',
|
||||
components: {
|
||||
meterPar,
|
||||
ngComponents,
|
||||
meterResult
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
activeTab: 'meterpar',
|
||||
parentMeterPar: {
|
||||
dFlowCalbz: '0',
|
||||
dZcalbz: '0',
|
||||
dCbtj: '0',
|
||||
dpbM: 0,
|
||||
dtbM: 0,
|
||||
dpbE: 0,
|
||||
dtbE: 0,
|
||||
dPatm: 0.0981,
|
||||
dPatmUnit: 2,
|
||||
dngComponents: '',
|
||||
dMeterType: '0',
|
||||
dCoreType: '0',
|
||||
dPtmode: '0',
|
||||
dPipeType: '0',
|
||||
dPipeD: 259.38,
|
||||
dLenUnit: 3,
|
||||
dPipeDtemp: 20,
|
||||
dPileDtempU: 0,
|
||||
dPipeMaterial: '11.16',
|
||||
dOrificeD: 150.25,
|
||||
dOrificeUnit: 3,
|
||||
dOrificeDtemp: 0,
|
||||
dOrificeDtempUnit: 0,
|
||||
dOrificeMaterial: '16.6',
|
||||
dOrificeSharpness: 0,
|
||||
dOrificeRk: 0,
|
||||
dOrificeRkLenU: 0,
|
||||
dPf: 1.48,
|
||||
dPfUnit: 2,
|
||||
dPfType: '0',
|
||||
dTf: 15,
|
||||
dTfUnit: 0,
|
||||
dDp: 12.5,
|
||||
dDpUnit: 1,
|
||||
dVFlowUnit: 0,
|
||||
dVFlowWorkUnit: 0,
|
||||
dMFlowUnit: 0,
|
||||
dEFlowUnit: 6,
|
||||
dCd: 0,
|
||||
dCdCalMethod: 0,
|
||||
dMeterFactor: 2354,
|
||||
dPulseNum: 12000,
|
||||
dVFlowMax: 6,
|
||||
dVFlowMin: 3,
|
||||
dVFlowCon: 5,
|
||||
dPfRangeMin: 0,
|
||||
dPfRangeMax: 0,
|
||||
dDpRangeMin: 0,
|
||||
dDpRangeMax: 0,
|
||||
dTfRangeMin: 0,
|
||||
dTfRangeMax: 0,
|
||||
dVGsc: 300,
|
||||
dVGscUnit: 0
|
||||
},
|
||||
|
||||
parentMeterResult: {
|
||||
dE: 10,
|
||||
dFG: 0,
|
||||
dFT: 0,
|
||||
dDViscosity: 0,
|
||||
dDExpCoefficient: 0,
|
||||
dRnPipe: 0,
|
||||
dBk: 0,
|
||||
dRoughNessPipe: 0,
|
||||
dCdCorrect: 0,
|
||||
dCdNozell: 0,
|
||||
dVFlowb: 100,
|
||||
dVFlowf: 100,
|
||||
dVFlowUnit: 2,
|
||||
dMFlowb: 44,
|
||||
dMFlowUnit: 0,
|
||||
dEFlowb: 33,
|
||||
dEFlowUnit: 0,
|
||||
dVelocityFlow: 3,
|
||||
dVelocityUnit: 1,
|
||||
dPressLost: 300,
|
||||
dPressLostUnit: 0,
|
||||
dBeta: 0,
|
||||
dKappa: 0
|
||||
},
|
||||
componentString: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
calc() {
|
||||
console.log(this.parentMeterPar);
|
||||
calcNGPar(this.parentMeterPar)
|
||||
.then((res) => {
|
||||
|
||||
this.activeTab = "meterresult"
|
||||
console.log('Response:', res);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Request error:', error);
|
||||
});
|
||||
},
|
||||
|
||||
parentMeterResult: {
|
||||
dE: 10,
|
||||
dFG: null,
|
||||
dFT: null,
|
||||
dDViscosity: null,
|
||||
dDExpCoefficient: null,
|
||||
dRnPipe: null,
|
||||
dBk: null,
|
||||
dRoughNessPipe: null,
|
||||
dCdCorrect: null,
|
||||
dCdNozell: null,
|
||||
dVFlowb: 100,
|
||||
dVFlowf: 100,
|
||||
dVFlowUnit: 2,
|
||||
dMFlowb: 44,
|
||||
dMFlowUnit: 0,
|
||||
dEFlowb: 33,
|
||||
dEFlowUnit: 0,
|
||||
dVelocityFlow: 3,
|
||||
dVelocityUnit: 1,
|
||||
dPressLost: 300,
|
||||
dPressLostUnit: 0,
|
||||
dBeta: null,
|
||||
dKappa: null
|
||||
},
|
||||
componentString: ''
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
calc() {
|
||||
console.log(this.parentMeterPar);
|
||||
calcNGPar(this.parentMeterPar)
|
||||
.then((res) => {
|
||||
console.log('Response:', res);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Request error:', error);
|
||||
});
|
||||
calcFlow() {
|
||||
console.log(this.parentMeterPar);
|
||||
// 遍历对象并将每个属性的值设置为零
|
||||
for (const key in this.parentMeterResult) {
|
||||
if (this.parentMeterResult.hasOwnProperty(key)) {
|
||||
this.parentMeterResult[key] = 0;
|
||||
}
|
||||
}
|
||||
calcFlow(this.parentMeterPar)
|
||||
.then((res) => {
|
||||
this.parentMeterResult = res.data[0];
|
||||
console.log('Response:', this.parentMeterResult);
|
||||
this.activeTab = "meterresult"
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error('Request error:', error);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
</script>
|
||||
|
||||
<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);
|
||||
}
|
||||
|
||||
/* 使用深度选择器 */
|
||||
/deep/ .el-tabs__nav {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/deep/ .el-tabs__item {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
}
|
||||
</style>
|
||||
|
@ -1,189 +1,75 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch" label-width="160px">
|
||||
<el-form-item label="创建人名称" prop="createName">
|
||||
<el-input
|
||||
v-model="queryParams.createName"
|
||||
placeholder="请输入创建人名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.createName" placeholder="请输入创建人名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="更新人名称" prop="updateName">
|
||||
<el-input
|
||||
v-model="queryParams.updateName"
|
||||
placeholder="请输入更新人名称"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.updateName" placeholder="请输入更新人名称" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="流量计编号" prop="ybbh">
|
||||
<el-input
|
||||
v-model="queryParams.ybbh"
|
||||
placeholder="请输入流量计编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.ybbh" placeholder="请输入流量计编号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="求渐近速度系数 E" prop="dE">
|
||||
<el-input
|
||||
v-model="queryParams.dE"
|
||||
placeholder="请输入求渐近速度系数 E"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dE" placeholder="请输入求渐近速度系数 E" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="求相对密度系数 FG" prop="dFG">
|
||||
<el-input
|
||||
v-model="queryParams.dFG"
|
||||
placeholder="请输入求相对密度系数 FG"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dFG" placeholder="请输入求相对密度系数 FG" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="求流动温度系数 FT" prop="dFT">
|
||||
<el-input
|
||||
v-model="queryParams.dFT"
|
||||
placeholder="请输入求流动温度系数 FT"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dFT" placeholder="请输入求流动温度系数 FT" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="求动力粘度dlnd" prop="dDViscosity">
|
||||
<el-input
|
||||
v-model="queryParams.dDViscosity"
|
||||
placeholder="请输入求动力粘度dlnd"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dDViscosity" placeholder="请输入求动力粘度dlnd" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="求可膨胀系数" prop="dDExpCoefficient">
|
||||
<el-input
|
||||
v-model="queryParams.dDExpCoefficient"
|
||||
placeholder="请输入求可膨胀系数"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dDExpCoefficient" placeholder="请输入求可膨胀系数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管道雷诺数" prop="dRnPipe">
|
||||
<el-input
|
||||
v-model="queryParams.dRnPipe"
|
||||
placeholder="请输入管道雷诺数"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dRnPipe" placeholder="请输入管道雷诺数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="孔板锐利度系数Bk" prop="dBk">
|
||||
<el-input
|
||||
v-model="queryParams.dBk"
|
||||
placeholder="请输入孔板锐利度系数Bk"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dBk" placeholder="请输入孔板锐利度系数Bk" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管道粗糙度系数 Gme" prop="dRoughNessPipe">
|
||||
<el-input
|
||||
v-model="queryParams.dRoughNessPipe"
|
||||
placeholder="请输入管道粗糙度系数 Gme"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dRoughNessPipe" placeholder="请输入管道粗糙度系数 Gme" clearable
|
||||
@keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="修正后的流出系数" prop="dCdCorrect">
|
||||
<el-input
|
||||
v-model="queryParams.dCdCorrect"
|
||||
placeholder="请输入修正后的流出系数"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dCdCorrect" placeholder="请输入修正后的流出系数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="喷嘴的流出系数" prop="dCdNozell">
|
||||
<el-input
|
||||
v-model="queryParams.dCdNozell"
|
||||
placeholder="请输入喷嘴的流出系数"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dCdNozell" placeholder="请输入喷嘴的流出系数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标况体积流量m³/s" prop="dVFlowb">
|
||||
<el-input
|
||||
v-model="queryParams.dVFlowb"
|
||||
placeholder="请输入标况体积流量m³/s"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dVFlowb" placeholder="请输入标况体积流量m³/s" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="工况体积流量" prop="dVFlowf">
|
||||
<el-input
|
||||
v-model="queryParams.dVFlowf"
|
||||
placeholder="请输入工况体积流量"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dVFlowf" placeholder="请输入工况体积流量" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标况质量流量" prop="dMFlowb">
|
||||
<el-input
|
||||
v-model="queryParams.dMFlowb"
|
||||
placeholder="请输入标况质量流量"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dMFlowb" placeholder="请输入标况质量流量" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="标况能量流量" prop="dEFlowb">
|
||||
<el-input
|
||||
v-model="queryParams.dEFlowb"
|
||||
placeholder="请输入标况能量流量"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dEFlowb" placeholder="请输入标况能量流量" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="管道内天然气流速" prop="dVelocityFlow">
|
||||
<el-input
|
||||
v-model="queryParams.dVelocityFlow"
|
||||
placeholder="请输入管道内天然气流速"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dVelocityFlow" placeholder="请输入管道内天然气流速" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="压力损失" prop="dPressLost">
|
||||
<el-input
|
||||
v-model="queryParams.dPressLost"
|
||||
placeholder="请输入压力损失"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dPressLost" placeholder="请输入压力损失" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="直径比" prop="dBeta">
|
||||
<el-input
|
||||
v-model="queryParams.dBeta"
|
||||
placeholder="请输入直径比"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dBeta" placeholder="请输入直径比" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="等熵指数" prop="dKappa">
|
||||
<el-input
|
||||
v-model="queryParams.dKappa"
|
||||
placeholder="请输入等熵指数"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.dKappa" placeholder="请输入等熵指数" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="取样编号" prop="sampleno">
|
||||
<el-input
|
||||
v-model="queryParams.sampleno"
|
||||
placeholder="请输入取样编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.sampleno" placeholder="请输入取样编号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item label="仪表编号" prop="meterno">
|
||||
<el-input
|
||||
v-model="queryParams.meterno"
|
||||
placeholder="请输入仪表编号"
|
||||
clearable
|
||||
@keyup.enter="handleQuery"
|
||||
/>
|
||||
<el-input v-model="queryParams.meterno" placeholder="请输入仪表编号" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
@ -193,42 +79,20 @@
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="Plus"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['ngtools:meterresult:add']"
|
||||
>新增</el-button>
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd"
|
||||
v-hasPermi="['ngtools:meterresult:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="success"
|
||||
plain
|
||||
icon="Edit"
|
||||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['ngtools:meterresult:edit']"
|
||||
>修改</el-button>
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate"
|
||||
v-hasPermi="['ngtools:meterresult:edit']">修改</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="Delete"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['ngtools:meterresult:remove']"
|
||||
>删除</el-button>
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete"
|
||||
v-hasPermi="['ngtools:meterresult:remove']">删除</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="Download"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['ngtools:meterresult:export']"
|
||||
>导出</el-button>
|
||||
<el-button type="warning" plain icon="Download" @click="handleExport"
|
||||
v-hasPermi="['ngtools:meterresult:export']">导出</el-button>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
@ -261,19 +125,16 @@
|
||||
<el-table-column label="仪表编号" align="center" prop="meterno" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)" v-hasPermi="['ngtools:meterresult:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['ngtools:meterresult:remove']">删除</el-button>
|
||||
<el-button link type="primary" icon="Edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['ngtools:meterresult:edit']">修改</el-button>
|
||||
<el-button link type="primary" icon="Delete" @click="handleDelete(scope.row)"
|
||||
v-hasPermi="['ngtools:meterresult:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
v-model:page="queryParams.pageNum"
|
||||
v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<pagination v-show="total>0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 添加或修改流量计算结果对话框 -->
|
||||
<el-dialog :title="title" v-model="open" width="500px" append-to-body>
|
||||
@ -359,181 +220,192 @@
|
||||
</template>
|
||||
|
||||
<script setup name="Meterresult">
|
||||
import { listMeterresult, getMeterresult, delMeterresult, addMeterresult, updateMeterresult } from "@/api/ngtools/meterresult";
|
||||
import {
|
||||
listMeterresult,
|
||||
getMeterresult,
|
||||
delMeterresult,
|
||||
addMeterresult,
|
||||
updateMeterresult
|
||||
} from "@/api/ngtools/meterresult";
|
||||
|
||||
const { proxy } = getCurrentInstance();
|
||||
const {
|
||||
proxy
|
||||
} = getCurrentInstance();
|
||||
|
||||
const meterresultList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
const meterresultList = ref([]);
|
||||
const open = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
const title = ref("");
|
||||
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
createName: null,
|
||||
updateName: null,
|
||||
ybbh: null,
|
||||
dE: null,
|
||||
dFG: null,
|
||||
dFT: null,
|
||||
dDViscosity: null,
|
||||
dDExpCoefficient: null,
|
||||
dRnPipe: null,
|
||||
dBk: null,
|
||||
dRoughNessPipe: null,
|
||||
dCdCorrect: null,
|
||||
dCdNozell: null,
|
||||
dVFlowb: null,
|
||||
dVFlowf: null,
|
||||
dMFlowb: null,
|
||||
dEFlowb: null,
|
||||
dVelocityFlow: null,
|
||||
dPressLost: null,
|
||||
dBeta: null,
|
||||
dKappa: null,
|
||||
sampleno: null,
|
||||
meterno: null
|
||||
},
|
||||
rules: {
|
||||
const data = reactive({
|
||||
form: {},
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
createName: null,
|
||||
updateName: null,
|
||||
ybbh: null,
|
||||
dE: null,
|
||||
dFG: null,
|
||||
dFT: null,
|
||||
dDViscosity: null,
|
||||
dDExpCoefficient: null,
|
||||
dRnPipe: null,
|
||||
dBk: null,
|
||||
dRoughNessPipe: null,
|
||||
dCdCorrect: null,
|
||||
dCdNozell: null,
|
||||
dVFlowb: null,
|
||||
dVFlowf: null,
|
||||
dMFlowb: null,
|
||||
dEFlowb: null,
|
||||
dVelocityFlow: null,
|
||||
dPressLost: null,
|
||||
dBeta: null,
|
||||
dKappa: null,
|
||||
sampleno: null,
|
||||
meterno: null
|
||||
},
|
||||
rules: {}
|
||||
});
|
||||
|
||||
const {
|
||||
queryParams,
|
||||
form,
|
||||
rules
|
||||
} = toRefs(data);
|
||||
|
||||
/** 查询流量计算结果列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listMeterresult(queryParams.value).then(response => {
|
||||
meterresultList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
/** 查询流量计算结果列表 */
|
||||
function getList() {
|
||||
loading.value = true;
|
||||
listMeterresult(queryParams.value).then(response => {
|
||||
meterresultList.value = response.rows;
|
||||
total.value = response.total;
|
||||
loading.value = false;
|
||||
});
|
||||
}
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
createName: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateName: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
ybbh: null,
|
||||
dE: null,
|
||||
dFG: null,
|
||||
dFT: null,
|
||||
dDViscosity: null,
|
||||
dDExpCoefficient: null,
|
||||
dRnPipe: null,
|
||||
dBk: null,
|
||||
dRoughNessPipe: null,
|
||||
dCdCorrect: null,
|
||||
dCdNozell: null,
|
||||
dVFlowb: null,
|
||||
dVFlowf: null,
|
||||
dMFlowb: null,
|
||||
dEFlowb: null,
|
||||
dVelocityFlow: null,
|
||||
dPressLost: null,
|
||||
dBeta: null,
|
||||
dKappa: null,
|
||||
sampleno: null,
|
||||
meterno: null
|
||||
};
|
||||
proxy.resetForm("meterresultRef");
|
||||
}
|
||||
|
||||
// 取消按钮
|
||||
function cancel() {
|
||||
open.value = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
function reset() {
|
||||
form.value = {
|
||||
id: null,
|
||||
createName: null,
|
||||
createBy: null,
|
||||
createTime: null,
|
||||
updateName: null,
|
||||
updateBy: null,
|
||||
updateTime: null,
|
||||
ybbh: null,
|
||||
dE: null,
|
||||
dFG: null,
|
||||
dFT: null,
|
||||
dDViscosity: null,
|
||||
dDExpCoefficient: null,
|
||||
dRnPipe: null,
|
||||
dBk: null,
|
||||
dRoughNessPipe: null,
|
||||
dCdCorrect: null,
|
||||
dCdNozell: null,
|
||||
dVFlowb: null,
|
||||
dVFlowf: null,
|
||||
dMFlowb: null,
|
||||
dEFlowb: null,
|
||||
dVelocityFlow: null,
|
||||
dPressLost: null,
|
||||
dBeta: null,
|
||||
dKappa: null,
|
||||
sampleno: null,
|
||||
meterno: null
|
||||
};
|
||||
proxy.resetForm("meterresultRef");
|
||||
}
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
}
|
||||
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加流量计算结果";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _id = row.id || ids.value
|
||||
getMeterresult(_id).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改流量计算结果";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["meterresultRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateMeterresult(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addMeterresult(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除流量计算结果编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delMeterresult(_ids);
|
||||
}).then(() => {
|
||||
/** 搜索按钮操作 */
|
||||
function handleQuery() {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('ngtools/meterresult/export', {
|
||||
...queryParams.value
|
||||
}, `meterresult_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
/** 重置按钮操作 */
|
||||
function resetQuery() {
|
||||
proxy.resetForm("queryRef");
|
||||
handleQuery();
|
||||
}
|
||||
|
||||
getList();
|
||||
// 多选框选中数据
|
||||
function handleSelectionChange(selection) {
|
||||
ids.value = selection.map(item => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
}
|
||||
|
||||
/** 新增按钮操作 */
|
||||
function handleAdd() {
|
||||
reset();
|
||||
open.value = true;
|
||||
title.value = "添加流量计算结果";
|
||||
}
|
||||
|
||||
/** 修改按钮操作 */
|
||||
function handleUpdate(row) {
|
||||
reset();
|
||||
const _id = row.id || ids.value
|
||||
getMeterresult(_id).then(response => {
|
||||
form.value = response.data;
|
||||
open.value = true;
|
||||
title.value = "修改流量计算结果";
|
||||
});
|
||||
}
|
||||
|
||||
/** 提交按钮 */
|
||||
function submitForm() {
|
||||
proxy.$refs["meterresultRef"].validate(valid => {
|
||||
if (valid) {
|
||||
if (form.value.id != null) {
|
||||
updateMeterresult(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("修改成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
} else {
|
||||
addMeterresult(form.value).then(response => {
|
||||
proxy.$modal.msgSuccess("新增成功");
|
||||
open.value = false;
|
||||
getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/** 删除按钮操作 */
|
||||
function handleDelete(row) {
|
||||
const _ids = row.id || ids.value;
|
||||
proxy.$modal.confirm('是否确认删除流量计算结果编号为"' + _ids + '"的数据项?').then(function() {
|
||||
return delMeterresult(_ids);
|
||||
}).then(() => {
|
||||
getList();
|
||||
proxy.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
|
||||
/** 导出按钮操作 */
|
||||
function handleExport() {
|
||||
proxy.download('ngtools/meterresult/export', {
|
||||
...queryParams.value
|
||||
}, `meterresult_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
|
||||
getList();
|
||||
</script>
|
||||
|
@ -36,7 +36,7 @@ module.exports = {
|
||||
proxy: {
|
||||
// detail: https://cli.vuejs.org/config/#devserver-proxy
|
||||
[process.env.VUE_APP_BASE_API]: {
|
||||
target: `http://192.168.3.246:9090`,
|
||||
target: `http://localhost:9090`,
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
['^' + process.env.VUE_APP_BASE_API]: ''
|
||||
|
Loading…
Reference in New Issue
Block a user