|
@@ -2,13 +2,16 @@ require("../css/qcScore.less");
|
|
const $ = require('jquery');
|
|
const $ = require('jquery');
|
|
require('jquery-templates');
|
|
require('jquery-templates');
|
|
const {api,post,getUrlArgObject} = require('./utils.js');
|
|
const {api,post,getUrlArgObject} = require('./utils.js');
|
|
|
|
+//本页全局变量
|
|
|
|
+let global_flawData = {}; //缺陷数据
|
|
|
|
+const global_id=getUrlArgObject("id");
|
|
|
|
+let global_activeTab=$(".sub-menu .page.active").attr("code"); //当前激活菜单项
|
|
|
|
|
|
$(function(){
|
|
$(function(){
|
|
- getSubMenu();
|
|
|
|
- initScoreItem();
|
|
|
|
|
|
+ //getSubMenu();
|
|
|
|
+ //initScoreItem();
|
|
getRecordDetail();
|
|
getRecordDetail();
|
|
|
|
|
|
- let global_flawData = {}; //缺陷数据
|
|
|
|
function initMenu(data){
|
|
function initMenu(data){
|
|
//菜单数据填充
|
|
//菜单数据填充
|
|
$("#subMenuTmpl").tmpl(data).appendTo("#subMenu");
|
|
$("#subMenuTmpl").tmpl(data).appendTo("#subMenu");
|
|
@@ -28,12 +31,13 @@ function initMenu(data){
|
|
$(this).addClass("active");
|
|
$(this).addClass("active");
|
|
//显示对应内容
|
|
//显示对应内容
|
|
const code=$(this).attr("code");
|
|
const code=$(this).attr("code");
|
|
|
|
+ global_activeTab=code;
|
|
$(".content-item,.flaw-item").hide();
|
|
$(".content-item,.flaw-item").hide();
|
|
$(".content-item[code="+code+"],.flaw-item[code="+code+"]").show();
|
|
$(".content-item[code="+code+"],.flaw-item[code="+code+"]").show();
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
-function getSubMenu(){
|
|
|
|
|
|
+/*function getSubMenu(){
|
|
post(api.getSubMenu).then(function(res){
|
|
post(api.getSubMenu).then(function(res){
|
|
if(res.data.code==='0'){
|
|
if(res.data.code==='0'){
|
|
const data = res.data.data;
|
|
const data = res.data.data;
|
|
@@ -41,19 +45,20 @@ function getSubMenu(){
|
|
$(".sub-menu li:first-child.page").addClass("active");
|
|
$(".sub-menu li:first-child.page").addClass("active");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
-};
|
|
|
|
|
|
+};*/
|
|
|
|
|
|
//获取病例明细
|
|
//获取病例明细
|
|
function getRecordDetail(){
|
|
function getRecordDetail(){
|
|
- const id=getUrlArgObject("id");
|
|
|
|
- post(api.getRecordDetail,{'behospitalCode':id}).then(function(res){
|
|
|
|
|
|
+ post(api.getRecordDetail,{'behospitalCode':global_id}).then(function(res){
|
|
if(res.data.code==='0'){
|
|
if(res.data.code==='0'){
|
|
const data = res.data.data;
|
|
const data = res.data.data;
|
|
const {beHospital,result,msg} = data;
|
|
const {beHospital,result,msg} = data;
|
|
const info=Object.assign(beHospital,result);
|
|
const info=Object.assign(beHospital,result);
|
|
- const activeTab=$(".sub-menu .page.active").attr("code");
|
|
|
|
|
|
+ initMenu(JSON.parse(result.menuData));
|
|
|
|
+ $(".sub-menu li:first-child.page").addClass("active");
|
|
|
|
+ global_activeTab=$(".sub-menu .page.active").attr("code");
|
|
initPatientInfo(info);
|
|
initPatientInfo(info);
|
|
- initContent(result.pageData,activeTab);
|
|
|
|
|
|
+ initContent(result.pageData);
|
|
initScoreItem(msg);
|
|
initScoreItem(msg);
|
|
global_flawData=msg;
|
|
global_flawData=msg;
|
|
}
|
|
}
|
|
@@ -70,19 +75,20 @@ function initContent(data){
|
|
for(let k in obj){
|
|
for(let k in obj){
|
|
$("#contentTmpl").tmpl({title:k,info:obj[k]}).appendTo("#contentInfo");
|
|
$("#contentTmpl").tmpl({title:k,info:obj[k]}).appendTo("#contentInfo");
|
|
}
|
|
}
|
|
|
|
+ $(".content-item[code="+global_activeTab+"]").show();
|
|
console.log(obj)
|
|
console.log(obj)
|
|
}
|
|
}
|
|
|
|
|
|
//评分项数据填充
|
|
//评分项数据填充
|
|
function initScoreItem(data){
|
|
function initScoreItem(data){
|
|
- //$("#flawTmpl").tmpl(data).appendTo("#flaws");
|
|
|
|
|
|
+ $("#flaws .flaw-box").html("");
|
|
for(let k in data){
|
|
for(let k in data){
|
|
$("#flawTmpl").tmpl(data[k]).appendTo("#flaws .flaw-box");
|
|
$("#flawTmpl").tmpl(data[k]).appendTo("#flaws .flaw-box");
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ $(".flaw-item[code="+global_activeTab+"]").show();
|
|
$(".flaw-item .oper a").click(function () {
|
|
$(".flaw-item .oper a").click(function () {
|
|
- const activeTab=$(".sub-menu .page.active").attr("code");
|
|
|
|
- const i = $(".flaw-item[code="+activeTab+"]").index($(this).parents(".flaw-item"));
|
|
|
|
|
|
+ //const activeTab=$(".sub-menu .page.active").attr("code");
|
|
|
|
+ const i = $(".flaw-item[code="+global_activeTab+"]").index($(this).parents(".flaw-item"));
|
|
const code=$(this).attr("code");
|
|
const code=$(this).attr("code");
|
|
const isEdit = $(this).is(".edit-flaw");
|
|
const isEdit = $(this).is(".edit-flaw");
|
|
showModal(isEdit?'0':'1',code,i);
|
|
showModal(isEdit?'0':'1',code,i);
|
|
@@ -90,42 +96,70 @@ function initScoreItem(data){
|
|
}
|
|
}
|
|
//删除评分项
|
|
//删除评分项
|
|
function delScore(id){
|
|
function delScore(id){
|
|
- post(api.delScore,{'id':id}).then(function(res){
|
|
|
|
|
|
+ const param={
|
|
|
|
+ 'behospitalCode':global_id,
|
|
|
|
+ 'optResultAlgVO':{
|
|
|
|
+ 'id':id
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ post(api.delScore,param).then(function(res){
|
|
if(res.data.code==='0'){
|
|
if(res.data.code==='0'){
|
|
- const data = res.data.data;
|
|
|
|
-
|
|
|
|
|
|
+ $("#delModal").hide();
|
|
|
|
+ updateFlaws();
|
|
|
|
+ alert('删除成功');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
//修改评分项
|
|
//修改评分项
|
|
-function editScore(){
|
|
|
|
- const param={};
|
|
|
|
|
|
+function editScore(info){
|
|
|
|
+ const param={
|
|
|
|
+ "behospitalCode": global_id,
|
|
|
|
+ "optResultAlgVO": info
|
|
|
|
+};
|
|
post(api.editScore,param).then(function(res){
|
|
post(api.editScore,param).then(function(res){
|
|
if(res.data.code==='0'){
|
|
if(res.data.code==='0'){
|
|
- const data = res.data.data;
|
|
|
|
-
|
|
|
|
|
|
+ $("#delModal").hide();
|
|
|
|
+ updateFlaws();
|
|
|
|
+ alert("修改成功");
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+//显示删除/修改弹窗
|
|
function showModal(flag,code,i){
|
|
function showModal(flag,code,i){
|
|
$("#delModal .modal-body").html("");
|
|
$("#delModal .modal-body").html("");
|
|
$("#delModal").show();
|
|
$("#delModal").show();
|
|
$("#delModal .confirm").off("click");
|
|
$("#delModal .confirm").off("click");
|
|
- const activeTab=$(".sub-menu .page.active").attr("code");
|
|
|
|
|
|
+ const info = global_flawData[global_activeTab][i];
|
|
if(flag==='0'){ //修改
|
|
if(flag==='0'){ //修改
|
|
- const info = global_flawData[activeTab][i];
|
|
|
|
$("#delModal .title").text("修改评分");
|
|
$("#delModal .title").text("修改评分");
|
|
$("#editTmpl").tmpl(info).appendTo("#delModal .modal-body");
|
|
$("#editTmpl").tmpl(info).appendTo("#delModal .modal-body");
|
|
$("#delModal .confirm").click(function(){
|
|
$("#delModal .confirm").click(function(){
|
|
- editScore(code);
|
|
|
|
|
|
+ const obj = Object.assign({},info,{msg:$("#delModal #qcMsg").val(),score:$("#delModal #qcScore").val()});
|
|
|
|
+ editScore(obj);
|
|
});
|
|
});
|
|
}else{
|
|
}else{
|
|
$("#delModal .title").text("删除评分");
|
|
$("#delModal .title").text("删除评分");
|
|
$("#delModal .modal-body").html('<p>确定要删除该评分记录吗?</p>');
|
|
$("#delModal .modal-body").html('<p>确定要删除该评分记录吗?</p>');
|
|
$("#delModal .confirm").click(function(){
|
|
$("#delModal .confirm").click(function(){
|
|
- delScore(code);
|
|
|
|
|
|
+ delScore(code,info);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-});
|
|
|
|
|
|
+//更新缺陷列表
|
|
|
|
+ function updateFlaws(){
|
|
|
|
+ const param = {
|
|
|
|
+ 'behospitalCode':global_id,
|
|
|
|
+ 'paramStr':[
|
|
|
|
+ "msg"
|
|
|
|
+ ]
|
|
|
|
+ };
|
|
|
|
+ post(api.getRecordDetail,param).then(function(res){
|
|
|
|
+ if(res.data.code==='0'){
|
|
|
|
+ const data = res.data.data;
|
|
|
|
+ const {msg} = data;
|
|
|
|
+ initScoreItem(msg);
|
|
|
|
+ global_flawData=msg;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+});
|