| 
						 | 
						<template>  <div>    <el-table :data="doctorCheck.checkItemList" style="width: 100%" :height="tableHeight" border highlight-current-row      @row-click="rowClick" size="small">      <el-table-column prop="itemName" label="项目" width="220" />      <el-table-column prop="result" label="结果" min-width="200">        <template slot-scope="scope">          <div style="display: flex">            <el-autocomplete style="width: 100%" type="textarea" v-model="scope.row.result" placeholder="请输入结果值"              :disabled="rowResultDisabled(scope.row)" :autosize="{ minRows: 1, maxRows: 10 }" :trigger-on-focus="false"              :fetch-suggestions="querySearch" :data-lineModeFlag="scope.row.lineModeFlag" @input="                madeTooltips(scope.$index);              computeFun(scope.$index);              " v-bind:class="scope.row.class">            </el-autocomplete>            <el-button style="min-width: 23px; padding: 2px" icon="el-icon-caret-bottom"              @click="btnMoreResult(scope.row, scope.$index)" :disabled="rowResultDisabled(scope.row)"              size="small"></el-button>            <el-button style="min-width: 23px; padding: 2px; margin-left: 2px"              @click="btnPacsResult(scope.row, scope.$index)" :disabled="rowResultDisabled(scope.row)"              size="small">P</el-button>            <el-button style="min-width: 23px; padding: 5.8px; margin-left: 2px"              :disabled="rowResultDisabled(scope.row)" @click="btnPacsRessulst(scope.row)" size="small">S</el-button>            <!-- <el-popover              placement="top-end"              width="500"              trigger="click"              :title="scope.row.itemName"            >              <el-tabs v-model="activeName">                <el-tab-pane label="文字结果" name="first">                  <el-table :data="gridData">                    <el-table-column                      property="checkDate"                      label="检查日期"                      align="center"                    ></el-table-column>                    <el-table-column                      property="itemResult"                      label="项目结果"                      align="center"                    ></el-table-column>                  </el-table>                </el-tab-pane>                <el-tab-pane label="折线图" name="second">                  <div                    style="height: 200px; width: 200px"                    ref="chart"                  ></div>                </el-tab-pane>              </el-tabs>              <el-button                slot="reference"                style="min-width: 23px; padding: 5.8px; margin-left: 2px"                :disabled="rowResultDisabled(scope.row)"                @click="btnPacsRessulst(scope.row)"                size="small"                >S</el-button              >            </el-popover> -->          </div>        </template>      </el-table-column>      <el-table-column prop="unit" label="单位" width="90" align="center" />      <el-table-column prop="referenceRangeValue" label="参考范围" width="120" align="center" />      <el-table-column prop="resultStatusId" label="提示" width="40" align="center">        <template slot-scope="scope">          <div>            {{              dddw(                resultStatus,                "id",                scope.row.resultStatusId,                "dataInputPrompt"              )            }}          </div>        </template>      </el-table-column>      <el-table-column prop="criticalFlag" label="危急值" width="50" align="center">        <template slot-scope="scope">          <el-button :style="[            { minWidth: '23px' },            { padding: '6px 2px' },            {              backgroundColor: scope.row.isCriticalValue == 'Y' ? 'red' : '',            },          ]" @click="btnCritical(scope.row)" size="small">W</el-button>        </template>      </el-table-column>    </el-table>
    <!--弹窗-->    <div>      <!-- 结果录入模版 -->      <el-dialog title="结果录入模版" :visible.sync="dialogWinMoreResult" width="800px" :close-on-click-modal="false">        <div style="margin-top: -10px">          <el-checkbox v-model="isSplitChooseResult" size="small" true-label="Y"            false-label="N">选结果模板时自动添加分隔符;</el-checkbox>          <div style="              overflow-y: auto;              height: 300px;              width: 100%;              display: flex;              flex-wrap: wrap;              align-content: flex-start;            ">            <div v-for="item in moreResult.data" :key="item.id" style="margin: 5px; cursor: pointer"              @click="clickResult(item)" @dblclick="dblclickResult(item)">              <el-tag size="samll" style="                  padding: 0 3px;                  height: 24px;                  line-height: 24px;                  font-size: 14px;                  color: #303133;                  background-color: white;                ">{{ item.result }}</el-tag>            </div>          </div>          <div>特殊符号:</div>          <div style="              overflow-y: auto;              width: 100%;              display: flex;              flex-wrap: wrap;              align-content: flex-start;            ">            <div v-for="item in symbols" :key="item.id" style="margin: 1px 2px; cursor: pointer"              @click="insertSymbols(item.displayName)">              <el-tag style="                  padding: 0 3px;                  height: 24px;                  line-height: 24px;                  font-size: 15px;                  color: #303133;                  background-color: white;                ">                {{ item.displayName }}              </el-tag>            </div>          </div>          <div style="display: flex; justify-content: space-between">            <div style="margin-top: 5px">录入结果:</div>            <div style="overflow-y: auto; display: flex; flex-wrap: wrap">              <div v-for="item in splitSymbols" :key="item" style="margin: 1px 2px; cursor: pointer"                @click="insertSymbols(item)">                <el-tag style="                    padding: 0 3px;                    height: 24px;                    line-height: 24px;                    font-size: 15px;                    color: #303133;                    background-color: white;                  ">                  {{ item }}                </el-tag>              </div>            </div>          </div>          <el-input id="resultBox" style="width: 100%" class="commonFont" type="textarea"            :autosize="{ minRows: 4, maxRows: 4 }" v-model="moreResult.result" />        </div>        <span slot="footer" class="dialog-footer">          <el-button @click="btnClear">清 除</el-button>          <el-button type="primary" @click="btnOkResult('defaultResult')">默认结果</el-button>          <el-button type="primary" @click="btnOkResult('')">确 定</el-button>          <el-button @click="dialogWinMoreResult = false">关 闭</el-button>        </span>      </el-dialog>
      <!--Pacs结果录入模版-->      <el-dialog :title="'Pacs结果录入模版 -- ' + doctorCheck.checkItemList[pacsParams.index].itemName"        v-if="dialogWinPacsTemplate" :visible.sync="dialogWinPacsTemplate" width="880px" :close-on-click-modal="false">        <PacsTemplate :refParams="pacsParams" :refFuncOther="handlePacsResult" />      </el-dialog>
      <el-dialog :title="curRow.itemName" :visible.sync="previousResults" width="500px" :close-on-click-modal="true"        :show-close="false" @close="resultsclose">        <el-tabs v-model="activeName">          <el-tab-pane label="文字结果" name="first">            <el-table :data="gridData">              <el-table-column property="checkDate" label="检查日期" align="center"></el-table-column>              <el-table-column property="itemResult" label="项目结果" align="center"></el-table-column>            </el-table>          </el-tab-pane>          <el-tab-pane label="折线图" name="second">            <div style="height: 400px; width: 500px" ref="chart1"></div>          </el-tab-pane>        </el-tabs>      </el-dialog>    </div>  </div></template><script>// 0-无参考范围,1-数字型,2-字符型,3-性激素
