<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="6">
        <el-row class="section-title">公费医疗自付总体比例</el-row>
        <el-form :inline="true" label-width="68px">
          <el-form-item>
            <el-button type="primary" icon="Edit" @click="handleEdit">修改</el-button>
            <el-button icon="Refresh" @click="resetTypeQuery">刷新</el-button>
          </el-form-item>
        </el-form>
        <el-table v-loading="typeLoading" :data="typeRatioList" height="600" stripe>
          <el-table-column label="医保分项编码" prop="ybClass" :show-overflow-tooltip="true" align="center" />
          <el-table-column label="医保分项名称" prop="ybClassName" :show-overflow-tooltip="true" align="center" />
          <el-table-column label="医保等级" prop="ybLvName" :show-overflow-tooltip="true" align="center" />
          <!-- 自付比例列 -->
          <el-table-column label="自付比例" align="center" width="150">
            <template #default="scope">
              <span
                v-if="scope.row.selfRatio !== null && scope.row.selfRatio !== undefined && scope.row.selfRatio !== ''">
                {{ scope.row.selfRatio }}%
              </span>
              <span v-else>-</span>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <el-col :span="18">
        <el-row class="section-title">单个药品/诊疗现行自付比例</el-row>
        <el-form :model="queryParams" ref="queryRef" v-show="showSearch" :inline="true" label-width="68px">
          <el-form-item label="项目" prop="searchKey">
            <el-input v-model="queryParams.searchKey" placeholder="项目编号/项目名称/医保编码" clearable style="width: 240px"
              @keyup.enter="handleQuery" />
          </el-form-item>
          <el-form-item label="项目分类" prop="itemType" label-width="100">
            <el-select v-model="queryParams.itemType" clearable style="width: 200px;">
              <el-option label="药品" value="1"></el-option>
              <el-option label="诊疗" value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
            <el-button icon="Refresh" @click="resetIndividualQuery">重置</el-button>
          </el-form-item>
        </el-form>

        <!-- 表格数据 -->
        <el-table v-loading="individualLoading" :data="individualRatioList">
          <el-table-column label="项目编号" prop="busNo" :show-overflow-tooltip="true" />
          <el-table-column label="项目名称" prop="name" :show-overflow-tooltip="true" />
          <el-table-column label="医保编码" width="250">
            <template #default="scope">
              <span v-if="scope.row.ybNo !== null && scope.row.ybNo !== undefined && scope.row.ybNo !== ''">
                {{ scope.row.ybNo }}
              </span>
              <span v-else>-</span>
            </template>
          </el-table-column>
          <el-table-column label="项目分类" prop="itemTypeName" :show-overflow-tooltip="true" width="110" align="center" />
          <el-table-column label="医保等级" prop="chrgitmLvName" :show-overflow-tooltip="true" width="110" align="center" />
          <!-- 自付比例列 -->
          <el-table-column label="自付比例" align="center" width="150">
            <template #default="scope">
              <span
                v-if="scope.row.selfRatio !== null && scope.row.selfRatio !== undefined && scope.row.selfRatio !== ''">
                {{ scope.row.selfRatio }}%
              </span>
              <span v-else>-</span>
            </template>
          </el-table-column>
          <!-- 二次自付比例列 -->
          <el-table-column label="二次自付比例" align="center" width="150">
            <template #default="scope">
              <span
                v-if="scope.row.twiceRatio !== null && scope.row.twiceRatio !== undefined && scope.row.twiceRatio !== ''">
                {{ scope.row.twiceRatio }}%
              </span>
              <span v-else>-</span>
            </template>
          </el-table-column>
          <el-table-column label="开始时间" prop="startDate" :show-overflow-tooltip="true" align="center" />
          <el-table-column label="结束时间" prop="endDate" :show-overflow-tooltip="true" align="center" />
        </el-table>

        <pagination v-show="individualTotal > 0" :total="individualTotal" v-model:page="queryParams.pageNo"
          v-model:limit="queryParams.pageSize" @pagination="getIndividualList" />
      </el-col>
    </el-row>

    <!-- 修改对话框 -->
    <el-dialog title="修改总体自付比例" v-model="typeRatioOpen" width="1000px" append-to-body>
      <el-form ref="typeRatioRef" :model="typeRatioForm" :rules="rules" label-width="180px">
        <el-row :gutter="20">
          <!-- 左侧列 -->
          <el-col :span="12">
            <el-form-item label="床位费比例（甲类）" prop="a01ratio">
              <el-input v-model="typeRatioForm.a01ratio" placeholder="请输入床位费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="诊察费比例（甲类）" prop="a02ratio">
              <el-input v-model="typeRatioForm.a02ratio" placeholder="请输入诊察费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="检查费比例（甲类）" prop="a03ratio">
              <el-input v-model="typeRatioForm.a03ratio" placeholder="请输入检查费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="化验费比例（甲类）" prop="a04ratio">
              <el-input v-model="typeRatioForm.a04ratio" placeholder="请输入化验费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="治疗费比例（甲类）" prop="a05ratio">
              <el-input v-model="typeRatioForm.a05ratio" placeholder="请输入治疗费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="手术费比例（甲类）" prop="a06ratio">
              <el-input v-model="typeRatioForm.a06ratio" placeholder="请输入手术费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="护理费比例（甲类）" prop="a07ratio">
              <el-input v-model="typeRatioForm.a07ratio" placeholder="请输入护理费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="卫生材料费比例（甲类）" prop="a08ratio">
              <el-input v-model="typeRatioForm.a08ratio" placeholder="请输入卫生材料费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="西药费比例（甲类）" prop="a09ratio">
              <el-input v-model="typeRatioForm.a09ratio" placeholder="请输入西药费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="中药饮片费比例（甲类）" prop="a10ratio">
              <el-input v-model="typeRatioForm.a10ratio" placeholder="请输入中药饮片费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="中成药费比例（甲类）" prop="a11ratio">
              <el-input v-model="typeRatioForm.a11ratio" placeholder="请输入中成药费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="一般诊疗费比例（甲类）" prop="a12ratio">
              <el-input v-model="typeRatioForm.a12ratio" placeholder="请输入一般诊疗费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="挂号费比例（甲类）" prop="a13ratio">
              <el-input v-model="typeRatioForm.a13ratio" placeholder="请输入挂号费比例（甲类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="其他费比例（甲类）" prop="a14ratio">
              <el-input v-model="typeRatioForm.a14ratio" placeholder="请输入其他费比例（甲类）" style="width: 100%" />
            </el-form-item>
          </el-col>

          <!-- 右侧列 -->
          <el-col :span="12">
            <el-form-item label="床位费比例（乙类）" prop="b01ratio">
              <el-input v-model="typeRatioForm.b01ratio" placeholder="请输入床位费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="诊察费比例（乙类）" prop="b02ratio">
              <el-input v-model="typeRatioForm.b02ratio" placeholder="请输入诊察费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="检查费比例（乙类）" prop="b03ratio">
              <el-input v-model="typeRatioForm.b03ratio" placeholder="请输入检查费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="化验费比例（乙类）" prop="b04ratio">
              <el-input v-model="typeRatioForm.b04ratio" placeholder="请输入化验费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="治疗费比例（乙类）" prop="b05ratio">
              <el-input v-model="typeRatioForm.b05ratio" placeholder="请输入治疗费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="手术费比例（乙类）" prop="b06ratio">
              <el-input v-model="typeRatioForm.b06ratio" placeholder="请输入手术费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="护理费比例（乙类）" prop="b07ratio">
              <el-input v-model="typeRatioForm.b07ratio" placeholder="请输入护理费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="卫生材料费比例（乙类）" prop="b08ratio">
              <el-input v-model="typeRatioForm.b08ratio" placeholder="请输入卫生材料费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="西药费比例（乙类）" prop="b09ratio">
              <el-input v-model="typeRatioForm.b09ratio" placeholder="请输入西药费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="中药饮片费比例（乙类）" prop="b10ratio">
              <el-input v-model="typeRatioForm.b10ratio" placeholder="请输入中药饮片费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="中成药费比例（乙类）" prop="b11ratio">
              <el-input v-model="typeRatioForm.b11ratio" placeholder="请输入中成药费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="一般诊疗费比例（乙类）" prop="b12ratio">
              <el-input v-model="typeRatioForm.b12ratio" placeholder="请输入一般诊疗费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="挂号费比例（乙类）" prop="b13ratio">
              <el-input v-model="typeRatioForm.b13ratio" placeholder="请输入挂号费比例（乙类）" style="width: 100%" />
            </el-form-item>
            <el-form-item label="其他费比例（乙类）" prop="b14ratio">
              <el-input v-model="typeRatioForm.b14ratio" placeholder="请输入其他费比例（乙类）" style="width: 100%" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary" @click="submitForm">确 定</el-button>
          <el-button @click="cancel">取 消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script setup name="GfRatioManage">
