|
@ -32,7 +32,7 @@ function getPrescriptionList( refresh){
|
|
|
startDate: startDate,
|
|
|
endDate: endDate,
|
|
|
state: state,
|
|
|
// dispensaryType: 3,
|
|
|
dispensaryType: 3,
|
|
|
hospital: hospital,
|
|
|
nameKey: nameKey
|
|
|
};
|
|
@ -43,25 +43,14 @@ function getPrescriptionList( refresh){
|
|
|
if(refresh){
|
|
|
$("#prescriptTable").bootstrapTable('refresh');
|
|
|
}
|
|
|
$("#prescriptTable").bootstrapTable({
|
|
|
method: 'get',
|
|
|
url: APIService.server + 'doctor/prescriptionInfo/getHDoctorPrescriptionExpressage',
|
|
|
var options = $.extend(orderAPI.getHOrderListTableAjaxObj, {
|
|
|
queryParams: queryParams,
|
|
|
contentType: "application/json",
|
|
|
queryParamsType: "limit",
|
|
|
dataType: "json",
|
|
|
pagination: true,
|
|
|
paginationLoop: true,
|
|
|
sidePagination: 'server',
|
|
|
pageNumber: 1,
|
|
|
pageSize: 10,
|
|
|
ajaxOptions: {
|
|
|
beforeSend: function(request) {
|
|
|
var userAgent = {"id":4821,"uid":"zbqD201703150228","imei":"864394010176834","token":"ee3fcb6091b46aa0a119c1504b8306d8","platform":2,"hospital":"3502050100"};
|
|
|
userAgent = JSON.stringify(userAgent);
|
|
|
request.setRequestHeader("userAgent", userAgent);
|
|
|
}
|
|
|
},
|
|
|
responseHandler: function (res) {
|
|
|
var data = _.map(res.data, function(o){
|
|
|
var result = "";
|
|
@ -85,7 +74,8 @@ function getPrescriptionList( refresh){
|
|
|
total: totalOrderCount
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
$("#prescriptTable").bootstrapTable(options);
|
|
|
}
|
|
|
});
|
|
|
|
|
@ -136,34 +126,12 @@ function bindEvents(){
|
|
|
state = $this.val();
|
|
|
getPrescriptionList(true);
|
|
|
});
|
|
|
|
|
|
$("#express").on('change', function(){
|
|
|
dispensaryType = $(this).val();
|
|
|
if(dispensaryType == 3){ //健管师配送时,显示复选框
|
|
|
$("#checkboxBox").removeClass("hidden");
|
|
|
}else{
|
|
|
$("#checkboxBox").addClass("hidden");
|
|
|
$("#allocationType").prop("checked", false);
|
|
|
allocationType = 0;
|
|
|
}
|
|
|
getPrescriptionList(true);
|
|
|
});
|
|
|
|
|
|
$("#address").on('change', function(){
|
|
|
hospital = $(this).val();
|
|
|
getPrescriptionList(true);
|
|
|
});
|
|
|
|
|
|
$("#allocationType").on('change', function(){
|
|
|
var $this = $(this);
|
|
|
if($this.prop('checked')){
|
|
|
allocationType = 1;
|
|
|
}else{
|
|
|
allocationType = 0;
|
|
|
}
|
|
|
getPrescriptionList(true);
|
|
|
});
|
|
|
|
|
|
$("#searchBtn").on('click', function(){
|
|
|
var $input = $("#searchName"),
|
|
|
text = $.trim($input.val());
|
|
@ -171,112 +139,6 @@ function bindEvents(){
|
|
|
getPrescriptionList(true);
|
|
|
});
|
|
|
|
|
|
$("#selectAll").on('click', function(){
|
|
|
var $this = $(this),
|
|
|
$checkbox = $("input[name=orderItem]"),
|
|
|
length = $checkbox.length;
|
|
|
if($this.prop("checked")){
|
|
|
$checkbox.prop("checked", true);
|
|
|
selectItemNum = length;
|
|
|
$("#selectedCount").text(selectItemNum);
|
|
|
}else{
|
|
|
$checkbox.prop("checked", false);
|
|
|
selectItemNum = 0;
|
|
|
$("#selectedCount").text(0);
|
|
|
}
|
|
|
checkArrangeDisable('all');
|
|
|
});
|
|
|
|
|
|
$("body").on('click', "input[name=orderItem]", function(){
|
|
|
var $this = $(this),
|
|
|
status = $this.data('status'),
|
|
|
type = $this.data('type'),
|
|
|
expressage = $this.data('expressage'),
|
|
|
code = $this.data('code');
|
|
|
if($this.prop("checked")){
|
|
|
selectItemNum ++;
|
|
|
if((type == 3) && (status >= 50) && (expressage=='' || !expressage)){
|
|
|
selectItem.push(code);
|
|
|
}
|
|
|
}else{
|
|
|
selectItemNum --;
|
|
|
if(selectItem.indexOf(code) > -1){
|
|
|
var index = selectItem.indexOf(code);
|
|
|
selectItem.splice(index,1);
|
|
|
}
|
|
|
}
|
|
|
$("#selectedCount").text(selectItemNum);
|
|
|
checkArrangeDisable();
|
|
|
});
|
|
|
|
|
|
$("#arrange").on('click', function(){
|
|
|
if($(this).hasClass("disabled")){
|
|
|
return false;
|
|
|
}
|
|
|
$('#myModal').modal('toggle');
|
|
|
getHealthDoctorList();
|
|
|
});
|
|
|
|
|
|
$("#doctorName").on('keyup', function(e){
|
|
|
if (e.which === 13) {
|
|
|
getHealthDoctorList(true);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$("#confirmBtn").on('click', function(){
|
|
|
//发送请求确认的请求
|
|
|
var params = {
|
|
|
codes: selectItem.join(","),
|
|
|
healthDoctor: selectDoctor
|
|
|
}
|
|
|
orderAPI.distributeHealthDoctor({data: params}).then(function(res){
|
|
|
if(res.status == 200){
|
|
|
$('#myModal').modal('toggle');
|
|
|
$('#confirmModal').modal('toggle');
|
|
|
$("#prescriptTable").bootstrapTable('refresh');
|
|
|
}else{
|
|
|
|
|
|
}
|
|
|
})
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
//判断选中的订单是否是可分配的的订单
|
|
|
function checkArrangeDisable(clickType){ //type=all 为点击全选时处理
|
|
|
//可以分配的条件,1是健管师配送订单,2状态为待分配
|
|
|
var $checkbox = $("input[name=orderItem]:checked"),
|
|
|
len = $checkbox.length;
|
|
|
isArrange = false;
|
|
|
if(clickType == 'all'){
|
|
|
selectItem = [];
|
|
|
}
|
|
|
for(var i=0; i<len; i++){
|
|
|
var $item = $($checkbox[i]),
|
|
|
status = $item.data('status'),
|
|
|
type = $item.data('type'),
|
|
|
expressage = $item.data('expressage'),
|
|
|
code = $item.data('code');
|
|
|
if(type != 3){
|
|
|
isArrange = false;
|
|
|
break;
|
|
|
}else{
|
|
|
if((status >= 50) && (expressage=='' || !expressage)){ //支付成功后状态+配送员的名字为空为待分配状态
|
|
|
isArrange = true;
|
|
|
if(clickType == 'all'){
|
|
|
selectItem.push(code);
|
|
|
}
|
|
|
}else{
|
|
|
isArrange = false;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if(!isArrange){
|
|
|
$("#arrange").addClass("disabled");
|
|
|
}else{
|
|
|
$("#arrange").removeClass("disabled");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//根据选择的tab获得开始和结束时间
|