|
@@ -3,6 +3,7 @@ const $ = require('jquery');
|
|
|
require('jquery-templates');
|
|
|
require('./modal.js');
|
|
|
const {api,post,getUrlArgObject,setBoxHeight} = require('./utils.js');
|
|
|
+const {keyMaps} = require('./maps.js');
|
|
|
//本页全局变量
|
|
|
let global_flawData = {}; //缺陷数据
|
|
|
const global_id=getUrlArgObject("id");
|
|
@@ -56,7 +57,7 @@ function getRecordDetail(){
|
|
|
const {beHospital,result,msg} = data;
|
|
|
const info=Object.assign(beHospital,result);
|
|
|
initMenu(JSON.parse(result.menuData));
|
|
|
- $(".sub-menu li:first-child.page").addClass("active");
|
|
|
+ $(".sub-menu>ul>li:first-child.page").addClass("active");
|
|
|
global_activeTab=$(".sub-menu .page.active").attr("code");
|
|
|
initPatientInfo(info);
|
|
|
initContent(result.pageData);
|
|
@@ -77,13 +78,29 @@ function initPatientInfo(data){
|
|
|
//显示病例模块明细
|
|
|
function initContent(data){
|
|
|
const obj = JSON.parse(data);
|
|
|
+ //formatData(obj['入院记录'])
|
|
|
+ let info=[];//formatData(obj['入院记录']);
|
|
|
for(let k in obj){
|
|
|
- $("#contentTmpl").tmpl({title:k,info:obj[k]}).appendTo("#contentInfo");
|
|
|
+ info=formatData(obj[k],k);
|
|
|
+ $("#contentTmpl").tmpl({title:k,info:info}).appendTo("#contentInfo");
|
|
|
}
|
|
|
$(".content-item[code="+global_activeTab+"]").show();
|
|
|
console.log(obj)
|
|
|
}
|
|
|
|
|
|
+function formatData(data,title){
|
|
|
+ if(!keyMaps[title]){
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+ const keyArr=Object.keys(keyMaps[title]);
|
|
|
+ let obj={};
|
|
|
+ keyArr.map((k)=>{
|
|
|
+ obj[keyMaps[title][k]]=data[0][k]||"";
|
|
|
+ });
|
|
|
+ const obj1=Object.assign({},obj,data[0]);
|
|
|
+ return [obj1];
|
|
|
+}
|
|
|
+
|
|
|
//评分项数据填充
|
|
|
function initScoreItem(data){
|
|
|
$("#flaws .flaw-box").html("");
|
|
@@ -146,17 +163,30 @@ function editScore(info){
|
|
|
function showModal(flag,code,i){
|
|
|
$("#delModal .modal-body").html("");
|
|
|
$("#delModal").show();
|
|
|
+ //事件解绑
|
|
|
$("#delModal .confirm").off("click");
|
|
|
- $("#qcScore").off("input");
|
|
|
+ $("#qcScore,#qcMsg").off("input");
|
|
|
const info = global_flawData[global_activeTab][i];
|
|
|
if(flag==='0'){ //修改
|
|
|
$("#delModal .title").text("修改评分");
|
|
|
$("#editTmpl").tmpl(info).appendTo("#delModal .modal-body");
|
|
|
+ //分数输入验证
|
|
|
$("#qcScore").on("input",function(){
|
|
|
const val=$(this).val();
|
|
|
if(/^[0-9]\d*$|^[0-9]\d*(.\d)?$/.test(val)){
|
|
|
$(".edit-box .warning").hide();
|
|
|
}else{
|
|
|
+ $(".edit-box .warning .red").text("支持≥0的数字输入,最多保留小数点后1位~");
|
|
|
+ $(".edit-box .warning").show();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ //提示信息输入验证
|
|
|
+ $("#qcMsg").on("input",function(){
|
|
|
+ const val=$(this).val();
|
|
|
+ if(val.trim()){
|
|
|
+ $(".edit-box .warning").hide();
|
|
|
+ }else{
|
|
|
+ $(".edit-box .warning .red").text("提示信息不能为空~");
|
|
|
$(".edit-box .warning").show();
|
|
|
}
|
|
|
});
|