From 6da3c1365a9f54c043a4ec2547163b1226e11412 Mon Sep 17 00:00:00 2001
From: jazz <jazzxhunter@163.com>
Date: 星期三, 06 十二月 2023 20:01:51 +0800
Subject: [PATCH] update_202312052001_项目-治疗室屏幕web-切图接口对接v2

---
 src/pages/room/detail.vue |  225 +++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 174 insertions(+), 51 deletions(-)

diff --git a/src/pages/room/detail.vue b/src/pages/room/detail.vue
index e0101a0..fec7abc 100644
--- a/src/pages/room/detail.vue
+++ b/src/pages/room/detail.vue
@@ -1,8 +1,8 @@
 <!--room-detail.vue-->
 <template>
   <div class="page">
-    <div class="page_header flex flex-ver" @click="back">
-      <div class="left flex flex-ver">
+    <div class="page_header flex flex-ver">
+      <div class="left flex flex-ver" @click="back">
         <img class="page_logo_1" src="../../assets/img/logo_1.png">
         <img class="page_logo_2" src="../../assets/img/logo_2.png">
       </div>
@@ -17,31 +17,31 @@
       </div>
     </div>
     <!-- 鏈湁瀹夋帓 -->
-    <div class="page_container flex flex-ver hide">
+    <div v-if="!occupyInfoView && (!assignTreatList || !assignTreatList.length)" class="page_container flex flex-ver">
       <div class="main flex-1">
-        <div class="room_title">VIP-璇婄枟瀹�-1</div>
-        <div class="room_main_tip" style="margin-top: 93px;line-height: 186px;font-size: 140px;">-浣跨敤涓�-</div>
+        <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="btn_box flex flex-center">
           <div class="flex flex-ver">
-            <div class="btn_box__item flex flex-center white" data-tx="绌洪棽">
+            <div class="btn_box__item flex flex-center white" data-tx="绌洪棽" data-status="0" @click="statusChg">
               <div class="flex flex-ver">
                 <img class="icon" src="../../assets/img/free.png">
                 <div class="tx">绌洪棽</div>
               </div>
             </div>
-            <div class="btn_box__item flex flex-center blue" data-tx="浣跨敤涓�">
+            <div class="btn_box__item flex flex-center blue" data-tx="浣跨敤涓�" data-status="1" @click="statusChg">
               <div class="flex flex-ver">
                 <img class="icon" src="../../assets/img/using.png">
                 <div class="tx white">浣跨敤涓�</div>
               </div>
             </div>
-            <div class="btn_box__item flex flex-center yellow" data-tx="瀹汉浼戞伅">
+            <div class="btn_box__item flex flex-center yellow" data-tx="瀹汉浼戞伅" data-status="2" @click="statusChg">
               <div class="flex flex-ver">
                 <img class="icon" src="../../assets/img/rest.png">
                 <div class="tx">瀹汉浼戞伅</div>
               </div>
             </div>
-            <div class="btn_box__item flex flex-center gray" data-tx="閫氱煡鎵撴壂">
+            <div class="btn_box__item flex flex-center gray" data-tx="閫氱煡鎵撴壂" data-status="3" @click="statusChg">
               <div class="flex flex-ver">
                 <img class="icon" src="../../assets/img/clear.png">
                 <div class="tx">閫氱煡鎵撴壂</div>
@@ -51,16 +51,16 @@
         </div>
       </div>
     </div>
-    <!-- 娌℃湁榛樿瀹汉鍜屾湁瀹夋帓 -->
-    <div class="page_container flex flex-ver hide">
+    <!-- 娌℃湁瀹汉鍜屾湁瀹夋帓 -->
+    <div v-if="!occupyInfoView && (assignTreatList && assignTreatList.length)" class="page_container flex flex-ver">
       <div class="main flex-1">
