Qx
qx
2025-03-18 dd24a2ea978b1e77ae4a510053cd1df0bf1863e7
src/views/doctor/check/index.vue
@@ -274,7 +274,7 @@
        <el-col v-show="baogaoqian">
          <template>
            <el-tabs v-model="radio" type="border-card" @tab-click="handleTabClick" style="margin-left: 10px">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index" :lazy="false">
                <el-table class="bgc" v-loading="loading" :data="proParentList.sons" border height="460px"
                  style="width: 96%; margin: 10px 10px" :row-class-name="tableRowClassName">
                  <el-table-column prop="project.proName" label="检测项目" width="150">
@@ -286,8 +286,8 @@
                        @input="vale($event, scope.row)" :disabled="scope.row.project.proName === 'BMI'"
                        ></el-input> -->
                        <template slot-scope="{ row, $index }">
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-${$index}`"
                        @keyup.enter.native="keyInputConfirm($event, $index)" @focus="handleFocus(row)"
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-item${index}-row${$index}`"
                      @keydown.enter.native="keyInputConfirm($event,index,$index)" @focus="handleFocus(row)"
                        @blur="handleInputConfirm(row)" @input="vale($event, row)"
                        :disabled="row.project.proName === 'BMI'"
                        ></el-input>
@@ -420,7 +420,7 @@
        <el-col :span="18" v-show="baogaohou">
          <template>
            <el-tabs v-model="radio" type="border-card" @tab-click="handleTabClick" style="margin-left: 10px">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index">
              <el-tab-pane :label="item.proName" :name="item.proId" v-for="(item, index) in Parent" :key="index" :lazy="false">
                <el-table class="bgc" v-loading="loading" :data="proParentList.sons" border height="460px"
                  style="width: 96%; margin: 10px 10px" :row-class-name="tableRowClassName">
                  <el-table-column prop="project.proName" label="检测项目" width="100">
@@ -431,8 +431,8 @@
                        placeholder="请输入检测结果" @focus="handleFocus(scope.row)" @blur="handleInputConfirm(scope.row)"
                        @input="vale"></el-input> -->
                        <template slot-scope="{ row, $index }">
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-${$index}`"
                        @keyup.enter.native="keyInputConfirm($event, $index)" @focus="handleFocus(row)"
                      <el-input type="textarea" autosize size="mini" v-model="row.proResult" :ref="`input-item${index}-row${$index}`"
                      @keydown.enter.native="keyInputConfirm($event,index,$index)" @focus="handleFocus(row)"
                        @blur="handleInputConfirm(row)" @input="vale($event, row)"
                        :disabled="row.project.proName === 'BMI'"
                        ></el-input>
@@ -1401,21 +1401,21 @@
    },
    keyInputConfirm(event, currentRowIndex) {
    keyInputConfirm(event,index, currentRowIndex) {
      // 阻止默认回车行为,比如提交表单
      event.preventDefault();
     event.stopPropagation()
      const nextRowIndex = currentRowIndex + 1; // 计算下一行索引
      // 如果下一行存在,则聚焦该行的输入框
      if (nextRowIndex < this.proParentList.sons.length) {
        this.$nextTick(() => {
          const nextInputRef = `input-${nextRowIndex}`;
          const nextInputRef = `input-item${index}-row${nextRowIndex}`;
          const nextInput = this.$refs[nextInputRef];
          if (nextInput) {
            // 处理 ref 可能为数组的情况(如动态渲染)
            const target = Array.isArray(nextInput) ? nextInput[0] : nextInput;
            target.focus(); // 聚焦输入框
            target.select(); // 可选:选中文本
            // target.select(); // 可选:选中文本
          }
        });
      }