Browse Source

Merge branch 'dev' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into dev

shibei_master
jiangyy 4 years ago
parent
commit
b3b3e67425
  1. 1
      src/utils/request.js
  2. 16
      src/views/components/editResi.vue
  3. 68
      src/views/modules/base/resi.vue

1
src/utils/request.js

@ -60,6 +60,7 @@ http.interceptors.response.use(response => {
}else { }else {
router.replace({ name: 'login' }) router.replace({ name: 'login' })
} }
return Promise.reject(response.data.msg) return Promise.reject(response.data.msg)
} }
return response return response

16
src/views/components/editResi.vue

@ -486,11 +486,25 @@ export default {
this.formList.forEach(async item => { this.formList.forEach(async item => {
if (item.optionSourceType === 'remote') { if (item.optionSourceType === 'remote') {
await this.getOptionsLists(item.optionSourceValue).then(res => { await this.getOptionsLists(item.optionSourceValue).then(res => {
item.options = res item.options = this.getTreeData(res)
}) })
} }
}) })
}, },
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
},
handleOpenSearch () { handleOpenSearch () {
this.openSearch = !this.openSearch this.openSearch = !this.openSearch
}, },

68
src/views/modules/base/resi.vue

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

Loading…
Cancel
Save