-        <div class="room_title">VIP-璇婄枟瀹�-1</div>
-        <div class="room_main_tip">-浣跨敤涓�-</div>
-        <div class="room_left_btn_box flex flex-ver">
-          <div class="room_left_btn_box__item flex-1 flex flex-center yellow">瀹汉浼戞伅</div>
-          <div class="room_left_btn_box__item flex-1 flex flex-center gray">閫氱煡鎵撴壂</div>
-          <!-- <div class="room_left_btn_box__item flex flex-center green">閫氱煡鎵撴壂</div> -->
-          <!-- <div class="room_left_btn_box__item flex flex-center green">缁撴潫鎵撴壂</div> -->
+        <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
+        <div v-if="roomInfo" class="room_main_tip">-{{ statusTx[roomInfo.status] }}-</div>
+        <div v-if="roomInfo && roomInfo.status >= 1" class="room_left_btn_box flex flex-ver">
+          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center yellow" @click="setStatus('瀹汉浼戞伅', 2)">瀹汉浼戞伅</div>
+          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center gray" @click="setStatus('鎵撴壂涓�', 3)">閫氱煡鎵撴壂</div>
+          <div v-if="roomInfo.status == 2" class="room_left_btn_box__item flex flex-center green" @click="setStatus('鎵撴壂涓�', 3)">閫氱煡鎵撴壂</div>
+          <div v-if="roomInfo.status == 3" class="room_left_btn_box__item flex flex-center green" @click="setStatus('绌洪棽', 0)">缁撴潫鎵撴壂</div>
         </div>
       </div>
       <div class="right">
@@ -68,18 +68,18 @@
           <div class="guest_title flex flex-center">绛夊緟璇婄枟</div>
           <div class="guest_block flex-1">
             <div class="guest_list">
-              <div v-for="(item, index) in list" :key="index" class="guest_list__row flex flex-ver" @click="selectCustomer">
+              <div v-for="(item, index) in assignTreatList" :key="index" class="guest_list__row flex flex-ver" @click="selectCustomer(item)">
                 <div class="guest_list__td flex flex-center">
                   <div>
-                    <div class="tx">寮�*姘�</div>
-                    <div class="tx" style="font-size: 14px;line-height: 20px;">2300000000</div>
+                    <div class="tx">{{ item.userName }}</div>
+                    <div class="tx" style="font-size: 14px;line-height: 20px;">{{ item.ciq || '' }}</div>
                   </div>
                 </div>
                 <div class="guest_list__td flex flex-center">
-                  <span class="tx">15:00寮�濮�</span>
+                  <span class="tx">{{ item.startTime?item.startTime+'寮�濮�':'' }}</span>
                 </div>
                 <div class="guest_list__td flex flex-center">
-                  <span class="tx">寮犳��姘�(鍖荤敓)銆佸紶鎬�姘�(鎶ゅ+)</span>
+                  <span class="tx">{{ item.aDoctorName?item.aDoctorName+'(鍖荤敓)銆�':'' }}{{ item.aNurseName?item.aNurseName+'(鎶ゅ+)':'' }}</span>
                 </div>
                 <div class="guest_list__td flex flex-center">
                   <img class="icon" src="../../assets/img/choose.png">
@@ -90,22 +90,22 @@
         </div>
       </div>
     </div>
-    <!-- 榛樿瀹汉鍜屾湁瀹夋帓 -->
-    <div class="page_container flex flex-ver">
+    <!-- 瀹汉鍜屾湁瀹夋帓 -->
+    <div v-if="occupyInfoView && (assignTreatList && assignTreatList.length)" class="page_container flex flex-ver">
       <div class="main flex-1">
-        <div class="room_title">VIP-璇婄枟瀹�-1</div>
+        <div v-if="roomInfo && roomInfo.roomNo" class="room_title">{{ roomInfo.roomNo }}</div>
         <div class="room_content">
           <div class="tip">璇婄枟瀹夋帓</div>
-          <div class="name">寮犳��姘�</div>
-          <div class="ciq">(2300000000)</div>
-          <div class="time">瀹夋帓娌荤枟鏃堕棿锛�13:30 寮�濮�</div>
+          <div class="name">{{ occupyInfoView.userName }}</div>
+          <div v-if="occupyInfoView.ciq" class="ciq">({{ occupyInfoView.ciq }})</div>
+          <div v-if="occupyInfoView.startTime" class="time">瀹夋帓娌荤枟鏃堕棿锛歿{ occupyInfoView.startTime }} 寮�濮�</div>
         </div>