import { mapState } from "vuex";import { getapi, postapi, putapi, deletapi } from "@/api/api";import { arrayExistObj, dddw, deepCopy } from "../../utlis/proFunc";import PacsTemplate from "./PacsTemplate.vue";import * as echarts from "echarts";export default {  components: {    PacsTemplate,  },  props: ["isCheckPicture", "registerCheckId", "doctor_check_check_charge"],  data() {    return {      activeName: "first",      previousResults: false,      gridData: [],      resultStatus: [], //结果状态提示数据
      tipsNormal: {        id: "01",        displayName: "正常",        dataInputPrompt: "正常",        reportPrompt: "正常",        reportBackgroundColor: 16777215,        reportFontColor: 0,        dataInputBackgroundColor: 16777215,        dataInputFontColor: 0,      }, //正常提示
      tipsError: {}, //错误提示
      tipsNegative: {}, //阴性提示
      tipsLowPositive: {}, //弱阳性提示
      tipsPositive: {}, //阳性提示
      tipsLow: {}, //偏低提示
      tipsHigh: {}, //偏高提示
      tipsSuperLow: {}, //超低提示
      tipsSuperHigh: {}, //超高提示
      tipsSuper: {}, //文字型危急值
      restaurants: [], //结果模版
      currentRow: -1, //当前操作的行
      dialogWinMoreResult: false,      dialogWinPacsTemplate: false,      moreResult: {        data: [],        result: "",        defaultResult: "",        index: 0, // 明细序列
      }, //结果模版
      isSplitChooseResult: "N", // 选结果时,是否自动加上分隔符
      selection: {        // 光标位置
        start: 0,        end: 0,      },      symbols: [], //特殊符号
      splitSymbols: [";", "、"], // 分隔符
      userInfo: {        operatorType: "0",        userId: "",        user: "",      },
      // pacs 结果录入
      pacsParams: {        from: "doctor",        refresh: -1, // 强制刷新
        row: {},        index: 0,        result: "",        summary: "",      },      curRow: {},      isSelectAll: 'N', // 录入结果时,是否全选
    };  },
  created() {    this.dictInit();
    let LocalConfig = JSON.parse(window.localStorage.getItem("LocalConfig") || null)    if (LocalConfig && LocalConfig.doctorCheck && LocalConfig.doctorCheck.isSelectAll) this.isSelectAll = LocalConfig.doctorCheck.isSelectAll  },
  //挂载完成
  mounted() {    this.checkItemList(this.dataTransOpts.tableS.register_check.id);    this.userInfo.operatorType = window.sessionStorage.getItem("operatorType") || '0';    this.userInfo.userId = window.sessionStorage.getItem("userId") || null;    this.userInfo.user = window.sessionStorage.getItem("user") || null;  },
  computed: {    ...mapState([      "window",      "dataTransOpts",      "dict",      "dialogWin",      "doctorCheck",    ]),    tableHeight() {      let temp = this.window.pageHeight < 600 ? 600 : this.window.pageHeight;      return Math.floor(        ((temp - 315 - (this.isCheckPicture ? 110 : 0)) * 3) / 5      );    },  },
  methods: {    dddw,    dictInit() {      //获取结果状态提示数据
      getapi("/api/app/result-status").then((res) => {        if (res.code != -1) {          this.resultStatus = res.data;          this.resultStatus.forEach((e) => {            switch (e.id) {              case "01": // 正常
                e.tooltips = "tipsNormal";                this.colorTrans(e, e.tooltips);                break;              case "02": // 错误
                e.tooltips = "tipsError";                this.colorTrans(e, e.tooltips);                break;              case "03": // 阴性
                e.tooltips = "tipsNegative";                this.colorTrans(e, e.tooltips);                break;              case "04": // 阳性
                e.tooltips = "tipsPositive";                this.colorTrans(e, e.tooltips);                break;              case "05": // 弱阳性
                e.tooltips = "tipsLowPositive";                this.colorTrans(e, e.tooltips);                break;              case "06": // 偏低
                e.tooltips = "tipsLow";                this.colorTrans(e, e.tooltips);                break;              case "07": // 偏高
                e.tooltips = "tipsHigh";                this.colorTrans(e, e.tooltips);                break;              case "08": // 危急值下限
                e.tooltips = "tipsSuperLow";                this.colorTrans(e, e.tooltips);                break;              case "09": // 危急值上限
                e.tooltips = "tipsSuperHigh";                this.colorTrans(e, e.tooltips);                break;              case "10": // 危急值
                e.tooltips = "tipsSuper";                this.colorTrans(e, e.tooltips);                break;              default:                e.tooltips = "tipsNormal";                this.colorTrans(e, e.tooltips);                break;            }          });        }      });
      //获取结果状态提示数据
      postapi("/api/app/CommonChar/GetCommonCharList", {}).then((res) => {        if (res.code >= 0) {          this.symbols = res.data;        }      });    },    btnPacsRessulst(row) {      this.curRow = row;      postapi("/api/app/RegisterCheckItem/GetItemTwoHistoricalResults", {        registerCheckId: row.registerCheckId,        itemId: row.itemId,      }).then((res) => {        if (res.code != -1) {          this.previousResults = true;          this.gridData = res.data;          this.$nextTick(() => {            this.initEcharts();          });        }      });    },    initEcharts() {      let yAxisData = [];      let xAxisData = [];      for (let i = 0; i < this.gridData.length; i++) {        if (this.gridData[i].checkDate) {          xAxisData.push(this.gridData[i].checkDate);          yAxisData.push(this.gridData[i].itemResult);        }      }      let myChart = echarts.init(this.$refs.chart1);      let option1 = {        tooltip: {          trigger: "axis",          confine: true,        },        legend: {          type: "scroll",          orient: "horizontal", // 垂直
          right: "3%", // 左对齐
          top: "0%", // 位于顶部
        },        grid: {          show: false,          left: "2%",          right: "2%",          top: "6%",          bottom: "0%",          containLabel: true,        },        xAxis: {          type: "category",          data: xAxisData,          axisLabel: {            textStyle: {              fontSize: "14",            },          },          axisLine: {            show: true,          },        },        yAxis: {          type: "value",          axisLabel: {            textStyle: {              fontSize: "14",            },          },        },        series: [          {            name: "项目结果",            type: "line",            data: yAxisData,          },        ],      };      myChart.setOption(option1);    },    resultsclose() {      this.activeName = "first";    },    // chartTabs(tab) {
    //   if (tab.name == "second") {
    //     this.$nextTick(() => {
    //       this.initEcharts();
    //     });
    //   }
    // },
    // 颜色转换
    // displayName: "错误",
    // dataInputPrompt: "×",
    // reportPrompt: "×",
    // reportBackgroundColor: 2427166,
    // reportFontColor: 1070166,
    // dataInputBackgroundColor: 321313,
    // dataInputFontColor: 12991019,
    colorTrans(dataColor, frontColor) {      let tempColor =        "000000" + Number(dataColor.dataInputBackgroundColor).toString(16);      let backgroundColor = "#" + tempColor.substring(tempColor.length - 6);      tempColor = "000000" + Number(dataColor.dataInputFontColor).toString(16);      let color = "#" + tempColor.substring(tempColor.length - 6);      this[frontColor] = Object.assign({}, dataColor, {        backgroundColor,        color,      });      console.log(`this.${frontColor}`, this[frontColor]);    },
    // "referenceRangeValue": "15-55",
    // "referenceRangeTypeFlag": "1",
    // "criticalRangeValue": null,
    // "result"
    madeTooltips(index) {      // let ts = confirm('提示')
      let checkItem = this.doctorCheck.checkItemList[index];      let tooltips = "tipsNormal";      checkItem.class = tooltips;      let referenceRangeTypeFlag = checkItem.referenceRangeTypeFlag || "0"; //参考范围类别0-无参考范围,1-数字型,2-字符型,3-性激素
      // console.log('madeTooltips',index,referenceRangeTypeFlag)
      switch (referenceRangeTypeFlag) {        case "3": // 1 是数字型,3 是性激素期
        case "1":          // console.log('1、3')
          if (checkItem.result) {            let tempResult = checkItem.result              .replaceAll("<", "")              .replaceAll("≤", "")              .replaceAll("≦", "")              .replaceAll(">", "")              .replaceAll("≥", "")              .replaceAll("≧", "")              .replaceAll("=", "")              .replaceAll(" ", "");            console.log("tempResult", isNaN(tempResult), tempResult);            if (isNaN(tempResult)) break;            let result = Number(tempResult);
            if (checkItem.referenceRangeValue) {              let criticalRangeValue = checkItem.criticalRangeValue;              let valueArr = checkItem.referenceRangeValue                .replaceAll("--", "-")                .replaceAll("〜", "-")                .replaceAll("~", "-")                .split("-");              if (valueArr.length == 1) valueArr.unshift(0);
              // console.log('valueArr',checkItem.referenceRangeValue,valueArr)
              if (criticalRangeValue) {                let criticalArr = criticalRangeValue                  .replaceAll("--", "-")                  .replaceAll("〜", "-")                  .replaceAll("~", "-")                  .split("-");                if (criticalArr.length == 1) criticalArr.unshift(0);
                // console.log('criticalArr',checkItem.criticalRangeValue,criticalArr)
                if (result < Number(criticalArr[0])) {                  tooltips = "tipsSuperLow";                } else if (result > Number(criticalArr[1])) {                  tooltips = "tipsSuperHigh";                } else if (result < Number(valueArr[0])) {                  tooltips = "tipsLow";                } else if (result > Number(valueArr[1])) {                  tooltips = "tipsHigh";                }              } else {                if (result < Number(valueArr[0])) {                  tooltips = "tipsLow";                } else if (result > Number(valueArr[1])) {                  tooltips = "tipsHigh";                }              }            }
            //错误值校验
            let errArr = [];            if (checkItem.inputCheck) {              errArr = checkItem.inputCheck                .replaceAll("--", "-")                .replaceAll("〜", "-")                .replaceAll("~", "-")                .split("-");              if (errArr.length == 1) errArr.unshift(-1);            }            if (errArr && errArr.length > 1) {              if (result < Number(errArr[0]) || result > Number(errArr[1])) {                tooltips = "tipsError";                console.log("checkItem", checkItem);              }            }          }          break;        case "2":          if (checkItem.result) {            if (              checkItem.result.indexOf("阴性") > -1 ||              checkItem.result.indexOf("-") > -1            ) {              tooltips = "tipsNegative";            } else if (              checkItem.result.indexOf("弱阳性") > -1 ||              checkItem.result.indexOf("±") > -1            ) {              tooltips = "tipsLowPositive";            } else if (              checkItem.result.indexOf("阳性") > -1 ||              checkItem.result.indexOf("+") > -1            ) {              tooltips = "tipsPositive";            }          }          break;        default:          break;      }
      // 判断后重新赋值
      checkItem.class = tooltips;      // 保存过检查时,直接取数据库
      checkItem.resultStatusId = this[tooltips].id; //名称 dataInputPrompt
      // console.log('checkItem',checkItem)
      // console.log(`this.${tooltips}`,this[tooltips])
    },
    // 行结果是否可编辑
    rowResultDisabled(row) {      return (        row.isCalculationItem == "Y" ||        this.doctorCheck.RegisterCheckEdit.completeFlag == "1" ||        this.doctorCheck.RegisterCheckEdit.completeFlag == "2"      );    },    btnCritical(row) {      this.dialogWin.FollowCriticalCheck = true;      this.doctorCheck.combinationCriticalValue = false;      this.doctorCheck.singleDetailedProject = row;    },    //项目列为计算函数
    computeFun(index) {      // 有计算项的,才调用计算函数
      let haveComputeFun = false;      let checkItem = this.doctorCheck.checkItemList[index];      console.log("checkItem", checkItem);      let body = {        registerCheckId: checkItem.registerCheckId,        items: [],      };
      this.doctorCheck.checkItemList.forEach((e) => {        body.items.push({          itemId: e.itemId,          result: e.result,        });        if (e.isCalculationItem == "Y") haveComputeFun = true;      });      if (!haveComputeFun) return; // 有计算项的,才调用计算函数
      let lfind = -1;      postapi(        "/api/app/diagnosisfunction/getcalculationfunctionresult",        body      ).then((res) => {        if (res.code != -1) {          // console.log('res.data',res.data)
          res.data.items.forEach((e) => {            lfind = arrayExistObj(              this.doctorCheck.checkItemList,              "itemId",              e.itemId            );            if (lfind > -1) {              if (e.result != this.doctorCheck.checkItemList[lfind].result) {                this.doctorCheck.checkItemList[lfind].result = e.result;                console.log("e", lfind, this.doctorCheck.checkItemList[lfind]);                this.madeTooltips(lfind);              }            }          });        }      });    },
    // 点击结果模版按钮
    btnMoreResult(row, index) {      this.moreResult.data = deepCopy(row.itemResultTemplates);      this.moreResult.result = row.result;      this.moreResult.defaultResult = row.defaultResult;      this.moreResult.index = index;      // "itemId": "3a0c517f-cbdb-9fff-e300-1f76b3e47580",
      // "result": "00000",
      // "diagnosisId": "3a0ed8a2-72d9-ee50-78aa-5b1f474f2921",
      // "isNameIntoSummary": "N",
      // "isResultIntoSummary": "Y",
      // "resultStatusId": "01",
      // "simpleCode": "0"
      this.dialogWinMoreResult = true;
      this.watchSelection();    },
    // pacs结果模板
    btnPacsResult(row, index) {      let result = row.result;      let summary = "";
      this.doctorCheck.checkSummaryList.forEach((e, i) => {        summary += e.summary;      });
      this.pacsParams.row = row;      this.pacsParams.index = index;      this.pacsParams.result = result;      this.pacsParams.summary = summary;      this.pacsParams.refresh++;
      this.dialogWinPacsTemplate = true;    },
    // pacs结果模板(备份)
    btnPacsResultBak(row, index) {      let result = row.result;      let summary = "";
      this.doctorCheck.checkSummaryList.forEach((e, i) => {        summary += e.summary;      });
      this.pacsParams.row = row;      this.pacsParams.index = index;      this.pacsParams.result = result;      this.pacsParams.summary = summary;      this.pacsParams.refresh++;
      this.dialogWinPacsTemplate = true;    },
    // 双击选择结果模版的结果
    dblclickResult(item) {      this.moreResult.result = "";      this.clickResult(item);      this.btnOkResult("");    },
    // 单击选择结果模版的结果
    clickResult(item) {      let result = [];      if (this.moreResult.result) result = this.moreResult.result.split(";");      // 不用分隔符时,不判断包含关系
      if (this.isSplitChooseResult == "Y" && result.indexOf(item.result) > -1)        return;      if (this.isSplitChooseResult == "Y" || result.length == 0) {        result.push(item.result);      } else {        result[result.length - 1] = result[result.length - 1] + item.result;      }
      let ret = "";      result.forEach((e, i) => {        let splitStr = ";";        if (i == 0) splitStr = "";        ret += splitStr + e;      });      this.moreResult.result = ret;    },
    // 清除结果值
    btnClear() {      this.moreResult.result = "";    },
    btnOkResult(result) {      this.doctorCheck.checkItemList[this.moreResult.index].result = result        ? this.moreResult[result]        : this.moreResult.result;      this.madeTooltips(this.moreResult.index);      this.computeFun(this.moreResult.index);      this.dialogWinMoreResult = false;    },
    // 处理 pacs 结果录入的情况
    handlePacsResult(row, index, pacsResult) {      // console.log('row,index,pacsResult', row, index, pacsResult)
      // this.doctorCheck.checkItemList[index].result = pacsResult.result;
      /* 新词条录入方式,取消合并      this.doctorCheck.checkSummaryList = [        {          id: Math.random(),          registerCheckId: this.doctorCheck.RegisterCheckEdit.id,          summary: pacsResult.summary,          summaryFlag: "N",        },      ];      */      this.dialogWinPacsTemplate = false;    },
    //选择项目
    rowClick(row) {      this.doctorCheck.checkItem = row;      this.restaurants = row.itemResultTemplates;    },
    //检查组合项目下所包含的明细项目
    checkItemList(RegisterCheckId) {      // this.doctorCheck.checkItem = null
      if (!RegisterCheckId) {        this.doctorCheck.checkItemList = [];        this.doctorCheck.RegisterCheckEdit = {          id: "",          checkDoctorId: "",          checkDate: "",          LastModifierId: "",          LastModificationTime: "",          completeFlag: "",        };        return;      }      console.log(        `/api/app/registercheckitem/getlistinregistercheckid?RegisterCheckId=${RegisterCheckId}`      );
      getapi(`/api/app/registercheck/getregistercheck?id=${RegisterCheckId}`)        .then((res) => {          if (res.code > -1) {            this.doctorCheck.RegisterCheckEdit = res.data;            if (              res.data.isCharge != "Y" &&              this.doctor_check_check_charge == "Y"            ) {              this.$message.warning({                showClose: true,                message: `该体检人员未缴清费用!`,              });            }            if (this.doctorCheck.RegisterCheckEdit.completeFlag == "0") {              // 当前用户是检查医生时,默认当前用户
              if (this.userInfo.operatorType == '1' || this.userInfo.operatorType == '3') {                this.doctorCheck.RegisterCheckEdit.checkDoctorId = this.userInfo.userId;              }              this.doctorCheck.RegisterCheckEdit.checkDate = new Date();            }            return getapi(              `/api/app/registercheckitem/getlistinregistercheckid?RegisterCheckId=${RegisterCheckId}&PatientRegisterId=${this.dataTransOpts.tableS.patient_register.id}`            );          }        })        .then((res) => {          // console.log("checkItemList", res.data);
          if (res && res.code > -1) {            res.data.forEach((e, i) => {              // 虚拟显示危急状态
              e["criticalFlag"] = "N";            });
            this.doctorCheck.checkItemList = res.data;            this.doctorCheck.checkItemList.forEach((e, i) => {              if (this.doctorCheck.RegisterCheckEdit.completeFlag == "0") {                this.madeTooltips(i);              } else {                let lfind = arrayExistObj(                  this.resultStatus,                  "id",                  e.resultStatusId                );                if (lfind > -1) {                  e.class = this.resultStatus[lfind].tooltips;                }              }            });            this.enterToTab();          }        })        .catch((err) => {          this.$message.error({            showClose: true,            message: `操作失败,原因:${err}`,          });        });    },
    querySearch(queryString, cb) {      var restaurants = []; //不需要字典库显示  deepCopy(this.restaurants) [{ value: '阴性' },{ value: '阳性' }]
      restaurants.forEach((item) => {        return (item.value = item.result);      });      // console.log("restaurants", restaurants);
      var results = queryString        ? restaurants.filter(this.createFilter(queryString))        : restaurants;      // 调用 callback 返回建议列表的数据
      cb(results);    },
    createFilter(queryString) {      return (restaurant) => {        return (          restaurant["value"].toLowerCase().indexOf(queryString.toLowerCase()) >          -1        );      };    },    handleSelect(item) {      console.log("item", item);    },
    //回车替代tab键
    enterToTab() {      // console.log('enterToTab');
      this.$nextTick(() => {        let inputs = document.querySelectorAll(["textarea", "input"]); //用数组可以读取多个标签的元素  //.inline-input
        // console.log('inputs', typeof inputs, inputs)
        // 为每个输入框添加键盘事件监听器
        inputs.forEach((input, i) => {          // console.log('input',input);
          input.addEventListener("keydown", (event) => {            // 如果按下的是回车键
            // console.log('data-lineModeFlag', input, input.getAttribute('data-lineModeFlag'), i);
            // console.log('event.keyCode', event.keyCode)
            switch (event.keyCode) {              case 13:                if (                  event.keyCode === 13 &&                  input.getAttribute("data-lineModeFlag") == "0"                ) {                  event.preventDefault();                } else {                  break;                }              case 9: // tab 键
                event.preventDefault();              case 40: // ↓ 键
                for (let j = i + 1; j < inputs.length; j++) {                  // console.log(inputs[j], inputs[j].getAttribute('type'), inputs[j].getAttribute('placeholder'))
                  if (inputs[j].getAttribute("placeholder") == "请输入结果值") {                    if (inputs[j].getAttribute("disabled") != "disabled") {                      // console.log('inputs[j]', inputs[j])
                      inputs[j].focus();                      break;                    }                  }                }                break;              case 38: // ↑ 键
                for (let j = i - 1; j > -1; j--) {                  // console.log(inputs[j], inputs[j].getAttribute('type'), inputs[j].getAttribute('placeholder'))
                  if (inputs[j].getAttribute("placeholder") == "请输入结果值") {                    if (inputs[j].getAttribute("disabled") != "disabled") {                      // console.log('inputs[j]', inputs[j])
                      inputs[j].focus();                      break;                    }                  }                }                break;              default:                break;            }          });
          // 点击时全选结果
          input.addEventListener("click", (event) => {            if (this.isSelectAll == 'Y') {              input.select();            }          });        });      });    },
    // 光标位置插入特殊符号
    insertSymbols(symbols) {      let result = this.moreResult.result || "";      if (result) {        result =          result.substring(0, this.selection.start) +          symbols +          result.substring(this.selection.end);      } else {        result = symbols;      }      this.moreResult.result = result;      this.selection.start++;      this.selection.end++;    },    // 获取光标位置的函数
    getCaretPosition() {      let input = document.getElementById("resultBox");      this.selection.start = input.selectionStart;      this.selection.end = input.selectionEnd;      // console.log('selection',this.selection)
    },    watchSelection() {      this.$nextTick(() => {        let that = this;        let resultBox = document.getElementById("resultBox"); //用数组可以读取多个标签的元素  //.inline-input
        // 绑定键盘事件到文本框
        resultBox.addEventListener("click", function (event) {          // 获取光标位置
          that.getCaretPosition();        });
        resultBox.addEventListener("input", function (event) {          // 获取光标位置
          that.getCaretPosition();        });      });    },  },
  //监听事件
  watch: {    //检查项目切换
    // "doctorCheck.RegisterCheckId":{
    //   immediate:true,
    //   handler(newVal, oldVal) {
    //     console.log(
    //       "watch doctorCheck.RegisterCheckId newVal:",
    //       newVal,
    //       " oldVal:",
    //       oldVal
    //     );
    //     this.checkItemList(newVal);
    //   }
    // },
    //检查项目未切换换时 也可以强制刷新数据
    "dataTransOpts.refresh.register_check_item.M": {      // immediate: true,
      handler(newVal, oldVal) {        console.log(          `watch 检查明细 newVal:${newVal} oldVal:${oldVal} registerCheckId: ${this.dataTransOpts.tableS.register_check.id}`        );        this.checkItemList(this.dataTransOpts.tableS.register_check.id);      },    },  },};</script><style lang="scss" scoped>@import "../../assets/css/global.css";
