123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- //mui.plusReady(function() {
- queryList();
- //});
- function queryList() {
- // plus.nativeUI.showWaiting();
- //拼请求内容
- var params = {};
- params.id = 0;
- params.pagesize = 60;
- //发送ajax请求
- sendPost("patient/device/list", params, "json", "post", queryListFailed, queryListSuccesss);
- }
- function queryListFailed(res) {
- console.log(res.status);
- if (res && res.msg) {
- // plus.nativeUI.toast(res.msg);
- } else {
- // plus.nativeUI.toast("数据加载失败");
- }
- // plus.nativeUI.closeWaiting();
- }
- function queryListSuccesss(res) {
- if (res.status == 200) {
- //成功
- // console.log(res.data.list);
- showList(res.data.list);
- } else {
- //非200则为失败
- queryListFailed(res);
- }
- // plus.nativeUI.closeWaiting();
- }
- /**
- * 清空tbody
- */
- function clearHTML() {
- $("#equ_list").html("");
- }
- /**
- * 显示查询结果
- * @param {Object} list
- */
- function showList(list) {
- clearHTML();
- var _html = "";
- for (var i = 0; i < list.length; i++) {
- var data = list[i];
- if (!data) {
- continue;
- }
-
- _html+="<li class='c-list-text c-list-link'>"
- _html+= "<div class='c-list-key'>"
- _html+= "<i class='icon-del mr5' attr_code="+data.code+"></i>"
- _html+= "<span>"+data.name+"</span>"
- _html+= "</div>"
- _html+= "<div class='c-list-info c-t-right'>"+data.sn+"</div>"
- _html+= "<span class='list-icon arrow-right'></span>"
- _html+="</li>";
-
-
-
-
- // "<li class='c-list-text c-list-link' attr_code="+data.code+" attr_name="+data.name+" attr_sn="+data.sn+">"
- // _html+="<div class='c-list-key'>"+data.name+"</div>"
- // _html+="<div class='c-list-info c-t-right'>"+data.sn+"</div>"
- // _html+="<span class='list-icon arrow-right'></span>"
- // _html+="</li>";
-
- }
- $("#equ_list").html(_html);
-
- $(".icon-del").on("click",function(){
- var i = $(this);
- var attr_code = $(this).attr('attr_code');
- dialog({
- title:'删除设备信息',
- content:'确定删除该设备信息吗?',
- ok: function (){
-
- //获取现在有的设备类别以及名称
- var params = {}
- params.code = attr_code;
- //发送ajax请求, 查询设备列表信息
- sendPost("patient/device/delete", params, "json", "post", queryListFailed,dele_Successs);
- function dele_Successs(res){
-
- console.log("删除成功");
- var i = plus.webview.getWebviewById("my-equipments");
- // mui.fire(i, "update_info_detail", {
- // type_name:params.type_name,
- // name:params.name,
- // sn:params.sn,
- // });
- // mui.toast("删除成功");
- alert("删除成功");
-
-
-
- }
- // plus.nativeUI.toast(res.mag);
- i.parent().parent().remove();
-
-
- },
- cancel: function () {
- // alert("你点了取消")
- return;
- }
- }).showModal();
- })
-
- }
- //添加数据添加监听
- window.addEventListener("update_info_detail", function(e) {
- //刷新列表
- queryList();
-
- });
|