From be330a8520fce4f9010295a8d727461962e76969 Mon Sep 17 00:00:00 2001
From: qinxianzhangyao <11053546+qinxianzhangyao@user.noreply.gitee.com>
Date: 星期四, 30 十一月 2023 17:57:45 +0800
Subject: [PATCH] qxtj

---
 src/views/doctor/check/index.vue |  152 +++++++++++++++++++++++++++++++++-----------------
 1 files changed, 101 insertions(+), 51 deletions(-)

diff --git a/src/views/doctor/check/index.vue b/src/views/doctor/check/index.vue
index 3e6e008..39ab05f 100644
--- a/src/views/doctor/check/index.vue
+++ b/src/views/doctor/check/index.vue
@@ -60,16 +60,24 @@
 
     <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
       <el-row>
-        <el-col :span="7" v-if="hzlogList.length >= 1">
+        <el-col :span="9" v-if="hzlogList.length >= 1">
           <h3>浼氳瘖鐢宠璁板綍</h3>
           <el-table :data="hzlogList" style="width: 100%" border>
             <el-table-column label="鐢宠浜�" align="center" prop="hzDoctorName" width="100px" />
-            <el-table-column label="绉戝" align="center" prop="hzDeptName" width="260px" />
+            <el-table-column label="绉戝" align="center" prop="hzDeptName" />
+            <el-table-column label="鎿嶄綔" align="center" width="150px">
+              <template slot-scope="scope">
+                <el-button type="primary" size="mini" @click="hadleedit(scope.row)"
+                  v-if="scope.row.hzReplyLogsList.length == 0 && scope.row.hzDoctorId == info.userId">淇敼</el-button>
+                <el-button type="primary" size="mini"
+                  v-if="scope.row.hzReplyLogsList.length == 0 && scope.row.hzDoctorId == info.userId"
+                  @click="handledele(scope.row)">鍒犻櫎</el-button>
+              </template>
+            </el-table-column>
           </el-table>
         </el-col>
-        <el-col :span="16">
-          <!-- :rules="rules" -->
-          <el-form ref="form" :model="form" label-width="80px">
+        <el-col :span="14">
+          <el-form ref="form" :model="form" :rules="rules" label-width="80px">
             <el-form-item label="濮撳悕" prop="cusName">
               <el-input v-model="form.cusName" placeholder="璇疯緭鍏ュ鍚�" disabled />
             </el-form-item>
@@ -365,7 +373,7 @@
 import {
   addReplylog, hzHasDept
 } from "@/api/hosp/replylog";
-import { listHzlog, addHzlog } from "@/api/hosp/hzlog";
+import { listHzlog, addHzlog, delHzlog,updateHzlog  } from "@/api/hosp/hzlog";
 import { listUser } from "@/api/system/user";
 import { getChildList } from "@/api/system/dept";
 export default {
@@ -387,6 +395,7 @@
       // proDefault: "",
       // dataList: [],
       rows: [],
+      id: [],
       deptAdviceList: [],
       value: [],
       remark: "", //澶囨敞
@@ -404,6 +413,7 @@
       deptList: [],
       tableAll: {},
       row: {},
+      info: {},
       allList: [],
       form: {
         createTime: new Date()
@@ -448,6 +458,11 @@
         type: "",
         name: null,
       },
+      rules: {
+        hzType: [
+          { required: true, message: '璇烽�夋嫨绉戝', trigger: 'change' }
+        ]
+      }
     };
   },
 
@@ -484,7 +499,7 @@
         }
       );
       getInfo().then((response) => {
-        this.form.hzDoctorId = response.user.userId;
+        this.info = response.user
         this.deptId = response.user.deptId;
         this.userId = response.user.userId;
         this.nickName = response.user.nickName;
@@ -628,10 +643,10 @@
     Changeapplyfor(row) {
       this.open = true;
       this.form = row
+      this.form.hzDoctorId = this.info.userId;
       getChildList().then(res => {
         this.deptList = res.data;
       })
-
       this.Hzlog(this.form.tjNumber)
     },
 
@@ -657,50 +672,84 @@
         })
       });
     },
