Selaa lähdekoodia

刷新-申诉病历详情

zhouna 3 vuotta sitten
vanhempi
commit
8c87fcbeef
1 muutettua tiedostoa jossa 50 lisäystä ja 8 poistoa
  1. 50 8
      src/js/appealUserPage.js

+ 50 - 8
src/js/appealUserPage.js

@@ -6,6 +6,7 @@ const { post, getUrlArgObject, setBoxHeight, getCookie, getLocal, initScroll } =
 const { api, ywCheckApi } = require('./api.js');
 let checkOk = require('./../images/checkOk.png')
 const adLogo = require("../images/adlogo.png")
+const loadingImg = require("./../images/loading.gif")
 if (localStorage.getItem('toLogin') === '1') {
   window.location.href = '../login.html';
 }
@@ -237,15 +238,56 @@ $(function () {
       }
     });
   }
+
+  //补录数据,接口来自技术服务部
   function supplementData() {
-    post(api.supplementData, { 'behospitalCode': global_id,'behospitalNum':1 }).then(function (res) {
-      if (res.data.code === '0') {
-        $("#contentInfo").html('')
-        getRecordDetailUpdate2()
-      }else{
-        $.alerModal({ "message": '刷新失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
-      }
-    });
+	//重新拉数据接口
+	post(api.supplementData, { 'behospitalCode': global_id,'behospitalNum':'' }).then(function (res) {
+	  const {code,data}=res.data;
+	  if (code === '0') {
+		if(data==='0'){ //0表示数据已更新,-1表示数据未更新
+		  //数据更新后先评分(评分成功后)再重新获取详情即刷新页面
+		  recordScore();
+		}else{
+		  $.alerModal({ "message": '刷新失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
+		}
+	  }else{
+		$.alerModal({ "message": '刷新失败,请重试~', type: "tip", time: '1000', isFather: true, win: 'default', fatherWrapper: $("#mainBox", parent.document) });
+	  }
+	});
+  }
+
+  function loading() {
+	const str = `
+    <div class="loadingBox">
+            <div class="mask"></div>
+            <img class="loadingImg" src=${loadingImg}  alt="loading" />
+        </div>
+    `
+	$("body", parent.document).append(str)
+  }
+  function hideLoading() {
+	$(".loadingBox", parent.document).remove()
+  }
+//评分
+  function recordScore() {
+	const param = {
+	  behospitalCode: global_id
+	};
+	loading();
+	post(api.recordScore, param).then(res => {
+	  if (res.data.code === '0') {
+		hideLoading();
+		//评分成功,刷新病历详情页面
+		window.parent.location.reload()
+	  } else {
+		hideLoading()
+		$.alerModal({ "message": res.data.msg || '刷新失败,请重试~', type: "tip", time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
+	  }
+	}).catch(() => {
+	  hideLoading()
+	  $.alerModal({ "message": '刷新失败,请重试~', type: "tip", win: 'default', time: '1000', isFather: true, fatherWrapper: $("#mainBox", parent.document) });
+	})
   }
 
   function changePay() {