Browse Source

格式化级联

shibei_master
13176889840 4 years ago
parent
commit
cf34df5ea4
  1. 16
      src/views/components/editResi.vue
  2. 23
      src/views/modules/base/resi.vue

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
}, },

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

@ -336,6 +336,7 @@ export default {
// .post('epmetuser/icresiuser/exportExcel', params) // .post('epmetuser/icresiuser/exportExcel', params)
axios({ axios({
url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/exportExcel', url: window.SITE_CONFIG['apiURL'] + '/epmetuser/icresiuser/exportExcel',
// url: 'epmetuser/icresiuser/exportExcel',
method: 'post', method: 'post',
data: params, data: params,
responseType: 'blob' responseType: 'blob'
@ -344,10 +345,6 @@ export default {
console.log('resllll', res) console.log('resllll', res)
let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1])
console.log('filename', fileName) console.log('filename', fileName)
// var headerData = res.headers
// this.download(res, '.xlsx')
// console.log('res', res)
// const fileName = '.xlsx'
let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) let blob = new Blob([res.data], { 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')
@ -780,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', {
@ -799,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)
} }
) )
} }
@ -810,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