Browse Source

婴儿信息编辑

LIJU 2 months ago
parent
commit
39f96b945c

+ 8 - 0
src/api/medical-advice/patient-info.js

@@ -146,6 +146,14 @@ export function saveBabyInfo(data) {
     })
 }
 
+export function editBabyInfo(data) {
+    return request({
+        url: '/medicalAdvice/addBabyInfo/editBabyInfo',
+        method: 'post',
+        data,
+    })
+}
+
 /**
  * 查询待转科列表
  * @param data

+ 35 - 4
src/views/medical-advice/patient-info/AddBabyInfo.vue

@@ -61,6 +61,7 @@
                <el-table-column  property="birthOrder" label="出生顺序" />
                <el-table-column label="操作">
                  <template #default="scope">
+                   <el-button  icon="Edit" type="primary" @click="openEdit(scope.row)">编辑</el-button>
                    <el-button  icon="Delete" type="danger" @click="delBaBy(scope.$index,scope.row)">删除</el-button>
                  </template>
                </el-table-column>
@@ -69,7 +70,7 @@
          </div>
       </el-main>
     </el-container>
-  <el-dialog v-model="editBabyDialog" title="增加婴儿信息" width="400">
+  <el-dialog v-model="editBabyDialog" :title="dialogTitle" width="400">
     <el-form :model="editBaByInfo">
       <el-form-item label="性别" >
         <el-select v-model="editBaByInfo.sex">
@@ -90,7 +91,7 @@
     <template #footer>
       <span class="dialog-footer">
         <el-button type="danger" @click="editBabyDialog = false">取消</el-button>
-        <el-button type="success"  @click="saveData"> 保存</el-button>
+        <el-button type="success"  @click="onSubmit"> 保存</el-button>
       </span>
     </template>
   </el-dialog>
@@ -100,7 +101,7 @@
 import {onMounted, ref, defineAsyncComponent} from "vue";
 import {getAllWards} from "@/api/zhu-yuan-yi-sheng/resident-doctor";
 import {getPatientBaseInfo,queryPatientInfo} from "@/api/medical-advice/medical-advice-management";
-import {queryBabyInfo,deleteBaby,saveBabyInfo} from "@/api/medical-advice/patient-info";
+import {queryBabyInfo,deleteBaby,saveBabyInfo,editBabyInfo} from "@/api/medical-advice/patient-info";
 import {ElMessageBox} from "element-plus";
 
 // 异步导入PatientInfo组件
@@ -148,6 +149,10 @@ const editBaByInfo = ref<EditBabyInfoType>({
   babyBirthHeight:'', // 新增:婴儿出生身高
 })
 
+const editBabyDialog  = ref(false)
+const dialogTitle = ref('增加婴儿信息')
+const isEdit = ref(false)
+
 const saveData=()=>{
   editBaByInfo.value.name = patientInfo.value.name
   editBaByInfo.value.inpatientNo= queryParam.value.inpatientNo
@@ -159,7 +164,16 @@ const saveData=()=>{
   })
 }
 
-const editBabyDialog  = ref(false)
+const onSubmit = ()=>{
+  if(isEdit.value){
+    editBabyInfo(editBaByInfo.value).then(()=>{
+      editBabyDialog.value = false
+      queryBaby()
+    })
+  }else{
+    saveData()
+  }
+}
 
 const visible = ref<boolean>(false)
 const patList  =ref([])
@@ -178,8 +192,25 @@ const queryBaby=()=>{
 }
 
 const addBaby = ()=>{
+   dialogTitle.value = '增加婴儿信息'
+   isEdit.value = false
+   Object.assign(editBaByInfo.value,{name:'',inpatientNo:'',sex:'',birthDate:'',birthDateTime:'',babyBirthWeight:'',babyBirthHeight:''})
    editBabyDialog.value = true
 }
+const openEdit = (row)=>{
+  dialogTitle.value = '编辑婴儿信息'
+  isEdit.value = true
+  Object.assign(editBaByInfo.value,{
+    name: patientInfo.value.name,
+    inpatientNo: row.inpatientNo,
+    sex: row.sex,
+    birthDate: row.birthDateTime || row.birthDate,
+    birthDateTime: row.birthDateTime,
+    babyBirthWeight: row.babyBirthWeight,
+    babyBirthHeight: row.babyBirthHeight,
+  })
+  editBabyDialog.value = true
+}
 const babyList = ref()
 
 const selectPatList = ()=>{