<template>
  <div class="batch-calibration-table">
    <div v-for="(rowData, rowIdx) in tableData" :key="rowIdx" class="form-block">
      <el-form :model="rowData" ref="tablePllr" label-width="130px" style="width: 100%">
        <!-- 顶部标题 -->
        <div style="text-align:center; margin:10px 0;">
          <div style="font-size:16px; font-weight:bold;">广西北港新材料有限公司检测中心</div>
          <div style="font-size:18px; font-weight:bold; margin:5px 0;">标准溶液标定记录</div>
          <div style="display:flex; justify-content:space-between; font-size:13px; margin:5px 10px;">
            <span>BBWXCLJC-4-11-03</span>
            <span>编号：{{ rowData.recordNo || '2025092702-2' }}</span>
          </div>
        </div>

        <!-- 表格主体：统一6列等宽布局 -->
        <table class="common-table-style4 fixed-layout" border style="width:100%;border-collapse:collapse;">
          <!-- 定义6列等宽 -->
          <colgroup>
            <col style="width:16.6666%">
            <col style="width:16.6666%">
            <col style="width:16.6666%">
            <col style="width:16.6666%">
            <col style="width:16.6666%">
            <col style="width:16.6666%">
          </colgroup>

          <!-- 标定序号行（合并6列） -->
          <tr>
            <td colspan="6" style="text-align:center; padding:6px; font-weight:bold;">标定{{ rowIdx + 1 }}</td>
          </tr>

          <!-- 基础信息行1：溶液名称 + 溶液编号 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">溶液名称</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[0] ? cols[0].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="0" @keydown.native="handleKeyDown($event, rowIdx, 0)"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">溶液编号</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[1] ? cols[1].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="1" @keydown.native="handleKeyDown($event, rowIdx, 1)"></el-input>
            </td>
          </tr>

          <!-- 基础信息行2：标定物名称 + 标定物编号 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">标定物名称</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[2] ? cols[2].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="2" @keydown.native="handleKeyDown($event, rowIdx, 2)"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">标定物编号</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[3] ? cols[3].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="3" @keydown.native="handleKeyDown($event, rowIdx, 3)"></el-input>
            </td>
          </tr>

          <!-- 基础信息行3：标定物级别批号 + 标定物厂家 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">标定物级别批号</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[4] ? cols[4].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="4" @keydown.native="handleKeyDown($event, rowIdx, 4)"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">标定物厂家</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[5] ? cols[5].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="5" @keydown.native="handleKeyDown($event, rowIdx, 5)"></el-input>
            </td>
          </tr>

          <!-- 干燥/灼烧仪器 + 仪器编号 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">干燥/灼烧仪器</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[6] ? cols[6].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="6" @keydown.native="handleKeyDown($event, rowIdx, 6)"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">干燥/灼烧仪器编号</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[7] ? cols[7].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="7" @keydown.native="handleKeyDown($event, rowIdx, 7)"></el-input>
            </td>
          </tr>

          <!-- 干燥/灼烧温度 + 干燥/灼烧时间 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">干燥/灼烧温度(℃)</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[8] ? cols[8].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="8" @keydown.native="handleKeyDown($event, rowIdx, 8)"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">干燥/灼烧时间(h)</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[9] ? cols[9].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="9" @keydown.native="handleKeyDown($event, rowIdx, 9)"></el-input>
            </td>
          </tr>

          <!-- 干燥/灼烧恒重（单字段，合并5列） -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">干燥/灼烧恒重(g)</td>
            <td colspan="5" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[10] ? cols[10].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="10" @keydown.native="handleKeyDown($event, rowIdx, 10)"></el-input>
            </td>
          </tr>

          <!-- 环境参数：温度、水温、湿度（三组，每组占2列） -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">温度(℃)</td>
            <td colspan="1" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[14] ? cols[14].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="14" @keydown.native="handleKeyDown($event, rowIdx, 14)"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">水温(℃)</td>
            <td colspan="1" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[15] ? cols[15].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="15" @keydown.native="handleKeyDown($event, rowIdx, 15)"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">湿度(%)</td>
            <td colspan="1" style="padding:6px;">
              <el-input size="mini" v-model="rowData[cols[16] ? cols[16].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="16" @keydown.native="handleKeyDown($event, rowIdx, 16)"></el-input>
            </td>
          </tr>

          <!-- ========= 标定数据区域：6列等宽 ========= -->
          <!-- 表头行：标定序号、1、2、3、4、空 -->
          <tr style="font-weight:bold; text-align:center;">
            <td style="padding:6px;">标定序号</td>
            <td style="padding:6px;">1</td>
            <td style="padding:6px;">2</td>
            <td style="padding:6px;">3</td>
            <td style="padding:6px;">4</td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 标定物用量 (g/ml) -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">标定物用量(g/ml)</td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[21] ? cols[21].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="21" @keydown.native="handleKeyDown($event, rowIdx, 21)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[23] ? cols[23].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="23" @keydown.native="handleKeyDown($event, rowIdx, 23)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[24] ? cols[24].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="24" @keydown.native="handleKeyDown($event, rowIdx, 24)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[25] ? cols[25].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="25" @keydown.native="handleKeyDown($event, rowIdx, 25)"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 滴定初读数V₀(ml) -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">滴定初读数V₀(ml)</td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[26] ? cols[26].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="26" @keydown.native="handleKeyDown($event, rowIdx, 26)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[27] ? cols[27].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="27" @keydown.native="handleKeyDown($event, rowIdx, 27)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[28] ? cols[28].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="28" @keydown.native="handleKeyDown($event, rowIdx, 28)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[29] ? cols[29].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="29" @keydown.native="handleKeyDown($event, rowIdx, 29)"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 滴定末读数V₁(ml) -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">滴定末读数V₁(ml)</td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[30] ? cols[30].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="30" @keydown.native="handleKeyDown($event, rowIdx, 30)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[31] ? cols[31].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="31" @keydown.native="handleKeyDown($event, rowIdx, 31)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[32] ? cols[32].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="32" @keydown.native="handleKeyDown($event, rowIdx, 32)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[33] ? cols[33].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="33" @keydown.native="handleKeyDown($event, rowIdx, 33)"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 滴定体积V₃(ml) - 自动计算只读 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">滴定体积V₃(ml)</td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[34] ? cols[34].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="34"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[35] ? cols[35].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="35"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[36] ? cols[36].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="36"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[37] ? cols[37].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="37"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 温度校正后值V₄(ml) - 自动计算只读 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">温度校正后值V₄(ml)</td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[38] ? cols[38].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="38"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[39] ? cols[39].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="39"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[40] ? cols[40].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="40"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[41] ? cols[41].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="41"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 滴定管校正后值V₅(ml) - 自动计算只读 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">滴定管校正后值V₅(ml)</td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[42] ? cols[42].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="42"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[43] ? cols[43].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="43"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[44] ? cols[44].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="44"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[45] ? cols[45].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="45"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 空白试验体积V₆(ml) -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">空白试验体积V₆(ml)</td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[46] ? cols[46].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="46" @keydown.native="handleKeyDown($event, rowIdx, 46)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[47] ? cols[47].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="47" @keydown.native="handleKeyDown($event, rowIdx, 47)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[48] ? cols[48].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="48" @keydown.native="handleKeyDown($event, rowIdx, 48)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[49] ? cols[49].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="49" @keydown.native="handleKeyDown($event, rowIdx, 49)"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 实际消耗体积V(ml) - 自动计算只读 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">实际消耗体积V(ml)</td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[50] ? cols[50].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="50"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[51] ? cols[51].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="51"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[52] ? cols[52].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="52"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" readonly v-model="rowData[cols[53] ? cols[53].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="53"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 计算公式（合并6列） -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">计算公式</td>
            <td colspan="5" style="padding:6px;">
              <el-input type="textarea" :rows="2" size="mini" v-model="rowData[cols[54] ? cols[54].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="54" @keydown.native="handleKeyDown($event, rowIdx, 54)"></el-input>
            </td>
          </tr>

          <!-- 结果计算值 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">结果计算值</td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[55] ? cols[55].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="55" @keydown.native="handleKeyDown($event, rowIdx, 55)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[56] ? cols[56].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="56" @keydown.native="handleKeyDown($event, rowIdx, 56)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[57] ? cols[57].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="57" @keydown.native="handleKeyDown($event, rowIdx, 57)"></el-input></td>
            <td style="padding:6px;"><el-input size="mini" v-model="rowData[cols[58] ? cols[58].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="58" @keydown.native="handleKeyDown($event, rowIdx, 58)"></el-input></td>
            <td style="padding:6px;"></td>
          </tr>

          <!-- 平均值与极差 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">单人结果平均值1</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" readonly v-model="rowData[cols[59] ? cols[59].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="59"></el-input>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">CR0.95(4)r-1</td>
            <td style="padding:6px;">
              <el-input size="mini" readonly v-model="rowData[cols[60] ? cols[60].ANLY_ITEM_NO : '']" :data-row="rowIdx" :data-col="60"></el-input>
            </td>
            <td style="padding:6px; font-weight:bold;">(≤0.15)</td>
          </tr>

          <!-- 标定人员与日期 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">标定日期</td>
            <td colspan="2" style="padding:6px;">
              <el-date-picker size="mini" type="date" value-format="yyyy-MM-dd" v-model="rowData.calibDate" style="width:100%"></el-date-picker>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">标定人员</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData.calibUser" :data-row="rowIdx" :data-col="61" @keydown.native="handleKeyDown($event, rowIdx, 61)"></el-input>
            </td>
          </tr>

          <!-- 复核人员与日期 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">复核日期</td>
            <td colspan="2" style="padding:6px;">
              <el-date-picker size="mini" type="date" value-format="yyyy-MM-dd" v-model="rowData.reviewDate" style="width:100%"></el-date-picker>
            </td>
            <td style="padding:6px; text-align:right; font-weight:bold;">复核人员</td>
            <td colspan="2" style="padding:6px;">
              <el-input size="mini" v-model="rowData.reviewUser" :data-row="rowIdx" :data-col="62" @keydown.native="handleKeyDown($event, rowIdx, 62)"></el-input>
            </td>
          </tr>

          <!-- 备注 -->
          <tr>
            <td style="padding:6px; text-align:right; font-weight:bold;">备 注</td>
            <td colspan="5" style="padding:6px;">
              <el-input type="textarea" :rows="2" size="mini" placeholder="无相关数据处保持空白状态" v-model="rowData.remark" :data-row="rowIdx" :data-col="63" @keydown.native="handleKeyDown($event, rowIdx, 63)"></el-input>
            </td>
          </tr>
        </table>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: "BatchCalibrationTable",
  props: {
    tableData: {
      type: Array,
      required: true,
      default: function() {
        return [];
      }
    },
    cols: {
      type: Array,
      required: true,
      default: function() {
        return [];
      }
    },
    theight4: {
      type: [Number, String],
      default: 400
    }
  },
  mounted: function() {
    this.validateFieldMapping();
  },
  methods: {
    validateFieldMapping: function() {
      if (this.tableData.length === 0 || this.cols.length === 0) {
        return;
      }
      var firstRow = this.tableData[0];
      var dataKeys = Object.keys(firstRow);
      var configKeys = [];
      for (var i = 0; i < this.cols.length; i++) {
        var col = this.cols[i];
        if (!col) continue;
        var key = col.ANLY_ITEM_NO || col.STUFF_NO;
        if (key) {
          configKeys.push(key);
        }
      }
      var missingKeys = [];
      for (var j = 0; j < configKeys.length; j++) {
        var k = configKeys[j];
        if (dataKeys.indexOf(k) === -1) {
          missingKeys.push(k);
        }
      }
      if (missingKeys.length > 0) {
        console.warn("字段不匹配：", missingKeys);
      }
    },
    handleKeyDown: function(event, rowIdx, colIdx) {
      var tagName = event.target.tagName;
      var isTextArea = (tagName === "TEXTAREA");
      if (event.key !== "Enter" || isTextArea) {
        return;
      }
      event.preventDefault();
      var getAvailableInputs = function(targetRow) {
        var selector = '[data-row="' + targetRow + '"]';
        var wrappers = document.querySelectorAll(selector);
        var list = [];
        for (var i = 0; i < wrappers.length; i++) {
          var wrap = wrappers[i];
          var el = wrap.querySelector("input,textarea") || wrap;
          if (!el) continue;
          if (el.disabled || el.readOnly) continue;
          if (el.offsetParent === null) continue;
          list.push(el);
        }
        list.sort(function(a, b) {
          var c1 = parseInt(a.dataset.col || 0, 10);
          var c2 = parseInt(b.dataset.col || 0, 10);
          return c1 - c2;
        });
        return list;
      };
      var currentInputs = getAvailableInputs(rowIdx);
      var current = null;
      for (var i = 0; i < currentInputs.length; i++) {
        if (currentInputs[i] === event.target) {
          current = currentInputs[i];
          break;
        }
      }
      if (!current) return;
      var index = -1;
      for (var i = 0; i < currentInputs.length; i++) {
        if (currentInputs[i] === current) {
          index = i;
          break;
        }
      }
      if (index === -1) return;
      var that = this;
      this.$nextTick(function() {
        if (index < currentInputs.length - 1) {
          var nextInput = currentInputs[index + 1];
          if (nextInput) {
            nextInput.focus();
            if (nextInput.tagName === "INPUT") {
              nextInput.select();
            }
          }
        } else {
          var nextRow = rowIdx + 1;
          var nextInputs = getAvailableInputs(nextRow);
          var target;
          if (nextInputs.length > 0) {
            target = nextInputs[0];
          } else {
            target = currentInputs[0];
          }
          if (target) {
            target.focus();
            if (target.tagName === "INPUT") {
              target.select();
            }
          }
        }
      });
    },
    handleInputChange: function(row, field, index) {
      this.$emit("data-change", row, field, index);
    }
  }
};
</script>

<style scoped>
.common-table-style4 {
  font-size: 13px;
  color: #333;
  width: 100%;
  border: 1px solid #999;
}
.common-table-style4 td {
  border: 1px solid #999;
  padding: 4px;
  vertical-align: middle;
}
/* 固定布局确保等宽生效 */
.common-table-style4.fixed-layout {
  table-layout: fixed;
}
.form-block {
  margin-bottom: 20px;
}
:deep(.el-form-item) {
  margin-bottom: 0;
}
:deep(.el-input__inner) {
  border-radius: 0;
}
:deep(.el-textarea__inner) {
  border-radius: 0;
}
</style>