import {getIndividualRatioPage, getTypeRatioList, saveTypeRatioList} from "@/api/gf/ratioManage";

const { proxy } = getCurrentInstance();

const typeRatioOpen = ref(false);
const showSearch = ref(true);
const individualRatioList = ref([]);
const individualLoading = ref(true);
const individualTotal = ref(0);
const individualDateRange = ref([]);
const typeRatioList = ref([]);
const typeLoading = ref(true);
const typeDateRange = ref([]);

// 验证规则
const validateRatio = (rule, value, callback) => {
  if (value === '' || value === null) {
    return callback(new Error('自付比例不能为空'));
  }
  const numValue = parseFloat(value);
  if (isNaN(numValue)) {
    return callback(new Error('请输入有效数字'));
  }
  if (numValue < 0 || numValue > 100) {
    return callback(new Error('自付比例必须在0~100之间'));
  }
  // 验证小数位（可选）
  if (value.toString().includes('.') && value.toString().split('.')[1].length > 2) {
    return callback(new Error('最多保留两位小数'));
  }
  callback();
};

const data = reactive({
  typeRatioForm: {},
  queryParams: {
    pageNo: 1,
    pageSize: 10,
    searchKey: undefined,
    itemType: undefined,
  },
  rules: {
    a01ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b01ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a02ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b02ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a03ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b03ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a04ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b04ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a05ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b05ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a06ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b06ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a07ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b07ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a08ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b08ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a09ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b09ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a10ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b10ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a11ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b11ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a12ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b12ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a13ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b13ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    a14ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
    b14ratio: [
      { pattern: /^\d*(\.\d{0,2})?$/, message: '请输入数字，最多保留两位小数', trigger: 'blur' },
      { validator: validateRatio, trigger: 'blur' }
    ],
  }
});