-        <div class="room_left_btn_box flex flex-ver" style="margin-top: 105px;">
-          <div class="room_left_btn_box__item flex flex-center green btn_ani">寮�濮嬫不鐤�</div>
-          <!-- <div class="room_left_btn_box__item flex-1 flex flex-center yellow">瀹汉浼戞伅</div>
-          <div class="room_left_btn_box__item flex-1 flex flex-center gray">閫氱煡鎵撴壂</div> -->
-          <!-- <div class="room_left_btn_box__item flex flex-center green">閫氱煡鎵撴壂</div> -->
-          <!-- <div class="room_left_btn_box__item flex flex-center green">缁撴潫鎵撴壂</div> -->
+        <div v-if="roomInfo" class="room_left_btn_box flex flex-ver" style="margin-top: 105px;">
+          <div v-if="roomInfo.status == 0" class="room_left_btn_box__item flex flex-center green btn_ani" @click="setStatus('浣跨敤涓�', 1)">寮�濮嬫不鐤�</div>
+          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center yellow" @click="setStatus('瀹汉浼戞伅', 2)">瀹汉浼戞伅</div>
+          <div v-if="roomInfo.status == 1" class="room_left_btn_box__item flex-1 flex flex-center gray" @click="setStatus('鎵撴壂涓�', 3)">閫氱煡鎵撴壂</div>
+          <div v-if="roomInfo.status == 2" class="room_left_btn_box__item flex flex-center green" @click="setStatus('鎵撴壂涓�', 3)">閫氱煡鎵撴壂</div>
+          <div v-if="roomInfo.status == 3" class="room_left_btn_box__item flex flex-center green" @click="setStatus('绌洪棽', 0)">缁撴潫鎵撴壂</div>
         </div>
       </div>
       <div class="right flex flex-col">
@@ -114,25 +114,25 @@
             <div class="staff_box_item flex-1 flex flex-center">
               <div>
                 <div class="staff_box_item__title">鍒嗚瘖椤鹃棶</div>
-                <div class="staff_box_item__name">寮犳��姘�</div>
+                <div class="staff_box_item__name">{{ occupyInfoView.adviserName || '' }}</div>
               </div>
             </div>
             <div class="staff_box_item flex-1 flex flex-center">
               <div>
                 <div class="staff_box_item__title">鎵ц鍖荤敓</div>
-                <div class="staff_box_item__name">寮犲尰鐢�</div>
+                <div class="staff_box_item__name">{{ occupyInfoView.aDoctorName || '' }}</div>
               </div>
             </div>
             <div class="staff_box_item flex-1 flex flex-center">
               <div>
                 <div class="staff_box_item__title">鎵ц鎶ゅ+</div>
-                <div class="staff_box_item__name">寮犳姢澹�</div>
+                <div class="staff_box_item__name">{{ occupyInfoView.aNurseName || '' }}</div>
               </div>
             </div>
           </div>
           <div class="room_info_project">
             <div class="room_info_project_block">
-              <div class="tx">phis-Fotona 瓒匳鍏夈�乸his-琛ユ按瀚╄偆(F)娑傛姽</div>
+              <div class="tx">{{ occupyInfoView.projectName || '' }}</div>
             </div>
           </div>
         </div>
@@ -140,18 +140,18 @@
           <div class="guest_title flex flex-center">绛夊緟璇婄枟</div>
           <div class="guest_block flex-1">
             <div class="guest_list">
-              <div v-for="(item, index) in list" :key="index" class="guest_list__row flex flex-ver" @click="selectCustomer">
+              <div v-for="(item, index) in assignTreatList" :key="index" class="guest_list__row flex flex-ver" @click="selectCustomer(item)">
                 <div class="guest_list__td flex flex-center">
                   <div>
-                    <div class="tx">寮�*姘�</div>
-                    <div class="tx" style="font-size: 14px;line-height: 20px;">2300000000</div>
+                    <div class="tx">{{ item.userName }}</div>
+                    <div class="tx" style="font-size: 14px;line-height: 20px;">{{ item.ciq || '' }}</div>
                   </div>
                 </div>
                 <div class="guest_list__td flex flex-center">
