123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- //获取团队信息
- var request = getRequest(),
- teamCode = request.id,
- isLeader = isTeamLeader();
- //记录页面控件的值
- var startDate = '',
- endDate = '',
- state = '0,2,3,4,10', // 状态,初始为:审核中
- dispensaryType = '', //配送方式
- page = 1,
- size = 10,
- nameKey, //搜索的姓名
- totalCount = 0,
- selectDoctor; //选中的医生
- $(function(){
- setTitle("续方管理");
- //非团队长隐藏操作按钮
- if(!isLeader){
- $("#arrange").hide();
- }
- //填充下拉框数据
- managementApis.getFilterInfo({
- data:{
- teamCode: teamCode
- }
- }).then(function(res){
- fillDropDown(res);
- $('#presctiptionStatus').val(state);
- //获得续方订单列表
- getPrescriptionList();
- });
- bindEvents();
- });
- //获得续方订单列表
- function getPrescriptionList( refresh){
- var params = {
- teamCode: teamCode,
- startDate: startDate,
- endDate: endDate,
- state: state,
- diseases: dispensaryType,
- nameKeyword: nameKey
- };
- //先请求获得所有的数量
- managementApis.getListCount({data:params}).then(function(res){
- if(res.status == 200){
- totalCount = res.data.total;
- if(refresh){
- $("#prescriptTable").bootstrapTable('refresh');
- }
- var options = $.extend(managementApis.getListTableAjaxObj, {
- 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;
- if(o.status*1 < -1) {
- o.statusName = "续方取消"
- } else {
- o.statusName = getStatusName(o.status);
- }
- o.drugs = getDrugs(o.prescriptionInfo);
- o.daysRemaining = getDaysRemaining(o)
- o.action = '<a class="c-12b7f5" href="prescription-main.html?tab=1&teamCode='+teamCode+'&code='+o.code+'&patiName='+o.name+'">查看</a>';
- return o;
- });
-
- return {
- rows: data,
- total: totalCount
- }
- }
- })
- $("#prescriptTable").bootstrapTable(options);
- }
- });
-
- }
- function queryParams(params) {
- console.log(params);
- //当表格数据变化的时候,则取消全选按钮,然后之前的选中的信息将取消选中
- page = params.offset/params.limit + 1;
- selectItemNum = 0;
- $("#selectAll").prop("checked", false);
- $("#selectedCount").text(0);
- $("#arrange").addClass("disabled");
-
- return {
- teamCode: teamCode,
- page: params.offset/params.limit + 1,
- size: params.limit,
- startDate: startDate,
- endDate: endDate,
- state: state,
- diseases: dispensaryType,
- nameKeyword: nameKey
- };
- }
- function fillDropDown(res){
- if(res.status == 200){
- var stateHtml = template('state_tmpl', {list: res.data.states});
- $("#presctiptionStatus").append(stateHtml);
- var expressHtml = template('express_tmpl', {list: res.data.diseases});
- $("#express").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);
- }
- });
- $("#presctiptionStatus").on('change', function(){
- var $this = $(this);
- state = $this.val();
- $('#prescriptTable').bootstrapTable('refreshOptions',{pageNumber:1});
- getPrescriptionList(true);
- });
- $("#express").on('change', function(){
- dispensaryType = $(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);
- });
- }
|