查询升级

This commit is contained in:
clay 2022-08-01 15:17:45 +08:00
parent f261d485a9
commit 788cd2c0d2
4 changed files with 84 additions and 39 deletions

View File

@ -95,6 +95,7 @@ export function addCreateDateRange(params, dateRange) {
// 回显数据字典
export function selectDictLabel(datas, value) {
console.log(datas)
let actions = [];
Object.keys(datas).some((key) => {
if (datas[key].dictValue === ('' + value)) {

View File

@ -172,7 +172,7 @@
<el-input v-model="scope.row.label"></el-input>
</template>
</el-table-column>
<el-table-column label="字典类型" min-width="10%">
<el-table-column label="显示字典类型" min-width="10%">
<template slot-scope="scope">
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
<el-option

View File

@ -163,7 +163,7 @@
</ul>
</div>
<div>
<el-dialog :title="selectedNodeParams.label" width="1200px"
<el-dialog :title="selectedNodeParams.label" width="1300px"
:visible.sync="tableColumnEditOpen"
@close="closeEditColumns">
<el-table
@ -203,7 +203,8 @@
<el-input v-model="scope.row.ucName" placeholder="请输入条件描述"/>
</template>
</el-table-column>
<el-table-column label="条件">
<el-table-column label="条件"
width="150px">
<template slot-scope="scope">
<el-select v-model="scope.row.ucCon" @change="ucTypeChang(scope.$index,scope.row)">
<el-option label="=" value="EQ"/>
@ -217,7 +218,8 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="显示类型">
<el-table-column label="显示类型"
width="150px">
<template slot-scope="scope">
<el-select v-model="scope.row.ucType" @change="ucTypeChang(scope.$index,scope.row)">
<el-option label="文本框" value="input"/>
@ -225,7 +227,8 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="模拟数据">
<el-table-column label="模拟数据"
width="260px">
<template slot-scope="scope">
<el-input v-if="scope.row.type == 1" placeholder="请输入模拟数据" v-model="scope.row.ucMock"></el-input>
<div v-else-if="scope.row.type == 2">
@ -258,6 +261,20 @@
></el-date-picker>
</template>
</el-table-column>
<el-table-column label="显示字典类型" width="150px">
<template slot-scope="scope">
<el-select v-model="scope.row.dictType" clearable filterable placeholder="请选择">
<el-option
v-for="dict in dictTypeList"
:key="dict.dictType"
:label="dict.dictName"
:value="dict.dictType">
<span style="float: left">{{ dict.dictName }}</span>
<span style="float: right; color: #8492a6; font-size: 13px">{{ dict.dictType }}</span>
</el-option>
</el-select>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
@ -325,6 +342,7 @@ export default {
nodes: [],
edges: []
},
dictTypeList:[],
// Column
tableColumnEditOpen:false,
loading: false,
@ -332,11 +350,6 @@ export default {
clientHeight: window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight,
//todo 线 er线
edgeShapeList: [
// { guid: "top-line", label: "线", class: "iconfont icon-flow-line" },
// { guid: "dice-er-edge", label: "线", class: "iconfont icon-flow-line" },
// { guid: "top-brokenline", label: "线", class: "iconfont icon-flow-broken" },
// { guid: "top-polyline", label: "线", class: "iconfont icon-flow-broken" },
// { guid: "top-cubic", label: "线", class: "iconfont icon-flow-curve" }
],
graph: null,
grid: null,
@ -510,7 +523,6 @@ export default {
//
editColumns() {
this.tableColumnEditOpen = true
},
// 线
tableCommentChang(e) {
@ -583,6 +595,9 @@ export default {
},
dragendHandler() {
},
tranDictData(list){
this.dictTypeList = list
},
initTopo(graphData) {
let self = this
if (self.graph) {
@ -1162,6 +1177,7 @@ export default {
item.type = 1
item.ucMock = ''
item.ucName = item.columnComment
item.dictType = null
columns.push(item)
}

View File

@ -80,23 +80,21 @@
<right-toolbar :showSearch.sync="previewDate.showSearch" @queryTable="handleQuery"></right-toolbar>
</el-row>
<el-table :data="previewDate.data">
<span v-for="(item,index) in previewDate.header">
<el-table-column v-if="checkDateType(item.prop)"
<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]) }}
</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>
<el-table-column v-else
:label="item.label"
align="center"
:key="index"
:prop="item.prop"
/>
</span>
</el-table>
<pagination
v-show="previewDate.total>0"
@ -116,10 +114,12 @@ import Topology from './packages/topology/src/topology'
import {deepClone} from './utils/index'
import {getQuery, getTables, updateQuery, preview} from '@/api/tool/top'
import {realData} from '@/api/system/data'
import { exportReal } from '../../../api/system/data'
import {exportReal} from '@/api/system/data'
import {optionSelect} from "@/api/system/dict/type";
import {eventBus} from "@/views/tool/top/utils/eventBus";
import {Release} from "@/api/tool/query";
import {Message} from "element-ui";
export default {
name: 'DemoTopology',
components: {
@ -162,7 +162,8 @@ export default {
tableComment: '主表字段',
relComment: '关联字段'
},
autoRefreshTimer: null
autoRefreshTimer: null,
dictTypeDataList: {}
}
},
mounted() {
@ -189,8 +190,29 @@ export default {
this.nodeTypeList = res.data.tables
this.relationalMap = res.data.relationalMap
})
optionSelect().then(res => {
this.$refs.topology.tranDictData(res.data)
})
},
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;
},
/**
* 重置
*/
@ -328,8 +350,14 @@ export default {
this.previewDate.header.push({
key: info.prop,
label: info.label,
prop: info.prop
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