Browse Source

解决编辑成功后暴力刷新的问题,已修改为无感刷新。

xiezhiming 9 months ago
parent
commit
930350e962
1 changed files with 41 additions and 34 deletions
  1. 41 34
      src/js/qcScore.js

+ 41 - 34
src/js/qcScore.js

@@ -255,13 +255,28 @@ $(function () {
         // $(".subMenu >li:first-child.page,.menu-mini>ul>li:first-child.page").addClass("active");
         // global_activeTab=$(".sub-menu .page.active").attr("code");
         // initPatientInfo(info);
-        // initContent(result.pageData);
+
+        const pageData = JSON.parse(result.pageData)
+        const list2 = pageData.病案首页
+        const diagList = JSON.parse(list2[0].出院诊断)
+        const operaList = JSON.parse(list2[0].手术信息)
+
+        global_diagList = diagList;
+        global_operaList = operaList;
+
+        initContent(result.pageData);
+
         initList(msg);
         initScoreItem(msg);
         global_flawData = msg;
         global_flawDataPay = drgs;
         // setBoxHeight();
         // changePay()
+        $(`.flaw-table,.content-item`).css('display', 'none')
+        if (global_activeTab === "缺陷总览") {
+          $(".flaw-table").css("display", "block")
+        }
+        $(`.content-item[code=${global_activeTab}`).css("display", "block")
       }
     });
   }
@@ -342,6 +357,7 @@ $(function () {
   }
   //显示病例模块明细
   function initContent(data, type) {
+    $("#contentInfo").empty()
     const obj = JSON.parse(data);
     let info = [];
     let hml = '', moduleId = '';
@@ -1162,26 +1178,24 @@ $(function () {
       console.log("编辑中");
       $(this).text('保存');
     } else {
-      let state
       switch (global_activeTab) {
         case "病案首页":
-          state = saveOrUpdate()
-
-          $(this).text('编辑');
+          saveOrUpdate().then((res) => {
+            getRecordDetailUpdate()
+            $.alerModal({ "message": "保存成功", type: "tip", time: '1000', win: true });
+            $(this).text('编辑');
+          }).catch(err => {
+            $.alerModal({ "message": '保存失败,请重试~', type: "tip", time: '1000', win: 'default' });
+          })
           break
         case "入院记录":
-          state = saveAdmissionRecordUpdate()
+          saveAdmissionRecordUpdate()
           $(this).text('编辑');
           break
         default:
           $(this).text('编辑');
       }
 
-      if (state === true) {
-        console.log("保存成功");
-      } else {
-        console.log("保存失败");
-      }
 
     }
     $(`.content-item[code=${global_activeTab}]`).find('p, .embed-table .table-1 td, .opera-table td,.embed-table .table-2 td,.inner-table td').attr('contenteditable', isEditing[global_activeTab]);
@@ -1684,31 +1698,24 @@ $(function () {
       ]
     }
     console.log("param:", param)
-    let state = 1
-    // axios.post(api.sendHomePageIng, param).then((res) => {
-    //   console.log("res", res.data);
-    // })
-    post1(api.sendHomePageIng, param).then(res => {
-      if (res.data.code == '0') {
-        // window.parent.location.reload()
-        console.log("sendHomePageIngRes", res.data)
-        console.log("成功");
-      } else {
-        state = 0
-        console.log("失败");
-      }
-
-    }).catch((e) => {
-      state = 0
-      console.log("失败1");
-    })
 
+    return new Promise((resolve, reject) => {
+      post1(api.sendHomePageIng, param).then(res => {
+        if (res.data.code == '0') {
+          // window.parent.location.reload()
+          console.log("sendHomePageIngRes", res.data)
+          console.log("成功");
+          resolve(true)
+        } else {
+          reject(false)
+          console.log("失败");
+        }
 
-    if (state === 1) {
-      return true
-    } else {
-      return false
-    }
+      }).catch((e) => {
+        reject(false)
+        console.log("失败1");
+      })
+    });
   }
 
   /**