Newer
Older
Nanping_sponge_GCYPG / src / views / preassess / noopReview / components / underlySurfaceTable.vue
@liyingjing liyingjing on 25 Oct 2023 2 KB 工程预评估
<template>
  <el-form
    class="tableForm"
    ref="tableForm"
    :model="formModel"
    :disabled="props.disabled"
  >
    <el-table
      :data="formModel.list"
      v-loading="loading"
      stripe
      element-loading-text="数据加载中..."
    >
      <el-table-column label="下垫面类型" align="center" prop="itemName" show-overflow-tooltip />
      <el-table-column label="面积㎡" align="center" prop="area">
        <template #default="{ row, $index }">
          <el-form-item
            :prop="'list.' + $index + '.' + 'area'"
            :rules="rules['area']"
          >
            <el-input v-model="row.area" />
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="径流系数" align="center" prop="runoffCoefficient">
        <template #header>
          <span>径流系数</span>
          <popover>
            <span style="font-weight: 700">说明</span>
            <br />
            <span>可输入参考值范围内的值,默认取径流系数参考值下限</span>
          </popover>
        </template>
        <template #default="{ row, $index }">
          <el-form-item
            :prop="'list.' + $index + '.' + 'runoffCoefficient'"
            :rules="rules['runoffCoefficient']"
          >
            <el-input v-model="row.runoffCoefficient" />
          </el-form-item>
        </template>
      </el-table-column>
      <el-table-column label="径流系数参考值" align="center" show-overflow-tooltip>
        <template #header>
          <span>径流系数参考值</span>
          <popover>
            <span style="font-weight: 700">说明</span>
            <br />
            <span>由下垫面建议径流系数配置获取</span>
          </popover>
        </template>
        <template #default="{ row }">
          <span>{{ `${row.downValue}-${row.upValue}` }}</span>
        </template>
      </el-table-column>
    </el-table>
  </el-form>
</template>

<script setup>
import { reactive } from 'vue'
import { isNumber, isScope } from '@/utils/validate-helper'
const { proxy } = getCurrentInstance()
import useTable from './mixins'
import popover from '@/components/popover'
const { loading, formModel, validate } = useTable(proxy)
const props = defineProps({
  list: {
    type: Array,
    default: () => {}
  },
  disabled: {
    type: Boolean,
    default: false
  }
})
const rules = reactive({
  area: isNumber('面积', { required: false, min: 0 }),
  runoffCoefficient: isScope('径流系数', { required: false, data: formModel })
})

defineExpose({
  validate
})
</script>

<style lang="scss" scoped></style>