forked from github/dataease
feat(仪表板): 仪表板新增查询按钮
This commit is contained in:
parent
9e69155606
commit
32aad19c60
@ -75,3 +75,6 @@ INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALU
|
|||||||
ALTER TABLE `panel_group`
|
ALTER TABLE `panel_group`
|
||||||
ADD COLUMN `update_by` varchar(255) NULL COMMENT '更新人' AFTER `status`,
|
ADD COLUMN `update_by` varchar(255) NULL COMMENT '更新人' AFTER `status`,
|
||||||
ADD COLUMN `update_time` bigint(13) NULL COMMENT '更新时间' AFTER `update_by`;
|
ADD COLUMN `update_time` bigint(13) NULL COMMENT '更新时间' AFTER `update_by`;
|
||||||
|
|
||||||
|
ALTER TABLE `sys_task_email`
|
||||||
|
ADD COLUMN `view_ids` varchar(255) NULL COMMENT '视图ID结婚' AFTER `task_id`;
|
||||||
|
@ -30,7 +30,8 @@ export default {
|
|||||||
copyData: null,
|
copyData: null,
|
||||||
editFilter: [
|
editFilter: [
|
||||||
'view',
|
'view',
|
||||||
'custom'
|
'custom',
|
||||||
|
'custom-button'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -56,6 +57,10 @@ export default {
|
|||||||
bus.$emit('component-dialog-edit')
|
bus.$emit('component-dialog-edit')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.curComponent.type === 'custom-button') {
|
||||||
|
bus.$emit('button-dialog-edit')
|
||||||
|
}
|
||||||
|
|
||||||
// 编辑样式组件
|
// 编辑样式组件
|
||||||
|
|
||||||
if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
||||||
|
@ -82,7 +82,8 @@ export default {
|
|||||||
linkageActiveStatus: false,
|
linkageActiveStatus: false,
|
||||||
editFilter: [
|
editFilter: [
|
||||||
'view',
|
'view',
|
||||||
'custom'
|
'custom',
|
||||||
|
'custom-button'
|
||||||
],
|
],
|
||||||
timer: null
|
timer: null
|
||||||
}
|
}
|
||||||
@ -216,6 +217,9 @@ export default {
|
|||||||
edit() {
|
edit() {
|
||||||
if (this.curComponent.type === 'custom') {
|
if (this.curComponent.type === 'custom') {
|
||||||
bus.$emit('component-dialog-edit', 'update')
|
bus.$emit('component-dialog-edit', 'update')
|
||||||
|
}
|
||||||
|
else if (this.curComponent.type === 'custom-button') {
|
||||||
|
bus.$emit('button-dialog-edit')
|
||||||
} else if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
} else if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
||||||
bus.$emit('component-dialog-style')
|
bus.$emit('component-dialog-style')
|
||||||
} else { bus.$emit('change_panel_right_draw', true) }
|
} else { bus.$emit('change_panel_right_draw', true) }
|
||||||
|
@ -60,7 +60,8 @@ export default {
|
|||||||
hyperlinksSetVisible: false,
|
hyperlinksSetVisible: false,
|
||||||
editFilter: [
|
editFilter: [
|
||||||
'view',
|
'view',
|
||||||
'custom'
|
'custom',
|
||||||
|
'custom-button'
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -72,6 +73,8 @@ export default {
|
|||||||
edit() {
|
edit() {
|
||||||
if (this.curComponent.type === 'custom') {
|
if (this.curComponent.type === 'custom') {
|
||||||
bus.$emit('component-dialog-edit', 'update')
|
bus.$emit('component-dialog-edit', 'update')
|
||||||
|
}else if (this.curComponent.type === 'custom-button') {
|
||||||
|
bus.$emit('button-dialog-edit')
|
||||||
} else if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
} else if (this.curComponent.type === 'v-text' || this.curComponent.type === 'de-rich-text' || this.curComponent.type === 'rect-shape') {
|
||||||
bus.$emit('component-dialog-style')
|
bus.$emit('component-dialog-style')
|
||||||
} else { bus.$emit('change_panel_right_draw', true) }
|
} else { bus.$emit('change_panel_right_draw', true) }
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
v-if="options!== null && options.attrs!==null"
|
v-if="options!== null && options.attrs!==null"
|
||||||
:type="options.attrs.type"
|
:type="options.attrs.type"
|
||||||
:round="options.attrs.round"
|
:round="options.attrs.round"
|
||||||
|
:plain="options.attrs.plain"
|
||||||
:size="size"
|
:size="size"
|
||||||
>
|
>
|
||||||
{{ options.value }}
|
{{ options.value }}
|
||||||
|
29
frontend/src/components/widget/DeWidget/SearchButton.vue
Normal file
29
frontend/src/components/widget/DeWidget/SearchButton.vue
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-button type="primary" @click="execute" plain>{{text}}</el-button>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'SearchButton',
|
||||||
|
props: {
|
||||||
|
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
text: '查询'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
execute() {
|
||||||
|
console.log('开始查询。。。')
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
@ -2,15 +2,15 @@ import { WidgetService } from '../service/WidgetService'
|
|||||||
|
|
||||||
const leftPanel = {
|
const leftPanel = {
|
||||||
icon: 'iconfont icon-chaxunsousuo',
|
icon: 'iconfont icon-chaxunsousuo',
|
||||||
label: '确定',
|
label: '查询按钮',
|
||||||
defaultClass: 'time-filter'
|
defaultClass: 'time-filter'
|
||||||
}
|
}
|
||||||
|
|
||||||
const drawPanel = {
|
const drawPanel = {
|
||||||
type: 'custom',
|
type: 'custom-button',
|
||||||
style: {
|
style: {
|
||||||
width: 300,
|
width: 150,
|
||||||
height: 47,
|
height: 60,
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: 500,
|
fontWeight: 500,
|
||||||
lineHeight: '',
|
lineHeight: '',
|
||||||
@ -21,9 +21,12 @@ const drawPanel = {
|
|||||||
options: {
|
options: {
|
||||||
attrs: {
|
attrs: {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
round: true
|
round: false,
|
||||||
|
plain: true,
|
||||||
|
customRange: false,
|
||||||
|
filterIds: []
|
||||||
},
|
},
|
||||||
value: '测试按钮'
|
value: '查询'
|
||||||
},
|
},
|
||||||
component: 'de-button',
|
component: 'de-button',
|
||||||
miniSizex: 1,
|
miniSizex: 1,
|
||||||
@ -35,6 +38,7 @@ class ButtonSureServiceImpl extends WidgetService {
|
|||||||
Object.assign(options, { name: 'buttonSureWidget' })
|
Object.assign(options, { name: 'buttonSureWidget' })
|
||||||
super(options)
|
super(options)
|
||||||
this.filterDialog = false
|
this.filterDialog = false
|
||||||
|
this.buttonDialog = true
|
||||||
this.showSwitch = false
|
this.showSwitch = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,6 +110,23 @@ div:focus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.de-button-dialog {
|
||||||
|
min-width: 250px !important;
|
||||||
|
width: 30% !important;
|
||||||
|
|
||||||
|
.el-dialog__header {
|
||||||
|
padding: 10px 20px !important;
|
||||||
|
|
||||||
|
.el-dialog__headerbtn {
|
||||||
|
top: 15px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-dialog__body {
|
||||||
|
padding: 1px 15px !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.de-style-dialog {
|
.de-style-dialog {
|
||||||
width: 600px !important;
|
width: 600px !important;
|
||||||
|
|
||||||
|
@ -238,6 +238,25 @@
|
|||||||
</div>
|
</div>
|
||||||
</de-container>
|
</de-container>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
v-if="buttonVisible && panelInfo.id"
|
||||||
|
:title="(currentWidget && currentWidget.getLeftPanel && currentWidget.getLeftPanel().label ? $t(currentWidget.getLeftPanel().label) : '') + $t('panel.module')"
|
||||||
|
:visible.sync="buttonVisible"
|
||||||
|
custom-class="de-button-dialog"
|
||||||
|
@close="cancelButton"
|
||||||
|
>
|
||||||
|
<button-dialog
|
||||||
|
v-if="buttonVisible && currentWidget"
|
||||||
|
:ref="'filter-setting-' + currentFilterCom.id"
|
||||||
|
:widget-info="currentWidget"
|
||||||
|
:element="currentFilterCom"
|
||||||
|
@sure-handler="sureHandler"
|
||||||
|
@cancel-handler="cancelHandler"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-if="filterVisible && panelInfo.id"
|
v-if="filterVisible && panelInfo.id"
|
||||||
:title="(currentWidget && currentWidget.getLeftPanel && currentWidget.getLeftPanel().label ? $t(currentWidget.getLeftPanel().label) : '') + $t('panel.module')"
|
:title="(currentWidget && currentWidget.getLeftPanel && currentWidget.getLeftPanel().label ? $t(currentWidget.getLeftPanel().label) : '') + $t('panel.module')"
|
||||||
@ -357,6 +376,7 @@ import '@/components/canvas/assets/iconfont/iconfont.css'
|
|||||||
import '@/components/canvas/styles/animate.css'
|
import '@/components/canvas/styles/animate.css'
|
||||||
import { ApplicationContext } from '@/utils/ApplicationContext'
|
import { ApplicationContext } from '@/utils/ApplicationContext'
|
||||||
import FilterDialog from '../filter/filterDialog'
|
import FilterDialog from '../filter/filterDialog'
|
||||||
|
import ButtonDialog from '../filter/ButtonDialog'
|
||||||
import toast from '@/components/canvas/utils/toast'
|
import toast from '@/components/canvas/utils/toast'
|
||||||
import { commonAttr } from '@/components/canvas/custom-component/component-list'
|
import { commonAttr } from '@/components/canvas/custom-component/component-list'
|
||||||
import generateID from '@/components/canvas/utils/generateID'
|
import generateID from '@/components/canvas/utils/generateID'
|
||||||
@ -383,6 +403,7 @@ export default {
|
|||||||
Editor,
|
Editor,
|
||||||
Toolbar,
|
Toolbar,
|
||||||
FilterDialog,
|
FilterDialog,
|
||||||
|
ButtonDialog,
|
||||||
SubjectSetting,
|
SubjectSetting,
|
||||||
Preview,
|
Preview,
|
||||||
AssistComponent,
|
AssistComponent,
|
||||||
@ -449,9 +470,11 @@ export default {
|
|||||||
],
|
],
|
||||||
enableSureButton: false,
|
enableSureButton: false,
|
||||||
filterFromDrag: false,
|
filterFromDrag: false,
|
||||||
|
buttonFromDrag: false,
|
||||||
activeToolsName: 'view',
|
activeToolsName: 'view',
|
||||||
rightDrawOpen: false,
|
rightDrawOpen: false,
|
||||||
editType: null
|
editType: null,
|
||||||
|
buttonVisible: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -626,6 +649,7 @@ export default {
|
|||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
bus.$off('component-on-drag', this.componentOnDrag)
|
bus.$off('component-on-drag', this.componentOnDrag)
|
||||||
bus.$off('component-dialog-edit', this.editDialog)
|
bus.$off('component-dialog-edit', this.editDialog)
|
||||||
|
bus.$off('button-dialog-edit', this.editButtonDialog)
|
||||||
bus.$off('component-dialog-style', this.componentDialogStyle)
|
bus.$off('component-dialog-style', this.componentDialogStyle)
|
||||||
bus.$off('previewFullScreenClose', this.previewFullScreenClose)
|
bus.$off('previewFullScreenClose', this.previewFullScreenClose)
|
||||||
bus.$off('change_panel_right_draw', this.changeRightDrawOpen)
|
bus.$off('change_panel_right_draw', this.changeRightDrawOpen)
|
||||||
@ -645,6 +669,7 @@ export default {
|
|||||||
initEvents() {
|
initEvents() {
|
||||||
bus.$on('component-on-drag', this.componentOnDrag)
|
bus.$on('component-on-drag', this.componentOnDrag)
|
||||||
bus.$on('component-dialog-edit', this.editDialog)
|
bus.$on('component-dialog-edit', this.editDialog)
|
||||||
|
bus.$on('button-dialog-edit', this.editButtonDialog)
|
||||||
bus.$on('component-dialog-style', this.componentDialogStyle)
|
bus.$on('component-dialog-style', this.componentDialogStyle)
|
||||||
bus.$on('previewFullScreenClose', this.previewFullScreenClose)
|
bus.$on('previewFullScreenClose', this.previewFullScreenClose)
|
||||||
bus.$on('change_panel_right_draw', this.changeRightDrawOpen)
|
bus.$on('change_panel_right_draw', this.changeRightDrawOpen)
|
||||||
@ -817,6 +842,11 @@ export default {
|
|||||||
this.openFilterDialog(true)
|
this.openFilterDialog(true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (this.currentWidget.buttonDialog) {
|
||||||
|
this.show = false
|
||||||
|
this.openButtonDialog(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
component = deepCopy(this.currentFilterCom)
|
component = deepCopy(this.currentFilterCom)
|
||||||
}
|
}
|
||||||
if (this.canvasStyleData.auxiliaryMatrix) {
|
if (this.canvasStyleData.auxiliaryMatrix) {
|
||||||
@ -874,6 +904,24 @@ export default {
|
|||||||
if (e.button !== 2) {
|
if (e.button !== 2) {
|
||||||
this.$store.commit('hideContextMenu')
|
this.$store.commit('hideContextMenu')
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
openButtonDialog(fromDrag = false) {
|
||||||
|
this.buttonFromDrag = fromDrag
|
||||||
|
this.buttonVisible = true
|
||||||
|
},
|
||||||
|
closeButton() {
|
||||||
|
this.buttonVisible = false
|
||||||
|
this.currentWidget = null
|
||||||
|
this.clearCurrentInfo()
|
||||||
|
},
|
||||||
|
cancelButton() {
|
||||||
|
this.closeButton()
|
||||||
|
if (this.buttonFromDrag) {
|
||||||
|
bus.$emit('onRemoveLastItem')
|
||||||
|
}
|
||||||
|
},
|
||||||
|
sureButton() {
|
||||||
|
|
||||||
},
|
},
|
||||||
openFilterDialog(fromDrag = false) {
|
openFilterDialog(fromDrag = false) {
|
||||||
this.filterFromDrag = fromDrag
|
this.filterFromDrag = fromDrag
|
||||||
@ -914,6 +962,15 @@ export default {
|
|||||||
this.openFilterDialog()
|
this.openFilterDialog()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
editButtonDialog(editType) {
|
||||||
|
this.editType = editType
|
||||||
|
if (this.curComponent && this.curComponent.serviceName) {
|
||||||
|
const serviceName = this.curComponent.serviceName
|
||||||
|
this.currentWidget = ApplicationContext.getService(serviceName)
|
||||||
|
this.currentFilterCom = this.curComponent
|
||||||
|
this.openButtonDialog()
|
||||||
|
}
|
||||||
|
},
|
||||||
closeLeftPanel() {
|
closeLeftPanel() {
|
||||||
this.show = false
|
this.show = false
|
||||||
},
|
},
|
||||||
@ -1093,6 +1150,19 @@ export default {
|
|||||||
e.dataTransfer.dropEffect = 'copy'
|
e.dataTransfer.dropEffect = 'copy'
|
||||||
this.$refs.canvasEditor.handleDragOver(e)
|
this.$refs.canvasEditor.handleDragOver(e)
|
||||||
},
|
},
|
||||||
|
sureHandler() {
|
||||||
|
this.currentFilterCom = this.$refs['filter-setting-' + this.currentFilterCom.id].getElementInfo()
|
||||||
|
if (this.editType !== 'update') {
|
||||||
|
adaptCurThemeCommonStyle(this.currentFilterCom)
|
||||||
|
}
|
||||||
|
this.$store.commit('setComponentWithId', this.currentFilterCom)
|
||||||
|
this.$store.commit('recordSnapshot', 'sureFilter')
|
||||||
|
this.$store.commit('setCurComponent', { component: this.currentFilterCom, index: this.curComponentIndex })
|
||||||
|
this.closeButton()
|
||||||
|
},
|
||||||
|
cancelHandler() {
|
||||||
|
this.cancelButton()
|
||||||
|
},
|
||||||
sureStatusChange(status) {
|
sureStatusChange(status) {
|
||||||
this.enableSureButton = status
|
this.enableSureButton = status
|
||||||
},
|
},
|
||||||
|
100
frontend/src/views/panel/filter/ButtonDialog.vue
Normal file
100
frontend/src/views/panel/filter/ButtonDialog.vue
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-form size="mini" ref="form" :model="form" label-width="100px">
|
||||||
|
<el-form-item label="名称">
|
||||||
|
<el-input v-model="currentElement.options.value"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
<el-form-item label="自定义范围">
|
||||||
|
<el-switch v-model="myAttrs.customRange" @change="customRangeChange"></el-switch>
|
||||||
|
<el-link style="margin-left: 10px;" type="warning" disabled>默认关联全部过滤组件</el-link>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
<el-form-item label="关联组件" v-if="myAttrs.customRange">
|
||||||
|
<el-select style="width: 300px;" multiple clearable v-model="myAttrs.filterIds" placeholder="请选择活动区域">
|
||||||
|
<el-option v-for="(filter, index) in filters" :key="filter.id" :label="filter.showName" :value="filter.id" />
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
|
||||||
|
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" @click="sure">确定</el-button>
|
||||||
|
<el-button @click="cancel">取消</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { ApplicationContext } from '@/utils/ApplicationContext'
|
||||||
|
import { mapState } from 'vuex'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'ButtonDialog',
|
||||||
|
props: {
|
||||||
|
widgetInfo: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
element: {
|
||||||
|
type: Object,
|
||||||
|
default: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
form: {
|
||||||
|
|
||||||
|
},
|
||||||
|
currentElement: null,
|
||||||
|
widget: null,
|
||||||
|
myAttrs: null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.widget = this.widgetInfo
|
||||||
|
this.currentElement = JSON.parse(JSON.stringify(this.element))
|
||||||
|
this.myAttrs = this.currentElement.options.attrs
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
|
||||||
|
...mapState([
|
||||||
|
'componentData'
|
||||||
|
]),
|
||||||
|
filters() {
|
||||||
|
const datas = this.componentData.filter(item => item.type === 'custom')
|
||||||
|
datas.forEach(item => {
|
||||||
|
|
||||||
|
const serviceName = item.serviceName
|
||||||
|
const widget = ApplicationContext.getService(serviceName)
|
||||||
|
const showName = widget.initLeftPanel().label
|
||||||
|
let result = ''
|
||||||
|
if(showName) {
|
||||||
|
result = this.$t(showName)
|
||||||
|
}
|
||||||
|
if(item.options.attrs.title) {
|
||||||
|
result += '【' + item.options.attrs.title + '】'
|
||||||
|
}
|
||||||
|
|
||||||
|
item.showName = result
|
||||||
|
})
|
||||||
|
return datas
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
sure() {
|
||||||
|
this.$emit('sure-handler')
|
||||||
|
},
|
||||||
|
cancel() {
|
||||||
|
this.$emit('cancel-handler')
|
||||||
|
},
|
||||||
|
getElementInfo() {
|
||||||
|
return this.currentElement
|
||||||
|
},
|
||||||
|
customRangeChange(val) {
|
||||||
|
this.myAttrs.filterIds = []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -59,10 +59,10 @@ export default {
|
|||||||
'numberSelectWidget',
|
'numberSelectWidget',
|
||||||
'numberSelectGridWidget',
|
'numberSelectGridWidget',
|
||||||
'numberRangeWidget'
|
'numberRangeWidget'
|
||||||
|
],
|
||||||
|
'按钮': [
|
||||||
|
'buttonSureWidget'
|
||||||
]
|
]
|
||||||
// '按钮': [
|
|
||||||
// 'buttonSureWidget'
|
|
||||||
// ]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user