123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- //获取团队信息
- var request = getRequest(),
- teamCode = request.id || '',
- type = request.type;
- //记录页面控件的值
- var startDate = '',
- endDate = '',
- state = '', //状态
- dispensaryType = '', //配送方式
- page = 1,
- size = 10,
- hospital, //服务站code
- allocationType, //是否是待分配续方
- nameKey, //搜索的姓名
- totalOrderCount = 0,
- selectDoctor; //选中的医生
- $(function(){
- setTitle("续方订单");
- //填充下拉框数据
- orderAPI.getHFilterInfo().then(function(res){
- fillDropDown(res);
- //获得续方订单列表
- getPrescriptionList();
- });
- bindEvents();
- });
- //获得续方订单列表
- function getPrescriptionList( refresh){
- var params = {
- type: type,
- teamCode: teamCode,
- startDate: startDate,
- endDate: endDate,
- state: state,
- dispensaryType: 3,
- hospital: hospital,
- nameKey: nameKey
- };
- //先请求获得所有的数量
- orderAPI.getHOrderListCount({data:params}).then(function(res){
- if(res.status == 200){
- totalOrderCount = res.data.total;
- if(refresh){
- $("#prescriptTable").bootstrapTable('refresh');
- }
- var options = $.extend(orderAPI.getHOrderListTableAjaxObj, {
- queryParams: queryParams,
- queryParamsType: "limit",
- pagination: true,
- paginationLoop: true,
- sidePagination: 'server',
- pageNumber: 1,
- pageSize: 10,
- responseHandler: function (res) {
- var data = _.map(res.data, function(o){
- var result = "";
- for(var i=0; i<o.prescriptionDt.length; i++){
- if(i>0){
- result += ','+o.prescriptionDt[i].name;
- }else{
- result += o.prescriptionDt[i].name;
- }
- }
- o.result = result;
- o.statusName = getStatusName(o.status);
- o.express = getExpressName(o.dispensaryType);
- o.address = address;
- o.action = '<a class="c-12b7f5" href="prescription-main.html?code='+o.code+'&patiCode='+o.patientCode+'&teamCode='+teamCode+'&tab=2&patiCode='+o.name+'">查看</a>';
- return o;
- });
-
- return {
- rows: data,
- total: totalOrderCount
- }
- }
- })
- $("#prescriptTable").bootstrapTable(options);
- }
- });
-
- }
- function queryParams(params) {
- return {
- type: type,
- page: params.offset/params.limit + 1,
- size: params.limit,
- startDate: startDate,
- endDate: endDate,
- state: state,
- hospital: hospital,
- dispensaryType: 3,
- teamCode: teamCode,
- nameKey: nameKey
- };
- }
- function fillDropDown(res){
- if(res.status == 200){
- var stateHtml = template('state_tmpl', {list: res.data.states});
- $("#orderStatus").append(stateHtml);
- var expressHtml = template('address_tmpl', {list: res.data.hospitals});
- $("#address").append(expressHtml);
- }else{
- }
- }
- //绑定事件
- function bindEvents(){
- $(".n-tab").on('click', function(){
- if($(this).hasClass("active")){
- return false;
- }else{
- $(this).addClass("active");
- $(this).siblings().removeClass("active");
- var seDate = getStartEndDate($(this).attr("data-val"));
- startDate = seDate.startDate;
- endDate = seDate.endDate;
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getPrescriptionList(true);
- }
- });
- $("#orderStatus").on('change', function(){
- var $this = $(this);
- state = $this.val();
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getPrescriptionList(true);
- });
-
- $("#address").on('change', function(){
- hospital = $(this).val();
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getPrescriptionList(true);
- });
- $("#searchBtn").on('click', function(){
- var $input = $("#searchName"),
- text = $.trim($input.val());
- nameKey = text;
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getPrescriptionList(true);
- });
- }
|