::v-deep .el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf {  padding: 0;}
::v-deep .el-textarea__inner {  min-height: 23px;  height: 23px;  line-height: 1.25;  padding: 2px 15px 2px 2px;}
/*正常*/::v-deep .tipsNormal .el-textarea__inner {  background-color: v-bind("tipsNormal.backgroundColor") !important;  color: v-bind("tipsNormal.color") !important;  font-family: "Microsoft YaHei";}
/*错误*/::v-deep .tipsError .el-textarea__inner {  background-color: v-bind("tipsError.backgroundColor") !important;  color: v-bind("tipsError.color") !important;  font-family: "Microsoft YaHei";}
/*阴性  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsNegative .el-textarea__inner {  background-color: v-bind("tipsNegative.backgroundColor") !important;  color: v-bind("tipsNegative.color") !important;  font-family: "Microsoft YaHei";}
/*弱阳性  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsLowPositive .el-textarea__inner {  background-color: v-bind("tipsLowPositive.backgroundColor") !important;  color: v-bind("tipsLowPositive.color") !important;  font-family: "Microsoft YaHei";}
/*阳性  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsPositive .el-textarea__inner {  background-color: v-bind("tipsPositive.backgroundColor") !important;  color: v-bind("tipsPositive.color") !important;  font-family: "Microsoft YaHei";}
/*偏低  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsLow .el-textarea__inner {  background-color: v-bind("tipsLow.backgroundColor") !important;  color: v-bind("tipsLow.color") !important;  font-family: "Microsoft YaHei";}
/*偏高  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsHigh .el-textarea__inner {  background-color: v-bind("tipsHigh.backgroundColor") !important;  color: v-bind("tipsHigh.color") !important;  font-family: "Microsoft YaHei";}
/*超低  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsSuperLow .el-textarea__inner {  background-color: v-bind("tipsSuperLow.backgroundColor") !important;  color: v-bind("tipsSuperLow.color") !important;  font-family: "Microsoft YaHei";}
/*超高  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsSuperHigh .el-textarea__inner {  background-color: v-bind("tipsSuperHigh.backgroundColor") !important;  color: v-bind("tipsSuperHigh.color") !important;  font-family: "Microsoft YaHei";}
/*文字性危及值  v-bind("(window.pageHeight > 600 ? (window.pageHeight - 250) : 350) + 'px'") */::v-deep .tipsSuper .el-textarea__inner {  background-color: v-bind("tipsSuper.backgroundColor") !important;  color: v-bind("tipsSuper.color") !important;  font-family: "Microsoft YaHei";}
::v-deep .commonFont .el-textarea__inner {  font-family: "Microsoft YaHei";}</style>
  |