From c6d3157eb616116c84d35e221ed9c57ef8da0ad6 Mon Sep 17 00:00:00 2001
From: long <515897141@qq.com>
Date: 星期四, 01 二月 2024 16:24:11 +0800
Subject: [PATCH] 操作频繁锁(60秒)

---
 src/pages/room/detail.vue |  450 ++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 321 insertions(+), 129 deletions(-)

diff --git a/src/pages/room/detail.vue b/src/pages/room/detail.vue
index ee10f21..b385645 100644
--- a/src/pages/room/detail.vue
+++ b/src/pages/room/detail.vue
@@ -23,10 +23,12 @@
     </div>
     <div class="page_header_placeholer" />
     <!-- 鏈湁瀹夋帓 -->
-    <div v-if="!occupyInfoView && (!assignTreatListView || !assignTreatListView.length)" class="page_container flex flex-1">
-      <div class="main flex-1">
+    <div v-if="(!occupyInfoViewArr || !occupyInfoViewArr.length) && (!assignTreatListView || !assignTreatListView.length)" class="page_container flex flex-1">
+      <div class="main flex-1 flex flex-col">
         <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>
+        <div class="flex-1" />
+        <div v-if="roomInfo" class="room_main_tip" style="line-height: 186px;font-size: 140px;margin-top: 0">-{{ statusTx[roomInfo.status] }}-</div>
+        <div class="flex-1" />
         <div class="btn_box flex flex-center">
           <div class="flex flex-ver">
             <div class="btn_box__item flex flex-center white" data-tx="绌洪棽" data-status="0" @click="statusChg">
@@ -66,7 +68,7 @@
       </div>
     </div>
     <!-- 娌℃湁瀹汉鍜屾湁瀹夋帓 -->
-    <div v-if="!occupyInfoView && (assignTreatListView && assignTreatListView.length)" class="page_container flex flex-1">
+    <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>
@@ -84,15 +86,20 @@
       </div>
     </div>
     <!-- 瀹汉鍜屾湁瀹夋帓 over-width -->
-    <div v-if="occupyInfoView" class="page_container flex flex-1">
-      <div class="main flex-1">
-        <XioRoomGuestInfoBox ref="XioRoomGuestInfoBox" :room-info="roomInfo" :occupy-info-view="occupyInfoView" @setStatus="setComStatus" />
+    <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>
+          <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="flex-1">
-          <XioRoomInfoBlock ref="XioRoomInfoBlock" :occupy-info-view="occupyInfoView" />
+        <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="flex flex-col" style="border-radius: 10px;">
+        <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>
@@ -102,7 +109,7 @@
     <!-- 鏇存敼鎴块棿鐘舵�佺獥 -->
     <XioRoomStatusChg ref="XioRoomStatusChg" @changeStatus="changeStatus" />
     <!-- MIC閫氱煡鍗搁夯 -->
-    <XioRoomOffNarcosisNotice ref="XioRoomOffNarcosisNotice" @confirm="offNarcosisNoticeConfirm" />
+    <!-- <XioRoomOffNarcosisNotice ref="XioRoomOffNarcosisNotice" @confirm="offNarcosisNoticeConfirm" /> -->
   </div>
 </template>
 
@@ -123,13 +130,11 @@
 // 鏇存敼鎴块棿鐘舵�佺獥
 import XioRoomStatusChg from '@/components/xio_room_status_chg'
 // 閫氱煡鍗搁夯
