var vm,list;
$(function(){
$("#toHome").click(function(){
window.location.href = "/phau/web/home.jsp"
});
$("#toSY").click(function(){
window.location.href = "/phau/web/sy.jsp"
});
$("#toQY").click(function(){
window.location.href = "/phau/web/qy.jsp"
});
lists();
});
function initVue(data){
vm = new Vue({
el : "#content",
data : {
hisCode : '',
shortName : '',
typeCode : '',
meds : data
},
computed:{
medList:function(){
var vpm = this;
return this.meds.filter(function(med){
return (med.hisCode.indexOf(vpm.hisCode) !== -1) && (med.shortName.indexOf(vpm.shortName) !== -1) && (med.typeCode.indexOf(vpm.typeCode) !== -1);
});
},
selectedMeds:function(){
var vpm = this;
return this.meds.filter(function(med){
return med.selected === true;
})
}
},
methods : {
selectMed:function(med){
this.hisCode = med.hisCode;
this.shortName = med.shortName;
this.typeCode = med.typeCode;
$('#medCNum').val(med.maxNum * med.posNum - med.total);
$('#medCNum').focus();
},
addToPres:function(){
med = this.meds.filter(function (med){
return med.hisCode === $('#medHisCode').val()
});
if (med.length === 0)
alert("请填写药品信息!");
else{
med[0].cnum = $('#medCNum').val();
med[0].selected = true;
this.clearText();
}
},
removeFromPres:function(med){
med.selected = false;
},
clearText:function(){
this.hisCode = '';
this.shortName = '';
this.typeCode = '';
$('#medCNum').val('');
},
scanCode:function(){
this.clearText();
$('#medTypeCode').focus();
},
startSY:function(){
sendPres(this.selectedMeds);
}
}
});
}
function sendPres(data){
$.ajax({
url:"med/startSY",
dataType:"json",
type:"post",
data:{
data : data
},
success:function(data){
if (data && data.result)
window.location.href = "/phau/web/home.jsp";
},
error:function(err){
}
});
}
function lists(){
$.ajax({
url:"med/getMedList",
dataType:"json",
type:"post",
data:{
//data : Sqkj.getStatusJson()
data:"{roomId:1,machine:'01',exit:'010100',left:'010101',right:'010102',hand:'010000',upstair:'010100'}"
},
success:function(data){
if (data && data.result)
initVue(data.data);
},
error:function(err){
}
});
}
两个ajax,上面的无法执行,下面的正常,将两个url调换后,换后的上面的依然无法执行,下面的也依然正常,求解决方法