long
2024-06-20 601fbd0b2fda10ce5ddcc4de3a32b04c9d6aaa60
提交 | 用户 | age
3ac5f2 1 <!--room-detail.vue-->
J 2 <template>
878885 3   <div class="page flex flex-col">
6da3c1 4     <div class="page_header flex flex-ver">
J 5       <div class="left flex flex-ver" @click="back">
878885 6         <div class="page_logo_1">
601fbd 7           <!-- 全局标题图标配置!!! -->
L 8           <img class="img" src="static/settingConfig/logo_1.png">
878885 9         </div>
601fbd 10         <!-- 全局标题图标配置!!! -->
L 11         <div v-if="settingConfig.isLongLogo" class="page_logo_2">
12           <!-- 全局标题图标配置!!! -->
13           <img class="img" src="static/settingConfig/logo_2.png">
878885 14         </div>
3ac5f2 15       </div>
J 16       <div class="right flex-1 flex flex-jcfe flex-ver">
1d1095 17         <el-button type="primary" icon="el-icon-refresh" class="reset_btn flex flex-center" size="small" style="width: 100px;" @click="resetPage">刷新</el-button>
aeb317 18         <div class="reset_btn flex flex-center" @click="resetStatus">重置房间状态</div>
3ac5f2 19         <div class="page_date">
bb2b08 20           <div class="page_week">{{ timeObj.week }}</div>
J 21           <div class="page_day">{{ timeObj.date }}</div>
3ac5f2 22         </div>
bb2b08 23         <div class="page_time">{{ timeObj.timeMin }}</div>
J 24         <!-- <div class="page_time">{{ timeObj.time }}</div> -->
3ac5f2 25       </div>
J 26     </div>
459990 27     <div class="page_header_placeholer" />
bb2b08 28     <!-- 未有安排 -->
583e10 29     <div v-if="(!occupyInfoViewArr || !occupyInfoViewArr.length) && (!assignTreatListView || !assignTreatListView.length)" class="page_container flex flex-1">
0e11d7 30       <div class="main flex-1 flex flex-col">
6da3c1 31         <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
0e11d7 32         <div class="flex-1" />
L 33         <div v-if="roomInfo" class="room_main_tip" style="line-height: 186px;font-size: 140px;margin-top: 0">-{{ statusTx[roomInfo.status] }}-</div>
34         <div class="flex-1" />
bb2b08 35         <div class="btn_box flex flex-center">
J 36           <div class="flex flex-ver">
6da3c1 37             <div class="btn_box__item flex flex-center white" data-tx="空闲" data-status="0" @click="statusChg">
bb2b08 38               <div class="flex flex-ver">
878885 39                 <div class="icon">
J 40                   <img class="img" src="static/imgs/free.png">
41                 </div>
bb2b08 42                 <div class="tx">空闲</div>
J 43               </div>
44             </div>
6da3c1 45             <div class="btn_box__item flex flex-center blue" data-tx="使用中" data-status="1" @click="statusChg">
bb2b08 46               <div class="flex flex-ver">
878885 47                 <div class="icon">
J 48                   <img class="img" src="static/imgs/using.png">
49                 </div>
bb2b08 50                 <div class="tx white">使用中</div>
J 51               </div>
52             </div>
6da3c1 53             <div class="btn_box__item flex flex-center yellow" data-tx="客人休息" data-status="2" @click="statusChg">
bb2b08 54               <div class="flex flex-ver">
878885 55                 <div class="icon">
J 56                   <img class="img" src="static/imgs/rest.png">
57                 </div>
bb2b08 58                 <div class="tx">客人休息</div>
J 59               </div>
60             </div>
6da3c1 61             <div class="btn_box__item flex flex-center gray" data-tx="通知打扫" data-status="3" @click="statusChg">
bb2b08 62               <div class="flex flex-ver">
878885 63                 <div class="icon">
J 64                   <img class="img" src="static/imgs/clear.png">
65                 </div>
bb2b08 66                 <div class="tx">通知打扫</div>
J 67               </div>
68             </div>
69           </div>
70         </div>
71       </div>
72     </div>
6da3c1 73     <!-- 没有客人和有安排 -->
583e10 74     <div v-if="(!occupyInfoViewArr || !occupyInfoViewArr.length) && (assignTreatListView && assignTreatListView.length)" class="page_container flex flex-1">
bb2b08 75       <div class="main flex-1">
6da3c1 76         <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
J 77         <div v-if="roomInfo" class="room_main_tip">-{{ statusTx[roomInfo.status] }}-</div>
1d1095 78         <div v-show="roomInfo && roomInfo.status >= 1" class="room_left_btn_box flex flex-ver">
J 79           <div v-show="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center yellow btn_ani" @click="setStatus('客人休息', 2)">客人休息</div>
80           <div v-show="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center gray btn_ani" @click="setStatus('打扫中', 3)">通知打扫</div>
81           <div v-show="roomInfo.status == 2" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('打扫中', 3)">通知打扫</div>
82           <div v-show="roomInfo.status == 3" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('空闲', 0)">结束打扫</div>
bb2b08 83         </div>
J 84       </div>
85       <div class="right">
459990 86         <div class="right_block">
J 87           <XioRoomGuestBox ref="XioRoomGuestBox" :assign-treat-list-view-com="assignTreatListView" @selectCustomer="selectCustomer" />
bb2b08 88         </div>
J 89       </div>
90     </div>
459990 91     <!-- 客人和有安排 over-width -->
583e10 92     <div v-if="occupyInfoViewArr && occupyInfoViewArr.length" class="page_container flex flex-1" :class="[occupyInfoViewArr && occupyInfoViewArr.length>1?'over-width':'']">
J 93       <div class="flex flex-1">
94         <div v-for="(item,index) in occupyInfoViewArr" :key="index" class="main flex-1">
12a2f1 95           <div v-if="occupyInfoViewArr.length>1 && item.treatRoomStatus === 0" class="cancel_icon_block" @click="cancelCustomerItem(item)">
583e10 96             <img class="img" src="static/imgs/cancel.png">
J 97           </div>
98           <XioRoomGuestInfoBox :ref="`XioRoomGuestInfoBox_${item.id}`" :room-info="roomInfo" :occupy-info-view="item" :off-narcosis-ids="offNarcosisIds" @setStatus="setComStatus" />
99         </div>
bb2b08 100       </div>
J 101       <div class="right flex flex-col">
583e10 102         <div v-for="(item,index) in occupyInfoViewArr" :key="index" class="flex-1 right_room_info">
c1e103 103           <XioRoomInfoBlock ref="XioRoomInfoBlock" :occupy-info-view="item" :occupy-info-view-arr="occupyInfoViewArr" />
bb2b08 104         </div>
583e10 105         <div v-if="occupyInfoViewArr.length<=1" class="flex flex-col" style="border-radius: 10px;">
459990 106           <XioRoomGuestBox ref="XioRoomGuestBox" :assign-treat-list-view-com="assignTreatListView" @selectCustomer="selectCustomer" />
bb2b08 107         </div>
J 108       </div>
109     </div>
aeb317 110     <!-- 选择客人弹窗 -->
J 111     <XioCustomerSelect ref="XioCustomerSelect" @cancel="selectCustomerCancel" @submit="selectCustomerSubmit" />
112     <!-- 更改房间状态窗 -->
113     <XioRoomStatusChg ref="XioRoomStatusChg" @changeStatus="changeStatus" />
1fa546 114     <!-- MIC通知卸麻 -->
583e10 115     <!-- <XioRoomOffNarcosisNotice ref="XioRoomOffNarcosisNotice" @confirm="offNarcosisNoticeConfirm" /> -->
3ac5f2 116   </div>
J 117 </template>
118
119 <script>
6da3c1 120 // 空闲 0
J 121 // 使用中 1
122 // 客人休息 2
123 // 待打扫/通知打扫 3
3ac5f2 124 // import Login from '../utils/jun_login.js'
459990 125 // 房间客人信息
J 126 import XioRoomGuestInfoBox from '@/components/xio_room_guest_info_box'
127 // 房间负责员工信息
128 import XioRoomInfoBlock from '@/components/xio_room_info_block'
129 // 房间客户预约列表信息
130 import XioRoomGuestBox from '@/components/xio_room_guest_box'
aeb317 131 // 选择客人弹窗
bb2b08 132 import XioCustomerSelect from '@/components/xio_customer_select'
aeb317 133 // 更改房间状态窗
J 134 import XioRoomStatusChg from '@/components/xio_room_status_chg'
1fa546 135 // 通知卸麻
583e10 136 // import XioRoomOffNarcosisNotice from '@/components/xio_room_off_narcosis_notice'
6da3c1 137 import Req from '../../utils/jun_httpInstall' // http 请求
1d1095 138 // import xioFn from './utils/xio_fn.js'
6da3c1 139 var isUseDefault = false // 是否已使用默认客人
878885 140 var isUseDefaultChg = 0// 已使用默认客人后房间是否有改变状态
3ac5f2 141 export default {
J 142   name: 'RoomDetail',
bb2b08 143   components: {
459990 144     XioRoomGuestInfoBox,
J 145     XioRoomInfoBlock,
146     XioRoomGuestBox,
aeb317 147     XioCustomerSelect,
583e10 148     XioRoomStatusChg
J 149     // XioRoomOffNarcosisNotice
bb2b08 150   },
3ac5f2 151   inject: ['noop'],
J 152   data() {
153     return {
6da3c1 154       id: this.$route.query.id || '',
J 155       roomInfo: {},
156       occupyInfo: '', // 当前占用人的信息
157       assignTreatList: [],
1d1095 158       statusTx: ['空闲', '使用中', '客人休息', '打扫中', '敷麻中'],
34cb2b 159       timeObj: {}, // week:星期,date:年月日,timeMin:时分,time:时分秒,timeStamp:时间戳
1fa546 160       curTreatId: '',
583e10 161       curTreatIds: '', // 已选中的治疗记录id数组
c6d315 162       offNarcosisIds: [], // 是否已通知卸麻的用户id数组
459990 163       // isShowAppellationName: true // 是否显示称谓
c6d315 164
L 165       // 60秒切换状态锁 ↓↓↓↓↓↓↓↓↓↓
166       setStatusLock: false, // 更新状态锁
ae5ea1 167       setStatusLockDuration: 15000, // 更新状态锁时间
c6d315 168       setStatusLockTimer: null
L 169       // 60秒切换状态锁 ↑↑↑↑↑↑↑↑↑↑
3ac5f2 170     }
J 171   },
172   computed: {
583e10 173     // 当前已选择用户的数组数据
459990 174     occupyInfoViewArr() {
12a2f1 175       if (this.occupyInfo && this.occupyInfo.length) {
J 176         return this.occupyInfoViewArrIdsHandleArr()
459990 177       } else {
12a2f1 178         if (this.curTreatIds && this.curTreatIds.length) {
J 179           return this.getCurTreatArr(this.curTreatIds)
459990 180         } else {
J 181           if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
182             isUseDefault = true
183             this.occupyInfoViewArrIdsHandle(this.assignTreatList[0])
184             return [this.assignTreatList[0]]
185           } else {
186             return ''
187           }
188         }
189       }
190     },
583e10 191     // 当前已选择用户的数据(单个)(暂无用)
6da3c1 192     occupyInfoView() {
583e10 193       // console.log('00000000000000000000000', this.occupyInfo, isUseDefault, isUseDefaultChg)
34cb2b 194       // 有当前选中的,根据需求修改增加选中不更改状态,由空闲开始
J 195       if (this.curTreatId) {
196         return this.gatCurTreatInfo()
6da3c1 197       } else {
34cb2b 198         // 有占用
J 199         if (this.occupyInfo) {
200           return this.occupyInfo
201         // 没有占用
6da3c1 202         } else {
34cb2b 203           // 还没使用默认客人值或者已使用默认客人值还没改变状态(适配轮询)
J 204           if ((!isUseDefault || (isUseDefault && isUseDefaultChg === 0)) && this.assignTreatList && this.assignTreatList.length) {
c4b6a2 205             // isUseDefault = true
34cb2b 206             return this.assignTreatList[0]
J 207           // 已使用过默认客人值
208           } else {
209             return ''
210           }
6da3c1 211         }
34cb2b 212       }
J 213     },
583e10 214     // 该治疗室用户列表
34cb2b 215     assignTreatListView() {
J 216       if (this.assignTreatList && this.assignTreatList.length) {
217         this.assignTreatList.forEach((o) => {
583e10 218           if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
J 219             this.occupyInfoViewArr.forEach((_o) => {
220               if (_o.id === o.id) {
221                 o.act = true
222               }
223             })
34cb2b 224           }
J 225         })
226         return this.assignTreatList
227       } else {
228         return []
6da3c1 229       }
J 230     }
3ac5f2 231   },
bf4dca 232   activated() {
3ac5f2 233     console.log('roomDetail mounted')
34cb2b 234     // 记录当前的治疗ID
583e10 235     // var curTreatId = localStorage.getItem('curTreatId')
J 236     // 记录当前的治疗记录ID数组
459990 237     var curTreatIds = localStorage.getItem('curTreatIds')
J 238     // 卸麻相关
df74f0 239     var localOffNarcosisIds = localStorage.getItem('offNarcosisIds')
J 240     // 获取是否已通知卸麻数组
241     if (localOffNarcosisIds) {
583e10 242       this.offNarcosisIds = JSON.parse(localOffNarcosisIds)
df74f0 243     } else {
583e10 244       this.offNarcosisIds = []
df74f0 245       this.setLocalStorageOffNarcosisIds()
2471a9 246     }
583e10 247     // 治疗记录ID数组
459990 248     if (curTreatIds) {
J 249       try {
250         this.curTreatIds = JSON.parse(curTreatIds)
251       } catch (error) {
252         this.curTreatIds = ''
253       }
1fa546 254     }
583e10 255     // this.curTreatId = curTreatId || ''
J 256     // 治疗室id
bf4dca 257     this.id = this.$route.query.id || ''
3ac5f2 258     this.init()
J 259   },
bf4dca 260   mounted() {},
3ac5f2 261   destroyed() {
J 262
263   },
264   methods: {
265     init() {
bf4dca 266       // 进入页面先初始化常量标识
J 267       isUseDefault = false
268       isUseDefaultChg = 0
6da3c1 269       // 计时
bb2b08 270       this.countGetTime(this, 'timeObj', 'detail')
6da3c1 271       // 轮询getData,8秒一次
878885 272       this.pollingAjaxFn(this, 'getData', 'detail', 8000)
J 273       // this.getData()
459990 274     },
583e10 275     // 初始默认选择的id数组处理
459990 276     occupyInfoViewArrIdsHandle(item) {
J 277       if (!this.curTreatIds) {
278         this.curTreatIds = []
279       }
280       this.curTreatIds.push(item.id)
281       this.setLocalCurTreatIds()
12a2f1 282     },
J 283     // 初始默认选择的id数组处理
284     occupyInfoViewArrIdsHandleArr() {
285       if (!this.curTreatIds) {
286         this.curTreatIds = []
287       }
288       if (this.occupyInfo && this.occupyInfo.length === 1) {
289         var res = []
290         res.push(this.occupyInfo[0])
291         if (this.curTreatIds && this.curTreatIds.length) {
292           this.curTreatIds = this.curTreatIds.filter((o) => { return o !== this.occupyInfo[0].id })
293           if (this.assignTreatList && this.assignTreatList.length && this.curTreatIds && this.curTreatIds.length) {
294             var curTreatItem = this.assignTreatList.find((o) => { return o.id === this.curTreatIds[0] })
295             if (curTreatItem) {
296               res.push(curTreatItem)
297             }
298           }
299         }
300         this.setLocalCurTreatIds()
301         return res
302       } else if (this.occupyInfo && this.occupyInfo.length > 1) {
303         this.occupyInfo.forEach((o) => {
304           this.curTreatIds.push(o.id)
305         })
306         return this.occupyInfo
307       }
1fa546 308     },
df74f0 309     // 设置已通知卸麻id数组
J 310     setLocalStorageOffNarcosisIds() {
583e10 311       localStorage.setItem('offNarcosisIds', JSON.stringify(this.offNarcosisIds))
df74f0 312     },
1fa546 313     // 卸麻通知确认
583e10 314     // offNarcosisNoticeConfirm() {
J 315     //   if (this.occupyInfoView) {
316     //     if (offNarcosisIds && offNarcosisIds.length) {
317     //       var flag = offNarcosisIds.find((o) => { return o === this.occupyInfoView.userId })
318     //       if (!flag) {
319     //         offNarcosisIds.push(this.occupyInfoView.userId)
320     //       }
321     //     } else if (offNarcosisIds) {
322     //       offNarcosisIds.push(this.occupyInfoView.userId)
323     //     }
324     //     this.setLocalStorageOffNarcosisIds()
325     //   }
326     // },
327     // // 显示通知卸麻弹窗
328     // showOffNarcosisNotice() {
329     //   // 打开弹窗
330     //   this.$refs['XioRoomOffNarcosisNotice'].showDialog()
331     // },
332     // 显示通知卸麻弹窗(多个)
333     showOffNarcosisNoticeMulti(id) {
334       // 打开弹窗,动态的ref对象获取
335       // eslint-disable-next-line no-eval
336       var ref = eval('this.$refs.XioRoomGuestInfoBox_' + id)[0]
337       ref.showOffNarcosisNotice()
1fa546 338     },
J 339     // 点击显示隐藏称谓
459990 340     // tapAppellationHandle() {
J 341     //   this.isShowAppellationName = !this.isShowAppellationName
342     // },
343     // 获取当前治疗信息(数组)
344     getCurTreatArr(ids) {
345       var arr = []
346       if (this.assignTreatList && this.assignTreatList.length) {
347         this.assignTreatList.forEach((o) => {
348           if (ids && ids.length) {
349             ids.forEach((_o) => {
350               if (_o === o.id) {
351                 arr.push(o)
352               }
353             })
354           }
355         })
c4b6a2 356         // 基本不会出现这种情况,但是以防万一,若本地缓存id存在,但对不上列表则缓存第一条数据id
J 357         if (!arr.length) {
358           arr.push(this.assignTreatList[0])
359           this.curTreatIds = []
360           this.curTreatIds.push(this.assignTreatList[0].id)
361           this.setLocalCurTreatIds()
362         }
459990 363       }
J 364       return arr
34cb2b 365     },
J 366     // 获取当前治疗信息
367     gatCurTreatInfo() {
368       if (this.assignTreatList && this.assignTreatList.length) {
1d1095 369         return this.assignTreatList.find((o) => { return o.id === this.curTreatId })
34cb2b 370       }
1d1095 371     },
J 372     // 刷新浏览器页面
373     resetPage() {
374       window.location.reload()
6da3c1 375     },
J 376     // 获取房间详情
377     getData() {
378       var params = {}
379       // 房间id
380       if (this.id) {
381         params.shopRoomId = this.id
382       }
383       Req.http.post({
878885 384         url: 'guide/treat/screen/room/info',
6da3c1 385         data: params,
J 386         udData: { noLoading: true },
387         header: { 'Content-Type': 'application/json' },
388         mockData: {
389           code: 100,
390           msg: '',
878885 391           data: {
J 392             roomInfo: {
393               roomNo: 'xx',
1d1095 394               status: 0 // 0空闲 1使用 2休息 3打扫 4 敷麻中
878885 395             },
459990 396             assignTreatList: [
J 397               {
398                 id: 'a111',
399                 startTime: '2023-12-08 00:00:00',
400                 userName: '黄嘉荣',
401                 gender: 1,
583e10 402                 hempStatus: 2,
c1e103 403                 treatRoomStatus: 0,
459990 404                 ciq: '123',
J 405                 adviserName: 'a君',
406                 aDoctorName: 'b君',
407                 aNurseName: 'c君',
408                 projectName: 'xxxxXXxxx',
409                 userId: '111'
410               },
411               {
412                 id: 'a222',
413                 startTime: '2023-12-08 00:15:00',
414                 userName: '李德华',
415                 gender: 1,
583e10 416                 hempStatus: 2,
c1e103 417                 treatRoomStatus: 0,
459990 418                 ciq: '456',
J 419                 adviserName: 'd君',
420                 aDoctorName: 'e君',
421                 aNurseName: 'f君',
422                 projectName: 'xxxxXXxxx',
423                 userId: '222'
424               },
425               {
426                 id: 'a333',
427                 startTime: '2023-12-08 00:20:00',
428                 userName: '猛学友',
429                 gender: 2,
583e10 430                 hempStatus: 2,
c1e103 431                 treatRoomStatus: 0,
459990 432                 ciq: '789',
J 433                 adviserName: 'g君',
434                 aDoctorName: 'h君',
435                 aNurseName: 'i君',
436                 projectName: 'xxxxXXxxx',
437                 userId: '333'
438               }
439             ],
878885 440             occupyInfo: null
J 441           }
6da3c1 442         }
J 443       }).then((res) => {
444         if (res && res.data) {
cf3e3e 445           if (res.data.assignTreatList && res.data.assignTreatList.length) {
J 446             res.data.assignTreatList.forEach((o) => {
583e10 447               // 治疗时间处理
cf3e3e 448               var st = (o.startTime).split(' ')[1].split(':')
J 449               o.startTime = `${st[0]}:${st[1]}`
583e10 450               // 称谓处理
1fa546 451               o.appellationName = o.userName[0] + `${o.gender ? ['女士', '先生', '女士'][o.gender] : '女士'}`
cf3e3e 452             })
J 453           }
12a2f1 454           if (res.data.occupyInfo && res.data.occupyInfo.length) {
J 455             res.data.occupyInfo.forEach((o) => {
456               // 治疗时间处理
457               var st = (o.startTime).split(' ')[1].split(':')
458               o.startTime = `${st[0]}:${st[1]}`
459               // 称谓处理
460               o.appellationName = o.userName[0] + `${o.gender ? ['女士', '先生', '女士'][o.gender] : '女士'}`
461             })
40660a 462           }
12a2f1 463           res.data.occupyInfo && res.data.occupyInfo.length && (isUseDefaultChg = 1)
J 464           res.data.occupyInfo && res.data.occupyInfo.length && (isUseDefault = 1)
6da3c1 465           for (const key in res.data) {
J 466             this[key] = res.data[key]
467           }
468         }
469         // console.log('999999999999999999999999999', res)
583e10 470         // 卸麻弹窗逻辑
df74f0 471         var offNarcosisTimer = null
J 472         offNarcosisTimer = setTimeout(() => {
583e10 473           console.log('================================>判断卸麻弹窗', this.occupyInfoViewArr, 'offNarcosisIds:', this.offNarcosisIds)
J 474           if (this.occupyInfoViewArr && this.occupyInfoViewArr.length && this.offNarcosisIds) {
475             this.occupyInfoViewArr.forEach((o) => {
476               // 判断改用户是否弹出过卸麻弹窗
477               var flag
478               flag = this.offNarcosisIds.find((_o) => { return _o === o.userId })
479               // 状态2且没有弹出过弹窗
480               if (o.hempStatus === 2 && !flag) {
481                 // 弹出对应id弹窗
482                 this.showOffNarcosisNoticeMulti(o.id)
483               }
484             })
df74f0 485           }
J 486           clearTimeout(offNarcosisTimer)
487           offNarcosisTimer = null
488         }, 500)
6da3c1 489       })
aeb317 490     },
J 491     // 返回
492     back() {
34cb2b 493       // 重置默认已使用客人的参数
cf3e3e 494       isUseDefault = false
878885 495       isUseDefaultChg = 0
6da3c1 496       // 关闭计时
aeb317 497       this.stopCountGetTime('detail')
6da3c1 498       // 关闭轮询
aeb317 499       this.stopPollingAjaxFn('detail')
6da3c1 500       // 返回
bf4dca 501       // console.log('111111111', this.$route.meta.isPush)
J 502       if (this.$route && this.$route.meta && this.$route.meta.isPush) {
503         this.$router.go(-1)
504       } else {
505         this.$router.push({
506           path: `/`
507         })
508       }
6da3c1 509     },
cf3e3e 510     // 未有安排直接状态变更
6da3c1 511     statusChg(e) {
J 512       var { tx, status } = e.currentTarget.dataset
583e10 513       // var { occupyInfoView, roomInfo } = this
J 514       console.log('==========================>没有安排时没有客人直接变更状态', tx, status)
6da3c1 515       // if (roomInfo && status * 1 == roomInfo.status) {
J 516       //   return
517       // }
583e10 518       this.changeStatusFn({}, status, () => {
6da3c1 519         this.getData()
J 520       })
521     },
583e10 522     // 没有客人的按流程设置房间状态
6da3c1 523     setStatus(tx, status) {
583e10 524       // var { occupyInfoView, roomInfo } = this
J 525       console.log('============================>有安排没有客人设置房间状态', tx, status)
526       this.changeStatusFn({}, status, () => {
6da3c1 527         // 刷新详情
J 528         this.getData()
529       })
530     },
583e10 531     // 按流程设置房间状态(组件)
459990 532     setComStatus(opt) {
583e10 533       // var { occupyInfoView, roomInfo } = this
J 534       console.log('============================>客人信息组件点击更改状态', opt.tx, opt.status, opt.item)
535       this.changeStatusFn(opt.item, opt.status, () => {
459990 536         // 刷新详情
J 537         this.getData()
538       })
539     },
cf3e3e 540     // 改变房间状态异步方法
6da3c1 541     changeStatusFn(item = {}, status, cb) {
c6d315 542       // 未解锁 20240201 long
L 543       if (this.setStatusLock) {
544         return this.$messageWarn('操作频繁,请稍后再试')
545       }
546       this.setStatusLock = true
547       clearInterval(this.setStatusLockTimer)
548       this.setStatusLockTimer = null
549
6da3c1 550       var params = {}
J 551       // 房间id
552       if (this.id) {
553         params.shopRoomId = this.id
554       }
12a2f1 555       // 治疗记录id this.curTreatIds occupyInfoViewArr
J 556       // 1.使用中/敷麻中 敷麻中 2 人占用
557       // 2.使用中/使用中 使用中 2 人占用
558       // 3.使用中/休息中  使用中 1 人占用
559       var arr = JSON.parse(JSON.stringify(this.occupyInfoViewArr))
6da3c1 560       if (item && item.id) {
12a2f1 561         if (arr && arr.length) {
J 562           arr.forEach((o) => {
563             if (o.id === item.id) {
564               o.treatRoomStatus = status * 1
565             }
566           })
567           // 是否有人使用中
568           var status_1 = arr.find((o) => { return o.treatRoomStatus === 1 })
569           // 是否有客人休息
570           var status_2 = arr.find((o) => { return o.treatRoomStatus === 2 })
571           // 是否有人打扫中
572           var status_3 = arr.find((o) => { return o.treatRoomStatus === 3 })
573           // 是否有人敷麻
574           var status_4 = arr.find((o) => { return o.treatRoomStatus === 4 })
575           // 更改的状态 敷麻中 > 使用中 > 休息中 > 待打扫
576           params.status = status * 1
577           if (status_3) {
578             params.status = 3
579           }
580           if (status_2) {
581             params.status = 2
582           }
583           if (status_1) {
584             params.status = 1
585           }
586           if (status_4) {
587             params.status = 4
588           }
589         }
590
591         // 当前选择客户的数组删除客户
592         this.occupyInfoViewArrDataHandle('cancel', item)
5311b8 593         params.treatRoomList = []
J 594         if (arr && arr.length) {
595           arr.forEach((o) => {
596             params.treatRoomList.push({
597               treatRecordId: o.id,
598               status: o.treatRoomStatus
599             })
600           })
601         }
12a2f1 602       } else {
J 603         // 更改的状态
604         params.status = status * 1
605       }
606
6da3c1 607       Req.http.post({
878885 608         url: 'guide/treat/screen/room/status/update',
6da3c1 609         data: params,
J 610         header: { 'Content-Type': 'application/json' },
611         mockData: {
612           code: 100,
613           msg: '',
614           data: {}
615         }
616       }).then((res) => {
878885 617         // 在已有默认客人的情况下,改变状态更改标识(适配轮询)
J 618         if (isUseDefault) {
34cb2b 619           console.log('在已有默认客人的情况下,改变状态更改标识')
878885 620           isUseDefaultChg = 1
34cb2b 621         }
d73f98 622         // 只要更改为空闲就重置参数
c4b6a2 623         if (params.status === 0) {
583e10 624           console.log('房间更改为空闲')
34cb2b 625           // 重置默认已使用客人的参数
J 626           isUseDefault = false
627           isUseDefaultChg = 0
459990 628           // this.isShowAppellationName = true
878885 629         }
6da3c1 630         // console.log('8888888888888888888888888888888888', res)
J 631         cb && cb()
c6d315 632
L 633         // 30s后解锁 20240201 long
634         this.setStatusLockTimer = setInterval(() => {
635           this.setStatusLock = false
636         }, this.setStatusLockDuration)
637       }, () => {
638         setTimeout(() => {
639           this.setStatusLock = false
640         }, 1000)
6da3c1 641       })
aeb317 642     },
J 643     // 重置状态
644     resetStatus() {
645       // 打开弹窗
646       this.$refs['XioRoomStatusChg'].showDialog()
647     },
cf3e3e 648     // 更改房间状态(重置状态的更改方法)
aeb317 649     changeStatus(opt) {
583e10 650       // var { occupyInfoView, roomInfo } = this
J 651       console.log('============================>重置房间状态', opt.statusTx, opt.status)
6da3c1 652       // if (roomInfo && opt.status * 1 == roomInfo.status) {
J 653       //   return
654       // }
34cb2b 655       // 清除选中医疗记录id
583e10 656       // localStorage.removeItem('curTreatId')
J 657       // this.curTreatId = ''
658       // 清除选中医疗记录ids数组
659       localStorage.removeItem('curTreatIds')
660       this.curTreatIds = ''
661       // 变更房间状态方法
34cb2b 662       this.changeStatusFn({}, opt.status, () => {
6da3c1 663         // 刷新详情
J 664         this.getData()
665         // 关闭弹窗
666         this.$refs['XioRoomStatusChg'].hideDialog()
667       })
aeb317 668     },
J 669     // 选择客户
670     selectCustomer(item = {}) {
34cb2b 671       if (item.act) {
J 672         return
673       }
aeb317 674       // 打开弹窗
J 675       this.$refs['XioCustomerSelect'].showDialog()
6da3c1 676       // 组件客户数据处理
aeb317 677       this.$refs['XioCustomerSelect'].dataInit(item)
J 678     },
679     // 选择客户取消
680     selectCustomerCancel(opt) {
681       console.log('cancel', opt)
682       this.$refs['XioCustomerSelect'].hideDialog()
683     },
684     // 选择客户确定
685     selectCustomerSubmit(opt) {
459990 686       console.log('=======================>submit', opt)
34cb2b 687       // 确定选择的用户,记录id
583e10 688       // localStorage.setItem('curTreatId', opt.id)
J 689       // this.curTreatId = opt.id
690       // 当前选择客户的数组增加客户
691       this.occupyInfoViewArrDataHandle('add', opt)
34cb2b 692       // 重置房间状态
12a2f1 693       // if (this.roomInfo) {
J 694       //   this.changeStatusFn({}, 0, () => {
695       //     // 刷新详情
696       //     this.getData()
697       //   })
698       // }
34cb2b 699       // 关闭弹窗
J 700       this.$refs['XioCustomerSelect'].hideDialog()
583e10 701     },
J 702     // 删除已选择的客户数据
703     cancelCustomerItem(item) {
704       // 当前选择客户的数组删除客户
705       this.occupyInfoViewArrDataHandle('cancel', item, true)
706     },
707     // 当前选择客户的数组增删处理方法
708     occupyInfoViewArrDataHandle(key, item, isReset) {
709       // 增加(选择)
710       if (key === 'add') {
711         // id数组处理
712         if (this.curTreatIds && this.curTreatIds.length) {
713           // 当前治疗记录id没有所选用户的治疗记录id
714           var flag = this.curTreatIds.find((o) => { return o === item.id })
715           if (!flag) {
716             this.curTreatIds.push(item.id)
717           }
718           // 缓存
719           this.setLocalCurTreatIds()
720         }
12a2f1 721         if (this.curTreatIds && !this.curTreatIds.length) {
J 722           this.curTreatIds.push(item.id)
723           // 缓存
724           this.setLocalCurTreatIds()
725         }
583e10 726         // 数组数据处理
J 727         // if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
728         //   this.occupyInfoViewArr.push(item)
729         // }
730       }
731       // 删除
732       if (key === 'cancel') {
733         // id数组处理
734         if (this.curTreatIds && this.curTreatIds.length) {
735           // 深复制
736           var ids = JSON.parse(JSON.stringify(this.curTreatIds))
737           this.curTreatIds = ids.filter((o) => { return o !== item.id })
738           // 缓存
739           this.setLocalCurTreatIds()
740           // 刷新
741           if (isReset) {
742             // 刷新详情
743             this.getData()
744           }
745         }
746         // 数组数据处理
747         // if (this.occupyInfoViewArr && this.occupyInfoViewArr.length) {
748         //   // 深复制
749         //   var arr = JSON.parse(JSON.stringify(this.occupyInfoViewArr))
750         //   this.occupyInfoViewArr = arr.filter((o) => { o.id !== item.id })
751         // }
752       }
459990 753     },
J 754     // 设置本地缓存ids数组
755     setLocalCurTreatIds() {
756       localStorage.setItem('curTreatIds', JSON.stringify(this.curTreatIds))
3ac5f2 757     }
J 758   }
759 }
760 </script>
cf3e3e 761
J 762 <style>
763 .el-popper.top_tx {
764   text-align: center;
765   font-size: 25px;
766 }
767 </style>
3ac5f2 768
J 769 <style scoped>
878885 770 .page{
J 771   overflow: auto;
772 }
459990 773 .page_header_placeholer {
J 774   height: 100px;
908dad 775   width: 100%;
L 776   display: block;
777   flex-shrink: 0;
459990 778 }
J 779 .page_header {
780   position: fixed;
781   top: 0;
782   left: 23px;
783   right: 23px;
784   z-index: 1;
785 }
bb2b08 786 .page_header .reset_btn {
J 787   width: 200px;
788   height: 60px;
789   line-height: 35px;
790   border-radius: 5px;
791   background-color: rgba(47,174,206,1);
792   color: rgba(255,255,255,1);
793   font-size: 24px;
794   text-align: center;
795   font-family: Microsoft Yahei;
6da3c1 796   cursor: pointer;
bf4dca 797   border: 0;
J 798   margin-left: 20px;
459990 799 }
J 800 .page_container.over-width {
801   width: 150%;
bb2b08 802 }
J 803 .page_container .main {
878885 804   /* height: 100%; */
bb2b08 805   border-radius: 10px;
J 806   background-color: rgba(255,255,255,1);
807   color: rgba(16,16,16,1);
808   font-size: 14px;
809   /* text-align: center; */
810   font-family: Roboto;
583e10 811   position: relative;
J 812 }
813 .page_container.over-width .main {
814   margin-right: 50px;
815 }
816 .page_container.over-width .main:last-child {
817   margin-right: 0;
818 }
819 .page_container .main .cancel_icon_block {
820   width: 50px;
821   height: 50px;
822   position: absolute;
823   top: 12px;
824   right: 11px;
825   z-index: 1;
826 }
827 .page_container .main .cancel_icon_block .img {
828   width: 100%;
829   height: 100%;
bb2b08 830 }
J 831 .page_container .main .room_title {
832   line-height: 50px;
833   color: rgba(255,255,255,1);
834   font-size: 36px;
835   text-align: center;
836   font-family: PingFangSC-medium;
837   padding: 10px 0;
838   background-color: rgba(34,123,235,1);
839   width: 400px;
840   margin: 39px auto 0 auto;
841 }
842 .page_container .main .room_main_tip {
843   line-height: 168px;
844   font-size: 120px;
845   color: rgba(46,77,124,1);
846   text-align: center;
847   font-family: PingFangSC-medium;
848   margin-top: 107px;
849   /* font-weight: bold; */
850 }
851 .page_container .main .room_main_tip.gray {
852   color: rgba(154,154,154,1);
853 }
854 .page_container .main .btn_box {
0e11d7 855   /* margin-top: 130px; */
L 856   margin-bottom: 40px;
bb2b08 857 }
J 858 .page_container .main .btn_box__item {
859   width: 250px;
860   height: 120px;
861   border-radius: 10px;
862   box-shadow: 0px 2px 6px 0px rgba(206,206,206,1);
863   margin-right: 70px;
6da3c1 864   cursor: pointer;
bb2b08 865 }
J 866 .page_container .main .btn_box__item:last-child {
867   margin-right: 0;
868 }
869 .page_container .main .btn_box__item.white {
870   background-color: rgba(255,255,255,1);
871 }
872 .page_container .main .btn_box__item.blue {
873   background-color: rgba(46,77,124,1);
874 }
875 .page_container .main .btn_box__item.yellow {
876   background-color: rgba(255,199,115,1);
877 }
878 .page_container .main .btn_box__item.gray {
879   background-color: rgba(206,206,206,1);
880 }
881 .page_container .main .btn_box__item .icon {
882   width: 60px;
883   height: 60px;
884   display: block;
885   margin-right: 17px;
878885 886 }
J 887 .page_container .main .btn_box__item .icon .img {
888   width: 100%;
889   height: 100%;
bb2b08 890 }
J 891 .page_container .main .btn_box__item .tx {
892   line-height: 37px;
893   color: rgba(51,51,51,1);
894   font-size: 26px;
895   text-align: center;
896   font-family: PingFangSC-medium;
897 }
898 .page_container .main .btn_box__item .tx.white {
899   color: rgba(255,255,255,1);
900 }
901 .page_container .main .room_left_btn_box {
902   padding: 0 23px;
903   margin-top: 163px;
904 }
905 .page_container .main .room_left_btn_box__item {
1d1095 906   width: 500px;
J 907   height: 150px;
908   line-height: 73px;
909   border-radius: 10px;
910   font-size: 50px;
911   text-align: center;
912   margin: auto;
913 }
914 .page_container .main .room_left_btn_box__item.flex-1 {
915   width: auto;
bb2b08 916   height: 150px;
J 917   line-height: 58px;
918   border-radius: 10px;
919   font-size: 40px;
920   text-align: center;
921   font-family: Microsoft Yahei;
922   margin-right: 20px;
923   font-weight: bold;
924 }
1d1095 925 /* .page_container .main .room_left_btn_box__item:last-child {
bb2b08 926   margin-right: 0;
1d1095 927 } */
bb2b08 928 .page_container .main .room_left_btn_box__item.yellow {
J 929   color: rgba(255,255,255,1);
930   background-color: rgba(233,157,66,1);
931 }
932 .page_container .main .room_left_btn_box__item.gray {
933   background-color: rgba(206,206,206,1);
934   color: rgba(79,79,79,1);
935 }
936 .page_container .main .room_left_btn_box__item.green {
937   background-color: rgba(47,174,206,1);
938   color: rgba(255,255,255,1);
1d1095 939 }
J 940 .page_container .main .room_left_btn_box__item.b-green {
941   background-color: rgba(79,167,114,1);
942   color: rgba(255,255,255,1);
bb2b08 943 }
J 944 .page_container .main .room_content {
945   margin-top: 30px;
946 }
947 .page_container .main .room_content .tip {
948   line-height: 33px;
949   color: rgba(79,79,79,1);
950   font-size: 24px;
951   text-align: center;
952   font-family: PingFangSC-medium;
953 }
954 .page_container .main .room_content .name {
955   line-height: 168px;
956   color: rgba(51,51,51,1);
957   font-size: 120px;
958   text-align: center;
959   font-family: PingFangSC-medium;
960   margin-top: 13px;
961 }
cf3e3e 962 .page_container .main .room_content .name .tx {
J 963   max-width: 666px;
964   margin: auto;
1fa546 965   text-align: center;
J 966 }
967 .page_container .main .room_content .name_icon {
968   width: 40px;
969   height: 40px;
970   display: block;
971   margin-top: 13px;
972   padding: 20px;
973 }
974 .page_container .main .room_content .name_icon .img {
975   width: 100%;
976   height: 100%;
cf3e3e 977 }
bb2b08 978 .page_container .main .room_content .ciq {
J 979   line-height: 42px;
980   color: rgba(51,51,51,1);
981   font-size: 30px;
982   text-align: center;
983   font-family: PingFangSC-regular;
984   margin-top: -5px;
985 }
986 .page_container .main .room_content .time {
987   line-height: 42px;
988   color: rgba(0,0,0,1);
989   font-size: 30px;
990   text-align: center;
991   font-family: PingFangSC-medium;
992   font-weight: bold;
993   margin-top: 21px;
994 }
995 .page_container .right {
996   width: 686px;
997   margin-left: 30px;
878885 998   /* height: 100%; */
bb2b08 999 }
583e10 1000 .page_container.over-width .right_room_info {
J 1001   margin-bottom: 58px;
1002 }
1003 .page_container.over-width .right_room_info:last-child {
1004   margin-bottom: 0;
1005 }
bb2b08 1006 .page_container .right_block {
J 1007   width: 100%;
1008   height: 100%;
1009 }
459990 1010 .page_container .right_block .guest_box {
J 1011   margin-top: 0;
878885 1012   width: 100%;
J 1013   height: 100%;
459990 1014   -webkit-flex-flow: column;
J 1015   flex-flow: column;
1016   display: box;
1017   display: -webkit-box;      /* OLD - iOS 6-, Safari 3.1-6 */
1018   display: -moz-box;         /* OLD - Firefox 19- (buggy but mostly works) */
1019   display: -ms-flexbox;      /* TWEENER - IE 10 */
1020   display: -webkit-flex;     /* NEW - Chrome */
1021   display: -moz-flex;
1022   display: -ms-flex;
1023   display: -o-flex;
1024   display: flex;
bb2b08 1025 }
J 1026 </style>