const { queryParams, typeRatioForm, rules } = toRefs(data);

/** 查询单项比例分页 */
function getIndividualList() {
  individualLoading.value = true;
  getIndividualRatioPage(proxy.addDateRange(queryParams.value, individualDateRange.value)).then(response => {
    individualRatioList.value = response.data.records;
    individualTotal.value = response.data.total;
    individualLoading.value = false;
  });
}

/** 查询单项比例分页 */
function getTypeList() {
  typeLoading.value = true;
  getTypeRatioList(proxy.addDateRange(queryParams.value, typeDateRange.value)).then(response => {
    typeRatioList.value = response.data;
    typeLoading.value = false;
  });
}

/** 刷新按钮操作 */
function resetTypeQuery() {
  getTypeList();
}

/** 搜索按钮操作 */
function handleQuery() {
  queryParams.value.pageNo = 1;
  getIndividualList();
}
/** 重置按钮操作 */
function resetIndividualQuery() {
  individualDateRange.value = [];
  proxy.resetForm("queryRef");
  handleQuery();
}

/** 修改总体比例 */
function handleEdit() {
  typeRatioOpen.value = true;
  getTypeRatioList(proxy.addDateRange(queryParams.value, typeDateRange.value)).then(response => {
    typeRatioList.value = response.data;
    for (const r of typeRatioList.value) {
      if (r.ybClass == '01' && r.ybLv == '1') {
        typeRatioForm.value.a01ratio = r.selfRatio
      }
      if (r.ybClass == '01' && r.ybLv == '2') {
        typeRatioForm.value.b01ratio = r.selfRatio
      }
      if (r.ybClass == '02' && r.ybLv == '1') {
        typeRatioForm.value.a02ratio = r.selfRatio
      }
      if (r.ybClass == '02' && r.ybLv == '2') {
        typeRatioForm.value.b02ratio = r.selfRatio
      }
      if (r.ybClass == '03' && r.ybLv == '1') {
        typeRatioForm.value.a03ratio = r.selfRatio
      }
      if (r.ybClass == '03' && r.ybLv == '2') {
        typeRatioForm.value.b03ratio = r.selfRatio
      }
      if (r.ybClass == '04' && r.ybLv == '1') {
        typeRatioForm.value.a04ratio = r.selfRatio
      }
      if (r.ybClass == '04' && r.ybLv == '2') {
        typeRatioForm.value.b04ratio = r.selfRatio
      }
      if (r.ybClass == '05' && r.ybLv == '1') {
        typeRatioForm.value.a05ratio = r.selfRatio
      }
      if (r.ybClass == '05' && r.ybLv == '2') {
        typeRatioForm.value.b05ratio = r.selfRatio
      }
      if (r.ybClass == '06' && r.ybLv == '1') {
        typeRatioForm.value.a06ratio = r.selfRatio
      }
      if (r.ybClass == '06' && r.ybLv == '2') {
        typeRatioForm.value.b06ratio = r.selfRatio
      }
      if (r.ybClass == '07' && r.ybLv == '1') {
        typeRatioForm.value.a07ratio = r.selfRatio
      }
      if (r.ybClass == '07' && r.ybLv == '2') {
        typeRatioForm.value.b07ratio = r.selfRatio
      }
      if (r.ybClass == '08' && r.ybLv == '1') {
        typeRatioForm.value.a08ratio = r.selfRatio
      }
      if (r.ybClass == '08' && r.ybLv == '2') {
        typeRatioForm.value.b08ratio = r.selfRatio
      }
      if (r.ybClass == '09' && r.ybLv == '1') {
        typeRatioForm.value.a09ratio = r.selfRatio
      }
      if (r.ybClass == '09' && r.ybLv == '2') {
        typeRatioForm.value.b09ratio = r.selfRatio
      }
      if (r.ybClass == '10' && r.ybLv == '1') {
        typeRatioForm.value.a10ratio = r.selfRatio
      }
      if (r.ybClass == '10' && r.ybLv == '2') {
        typeRatioForm.value.b10ratio = r.selfRatio
      }
      if (r.ybClass == '11' && r.ybLv == '1') {
        typeRatioForm.value.a11ratio = r.selfRatio
      }
      if (r.ybClass == '11' && r.ybLv == '2') {
        typeRatioForm.value.b11ratio = r.selfRatio
      }
      if (r.ybClass == '12' && r.ybLv == '1') {
        typeRatioForm.value.a12ratio = r.selfRatio
      }
      if (r.ybClass == '12' && r.ybLv == '2') {
        typeRatioForm.value.b12ratio = r.selfRatio
      }
      if (r.ybClass == '13' && r.ybLv == '1') {
        typeRatioForm.value.a13ratio = r.selfRatio
      }
      if (r.ybClass == '13' && r.ybLv == '2') {
        typeRatioForm.value.b13ratio = r.selfRatio
      }
      if (r.ybClass == '14' && r.ybLv == '1') {
        typeRatioForm.value.a14ratio = r.selfRatio
      }
      if (r.ybClass == '14' && r.ybLv == '2') {
        typeRatioForm.value.b14ratio = r.selfRatio
      }
    }
  });
}

