12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- var d = dialog({contentType:'load', skin:'bk-popup'});
- var category_code = null;
- var prescriptionCode;
- $(function() {
- Request = GetRequest();
- var openid = Request["openid"];
- prescriptionCode = Request["prescriptionCode"];
- category_code = Request["category_code"];
- 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-xueyaji.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();
- }
- }
-
|