导出字段映射升级
This commit is contained in:
parent
788cd2c0d2
commit
3dff38153a
|
|
@ -60,23 +60,38 @@
|
|||
<right-toolbar :showSearch.sync="showSearch" @queryTable="handleQuery"></right-toolbar>
|
||||
</el-row>
|
||||
<el-table :data="realDate.data">
|
||||
<span v-for="(item,index) in realDate.header">
|
||||
<el-table-column v-if="checkDateType(item.prop)"
|
||||
:label="item.label"
|
||||
align="center"
|
||||
:key="index"
|
||||
:prop="item.prop">
|
||||
<template slot-scope="scope">
|
||||
{{ parseDateOrTime(scope.row[item.prop]) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else
|
||||
:label="item.label"
|
||||
align="center"
|
||||
:key="index"
|
||||
:prop="item.prop"
|
||||
/>
|
||||
</span>
|
||||
<el-table-column v-for="(item,index) in realDate.header"
|
||||
:label="item.label"
|
||||
align="center"
|
||||
:key="index"
|
||||
:prop="item.prop">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="checkDateType(item.prop)">
|
||||
{{ parseDateOrTime(scope.row[item.prop]) }}
|
||||
</span>
|
||||
<span v-else-if="item.dictType!=null">
|
||||
{{ dictFormat(item.dictType, scope.row[item.prop]) }}
|
||||
</span>
|
||||
<span v-else>{{ scope.row[item.prop] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <span v-for="(item,index) in realDate.header">-->
|
||||
<!-- <el-table-column v-if="checkDateType(item.prop)"-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- align="center"-->
|
||||
<!-- :key="index"-->
|
||||
<!-- :prop="item.prop">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ parseDateOrTime(scope.row[item.prop]) }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column v-else-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- align="center"-->
|
||||
<!-- :key="index"-->
|
||||
<!-- :prop="item.prop"-->
|
||||
<!-- />-->
|
||||
<!-- </span>-->
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
|
|
@ -114,6 +129,7 @@ export default {
|
|||
data: [],
|
||||
header: [],
|
||||
},
|
||||
dictTypeDataList:{},
|
||||
total: 0,
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
|
|
@ -127,10 +143,21 @@ export default {
|
|||
let data = res.data
|
||||
this.uconList = listInit(data.uniCons)
|
||||
this.realDate.header = data.infoList
|
||||
this.dictTypeDataList = data.dictList
|
||||
})
|
||||
|
||||
this.handleQuery()
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 字典渲染
|
||||
* @param dictType
|
||||
* @param data
|
||||
* @returns {*}
|
||||
*/
|
||||
dictFormat(dictType, data) {
|
||||
return this.selectDictLabel(this.dictTypeDataList[dictType], data)
|
||||
},
|
||||
outPlaceholder(item) {
|
||||
return "请输入" + item.ucName
|
||||
},
|
||||
|
|
|
|||
|
|
@ -130,23 +130,40 @@
|
|||
</div>
|
||||
<div class="el-table">
|
||||
<el-table v-show="previewDate.open" :data="previewDate.data">
|
||||
<span v-for="(item,index) in previewDate.header">
|
||||
<el-table-column v-if="checkDateType(item.prop)"
|
||||
:label="item.label"
|
||||
align="center"
|
||||
:key="index"
|
||||
:prop="item.prop">
|
||||
<template slot-scope="scope">
|
||||
<el-table-column v-for="(item,index) in previewDate.header"
|
||||
:label="item.label"
|
||||
align="center"
|
||||
:key="index"
|
||||
:prop="item.prop">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="checkDateType(item.prop)">
|
||||
{{ parseDateOrTime(scope.row[item.prop]) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-else
|
||||
:label="item.label"
|
||||
align="center"
|
||||
:key="index"
|
||||
:prop="item.prop"
|
||||
/>
|
||||
</span>
|
||||
</span>
|
||||
<span v-else-if="item.dictType!=null">
|
||||
{{ dictFormat(item.dictType, scope.row[item.prop]) }}
|
||||
</span>
|
||||
<span v-else>{{ scope.row[item.prop] }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<!-- <span v-for="(item,index) in previewDate.header">-->
|
||||
<!-- <el-table-column v-if="checkDateType(item.prop)"-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- align="center"-->
|
||||
<!-- :key="index"-->
|
||||
<!-- :prop="item.prop">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- {{ parseDateOrTime(scope.row[item.prop]) }}-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column v-else-->
|
||||
<!-- :label="item.label"-->
|
||||
<!-- align="center"-->
|
||||
<!-- :key="index"-->
|
||||
<!-- :prop="item.prop"-->
|
||||
<!-- />-->
|
||||
<!-- </span>-->
|
||||
</el-table>
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
|
|
@ -161,7 +178,7 @@
|
|||
:visible.sync="columnInfo.open"
|
||||
width="40%"
|
||||
>
|
||||
<el-table ref="columnInfoTable" :data="columnInfo.list" row-key="column">
|
||||
<el-table max-height="650px" ref="columnInfoTable" :data="columnInfo.list" row-key="column">
|
||||
<el-table-column label="字段信息" min-width="10%">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-model="scope.row.prop"></el-input>
|
||||
|
|
@ -309,6 +326,7 @@ export default {
|
|||
data: [],
|
||||
header: []
|
||||
},
|
||||
dictTypeDataList:{},
|
||||
rules: {
|
||||
uqName: [{required: true, message: '请输入名称', trigger: 'blur'}],
|
||||
uqDescribe: [{required: true, message: '请输入描述', trigger: 'blur'}]
|
||||
|
|
@ -337,9 +355,25 @@ export default {
|
|||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
/**
|
||||
* 字典渲染
|
||||
* @param dictType
|
||||
* @param data
|
||||
* @returns {*}
|
||||
*/
|
||||
dictFormat(dictType, data) {
|
||||
return this.selectDictLabel(this.dictTypeDataList[dictType], data)
|
||||
},
|
||||
/**
|
||||
* 字段信息列删除
|
||||
* @param index
|
||||
*/
|
||||
columnInfoDelete(index) {
|
||||
this.columnInfo.list.splice(index, 1)
|
||||
},
|
||||
/**
|
||||
* 重置字段信息
|
||||
*/
|
||||
resetFieldExtract() {
|
||||
this.columnInfo.list = []
|
||||
this.previewDate.header = []
|
||||
|
|
@ -378,6 +412,7 @@ export default {
|
|||
return
|
||||
}
|
||||
let columnList = []
|
||||
this.columnInfo.list = []
|
||||
this.previewDate.header.forEach(item => {
|
||||
columnList.push({
|
||||
prop: item.key,
|
||||
|
|
@ -475,15 +510,14 @@ export default {
|
|||
})
|
||||
},
|
||||
/** 预览 */
|
||||
previewQuery() {
|
||||
this.$refs['elForm'].validate(valid => {
|
||||
previewQuery(){
|
||||
this.$refs['elForm'].validate( valid=>{
|
||||
if (valid) {
|
||||
let list = JSONString(this.columns)
|
||||
let data = {
|
||||
pageNum: this.queryParams.pageNum,
|
||||
pageSize: this.queryParams.pageSize,
|
||||
uqSql: this.info.uqSql
|
||||
|
||||
}
|
||||
if (list.length > 0) {
|
||||
if (this.changUniCon(list)) {
|
||||
|
|
@ -492,6 +526,17 @@ export default {
|
|||
return
|
||||
}
|
||||
}
|
||||
for (let i = 0; i < this.columnInfo.list.length; i++) {
|
||||
let info = this.columnInfo.list[i]
|
||||
if (info.dictType!=null){
|
||||
this.getDicts(info.dictType).then(res=>{
|
||||
this.dictTypeDataList[info.dictType] = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 预览数据请求
|
||||
*/
|
||||
previewQueryData(data).then(res => {
|
||||
this.previewDate.data = res.rows
|
||||
this.total = res.total
|
||||
|
|
@ -624,6 +669,7 @@ export default {
|
|||
return
|
||||
}
|
||||
}
|
||||
data.infoList = that.columnInfo.list
|
||||
return exportMock(data)
|
||||
}).then(response => {
|
||||
that.columns = JSONParse(list)
|
||||
|
|
|
|||
|
|
@ -196,22 +196,14 @@ export default {
|
|||
|
||||
},
|
||||
methods: {
|
||||
|
||||
// todo 异步请求问题 字典状态字典翻译
|
||||
dictFormat: async function(dictType, data) {
|
||||
console.log("请求开始",dictType, !this.dictTypeDataList[dictType])
|
||||
if (!this.dictTypeDataList[dictType]) {
|
||||
this.dictTypeDataList[dictType] = {}
|
||||
await this.getDicts(dictType).then(res => {
|
||||
this.dictTypeDataList[dictType] = res.data
|
||||
console.log("请求响应",res.data)
|
||||
console.log("数据集",this.dictTypeDataList)
|
||||
})
|
||||
}
|
||||
console.log('准备执行字段渲染',this.dictTypeDataList[dictType], data)
|
||||
let res = this.selectDictLabel(this.dictTypeDataList[dictType], data + '')
|
||||
console.log(res,"rses")
|
||||
return res;
|
||||
/**
|
||||
* 字典渲染
|
||||
* @param dictType
|
||||
* @param data
|
||||
* @returns {*}
|
||||
*/
|
||||
dictFormat(dictType, data) {
|
||||
return this.selectDictLabel(this.dictTypeDataList[dictType], data)
|
||||
},
|
||||
/**
|
||||
* 重置
|
||||
|
|
@ -297,11 +289,7 @@ export default {
|
|||
isRelease: release
|
||||
}
|
||||
Release(data).then(res => {
|
||||
that.$router.replace('/tool/er-top')
|
||||
Message({
|
||||
message: res.msg,
|
||||
type: 'success'
|
||||
})
|
||||
window.close()
|
||||
})
|
||||
})
|
||||
},
|
||||
|
|
@ -338,6 +326,7 @@ export default {
|
|||
id: this.topId
|
||||
}
|
||||
preview(data).then(res => {
|
||||
this.dictTypeDataList = res.dictList
|
||||
this.previewDate.data = res.rows
|
||||
this.previewDate.total = res.total
|
||||
this.previewDate.uconList = res.uconList
|
||||
|
|
@ -353,11 +342,6 @@ export default {
|
|||
prop: info.prop,
|
||||
dictType: info.dictType
|
||||
})
|
||||
// if (info.dictType!=null){
|
||||
// this.getDicts(info.dictType).then(res => {
|
||||
// this.dictTypeDataList[info.dictType] = res.data
|
||||
// })
|
||||
// }
|
||||
})
|
||||
this.previewDate.title = this.baseData.uqName + '数据预览'
|
||||
this.previewDate.open = true
|
||||
|
|
|
|||
Loading…
Reference in New Issue