|
|
@ -225,6 +225,7 @@ |
|
|
|
import resiSearch from '../../components/resiSearch.vue' |
|
|
|
import resiForm from '../../components/resiForm.vue' |
|
|
|
import editResi from '../../components/editResi.vue' |
|
|
|
import axios from 'axios' |
|
|
|
export default { |
|
|
|
components: { |
|
|
|
resiSearch, |
|
|
@ -333,21 +334,18 @@ export default { |
|
|
|
} |
|
|
|
|
|
|
|
// .post('epmetuser/icresiuser/exportExcel', params) |
|
|
|
this.$http({ |
|
|
|
url: 'epmetuser/icresiuser/exportExcel', |
|
|
|
axios({ |
|
|
|
url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/exportExcel', |
|
|
|
// url: 'epmetuser/icresiuser/exportExcel', |
|
|
|
method: 'post', |
|
|
|
data: params, |
|
|
|
header: { |
|
|
|
headers: { 'Content-Type': 'application/x-download' } |
|
|
|
}, |
|
|
|
responseType: 'blob' |
|
|
|
}) |
|
|
|
.then(({ data: res }) => { |
|
|
|
// var headerData = res.headers |
|
|
|
// this.download(res, '人员数据.xlsx') |
|
|
|
console.log('res', res) |
|
|
|
const fileName = '人员数据.xlsx' |
|
|
|
let blob = new Blob([res], { type: 'application/vnd.ms-excel' }) |
|
|
|
.then(res => { |
|
|
|
console.log('resllll', res) |
|
|
|
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|
|
|
console.log('filename', fileName) |
|
|
|
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) |
|
|
|
var url = window.URL.createObjectURL(blob) |
|
|
|
var aLink = document.createElement('a') |
|
|
|
aLink.style.display = 'none' |
|
|
@ -357,7 +355,6 @@ export default { |
|
|
|
aLink.click() |
|
|
|
document.body.removeChild(aLink) //下载完成移除元素 |
|
|
|
window.URL.revokeObjectURL(url) //释放掉blob对象 |
|
|
|
// window.location.href = res.data |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
|
console.log('获取导出情失败', err) |
|
|
@ -398,18 +395,27 @@ export default { |
|
|
|
this.importBtnTitle = '正在上传中...' |
|
|
|
const formData = new FormData() //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|
|
|
formData.append('file', file.file) //添加文件对象 |
|
|
|
this.$http |
|
|
|
.post('/epmetuser/icresiuser/importExcel', formData) |
|
|
|
.then(({ data: res }) => { |
|
|
|
// if(res.code === 0) { |
|
|
|
// // this.$refs.upload.submit() |
|
|
|
// file.onSuccess() |
|
|
|
// console.log('res-ooooo---', res) |
|
|
|
// } |
|
|
|
axios({ |
|
|
|
url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/importExcel', |
|
|
|
method: 'post', |
|
|
|
data: formData, |
|
|
|
responseType: 'blob' |
|
|
|
}) |
|
|
|
.then((res) => { |
|
|
|
this.importLoading = false |
|
|
|
this.importBtnTitle = '导入人员数据' |
|
|
|
console.log('res-ooooo---', res) |
|
|
|
this.download(res, 'info.xlsx') |
|
|
|
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) |
|
|
|
console.log('filename', fileName) |
|
|
|
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) |
|
|
|
var url = window.URL.createObjectURL(blob) |
|
|
|
var aLink = document.createElement('a') |
|
|
|
aLink.style.display = 'none' |
|
|
|
aLink.href = url |
|
|
|
aLink.setAttribute('download', fileName) |
|
|
|
document.body.appendChild(aLink) |
|
|
|
aLink.click() |
|
|
|
document.body.removeChild(aLink) //下载完成移除元素 |
|
|
|
window.URL.revokeObjectURL(url) //释放掉blob对象 |
|
|
|
}) |
|
|
|
.catch( err => { |
|
|
|
console.log('失败', err) |
|
|
@ -771,6 +777,20 @@ export default { |
|
|
|
return this.$message.error('网络错误') |
|
|
|
}) |
|
|
|
}, |
|
|
|
getTreeData(data){ |
|
|
|
if (!Array.isArray(data)) return [] |
|
|
|
let arr = data.map(item => { |
|
|
|
let _item = {} |
|
|
|
if (item.children) { |
|
|
|
if (item.children.length === 0) _item = { ...item, children: undefined } |
|
|
|
else _item = { ...item, children: this.getTreeData(item.children)} |
|
|
|
} else { |
|
|
|
_item = { ...item } |
|
|
|
} |
|
|
|
return _item |
|
|
|
}) |
|
|
|
return arr |
|
|
|
}, |
|
|
|
async getFormList(type) { |
|
|
|
await this.$http |
|
|
|
.post('/oper/customize/icform/getcustomerform', { |
|
|
@ -790,7 +810,7 @@ export default { |
|
|
|
if (item.optionSourceType === 'remote') { |
|
|
|
await this.getOptionsList(item.optionSourceValue).then( |
|
|
|
(res) => { |
|
|
|
item.options = res |
|
|
|
item.options = this.getTreeData(res) |
|
|
|
} |
|
|
|
) |
|
|
|
} |
|
|
@ -801,7 +821,7 @@ export default { |
|
|
|
n.tableName = item.tableName |
|
|
|
if (n.optionSourceType === 'remote' && type !== 'edit') { |
|
|
|
await this.getOptionsList(n.optionSourceValue).then((res) => { |
|
|
|
n.options = res |
|
|
|
n.options = this.getTreeData(res) |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|