-import XioRoomOffNarcosisNotice from '@/components/xio_room_off_narcosis_notice'
+// 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// 宸蹭娇鐢ㄩ粯璁ゅ浜哄悗鎴块棿鏄惁鏈夋敼鍙樼姸鎬�
-var offNarcosisIds = [] // 鏄惁宸查�氱煡鍗搁夯id鏁扮粍
-var isOffNarcosisShow = false // 鏄惁鏄剧ず宸查�氱煡鍗搁夯寮圭獥
 export default {
   name: 'RoomDetail',
   components: {
@@ -137,8 +142,8 @@
     XioRoomInfoBlock,
     XioRoomGuestBox,
     XioCustomerSelect,
-    XioRoomStatusChg,
-    XioRoomOffNarcosisNotice
+    XioRoomStatusChg
+    // XioRoomOffNarcosisNotice
   },
   inject: ['noop'],
   data() {
@@ -150,20 +155,25 @@
       statusTx: ['绌洪棽', '浣跨敤涓�', '瀹汉浼戞伅', '鎵撴壂涓�', '鏁烽夯涓�'],
       timeObj: {}, // week锛氭槦鏈燂紝date锛氬勾鏈堟棩锛宼imeMin锛氭椂鍒嗭紝time锛氭椂鍒嗙锛宼imeStamp锛氭椂闂存埑
       curTreatId: '',
-      curTreatIds: ''
+      curTreatIds: '', // 宸查�変腑鐨勬不鐤楄褰昳d鏁扮粍
+      offNarcosisIds: [], // 鏄惁宸查�氱煡鍗搁夯鐨勭敤鎴穒d鏁扮粍
       // isShowAppellationName: true // 鏄惁鏄剧ず绉拌皳
+
+      // 60绉掑垏鎹㈢姸鎬侀攣 鈫撯啌鈫撯啌鈫撯啌鈫撯啌鈫撯啌
+      setStatusLock: false, // 鏇存柊鐘舵�侀攣
+      setStatusLockDuration: 60000, // 鏇存柊鐘舵�侀攣鏃堕棿
+      setStatusLockTimer: null
+      // 60绉掑垏鎹㈢姸鎬侀攣 鈫戔啈鈫戔啈鈫戔啈鈫戔啈鈫戔啈
     }
   },
