提交 94a2395c authored 作者: taojinlong's avatar taojinlong

Merge branch 'main' of github.com:dataease/dataease into main

...@@ -44,4 +44,9 @@ public class ChartViewController { ...@@ -44,4 +44,9 @@ public class ChartViewController {
public ChartViewDTO getData(@PathVariable String id) throws Exception { public ChartViewDTO getData(@PathVariable String id) throws Exception {
return chartViewService.getData(id); return chartViewService.getData(id);
} }
@PostMapping("chartDetail/{id}")
public Map<String, Object> chartDetail(@PathVariable String id) {
return chartViewService.getChartDetail(id);
}
} }
...@@ -82,4 +82,8 @@ public class DataSetTableController { ...@@ -82,4 +82,8 @@ public class DataSetTableController {
dataSetTableService.saveIncrementalConfig(datasetTableIncrementalConfig); dataSetTableService.saveIncrementalConfig(datasetTableIncrementalConfig);
} }
@PostMapping("datasetDetail/{id}")
public Map<String, Object> datasetDetail(@PathVariable String id) {
return dataSetTableService.getDatasetDetail(id);
}
} }
...@@ -20,6 +20,7 @@ import io.dataease.service.dataset.DataSetTableFieldsService; ...@@ -20,6 +20,7 @@ import io.dataease.service.dataset.DataSetTableFieldsService;
import io.dataease.service.dataset.DataSetTableService; import io.dataease.service.dataset.DataSetTableService;
import io.dataease.service.spark.SparkCalc; import io.dataease.service.spark.SparkCalc;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -249,4 +250,15 @@ public class ChartViewService { ...@@ -249,4 +250,15 @@ public class ChartViewService {
throw new RuntimeException("Name can't repeat in same group."); throw new RuntimeException("Name can't repeat in same group.");
} }
} }
public Map<String, Object> getChartDetail(String id) {
Map<String, Object> map = new HashMap<>();
ChartViewWithBLOBs chartViewWithBLOBs = chartViewMapper.selectByPrimaryKey(id);
map.put("chart", chartViewWithBLOBs);
if (ObjectUtils.isNotEmpty(chartViewWithBLOBs)) {
Map<String, Object> datasetDetail = dataSetTableService.getDatasetDetail(chartViewWithBLOBs.getTableId());
map.putAll(datasetDetail);
}
return map;
}
} }
...@@ -16,6 +16,7 @@ import io.dataease.datasource.provider.ProviderFactory; ...@@ -16,6 +16,7 @@ import io.dataease.datasource.provider.ProviderFactory;
import io.dataease.datasource.request.DatasourceRequest; import io.dataease.datasource.request.DatasourceRequest;
import io.dataease.dto.dataset.DataTableInfoDTO; import io.dataease.dto.dataset.DataTableInfoDTO;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -422,4 +423,15 @@ public class DataSetTableService { ...@@ -422,4 +423,15 @@ public class DataSetTableService {
throw new RuntimeException("Name can't repeat in same group."); throw new RuntimeException("Name can't repeat in same group.");
} }
} }
public Map<String, Object> getDatasetDetail(String id) {
Map<String, Object> map = new HashMap<>();
DatasetTable table = datasetTableMapper.selectByPrimaryKey(id);
map.put("table", table);
if (ObjectUtils.isNotEmpty(table)) {
Datasource datasource = datasourceMapper.selectByPrimaryKey(table.getDataSourceId());
map.put("datasource", datasource);
}
return map;
}
} }
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
<span v-show="isActive()" class="iconfont icon-xiangyouxuanzhuan" @mousedown="handleRotate" /> <span v-show="isActive()" class="iconfont icon-xiangyouxuanzhuan" @mousedown="handleRotate" />
<span v-show="element.isLock" class="iconfont icon-suo" /> <span v-show="element.isLock" class="iconfont icon-suo" />
<!-- <span v-show="isActive()" class="iconfont icon-more">--> <!-- <span v-show="isActive()" class="iconfont icon-more">-->
<!-- <el-button--> <!-- <el-button-->
<!-- icon="el-icon-more"--> <!-- icon="el-icon-more"-->
<!-- type="text"--> <!-- type="text"-->
<!-- size="small"--> <!-- size="small"-->
<!-- />--> <!-- />-->
<!-- </span>--> <!-- </span>-->
<div <div
v-for="item in (isActive()? pointList : [])" v-for="item in (isActive()? pointList : [])"
:key="item" :key="item"
...@@ -335,9 +335,9 @@ export default { ...@@ -335,9 +335,9 @@ export default {
symmetricPoint symmetricPoint
}) })
console.log('this is test:' + JSON.stringify(this.element.propValue.viewId)) // console.log('this is test:' + JSON.stringify(this.element.propValue.viewId))
this.$store.commit('setShapeStyle', style) this.$store.commit('setShapeStyle', style)
eventBus.$emit('resizing', this.element.propValue.viewId) this.element.propValue && this.element.propValue.viewId && eventBus.$emit('resizing', this.element.propValue.viewId)
} }
const up = () => { const up = () => {
......
...@@ -30,8 +30,8 @@ ...@@ -30,8 +30,8 @@
:id="'component' + item.id" :id="'component' + item.id"
class="component" class="component"
:style="getComponentStyle(item.style)" :style="getComponentStyle(item.style)"
:element="item" :service-name="item.widgetService.name"
:item="item" :panel-id="panelInfo.id"
@filter-value-change="filterValueChange" @filter-value-change="filterValueChange"
/> />
...@@ -97,12 +97,18 @@ export default { ...@@ -97,12 +97,18 @@ export default {
isShowArea: false isShowArea: false
} }
}, },
computed: mapState([ computed: {
'componentData', panelInfo() {
'curComponent', return this.$store.state.panel.panelInfo
'canvasStyleData', },
'editor' ...mapState([
]), 'componentData',
'curComponent',
'canvasStyleData',
'editor'
])
},
mounted() { mounted() {
// 获取编辑器元素 // 获取编辑器元素
this.$store.commit('getEditor') this.$store.commit('getEditor')
......
<script> <script>
import { ApplicationContext } from '@/utils/ApplicationContext'
export default { export default {
name: 'DeDrawingWidget', name: 'DeDrawingWidget',
functional: true, functional: true,
props: { props: {
item: { serviceName: {
type: Object, type: String,
default: null
},
panelId: {
type: String,
default: null default: null
} }
}, },
render(createElement, context) { render(createElement, context) {
const item = context.props.item const widgetInfo = ApplicationContext.getService(context.props.serviceName)
return createElement(item.component, { // const widgetInfo = context.props.widgetInfo
const panelId = context.props.panelId
const dialogInfo = widgetInfo.getDialogPanel && widgetInfo.getDialogPanel(panelId) || null
if (!dialogInfo) {
throw new Error('系统错误')
}
return createElement(dialogInfo.component, {
props: { props: {
element: item element: dialogInfo
}, },
on: { on: {
'value-change': value => { 'value-change': value => {
......
import { DrawWidgetService } from '../service/DrawWidgetService'
const leftPanel = {
// name: 'text-select',
icon: 'iconfont icon-xialakuang',
label: '文本下拉',
defaultClass: 'text-filter'
}
const dialogPanel = {
options: {
refId: '1234567890',
attrs: {
multiple: false,
placeholder: '请选择',
datas: [],
key: 'id',
label: 'text',
value: 'id'
},
value: ''
},
defaultClass: 'text-filter',
component: 'de-select'
}
const drawPanel = {
type: 'custom',
style: {
width: 200,
height: 22,
fontSize: 14,
fontWeight: 500,
lineHeight: '',
letterSpacing: 0,
textAlign: '',
color: ''
},
component: 'de-select'
}
class MySelectImpl extends DrawWidgetService {
constructor(options = {}) {
Object.assign(options, { name: 'mySelectWidget' })
super(options)
}
initLeftPanel(uuid) {
uuid = uuid || this.uuid()
this.setLeftPanel(uuid, leftPanel)
return uuid
// console.log('this is first initWidget')
}
initFilterDialog(uuid) {
uuid = uuid || this.uuid()
this.setDialogPanel(uuid, dialogPanel)
return uuid
}
initDrawPanel(uuid) {
uuid = uuid || this.uuid()
this.setDrawPanel(uuid, drawPanel)
return uuid
}
toDrawWidget() {
// console.log('this is first toDrawWidget')
}
// 移动到画布之前回掉
beforeToDraw() {
}
setOptionDatas(uuid, data) {
const dialogPanel = this.getDialogPanel(uuid)
dialogPanel.options.attrs.datas = data
this.setDialogPanel(uuid, dialogPanel)
}
filterFieldMethod(fields) {
return fields.filter(field => {
return field['deType'] === 0
})
}
}
const mySelectImpl = new MySelectImpl()
export default mySelectImpl
...@@ -31,7 +31,8 @@ requireComponent.keys().forEach(fileName => { ...@@ -31,7 +31,8 @@ requireComponent.keys().forEach(fileName => {
) )
}) })
const req = require.context('./serviceImpl', false, /\.js$/) // const req = require.context('./serviceImpl', false, /\.js$/)
const req = require.context('./drawServiceImpl', false, /\.js$/)
const requireAll = requireContext => requireContext.keys() const requireAll = requireContext => requireContext.keys()
const widgets = {} const widgets = {}
......
import store from '@/store'
import { uuid } from 'vue-uuid'
export const commonStyle = {
rotate: 0,
opacity: 1
}
export const commonAttr = {
animations: [],
events: {},
groupStyle: {}, // 当一个组件成为 Group 的子组件时使用
isLock: false // 是否锁定组件
}
export class DrawWidgetService {
constructor(options) {
this.options = options
this.name = options.name
this.leftPanelPath = 'application/addLeftWidget'
this.dialogPanelPath = 'application/addDialogWidget'
this.drawPanelPath = 'application/addDrawWidget'
this.storeWidget()
}
/**
* 存储数据到本地
* @param {本地存储路径} path
* @param {要存储的数据} data
*/
store(path, data) {
store.dispatch(path, data)
}
uuid() {
return uuid.v1()
}
setLeftPanel(uuid, leftPanel) {
this.store(this.leftPanelPath, { uuid: uuid, leftPanel: leftPanel })
}
getLeftPanel(uuid) {
if (!store.getters.leftWidgetMap[uuid]) {
this.initLeftPanel && this.initLeftPanel(uuid)
}
return store.getters.leftWidgetMap[uuid]
}
setDialogPanel(uuid, dialogPanel) {
this.store(this.dialogPanelPath, { uuid: uuid, dialogPanel: dialogPanel })
}
getDialogPanel(uuid) {
if (!store.getters.dialogWidgetMap[uuid]) {
this.initFilterDialog && this.initFilterDialog(uuid)
}
return store.getters.dialogWidgetMap[uuid]
}
setDrawPanel(uuid, drawPanel) {
if (!store.getters.drawWidgetMap[uuid]) { // 第一次
drawPanel.style = Object.assign(drawPanel.style, commonStyle)
drawPanel = Object.assign(drawPanel, commonAttr)
if (this.initFilterDialog) { // 需要弹窗
const dialogOptions = this.getDialogPanel(uuid)
drawPanel = Object.assign(drawPanel, dialogOptions)
}
}
this.store(this.drawPanelPath, { uuid: uuid, drawPanel: drawPanel })
}
getDrawPanel(uuid) {
if (!store.getters.drawWidgetMap[uuid]) {
this.initDrawPanel && this.initDrawPanel(uuid)
}
return store.getters.drawWidgetMap[uuid]
}
storeWidget() {
// store.dispatch('application/loadBean', { key: this.name, value: this })
this.store('application/loadBean', { key: this.name, value: this })
}
initWidget() {
console.log('this is initWidget')
}
toDrawWidget() {
console.log('this is toDrawWidget')
}
}
...@@ -779,9 +779,14 @@ export default { ...@@ -779,9 +779,14 @@ export default {
showRow: '显示行', showRow: '显示行',
add_excel_table: '添加Excel数据集', add_excel_table: '添加Excel数据集',
add_custom_table: '添加自助数据集', add_custom_table: '添加自助数据集',
upload_file: '上传文件' upload_file: '上传文件',
detail: '详情',
type: '类型',
create_by: '创建者',
create_time: '创建时间'
}, },
datasource: { datasource: {
datasource: '数据源',
create: '新建数据连接', create: '新建数据连接',
type: '类型', type: '类型',
please_choose_type: '请选择数据源类型', please_choose_type: '请选择数据源类型',
......
...@@ -18,6 +18,9 @@ const getters = { ...@@ -18,6 +18,9 @@ const getters = {
loadingMap: state => state.request.loadingMap, loadingMap: state => state.request.loadingMap,
currentPath: state => state.permission.currentPath, currentPath: state => state.permission.currentPath,
permissions: state => state.user.permissions, permissions: state => state.user.permissions,
beanMap: state => state.application.beanMap beanMap: state => state.application.beanMap,
leftWidgetMap: state => state.application.leftWidgetMap,
dialogWidgetMap: state => state.application.dialogWidgetMap,
drawWidgetMap: state => state.application.drawWidgetMap
} }
export default getters export default getters
const state = { const state = {
beanMap: {} beanMap: {},
leftWidgetMap: {},
dialogWidgetMap: {},
drawWidgetMap: {}
} }
const mutations = { const mutations = {
ADD_BEAN: (state, { key, value }) => { ADD_BEAN: (state, { key, value }) => {
state.beanMap[key] = value state.beanMap[key] = value
},
ADD_LEFT_WIDGET: (state, { uuid, leftPanel }) => {
state.leftWidgetMap[uuid] = leftPanel
},
ADD_DIALOG_WIDGET: (state, { uuid, dialogPanel }) => {
state.dialogWidgetMap[uuid] = dialogPanel
},
ADD_DRAW_WIDGET: (state, { uuid, drawPanel }) => {
state.drawWidgetMap[uuid] = drawPanel
} }
} }
...@@ -13,7 +28,20 @@ const mutations = { ...@@ -13,7 +28,20 @@ const mutations = {
const actions = { const actions = {
loadBean({ commit }, data) { loadBean({ commit }, data) {
commit('ADD_BEAN', data) commit('ADD_BEAN', data)
},
addLeftWidget({ commit }, data) {
commit('ADD_LEFT_WIDGET', data)
},
addDialogWidget({ commit }, data) {
commit('ADD_DIALOG_WIDGET', data)
},
addDrawWidget({ commit }, data) {
commit('ADD_DRAW_WIDGET', data)
} }
} }
export default { export default {
......
...@@ -2,7 +2,16 @@ ...@@ -2,7 +2,16 @@
<el-row style="height: 100%;overflow-y: hidden;width: 100%;"> <el-row style="height: 100%;overflow-y: hidden;width: 100%;">
<span v-show="false">{{ vId }}</span> <span v-show="false">{{ vId }}</span>
<el-row style="height: 40px;background-color: white" class="padding-lr"> <el-row style="height: 40px;background-color: white" class="padding-lr">
<span style="line-height: 40px;">{{ view.name }}</span> <el-popover
placement="right-start"
width="400"
trigger="click"
@show="showTab"
@hide="hideTab"
>
<dataset-chart-detail type="chart" :data="view" :tab-status="tabStatus" />
<span slot="reference" style="line-height: 40px;cursor: pointer;">{{ view.name }}</span>
</el-popover>
<span style="float: right;line-height: 40px;"> <span style="float: right;line-height: 40px;">
<el-button size="mini" @click="closeEdit"> <el-button size="mini" @click="closeEdit">
{{ $t('chart.close') }} {{ $t('chart.close') }}
...@@ -229,6 +238,7 @@ import QuotaItem from '../components/drag-item/QuotaItem' ...@@ -229,6 +238,7 @@ import QuotaItem from '../components/drag-item/QuotaItem'
import FilterItem from '../components/drag-item/FilterItem' import FilterItem from '../components/drag-item/FilterItem'
import ChartComponent from '../components/ChartComponent' import ChartComponent from '../components/ChartComponent'
import bus from '@/utils/bus' import bus from '@/utils/bus'
import DatasetChartDetail from '../../dataset/common/DatasetChartDetail'
// shape attr,component style // shape attr,component style
import { import {
...@@ -255,7 +265,7 @@ import QuotaFilterEditor from '../components/filter/QuotaFilterEditor' ...@@ -255,7 +265,7 @@ import QuotaFilterEditor from '../components/filter/QuotaFilterEditor'
export default { export default {
name: 'ChartEdit', name: 'ChartEdit',
components: { QuotaFilterEditor, BackgroundColorSelector, FilterItem, XAxisSelector, YAxisSelector, TooltipSelector, LabelSelector, LegendSelector, TitleSelector, SizeSelector, ColorSelector, ChartComponent, QuotaItem, DimensionItem, draggable }, components: { DatasetChartDetail, QuotaFilterEditor, BackgroundColorSelector, FilterItem, XAxisSelector, YAxisSelector, TooltipSelector, LabelSelector, LegendSelector, TitleSelector, SizeSelector, ColorSelector, ChartComponent, QuotaItem, DimensionItem, draggable },
data() { data() {
return { return {
table: {}, table: {},
...@@ -296,7 +306,8 @@ export default { ...@@ -296,7 +306,8 @@ export default {
name: [ name: [
{ required: true, message: this.$t('commons.input_content'), trigger: 'change' } { required: true, message: this.$t('commons.input_content'), trigger: 'change' }
] ]
} },
tabStatus: false
} }
}, },
computed: { computed: {
...@@ -577,6 +588,13 @@ export default { ...@@ -577,6 +588,13 @@ export default {
}, },
resetRename() { resetRename() {
// this.itemForm = {} // this.itemForm = {}
},
showTab() {
this.tabStatus = true
},
hideTab() {
this.tabStatus = false
} }
} }
} }
......
<template>
<el-col>
<el-row>
<span style="font-weight: 500;">{{ $t('dataset.detail') }}</span>
</el-row>
<el-col>
<el-tabs v-if="tabStatus" v-model="tabActive" class="info-tab">
<el-tab-pane v-if="type === 'chart'" :label="$t('chart.datalist')" name="chart">
<el-col class="info-item">
<p class="info-title">{{ $t('commons.name') }}</p>
<p class="info-content">{{ detail.chart.name }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('chart.chart_type') }}</p>
<svg-icon v-if="detail.chart.type" :icon-class="detail.chart.type" />
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('chart.title') }}</p>
<p class="info-content">{{ detail.chart.title || 'N/A' }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('dataset.create_by') }}</p>
<p class="info-content">{{ detail.chart.createBy }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('dataset.create_time') }}</p>
<p class="info-content">{{ detail.chart.createTime | timestampFormatDate }}</p>
</el-col>
</el-tab-pane>
<el-tab-pane :label="$t('dataset.datalist')" name="table">
<el-col class="info-item">
<p class="info-title">{{ $t('commons.name') }}</p>
<p class="info-content">{{ detail.table.name }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('dataset.type') }}</p>
<p v-if="detail.table.type === 'db'" class="info-content">{{ $t('dataset.db_data') }}</p>
<p v-if="detail.table.type === 'sql'" class="info-content">{{ $t('dataset.sql_data') }}</p>
<p v-if="detail.table.type === 'excel'" class="info-content">{{ $t('dataset.excel_data') }}</p>
<p v-if="detail.table.type === 'custom'" class="info-content">{{ $t('dataset.custom_data') }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('dataset.mode') }}</p>
<p v-if="detail.table.mode === 0" class="info-content">{{ $t('dataset.direct_connect') }}</p>
<p v-if="detail.table.mode === 1" class="info-content">{{ $t('dataset.sync_data') }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('dataset.create_by') }}</p>
<p class="info-content">{{ detail.table.createBy }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('dataset.create_time') }}</p>
<p class="info-content">{{ detail.table.createTime | timestampFormatDate }}</p>
</el-col>
</el-tab-pane>
<el-tab-pane :label="$t('datasource.datasource')" name="datasource">
<el-col class="info-item">
<p class="info-title">{{ $t('commons.name') }}</p>
<p class="info-content">{{ detail.datasource.name }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('commons.description') }}</p>
<p class="info-content">{{ detail.datasource.desc || 'N/A' }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('datasource.type') }}</p>
<p class="info-content">{{ detail.datasource.type }}</p>
</el-col>
<el-col class="info-item">
<p class="info-title">{{ $t('dataset.create_time') }}</p>
<p class="info-content">{{ detail.datasource.createTime | timestampFormatDate }}</p>
</el-col>
</el-tab-pane>
</el-tabs>
</el-col>
</el-col>
</template>
<script>
import { post } from '@/api/dataset/dataset'
export default {
name: 'DatasetChartDetail',
props: {
type: {
type: String,
required: true
},
data: {
type: Object,
required: true
},
tabStatus: {
type: Boolean,
required: true
}
},
data() {
return {
tabActive: 'chart',
detail: {
chart: {},
table: {},
datasource: {}
}
}
},
watch: {
'data': function() {
this.init()
},
'type': function() {
this.typeChange()
},
'tabStatus': function() {
this.typeChange()
}
},
mounted() {
this.init()
},
methods: {
init() {
if (this.data.id) {
if (this.type === 'dataset') {
post('/dataset/table/datasetDetail/' + this.data.id, null).then(res => {
this.detail = res.data
})
} else if (this.type === 'chart') {
post('/chart/view/chartDetail/' + this.data.id, null).then(res => {
this.detail = res.data
})
}
}
},
typeChange() {
if (this.type === 'dataset') {
this.tabActive = 'table'
} else if (this.type === 'chart') {
this.tabActive = 'chart'
}
}
}
}
</script>
<style scoped>
.info-tab>>>.el-tabs__item{
font-weight: 400;
font-size: 12px;
}
.info-item{
margin: 6px 0;
}
.info-title{
margin: 0!important;
font-weight: 600;
font-size: 12px;
}
.info-content{
margin: 0!important;
font-size: 12px;
}
</style>
...@@ -3,9 +3,18 @@ ...@@ -3,9 +3,18 @@
<el-row> <el-row>
<el-row style="height: 26px;"> <el-row style="height: 26px;">
<span v-show="false">{{ tableId }}</span> <span v-show="false">{{ tableId }}</span>
<span style="line-height: 26px;"> <el-popover
{{ table.name }} placement="right-start"
</span> width="400"
trigger="click"
@show="showTab"
@hide="hideTab"
>
<dataset-chart-detail type="dataset" :data="table" :tab-status="tabStatus" />
<span slot="reference" style="line-height: 26px;cursor: pointer;">
{{ table.name }}
</span>
</el-popover>
<el-row style="float: right"> <el-row style="float: right">
<el-button v-if="table.type ==='sql'" size="mini" @click="editSql"> <el-button v-if="table.type ==='sql'" size="mini" @click="editSql">
{{ $t('dataset.edit_sql') }} {{ $t('dataset.edit_sql') }}
...@@ -81,10 +90,11 @@ ...@@ -81,10 +90,11 @@
import { getTable, getPreviewData, fieldList, batchEdit } from '@/api/dataset/dataset' import { getTable, getPreviewData, fieldList, batchEdit } from '@/api/dataset/dataset'
import TabDataPreview from './TabDataPreview' import TabDataPreview from './TabDataPreview'
import UpdateInfo from './UpdateInfo' import UpdateInfo from './UpdateInfo'
import DatasetChartDetail from '../common/DatasetChartDetail'
export default { export default {
name: 'ViewTable', name: 'ViewTable',
components: { UpdateInfo, TabDataPreview }, components: { DatasetChartDetail, UpdateInfo, TabDataPreview },
data() { data() {
return { return {
createViewDialog: false, createViewDialog: false,
...@@ -98,7 +108,8 @@ export default { ...@@ -98,7 +108,8 @@ export default {
tableFields: [], tableFields: [],
tableViewRowForm: { tableViewRowForm: {
row: 1000 row: 1000
} },
tabStatus: false
} }
}, },
computed: { computed: {
...@@ -173,6 +184,13 @@ export default { ...@@ -173,6 +184,13 @@ export default {
reSearch(val) { reSearch(val) {
this.tableViewRowForm = val this.tableViewRowForm = val
this.initPreviewData() this.initPreviewData()
},
showTab() {
this.tabStatus = true
},
hideTab() {
this.tabStatus = false
} }
} }
} }
......
...@@ -69,19 +69,18 @@ ...@@ -69,19 +69,18 @@
</de-container> </de-container>
<el-dialog <el-dialog
v-if="filterVisible" v-if="filterVisible && panelInfo.id"
title="过滤组件" title="过滤组件"
:visible.sync="filterVisible" :visible.sync="filterVisible"
custom-class="de-filter-dialog" custom-class="de-filter-dialog"
> >
<filter-dialog v-if="filterVisible" :component-info="currentComponent" :widget-id="currentWidgetId" @re-fresh-component="reFreshComponent"> <filter-dialog v-if="filterVisible && currentWidget" :widget-info="currentWidget" @re-fresh-component="reFreshComponent">
<de-drawing-widget <de-drawing-widget
v-if="filterVisible && currentComponent" v-if="filterVisible"
:id="'component' + currentComponent.id"
style="width: 100% !important;" style="width: 100% !important;"
class="component" class="component"
:element="currentComponent" :service-name="currentWidget.name"
:item="currentComponent" :panel-id="panelInfo.id"
/> />
</filter-dialog> </filter-dialog>
<!-- <div slot="footer" class="dialog-footer"> <!-- <div slot="footer" class="dialog-footer">
...@@ -144,9 +143,7 @@ export default { ...@@ -144,9 +143,7 @@ export default {
activeName: 'attr', activeName: 'attr',
reSelectAnimateIndex: undefined, reSelectAnimateIndex: undefined,
filterVisible: false, filterVisible: false,
currentWidgetId: null, currentWidget: null
currentWidget: null,
currentComponent: null
} }
}, },
...@@ -252,6 +249,7 @@ export default { ...@@ -252,6 +249,7 @@ export default {
e.stopPropagation() e.stopPropagation()
let component let component
const newComponentId = uuid.v1() const newComponentId = uuid.v1()
const componentInfo = JSON.parse(e.dataTransfer.getData('componentInfo')) const componentInfo = JSON.parse(e.dataTransfer.getData('componentInfo'))
// 用户视图设置 复制一个模板 // 用户视图设置 复制一个模板
...@@ -268,16 +266,18 @@ export default { ...@@ -268,16 +266,18 @@ export default {
}) })
} else { } else {
this.currentWidget = ApplicationContext.getService(componentInfo.id) this.currentWidget = ApplicationContext.getService(componentInfo.id)
if (this.currentWidget.filterDialog) {
const drawPanel = this.currentWidget.getDrawPanel(this.panelInfo.id)
drawPanel.style.top = e.offsetY
drawPanel.style.left = e.offsetX
drawPanel.id = newComponentId
this.currentWidget.setDrawPanel(this.panelInfo.id, drawPanel)
if (this.currentWidget.initFilterDialog) {
this.show = false this.show = false
this.currentComponent = deepCopy(this.currentWidget)
this.currentComponent.style.top = e.offsetY
this.currentComponent.style.left = e.offsetX
this.currentComponent.id = newComponentId
this.openFilterDiolog() this.openFilterDiolog()
return return
} }
component = deepCopy(this.currentWidget) component = deepCopy(drawPanel)
} }
component.style.top = e.offsetY component.style.top = e.offsetY
...@@ -311,17 +311,16 @@ export default { ...@@ -311,17 +311,16 @@ export default {
} }
}, },
openFilterDiolog() { openFilterDiolog() {
this.currentWidgetId = this.currentComponent.name
this.filterVisible = true this.filterVisible = true
}, },
cancelFilter() { cancelFilter() {
this.filterVisible = false this.filterVisible = false
this.currentWidgetId = null
this.currentWidget = null this.currentWidget = null
this.currentComponent = null
}, },
sureFilter() { sureFilter() {
const component = deepCopy(this.currentComponent) const currentComponent = this.currentWidget.getDrawPanel(this.panelInfo.id)
currentComponent.widgetService = this.currentWidget
const component = deepCopy(currentComponent)
this.$store.commit('addComponent', { component }) this.$store.commit('addComponent', { component })
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot')
this.cancelFilter() this.cancelFilter()
......
...@@ -144,7 +144,7 @@ import DeContainer from '@/components/dataease/DeContainer' ...@@ -144,7 +144,7 @@ import DeContainer from '@/components/dataease/DeContainer'
import DeAsideContainer from '@/components/dataease/DeAsideContainer' import DeAsideContainer from '@/components/dataease/DeAsideContainer'
import draggable from 'vuedraggable' import draggable from 'vuedraggable'
import DragItem from '@/components/DragItem' import DragItem from '@/components/DragItem'
import { ApplicationContext } from '@/utils/ApplicationContext' // import { ApplicationContext } from '@/utils/ApplicationContext'
import { groupTree, loadTable, fieldList, fieldValues } from '@/api/dataset/dataset' import { groupTree, loadTable, fieldList, fieldValues } from '@/api/dataset/dataset'
export default { export default {
name: 'FilterDialog', name: 'FilterDialog',
...@@ -156,11 +156,8 @@ export default { ...@@ -156,11 +156,8 @@ export default {
DragItem DragItem
}, },
props: { props: {
widgetId: {
type: String, widgetInfo: {
default: null
},
componentInfo: {
type: Object, type: Object,
default: null default: null
} }
...@@ -184,23 +181,29 @@ export default { ...@@ -184,23 +181,29 @@ export default {
fieldValues: [] fieldValues: []
} }
}, },
computed: {
uuid() {
return this.$store.state.panel.panelInfo.id
}
},
watch: { watch: {
selectField(values) { selectField(values) {
if (values && values.length > 0) { if (values && values.length > 0) {
const value = values[0] const value = values[0]
const fieldId = value.id const fieldId = value.id
this.componentInfo && this.componentInfo.setOptionDatas && fieldValues(fieldId).then(res => { this.widget && this.widget.setOptionDatas && fieldValues(fieldId).then(res => {
const datas = res.data.map(item => { const datas = res.data.map(item => {
return { id: item, text: item } return { id: item, text: item }
}) })
this.componentInfo.setOptionDatas(datas) this.widget.setOptionDatas(this.uuid, datas)
this.$emit('re-fresh-component', this.componentInfo) // this.$emit('re-fresh-component', this.componentInfo)
}) })
} }
} }
}, },
created() { created() {
this.widget = ApplicationContext.getService(this.widgetId) // this.widget = ApplicationContext.getService(this.widgetId)
this.widget = this.widgetInfo
this.loadDataSetTree() this.loadDataSetTree()
}, },
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
<div class="filter-widget-content"> <div class="filter-widget-content">
<div <div
v-for="(widget, index) in item" v-for="(widget, index) in item"
:key="widget.name+index" :key="widget.widgetName+index"
:data-id="widget.name" :data-id="widget.widgetName"
draggable draggable
:data-index="index" :data-index="index"
:class="'filter-widget '+ (widget.defaultClass || '')" :class="'filter-widget '+ (widget.defaultClass || '')"
...@@ -35,23 +35,29 @@ export default { ...@@ -35,23 +35,29 @@ export default {
data() { data() {
return { return {
componentList, componentList,
panelInfo: this.$store.state.panel.panelInfo,
widgetSubjects: { widgetSubjects: {
'时间过滤组件': [
'timeYearWidget',
'timeMonthWidget',
'timeQuarterWidget',
'timeDateWidget',
'timeDateRangeWidget'
],
'文本过滤组件': [ '文本过滤组件': [
'textSelectWidget', 'mySelectWidget'
'textInputWidget'
],
'按钮': [
'buttonSureWidget'
] ]
} }
// widgetSubjects: {
// '时间过滤组件': [
// 'timeYearWidget',
// 'timeMonthWidget',
// 'timeQuarterWidget',
// 'timeDateWidget',
// 'timeDateRangeWidget'
// ],
// '文本过滤组件': [
// 'textSelectWidget',
// 'textInputWidget'
// ],
// '按钮': [
// 'buttonSureWidget'
// ]
// }
} }
}, },
created() { created() {
...@@ -59,7 +65,11 @@ export default { ...@@ -59,7 +65,11 @@ export default {
const widgetNames = this.widgetSubjects[key] const widgetNames = this.widgetSubjects[key]
this.widgetSubjects[key] = widgetNames.map(widgetName => { this.widgetSubjects[key] = widgetNames.map(widgetName => {
const widget = ApplicationContext.getService(widgetName) const widget = ApplicationContext.getService(widgetName)
return widget const uuid = this.panelInfo.id
// widget.initLeftPanel(uuid)
const result = { widgetName: widgetName }
Object.assign(result, widget.getLeftPanel(uuid))
return result
}) })
} }
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论