From b94eae282d4014c9e861797168e61f270f04c821 Mon Sep 17 00:00:00 2001
From: luobisheng <727299681@qq.com>
Date: 星期二, 29 十一月 2022 18:33:50 +0800
Subject: [PATCH] 审核修改
---
src/utils/helper.js | 83 +++++++++++++++++++++++++++++------------
1 files changed, 58 insertions(+), 25 deletions(-)
diff --git a/src/utils/helper.js b/src/utils/helper.js
index 1df5e96..d79cabf 100644
--- a/src/utils/helper.js
+++ b/src/utils/helper.js
@@ -2,7 +2,7 @@
// 娣辨嫹璐�
export function deepClone(obj) {
let objClone = Array.isArray(obj) ? [] : {};
- if (obj && typeof obj === 'object' && obj != null) {
+ if (obj && typeof obj === 'object') {
for (let key in obj) {
if (obj.hasOwnProperty(key)) {
if (obj[key] && typeof obj[key] === 'object') {
@@ -33,30 +33,38 @@
})
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)
+// 鑾峰彇瀛楀吀琛�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;
}
+
+// data: 鏂囦欢, contentDisposition锛氳姹傚ご涓枃浠剁殑鍚嶅瓧
+// 榛樿涓嶇敤淇敼锛岀洿鎺ュ皢杩斿洖鐨剅es浼犲叆鍗冲彲
+export function downloadFile(res) {
+ const blob = new Blob([res.data], { type: 'application/octet-stream' });
+ const fileName = res.contentDisposition.split(`''`)[1];
+ if (window.navigator && window.navigator.msSaveBlob) {
+ window.navigator.msSaveBlob(blob, fileName);
+ } else {
+ const link = document.createElement('a');
+ link.style.display = 'none';
+ link.href = window.URL.createObjectURL(blob);
+ link.download = decodeURI(fileName);
+ document.body.appendChild(link);
+ link.click();
+ window.URL.revokeObjectURL(link.href);
+ document.body.removeChild(link);
+ }
+}
+
// 鑾峰彇token
export function getToken() {
const token = sessionStorage.getItem('token');
@@ -64,7 +72,17 @@
if (token && tokenHead) {
return tokenHead + token;
}
- 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) {
@@ -102,3 +120,18 @@
}
return str + '鍒嗛挓'
}
+
+export const EVENT_SOURCE = [
+ { label: '瑙嗛鎶撴媿', value: 1 },
+ { label: '鎵嬪姩鐧昏', value: 2 }
+]
+
+export const CATEGOTY = [
+ { label: '杩濊', value: 1 },
+ { label: '杩濆缓', value: 2 }
+]
+
+export const RESOURCE_TYPE = [
+ { label: '涓婃姤', value: '01' },
+ { label: '澶勭疆', value: '02' }
+]
--
Gitblit v1.8.0