1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var category_code = null;
- var prescriptionCode;
- $(function() {
- Request = GetRequest();
- prescriptionCode = Request["prescriptionCode"];
- category_code = Request["category_code"];
- var openid = Request["openid"];
- var userAgent = window.localStorage.getItem(agentName);
- if(!userAgent){
- window.localStorage.setItem(pageName,"{\"pageurl\":\""+window.location.href+"\"}");
- window.location.href = "../../home/html/zhmm-login.html?type=0&openid=" + openid;
- }
- getDevices();
- bindEvents();
- });
- function getDevices(){
- var params = {};
- params.category_code = category_code;
- d.show();
- sendPost("/common/device/DeviceList",params,"JSON","GET",queryListFailed,queryListSuccess);
- }
- function queryListSuccess(res){
- d.close();
- if(res.status==200){
- if(res.data&&res.data.length>0){
- var html = template('list-tmp', {list: res.data});
-
- $("#list").empty().append(html);
- }else{
- $("#list").hide();
- $(".div-no-info").show();
- // dialog({contentType:'tipsbox', skin:'bk-popup',bottom:true , content:'无更多设备!'}).show();
- }
- }else{
- queryListFailed(res);
- }
- }
- function bindEvents(){
- template.helper("getPhoto", function(str){
- return getImgUrl(str);
- });
-
- $("#list").on('click', 'li', function(){
- var $this = $(this),
- id = $this.attr("data-id");
- location.href="edit-xuetangyi.html?deviceId="+id+"&prescriptionCode="+prescriptionCode;
- })
- }
- function queryListFailed(res) {
- d.close();
- if (res && res.msg) {
- dialog({contentType:'tipsbox', skin:'bk-popup',bottom:true, content:res.msg}).show();
- } else {
- dialog({contentType:'tipsbox', skin:'bk-popup' ,bottom:true, content:'加载设备型号列表失败'}).show();
- }
- }
-
|