From eda46bf83619297600436e5015fd8977e9974219 Mon Sep 17 00:00:00 2001
From: luobisheng <727299681@qq.com>
Date: 星期五, 04 十一月 2022 15:50:31 +0800
Subject: [PATCH] Merge branch 'master' of http://42.193.1.25:9521/r/sccg_ui

---
 src/utils/helper.js |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)

diff --git a/src/utils/helper.js b/src/utils/helper.js
index 2c1f075..25f8baf 100644
--- a/src/utils/helper.js
+++ b/src/utils/helper.js
@@ -33,6 +33,42 @@
         })
     return arr;
 }
+// 鑾峰彇瀛楀吀琛�2
+export async function getCodeList(code){
+    let arr;
+    await myrequest({
+        method: 'get',
+        url: `/sccg/dict/queryByCode?code=${code}`
+    })
+        .then(res => {
+            arr = res.data;
+        })
+    return arr;
+}
+export async function myDownLoad(arr){
+    let fileName = arr.headers['content-disposition'];
+            console.log(fileName);
+            if (fileName) {
+                fileName = fileName.slice(fileName.indexOf('filename=') + 9);
+            }
+            const blob = new Blob([arr.data], {
+                type: 'application/octet-stream'
+            })
+            // content-disposition
+            const downloadElement = document.createElement('a')
+            // 鍒涘缓涓嬭浇鐨勯摼鎺�
+            const href = window.URL.createObjectURL(blob)
+            downloadElement.href = href
+            // // 涓嬭浇鍚庢枃浠跺悕
+            downloadElement.download = fileName
+            document.body.appendChild(downloadElement)
+            // 鐐瑰嚮涓嬭浇
+            downloadElement.click()
+            // 涓嬭浇瀹屾垚绉婚櫎鍏冪礌
+            document.body.removeChild(downloadElement)
+            // 閲婃斁鎺塨lob瀵硅薄
+            window.URL.revokeObjectURL(href)
+}
 // 鑾峰彇token
 export function getToken() {
     const token = sessionStorage.getItem('token');
@@ -42,6 +78,17 @@
     }
     return;
 }
+// 鑾峰彇骞存湀鏃ユ椂鍒嗙
+export function getNowDate(time){
+    const result = new Date(time);
+    let yy = result.getFullYear(),
+    mm = result.getMonth()+1,
+    dd = result.getDate(),
+    hh = result.getHours(),
+    mi = result.getMinutes(),
+    ss = result.getSeconds()
+    return yy+'-'+ fillTime(mm)+'-'+fillTime(dd)+" "+fillTime(hh)+':'+fillTime(mi) + ':' + fillTime(ss);
+}
 function filterTime(time) {
     if (time < 0) {
         return '宸查�炬湡';

--
Gitblit v1.8.0