+    handledele(row) {
+      this.id = []
+      this.id.push(row.id)
+      delHzlog(this.id).then(res => {
+        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+        this.Hzlog(this.form.tjNumber)
+      })
+    },
+
+    hadleedit(row) {
+      this.form.hzType = row.hzType
+      this.form.id = row.id
+    },
 
     submitFormapply() {
+      console.log(this.form)
       let data = {}
       this.userList.forEach(item1 => {
         if (this.form.hzDoctorId == item1.userId) {
           this.form.hzDoctorName = item1.nickName
         }
       })
-      if (this.form.hzDeptId) {
-        // let hzDeptId = ""
-        // this.form.hzDeptId.forEach(item => {
-        //   hzDeptId += item + ','
-        // })
-        data = {
-          tjNumber: this.form.tjNumber,
-          userId: this.form.cusId,
-          userName: this.form.cusName,
-          hzDeptIdList: this.form.hzDeptId,
-          hzDoctorId: this.form.hzDoctorId,
-          hzType: this.form.hzType,
-          orderId: this.form.orderId,
-          hzDoctorName: this.form.hzDoctorName
+      if (this.form.hzType != undefined) {
+        if (this.form.hzDeptId && this.form.id) {
+          // let hzDeptId = ""
+          // this.form.hzDeptId.forEach(item => {
+          //   hzDeptId += item + ','
+          // })
+          data = {
+            tjNumber: this.form.tjNumber,
+            userId: this.form.cusId,
+            userName: this.form.cusName,
+            hzDeptIdList: this.form.hzDeptId,
+            hzDoctorId: this.form.hzDoctorId,
+            hzType: this.form.hzType,
+            orderId: this.form.orderId,
+            hzDoctorName: this.form.hzDoctorName,
+            id:this.form.id
+          }
+        } else {
+          data = {
+            tjNumber: this.form.tjNumber,
+            userId: this.form.cusId,
+            userName: this.form.cusName,
+            hzDoctorId: this.form.hzDoctorId,
+            hzType: this.form.hzType,
+            orderId: this.form.orderId,
+            hzDoctorName: this.form.hzDoctorName
+          }
         }
+        this.$refs["form"].validate((valid) => {
+          if (valid) {
+            if (this.form.id != null) {
+              updateHzlog(data).then(res => {
+                if (res.code == 200) {
+                  this.$modal.msgSuccess("淇敼鎴愬姛");
+                  this.form = {}
+                  this.Hzlog()
+                  this.radioChange(1)
+                }
+              })
+            } else {
+              addHzlog(data).then(res => {
+                if (res.code == 200) {
+                  this.$modal.msgSuccess("鐢宠鎴愬姛");
+                  this.form = {}
+                  this.Hzlog()
+                  this.radioChange(1)
+                }
+              })
+              this.open = false;
+            }
+          }
+        })
       } else {
-        data = {
-          tjNumber: this.form.tjNumber,
-          userId: this.form.cusId,
-          userName: this.form.cusName,
-          hzDoctorId: this.form.hzDoctorId,
-          hzType: this.form.hzType,
-          orderId: this.form.orderId,
-          hzDoctorName: this.form.hzDoctorName
-        }
+        this.$modal.msgError("璇烽�夋嫨浼氳瘖绉戝");
       }
 
-      addHzlog(data).then(res => {
-        if (res.code == 200) {
-          this.$modal.msgSuccess("鐢宠鎴愬姛");
-          this.form = {}
-          this.Hzlog()
-          this.radioChange(1)
-        }
-      })
-      this.open = false;
     },
     cancel() {
       this.open = false;
@@ -746,20 +795,21 @@
             return false;
           }
         });
-      //   this.allList = []
-      //   if(newRows[0].hzReplyLogsList){
-      //     this.hzReplyLogsList = newRows[0].hzReplyLogsList  
-      //   }
-      //  console.log(this.hzReplyLogsList)
-      //   this.allList = newRows
-      }else{
+        //   this.allList = []
+        //   if(newRows[0].hzReplyLogsList){
+        //     this.hzReplyLogsList = newRows[0].hzReplyLogsList  
+        //   }
+        //  console.log(this.hzReplyLogsList)
+        //   this.allList = newRows
+      } else {
         this.allList = []
-        if(selection[0].hzReplyLogsList){
-          this.hzReplyLogsList = selection[0].hzReplyLogsList  
-        }else{
+        if (selection[0]) {
+          if (selection[0].hzReplyLogsList) {
+            this.hzReplyLogsList = selection[0].hzReplyLogsList
+          }
+        } else {
           this.hzReplyLogsList = []
         }
-       console.log(this.hzReplyLogsList)
         this.allList = selection
       }
     },

--
Gitblit v1.8.0