<template>
  <div class="app-container">
    <el-form :model="meterResult" label-position="top" ref="queryRef" :inline="false" label-width="160px">
      <el-form-item label="求渐近速度系数 E" prop="dE" ref="selectRef">
        <el-input v-model="meterResult.dE" />
      </el-form-item>
      <el-form-item label="求相对密度系数 FG" prop="dFG">
        <el-input v-model="meterResult.dFG" placeholder=" " />
      </el-form-item>
      <el-form-item label="求流动温度系数 FT" prop="dFT">
        <el-input v-model="meterResult.dFT" placeholder="" />
      </el-form-item>
      <el-form-item label="求动力粘度dlnd" prop="dDViscosity">
        <el-input v-model="meterResult.dDViscosity" placeholder="" />
      </el-form-item>
      <el-form-item label="求可膨胀系数" prop="dDExpCoefficient">
        <el-input v-model="meterResult.dDExpCoefficient" placeholder="" />
      </el-form-item>
      <el-form-item label="管道雷诺数" prop="dRnPipe">
        <el-input v-model="meterResult.dRnPipe" placeholder="" />
      </el-form-item>
      <el-form-item label="孔板锐利度系数Bk" prop="dBk">
        <el-input v-model="meterResult.dBk" placeholder="" />
      </el-form-item>
      <el-form-item label="管道粗糙度系数 Gme" prop="dRoughNessPipe">
        <el-input v-model="meterResult.dRoughNessPipe" placeholder="" />
      </el-form-item>
      <el-form-item label="修正后的流出系数" prop="dCdCorrect">
        <el-input v-model="meterResult.dCdCorrect" placeholder="" />
      </el-form-item>
      <el-form-item label="喷嘴的流出系数" prop="dCdNozell">
        <el-input 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' }"
        />
      </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' }"
        />
      </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' }"
        />
      </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' }"
        />
      </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' }"
        />
      </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' }"
        />
      </el-form-item>
      <el-form-item label="直径比" prop="dBeta">
        <el-input v-model="meterResult.dBeta" placeholder="" />
      </el-form-item>
      <el-form-item label="等熵指数" prop="dKappa">
        <el-input 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
  },

  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);
      }
    }
  },
  mounted() {
    this.selectWidth = this.$refs.selectRef.$el.offsetWidth;
  },
  methods: {}
};
</script>

<style scoped>
/* 可按需添加样式 */
.app-container {
  display: flex;
  align-items: center;
  gap: 2px;
  position: relative;
}
</style>
