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

feat: 过滤组件年份页面

上级 0b410f94
...@@ -42,6 +42,12 @@ class TimeYearServiceImpl extends WidgetService { ...@@ -42,6 +42,12 @@ class TimeYearServiceImpl extends WidgetService {
beforeToDraw() { beforeToDraw() {
} }
filterFieldMethod(fields) {
return fields.filter(field => {
return field['deType'] === 1
})
}
} }
const timeYearServiceImpl = new TimeYearServiceImpl({ name: 'timeYearWidget' }) const timeYearServiceImpl = new TimeYearServiceImpl({ name: 'timeYearWidget' })
export default timeYearServiceImpl export default timeYearServiceImpl
...@@ -164,3 +164,10 @@ div:focus { ...@@ -164,3 +164,10 @@ div:focus {
.de-filter-data-table::before { .de-filter-data-table::before {
height: 0px !important; height: 0px !important;
} }
.custom-component-class {
width: 100%;
div {
width: 100% !important;
}
}
...@@ -69,13 +69,31 @@ ...@@ -69,13 +69,31 @@
</de-container> </de-container>
<el-dialog <el-dialog
v-if="filterVisible"
title="过滤组件" title="过滤组件"
:visible.sync="filterVisible" :visible.sync="filterVisible"
custom-class="de-filter-dialog" custom-class="de-filter-dialog"
> >
<filter-dialog> <filter-dialog v-if="filterVisible" :widget-id="currentWidgetId">
<h1>aaaaaaaaa</h1> <de-drawing-widget
v-if="filterVisible && currentComponent"
:id="'component' + currentComponent.id"
style="width: 100% !important;"
class="component"
:element="currentComponent"
:item="currentComponent"
/>
</filter-dialog> </filter-dialog>
<!-- <div slot="footer" class="dialog-footer">
<el-button type="text" @click="editPasswordVisible = false">{{ $t('commons.cancel') }}</el-button>
<el-button type="primary" @click="editUserPassword('editPasswordForm')">确认</el-button>
</div> -->
<div style="text-align: end !important;margin: 0 15px !important;">
<span slot="footer">
<el-button @click="cancelFilter">取 消</el-button>
<el-button type="primary" @click="sureFilter">确 定</el-button>
</span>
</div>
</el-dialog> </el-dialog>
</el-container> </el-container>
...@@ -125,7 +143,10 @@ export default { ...@@ -125,7 +143,10 @@ export default {
showIndex: -1, showIndex: -1,
activeName: 'attr', activeName: 'attr',
reSelectAnimateIndex: undefined, reSelectAnimateIndex: undefined,
filterVisible: false filterVisible: false,
currentWidgetId: null,
currentWidget: null,
currentComponent: null
} }
}, },
...@@ -263,13 +284,17 @@ export default { ...@@ -263,13 +284,17 @@ export default {
} }
}) })
} else { } else {
const wd = ApplicationContext.getService(componentInfo.id) this.currentWidget = ApplicationContext.getService(componentInfo.id)
if (wd.filterDialog) { if (this.currentWidget.filterDialog) {
this.show = false this.show = false
this.openFilterDiolog() this.currentComponent = deepCopy(this.currentWidget)
this.currentComponent.style.top = e.offsetY
this.currentComponent.style.left = e.offsetX
this.currentComponent.id = newComponentId
this.openFilterDiolog(componentInfo.id)
return return
} }
component = deepCopy(wd) component = deepCopy(this.currentWidget)
} }
component.style.top = e.offsetY component.style.top = e.offsetY
...@@ -302,10 +327,22 @@ export default { ...@@ -302,10 +327,22 @@ export default {
this.$store.commit('hideContextMenu') this.$store.commit('hideContextMenu')
} }
}, },
openFilterDiolog() { openFilterDiolog(widgetId) {
this.currentWidgetId = widgetId
this.filterVisible = true this.filterVisible = true
},
cancelFilter() {
this.filterVisible = false
this.currentWidgetId = null
this.currentWidget = null
this.currentComponent = null
},
sureFilter() {
const component = deepCopy(this.currentComponent)
this.$store.commit('addComponent', { component })
this.$store.commit('recordSnapshot')
this.cancelFilter()
} }
} }
} }
</script> </script>
...@@ -373,7 +410,6 @@ export default { ...@@ -373,7 +410,6 @@ export default {
.leftPanel { .leftPanel {
transform: translate(0); transform: translate(0);
} }
} }
</style> </style>
...@@ -122,7 +122,12 @@ ...@@ -122,7 +122,12 @@
<el-col :span="24"> <el-col :span="24">
<div class="filter-content"> <div class="filter-content">
<el-card class="box-card"> <el-card class="box-card">
<slot /> <div style="margin-bottom: 10px;">
<span> {{ widget.label }}</span>
</div>
<div class="custom-component-class">
<slot />
</div>
</el-card> </el-card>
</div> </div>
...@@ -139,6 +144,7 @@ import DeContainer from '@/components/dataease/DeContainer' ...@@ -139,6 +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 { groupTree, loadTable, fieldList } from '@/api/dataset/dataset' import { groupTree, loadTable, fieldList } from '@/api/dataset/dataset'
export default { export default {
name: 'FilterDialog', name: 'FilterDialog',
...@@ -149,6 +155,12 @@ export default { ...@@ -149,6 +155,12 @@ export default {
draggable, draggable,
DragItem DragItem
}, },
props: {
widgetId: {
type: String,
default: null
}
},
data() { data() {
return { return {
activeName: 'dataset', activeName: 'dataset',
...@@ -163,10 +175,12 @@ export default { ...@@ -163,10 +175,12 @@ export default {
children: 'children', children: 'children',
label: 'label' label: 'label'
}, },
selectField: [] selectField: [],
widget: null
} }
}, },
created() { created() {
this.widget = ApplicationContext.getService(this.widgetId)
this.loadDataSetTree() this.loadDataSetTree()
}, },
...@@ -178,7 +192,11 @@ export default { ...@@ -178,7 +192,11 @@ export default {
}, },
loadDataSetTree() { loadDataSetTree() {
groupTree({}).then(res => { groupTree({}).then(res => {
this.data = res.data let datas = res.data
if (this.widget && this.widget.filterFieldMethod) {
datas = this.widget.filterFieldMethod(datas)
}
this.data = datas
}) })
}, },
renderNode(h, { node, data, store }) { renderNode(h, { node, data, store }) {
...@@ -414,4 +432,5 @@ export default { ...@@ -414,4 +432,5 @@ export default {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
</style> </style>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论