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