/** 提交按钮 */
function submitForm() {
  let form = {
    typeRatioList: [{
      ybClass: "01",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a01ratio
    }, {
      ybClass: "01",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b01ratio
    }, {
      ybClass: "02",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a02ratio
    }, {
      ybClass: "02",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b02ratio
    }, {
      ybClass: "03",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a03ratio
    }, {
      ybClass: "03",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b03ratio
    }, {
      ybClass: "04",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a04ratio
    }, {
      ybClass: "04",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b04ratio
    }, {
      ybClass: "05",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a05ratio
    }, {
      ybClass: "05",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b05ratio
    }, {
      ybClass: "06",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a06ratio
    }, {
      ybClass: "06",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b06ratio
    }, {
      ybClass: "07",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a07ratio
    }, {
      ybClass: "07",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b07ratio
    }, {
      ybClass: "08",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a08ratio
    }, {
      ybClass: "08",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b08ratio
    }, {
      ybClass: "09",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a09ratio
    }, {
      ybClass: "09",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b09ratio
    }, {
      ybClass: "10",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a10ratio
    }, {
      ybClass: "10",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b10ratio
    }, {
      ybClass: "11",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a11ratio
    }, {
      ybClass: "11",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b11ratio
    }, {
      ybClass: "12",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a12ratio
    }, {
      ybClass: "12",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b12ratio
    }, {
      ybClass: "13",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a13ratio
    }, {
      ybClass: "13",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b13ratio
    }, {
      ybClass: "14",
      ybLv: "1",
      selfRatio: typeRatioForm.value.a14ratio
    }, {
      ybClass: "14",
      ybLv: "2",
      selfRatio: typeRatioForm.value.b14ratio
    }]
  }
  proxy.$refs["typeRatioRef"].validate(valid => {
    if (valid) {
      saveTypeRatioList(form).then(response => {
        proxy.$modal.msgSuccess("修改成功");
        typeRatioOpen.value = false;
        getTypeList();
      })
    }
  })
}
/** 取消按钮 */
function cancel() {
  open.value = false;
  reset();
}

getIndividualList();
getTypeList();
</script>

<style>
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 15px;
}

.grid-item {
  margin-bottom: 0;
  background: white;
  border-radius: 8px;
  padding: 5px;
  transition: all 0.3s ease;
}

.grid-item :deep(.el-input) {
  width: 100%;
}

/* 描述文本样式 */
.item-description {
  font-size: 12px;
  color: #7f8c8d;
  margin-top: 8px;
  line-height: 1.4;
  padding: 5px;
  background-color: #f9f9f9;
  border-radius: 4px;
}

.section-title {
  margin-bottom: 20px;
  font-weight: 550;
  font-size: 18px;
  color: #515A6E;
}
</style>
