浏览代码

手术安排需要权限

lighter 2 年之前
父节点
当前提交
45b9f69c6d
共有 1 个文件被更改,包括 36 次插入8 次删除
  1. 36 8
      src/views/surgical-management/SurgeryArrangement.vue

+ 36 - 8
src/views/surgical-management/SurgeryArrangement.vue

@@ -43,7 +43,8 @@
         <el-table-column label="送出时间" prop="applyDate"></el-table-column>
         <el-table-column label="手术间" prop="roomName" width="80">
           <template #default="scope">
-            <el-select v-model="scope.row.roomCode" @change="(roomCode) => handleArrangementChange(scope.row.recordId, 'room_code', roomCode)">
+            <el-select v-model="scope.row.roomCode" @focus="handleSelectionFocus(scope.row, 'roomCode')"
+                       @change="(roomCode) => handleSelectionChange(scope.row.recordId, 'room_code', roomCode)">
               <el-option v-for="item in allRooms" :value="item.code" :label="item.name" :disabled="item.statusFlag === 2"></el-option>
             </el-select>
           </template>
@@ -64,14 +65,16 @@
         </el-table-column>
         <el-table-column label="器械护士" width="60">
           <template #default="scope">
-            <el-select v-model="scope.row.nurseQx" filterable @change="(nurseQx) => handleArrangementChange(scope.row.recordId, 'nurse_qx', nurseQx)">
+            <el-select v-model="scope.row.nurseQx" filterable @focus="handleSelectionFocus(scope.row, 'nurseQx')"
+                       @change="(nurseQx) => handleSelectionChange(scope.row.recordId, 'nurse_qx', nurseQx)">
               <el-option v-for="item in allStaffs" :value="item.code" :label="item.name"></el-option>
             </el-select>
           </template>
         </el-table-column>
         <el-table-column label="巡回护士" width="60">
           <template #default="scope">
-            <el-select v-model="scope.row.nurseXh" filterable @change="(nurseXh) => handleArrangementChange(scope.row.recordId, 'nurse_xh', nurseXh)">
+            <el-select v-model="scope.row.nurseXh" filterable @focus="handleSelectionFocus(scope.row, 'nurseXh')"
+                       @change="(nurseXh) => handleSelectionChange(scope.row.recordId, 'nurse_xh', nurseXh)">
               <el-option v-for="item in allStaffs" :value="item.code" :label="item.name"></el-option>
             </el-select>
           </template>
@@ -108,7 +111,8 @@
         </el-table-column>
         <el-table-column label="体外标志">
           <template #default="scope">
-            <el-select v-model="scope.row.twFlag"  @change="(twFlag) => handleArrangementChange(scope.row.recordId, 'tw_flag', twFlag)">
+            <el-select v-model="scope.row.twFlag" @focus="handleSelectionFocus(scope.row, 'twFlag')"
+                       @change="(twFlag) => handleSelectionChange(scope.row.recordId, 'tw_flag', twFlag)">
               <el-option label="否" value="0"></el-option>
               <el-option label="是" value="1"></el-option>
             </el-select>
@@ -251,14 +255,38 @@ const beforeSearch = (row) => {
   showSearch = true
 }
 const handleClickSearchResult = (item) => {
-  currentRow.doctorZd = item.code
-  currentRow.doctorZdName = item.name
   showSearch = false
-  handleArrangementChange(currentRow.recordId, currentKey, item.code)
+  handleArrangementChange(currentRow.recordId, currentKey, item.code).then(() => {
+    currentRow.doctorZd = item.code
+    currentRow.doctorZdName = item.name
+  })
+}
+
+const oldSelection = reactive({
+  key: '',
+  val: ''
+})
+const handleSelectionFocus = (row, key) => {
+  currentRow = row
+  oldSelection.key = key
+  oldSelection.val = row[key]
+}
+
+const handleSelectionChange = (orderId, key, value) => {
+  handleArrangementChange(orderId, key, value).then(() => {
+  }).catch(() => {
+    currentRow[oldSelection.key] = oldSelection.val
+  })
 }
 
 const handleArrangementChange = (orderId, key, value) => {
-  updateArrangement(orderId, key, value)
+  return new Promise((resolve, reject) => {
+    updateArrangement(orderId, key, value).then(() => {
+      resolve()
+    }).catch(() => {
+      reject()
+    })
+  })
 }
 
 const doctorAdvise = (row) => {