jxmanxk
2024-01-23 5311b8ec19221a560aeca28262f14433b7781801
src/pages/room/detail.vue
@@ -1,12 +1,17 @@
<!--room-detail.vue-->
<template>
  <div class="page">
  <div class="page flex flex-col">
    <div class="page_header flex flex-ver">
      <div class="left flex flex-ver" @click="back">
        <img class="page_logo_1" src="../../assets/img/logo_1.png">
        <img class="page_logo_2" src="../../assets/img/logo_2.png">
        <div class="page_logo_1">
          <img class="img" src="static/imgs/logo_1.png">
        </div>
        <div class="page_logo_2">
          <img class="img" src="static/imgs/logo_2.png">
        </div>
      </div>
      <div class="right flex-1 flex flex-jcfe flex-ver">
        <el-button type="primary" icon="el-icon-refresh" class="reset_btn flex flex-center" size="small" style="width: 100px;" @click="resetPage">刷新</el-button>
        <div class="reset_btn flex flex-center" @click="resetStatus">重置房间状态</div>
        <div class="page_date">
          <div class="page_week">{{ timeObj.week }}</div>
@@ -16,8 +21,9 @@
        <!-- <div class="page_time">{{ timeObj.time }}</div> -->
      </div>
    </div>
    <div class="page_header_placeholer" />
    <!-- 未有安排 -->
    <div v-if="!occupyInfoView && (!assignTreatList || !assignTreatList.length)" class="page_container flex flex-ver">
    <div v-if="(!occupyInfoViewArr || !occupyInfoViewArr.length) && (!assignTreatListView || !assignTreatListView.length)" class="page_container flex flex-1">
      <div class="main flex-1">
        <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
        <div v-if="roomInfo" class="room_main_tip" style="margin-top: 93px;line-height: 186px;font-size: 140px;">-{{ statusTx[roomInfo.status] }}-</div>
@@ -25,25 +31,33 @@
          <div class="flex flex-ver">
            <div class="btn_box__item flex flex-center white" data-tx="空闲" data-status="0" @click="statusChg">
              <div class="flex flex-ver">
                <img class="icon" src="../../assets/img/free.png">
                <div class="icon">
                  <img class="img" src="static/imgs/free.png">
                </div>
                <div class="tx">空闲</div>
              </div>
            </div>
            <div class="btn_box__item flex flex-center blue" data-tx="使用中" data-status="1" @click="statusChg">
              <div class="flex flex-ver">
                <img class="icon" src="../../assets/img/using.png">
                <div class="icon">
                  <img class="img" src="static/imgs/using.png">
                </div>
                <div class="tx white">使用中</div>
              </div>
            </div>
            <div class="btn_box__item flex flex-center yellow" data-tx="客人休息" data-status="2" @click="statusChg">
              <div class="flex flex-ver">
                <img class="icon" src="../../assets/img/rest.png">
                <div class="icon">
                  <img class="img" src="static/imgs/rest.png">
                </div>
                <div class="tx">客人休息</div>
              </div>
            </div>
            <div class="btn_box__item flex flex-center gray" data-tx="通知打扫" data-status="3" @click="statusChg">
              <div class="flex flex-ver">
                <img class="icon" src="../../assets/img/clear.png">
                <div class="icon">
                  <img class="img" src="static/imgs/clear.png">
                </div>
                <div class="tx">通知打扫</div>
              </div>
            </div>
