qinxianzhangyao
2023-11-30 be330a8520fce4f9010295a8d727461962e76969
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
      }
    },