fix: 优化原始、自助、脚本、存储数据集在无数据,但是有输出字段时,数据预览依旧展示字段,根据输出字段来

main
wu.jian2 2 years ago
parent e642d4bf86
commit dc02f06ee6

@ -300,7 +300,7 @@
class="bs-el-table bs-scrollbar" class="bs-el-table bs-scrollbar"
> >
<el-table-column <el-table-column
v-for="(value, key) in dataPreviewList[0]" v-for="(value, key) in dataPreviewList[0] ? dataPreviewList[0] : noDataTableDisplayFields"
:key="key" :key="key"
:label="key" :label="key"
align="center" align="center"
@ -852,6 +852,14 @@ export default {
script: this.dataForm.script, script: this.dataForm.script,
paramsList: this.dataForm.paramsList paramsList: this.dataForm.paramsList
} }
},
noDataTableDisplayFields () {
//
const tableColumnObject = {}
this.structurePreviewList.forEach(item => {
tableColumnObject[item.fieldName] = ''
})
return tableColumnObject
} }
}, },
watch: { watch: {

@ -297,8 +297,9 @@
<span>{{ field.fieldName }}</span>&nbsp;<span <span>{{ field.fieldName }}</span>&nbsp;<span
v-show="field.fieldDesc" v-show="field.fieldDesc"
style="color: #909399;" style="color: #909399;"
>({{ >
field.fieldDesc }})</span> ({{ field.fieldDesc }})
</span>
<el-button <el-button
class="edit_field" class="edit_field"
type="text" type="text"
@ -332,7 +333,7 @@
class="bs-el-table bs-scrollbar" class="bs-el-table bs-scrollbar"
> >
<el-table-column <el-table-column
v-for="(value, key) in dataPreviewList[0]" v-for="(value, key) in dataPreviewList[0] ? dataPreviewList[0] : noDataTableDisplayFields"
:key="key" :key="key"
:label="key" :label="key"
align="center" align="center"
@ -568,6 +569,16 @@ export default {
isInit: false isInit: false
} }
}, },
computed: {
noDataTableDisplayFields () {
//
const tableColumnObject = {}
this.structurePreviewList.forEach(item => {
tableColumnObject[item.fieldName] = ''
})
return tableColumnObject
}
},
watch: { watch: {
'dataForm.fieldInfo': { 'dataForm.fieldInfo': {
handler (value) { handler (value) {
@ -588,6 +599,7 @@ export default {
deep: true, deep: true,
immediate: true immediate: true
} }
}, },
mounted () { mounted () {
this.init() this.init()
@ -671,9 +683,10 @@ export default {
this.tableLoading = true this.tableLoading = true
datasetExecuteTest(executeParams).then((data) => { datasetExecuteTest(executeParams).then((data) => {
if (this.dataForm.fieldList == null) { if (this.dataForm.fieldList == null) {
this.dataForm.fieldList = _.cloneDeep(res.structure) this.dataForm.fieldList = _.cloneDeep(data.structure)
} }
this.dataPreviewList = data.data.list this.dataPreviewList = data.data.list
console.log(this.dataPreviewList)
this.totalCount = data.data.totalCount this.totalCount = data.data.totalCount
this.tableLoading = false this.tableLoading = false
}).catch(() => { }).catch(() => {
@ -810,6 +823,7 @@ export default {
*/ */
queryAllField () { queryAllField () {
getTableFieldList(this.dataForm.sourceId, this.dataForm.tableName).then((data) => { getTableFieldList(this.dataForm.sourceId, this.dataForm.tableName).then((data) => {
console.log('data', data)
const fieldDescMap = {} const fieldDescMap = {}
this.fieldList = data.map(field => { this.fieldList = data.map(field => {
fieldDescMap[field.columnName] = field.columnComment fieldDescMap[field.columnName] = field.columnComment

@ -260,7 +260,7 @@
class="bs-el-table bs-scrollbar" class="bs-el-table bs-scrollbar"
> >
<el-table-column <el-table-column
v-for="(value, key) in dataPreviewList[0]" v-for="(value, key) in dataPreviewList[0] ? dataPreviewList[0] : noDataTableDisplayFields"
:key="key" :key="key"
:label="key" :label="key"
align="center" align="center"
@ -612,6 +612,16 @@ export default {
fieldDesc: null // fieldDesc: null //
} }
}, },
computed: {
noDataTableDisplayFields () {
//
const tableColumnObject = {}
this.structurePreviewList.forEach(item => {
tableColumnObject[item.fieldName] = ''
})
return tableColumnObject
}
},
watch: { watch: {
'dataForm.script' () { 'dataForm.script' () {
this.passTest = false this.passTest = false

@ -288,7 +288,7 @@
class="bs-el-table bs-scrollbar" class="bs-el-table bs-scrollbar"
> >
<el-table-column <el-table-column
v-for="(value, key) in dataPreviewList[0]" v-for="(value, key) in dataPreviewList[0] ? dataPreviewList[0] : noDataTableDisplayFields"
:key="key" :key="key"
:label="key" :label="key"
align="center" align="center"
@ -673,6 +673,14 @@ export default {
script: this.dataForm.script, script: this.dataForm.script,
paramsList: this.dataForm.paramsList paramsList: this.dataForm.paramsList
} }
},
noDataTableDisplayFields () {
//
const tableColumnObject = {}
this.structurePreviewList.forEach(item => {
tableColumnObject[item.fieldName] = ''
})
return tableColumnObject
} }
}, },
watch: { watch: {

Loading…
Cancel
Save