@@ -52,125 +66,39 @@
      </div>
    </div>
    <!-- 没有客人和有安排 -->
    <div v-if="!occupyInfoView && (assignTreatList && assignTreatList.length)" class="page_container flex flex-ver">
    <div v-if="(!occupyInfoViewArr || !occupyInfoViewArr.length) && (assignTreatListView && assignTreatListView.length)" class="page_container flex flex-1">
      <div class="main flex-1">
        <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
        <div v-if="roomInfo" class="room_main_tip">-{{ statusTx[roomInfo.status] }}-</div>
        <div v-if="roomInfo && roomInfo.status >= 1" class="room_left_btn_box flex flex-ver">
          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center yellow" @click="setStatus('客人休息', 2)">客人休息</div>
          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center gray" @click="setStatus('打扫中', 3)">通知打扫</div>
          <div v-if="roomInfo.status == 2" class="room_left_btn_box__item flex flex-center green" @click="setStatus('打扫中', 3)">通知打扫</div>
          <div v-if="roomInfo.status == 3" class="room_left_btn_box__item flex flex-center green" @click="setStatus('空闲', 0)">结束打扫</div>
        <div v-show="roomInfo && roomInfo.status >= 1" class="room_left_btn_box flex flex-ver">
          <div v-show="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center yellow btn_ani" @click="setStatus('客人休息', 2)">客人休息</div>
          <div v-show="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center gray btn_ani" @click="setStatus('打扫中', 3)">通知打扫</div>
          <div v-show="roomInfo.status == 2" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('打扫中', 3)">通知打扫</div>
          <div v-show="roomInfo.status == 3" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('空闲', 0)">结束打扫</div>
        </div>
      </div>
      <div class="right">
        <div class="right_block flex flex-col">
          <div class="guest_title flex flex-center">等待诊疗</div>
          <div class="guest_block flex-1">
            <div class="guest_list">
              <div v-for="(item, index) in assignTreatList" :key="index" class="guest_list__row flex flex-ver" @click="selectCustomer(item)">
                <div class="guest_list__td">
                  <div class="tx flex flex-ver">
                    <div class="flex-1 flex-1-w1 ell">{{ item.userName }}</div>
                  </div>
                  <div class="tx" style="font-size: 14px;line-height: 20px;">{{ item.ciq || '' }}</div>
                </div>
                <div class="guest_list__td flex flex-center">
                  <span class="tx">{{ item.startTime?item.startTime+'开始':'' }}</span>
                </div>
                <div class="guest_list__td flex flex-center">
                  <span class="tx flex-1 flex-1-w1 ell">{{ item.aDoctorName?item.aDoctorName+'(医生)、':'' }}{{ item.aNurseName?item.aNurseName+'(护士)':'' }}</span>
                </div>
                <div class="guest_list__td flex flex-center">
                  <img class="icon" src="../../assets/img/choose.png">
                </div>
              </div>
            </div>
          </div>
        <div class="right_block">
          <XioRoomGuestBox ref="XioRoomGuestBox" :assign-treat-list-view-com="assignTreatListView" @selectCustomer="selectCustomer" />
        </div>
      </div>
    </div>
    <!-- 客人和有安排 -->
    <div v-if="occupyInfoView && (assignTreatList && assignTreatList.length)" class="page_container flex flex-ver">
      <div class="main flex-1">
        <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
        <div class="room_content">
          <div class="tip">诊疗安排</div>
          <!-- <div class="name">{{ occupyInfoView.userName }}</div> -->
          <div class="name">
            <el-popover
              placement="top"
              width="400"
              popper-class="top_tx"
              trigger="click"
              :popper-options="{ removeOnDestroy: true }"
            >
              <div>{{ occupyInfoView.userName }}</div>
              <div slot="reference" class="tx ell">{{ occupyInfoView.userName }}</div>
            </el-popover>
    <!-- 客人和有安排 over-width -->
    <div v-if="occupyInfoViewArr && occupyInfoViewArr.length" class="page_container flex flex-1" :class="[occupyInfoViewArr && occupyInfoViewArr.length>1?'over-width':'']">
      <div class="flex flex-1">
        <div v-for="(item,index) in occupyInfoViewArr" :key="index" class="main flex-1">
          <div v-if="occupyInfoViewArr.length>1 && item.treatRoomStatus === 0" class="cancel_icon_block" @click="cancelCustomerItem(item)">
            <img class="img" src="static/imgs/cancel.png">
          </div>
          <div v-if="occupyInfoView.ciq" class="ciq">({{ occupyInfoView.ciq }})</div>
          <div v-if="occupyInfoView.startTime" class="time">安排治疗时间:{{ occupyInfoView.startTime }} 开始</div>
        </div>
        <div v-if="roomInfo" class="room_left_btn_box flex flex-ver" style="margin-top: 105px;">
          <div v-if="roomInfo.status == 0" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('使用中', 1)">开始治疗</div>
          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center yellow" @click="setStatus('客人休息', 2)">客人休息</div>
          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center gray" @click="setStatus('打扫中', 3)">通知打扫</div>
          <div v-if="roomInfo.status == 2" class="room_left_btn_box__item flex flex-center green" @click="setStatus('打扫中', 3)">通知打扫</div>
          <div v-if="roomInfo.status == 3" class="room_left_btn_box__item flex flex-center green" @click="setStatus('空闲', 0)">结束打扫</div>
          <XioRoomGuestInfoBox :ref="`XioRoomGuestInfoBox_${item.id}`" :room-info="roomInfo" :occupy-info-view="item" :off-narcosis-ids="offNarcosisIds" @setStatus="setComStatus" />
        </div>
      </div>
      <div class="right flex flex-col">
        <div class="room_info flex-1">
          <div class="staff_box flex flex-ver flex-sb">
            <div class="staff_box_item flex-1 flex flex-center">
              <div>
                <div class="staff_box_item__title">分诊顾问</div>
                <div class="staff_box_item__name">{{ occupyInfoView.adviserName || '' }}</div>
              </div>
            </div>
            <div class="staff_box_item flex-1 flex flex-center">
              <div>
                <div class="staff_box_item__title">执行医生</div>
                <div class="staff_box_item__name">{{ occupyInfoView.aDoctorName || '' }}</div>
              </div>
            </div>
            <div class="staff_box_item flex-1 flex flex-center">
              <div>
                <div class="staff_box_item__title">执行护士</div>
                <div class="staff_box_item__name">{{ occupyInfoView.aNurseName || '' }}</div>
              </div>
            </div>
          </div>
          <div class="room_info_project">
            <div class="room_info_project_block">
              <div class="tx">{{ occupyInfoView.projectName || '' }}</div>
            </div>
          </div>
        <div v-for="(item,index) in occupyInfoViewArr" :key="index" class="flex-1 right_room_info">
          <XioRoomInfoBlock ref="XioRoomInfoBlock" :occupy-info-view="item" :occupy-info-view-arr="occupyInfoViewArr" />
        </div>
        <div class="guest_box flex flex-col">
          <div class="guest_title flex flex-center">等待诊疗</div>
          <div class="guest_block flex-1">
            <div class="guest_list">
              <div v-for="(item, index) in assignTreatList" :key="index" class="guest_list__row flex flex-ver" @click="selectCustomer(item)">
                <div class="guest_list__td">
                  <div class="tx flex flex-ver">
                    <div class="flex-1 flex-1-w1 ell">{{ item.userName }}</div>
                  </div>
                  <div class="tx" style="font-size: 14px;line-height: 20px;">{{ item.ciq || '' }}</div>
                </div>
                <div class="guest_list__td flex flex-center">
                  <span class="tx">{{ item.startTime?item.startTime+'开始':'' }}</span>
                </div>
                <div class="guest_list__td flex flex-center">
                  <span class="tx flex-1 flex-1-w1 ell">{{ item.aDoctorName?item.aDoctorName+'(医生)、':'' }}{{ item.aNurseName?item.aNurseName+'(护士)':'' }}</span>
                </div>
                <div class="guest_list__td flex flex-center">
                  <img class="icon" src="../../assets/img/choose.png">
                </div>
              </div>
            </div>
          </div>
        <div v-if="occupyInfoViewArr.length<=1" class="flex flex-col" style="border-radius: 10px;">
          <XioRoomGuestBox ref="XioRoomGuestBox" :assign-treat-list-view-com="assignTreatListView" @selectCustomer="selectCustomer" />
        </div>
      </div>
    </div>
