<template>
  <view class="Receipt_infopage" v-if="Object.keys(infoDATA).length > 0">
    <view class="title">工单信息</view>
    <view class="page_item footerOtherMargin">
      <view class="page_item_top">
        <view class="page_item_top_L">
          <text class="L_text">单号:{{ infoDATA.gdcode }}</text>
          <view class="page_item_cont_start emergency1" v-if="infoDATA.emergencyType.value == 1">
            <text>
              <text class="cubeic-star icon_transport transport-shiwujiaoxing"></text>
              {{ infoDATA.emergencyType.name }}
            </text>
          </view>
          <view class="page_item_cont_start emergency" v-if="infoDATA.emergencyType.value == 2">
            <text>
              <text class="cubeic-star icon_transport transport-shiwujiaoxing"></text>
              {{ infoDATA.emergencyType.name }}
            </text>
          </view>
          <view class="page_item_cont_start emergencys" v-if="infoDATA.emergencyType.value == 3">
            <text>
              <text class="cubeic-star icon_transport transport-shiwujiaoxing"></text>
              {{ infoDATA.emergencyType.name }}
            </text>
          </view>
        </view>
        <view class="page_item_top_R">
          <text class="L_iocn" v-if="
              !(
                infoDATA.gdState.value == 5 &&
                infoDATA.taskType.associationType.value == 'inspect'
              )
            ">{{ infoDATA.gdState.name }}</text>
          <text class="L_iocn" v-if="
              infoDATA.gdState.value == 5 &&
              infoDATA.taskType.associationType.value == 'inspect'
            ">待送回</text>
        </view>

        <view class="L"></view>
        <view class="R"></view>
      </view>
      <view class="page_item_cont">
        <view class="page_item_cont_T">
          <view class="page_item_cont_title">
            <text> <text class="starting">起</text> 点科室 </text>
            <text class="text_big">{{ infoDATA.startDept.dept }}</text>
          </view>
        </view>
        <view class="line"></view>
        <view class="page_item_cont_B">
          <view class="page_item_cont_title" v-for="(dept, index) of infoDATA.middleDept" :key="'ico' + index">
            <view v-if="infoDATA.taskType.associationType.value == 'inspect'">
              <text> <text class="End">检</text> 查科室 </text>
              <text class="text_big">{{ dept.dept }}</text>
              <view></view>
            </view>
          </view>
          <template v-if="infoDATA.taskType.associationType.value != 'inspect'">
            <view class="page_item_cont_title" v-for="(dept, i) of infoDATA.endDepts" :key="i">
              <view>
                <text> <text class="End">终</text> 点科室 </text>
                <text class="text_big">{{ dept.dept }}</text>
              </view>
            </view>
          </template>
          <view v-if="
              infoDATA.taskType.associationType.value == 'inspect' ||
              infoDATA.taskType.associationType.value == 'patientTransport'
            ">
            <!-- 待抢单 -->
            <text class="red" v-if="infoDATA.gdState.value == 2">请扫描患者腕带,或者请扫描科室码</text>
            <!-- 待到达 -->
            <text class="red" v-if="infoDATA.gdState.value == 4">请扫描患者腕带</text>
            <!-- 执行中 -->
            <text class="red" v-if="infoDATA.gdState.value == 8">请扫描检查科室码,并扫描患者腕带</text>
            <!-- 待送达 -->
            <text class="red" v-if="infoDATA.gdState.value == 5">请扫描终点科室码,并扫描患者腕带</text>
          </view>
        </view>
      </view>
      <view class="page_item_foot">
        <view class="page_item_foot_text">
          <text class="text1">状态</text>
          <text class="text2" v-if="
              !(
                infoDATA.gdState.value == 5 &&
                infoDATA.taskType.associationType.value == 'inspect'
              )
            ">{{ infoDATA.gdState.name }}</text>
          <text class="text2" v-if="
              infoDATA.gdState.value == 5 &&
              infoDATA.taskType.associationType.value == 'inspect'
            ">待送回</text>
        </view>
        <!-- <view class="page_item_foot_text">
          <text class="text1">关联类型</text>
          <text class="text2">{{ infoDATA.taskType.associationType.name }}</text>
        </view> -->
        <view class="page_item_foot_text">
          <text class="text1">任务类型</text>
          <text class="text2">{{ infoDATA.taskType.taskName }}<template
              v-if="infoDATA.goodsRemark">-{{infoDATA.goodsRemark}}</template></text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.taskType.associationType.value==='inspect'">
          <text class="text1">是否半程陪检</text>
          <text class="text2">{{ infoDATA.isHalfInspect===1?'是':'否' }}</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">执行人员</text>
          <text class="text2">{{ infoDATA.worker?infoDATA.worker.name:'-' }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.gdState.value == '2'">
          <text class="text1">预计响应时间</text>
          <text class="text2">{{ infoDATA.estimeResponseTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.gdState.value == '5'">
          <text class="text1" v-if="!(infoDATA.taskType.associationType.value == 'inspect')">预计送达时间</text>
          <text class="text1" v-if="infoDATA.taskType.associationType.value == 'inspect'">预计送回时间</text>
          <text class="text2">{{ infoDATA.estimeCompleteTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text" v-if="infoDATA.gdState.value == '4'">
          <text class="text1">预计到达时间</text>
          <text class="text2">{{ infoDATA.estimateArriveTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">创建时间</text>
          <text class="text2">{{ infoDATA.startTime || '无' }}</text>
        </view>
        <view class="page_item_foot_text">
          <text class="text1">预约时间</text>
          <text class="text2" v-if="infoDATA.taskType.associationType.value == 'inspect'">{{ infoDATA.yyTime }}</text>
          <text class="text2"
            v-if="infoDATA.taskType.associationType.value == 'patientTransport'">{{ infoDATA.yyjdTime|yyTimeFilter }}</text>
        </view>
        <view class="page_item_foot_text" v-if="
            infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport'
          ">
          <text class="text1">床号</text>
          <text class="text2">{{
            infoDATA.patient ? infoDATA.patient.bedNum : "-"
          }}</text>
        </view>
        <view class="page_item_foot_text" v-if="
            infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport'
          ">
          <text class="text1">携带设备</text>
          <text class="text2">{{ infoDATA.goods || "暂无" }}</text>
        </view>
        <view class="page_item_info" style="padding: 0;" v-if="infoDATA.workOrderRemark !== undefined">
          <view class="page_item_foot_text">
            <view class="text1" v-if="infoDATA.taskType.associationType.value == 'inspect' || infoDATA.taskType.associationType.value == 'patientTransport'">备注信息</view>
            <view class="text1" v-else>工单备注</view>
            <view class="text2" style="float: none;word-break: break-all;">{{ infoDATA.workOrderRemark }}</view>
          </view>
        </view>
        <view class="page_item_foot_text" v-if="
            infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport'
          ">
          <text class="text1">患者姓名</text>
          <text class="text2">{{ infoDATA.patient.patientName }}({{
              infoDATA.patient.residenceNo
            }})</text>
        </view>
        <view class="page_item_foot_text" v-if="
            (infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport')&&infoDATA.patient.careLevel
          ">
          <text class="text1">{{infoDATA.patient.careLevel.desc}}</text>
          <text class="text2"
            :class="[(infoDATA.patient.careLevel.value==0||infoDATA.patient.careLevel.value==1)?'red':'green']">{{infoDATA.patient.careLevel.name}}</text>
        </view>
        <view class="page_item_foot_text" v-if="
            (infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport')&&infoDATA.patient.illnessState
          ">
          <text class="text1">{{infoDATA.patient.illnessState.desc}}</text>
          <text class="text2"
            :class="{red:infoDATA.patient.illnessState.value==2||infoDATA.patient.illnessState.value==3}">{{infoDATA.patient.illnessState.name}}</text>
        </view>
        <view class="page_item_foot_text"
          v-if="
            (infoDATA.taskType.associationType.value == 'inspect' ||
            infoDATA.taskType.associationType.value == 'patientTransport')&&(infoDATA.isAccompany===1||infoDATA.isAccompany===0)">
          <text class="text1">陪同情况</text>
          <text class="text2"
            :class="{red:infoDATA.isAccompany===1}">{{ infoDATA.isAccompany===1?'需要医护陪同':'无需医护陪同'}}</text>
        </view>
        <view class="page_item_foot_text"
          v-if="(infoDATA.taskType.associationType.value == 'inspect' || infoDATA.taskType.associationType.value == 'patientTransport') && infoDATA.inspectScore">
          <text class="text1">陪检方式</text>
          <text class="text2">{{ infoDATA.inspectScore.inspectMode }}</text>
        </view>
        
        <view class="page_item_foot_text"
          v-if="(infoDATA.taskType.associationType.value == 'inspect' || infoDATA.taskType.associationType.value == 'patientTransport') && infoDATA.inspectUsers">
          <text class="text1">陪检人员</text>
          <text class="text2">{{ infoDATA.inspectUsers }}</text>
        </view>
        <view class="page_item_foot_text"
          v-if="(infoDATA.taskType.associationType.value == 'inspect' || infoDATA.taskType.associationType.value == 'patientTransport') && infoDATA.inspectUsersNum">
          <text class="text1">陪检人数</text>
          <text class="text2">{{ infoDATA.inspectUsersNum }}</text>
        </view>
        
        <view class="page_item_foot_text"
          v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.inspectUsers">
          <text class="text1">执行人员</text>
          <text class="text2">{{ infoDATA.inspectUsers }}</text>
        </view>
        <view class="page_item_foot_text"
          v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.inspectUsersNum">
          <text class="text1">执行人数</text>
          <text class="text2">{{ infoDATA.inspectUsersNum }}</text>
        </view>
      </view>
      <!-- 药包 -->
      <view class="page_item_info" v-if="infoDATA.taskType.associationType.value == 'drugsBag'">
        <text class="page_item_info_title">药包编码</text>
        <text class="text">{{ infoDATA.drugs?infoDATA.drugs.packid:'无' }}</text>
      </view>
      <!-- 血制品 -->
      <view class="page_item_info" v-if="
          infoDATA.taskType.associationType.value == 'ordinary' &&
          infoDATA.taskType.ordinaryField.value == 'blood'
        ">
        <view>
          <text class="page_item_info_title">·</text>
          <text class="text">
            送达数量
            <text class="page_item_info_txt">{{infoDATA.deliveryNum || '无'}}</text>
          </text>
          <text class="text">
            实收数量
            <text class="page_item_info_txt">{{infoDATA.actualReceiveNum || '无'}}</text>
          </text>
          <text class="text">
            应收数量
            <text class="page_item_info_txt">{{infoDATA.expectReceiveNum || '无'}}</text>
          </text>
        </view>
      </view>
      <!-- 标本 -->
      <view class="page_item_info" v-if="
          infoDATA.taskType.associationType.value == 'specimen' ||
          infoDATA.taskType.associationType.value == 'specimenPlan'
        ">
        <view>
          <text class="page_item_info_title">标本信息</text>
          <text class="text">
            预计接收
            <text class="page_item_info_txt">{{
              infoDATA.expectReceiveNum || '无'
            }}</text>
          </text>
          <text class="text"
            v-if="infoDATA.gdState.value == 5 || infoDATA.gdState.value == 6 || infoDATA.gdState.value == 7">
            扫描接收
            <text class="page_item_info_txt">{{infoDATA.actualReceiveNum || '无'}}</text>
          </text>
          <text class="text" v-if="infoDATA.gdState.value == 6 || infoDATA.gdState.value == 7">
            实际送达
            <text class="page_item_info_txt">{{actualDelivery || '无'}}</text>
          </text>
        </view>
        <view v-for="spe in infoDATA.specimenSet" :key="spe.id" class="spe_list">
          <view>
            <text class="page_item_info_title">标本类型</text>
            <text class="text">{{ spe.stype ? spe.stype.name : "-" }}({{
                spe.urgent == 1 ? "急" : "普"
              }})</text>
          </view>
          <view>
            <text class="page_item_info_title">标本编码</text>
            <text class="text">{{ spe.scode }}</text>
          </view>
          <view>
            <text class="page_item_info_title">患者姓名</text>
            <text class="text">{{ spe.patientName }}<text v-if="spe.bedNum">({{spe.bedNum}})</text></text>
          </view>
          <view>
            <text class="page_item_info_title">目标科室</text>
            <text class="text">{{
              spe.checkDept ? spe.checkDept.dept : "-"
            }}</text>
          </view>
        </view>
      </view>
      <!-- 静配 -->
      <view class="page_item_info" v-if="infoDATA.taskType.associationType.value == 'jPBag'">
        <text class="page_item_info_title">药包编码</text>
        <text class="text">{{ infoDATA.staticDistri?infoDATA.staticDistri.packid:'无' }}</text>
      </view>
      <!-- 陪检 -->
      <view v-if="infoDATA.taskType.associationType.value == 'inspect'">
        <view class="page_item_info">
          <text class="page_item_info_title">检查信息</text>
        </view>
        <view id="infos" :animation="animationData">
          <view class="page_item_infos" v-for="(item, index) of infoDATA.checkList" :key="index">
            <view class="page_item_info2">
              <view class="page_item_foot_text">
                <text class="text1">检查科室</text>
                <text class="text2">{{ item.execDept?item.execDept.dept:'-' }}</text>
              </view>
              <view class="page_item_foot_text">
                <text class="text1">检查项</text>
                <text class="text2">{{ item.inspectName||'-' }}</text>
              </view>
              <view class="page_item_foot_text">
                <text class="text1">叫号信息</text>
                <text class="text2">{{ item.reservationNumber||'-' }}</text>
              </view>
              <view class="page_item_foot_text">
                <text class="text1">预约时间</text>
                <text class="text2">{{ item.yyTime || "-" }}</text>
              </view>
              <!-- <view class="page_item_foot_text"
                v-show="item.inspectState.value==1||item.inspectState.value==2||item.inspectState.value==4">
                <view class="btn" @click.stop="remove(item)">移除</view>
              </view> -->
              <view class="page_item_foot_text">
                <view class="btn" @click.stop="remove(item)">移除</view>
              </view>
            </view>
          </view>
        </view>
        <view id="pulldown" @click="show('show')" v-if="showType == 'hiddle'">
          点击可查看检查详情
          <text class="cubeic-pulldown icon_transport transport-paixujiantouxia"></text>
        </view>
        <view id="pullup" @click="show('hiddle')" v-if="showType == 'show'">
          点击可收起检查详情
          <text class="cubeic-pullup icon_transport transport-paixujiantoushang"></text>
        </view>
      </view>
    </view>
    <view class="foot_btn2 footerPadding">
      <view class="btn2" @click="showAlert" v-if="infoDATA.gdState.value == 2">接单</view>
      <!-- 如果不是静配,药配,标本配送,标本轮巡,万能交接 -->
      <template
        v-if="((!infoDATA.worker)||(infoDATA.worker&&infoDATA.worker.id == currentUserId))&&infoDATA.gdState.value != 6&&infoDATA.gdState.value != 7&&infoDATA.gdState.value != 11">
        <view :class="[infoDATA.taskType.specialCloseButton == 1 ? 'btn3' : 'btn2']" v-if="
          infoDATA.gdState.value != 2 &&
          infoDATA.taskType.associationType.value != 'jPBag' &&
          infoDATA.taskType.associationType.value != 'drugsBag' &&
          infoDATA.taskType.associationType.value != 'specimen' &&
          infoDATA.taskType.associationType.value != 'specimenPlan' &&
          infoDATA.taskType.associationType.value != 'ordinary' &&
          !(infoDATA.taskType.associationType.value == 'other' && (infoDATA.gdState.value == 4 && infoDATA.taskType.carryingCourses[0].actionsSwitch || infoDATA.gdState.value == 5 && infoDATA.taskType.carryingCourses[1].actionsSwitch))
        " hover-class="seimin-btn-hover">
          <smallScreen :sData="infoDATA" :sType="1">扫码</smallScreen>
        </view>
        <!-- 其他临床服务-完成工单-待到达 -->
        <view v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.gdState.value == 4 && infoDATA.taskType.carryingCourses[0].actionsSwitch" class="btn2 page_item_btn" @click="otherCompleteOrder(infoDATA)" hover-class="seimin-btn-hover">确认到达</view>
        <!-- 其他临床服务-完成工单-待送达 -->
        <view v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.gdState.value == 5 && infoDATA.taskType.carryingCourses[1].actionsSwitch" class="btn2 page_item_btn" @click="otherCompleteOrder(infoDATA)" hover-class="seimin-btn-hover">完成工单</view>
        <!-- 其他临床服务-拍照 -->
        <view v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.gdState.value == 4 && infoDATA.taskType.carryingCourses[0].photoSwitch" class="btn2 page_item_btn" @click="photographToOther(infoDATA, 'start')" hover-class="seimin-btn-hover">拍照</view>
        
        <view :class="[infoDATA.taskType.specialCloseButton == 1 ? 'btn3' : 'btn2']" @click="photograph(infoDATA)" v-if="
          infoDATA.taskType.associationType.value != 'jPBag' &&
          infoDATA.taskType.associationType.value != 'drugsBag' &&
          infoDATA.taskType.associationType.value != 'specimen' &&
          infoDATA.taskType.associationType.value != 'specimenPlan' &&
          infoDATA.taskType.associationType.value != 'other' &&
          infoDATA.taskType.associationType.value != 'ordinary' &&
          infoDATA.gdState.value == 4
        " hover-class="seimin-btn-hover">拍照</view>
        <view class="btn3" @click="specialCloseClick()" v-if="
          infoDATA.gdState.value != 2 &&
          infoDATA.taskType.associationType.value != 'jPBag' &&
          infoDATA.taskType.associationType.value != 'drugsBag' &&
          infoDATA.taskType.associationType.value != 'specimen' &&
          infoDATA.taskType.associationType.value != 'specimenPlan' &&
          infoDATA.taskType.associationType.value != 'ordinary' &&
          infoDATA.taskType.specialCloseButton == 1
        " hover-class="seimin-btn-hover">特殊情况关闭</view>
      </template>
      <!-- 如果不是患者陪检或患者转运或其他,万能交接 -->
      <view :class="[infoDATA.taskType.specialCloseButton == 1 ? 'btn3' : 'btn2']" v-if="
          infoDATA.gdState.value != 2 &&
          infoDATA.taskType.associationType.value != 'patientTransport' &&
          infoDATA.taskType.associationType.value != 'inspect' &&
          infoDATA.taskType.associationType.value != 'other' &&
          infoDATA.taskType.associationType.value != 'ordinary'
        " hover-class="seimin-btn-hover">
        <smallScreen :sData="infoDATA" :sType="2">扫码</smallScreen>
      </view>
      <!-- 如果是万能交接 -->
      <view :class="[infoDATA.taskType.specialCloseButton == 1 ? 'btn3' : 'btn2']"
        v-if="infoDATA.taskType.associationType.value == 'ordinary'"
        hover-class="seimin-btn-hover" @click="goBack()">
        知道了
      </view>
      <view class="btn3" @click="specialCloseClick()" v-if="
          infoDATA.gdState.value != 2 &&
          infoDATA.taskType.associationType.value != 'patientTransport' &&
          infoDATA.taskType.associationType.value != 'inspect' &&
          infoDATA.taskType.associationType.value != 'other' &&
          infoDATA.taskType.specialCloseButton == 1
        " hover-class="seimin-btn-hover">特殊情况关闭</view>
      <view class="btn3" @click="viewSpecimen(infoDATA)" v-if="
          infoDATA.taskType.associationType.value == 'specimen' ||
          infoDATA.taskType.associationType.value == 'specimenPlan'
        " hover-class="seimin-btn-hover">查看标本</view>
      <view class="btn3" @click="viewDrugsBag(infoDATA)" v-if="infoDATA.taskType.associationType.value == 'drugsBag'" hover-class="seimin-btn-hover">查看业务流程</view>
      <view class="btn3" @click="toDrugBatches(infoDATA.drugs.batchNo)" v-if="infoDATA.taskType.associationType.value == 'drugsBag' && taskTypeConfig.drugsBatchInfo == 1" hover-class="seimin-btn-hover">药品批次</view>
      <view class="btn3" @click="viewBlood(infoDATA)" v-if="infoDATA.taskType.associationType.value == 'ordinary' && infoDATA.taskType.ordinaryField.value == 'blood'" hover-class="seimin-btn-hover">查看血制品</view>
      <view class="btn3" @click="additionalUser(infoDATA)" v-if="(infoDATA.taskType.associationType.value == 'inspect' || infoDATA.taskType.associationType.value == 'patientTransport') && infoDATA.worker && infoDATA.worker.id && multiplayerMode === 1" hover-class="seimin-btn-hover">追加陪检人员</view>
      <view class="btn3" @click="additionalUser(infoDATA)" v-if="infoDATA.taskType.associationType.value == 'other' && infoDATA.worker && infoDATA.worker.id && clinicalMultiplayerMode === 1 && clinicalTaskIdsFlag && !infoDATA.copyBy" hover-class="seimin-btn-hover">追加执行人员</view>
    </view>
    <!-- 弹窗 -->
    <showModel :title="models.title" :icon="models.icon" :disjunctor="models.disjunctor" :content="models.content"
      @know="know" :operate="models.operate" @ok="ok" @cancel="cancel" :textareaFlag="textareaFlag"
      @textareaInput="textareaInput"></showModel>
    <!-- 弹窗 -->
    <inspectRemoveModel :title="models1.title" :icon="models1.icon" :disjunctor="models1.disjunctor"
      :content="models1.content" @know="know1" :operate="models1.operate" @ok="ok1" @cancel="cancel1" :remove="true">
    </inspectRemoveModel>
    <!-- 填写交接人工号弹窗 -->
    <selectAccount v-if="hosModels.disjunctor" :disjunctor="hosModels.disjunctor" @ok="hosOk"
      @cancel="hosCancel">
    </selectAccount>
    <!-- 手动查询弹窗 -->
    <checkboxModal v-if="checkboxModels.disjunctor" :content="checkboxModels.content" :disjunctor="checkboxModels.disjunctor"
      @ok="checkboxOk" @cancel="checkboxCancel">
    </checkboxModal>
  </view>
</template>
<script>
  import selectAccount from "../../components/selectAccount/selectAccount.vue";
  import smallScreen from "../../components/smallScreen/smallScreen.vue";
  import {
    get,
    post,
    SM,
    webHandle
  } from "../../http/http.js";
  import {
    pathUrl,
    photographTool
  } from "../../tools/photograph.js";
  export default {
    components: {
      selectAccount,
    },
    data() {
      return {
        other: {
          user: {},
          data: {},
        },
        // 手动查询弹窗model
        checkboxModels: {
          disjunctor: false,
        },
        taskTypeConfig: {},
        // 填写交接人工号弹窗model
        hosModels: {
          disjunctor: false,
        },
        currentCode: '', //当前拍照使用的科室二维码
        currentData: {}, //当前小扫描的工单对象
        multiplayerMode: 0,
        clinicalMultiplayerMode: 0,
        clinicalTaskIdsFlag: false,
        hosId: uni.getStorageSync('userData').user.currentHospital.id,
        SMFlag:true,
        actualDelivery: 0,
        currentUserId: 0,
        // 弹窗model
        models: {
          disjunctor: false,
        },
        // 弹窗model1
        models1: {
          disjunctor: false,
        },
        currentInspect: null,
        showType: "show",
        infoDATA: {},
        dataId: "",
        animationData: {},
        // 特殊情况关闭原因开关
        textareaFlag: false,
        textareaText: "",
      };
    },
    filters: {
      // 自定义管道 yyTime
      yyTimeFilter: function(data) {
        if (data) {
          let nDate = null;
          if (typeof data == 'string') {
            let arr = data.split(/[-:\s]/);
            nDate = new Date(
              arr[0] - 0,
              arr[1] - 1,
              arr[2] - 0,
              arr[3] - 0,
              arr[4] - 0,
              0
            );
          } else if (typeof data == 'number') {
            nDate = new Date(data);
          }
          const month = (nDate.getMonth() + 1).toString().padStart(2, 0);
          const date = nDate.getDate().toString().padStart(2, 0);
          const hour = nDate.getHours().toString().padStart(2, 0);
          const minute = nDate.getMinutes().toString().padStart(2, 0);
          return `${month}-${date} ${hour}:${minute}`;
        } else {
          return "-";
        }
      },
    },
    methods: {
      // 手动查询-确认
      checkboxOk(bulkCopy) {
        console.log(bulkCopy);
        this.checkboxModels.disjunctor = false;
        let { user, data } = this.other;
        this.additionalUserCommon(user, data.id, data.worker.id, bulkCopy);
      },
      // 手动查询-取消
      checkboxCancel() {
        this.checkboxModels.disjunctor = false;
      },
      // 手动查询弹窗
      showCheckboxModal(user, data) {
        this.other = {
          user,
          data,
        };
        this.checkboxModels = {
          content: `您要最追加的人员为${user.name},您确认要追加吗?`,
          disjunctor: true,
        }
      },
      // 判断药品页面控制-是否显示关联批次药品
      isShowDrugsBatchInfo(){
        post("/simple/data/fetchDataList/taskType", {
          "idx": 0,
          "sum": 10,
          "taskType": {
            "simpleQuery": true,
            "hosId": {
              "id": this.hosId
            },
            "associationType": {
              "key": "association_types",
              "value": "drugsBag"
            }
          }
        }).then((res) => {
          if (res.status == 200) {
            res.list = res.list || [];
            let taskType = res.list[0] || {};
            if(taskType.id){
              post("/simple/data/fetchDataList/taskTypeConfig", {
                "idx": 0,
                "sum": 10,
                "taskTypeConfig": {
                  "taskTypeDTO": {
                    "hosId": {
                      "id": this.hosId
                    },
                    "associationType": taskType.associationType
                  }
                }
              }).then((res) => {
                if (res.status == 200) {
                  res.list = res.list || [];
                  this.taskTypeConfig = res.list[0] || {};
                } else {
                  uni.showToast({
                    icon: "none",
                    title: res.msg || "接口获取数据失败!",
                  });
                }
              });
            }else{
              uni.showToast({
                icon: "none",
                title: "请配置药品任务类型!",
              });
            }
          } else {
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败!",
            });
          }
        });
      },
      // 跳转到药品批次页面
      toDrugBatches(batchNo){
        uni.navigateTo({
          url: `../drugBatches/drugBatches?batchNo=${batchNo}`,
        });
      },
      // 前往其他临床服务完成工单确认页面
      otherCompleteOrder(data){
        console.log(data);
        uni.navigateTo({
          url: `../otherCompleteOrder/otherCompleteOrder?orderId=${data.id}&taskType=${data.taskType ? encodeURIComponent(JSON.stringify(data.taskType)) : ''}&order=${data ? encodeURIComponent(JSON.stringify(data)) : ''}`,
        });
      },
      // 如果不是静配,药配,标本配送,标本轮巡
      // 科室签到(小扫描)-拍照
      nextDeptOrder_ss(data, accountObj) {
        console.log(this.currentCode);
        let isKs = 0;
        let ids = [];
        let id = data.id;
        ids.push(id);
        let list = {
          code: "",
          ids: ids,
        };
        let code = "";
        let type = "";
        if (this.currentCode) {
          let gdStateValue = data.gdState.value; //工单状态value
          let associationTypeValue = data.taskType.associationType.value; //关联类型value
          
          // 其他临床服务,并且工单状态是待到达||工单状态待送达
          if (
            (associationTypeValue == "other" &&
              gdStateValue == "4") ||
            gdStateValue == "5"
          ) {
            code = this.currentCode;
            type = "orderSign/" + code;
            list = {
              ids
            };
            if (accountObj) {
              list.handover = [accountObj.accountId];
            }
            isKs = 1;
          }
          uni.showLoading({
            title: "加载中",
            mask: true,
          });
          post("/workerOrder/" + type, list).then((res) => {
            uni.hideLoading();
            if (res) {
              if (res.status == 200) {
                if (
                  gdStateValue == "4" &&
                  associationTypeValue == "other"
                ) {
                  uni.navigateTo({
                    url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
                  });
                }
                if (gdStateValue == "5") {
                  uni.navigateTo({
                    url: `../../pages/scanning_code/scanning_code?type=${associationTypeValue}&type1=${res.type}&id=${data.id}&deptCode=${code}&dept=${res.dept}&accountObj=${encodeURIComponent(JSON.stringify(accountObj))}`,
                  });
                }
              } else {
                uni.navigateTo({
                  url: `../../pages/scanning_Result/scanning_Result?type=${
                  associationTypeValue
                }&type1=${res.type}&id=${data.id}&status=600&msg=${
                  res.msg
                }&isKs=${isKs}&model=${encodeURIComponent(
                  JSON.stringify(res)
                )}&qrcode=${this.currentCode}`,
                });
              }
            } else {
              uni.navigateTo({
                url: `../../pages/scanning_Result/scanning_Result?id=${data.id}&status=600&msg=扫码失败!请扫描正确的二维码!&isKs=${isKs}&qrcode=${this.currentCode}`,
              });
            }
          });
        }
      },
      // 填写交接人工号-确认
      hosOk(data) {
        console.log(data);
        const {
          accountName,
          account,
          accountId
        } = data;
        if (!accountName && !account) {
          //没有填写交接人
          uni.showModal({
            title: '提示',
            content: "请填写交接人工号!",
            showCancel: false,
            success: function(res) {
              if (res.confirm) {
                console.log('用户点击确定');
              } else if (res.cancel) {
                console.log('用户点击取消');
              }
            }
          });
          return;
        } else if (!accountName && account || accountName && !account) {
          //没有填写交接人
          uni.showModal({
            title: '提示',
            content: "请填写正确的交接人工号!",
            showCancel: false,
            success: function(res) {
              if (res.confirm) {
                console.log('用户点击确定');
              } else if (res.cancel) {
                console.log('用户点击取消');
              }
            }
          });
          return;
        }
        this.hosModels.disjunctor = false;
        let associationTypeValue = this.currentData.taskType.associationType.value;
        console.log(associationTypeValue)
        this.uploadToOther(this.currentData, data, 'start');
      },
      // 填写交接人工号-取消
      hosCancel() {
        this.hosModels.disjunctor = false;
      },
      // 填写交接人工号弹窗
      showSelectAccount() {
        this.hosModels = {
          disjunctor: true,
        }
      },
      // 拍照-上传
      uploadToOther(data, accountObj, type){
        // 其他临床服务拍照签到
        console.log(data, 1111);
        let id_seimin;
        let asTypeValue_seimin;
        let gdStateValue_seimin;
        if (data.status != 200 && data.status !== undefined) {
          id_seimin = data.id;
          asTypeValue_seimin = data.type;
          gdStateValue_seimin = JSON.parse(data.model).gdstate2; //type改成gdstate
        } else {
          id_seimin = data.id;
          asTypeValue_seimin = data.taskType.associationType.value;
          gdStateValue_seimin = data.gdState.value;
        }
        //#ifdef H5
        uni.chooseImage({
          count: 1,
          sourceType: ['camera'],
          success: (chooseImageRes) => {
            console.log(chooseImageRes, pathUrl)
            const tempFilePaths = chooseImageRes.tempFilePaths;
            const tempFiles = chooseImageRes.tempFiles;
            let tp = tempFilePaths[0];
            uni.showLoading({
              mask: true,
              title: '加载中'
            });
            post('/workerOrder/findRecordInfoByOrderId', {
              orderId: id_seimin,
              gdOperate: 21,
            }).then(result => {
              console.log(result)
              if (result.state == 200) {
                uni.getImageInfo({
                  src: tp,
                  success: (res) => {
                    console.log('压缩前', res)
                    let canvasWidth = res.width //图片原始长宽
                    let canvasHeight = res.height
                    let img = new Image()
                    img.src = res.path
                    let canvas = document.createElement('canvas');
                    let ctx = canvas.getContext('2d')
                    canvas.width = canvasWidth
                    canvas.height = canvasHeight
                    ctx.drawImage(img, 0, 0, canvasWidth, canvasHeight)
                    canvas.toBlob((fileSrc) => {
                      tp = window.URL.createObjectURL(fileSrc)
                      console.log('压缩后', tp);
                      uni.uploadFile({
                        url: pathUrl + '/common/common/uploadAttachment/'+(type == 'start' ? 'orderStartPhoto' : 'orderEndPhoto')+'/' + id_seimin + '/' + result.recordId,
                        filePath: tp,
                        name: 'file',
                        formData: {
                          'filename': tempFiles[0].name ? tempFiles[0].name.split('.')[0] + '.jpg' : tempFiles[
                            0].path.split(
                              /[\\/]/).reverse()[0].split('.')[0] + '.jpg'
                        },
                        success: (uploadFileRes) => {
                          console.log(uploadFileRes, 10086, asTypeValue_seimin);
                          this.nextDeptOrder_ss(data, accountObj, type);
                        },
                        fail: err => {
                          console.error(err);
                          uni.hideLoading();
                          uni.showToast({
                            icon: 'none',
                            title: '上传失败',
                            duration: 2000
                          });
                        }
                      });
                    }, 'image/jpeg', 0.3)
                  },
                  fail: function () {
                    uni.hideLoading();
                    uni.showToast({
                      icon: 'none',
                      title: '上传失败',
                      duration: 2000
                    });
                  }
                })
              } else {
                uni.hideLoading();
                uni.showToast({
                  icon: "none",
                  title: result.msg || "接口获取数据失败!",
                });
              }
            })
          }
        });
        //#endif
        //#ifdef APP-PLUS
        uni.chooseImage({
          count: 1,
          sourceType: ['camera'],
          sizeType: ['compressed'],
          success: (chooseImageRes) => {
            console.log(chooseImageRes, pathUrl)
            const tempFilePaths = chooseImageRes.tempFilePaths;
            const tempFiles = chooseImageRes.tempFiles;
            let tp = tempFilePaths[0];
            uni.showLoading({
              mask: true,
              title: '加载中'
            });
            post('/workerOrder/findRecordInfoByOrderId', {
              orderId: id_seimin,
              gdOperate: 21,
            }).then(result => {
              console.log(result)
              if (result.state == 200) {
                uni.compressImage({
                  src: tp,
                  quality: 30,
                  success: (res) => {
                    console.log('压缩前', res)
                    tp = res.tempFilePath;
                    console.log('压缩后', tp);
                    uni.uploadFile({
                      url: pathUrl + '/common/common/uploadAttachment/'+(type == 'start' ? 'orderStartPhoto' : 'orderEndPhoto')+'/' + id_seimin + '/' + result.recordId,
                      filePath: tp,
                      name: 'file',
                      formData: {
                        'filename': tempFiles[0].name ? tempFiles[0].name.split('.')[0] + '.jpg' : tempFiles[
                          0].path.split(
                            /[\\/]/).reverse()[0].split('.')[0] + '.jpg'
                      },
                      success: (uploadFileRes) => {
                        console.log(uploadFileRes, 10086, asTypeValue_seimin);
                        this.nextDeptOrder_ss(data, accountObj, type);
                      },
                      fail: err => {
                        console.error(err);
                        uni.hideLoading();
                        uni.showToast({
                          icon: 'none',
                          title: '上传失败',
                          duration: 2000
                        });
                      }
                    });
                  },
                  fail: function () {
                    uni.hideLoading();
                    uni.showToast({
                      icon: 'none',
                      title: '上传失败',
                      duration: 2000
                    });
                  }
                })
              } else {
                uni.hideLoading();
                uni.showToast({
                  icon: "none",
                  title: result.msg || "接口获取数据失败!",
                });
              }
            })
          }
        });
        //#endif
      },
      // 拍照-其他
      async photographToOther(data, type) {
        this.currentData = data;
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        // 其他临床服务
        let result = await post("/dept/scanning", {
          content: type === 'start' ? data.startDept.qrcode : data.endDepts[0].qrcode,
          taskTypeId: data.taskType.id,
          gdState: data.gdState.id,
        });
        uni.hideLoading();
        this.currentCode = result.code;
        if (result.state == 200 || result.state == 201) {
          uni.showModal({
          	title: '提示',
          	content: '请尽量拍摄角度覆盖清洁区域?',
          	success: (res) => {
          		if (res.confirm) {
          			if (result.account) {
          			  this.uploadToOther(data, {
          			    account: result.account,
          			    accountName: result.name,
          			    accountId: result.id,
          			  }, type);
          			} else {
          			  this.uploadToOther(data, undefined, type);
          			}
          		} else if (res.cancel) {
          			console.log('用户点击取消');
          		}
          	}
          });
        } else if (result.state == '0000') {
          this.showSelectAccount();
        } else {
          uni.showToast({
            icon: "none",
            title: result.info || "接口获取数据失败!",
          });
        }
      },
      goBack() {
        uni.navigateTo({
          url: "../receiptpage/receiptpage",
        });
      },
      // 查看标本
      viewSpecimen(workOrder) {
        uni.navigateTo({
          url: `../specimenDetail/specimenDetail?workOrderId=${workOrder.id}&associationTypeValue=${workOrder.taskType.associationType.value}`,
        });
      },
      // 查看药品业务数据
      viewDrugsBag(workOrder) {
        uni.navigateTo({
          url: `../drugsBagHistory/drugsBagHistory?id=${workOrder.drugs.id}&packid=${workOrder.drugs.packid}`,
        });
      },
      // 查看血制品
      viewBlood(workOrder) {
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        post('/transflow/checkData', {
          "type": "blood",
          "orderId": workOrder.id
        }).then(res => {
          uni.hideLoading();
          if(res.state == 200){
            uni.navigateTo({
              url: `../blood_list/blood_list?bloods=${encodeURIComponent(JSON.stringify(res.data.all))}`,
            });
          }else{
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败!",
            });
          }
        })
      },
      // 移除检查->知道了
      know1() {
        this.models1.disjunctor = false;
        // this.getInfo(this.dataId);
        uni.navigateTo({
          url: '../receiptpage/receiptpage',
        });
      },
      // 移除检查->确定
      ok1(data) {
        console.log(data);
        const {
          value,
          yyTime
        } = data;
        if (!value) {
          //没有选择移除原因
          uni.showModal({
            title: "提示",
            content: "请选择移除原因!",
            showCancel: false,
            success: function(res) {
              if (res.confirm) {
                console.log("用户点击确定");
              } else if (res.cancel) {
                console.log("用户点击取消");
              }
            },
          });
          return;
        } else if (value == 2 && !yyTime) {
          //没有填写预约时间
          uni.showModal({
            title: "提示",
            content: "请填写预约时间!",
            showCancel: false,
            success: function(res) {
              if (res.confirm) {
                console.log("用户点击确定");
              } else if (res.cancel) {
                console.log("用户点击取消");
              }
            },
          });
          return;
        }
        this.models1.disjunctor = false;
        let postData = {
          gdId: this.infoDATA.id,
          inspectId: this.currentInspect.id,
          reason: value == 1 ? 'checkDone' : 'modificationTime',
          yyTime: value == 1 ? undefined : yyTime,
        };
        uni.showLoading({
          title: '移除中',
          mask: true,
        })
        post('/workerOrder/removeInspectByOderId', postData).then(res => {
          uni.hideLoading();
          if (res.state == 200) {
            uni.showToast({
              icon: 'none',
              title: '移除成功!',
              success() {
                setTimeout(() => {
                  uni.navigateTo({
                    url: '../receiptpage/receiptpage',
                  });
                }, 1500)
              }
            })
          } else {
            uni.showToast({
              icon: 'none',
              title: '移除失败!',
            })
          }
        })
      },
      // 移除检查->取消
      cancel1() {
        this.models1.disjunctor = false;
      },
      // 移除
      remove(item) {
        this.currentInspect = item;
        this.models1 = {
          disjunctor: true,
          content: "请选择您移除检查的原因?检查移除后将会自动完成或删除工单!",
          icon: "warn",
          operate: {
            ok: "确定",
            cancel: "取消",
          },
        };
      },
      // 拍照
      photograph(data) {
        photographTool(data);
      },
      // 特殊情况输入文字
      textareaInput(value) {
        this.textareaText = value;
        if (value.trim().length >= 10) {
          this.models.operate = {
            ok: "确定",
            cancel: "取消",
          };
        } else {
          this.models.operate = {
            cancel: "取消",
          };
        }
      },
      // 追加陪检人/执行人按钮
      additionalUser(data) {
        if (!this.SMFlag) {
          return;
        }
        this.SMFlag = false;
        console.log(data, 'data');
        SM().then((ress1) => {
          uni.showLoading({
            title: "加载中",
            mask: true,
          });
          //检验二维码的有效性
          post("/dept/scanning", {
            content: ress1,
            taskTypeId: data.taskType.id,
            gdState: data.gdState.id,
          }).then((result) => {
            this.SMFlag = true;
            // this.currentCode = result.code;
            if (result.state == 200 || result.state == 201) {
              console.log(result);
              let user;
              try{
                // json对象字符串
                user = JSON.parse(result.code);
                // 不是json对象字符串
                if(Object.prototype.toString.call(user).slice(8, -1).toLowerCase() !== 'object'){
                  user = result.code;
                }
              }catch(e){
                user = result.code;
              }
              if(Object.prototype.toString.call(user).slice(8, -1).toLowerCase() === 'object' && user.type == 'myQrCode' && user.id && user.name){
                user.qrcode = ress1;
                uni.hideLoading();
                if(data.taskType.associationType.value == 'other'){
                  this.showCheckboxModal(user, data);
                }else{
                  uni.showModal({
                    title: "提示",
                    content: `您要最追加的人员为${user.name},您确认要追加吗?`,
                    success: (res) => {
                      if (res.confirm) {
                        console.log("用户点击确定");
                        this.additionalUserCommon(user, data.id, data.worker.id, false);
                      } else if (res.cancel) {
                        console.log("用户点击取消");
                      }
                    },
                  });
                }
              }else if(Object.prototype.toString.call(user).slice(8, -1).toLowerCase() === 'string'){
                let identityCardNumber = user;
                // 根据身份证获取name
                // todo
                post("/data/fetchDataList/user", {idx: 0, sum: 1, user: { identityCardNumber }}).then((result) => {
                  uni.hideLoading();
                  if(result.status == 200){
                    result.list = result.list || [];
                    if(result.list.length){
                      let user = {name: result.list[0].name, identityCardNumber, qrcode: ress1};
                      if(data.taskType.associationType.value == 'other'){
                        this.showCheckboxModal(user, data);
                      }else{
                        uni.showModal({
                          title: "提示",
                          content: `您要最追加的人员为${user.name},您确认要追加吗?`,
                          success: (res) => {
                            if (res.confirm) {
                              console.log("用户点击确定");
                              this.additionalUserCommon(user, data.id, data.worker.id, false);
                            } else if (res.cancel) {
                              console.log("用户点击取消");
                            }
                          },
                        });
                      }
                    }else{
                      uni.navigateTo({
                        url: `../result_error/result_error?qrcode=${ress1}&msg=扫描二维码无法找到用户!`,
                      });
                    }
                  }else{
                    uni.navigateTo({
                      url: `../result_error/result_error?qrcode=${ress1}&msg=请扫描正确的二维码!`,
                    });
                  }
                })
              }else{
                uni.hideLoading();
                uni.navigateTo({
                  url: `../result_error/result_error?qrcode=${ress1}&msg=请扫描正确的二维码!`,
                });
              }
            } else {
              uni.hideLoading();
              uni.navigateTo({
                url: `../result_error/result_error?qrcode=${ress1}&msg=${result.info || '接口获取数据失败!'}`,
              });
            }
          });
        }).catch(err=>{
          this.SMFlag = true;
        });
      },
      // 追加陪检人/执行人
      additionalUserCommon(user, gdId, workerId, bulkCopy) {
        console.log(user, gdId, workerId, bulkCopy);
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        // 二维码里有id则传userid,没有则传identityCardNumber
        post("/workerOrder/additionalAccompanyingPersonnel", {
          userId: user.id || undefined,
          identityCardNumber: !user.id ? user.identityCardNumber : undefined,
          gdId,
          workerId,
          bulkCopy: bulkCopy ? 1 : undefined,
        }).then((result) => {
          uni.hideLoading();
          if (result.state == 200) {
            this.getInfo(gdId);
            uni.showToast({
              icon: 'none',
              duration: 4000,
              title: '操作成功!'
            })
          } else {
            uni.navigateTo({
              url: `../result_error/result_error?qrcode=${user.qrcode}&msg=${result.msg || '接口获取数据失败!'}`,
            });
          }
        });
      },
      // 特殊情况关闭按钮
      specialCloseClick() {
        this.textareaFlag = true;
        this.models = {
          title: "特殊情况关闭",
          disjunctor: true,
          content: "",
          icon: "",
          operate: {
            cancel: "取消",
          },
        };
      },
      ok() {
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        post("/workerOrder/specialCaseClose", {
          workOrderId: this.dataId,
          reason: this.textareaText.trim(),
        }).then((result) => {
          this.models.disjunctor = false;
          this.textareaFlag = false;
          this.textareaText = "";
          if (result.state == 200) {
            uni.hideLoading();
            this.models = {
              disjunctor: true,
              content: "工单关闭成功",
              icon: "success",
              operate: {
                know: "知道了",
              },
            };
          } else {
            uni.hideLoading();
            this.models = {
              disjunctor: true,
              content: "工单关闭失败",
              icon: "error",
              operate: {
                know: "知道了",
              },
            };
          }
        });
      },
      cancel() {
        this.models.disjunctor = false;
        this.textareaFlag = false;
        this.textareaText = "";
      },
      // 点击可查看检查详情
      show(type) {
        this.showType = type;
        if (type === "show") {
          //展开
          // 计算高度
          const query = uni.createSelectorQuery().in(this);
          query
            .selectAll(".page_item_infos")
            .boundingClientRect((data) => {
              let len = data.reduce((prev, current) => {
                return prev + current.height;
              }, 0);
              this.animation.height(len).step();
              this.animationData = this.animation.export();
            })
            .exec();
        } else if (type === "hiddle") {
          this.animation.height(0).step();
          this.animationData = this.animation.export();
        }
      },
      // 抢单->知道了
      know() {
        this.models.disjunctor = false;
        uni.navigateTo({
          url: "../receiptpage/receiptpage",
        });
      },
      // 抢单
      showAlert() {
        get("/workerOrder/takeOrder/" + this.infoDATA.id).then((res) => {
          if (res.status == 200) {
            this.models = {
              disjunctor: true,
              content: "接单成功",
              icon: "success",
              operate: {
                know: "知道了",
              },
            };
          } else {
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败!",
            });
          }
        });
      },
      // 请求详细页面的数据(除标本轮巡和标本配送)
      getInfo(id) {
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        get("/api/fetchData/workOrder/" + id).then((res) => {
          uni.hideLoading();
          if (res.status == 200) {
            this.infoDATA = res.data;
            // 计算高度
            setTimeout(() => {
              const query = uni.createSelectorQuery().in(this);
              query
                .selectAll(".page_item_infos")
                .boundingClientRect((data) => {
                  let len = data.reduce((prev, current) => {
                    return prev + current.height;
                  }, 0);
                  this.animation.height(len).step();
                  this.animationData = this.animation.export();
                })
                .exec();
            }, 500)
          } else {
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败!",
            });
          }
        });
      },
      // 请求详细页面的数据
      getInfoBySpecimen(id) {
        uni.showLoading({
          title: "加载中",
          mask: true,
        });
        post("/api/getWechatItem", {
          id
        }).then((res) => {
          uni.hideLoading();
          if (res.state == 200) {
            this.actualDelivery = res.actualDelivery;
            this.infoDATA = res.data;
            // 计算高度
            setTimeout(() => {
              const query = uni.createSelectorQuery().in(this);
              query
                .selectAll(".page_item_infos")
                .boundingClientRect((data) => {
                  let len = data.reduce((prev, current) => {
                    return prev + current.height;
                  }, 0);
                  this.animation.height(len).step();
                  this.animationData = this.animation.export();
                })
                .exec();
            }, 500)
          } else {
            uni.showToast({
              icon: "none",
              title: res.msg || "接口获取数据失败!",
            });
          }
        });
      },
      // 获取检查页面控制开关
      getTaskConfig(){
        post("/simple/data/fetchDataList/taskTypeConfig", {
            "idx": 0,
            "sum": 10,
            "taskTypeConfig": {
                "taskTypeDTO": {
                    "hosId": {
                        "id": this.hosId
                    },
                    "associationType": {
                        "key": "association_types",
                        "value": "inspect"
                    }
                }
            }
        }).then((result) => {
          if (result.status == 200) {
            if(result.list && result.list[0]){
              this.multiplayerMode = result.list[0].multiplayerMode;
            }else{
              this.multiplayerMode = 0;
            }
          } else {
            this.multiplayerMode = 0;
          }
        });
      },
      // 获取临床服务页面控制开关
      getTaskOtherConfig(options){
        post("/simple/data/fetchDataList/taskTypeConfig", {
            "idx": 0,
            "sum": 10,
            "taskTypeConfig": {
                "hosId": this.hosId,
                "associationType": options.associationTypeId,
            }
        }).then((result) => {
          if (result.status == 200) {
            if(result.list && result.list[0]){
              this.clinicalMultiplayerMode = result.list[0].clinicalMultiplayerMode;
              let clinicalTaskIds = result.list[0].clinicalTaskIds ? result.list[0].clinicalTaskIds.split(',') : [] ;
              this.clinicalTaskIdsFlag = clinicalTaskIds.includes(options.taskTypeId);
              console.log(clinicalTaskIds, options.taskTypeId)
            }else{
              this.clinicalMultiplayerMode = 0;
              this.clinicalTaskIdsFlag = false;
            }
          } else {
            this.clinicalMultiplayerMode = 0;
            this.clinicalTaskIdsFlag = false;
          }
        });
      }
    },
    onLoad(options) {
      console.log(options, 'options');
      options.associationTypeValue === 'drugsBag' && this.isShowDrugsBatchInfo();
      this.currentUserId = uni.getStorageSync('userData').user.id;
      let id = options.id;
      this.dataId = id;
      if (
        options.associationTypeValue == 'specimen' ||
        options.associationTypeValue == 'specimenPlan'
      ) {
        this.getInfoBySpecimen(id);
      } else {
        this.getInfo(id);
      }
      if (
        options.associationTypeValue == 'inspect' ||
        options.associationTypeValue == 'patientTransport'
      ) {
        this.getTaskConfig();
      }else if(options.associationTypeValue == 'other'){
        this.getTaskOtherConfig(options);
      }
      // 创建动画
      this.animation = uni.createAnimation({
        duration: 500,
        timingFunction: "ease",
      });
      // #ifdef APP-PLUS
      webHandle("no", "app");
      // #endif
      // #ifdef H5
      webHandle("no", "wx");
      // #endif
    },
    onUnload() {
      // 页面关闭后清空数据
      this.animationData = {};
    },
  };
</script>
<style lang="less">
  .Receipt_infopage {
    padding: 0 20rpx;
    overflow: hidden;

    .red {
      color: red !important;
      font-weight: bold !important;
    }

    .green {
      color: #49b856 !important;
      font-weight: bold !important;
    }

    .title {
      font-size: 48rpx;
      margin-top: 24rpx;
      margin-bottom: 24rpx;
      text-align: center;
    }

    .page_item {
      margin-top: 16rpx;
      margin-bottom: 124rpx;
      background: #fff;
      border-radius: 8rpx;
      padding: 0 16rpx;
      border: 2rpx solid #e5e9ed;

      .L {
        width: 40rpx;
        height: 40rpx;
        border-radius: 50%;
        background: #f9fafb;
        position: relative;
        left: -50rpx;
        top: 66rpx;
      }

      .R {
        width: 40rpx;
        height: 40rpx;
        border-radius: 50%;
        background: #f9fafb;
        position: relative;
        float: right;
        right: -50rpx;
        top: 26rpx;
      }

      .starting {
        width: 50rpx;
        height: 50rpx;
        color: #fff;
        background: #49b856;
        display: inline-block;
        border-radius: 50%;
        text-align: center;
        line-height: 46rpx;
        font-size: 32rpx;
        margin-right: 6rpx;
      }

      .End {
        width: 50rpx;
        height: 50rpx;
        color: #fff;
        background: #39b199;
        display: inline-block;
        border-radius: 50%;
        text-align: center;
        line-height: 46rpx;
        font-size: 32rpx;
        margin-right: 6rpx;
      }

      .page_item_top {
        height: 86rpx;
        border-bottom: 2rpx dashed #666;
        padding: 0 16rpx;

        .page_item_top_L {
          height: 100%;
          float: left;
          line-height: 88rpx;

          .emergencys {
            background: #ff3b53 !important;
            width: 124rpx !important;
          }

          .emergency {
            background: #ff3b53 !important;
          }

          .emergency1 {
            background: #49b856 !important;
          }

          .page_item_cont_start {
            text-align: center;
            height: 44rpx;
            width: 104rpx;
            line-height: 44rpx;
            border-radius: 8rpx;
            background: #49b856;
            color: #fff;
            display: inline-block;
            font-size: 28rpx;

            .cubeic-star {
              margin-right: 8rpx;
            }
          }

          .L_time {
            color: #6cc076;
            font-size: 32rpx;
          }

          .L_text {
            font-size: 32rpx;
            display: inline-block;
            font-weight: 700;
            margin-right: 16rpx;
          }
        }

        .page_item_top_R {
          height: 60rpx;
          float: right;
          padding-top: 20rpx;
          font-size: 32rpx;
          position: absolute;
          right: 50rpx;

          .L_iocn {
            display: inline-block;
            height: 52rpx;
            line-height: 48rpx;
            color: rgb(7, 134, 60);
            font-size: 36rpx;
            font-weight: 700;
          }
        }
      }

      .page_item_cont {
        min-height: 180rpx;
        // max-height: 424rpx;
        padding: 0 16rpx;
        text-align: left;
        position: relative;

        .text_big {
          font-size: 32rpx;
          position: absolute;
          right: 16rpx;
          font-weight: 700;
          margin-top: 10rpx;
        }

        .text_big2 {
          font-size: 32rpx;
          position: absolute;
          right: 16rpx;
          font-weight: 700;
        }

        .line {
          height: 20rpx;
          width: 2rpx;
          border-left: 2rpx solid #666;
          position: absolute;
          top: 82rpx;
          left: 40rpx;
        }

        .lines {
          height: 40%;
          width: 2rpx;
          border-left: 2rpx solid #666;
          position: absolute;
          top: 23%;
          left: 36rpx;
        }

        .page_item_cont_T {
          padding-top: 28rpx;
          font-size: 28rpx;

          .page_item_cont_title {
            height: 100%;
            font-size: 32rpx;
          }
        }

        .page_item_cont_B {
          padding-top: 28rpx;
          margin-bottom: 28rpx;

          .page_item_cont_title {
            height: 60rpx;
            font-size: 32rpx;
          }

          .page_item_cont_title1 {
            height: 60rpx;
            line-height: 60rpx;
            font-size: 32rpx;
            padding-left: 64rpx;
          }
        }
      }

      .page_item_foot {
        border-top: 2rpx dashed #666;
        border-bottom: 2rpx dashed #666;
        padding: 28rpx 16rpx;
        text-align: left;

        .page_item_foot_text {
          font-size: 32rpx;
          margin-bottom: 20rpx;

          .text1 {
            color: rgb(102, 102, 102);
          }

          .text2 {
            float: right;
            font-weight: 700;
          }
        }
      }

      .page_item_info {
        padding: 20rpx 16rpx;
        text-align: left;
        line-height: 60rpx;
        font-size: 32rpx;

        .spe_list {
          padding: 32rpx 0;
          border-top: 2rpx solid #666;

          .page_item_info_title {
            color: #666;
          }
        }

        .page_item_info_title {
          font-weight: 700;
        }

        .text {
          float: right;
          font-weight: 700;

          .page_item_info_txt {
            color: #49b856;
            margin-left: 8rpx;
            margin-right: 8rpx;
          }
        }
      }

      #infos {
        height: 0;
        overflow: hidden;
      }

      .page_item_infos {
        padding-top: 20rpx;
        padding-bottom: 20rpx;
        border-bottom: 2rpx dashed #666;

        .page_item_info2 {
          text-align: left;
          line-height: 60rpx;
          font-size: 32rpx;
          padding-left: 16rpx;

          .page_item_foot_text {
            font-size: 32rpx;
            margin-bottom: 20rpx;

            &:last-of-type {
              margin-bottom: 0;
            }

            .text1 {
              color: rgb(102, 102, 102);
            }

            .text2 {
              float: right;
              font-weight: 700;
            }

            .btn {
              height: 66rpx;
              width: 132rpx;
              margin: 0 auto;
              background-color: #49b856;
              color: #fff;
              border-radius: 8rpx;
              font-size: 32rpx;
              margin-top: 20rpx;
              text-align: center;
            }
          }
        }
      }

      #pulldown {
        color: #49b856;
        font-size: 36rpx;
        height: 60rpx;
        text-align: center;

        .cubeic-pulldown {
          font-size: 48rpx;
          position: relative;
          bottom: 6rpx;
        }
      }

      #pullup {
        color: #49b856;
        font-size: 36rpx;
        height: 60rpx;
        text-align: center;

        .cubeic-pullup {
          font-size: 48rpx;
          position: relative;
          top: 12rpx;
        }
      }
    }

    .foot_btn2 {
      position: fixed;
      bottom: 0;
      right: 20rpx;
      left: 20rpx;
      line-height: 66rpx;
      height: 100rpx;
      border-top: 2rpx solid #e5e9ed;
      background: #f9fafb;
      display: flex;
      justify-content: space-between;

      .btn2,
      .btn3 {
        height: 66rpx;
        flex: 1;
        margin: 0 1%;
        background-image: linear-gradient(to right, #72c172, #3bb197);
        color: #fff;
        border-radius: 8rpx;
        font-size: 28rpx;
        margin-top: 16rpx;
        text-align: center;
      }
    }
  }
</style>