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