| | |
| | | var key = $('#app-edit-search').val(); |
| | | var needBegintime = $('#test1').val(); |
| | | var needEndtime = $('#test2').val(); |
| | | if (needBegintime != null && needEndtime != null) { |
| | | var flag=compareDate(needBegintime, needEndtime); |
| | | if(!flag){ |
| | | layer.msg('结束时间不得小于开始时间'); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | table.reload('app-table', { where: { doctorName: key,needBegintime:needBegintime, needEndtime:needEndtime} }); |
| | | }); |
| | | //比较日期大小 |
| | | function compareDate(logintime, logouttime) { |
| | | var arys1 = new Array(); |
| | | var arys2 = new Array(); |
| | | if (logintime != null && logouttime != null) { |
| | | arys1 = logintime.split('-'); |
| | | var logindate = new Date(arys1[0], parseInt(arys1[1] - 1), arys1[2]); |
| | | arys2 = logouttime.split('-'); |
| | | var logoutdate = new Date(arys2[0], parseInt(arys2[1] - 1), arys2[2]); |
| | | if (logindate > logoutdate) { |
| | | return false; |
| | | } else { |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | // 导出 |
| | | $('#app-btn-export').click(function () { |
| | | var url = config.base_server + 'api-opration/dataneed/export'; |
| | | var xhr = new XMLHttpRequest(); |
| | | xhr.open('POST', url, true); |
| | | xhr.responseType = "blob"; |
| | | xhr.setRequestHeader("client_type", "DESKTOP_WEB"); |
| | | xhr.setRequestHeader("Authorization", "Bearer " + config.getToken().access_token); |
| | | xhr.onload = function() { |
| | | if (this.status == 200) { |
| | | var fileName = "user.xlsx"; |
| | | var blob = this.response; |
| | | var a = document.createElement('a'); |
| | | a.innerHTML = fileName; |
| | | // 指定生成的文件名 |
| | | a.download = fileName; |
| | | a.href = URL.createObjectURL(blob); |
| | | document.body.appendChild(a); |
| | | var evt = document.createEvent("MouseEvents"); |
| | | evt.initEvent("click", false, false); |
| | | a.dispatchEvent(evt); |
| | | document.body.removeChild(a); |
| | | } |
| | | } |
| | | xhr.send(); |
| | | }); |
| | | |
| | | // 添加按钮点击事件 |
| | | $('#app-btn-add').click(function () { |
| | | showEditModel(); |
| | | }); |
| | | // $('#app-btn-add').click(function () { |
| | | // showEditModel(); |
| | | // }); |
| | | |
| | | // // 显示编辑弹窗 |
| | | // var showEditModel = function (data) { |