| | |
| | | // data: 文件, contentDisposition:请求头中文件的名字 |
| | | // 默认不用修改,直接将返回的res传入即可 |
| | | export function downloadFile(res) { |
| | | const blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }); |
| | | const blob = new Blob([res.data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }); |
| | | const fileName = res.contentDisposition.split('=')[1]; |
| | | if (window.navigator && window.navigator.msSaveBlob) { |
| | | navigator.msSaveBlob(blob, fileName); |
| | | navigator.msSaveBlob(blob, `${new Date().getTime()}`); |
| | | } else { |
| | | const link = document.createElement('a'); |
| | | link.style.display = 'none'; |
| | | link.href = URL.createObjectURL(blob); |
| | | link.setAttribute('download', decodeURI(fileName)); |
| | | link.setAttribute('download', decodeURI(`${new Date().getTime()}`)); |
| | | document.body.appendChild(link); |
| | | link.click(); |
| | | URL.revokeObjectURL(link.href); |
| | |
| | | } |
| | | 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' } |
| | | ] |