@@ -178,6 +106,8 @@
    <XioCustomerSelect ref="XioCustomerSelect" @cancel="selectCustomerCancel" @submit="selectCustomerSubmit" />
    <!-- 更改房间状态窗 -->
    <XioRoomStatusChg ref="XioRoomStatusChg" @changeStatus="changeStatus" />
    <!-- MIC通知卸麻 -->
    <!-- <XioRoomOffNarcosisNotice ref="XioRoomOffNarcosisNotice" @confirm="offNarcosisNoticeConfirm" /> -->
  </div>
</template>
@@ -187,17 +117,31 @@
// 客人休息 2
// 待打扫/通知打扫 3
// import Login from '../utils/jun_login.js'
// 房间客人信息
import XioRoomGuestInfoBox from '@/components/xio_room_guest_info_box'
// 房间负责员工信息
import XioRoomInfoBlock from '@/components/xio_room_info_block'
// 房间客户预约列表信息
import XioRoomGuestBox from '@/components/xio_room_guest_box'
// 选择客人弹窗
import XioCustomerSelect from '@/components/xio_customer_select'
// 更改房间状态窗
import XioRoomStatusChg from '@/components/xio_room_status_chg'
// 通知卸麻
// import XioRoomOffNarcosisNotice from '@/components/xio_room_off_narcosis_notice'
import Req from '../../utils/jun_httpInstall' // http 请求
// import xioFn from './utils/xio_fn.js'
var isUseDefault = false // 是否已使用默认客人
var isUseDefaultChg = 0// 已使用默认客人后房间是否有改变状态
export default {
  name: 'RoomDetail',
  components: {
    XioRoomGuestInfoBox,
    XioRoomInfoBlock,
    XioRoomGuestBox,
    XioCustomerSelect,
    XioRoomStatusChg
    // XioRoomOffNarcosisNotice
  },
  inject: ['noop'],
  data() {
@@ -206,42 +150,217 @@
      roomInfo: {},
      occupyInfo: '', // 当前占用人的信息
      assignTreatList: [],
      statusTx: ['空闲', '使用中', '客人休息', '打扫中'],
      timeObj: {} // week:星期,date:年月日,timeMin:时分,time:时分秒,timeStamp:时间戳
      statusTx: ['空闲', '使用中', '客人休息', '打扫中', '敷麻中'],
      timeObj: {}, // week:星期,date:年月日,timeMin:时分,time:时分秒,timeStamp:时间戳
      curTreatId: '',
      curTreatIds: '', // 已选中的治疗记录id数组
      offNarcosisIds: [] // 是否已通知卸麻的用户id数组
      // isShowAppellationName: true // 是否显示称谓
    }
  },
  computed: {
    occupyInfoView() {
      // 有占用
      if (this.occupyInfo) {
        return this.occupyInfo
      // 没有占用
    // 当前已选择用户的数组数据
    occupyInfoViewArr() {
      if (this.occupyInfo && this.occupyInfo.length) {
        return this.occupyInfoViewArrIdsHandleArr()
      } else {
        // 还没使用默认客人值
        if (!isUseDefault && this.assignTreatList && this.assignTreatList.length) {
          isUseDefault = true
          return this.assignTreatList[0]
        // 已使用过默认客人值
        if (this.curTreatIds && this.curTreatIds.length) {
          return this.getCurTreatArr(this.curTreatIds)
        } else {
          return ''
          if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
            isUseDefault = true
            this.occupyInfoViewArrIdsHandle(this.assignTreatList[0])
            return [this.assignTreatList[0]]
          } else {
            return ''
          }
        }
      }
    },
    // 当前已选择用户的数据(单个)(暂无用)
    occupyInfoView() {
      // console.log('00000000000000000000000', this.occupyInfo, isUseDefault, isUseDefaultChg)
      // 有当前选中的,根据需求修改增加选中不更改状态,由空闲开始
      if (this.curTreatId) {
        return this.gatCurTreatInfo()
      } else {
        // 有占用
        if (this.occupyInfo) {
          return this.occupyInfo
        // 没有占用
        } else {
          // 还没使用默认客人值或者已使用默认客人值还没改变状态(适配轮询)
          if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
            // isUseDefault = true
            return this.assignTreatList[0]
          // 已使用过默认客人值
          } else {
            return ''
          }
        }
      }
    },
    // 该治疗室用户列表
    assignTreatListView() {
      if (this.assignTreatList && this.assignTreatList.length) {
        this.assignTreatList.forEach((o) => {
          if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
            this.occupyInfoViewArr.forEach((_o) => {
              if (_o.id === o.id) {
                o.act = true
              }
            })
          }
        })
        return this.assignTreatList
      } else {
        return []
      }
    }
  },
  mounted() {
  activated() {
    console.log('roomDetail mounted')
    // 记录当前的治疗ID
    // var curTreatId = localStorage.getItem('curTreatId')
    // 记录当前的治疗记录ID数组
    var curTreatIds = localStorage.getItem('curTreatIds')
    // 卸麻相关
    var localOffNarcosisIds = localStorage.getItem('offNarcosisIds')
    // 获取是否已通知卸麻数组
    if (localOffNarcosisIds) {
      this.offNarcosisIds = JSON.parse(localOffNarcosisIds)
    } else {
      this.offNarcosisIds = []
      this.setLocalStorageOffNarcosisIds()
    }
    // 治疗记录ID数组
    if (curTreatIds) {
      try {
        this.curTreatIds = JSON.parse(curTreatIds)
      } catch (error) {
        this.curTreatIds = ''
      }
    }
    // this.curTreatId = curTreatId || ''
    // 治疗室id
    this.id = this.$route.query.id || ''
    this.init()
  },
  mounted() {},
  destroyed() {
  },
  methods: {
    init() {
      // 进入页面先初始化常量标识
      isUseDefault = false
      isUseDefaultChg = 0
      // 计时
      this.countGetTime(this, 'timeObj', 'detail')
      // 轮询getData,8秒一次
      // this.pollingAjaxFn(this, 'getData', 'detail', 8000)
      this.getData()
      this.pollingAjaxFn(this, 'getData', 'detail', 8000)
      // this.getData()
    },
    // 初始默认选择的id数组处理
    occupyInfoViewArrIdsHandle(item) {
      if (!this.curTreatIds) {
        this.curTreatIds = []
      }
      this.curTreatIds.push(item.id)
      this.setLocalCurTreatIds()
    },
    // 初始默认选择的id数组处理
    occupyInfoViewArrIdsHandleArr() {
      if (!this.curTreatIds) {
        this.curTreatIds = []
      }
      if (this.occupyInfo && this.occupyInfo.length === 1) {
        var res = []
        res.push(this.occupyInfo[0])
        if (this.curTreatIds && this.curTreatIds.length) {
          this.curTreatIds = this.curTreatIds.filter((o) => { return o !== this.occupyInfo[0].id })
          if (this.assignTreatList && this.assignTreatList.length && this.curTreatIds && this.curTreatIds.length) {
            var curTreatItem = this.assignTreatList.find((o) => { return o.id === this.curTreatIds[0] })
            if (curTreatItem) {
              res.push(curTreatItem)
            }
          }
        }
        this.setLocalCurTreatIds()
        return res
      } else if (this.occupyInfo && this.occupyInfo.length > 1) {
        this.occupyInfo.forEach((o) => {
          this.curTreatIds.push(o.id)
        })
        return this.occupyInfo
      }
    },
    // 设置已通知卸麻id数组
    setLocalStorageOffNarcosisIds() {
      localStorage.setItem('offNarcosisIds', JSON.stringify(this.offNarcosisIds))
    },
    // 卸麻通知确认
    // offNarcosisNoticeConfirm() {
    //   if (this.occupyInfoView) {
    //     if (offNarcosisIds && offNarcosisIds.length) {
    //       var flag = offNarcosisIds.find((o) => { return o === this.occupyInfoView.userId })
    //       if (!flag) {
    //         offNarcosisIds.push(this.occupyInfoView.userId)
    //       }
    //     } else if (offNarcosisIds) {
    //       offNarcosisIds.push(this.occupyInfoView.userId)
    //     }
    //     this.setLocalStorageOffNarcosisIds()
    //   }
    // },
    // // 显示通知卸麻弹窗
    // showOffNarcosisNotice() {
    //   // 打开弹窗
    //   this.$refs['XioRoomOffNarcosisNotice'].showDialog()
    // },
    // 显示通知卸麻弹窗(多个)
    showOffNarcosisNoticeMulti(id) {
      // 打开弹窗,动态的ref对象获取
      // eslint-disable-next-line no-eval
      var ref = eval('this.$refs.XioRoomGuestInfoBox_' + id)[0]
      ref.showOffNarcosisNotice()
    },
    // 点击显示隐藏称谓
    // tapAppellationHandle() {
    //   this.isShowAppellationName = !this.isShowAppellationName
    // },
    // 获取当前治疗信息(数组)
    getCurTreatArr(ids) {
      var arr = []
      if (this.assignTreatList && this.assignTreatList.length) {
        this.assignTreatList.forEach((o) => {
          if (ids && ids.length) {
            ids.forEach((_o) => {
              if (_o === o.id) {
                arr.push(o)
              }
            })
          }
        })
        // 基本不会出现这种情况,但是以防万一,若本地缓存id存在,但对不上列表则缓存第一条数据id
        if (!arr.length) {
          arr.push(this.assignTreatList[0])
          this.curTreatIds = []
          this.curTreatIds.push(this.assignTreatList[0].id)
          this.setLocalCurTreatIds()
        }
      }
      return arr
    },
    // 获取当前治疗信息
    gatCurTreatInfo() {
      if (this.assignTreatList && this.assignTreatList.length) {
        return this.assignTreatList.find((o) => { return o.id === this.curTreatId })
      }
    },
    // 刷新浏览器页面
    resetPage() {
      window.location.reload()
    },
    // 获取房间详情
    getData() {
@@ -251,63 +370,158 @@
        params.shopRoomId = this.id
      }
      Req.http.post({
        url: 'treat/screen/room/info',
        url: 'guide/treat/screen/room/info',
        data: params,
        udData: { noLoading: true },
        header: { 'Content-Type': 'application/json' },
        mockData: {
          code: 100,
          msg: '',
          data: {}
          data: {
            roomInfo: {
              roomNo: 'xx',
              status: 0 // 0空闲 1使用 2休息 3打扫 4 敷麻中
            },
            assignTreatList: [
              {
                id: 'a111',
                startTime: '2023-12-08 00:00:00',
                userName: '黄嘉荣',
                gender: 1,
                hempStatus: 2,
                treatRoomStatus: 0,
                ciq: '123',
                adviserName: 'a君',
                aDoctorName: 'b君',
                aNurseName: 'c君',
                projectName: 'xxxxXXxxx',
                userId: '111'
              },
              {
                id: 'a222',
                startTime: '2023-12-08 00:15:00',
                userName: '李德华',
                gender: 1,
                hempStatus: 2,
                treatRoomStatus: 0,
                ciq: '456',
                adviserName: 'd君',
                aDoctorName: 'e君',
                aNurseName: 'f君',
                projectName: 'xxxxXXxxx',
                userId: '222'
              },
              {
                id: 'a333',
                startTime: '2023-12-08 00:20:00',
                userName: '猛学友',
                gender: 2,
                hempStatus: 2,
                treatRoomStatus: 0,
                ciq: '789',
                adviserName: 'g君',
                aDoctorName: 'h君',
                aNurseName: 'i君',
                projectName: 'xxxxXXxxx',
                userId: '333'
              }
            ],
            occupyInfo: null
          }
        }
      }).then((res) => {
        if (res && res.data) {
          // 治疗时间处理
          if (res.data.assignTreatList && res.data.assignTreatList.length) {
            res.data.assignTreatList.forEach((o) => {
              // 治疗时间处理
              var st = (o.startTime).split(' ')[1].split(':')
              o.startTime = `${st[0]}:${st[1]}`
              // 称谓处理
              o.appellationName = o.userName[0] + `${o.gender ? ['女士', '先生', '女士'][o.gender] : '女士'}`
            })
          }
          // 占用信息治疗时间处理
          if (res.data.occupyInfo && res.data.occupyInfo.startTime) {
            var ost = (res.data.occupyInfo.startTime).split(' ')[1].split(':')
            res.data.occupyInfo.startTime = `${ost[0]}:${ost[1]}`
          if (res.data.occupyInfo && res.data.occupyInfo.length) {
            res.data.occupyInfo.forEach((o) => {
              // 治疗时间处理
              var st = (o.startTime).split(' ')[1].split(':')
              o.startTime = `${st[0]}:${st[1]}`
              // 称谓处理
              o.appellationName = o.userName[0] + `${o.gender ? ['女士', '先生', '女士'][o.gender] : '女士'}`
            })
          }
          res.data.occupyInfo && res.data.occupyInfo.length && (isUseDefaultChg = 1)
          res.data.occupyInfo && res.data.occupyInfo.length && (isUseDefault = 1)
          for (const key in res.data) {
            this[key] = res.data[key]
          }
        }
        // console.log('999999999999999999999999999', res)
        // 卸麻弹窗逻辑
        var offNarcosisTimer = null
        offNarcosisTimer = setTimeout(() => {
          console.log('================================>判断卸麻弹窗', this.occupyInfoViewArr, 'offNarcosisIds:', this.offNarcosisIds)
          if (this.occupyInfoViewArr && this.occupyInfoViewArr.length && this.offNarcosisIds) {
            this.occupyInfoViewArr.forEach((o) => {
              // 判断改用户是否弹出过卸麻弹窗
              var flag
              flag = this.offNarcosisIds.find((_o) => { return _o === o.userId })
              // 状态2且没有弹出过弹窗
              if (o.hempStatus === 2 && !flag) {
                // 弹出对应id弹窗
                this.showOffNarcosisNoticeMulti(o.id)
              }
            })
          }
          clearTimeout(offNarcosisTimer)
          offNarcosisTimer = null
        }, 500)
      })
    },
    // 返回
    back() {
      // 重置默认已使用客人的参数
      isUseDefault = false
      isUseDefaultChg = 0
      // 关闭计时
      this.stopCountGetTime('detail')
      // 关闭轮询
      this.stopPollingAjaxFn('detail')
      // 返回
      this.$router.go(-1)
      // console.log('111111111', this.$route.meta.isPush)
      if (this.$route && this.$route.meta && this.$route.meta.isPush) {
        this.$router.go(-1)
      } else {
        this.$router.push({
          path: `/`
        })
      }
    },
    // 未有安排直接状态变更
    statusChg(e) {
      var { tx, status } = e.currentTarget.dataset
      var { occupyInfoView, roomInfo } = this
      console.log(tx, status)
      // var { occupyInfoView, roomInfo } = this
      console.log('==========================>没有安排时没有客人直接变更状态', tx, status)
      // if (roomInfo && status * 1 == roomInfo.status) {
      //   return
      // }
      this.changeStatusFn(occupyInfoView, status, () => {
      this.changeStatusFn({}, status, () => {
        this.getData()
      })
    },
    // 按流程设置房间状态
    // 没有客人的按流程设置房间状态
    setStatus(tx, status) {
      var { occupyInfoView, roomInfo } = this
      console.log(tx, status)
      this.changeStatusFn(occupyInfoView, status, () => {
      // var { occupyInfoView, roomInfo } = this
      console.log('============================>有安排没有客人设置房间状态', tx, status)
      this.changeStatusFn({}, status, () => {
        // 刷新详情
        this.getData()
      })
    },
    // 按流程设置房间状态(组件)
    setComStatus(opt) {
      // var { occupyInfoView, roomInfo } = this
      console.log('============================>客人信息组件点击更改状态', opt.tx, opt.status, opt.item)
      this.changeStatusFn(opt.item, opt.status, () => {
        // 刷新详情
        this.getData()
      })
@@ -315,18 +529,64 @@
    // 改变房间状态异步方法
    changeStatusFn(item = {}, status, cb) {
      var params = {}
      // 更改的状态
      params.status = status * 1
      // 房间id
      if (this.id) {
        params.shopRoomId = this.id
      }
      // 治疗记录id
      // 治疗记录id this.curTreatIds occupyInfoViewArr
      // 1.使用中/敷麻中 敷麻中 2 人占用
      // 2.使用中/使用中 使用中 2 人占用
      // 3.使用中/休息中  使用中 1 人占用
      var arr = JSON.parse(JSON.stringify(this.occupyInfoViewArr))
      if (item && item.id) {
        params.treatRecordId = item.id
        if (arr && arr.length) {
          arr.forEach((o) => {
            if (o.id === item.id) {
              o.treatRoomStatus = status * 1
            }
          })
          // 是否有人使用中
          var status_1 = arr.find((o) => { return o.treatRoomStatus === 1 })
          // 是否有客人休息
          var status_2 = arr.find((o) => { return o.treatRoomStatus === 2 })
          // 是否有人打扫中
          var status_3 = arr.find((o) => { return o.treatRoomStatus === 3 })
          // 是否有人敷麻
          var status_4 = arr.find((o) => { return o.treatRoomStatus === 4 })
          // 更改的状态 敷麻中 > 使用中 > 休息中 > 待打扫
          params.status = status * 1
          if (status_3) {
            params.status = 3
          }
          if (status_2) {
            params.status = 2
          }
          if (status_1) {
            params.status = 1
          }
          if (status_4) {
            params.status = 4
          }
        }
        // 当前选择客户的数组删除客户
        this.occupyInfoViewArrDataHandle('cancel', item)
        params.treatRoomList = []
        if (arr && arr.length) {
          arr.forEach((o) => {
            params.treatRoomList.push({
              treatRecordId: o.id,
              status: o.treatRoomStatus
            })
          })
        }
      } else {
        // 更改的状态
        params.status = status * 1
      }
      Req.http.post({
        url: 'treat/screen/room/status/update',
        url: 'guide/treat/screen/room/status/update',
        data: params,
        header: { 'Content-Type': 'application/json' },
        mockData: {
@@ -335,6 +595,19 @@
          data: {}
        }
      }).then((res) => {
        // 在已有默认客人的情况下,改变状态更改标识(适配轮询)
        if (isUseDefault) {
          console.log('在已有默认客人的情况下,改变状态更改标识')
          isUseDefaultChg = 1
        }
        // 只要更改为空闲就重置参数
        if (params.status === 0) {
          console.log('房间更改为空闲')
          // 重置默认已使用客人的参数
          isUseDefault = false
          isUseDefaultChg = 0
          // this.isShowAppellationName = true
        }
        // console.log('8888888888888888888888888888888888', res)
        cb && cb()
      })
@@ -346,12 +619,19 @@
    },
    // 更改房间状态(重置状态的更改方法)
    changeStatus(opt) {
      var { occupyInfoView, roomInfo } = this
      console.log(opt.statusTx, opt.status)
      // var { occupyInfoView, roomInfo } = this
      console.log('============================>重置房间状态', opt.statusTx, opt.status)
      // if (roomInfo && opt.status * 1 == roomInfo.status) {
      //   return
      // }
      this.changeStatusFn(occupyInfoView, opt.status, () => {
      // 清除选中医疗记录id
      // localStorage.removeItem('curTreatId')
      // this.curTreatId = ''
      // 清除选中医疗记录ids数组
      localStorage.removeItem('curTreatIds')
      this.curTreatIds = ''
      // 变更房间状态方法
      this.changeStatusFn({}, opt.status, () => {
        // 刷新详情
        this.getData()
        // 关闭弹窗
@@ -360,6 +640,9 @@
    },
    // 选择客户
    selectCustomer(item = {}) {
      if (item.act) {
        return
      }
      // 打开弹窗
      this.$refs['XioCustomerSelect'].showDialog()
      // 组件客户数据处理
@@ -372,13 +655,77 @@
    },
    // 选择客户确定
    selectCustomerSubmit(opt) {
      console.log('submit', opt)
      this.changeStatusFn(opt, 1, () => {
        // 刷新详情
        this.getData()
        // 关闭弹窗
        this.$refs['XioCustomerSelect'].hideDialog()
      })
      console.log('=======================>submit', opt)
      // 确定选择的用户,记录id
      // localStorage.setItem('curTreatId', opt.id)
      // this.curTreatId = opt.id
      // 当前选择客户的数组增加客户
      this.occupyInfoViewArrDataHandle('add', opt)
      // 重置房间状态
      // if (this.roomInfo) {
      //   this.changeStatusFn({}, 0, () => {
      //     // 刷新详情
      //     this.getData()
      //   })
      // }
      // 关闭弹窗
      this.$refs['XioCustomerSelect'].hideDialog()
    },
    // 删除已选择的客户数据
    cancelCustomerItem(item) {
      // 当前选择客户的数组删除客户
      this.occupyInfoViewArrDataHandle('cancel', item, true)
    },
    // 当前选择客户的数组增删处理方法
    occupyInfoViewArrDataHandle(key, item, isReset) {
      // 增加(选择)
      if (key === 'add') {
        // id数组处理
        if (this.curTreatIds && this.curTreatIds.length) {
          // 当前治疗记录id没有所选用户的治疗记录id
          var flag = this.curTreatIds.find((o) => { return o === item.id })
          if (!flag) {
            this.curTreatIds.push(item.id)
          }
          // 缓存
          this.setLocalCurTreatIds()
        }
        if (this.curTreatIds && !this.curTreatIds.length) {
          this.curTreatIds.push(item.id)
          // 缓存
          this.setLocalCurTreatIds()
        }
        // 数组数据处理
        // if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
        //   this.occupyInfoViewArr.push(item)
        // }
      }
      // 删除
      if (key === 'cancel') {
        // id数组处理
        if (this.curTreatIds && this.curTreatIds.length) {
          // 深复制
          var ids = JSON.parse(JSON.stringify(this.curTreatIds))
          this.curTreatIds = ids.filter((o) => { return o !== item.id })
          // 缓存
          this.setLocalCurTreatIds()
          // 刷新
          if (isReset) {
            // 刷新详情
            this.getData()
          }
        }
        // 数组数据处理
        // if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
        //   // 深复制
        //   var arr = JSON.parse(JSON.stringify(this.occupyInfoViewArr))
        //   this.occupyInfoViewArr = arr.filter((o) => { o.id !== item.id })
        // }
      }
    },
    // 设置本地缓存ids数组
    setLocalCurTreatIds() {
      localStorage.setItem('curTreatIds', JSON.stringify(this.curTreatIds))
    }
  }
}
@@ -392,6 +739,19 @@
</style>
<style scoped>
.page{
  overflow: auto;
}
.page_header_placeholer {
  height: 100px;
}
.page_header {
  position: fixed;
  top: 0;
  left: 23px;
  right: 23px;
  z-index: 1;
}
.page_header .reset_btn {
  width: 200px;
  height: 60px;
@@ -403,15 +763,39 @@
  text-align: center;
  font-family: Microsoft Yahei;
  cursor: pointer;
  border: 0;
  margin-left: 20px;
}
.page_container.over-width {
  width: 150%;
}
.page_container .main {
  height: 100%;
  /* height: 100%; */
  border-radius: 10px;
  background-color: rgba(255,255,255,1);
  color: rgba(16,16,16,1);
  font-size: 14px;
  /* text-align: center; */
  font-family: Roboto;
  position: relative;
}
.page_container.over-width .main {
  margin-right: 50px;
}
.page_container.over-width .main:last-child {
  margin-right: 0;
}
.page_container .main .cancel_icon_block {
  width: 50px;
  height: 50px;
  position: absolute;
  top: 12px;
  right: 11px;
  z-index: 1;
}
.page_container .main .cancel_icon_block .img {
  width: 100%;
  height: 100%;
}
.page_container .main .room_title {
  line-height: 50px;
@@ -468,6 +852,10 @@
  display: block;
  margin-right: 17px;
}
.page_container .main .btn_box__item .icon .img {
  width: 100%;
  height: 100%;
}
.page_container .main .btn_box__item .tx {
  line-height: 37px;
  color: rgba(51,51,51,1);
@@ -483,6 +871,16 @@
  margin-top: 163px;
}
.page_container .main .room_left_btn_box__item {
  width: 500px;
  height: 150px;
  line-height: 73px;
  border-radius: 10px;
  font-size: 50px;
  text-align: center;
  margin: auto;
}
.page_container .main .room_left_btn_box__item.flex-1 {
  width: auto;
  height: 150px;
  line-height: 58px;
  border-radius: 10px;
@@ -492,9 +890,9 @@
  margin-right: 20px;
  font-weight: bold;
}
.page_container .main .room_left_btn_box__item:last-child {
/* .page_container .main .room_left_btn_box__item:last-child {
  margin-right: 0;
}
} */
.page_container .main .room_left_btn_box__item.yellow {
  color: rgba(255,255,255,1);
  background-color: rgba(233,157,66,1);
@@ -504,15 +902,12 @@
  color: rgba(79,79,79,1);
}
.page_container .main .room_left_btn_box__item.green {
  width: 500px;
  height: 150px;
  line-height: 73px;
  border-radius: 10px;
  background-color: rgba(47,174,206,1);
  color: rgba(255,255,255,1);
  font-size: 50px;
  text-align: center;
  margin: auto;
}
.page_container .main .room_left_btn_box__item.b-green {
  background-color: rgba(79,167,114,1);
  color: rgba(255,255,255,1);
}
.page_container .main .room_content {
  margin-top: 30px;
@@ -535,6 +930,18 @@
.page_container .main .room_content .name .tx {
  max-width: 666px;
  margin: auto;
  text-align: center;
}
.page_container .main .room_content .name_icon {
  width: 40px;
  height: 40px;
  display: block;
  margin-top: 13px;
  padding: 20px;
}
.page_container .main .room_content .name_icon .img {
  width: 100%;
  height: 100%;
}
.page_container .main .room_content .ciq {
  line-height: 42px;
@@ -556,125 +963,32 @@
.page_container .right {
  width: 686px;
  margin-left: 30px;
  height: 100%;
  /* height: 100%; */
}
.page_container.over-width .right_room_info {
  margin-bottom: 58px;
}
.page_container.over-width .right_room_info:last-child {
  margin-bottom: 0;
}
.page_container .right_block {
  width: 100%;
  height: 100%;
}
.page_container .right .guest_title {
  height: 60px;
  line-height: 28px;
  border-radius: 10px 10px 0px 0px;
  background-color: rgba(255,255,255,1);
  color: rgba(34,123,235,1);
  font-size: 20px;
  text-align: center;
  font-family: Roboto;
  font-weight: bold;
}
.page_container .right .guest_block {
  background-color: #fff;
  overflow: auto;
}
.page_container .right .guest_list {
  background-color: #fff;
  padding-bottom: 23px;
}
.page_container .right .guest_list__row {
  min-height: 75px;
  background-color: rgba(34,123,235,0.1);
}
.page_container .right .guest_list__row:nth-child(2n) {
  background-color: #fff;
}
.page_container .right .guest_list__td {}
.page_container .right .guest_list__td .tx {
  line-height: 30px;
  color: rgba(16,16,16,1);
  font-size: 22px;
  text-align: center;
  font-family: PingFangSC-regular;
  box-sizing: border-box;
  padding: 0 5px;
}
.page_container .right .guest_list__td .icon {
  width: 20px;
  height: 20px;
  display: block;
}
.page_container .right .guest_list__td:nth-child(1) {
  width: 19.54%;
}
.page_container .right .guest_list__td:nth-child(2) {
  width: 21.86%;
}
.page_container .right .guest_list__td:nth-child(3) {
  width: 46.06%;
}
.page_container .right .guest_list__td:nth-child(4) {
  width: 12.54%;
}
.page_container .right .room_info {
  width: 100%;
  border-radius: 10px;
  background-color: rgba(255,255,255,0.3);
}
.page_container .right .room_info .staff_box {
  margin-top: 30px;
}
.page_container .right .room_info .staff_box_item {
  height: 180px;
}
.page_container .right .room_info .staff_box_item:nth-child(1) {
  background-color: rgba(255,255,255,0.1);
}
.page_container .right .room_info .staff_box_item:nth-child(2) {
  background-color: rgba(255,255,255,0.3);
  margin: 0 10px;
}
.page_container .right .room_info .staff_box_item:nth-child(3) {
  background-color: rgba(255,255,255,0.1);
}
.page_container .right .room_info .staff_box_item__title {
  line-height: 28px;
  color: rgba(255,255,255,1);
  font-size: 20px;
  text-align: center;
  font-family: PingFangSC-regular;
}
.page_container .right .room_info .staff_box_item__name {
  line-height: 56px;
  color: rgba(255,255,255,1);
  font-size: 40px;
  text-align: center;
  font-family: PingFangSC-medium;
  margin-top: 5px;
}
.page_container .right .room_info .room_info_project {
  padding: 36px 20px 20px 20px;
  height: 138px;
  box-sizing: border-box;
  overflow: hidden;
}
.page_container .right .room_info .room_info_project_block {
  box-sizing: border-box;
.page_container .right_block .guest_box {
  margin-top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
}
.page_container .right .room_info .room_info_project .tx {
  line-height: 39px;
  color: rgba(255,255,255,1);
  font-size: 28px;
  text-align: center;
  font-family: PingFangSC-regular;
}
.page_container .right .guest_box {
  margin-top: 65px;
  width: 100%;
  height: 345px;
  background-color: #fff;
  overflow: hidden;
  -webkit-flex-flow: column;
  flex-flow: column;
  display: box;
  display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
  display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
  display: -ms-flexbox;      /* TWEENER - IE 10 */
  display: -webkit-flex;     /* NEW - Chrome */
  display: -moz-flex;
  display: -ms-flex;
  display: -o-flex;
  display: flex;
}
</style>