zhangxc 5 rokov pred
rodič
commit
b87442797f
6 zmenil súbory, kde vykonal 106 pridanie a 8 odobranie
  1. 13 1
      src/css/qcList.less
  2. 2 2
      src/css/reset.less
  3. 1 1
      src/html/qcList.html
  4. 2 0
      src/js/api.js
  5. 24 2
      src/js/qcList.js
  6. 64 2
      src/js/utils.js

+ 13 - 1
src/css/qcList.less

@@ -168,7 +168,7 @@ table{
     width: 160px;
 }
 
-.filter,.reset{
+.filter,.reset,.export{
     display: inline-block;
     width:60px;
     height:32px;
@@ -183,6 +183,18 @@ table{
     float: left;
     margin: 0 0px 22px 0;
 }
+.export{
+    height:34px;
+    background: #fff;
+    border-radius: 4px;
+    color: #777;
+    border: 1px solid #777;
+    box-sizing: border-box;
+    cursor: pointer;
+    margin-left: 10px;
+    float: left;
+    top: 0px;
+}
 .arrow{
     position: absolute;
     width: 10px;

+ 2 - 2
src/css/reset.less

@@ -448,7 +448,7 @@ input:-ms-input-placeholder{  /* Internet Explorer 10-11 */
   }
 }
 .filterclearT {
-  height: 32px !important;
+  height: 324x !important;
   line-height: 32px !important;
   float: left;
   position: relative;
@@ -462,7 +462,7 @@ input:-ms-input-placeholder{  /* Internet Explorer 10-11 */
 .filterclear.abnormalClear {
   display: inline-block;
   width: 60px;
-  height: 32px;
+  height: 34px;
   line-height: 32px;
   background: #fff;
   border-radius: 4px;

+ 1 - 1
src/html/qcList.html

@@ -57,7 +57,7 @@
                 </span>
                
                 <span class="filter">查询</span>
-                <!-- <span class="reset">重置</span> -->
+                <span class="export">导出</span>
                 <span class="filterclear abnormalClear filterclearT">重置</span>
             </div>
             <div class="overAuto">

+ 2 - 0
src/js/api.js

@@ -77,6 +77,8 @@ const api = {
     typeGetById:'/qc/qcType/getById',//根据id返回
     getQcAnnormalMode:'/qc/abnormal/getQcAnnormalMode',//异常修改
     saveAndupdataModel:'/qc/modelHospital/saveAndupdataModel',//异常保存
+    exportQcList:'/qc/behospitalInfo/exportQcresult',//质控评分导出
+    exportQcListDept:'/qc/behospitalInfo/exportQcresultByDept',//质控评分(科室)导出
 }
 module.exports = {
     api

+ 24 - 2
src/js/qcList.js

@@ -2,7 +2,7 @@ const $ = require('jquery');
 require("../css/qcList.less");
 require('./modal.js');
 const {api} = require('./api.js')
-const {post,getCookie,getUrlArgObjectNew,emptyBox} = require('./utils.js')
+const {post,getCookie,getUrlArgObjectNew,emptyBox,downloadExportedData,expJson} = require('./utils.js')
 require('./../resource/jquery-ui/jquery-ui.min.js');
 require('./../resource/jquery-ui/jquery-ui.min.css');
 const iconCheck= require("./../images/icon_check.png")
@@ -130,6 +130,7 @@ $(".filter").on("click", function(e){
     if(behosDateEnd){
         behosDateEnd = behosDateEnd.replace(/\//g,'-') + ' 23:59:59'
     }
+
     name = nameTemp
     behospitalCode = behospitalCodeTemp
     level = levelTemp==="全部"?"":levelTemp
@@ -600,6 +601,27 @@ $(document).on("click", function(){
     $(".selectLevel .arrow").attr("src",iconDown)
     
 })
-
 $((function($){
+
+    $('.export').click(function(){
+        if((new Date(behosDateEnd) - new Date(behosDateStart))/24/60/60/1000 > 7){
+            $.alerModal({"message":"最多只能导出7天",type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
+        }
+        const param = {
+            "behospitalCode": behospitalCode,
+            "deptId": deptId,
+            "doctorCode":doctorNum,
+            "doctorName": doctorName,
+            "leaveHosDateEnd": behosDateEnd,
+            "leaveHosDateStart": behosDateStart,
+            "level": level,
+            "name": name
+        }
+        expJson(api.exportQcList,param).then(res =>{
+            downloadExportedData(res.data)
+            
+        }).catch((e) =>{
+            $.alerModal({"message":"导出失败",type:"tip",time:'1000',isFather: true, fatherWrapper: $("#mainBox", parent.document)});
+        })
+    })
 })($));

+ 64 - 2
src/js/utils.js

@@ -1,7 +1,7 @@
 const qs = require('qs');
 const $ = require("jquery");
 var Utils = require('./rePromise');
-const baseUrl = "http://192.168.2.241:5858"
+const baseUrl = "http://192.168.3.113:5858"
 //页面映射
 const pageMap={
   'YH-KZT':'console.html',
@@ -125,6 +125,66 @@ const post = function (url, data) {
   });
 }
 
+// 导出
+const expJson = (url,data) =>{
+  const token = getCookie('accessToken')
+  if(!token&&window.location.href.indexOf('login')==-1){
+    window.location.href = "../login.html"
+  }
+  let need = window.location.href.indexOf('localhost')!=-1
+  return new Utils((resolve, reject) => {
+    $.ajax({
+      method: 'post',
+      url: (need?baseUrl:'')+url,
+      async:true,
+      cache: false,
+      contentType: false,
+      processData: false,
+      data: JSON.stringify(data),
+      contentType: "application/json; charset=UTF-8",
+      // contentType: "application/vnd.ms-excel;charset=UTF-8",
+      // responseType: 'blob', //必须添加,否则会乱码
+      beforeSend: function (xmlHttp) {
+        xmlHttp.setRequestHeader("If-Modified-Since", "0");
+        xmlHttp.setRequestHeader("Cache-Control", "no-cache");
+        xmlHttp.setRequestHeader("Authorization",token?"Bearer "+token:'')
+      },
+      success: function (res) {
+        resolve({ data: res });
+      },
+      error: function (error) {
+        if(error.status===403||error.status===401){
+          const wd = window.parent.window||window;
+          wd.location.href = "../login.html";
+        }
+        reject(error);
+      },
+    });
+  });
+}
+
+// 导出
+function downloadExportedData(data, fileName) {
+  // var blob = new Blob([data], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'}); //type表示xlsx类型
+  // var blob = new Blob([data], {type: 'application/vnd.ms-excel;charset=UTF-8'}); //type表示xlsx类型
+  var blob = new Blob([data], {type: 'APPLICATION/OCTET-STREAM;charset=UTF-8'}); //type表示xlsx类型
+  var href = window.URL.createObjectURL(blob);//创建下载的链接
+  // 为兼容FF26 (不支持a标签的模拟点击事件)
+   if (navigator.userAgent.indexOf("Firefox") > -1){
+      //window.open(requestUrl);
+      window.location.href = href;
+   }else {
+      var downloadElement = document.createElement('a');
+      downloadElement.href = href;
+      downloadElement.download = fileName; //下载后文件名
+      document.body.appendChild(downloadElement);
+      downloadElement.click(); //点击下载
+      document.body.removeChild(downloadElement); //下载完成移除元素
+      window.URL.revokeObjectURL(href);
+   }
+  
+}
+
 //判断浏览器是否为Ie8
 const isIe8 = function () {
   var DEFAULT_VERSION = 8.0;
@@ -224,5 +284,7 @@ module.exports = {
   hasData,
   focusMenuItem,
   emptyBox,
-  picEmptyData
+  picEmptyData,
+  downloadExportedData,
+  expJson
 };