提交 9de07492 authored 作者: fit2cloud-chenyw's avatar fit2cloud-chenyw

feat: 查询条件编辑

上级 ee63e0be
...@@ -49,6 +49,9 @@ export default { ...@@ -49,6 +49,9 @@ export default {
this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId) this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId)
bus.$emit('PanelSwitchComponent', { name: 'ChartEdit' }) bus.$emit('PanelSwitchComponent', { name: 'ChartEdit' })
} }
if (this.curComponent.type === 'custom') {
bus.$emit('component-dialog-edit')
}
// 编辑组件 // 编辑组件
}, },
lock() { lock() {
......
...@@ -38,6 +38,7 @@ export class DrawWidgetService { ...@@ -38,6 +38,7 @@ export class DrawWidgetService {
getDrawPanel() { getDrawPanel() {
let drawPanel = this.initDrawPanel() let drawPanel = this.initDrawPanel()
drawPanel.serviceName = this.options.name
drawPanel.style = Object.assign(drawPanel.style, commonStyle) drawPanel.style = Object.assign(drawPanel.style, commonStyle)
drawPanel = Object.assign(drawPanel, commonAttr) drawPanel = Object.assign(drawPanel, commonAttr)
if (this.filterDialog) { if (this.filterDialog) {
......
...@@ -97,6 +97,26 @@ const data = { ...@@ -97,6 +97,26 @@ const data = {
} }
}, },
setComponentWithId(state, component) {
for (let index = 0; index < state.componentData.length; index++) {
const element = state.componentData[index]
if (element.id && element.id === component.id) {
state.componentData[index] = component
return
}
}
state.componentData.push(component)
},
deleteComponentWithId(state, id) {
for (let index = 0; index < state.componentData.length; index++) {
const element = state.componentData[index]
if (element.id && element.id === id) {
state.componentData.splice(index, 1)
break
}
}
},
deleteComponent(state, index) { deleteComponent(state, index) {
if (index === undefined) { if (index === undefined) {
index = state.curComponentIndex index = state.curComponentIndex
......
...@@ -163,7 +163,8 @@ export default { ...@@ -163,7 +163,8 @@ export default {
'componentData', 'componentData',
'curComponent', 'curComponent',
'isClickComponent', 'isClickComponent',
'canvasStyleData' 'canvasStyleData',
'curComponentIndex'
]) ])
}, },
...@@ -193,6 +194,10 @@ export default { ...@@ -193,6 +194,10 @@ export default {
bus.$on('component-on-drag', () => { bus.$on('component-on-drag', () => {
this.show = false this.show = false
}) })
bus.$on('component-dialog-edit', () => {
this.eidtDialog()
})
}, },
beforeDestroy() { beforeDestroy() {
const elx = this.$refs.rightPanel const elx = this.$refs.rightPanel
...@@ -273,7 +278,7 @@ export default { ...@@ -273,7 +278,7 @@ export default {
} else { } else {
this.currentWidget = ApplicationContext.getService(componentInfo.id) this.currentWidget = ApplicationContext.getService(componentInfo.id)
this.currentFilterCom = this.currentWidget.getDrawPanel(this.panelInfo.id) this.currentFilterCom = this.currentWidget.getDrawPanel()
this.currentFilterCom.style.top = e.offsetY this.currentFilterCom.style.top = e.offsetY
this.currentFilterCom.style.left = e.offsetX this.currentFilterCom.style.left = e.offsetX
this.currentFilterCom.id = newComponentId this.currentFilterCom.id = newComponentId
...@@ -330,12 +335,19 @@ export default { ...@@ -330,12 +335,19 @@ export default {
}, },
sureFilter() { sureFilter() {
const component = deepCopy(this.currentFilterCom) const component = deepCopy(this.currentFilterCom)
this.$store.commit('addComponent', { component }) // this.$store.commit('addComponent', { component })
this.$store.commit('setComponentWithId', component)
this.$store.commit('recordSnapshot') this.$store.commit('recordSnapshot')
this.cancelFilter() this.cancelFilter()
}, },
reFreshComponent(component) { reFreshComponent(component) {
this.currentFilterCom = component this.currentFilterCom = component
},
eidtDialog() {
const serviceName = this.curComponent.serviceName
this.currentWidget = ApplicationContext.getService(serviceName)
this.currentFilterCom = this.curComponent
this.openFilterDiolog()
} }
} }
} }
......
...@@ -195,6 +195,7 @@ export default { ...@@ -195,6 +195,7 @@ export default {
this.widget && fieldValues(fieldId).then(res => { this.widget && fieldValues(fieldId).then(res => {
info.options.attrs.datas = this.widget.optionDatas(res.data) info.options.attrs.datas = this.widget.optionDatas(res.data)
info.options.attrs.fieldId = fieldId info.options.attrs.fieldId = fieldId
info.options.attrs.dragItems = values
this.$emit('re-fresh-component', info) this.$emit('re-fresh-component', info)
}) })
} }
...@@ -204,6 +205,10 @@ export default { ...@@ -204,6 +205,10 @@ export default {
// this.widget = ApplicationContext.getService(this.widgetId) // this.widget = ApplicationContext.getService(this.widgetId)
this.widget = this.widgetInfo this.widget = this.widgetInfo
this.loadDataSetTree() this.loadDataSetTree()
if (this.componentInfo && this.componentInfo.options.attrs.dragItems) {
this.selectField = this.componentInfo.options.attrs.dragItems
}
}, },
methods: { methods: {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论