-                  <span class="tx">15:00寮�濮�</span>
+                  <span class="tx">{{ item.startTime?item.startTime+'寮�濮�':'' }}</span>
                 </div>
                 <div class="guest_list__td flex flex-center">
-                  <span class="tx">寮犳��姘�(鍖荤敓)銆佸紶鎬�姘�(鎶ゅ+)</span>
+                  <span class="tx">{{ item.aDoctorName?item.aDoctorName+'(鍖荤敓)銆�':'' }}{{ item.aNurseName?item.aNurseName+'(鎶ゅ+)':'' }}</span>
                 </div>
                 <div class="guest_list__td flex flex-center">
                   <img class="icon" src="../../assets/img/choose.png">
@@ -170,11 +170,17 @@
 </template>
 
 <script>
+// 绌洪棽 0
+// 浣跨敤涓� 1
+// 瀹汉浼戞伅 2
+// 寰呮墦鎵�/閫氱煡鎵撴壂 3
 // import Login from '../utils/jun_login.js'
 // 閫夋嫨瀹汉寮圭獥
 import XioCustomerSelect from '@/components/xio_customer_select'
 // 鏇存敼鎴块棿鐘舵�佺獥
 import XioRoomStatusChg from '@/components/xio_room_status_chg'
+import Req from '../../utils/jun_httpInstall' // http 璇锋眰
+var isUseDefault = false // 鏄惁宸蹭娇鐢ㄩ粯璁ゅ浜�
 export default {
   name: 'RoomDetail',
   components: {
@@ -184,12 +190,31 @@
   inject: ['noop'],
   data() {
     return {
-      list: ['', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', ''],
-      timeObj: {}// week锛氭槦鏈燂紝date锛氬勾鏈堟棩锛宼imeMin锛氭椂鍒嗭紝time锛氭椂鍒嗙锛宼imeStamp锛氭椂闂存埑
+      id: this.$route.query.id || '',
+      roomInfo: {},
+      occupyInfo: '', // 褰撳墠鍗犵敤浜虹殑淇℃伅
+      assignTreatList: [],
+      statusTx: ['绌洪棽', '浣跨敤涓�', '瀹汉浼戞伅', '鎵撴壂涓�'],
+      timeObj: {} // week锛氭槦鏈燂紝date锛氬勾鏈堟棩锛宼imeMin锛氭椂鍒嗭紝time锛氭椂鍒嗙锛宼imeStamp锛氭椂闂存埑
     }
   },
   computed: {
-
+    occupyInfoView() {
+      // 鏈夊崰鐢�
+      if (this.occupyInfo) {
+        return this.occupyInfo
+      // 娌℃湁鍗犵敤
+      } else {
+        // 娌′娇鐢ㄩ粯璁ゅ浜哄��
+        if (!isUseDefault && this.assignTreatList && this.assignTreatList.length) {
+          isUseDefault = true
+          return this.assignTreatList[0]
+        // 宸蹭娇鐢ㄨ繃榛樿瀹汉鍊�
+        } else {
+          return ''
+        }
+      }
+    }
   },
   mounted() {
     console.log('roomDetail mounted')
@@ -200,13 +225,95 @@
   },
   methods: {
     init() {
+      // 璁℃椂
       this.countGetTime(this, 'timeObj', 'detail')
+      // 杞getData锛�8绉掍竴娆�
+      this.pollingAjaxFn(this, 'getData', 'detail', 8000)
+      // this.getData()
+    },
+    // 鑾峰彇鎴块棿璇︽儏
+    getData() {
+      var params = {}
+      // 鎴块棿id
+      if (this.id) {
+        params.shopRoomId = this.id
+      }
+      Req.http.post({
+        url: 'treat/screen/room/info',
+        data: params,
+        udData: { noLoading: true },
+        header: { 'Content-Type': 'application/json' },
+        mockData: {
+          code: 100,
+          msg: '',
+          data: {}
+        }
+      }).then((res) => {
+        if (res && res.data) {
+          for (const key in res.data) {
+            this[key] = res.data[key]
+          }
+        }
+        // console.log('999999999999999999999999999', res)
+      })
     },
     // 杩斿洖
     back() {
+      // 鍏抽棴璁℃椂
       this.stopCountGetTime('detail')
+      // 鍏抽棴杞
       this.stopPollingAjaxFn('detail')
+      // 杩斿洖
       this.$router.go(-1)
+    },
+    // 鐩存帴鐘舵�佸彉鏇�
+    statusChg(e) {
+      var { tx, status } = e.currentTarget.dataset
+      var { occupyInfoView, roomInfo } = this
+      console.log(tx, status)
+      // if (roomInfo && status * 1 == roomInfo.status) {
+      //   return
+      // }
+      this.changeStatusFn(occupyInfoView, status, () => {
+        this.getData()
+      })
+    },
+    // 鎸夋祦绋嬭缃埧闂寸姸鎬�
+    setStatus(tx, status) {
+      var { occupyInfoView, roomInfo } = this
+      console.log(tx, status)
+      this.changeStatusFn(occupyInfoView, status, () => {
+        // 鍒锋柊璇︽儏
+        this.getData()
+      })
+    },
+    // 鏀瑰彉鎴块棿鐘舵�佸紓姝�
+    changeStatusFn(item = {}, status, cb) {
+      var params = {}
+      // 鐘舵��
+      // 鎴块棿id
+      if (this.id) {
+        params.shopRoomId = this.id
+      }
+      // 鏇存敼鐨勭姸鎬�
+      params.status = status * 1
+      // 娌荤枟璁板綍id
+      if (item && item.id) {
+        params.vAssignTreatId = item.id
+      }
+      Req.http.post({
+        url: 'treat/screen/room/status/update',
+        data: params,
+        header: { 'Content-Type': 'application/json' },
+        mockData: {
+          code: 100,
+          msg: '',
+          data: {}
+        }
+      }).then((res) => {
+        // console.log('8888888888888888888888888888888888', res)
+        cb && cb()
+      })
     },
     // 閲嶇疆鐘舵��
     resetStatus() {
@@ -215,14 +322,23 @@
     },
     // 鏇存敼鎴块棿鐘舵��
     changeStatus(opt) {
-      console.log(opt.statusTx)
-      // 鍏抽棴寮圭獥
-      this.$refs['XioRoomStatusChg'].hideDialog()
+      var { occupyInfoView, roomInfo } = this
+      console.log(opt.statusTx, opt.status)
+      // if (roomInfo && opt.status * 1 == roomInfo.status) {
+      //   return
+      // }
+      this.changeStatusFn(occupyInfoView, opt.status, () => {
+        // 鍒锋柊璇︽儏
+        this.getData()
+        // 鍏抽棴寮圭獥
+        this.$refs['XioRoomStatusChg'].hideDialog()
+      })
     },
     // 閫夋嫨瀹㈡埛
     selectCustomer(item = {}) {
       // 鎵撳紑寮圭獥
       this.$refs['XioCustomerSelect'].showDialog()
+      // 缁勪欢瀹㈡埛鏁版嵁澶勭悊
       this.$refs['XioCustomerSelect'].dataInit(item)
     },
     // 閫夋嫨瀹㈡埛鍙栨秷
@@ -233,7 +349,12 @@
     // 閫夋嫨瀹㈡埛纭畾
     selectCustomerSubmit(opt) {
       console.log('submit', opt)
-      this.$refs['XioCustomerSelect'].hideDialog()
+      this.changeStatusFn(opt, 1, () => {
+        // 鍒锋柊璇︽儏
+        this.getData()
+        // 鍏抽棴寮圭獥
+        this.$refs['XioCustomerSelect'].hideDialog()
+      })
     }
   }
 }
@@ -250,6 +371,7 @@
   font-size: 24px;
   text-align: center;
   font-family: Microsoft Yahei;
+  cursor: pointer;
 }
 .page_container .main {
   height: 100%;
@@ -292,6 +414,7 @@
   border-radius: 10px;
   box-shadow: 0px 2px 6px 0px rgba(206,206,206,1);
   margin-right: 70px;
+  cursor: pointer;
 }
 .page_container .main .btn_box__item:last-child {
   margin-right: 0;

--
Gitblit v1.8.0