-  // todo 椤甸潰鏄剧ず鍙婃暟缁勫鐞�
   computed: {
+    // 褰撳墠宸查�夋嫨鐢ㄦ埛鐨勬暟缁勬暟鎹�
     occupyInfoViewArr() {
-      // 缂撳瓨璁板綍
-      if (this.curTreatIds) {
-        return this.getCurTreatArr(this.curTreatIds)
+      if (this.occupyInfo && this.occupyInfo.length) {
+        return this.occupyInfoViewArrIdsHandleArr()
       } else {
-        if (this.occupyInfo) {
-          this.occupyInfoViewArrIdsHandle(this.occupyInfo)
-          return [this.occupyInfo]
+        if (this.curTreatIds && this.curTreatIds.length) {
+          return this.getCurTreatArr(this.curTreatIds)
         } else {
           if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
             isUseDefault = true
@@ -175,8 +185,9 @@
         }
       }
     },
+    // 褰撳墠宸查�夋嫨鐢ㄦ埛鐨勬暟鎹紙鍗曚釜锛夛紙鏆傛棤鐢級
     occupyInfoView() {
-      console.log('00000000000000000000000', this.occupyInfo, isUseDefault, isUseDefaultChg)
+      // console.log('00000000000000000000000', this.occupyInfo, isUseDefault, isUseDefaultChg)
       // 鏈夊綋鍓嶉�変腑鐨勶紝鏍规嵁闇�姹備慨鏀瑰鍔犻�変腑涓嶆洿鏀圭姸鎬侊紝鐢辩┖闂插紑濮�
       if (this.curTreatId) {
         return this.gatCurTreatInfo()
@@ -188,7 +199,7 @@
         } else {
           // 杩樻病浣跨敤榛樿瀹汉鍊兼垨鑰呭凡浣跨敤榛樿瀹汉鍊艰繕娌℃敼鍙樼姸鎬侊紙閫傞厤杞锛�
           if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
-            isUseDefault = true
+            // isUseDefault = true
             return this.assignTreatList[0]
           // 宸蹭娇鐢ㄨ繃榛樿瀹汉鍊�
           } else {
@@ -197,12 +208,16 @@
         }
       }
     },
+    // 璇ユ不鐤楀鐢ㄦ埛鍒楄〃
     assignTreatListView() {
       if (this.assignTreatList && this.assignTreatList.length) {
         this.assignTreatList.forEach((o) => {
-          o.act = false
-          if (this.occupyInfoView && this.occupyInfoView.id === o.id) {
-            o.act = true
+          if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
+            this.occupyInfoViewArr.forEach((_o) => {
+              if (_o.id === o.id) {
+                o.act = true
+              }
+            })
           }
         })
         return this.assignTreatList
@@ -214,23 +229,19 @@
   activated() {
     console.log('roomDetail mounted')
     // 璁板綍褰撳墠鐨勬不鐤桰D
-    var curTreatId = localStorage.getItem('curTreatId')
-    // 璁板綍褰撳墠鐨勬不鐤桰D鏁扮粍
+    // var curTreatId = localStorage.getItem('curTreatId')
+    // 璁板綍褰撳墠鐨勬不鐤楄褰旾D鏁扮粍
     var curTreatIds = localStorage.getItem('curTreatIds')
     // 鍗搁夯鐩稿叧
     var localOffNarcosisIds = localStorage.getItem('offNarcosisIds')
-    var localIsOffNarcosisShow = localStorage.getItem('isOffNarcosisShow')
     // 鑾峰彇鏄惁宸查�氱煡鍗搁夯鏁扮粍
     if (localOffNarcosisIds) {
-      offNarcosisIds = JSON.parse(localOffNarcosisIds)
+      this.offNarcosisIds = JSON.parse(localOffNarcosisIds)
     } else {
-      offNarcosisIds = []
+      this.offNarcosisIds = []
       this.setLocalStorageOffNarcosisIds()
     }
-    if (localIsOffNarcosisShow) {
-      isOffNarcosisShow = localIsOffNarcosisShow
-    }
-    // 鏁扮粍
+    // 娌荤枟璁板綍ID鏁扮粍
     if (curTreatIds) {
       try {
         this.curTreatIds = JSON.parse(curTreatIds)
@@ -238,7 +249,8 @@
         this.curTreatIds = ''
       }
     }
-    this.curTreatId = curTreatId || ''
+    // this.curTreatId = curTreatId || ''
+    // 娌荤枟瀹d
     this.id = this.$route.query.id || ''
     this.init()
   },
@@ -257,7 +269,7 @@
       this.pollingAjaxFn(this, 'getData', 'detail', 8000)
       // this.getData()
     },
-    // 鍒濆鍗犵敤id鏁扮粍澶勭悊
+    // 鍒濆榛樿閫夋嫨鐨刬d鏁扮粍澶勭悊
     occupyInfoViewArrIdsHandle(item) {
       if (!this.curTreatIds) {
         this.curTreatIds = []
@@ -265,30 +277,61 @@
       this.curTreatIds.push(item.id)
       this.setLocalCurTreatIds()
     },
+    // 鍒濆榛樿閫夋嫨鐨刬d鏁扮粍澶勭悊
+    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(offNarcosisIds))
+      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()
-      }
-      isOffNarcosisShow = true
-      localStorage.setItem('isOffNarcosisShow', true)
-    },
-    // 鏄剧ず閫氱煡鍗搁夯寮圭獥
-    showOffNarcosisNotice() {
-      // 鎵撳紑寮圭獥
-      this.$refs['XioRoomOffNarcosisNotice'].showDialog()
+    // 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() {
@@ -307,6 +350,13 @@
             })
           }
         })
+        // 鍩烘湰涓嶄細鍑虹幇杩欑鎯呭喌锛屼絾鏄互闃蹭竾涓�锛岃嫢鏈湴缂撳瓨id瀛樺湪锛屼絾瀵逛笉涓婂垪琛ㄥ垯缂撳瓨绗竴鏉℃暟鎹甶d
+        if (!arr.length) {
+          arr.push(this.assignTreatList[0])
+          this.curTreatIds = []
+          this.curTreatIds.push(this.assignTreatList[0].id)
+          this.setLocalCurTreatIds()
+        }
       }
       return arr
     },
