|
@@ -1,6 +1,7 @@
|
|
|
require("../css/qcScore.less");
|
|
|
const $ = require('jquery');
|
|
|
require('jquery-templates');
|
|
|
+require('./modal.js');
|
|
|
const {api,post,getUrlArgObject} = require('./utils.js');
|
|
|
//本页全局变量
|
|
|
let global_flawData = {}; //缺陷数据
|
|
@@ -11,7 +12,6 @@ $(function(){
|
|
|
//getSubMenu();
|
|
|
//initScoreItem();
|
|
|
getRecordDetail();
|
|
|
-
|
|
|
function initMenu(data){
|
|
|
//菜单数据填充
|
|
|
$("#subMenuTmpl").tmpl(data).appendTo("#subMenu");
|
|
@@ -33,7 +33,8 @@ function initMenu(data){
|
|
|
const code=$(this).attr("code");
|
|
|
global_activeTab=code;
|
|
|
$(".content-item,.flaw-item").hide();
|
|
|
- $(".content-item[code="+code+"],.flaw-item[code="+code+"]").show();
|
|
|
+ $(".content-item[code='"+code+"']").show();
|
|
|
+ showFlawList();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -67,7 +68,10 @@ function getRecordDetail(){
|
|
|
|
|
|
//填充患者信息
|
|
|
function initPatientInfo(data){
|
|
|
- $("#infoTmpl").tmpl(data).appendTo("#patientInfo");
|
|
|
+ const date = data.birthday.substr(0,10);
|
|
|
+ const age=new Date(date).getTime()/(365*24*60*60*1000);
|
|
|
+ const obj=Object.assign({},data,{age:Math.floor(-age)});
|
|
|
+ $("#infoTmpl").tmpl(obj).appendTo("#patientInfo");
|
|
|
}
|
|
|
//显示病例模块明细
|
|
|
function initContent(data){
|
|
@@ -85,7 +89,8 @@ function initScoreItem(data){
|
|
|
for(let k in data){
|
|
|
$("#flawTmpl").tmpl(data[k]).appendTo("#flaws .flaw-box");
|
|
|
}
|
|
|
- $(".flaw-item[code="+global_activeTab+"]").show();
|
|
|
+ //$(".flaw-item[code="+global_activeTab+"]").show();
|
|
|
+ showFlawList();
|
|
|
$(".flaw-item .oper a").click(function () {
|
|
|
//const activeTab=$(".sub-menu .page.active").attr("code");
|
|
|
const i = $(".flaw-item[code="+global_activeTab+"]").index($(this).parents(".flaw-item"));
|
|
@@ -94,6 +99,18 @@ function initScoreItem(data){
|
|
|
showModal(isEdit?'0':'1',code,i);
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+//显示缺陷列表
|
|
|
+function showFlawList(){
|
|
|
+ const hml = $(".flaw-item[code="+global_activeTab+"]");
|
|
|
+ if(hml.length){
|
|
|
+ hml.show();
|
|
|
+ $("#flaws .empty").hide();
|
|
|
+ }else{
|
|
|
+ $("#flaws .empty").length?$("#flaws .empty").show():$("#emptyTmpl").tmpl().appendTo("#flaws .flaw-box");
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//删除评分项
|
|
|
function delScore(id){
|
|
|
const param={
|
|
@@ -106,7 +123,7 @@ function delScore(id){
|
|
|
if(res.data.code==='0'){
|
|
|
$("#delModal").hide();
|
|
|
updateFlaws();
|
|
|
- alert('删除成功');
|
|
|
+ $.alerModal({"message":"删除成功",type:"tip",time:'1000'});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -120,7 +137,7 @@ function editScore(info){
|
|
|
if(res.data.code==='0'){
|
|
|
$("#delModal").hide();
|
|
|
updateFlaws();
|
|
|
- alert("修改成功");
|
|
|
+ $.alerModal({"message":"修改成功",type:"tip",time:'1000'});
|
|
|
}
|
|
|
});
|
|
|
}
|
|
@@ -129,11 +146,23 @@ function showModal(flag,code,i){
|
|
|
$("#delModal .modal-body").html("");
|
|
|
$("#delModal").show();
|
|
|
$("#delModal .confirm").off("click");
|
|
|
+ $("#qcScore").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").show();
|
|
|
+ }
|
|
|
+ });
|
|
|
$("#delModal .confirm").click(function(){
|
|
|
+ if($(".edit-box .warning").is(":visible")){
|
|
|
+ return;
|
|
|
+ }
|
|
|
const obj = Object.assign({},info,{msg:$("#delModal #qcMsg").val(),score:$("#delModal #qcScore").val()});
|
|
|
editScore(obj);
|
|
|
});
|