<template>
  <div id="operation-record" style=" background: #fff; padding: 10px 20px 50px 20px;page-break-after:always">
    <div style="position: fixed;z-index: 999;right: 90px;">
      <div v-if="!onlyRead && isPlatform">
        <el-button v-print="'#eyesFunc'" size="small" @click="handlePrint">打印</el-button>
        <template v-if="isCreator">
          <el-button type="primary" size="small" @click="handleSaveTable">保存</el-button>
          <el-button type="danger" size="small" @click="handleDelete">删除</el-button>
        </template>
      </div>
      <div v-if="creator" style="margin: 10px 0;text-align: left;color: #409EFF">
        <div>
          操作员：{{ creator.doctorName }}
        </div>
        <div>
          工号：{{ creator.doctorCode }}
        </div>
      </div>
    </div>
    <div id="eyesFunc" style="width: 840px;padding-right: 8px" class="printBox">
      <div v-if="!isDev" class="flex j-c">
        <img width="450" src="@/assets/img/xianganlogo.png">
      </div>
      <p style="color:#000000;font-size:32px;text-align:center;">
        双眼视功能检查报告单
      </p>
      <div style="display: flex;justify-content: space-around;margin-top: 16px">
        <span class="bold">登记号：<el-input v-model="formData.patientId" style="width: 120px" size="small" clearable placeholder="" /></span>
        <span class="bold">姓名：<el-input v-model="formData.patientName" style="width: 120px" size="small" clearable placeholder="" /></span>
        <span class="bold">性别：<el-input v-model="formData.patientSex" style="width: 120px" size="small" clearable placeholder="" /></span>
        <span class="bold">年龄：<el-input v-model="formData.patientAge" style="width: 120px" size="small" clearable placeholder="" /></span>
      </div>
      <div class="operation-record-table eyesTable">
        <el-table :data="tableData" :span-method="objectSpanMethod" border style="width: 100%; margin-top: 20px">
          <el-table-column label="" width="180" align="center" :resizable="false">
            <template slot-scope="scope">
              <div v-if="scope.row.name == '1'">
                <div class="center" style="display: flex">
                  <el-input v-model="formData.qgztOs1" placeholder="">
                    <template slot="prepend">OS:</template>
                  </el-input>
                  <el-input v-model="formData.qgztOs2" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                  <el-input v-model="formData.qgztOs3" placeholder="">
                    <template slot="prepend">X</template>
                  </el-input>
                </div>
              </div>
              <div v-else-if="scope.row.name == '集合近点(NPC)'">
                <p>{{ scope.row.name }}</p>
                <div style="border-top: 1px solid #D9D9D9;display: flex;flex-wrap: wrap;margin: 3px 0">
                  <div v-for="(item,index) in npcList" :key="index" class="check" style="margin: 0 10px 0 6px;font-size: 14px" @click="item.isSelect = !item.isSelect">
                    <input type="checkbox" :checked="item.isSelect">
                    <div>{{ item.name }}</div>
                  </div>
                </div>
              </div>
              <div v-else-if="scope.row.name == '梯度性AC/A'">
                <p>{{ scope.row.name }}</p>
                <div style="border-top: 1px solid #D9D9D9;display: flex;flex-wrap: wrap;margin: 3px 0">
                  <div v-for="(item,index) in acaList" :key="index" class="check" style="margin: 0 12px 0 10px;font-size: 14px" @click="item.isSelect = !item.isSelect">
                    <input type="checkbox" :checked="item.isSelect">
                    <div>{{ item.name }}</div>
                  </div>
                </div>
              </div>
              <div v-else-if="scope.row.name == '调节幅度(AMP)'">
                <p>{{ scope.row.name }}</p>
                <div style="border-top: 1px solid #D9D9D9;display: flex;flex-wrap: wrap;margin: 3px 0">
                  <div v-for="(item,index) in ampList" :key="index" class="check" style="margin: 0 12px 0 6px;font-size: 14px" @click="item.isSelect = !item.isSelect">
                    <input type="checkbox" :checked="item.isSelect">
                    <div>{{ item.name }}</div>
                  </div>
                </div>
              </div>
              <div v-else-if="scope.row.name == 'FV'">
                <div class="width-180 center" style="display: flex">
                  <el-input v-model="formData.fvYuanBo1" placeholder="">
                    <template slot="prepend">远BO:</template>
                  </el-input>
                  <el-input v-model="formData.fvYuanBo2" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                  <el-input v-model="formData.fvYuanBo3" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                </div>
              </div>
              <div v-else-if="scope.row.name == '签名'" style="display: flex;justify-content: space-between">
                <div class="width-180" style="text-align: left">
                  <span style="display: inline-block;margin-top: 16px">视光师:</span>
                  <img v-if="formData.ygsSign" :src="formData.ygsSign" alt="" style="width: 80px;height: 50px;border-style:none;">
                </div>
                <div class="width-180" style="text-align: left;margin-top: 12px">
                  <el-input v-model="formData.ysSign" placeholder="">
                    <template slot="prepend">医师:</template>
                  </el-input>
                </div>
                <div class="width-180" style="text-align: left;margin-top: 12px">
                  日期：<el-date-picker
                    v-model="formData.riQi"
                    type="date"
                    placeholder="选择日期"
                  />
                </div>
              </div>
              <p v-else>{{ scope.row.name }}</p>
            </template>
          </el-table-column>
          <el-table-column label="" width="240" :resizable="false" prop="type">
            <template slot-scope="scope">
              <div v-if="scope.row.name==='检查项目'" style="text-align: center">检查结果</div>
              <div v-if="scope.row.name == '1'">
                <div class="width-180 center" style="display: flex">
                  <el-input v-model="formData.qgztOsVa1" placeholder="">
                    <template slot="prepend">VA:</template>
                  </el-input>
                  <!--                  <el-input v-model="formData.qgztOsVa2" placeholder="">-->
                  <!--                    <template slot="prepend">/</template>-->
                  <!--                  </el-input>-->
                  <!--                  <el-input v-model="formData.qgztOsVa3" placeholder="">-->
                  <!--                    <template slot="prepend">X</template>-->
                  <!--                  </el-input>-->
                </div>
              </div>
              <div v-if="scope.row.name == '屈光状态'">
                <div class="width-120 center" style="display: flex">
                  <el-input v-model="formData.qgztOd1" placeholder="">
                    <template slot="prepend">OD:</template>
                  </el-input>
                  <el-input v-model="formData.qgztOd2" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                  <el-input v-model="formData.qgztOd3" placeholder="">
                    <template slot="prepend">X</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '交替遮盖试验(CT)'">
                <div class="center">
                  <div style="display: flex;justify-content: space-around;align-items: center"><span>远:</span>
                    <el-select v-model="formData.ctYuan" placeholder="" clearable style="display: inline-block;width: 100px">
                      <el-option
                        v-for="item in ctList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.name"
                      />
                    </el-select>
                    <span>近:</span>
                    <el-select v-model="formData.ctJin" placeholder="" clearable style="display: inline-block;width: 100px">
                      <el-option
                        v-for="item in ctList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.name"
                      />
                    </el-select>
                  </div>
                </div>
              </div>
              <div v-if="scope.row.name == '集合近点(NPC)'">
                <div class="width-180 center">
                  <el-input v-model="formData.npcPld" placeholder="">
                    <template slot="prepend">破裂点:</template>
                    <template slot="append">CM</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == 'Worth-4-dot'">
                <div class="center" style="display: flex">
                  <el-select v-model="formData.worth1" placeholder="" clearable style="display: inline-block;width: 50px" @change="selectWorth($event, 'od')">
                    <el-option
                      v-for="item in worthList"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    />
                  </el-select>
                  @D(
                  <el-input v-model="formData.worth2" placeholder="" style="width: 100px" />
                  )
                </div>
              </div>
              <div v-if="scope.row.name == '立体视(stereo)'">
                <div class="center">
                  <span>RDD(远):</span>
                  <el-select v-model="formData.stereoRdd" placeholder="" clearable style="display: inline-block;width: 100px" @change="selectWorth($event, 'od')">
                    <el-option
                      v-for="item in stereoList"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    />
                  </el-select>
                </div>
              </div>
              <div v-if="scope.row.name == '眼位'">
                <div class="center" style="display: flex">
                  <el-input v-model="formData.ywYuan" placeholder="" style="width: 120px">
                    <template slot="prepend">远:</template>
                  </el-input>
                  <span>△</span>
                  <el-select v-model="formData.ywYuanExtra" placeholder="" style="width: 100px">
                    <el-option
                      v-for="item in position"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    />
                  </el-select>
                </div>
              </div>
              <div v-if="scope.row.name == '梯度性AC/A'">
                <div class="width-180 center">
                  <el-input v-model="formData.aca1" placeholder="">
                    <template slot="append">△/D</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '融像性聚散(FV)'">
                <div class="width-180 center" style="display: flex">
                  <el-input v-model="formData.fvYuanBi1" placeholder="">
                    <template slot="prepend">远BI:</template>
                  </el-input>
                  <el-input v-model="formData.fvYuanBi2" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                  <el-input v-model="formData.fvYuanBi3" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == 'FV'">
                <div class="width-180 center" style="display: flex">
                  <el-input v-model="formData.fvJinBo1" placeholder="">
                    <template slot="prepend">近BO:</template>
                  </el-input>
                  <el-input v-model="formData.fvJinBo2" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                  <el-input v-model="formData.fvJinBo3" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '相对调节(RA)'">
                <div class="width-180 center">
                  <el-input v-model="formData.raNar" placeholder="">
                    <template slot="prepend">NRA:</template>
                    <template slot="append">D</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '调节幅度(AMP)'">
                <div class="width-180 center">
                  <div>
                    <el-input v-model="formData.ampOd" placeholder="">
                      <template slot="prepend">OD:</template>
                      <template slot="append">D</template>
                    </el-input>
                  </div>
                  <el-input v-model="formData.ampOs" placeholder="">
                    <template slot="prepend">OS:</template>
                    <template slot="append">D</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '调节灵活度(AF)'">
                <div class="center">
                  <div class="flex">
                    <el-input v-model="formData.afOd1" placeholder="" style="width: 120px">
                      <template slot="prepend">OD:</template>
                    </el-input>
                    <el-select v-model="formData.afOd2" placeholder="" clearable style="display: inline-block;width: 100px;margin-left: 8px" @change="selectWorth($event, 'od')">
                      <el-option
                        v-for="item in afList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.name"
                      />
                    </el-select>
                  </div>
                  <div class="flex">
                    <el-input v-model="formData.afOs1" placeholder="" style="width: 120px">
                      <template slot="prepend">OS:</template>
                    </el-input>
                    <el-select v-model="formData.afOs2" placeholder="" clearable style="display: inline-block;width: 100px;margin-left: 8px" @change="selectWorth($event, 'od')">
                      <el-option
                        v-for="item in afList"
                        :key="item.id"
                        :label="item.name"
                        :value="item.name"
                      />
                    </el-select>
                  </div>
                </div>
              </div>
              <div v-if="scope.row.name == '调节反应(FCC)'">
                <div class="width-180 center">
                  <div>
                    <el-input v-model="formData.fccOd" placeholder="">
                      <template slot="prepend">OD:</template>
                      <template slot="append">D</template>
                    </el-input>
                  </div>
                  <el-input v-model="formData.fccOs" placeholder="">
                    <template slot="prepend">OS:</template>
                    <template slot="append">D</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '初步诊断'">
                <div>
                  <div style="display:flex;margin-bottom: 8px">
                    <div class="check" style="margin-left: 0" @click="formData.cbzdNormal=!formData.cbzdNormal">
                      <input type="checkbox" :checked="formData.cbzdNormal">正常
                    </div>
                  </div>
                  <div>
                    <div style="display: flex">
                      <div style="width: 160px;">聚散功能异常：</div>
                      <div style="width: 100%;display: flex;flex-wrap: wrap;">
                        <div v-for="(item,index) in dispersionList" :key="index" class="check" :class="[index < dispersionList.length - 2 ? 'check-width-100' : '']" style="margin-left: 22px;font-size: 14px" @click="item.isSelect = !item.isSelect">
                          <input type="checkbox" :checked="item.isSelect">
                          <div>{{ item.name }}</div>
                        </div>
                      </div>
                    </div>
                    <div style="display: flex">
                      <div style="width: 160px;">调节功能异常：</div>
                      <div style="width: 100%;display: flex;flex-wrap: wrap;">
                        <div v-for="(item,index) in regulatoryList" :key="index" class="check" :class="[index !== regulatoryList.length - 1 ? 'check-width-120' : '']" style="margin-left: 22px;font-size: 14px" @click="item.isSelect = !item.isSelect">
                          <input type="checkbox" :checked="item.isSelect">
                          <div>{{ item.name }}</div>
                        </div>
                      </div>
                    </div>
                    <div style="display: flex">
                      <span style="width: 160px;">斜&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 视：</span>
                      <div style="width: 100%;display: flex;flex-wrap: wrap;">
                        <div v-for="(item,index) in strabismusList" :key="index" class="check" style="margin-left: 22px;font-size: 14px" @click="item.isSelect = !item.isSelect">
                          <input type="checkbox" :checked="item.isSelect">
                          <div>{{ item.name }}</div>
                        </div>
                        <!--                        <el-select v-model="formData.cbzdXs" multiple placeholder="请选择" style="width: 100%">-->
                        <!--                          <el-option-->
                        <!--                            v-for="item in scope.row.c"-->
                        <!--                            :key="item.id"-->
                        <!--                            :label="item.name"-->
                        <!--                            :value="item.name"-->
                        <!--                          />-->
                        <!--                        </el-select>-->
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <div v-if="scope.row.name == '建议'">
                <div class="center" style="text-align: left">
                  <el-input v-model="formData.jianYi" type="textarea" :autosize="{ minRows: 3, maxRows: 3}" placeholder="" style="width: 100%" />
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="" width="" :resizable="false">
            <template slot-scope="scope">
              <div v-if="scope.row.name==='检查项目'" style="text-align: center">
                参考范围
              </div>
              <div v-if="scope.row.name == '屈光状态'">
                <div class="width-180 center" style="display: flex">
                  <el-input v-model="formData.qgztOdVa1" placeholder="">
                    <template slot="prepend">VA:</template>
                  </el-input>
                  <!--                  <el-input v-model="formData.qgztOdVa2" placeholder="">-->
                  <!--                    <template slot="prepend">/</template>-->
                  <!--                  </el-input>-->
                  <!--                  <el-input v-model="formData.qgztOdVa3" placeholder="">-->
                  <!--                    <template slot="prepend">X</template>-->
                  <!--                  </el-input>-->
                </div>
              </div>
              <div v-if="scope.row.name == '交替遮盖试验(CT)'">
                <div class="width-180 center">
                  <el-input v-model="formData.ctYqyd" placeholder="">
                    <template slot="prepend">眼球运动:</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '集合近点(NPC)'">
                <div class="width-180 center">
                  <el-input v-model="formData.npcHfd" placeholder="">
                    <template slot="prepend">恢复点:</template>
                    <template slot="append">CM</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == 'Worth-4-dot'">
                <div class="center" style="display: flex">
                  <el-select v-model="formData.worth3" placeholder="" clearable style="display: inline-block;width: 50px" @change="selectWorth($event, 'os')">
                    <el-option
                      v-for="item in worthList"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    />
                  </el-select>
                  @N(
                  <el-input v-model="formData.worth4" placeholder="" style="width: 90px" />
                  )
                </div>
              </div>
              <div v-if="scope.row.name == '立体视(stereo)'">
                <div class="center">
                  <span>TNO(近):</span>
                  <el-select v-model="formData.stereoTno" placeholder="" clearable style="display: inline-block;width: 100px" @change="selectWorth($event, 'od')">
                    <el-option
                      v-for="item in stereoList"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    />
                  </el-select>
                </div>
              </div>
              <div v-if="scope.row.name == '眼位'">
                <div class="center" style="display: flex">
                  <el-input v-model="formData.ywJin" placeholder="" style="width: 120px">
                    <template slot="prepend">近:</template>
                  </el-input>
                  <span>△</span>
                  <el-select v-model="formData.ywJinExtra" placeholder="" style="width: 100px">
                    <el-option
                      v-for="item in position"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    />
                  </el-select>
                </div>
              </div>
              <div v-if="scope.row.name == '梯度性AC/A'">
                <div class="width-200 center">
                  <el-input v-model="formData.aca2" placeholder="">
                    <template slot="prepend">计算性AC/A:</template>
                    <template slot="append">△/D</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '融像性聚散(FV)'">
                <div class="width-180 center" style="display: flex">
                  <el-input v-model="formData.fvJinBi1" placeholder="">
                    <template slot="prepend">近BI:</template>
                  </el-input>
                  <el-input v-model="formData.fvJinBi2" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                  <el-input v-model="formData.fvJinBi3" placeholder="">
                    <template slot="prepend">/</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == 'FV'">
                <div>
                  远BO:7~11/15~23/8~12
                </div>
                <div>
                  近BO:12~22/15~27/4~18
                </div>
              </div>
              <div v-if="scope.row.name == '相对调节(RA)'">
                <div class="width-180 center">
                  <el-input v-model="formData.raPra" placeholder="">
                    <template slot="prepend">PRA:</template>
                    <template slot="append">D</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '调节幅度(AMP)'">
                <div class="width-180 center">
                  <el-input v-model="formData.ampOu" placeholder="">
                    <template slot="prepend">OU:</template>
                    <template slot="append">D</template>
                  </el-input>
                </div>
              </div>
              <div v-if="scope.row.name == '调节灵活度(AF)'">
                <div class="center" style="display:flex;">
                  <el-input v-model="formData.afOu1" placeholder="" style="width: 120px">
                    <template slot="prepend">OU:</template>
                  </el-input>
                  <el-select v-model="formData.afOu2" placeholder="" clearable style="display: inline-block;width: 100px;margin-left: 8px" @change="selectWorth($event, 'od')">
                    <el-option
                      v-for="item in afList"
                      :key="item.id"
                      :label="item.name"
                      :value="item.name"
                    />
                  </el-select>
                </div>
              </div>
              <div v-if="scope.row.name == '调节反应(FCC)'">
                <div class="width-180 center">
                  <el-input v-model="formData.fccOu" placeholder="">
                    <template slot="prepend">OU:</template>
                    <template slot="append">D</template>
                  </el-input>
                </div>
              </div>
            </template>
          </el-table-column>
          <el-table-column label="" width="" :resizable="false">
            <template slot-scope="scope">
              <div v-if="scope.row.name == '集合近点(NPC)'">
                <div class="width-180 center">
                  破裂点：0-7cm
                </div>
                <div>
                  恢复点：0-10cm
                </div>
              </div>
              <div v-if="scope.row.name == 'Worth-4-dot'">
                4个
              </div>
              <div v-if="scope.row.name == '立体视(stereo)'">
                ≤60″
              </div>
              <div v-if="scope.row.name == '眼位'">
                <div class="center">
                  远：0~2△BI（外隐斜）
                </div>
                <div class="center">
                  近：0~6△BI（外隐斜）
                </div>
              </div>
              <div v-if="scope.row.name == '梯度性AC/A'">
                梯度性：3~5
              </div>
              <div v-if="scope.row.name == '融像性聚散(FV)'">
                <div>
                  远BI：X/5~9/3~5
                </div>
                <div>
                  近BI:11~15/19~23/10~16
                </div>
              </div>
              <div v-if="scope.row.name == '相对调节(RA)'">
                <div>
                  NRA：+1.75~+2.25D
                </div>
                <div>
                  PRA：-1.75~-3.00D
                </div>
              </div>
              <div v-if="scope.row.name == '调节幅度(AMP)'">
                ≥15-0.25×年龄
              </div>
              <div v-if="scope.row.name == '调节灵活度(AF)'">
                <div>
                  单眼＞11cpm
                </div>
                <div>
                  双眼＞8cpm
                </div>
              </div>
              <div v-if="scope.row.name == '调节反应(FCC)'">
                +0.25~0.75D
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  props: {
    isDev: {
      type: Boolean
    },
    patientId: {
      type: String,
      default: ''
    },
    onlyRead: {
      type: Boolean,
      default: false
    },
    isPlatform: {
      type: Boolean,
      default: true
    },
    caseId: {
      type: String,
      default: ''
    },
    isCreator: {
      type: Boolean,
      default: true
    },
    // 操作员
    creator: {
      type: Object
    }
  },
  data() {
    return {
      formData: {
        idList: [],
        jzNumber: '',
        patientId: '',
        patientName: '',
        patientSex: '',
        patientAge: '',
        // 屈光状态
        qgztOd1: '',
        qgztOd2: '',
        qgztOd3: '',
        qgztOdVa1: '',
        qgztOdVa2: '',
        qgztOdVa3: '',
        qgztOs1: '',
        qgztOs2: '',
        qgztOs3: '',
        qgztOsVa1: '',
        qgztOsVa2: '',
        qgztOsVa3: '',
        // 交替遮盖实验
        ctJin: '',
        ctYuan: '',
        jtzgsyFront: '',
        ctYqyd: '正常',
        // 集合近点
        npcPld: '',
        npcHfd: '',
        npcBd: '',
        npcTjsb: '',
        // worth-4-dot
        worth1: '',
        worth2: '',
        worth3: '',
        worth4: '',
        // 立体视
        stereoRdd: '',
        stereoTno: '',
        // 眼位
        ywYuan: '',
        ywJin: '',
        ywJinExtra: '',
        ywYuanExtra: '',
        // 梯度性AC/A
        aca1: '',
        aca2: '',
        acaAdd: '',
        acaDec: '',
        // 融像性聚散
        fvJinBi1: '',
        fvJinBi2: '',
        fvJinBi3: '',
        fvJinBo1: '',
        fvJinBo2: '',
        fvJinBo3: '',
        fvYuanBi1: '',
        fvYuanBi2: '',
        fvYuanBi3: '',
        fvYuanBo1: '',
        fvYuanBo2: '',
        fvYuanBo3: '',
        // 相对调节
        raNar: '',
        raPra: '',
        // 调节幅度
        ampOd: '',
        ampOs: '',
        ampOu: '',
        ampFjf: '',
        ampYjf: '',
        // 调节灵活度
        afOd1: '',
        afOd2: '',
        afOs1: '',
        afOs2: '',
        afOu1: '',
        afOu2: '',
        // 调节反应
        fccOd: '',
        fccOs: '',
        fccOu: '',
        // 初步诊断
        cbzdNormal: false,
        // cbzdCheck: false,
        // cbzdJsgnyc: [],
        // cbzdTjgnyc: [],
        cbzdJsgnyc: '', // 聚散功能异常
        cbzdTjgnyc: '', // 调节功能异常
        cbzdXs: '', // 斜视
        // 建议
        jianYi: '',
        // 签名
        ygsSign: '',
        ysSign: '',
        riQi: ''
      },
      position: [
        {
          name: 'BI',
          id: '1'
        }, {
          name: 'BO',
          id: '2'
        }, {
          name: 'BD',
          id: '3'
        }, {
          name: 'BU',
          id: '4'
        }
      ],
      ctList: [
        {
          name: '正位',
          id: '1'
        },
        {
          name: '外->中',
          id: '2'
        },
        {
          name: '内->中',
          id: '3'
        }
      ],
      worthList: [
        {
          name: '5个',
          id: '1'
        },
        {
          name: '4个',
          id: '2'
        },
        {
          name: '3个',
          id: '3'
        },
        {
          name: '2个',
          id: '4'
        }
      ],
      npcList: [
        {
          name: '笔灯',
          isSelect: true
        }, {
          name: '调节视标',
          isSelect: false
        }
      ],
      acaList: [
        {
          name: '+1.00',
          isSelect: false
        }, {
          name: '-1.00',
          isSelect: true
        }
      ],
      ampList: [
        {
          name: '负镜法',
          isSelect: false
        }, {
          name: '移近法',
          isSelect: false
        }
      ],
      afList: [
        {
          name: 'cpm (+)',
          id: '1'
        }, {
          name: 'cpm (-)',
          id: '2'
        }, {
          name: 'cpm',
          id: '3'
        }
      ],
      stereoList: [
        {
          name: '400“',
          id: '1'
        },
        {
          name: '240“',
          id: '2'
        },
        {
          name: '120“',
          id: '3'
        },
        {
          name: '60“',
          id: '4'
        },
        {
          name: '无',
          id: '5'
        }
      ],
      dispersionList: [
        {
          name: '集合不足',
          isSelect: false
        }, {
          name: '集合过度',
          isSelect: false
        }, {
          name: '散开不足',
          isSelect: false
        }, {
          name: '散开过度',
          isSelect: false
        }, {
          name: '内隐斜',
          isSelect: false
        }, {
          name: '外隐斜',
          isSelect: false
        }, {
          name: '假性集合不足',
          isSelect: false
        }, {
          name: '融像性聚散功能异常',
          isSelect: false
        }
      ],
      regulatoryList: [
        {
          name: '调节灵敏度下降',
          isSelect: false
        }, {
          name: '调节不能持久',
          isSelect: false
        }, {
          name: '调节不足',
          isSelect: false
        }, {
          name: '调节过度',
          isSelect: false
        }, {
          name: '调节麻痹',
          isSelect: false
        }
      ],
      strabismusList: [
        {
          name: '内斜视',
          isSelect: false
        }, {
          name: '外斜视',
          isSelect: false
        }, {
          name: '间歇性外斜视',
          isSelect: false
        }, {
          name: '垂直斜',
          isSelect: false
        }
      ],
      tableData: [
        {
          name: '检查项目'
        }, {
          name: '屈光状态'
        }, {
          name: '1'
        }, {
          name: '交替遮盖试验(CT)'
        }, {
          name: '集合近点(NPC)'
        }, {
          name: 'Worth-4-dot'
        }, {
          name: '立体视(stereo)'
        }, {
          name: '眼位'
        }, {
          name: '梯度性AC/A'
        }, {
          name: '融像性聚散(FV)'
        }, {
          name: 'FV'
        }, {
          name: '相对调节(RA)'
        }, {
          name: '调节幅度(AMP)'
        }, {
          name: '调节灵活度(AF)'
        }, {
          name: '调节反应(FCC)'
        }, {
          name: '初步诊断'
        }, {
          name: '建议'
        }, {
          name: '签名'
        }]
    }
  },
  watch: {
    caseId(val) {
      if (val) {
        this.getSysgnjc()
      }
    }
  },
  mounted() {
    this.getPatientData()
    this.getSysgnjc()
  },
  methods: {
    // 获取签名
    setSign() {
      const userData = JSON.parse(window.sessionStorage.getItem('qg-userData'))
      const date = this.$moment().format('YYYY-MM-DD')
      const mzName = window.sessionStorage.getItem('mzDoctorName')
      this.formData.ygsSign = userData.signImgBase
      this.formData.ysSign = mzName
      this.formData.riQi = date
    },
    async getSysgnjc() {
      const { data: res } = await this.$http.get('/sysgnjc/getSysgnjc', { params: {
        caseId: this.caseId,
        patientId: this.patientId
      }})
      if (res.code === 0) {
        this.formData = res.data
        if (this.formData.ctYuan) {
          this.formData.ctYuan = this.formData.ctYuan.replace('&gt;', '>')
          this.formData.ctJin = this.formData.ctJin.replace('&gt;', '>')
        }
        if (!this.formData.id) {
          await this.queryProject()
          this.formData.ywJinExtra = 'BI'
          this.formData.ywYuanExtra = 'BI'
          this.formData.ctYuan = this.formData.ctJin = '正位'
          this.formData.ctYqyd = '正常'
          this.formData.worth1 = this.formData.worth3 = '4个'
          this.formData.worth2 = this.formData.worth4 = '融像'
          this.formData.stereoRdd = this.formData.stereoTno = '60“'
          this.setSign()
        }
        this.formData.jzNumber = window.sessionStorage.getItem('jzNumber')
        this.handleStr(this.formData.npcBd, this.npcList)
        this.handleStr(this.formData.acaAdd, this.acaList)
        this.handleStr(this.formData.ampFjf, this.ampList)
        this.handleStr(this.formData.cbzdJsgnyc, this.dispersionList)
        this.handleStr(this.formData.cbzdTjgnyc, this.regulatoryList)
        this.handleStr(this.formData.cbzdXs, this.strabismusList)
      }
    },
    selectWorth(val, type) {
      if (val === '5个') {
        type === 'od' ? this.formData.worth2 = '复视' : this.formData.worth4 = '复视'
      } else if (val === '4个') {
        type === 'od' ? this.formData.worth2 = '融像' : this.formData.worth4 = '融像'
      } else if (val === '3个') {
        type === 'od' ? this.formData.worth2 = '右眼抑制' : this.formData.worth4 = '右眼抑制'
      } else if (val === '2个') {
        type === 'od' ? this.formData.worth2 = '左眼抑制' : this.formData.worth4 = '左眼抑制'
      }
    },
    // 获取患者信息
    async getPatientData() {
      const { data: res } = await this.$http.get(
        '/patient/view/getPatientData',
        {
          params: {
            patientId: this.patientId
          }
        }
      )
      if (res.code === 0) {
        this.formData.patientId = res.data.patientId
        this.formData.patientAge = res.data.patientAge
        this.formData.patientSex = res.data.patientSex
        this.formData.patientName = res.data.patientName
      } else {
        this.$message.error(res.msg)
      }
    },
    // 获取报告单id
    async queryProject() {
      const project = window.sessionStorage.getItem('projectItem') ? JSON.parse(window.sessionStorage.getItem('projectItem')) : []
      const { data: res } = await this.$http.get(
        '/patient/getZlItemDict',
        {
          params: {
            caseName: '双眼视功能检查报告单'
          }
        }
      )
      if (res.code === 0) {
        const data = res.data || []
        const list = []
        if (data.length) {
          for (let i = 0; i < data.length; i++) {
            for (let j = 0; j < project.length; j++) {
              if (data[i].itemId === project[j].porjectCode) {
                list.push(project[j].id)
              }
            }
          }
          this.formData.idList = list
        }
      } else {
        this.$message.error(res.msg)
      }
    },
    // 处理字符串
    handleStr(string, array) {
      if (string) {
        const data = string.split(',')
        array.forEach(item => {
          data.forEach(row => {
            if (item.name === row) {
              item.isSelect = true
            }
          })
        })
      } else {
        array.forEach(item => {
          item.isSelect = false
        })
      }
      return array
    },
    // 处理数组
    handleCheck(array) {
      if (array && array.length) {
        const temp = []
        array.forEach(item => {
          if (item.isSelect) {
            temp.push(item.name)
          }
        })
        return temp.join(',')
      }
    },
    handlePrint() {
      if (!this.isCreator) {
        return
      }
      this.handleSaveTable()
    },
    // 保存
    async handleSaveTable() {
      const data = JSON.parse(JSON.stringify(this.formData))
      data.npcBd = this.handleCheck(this.npcList)
      data.acaAdd = this.handleCheck(this.acaList)
      data.ampFjf = this.handleCheck(this.ampList)
      data.cbzdJsgnyc = this.handleCheck(this.dispersionList)
      data.cbzdTjgnyc = this.handleCheck(this.regulatoryList)
      data.cbzdXs = this.handleCheck(this.strabismusList)
      const params = {
        caseId: this.caseId,
        ...data
      }
      const { data: res } = await this.$http.post('/sysgnjc/saveSysgnjc', params)
      if (res.code === 0) {
        await this.getSysgnjc()
        this.$message.success('保存成功')
      } else {
        this.$message.error(res.msg)
      }
    },
    // 删除
    handleDelete() {
      const params = {
        id: this.caseId
      }
      this.$confirmFun('你确定要删除吗？').then(async() => {
        await this.deleteNewForm()
        const { data: res } = await this.$http.post('/case/delete', params)
        if (res.code === 0) {
          this.$message.success('删除成功')
          await this.$parent.getFormList()
        } else {
          this.$message.error(res.msg)
        }
      })
    },
    async deleteNewForm() {
      const params = {
        id: this.caseId
      }
      const { data: res } = await this.$http.post('/sysgnjc/delSysgnjc', params)
      if (res.code === 0) {
      } else {
        this.$message.error(res.msg)
      }
    },
    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 0) {
        if (rowIndex === 1 || rowIndex === 9) {
          return {
            rowspan: 2,
            colspan: 1
          }
        } else if (rowIndex === 17) {
          return {
            rowspan: 1,
            colspan: 4
          }
        }
      } else if (rowIndex === 15 || rowIndex === 16) {
        if (columnIndex === 1) {
          return {
            rowspan: 1,
            colspan: 3
          }
        }
      }
      if (columnIndex === 1) {
        if (rowIndex === 0) {
          return {
            rowspan: 1,
            colspan: 2
          }
        }
      }
    }
  }
}
</script>
<style lang="scss" scoped>
#eyesFunc{
  ::v-deep .el-table__header-wrapper{
    display: none;
  }
  ::v-deep .el-input__inner {
    border: none;
    font-size: 16px;
    line-height: 26px !important;
    height: 26px;
    text-align: center;
    border-bottom: 1px solid #ccc;
    border-radius: 0;
    padding: 0;
  }
  ::v-deep .el-input-group__prepend{
    border: none;
  }
  ::v-deep .el-input-group__append{
    border: none;
  }
  ::v-deep .el-input-group--prepend .el-input__inner{
    height: 26px !important;
  }
  .eyesTable{
    ::v-deep .el-table__cell{
      padding: 3px 0 !important;
    }
  }
}
.flex{
  display: flex;
}
.j-c{
  justify-content: center;
}
.check {
  cursor: pointer;
  user-select: none;
  display: flex;
  margin-left: 15px;
  input{
    -webkit-appearance: checkbox !important;
    margin-right: 5px !important;
  }
}
.width-100{
  width: 150px;
}
.check-width-100{
  width: 100px;
}
.check-width-120{
  width: 120px;
}
.bold{
  font-weight: 700;
}
.printBox{
  .el-table tr{
    page-break-inside: avoid;
  }
}
#operation-record {
  height: 100%;
  overflow: auto;

  .operation-record-table {
    width: 100%;
    .operation-text {
      font-weight: 700;
    }
    .text {
      font-weight: 700;
    }
    .sign {
      cursor: pointer;
      color: #46a1ff;
      font-weight: 400;
    }
  }
  .center {
    text-align: left;
  }
  .left {
    text-align: left;
  }
  .width-50 {
    .el-input {
      width: 50px;
    }
  }
  .width-70 {
    .el-input {
      width: 70px;
    }
  }
  .width-100 {
    .el-input {
      width: 100px;
    }
  }
  .width-120 {
    .el-input {
      width: 120px;
    }
  }
  .width-180 {
    .el-input {
      width: 180px;
    }
  }
}
</style>
<style lang="scss" scoped>
#eyesFunc{
  .operation-record-table{
    .center {
      text-align: left;
    }
    ::v-deep .el-input__inner {
      padding: 0;
      font-size: 16px;
      border: none;
      text-align: center;
      border-radius: 0;
    }
    ::v-deep .el-textarea__inner{
      border: none;
      font-size: 16px;
    }
  }
  .check {
    cursor: pointer;
    user-select: none;
    display: flex;
    input{
      -webkit-appearance: checkbox !important;
      margin-right: 5px !important;
    }
  }
  ::v-deep .el-table th {
    border-color: #8e8c8c !important;
  }
  ::v-deep .el-table td {
    border-color: #8e8c8c !important;
  }
  ::v-deep .el-table--group,
  ::v-deep .el-table--border {
    border: 1px solid #8e8c8c !important;
    border-bottom: none !important;
  }
  ::v-deep .el-icon-arrow-up{
    display: none;
  }
  ::v-deep .el-input-group__append, ::v-deep .el-input-group__prepend{
    background: none;
    padding: 0 5px !important;
  }
  ::v-deep .el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell {
    background: none !important;
  }
  ::v-deep .el-input__prefix {
    display: none;
  }
}
</style>