@@ -346,7 +396,8 @@
                 startTime: '2023-12-08 00:00:00',
                 userName: '榛勫槈鑽�',
                 gender: 1,
-                hempStatus: 0,
+                hempStatus: 2,
+                treatRoomStatus: 0,
                 ciq: '123',
                 adviserName: 'a鍚�',
                 aDoctorName: 'b鍚�',
@@ -359,7 +410,8 @@
                 startTime: '2023-12-08 00:15:00',
                 userName: '鏉庡痉鍗�',
                 gender: 1,
-                hempStatus: 0,
+                hempStatus: 2,
+                treatRoomStatus: 0,
                 ciq: '456',
                 adviserName: 'd鍚�',
                 aDoctorName: 'e鍚�',
@@ -372,7 +424,8 @@
                 startTime: '2023-12-08 00:20:00',
                 userName: '鐚涘鍙�',
                 gender: 2,
-                hempStatus: 0,
+                hempStatus: 2,
+                treatRoomStatus: 0,
                 ciq: '789',
                 adviserName: 'g鍚�',
                 aDoctorName: 'h鍚�',
@@ -386,41 +439,46 @@
         }
       }).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.userName) {
-            res.data.occupyInfo.appellationName = res.data.occupyInfo.userName[0] + `${res.data.occupyInfo.gender ? ['濂冲+', '鍏堢敓', '濂冲+'][res.data.occupyInfo.gender] : '濂冲+'}`
+          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 && (isUseDefaultChg = 1)
-          res.data.occupyInfo && (isUseDefault = 1)
-          // 鍗犵敤淇℃伅娌荤枟鏃堕棿澶勭悊
-          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]}`
-          }
+          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.occupyInfoView, 'offNarcosisIds:', offNarcosisIds, 'isOffNarcosisShow:', isOffNarcosisShow)
-          if (this.occupyInfoView && this.occupyInfoView.hempStatus === 2 && this.occupyInfoView.userId) {
-            var flag
-            offNarcosisIds && offNarcosisIds.length && (flag = offNarcosisIds.find((o) => { return o === this.occupyInfoView.userId }))
-            // flag = isOffNarcosisShow
-            if (!flag) {
-              this.showOffNarcosisNotice()
-            }
+          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
@@ -449,46 +507,100 @@
     // 鏈湁瀹夋帓鐩存帴鐘舵�佸彉鏇�
     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)
-      this.changeStatusFn(occupyInfoView, opt.status, () => {
+      // var { occupyInfoView, roomInfo } = this
+      console.log('============================>瀹汉淇℃伅缁勪欢鐐瑰嚮鏇存敼鐘舵��', opt.tx, opt.status, opt.item)
+      this.changeStatusFn(opt.item, opt.status, () => {
         // 鍒锋柊璇︽儏
         this.getData()
       })
     },
     // 鏀瑰彉鎴块棿鐘舵�佸紓姝ユ柟娉�
     changeStatusFn(item = {}, status, cb) {
+      // 鏈В閿� 20240201 long
+      if (this.setStatusLock) {
+        return this.$messageWarn('鎿嶄綔棰戠箒锛岃绋嶅悗鍐嶈瘯')
+      }
+      this.setStatusLock = true
+      clearInterval(this.setStatusLockTimer)
+      this.setStatusLockTimer = null
+
       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: 'guide/treat/screen/room/status/update',
         data: params,
@@ -504,15 +616,9 @@
           console.log('鍦ㄥ凡鏈夐粯璁ゅ浜虹殑鎯呭喌涓嬶紝鏀瑰彉鐘舵�佹洿鏀规爣璇�')
           isUseDefaultChg = 1
         }
-        // 褰撳墠閫変腑鐨勭敤鎴锋埧闂存洿鏀逛簡鐘舵�侊紝宸茬粡鎴愪负鍗犵敤鏃讹紝娓呴櫎閫変腑鍖荤枟璁板綍id
-        if (item && item.id && item.id === this.curTreatId) {
-          console.log('褰撳墠閫変腑鐨勭敤鎴锋埧闂存洿鏀逛簡鐘舵�侊紝宸茬粡鎴愪负鍗犵敤鏃讹紝娓呴櫎閫変腑鍖荤枟璁板綍id')
-          localStorage.removeItem('curTreatId')
-          this.curTreatId = ''
-        }
         // 鍙鏇存敼涓虹┖闂插氨閲嶇疆鍙傛暟
-        if (status === 0) {
-          console.log('鏇存敼涓虹┖闂�')
+        if (params.status === 0) {
+          console.log('鎴块棿鏇存敼涓虹┖闂�')
           // 閲嶇疆榛樿宸蹭娇鐢ㄥ浜虹殑鍙傛暟
           isUseDefault = false
           isUseDefaultChg = 0
@@ -520,6 +626,15 @@
         }
         // console.log('8888888888888888888888888888888888', res)
         cb && cb()
+
+        // 30s鍚庤В閿� 20240201 long
+        this.setStatusLockTimer = setInterval(() => {
+          this.setStatusLock = false
+        }, this.setStatusLockDuration)
+      }, () => {
+        setTimeout(() => {
+          this.setStatusLock = false
+        }, 1000)
       })
     },
     // 閲嶇疆鐘舵��
@@ -529,14 +644,18 @@
     },
     // 鏇存敼鎴块棿鐘舵�侊紙閲嶇疆鐘舵�佺殑鏇存敼鏂规硶锛�
     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
       // }
       // 娓呴櫎閫変腑鍖荤枟璁板綍id
-      localStorage.removeItem('curTreatId')
-      this.curTreatId = ''
+      // localStorage.removeItem('curTreatId')
+      // this.curTreatId = ''
+      // 娓呴櫎閫変腑鍖荤枟璁板綍ids鏁扮粍
+      localStorage.removeItem('curTreatIds')
+      this.curTreatIds = ''
+      // 鍙樻洿鎴块棿鐘舵�佹柟娉�
       this.changeStatusFn({}, opt.status, () => {
         // 鍒锋柊璇︽儏
         this.getData()
@@ -563,27 +682,71 @@
     selectCustomerSubmit(opt) {
       console.log('=======================>submit', opt)
       // 纭畾閫夋嫨鐨勭敤鎴凤紝璁板綍id
-      localStorage.setItem('curTreatId', opt.id)
-      this.curTreatId = opt.id
-      if (this.curTreatIds && this.curTreatIds.length) {
-        var flag = this.curTreatIds.find((o) => { return o === opt.id })
-        if (!flag) {
-          this.curTreatIds.push(opt.id)
-        }
-        this.setLocalCurTreatIds()
-      }
-      if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
-        this.occupyInfoViewArr.push(opt)
-      }
+      // localStorage.setItem('curTreatId', opt.id)
+      // this.curTreatId = opt.id
+      // 褰撳墠閫夋嫨瀹㈡埛鐨勬暟缁勫鍔犲鎴�
+      this.occupyInfoViewArrDataHandle('add', opt)
       // 閲嶇疆鎴块棿鐘舵��
-      if (this.roomInfo) {
-        this.changeStatusFn({}, 0, () => {
-          // 鍒锋柊璇︽儏
-          this.getData()
-        })
-      }
+      // 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() {
@@ -606,6 +769,9 @@
 }
 .page_header_placeholer {
   height: 100px;
+  width: 100%;
+  display: block;
+  flex-shrink: 0;
 }
 .page_header {
   position: fixed;
@@ -639,6 +805,25 @@
   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;
@@ -664,7 +849,8 @@
   color: rgba(154,154,154,1);
 }
 .page_container .main .btn_box {
-  margin-top: 130px;
+  /* margin-top: 130px; */
+  margin-bottom: 40px;
 }
 .page_container .main .btn_box__item {
   width: 250px;
@@ -808,6 +994,12 @@
   margin-left: 30px;
   /* 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%;

--
Gitblit v1.8.0