forked from github/dataease
Merge pull request #7386 from dataease/pr@dev-v2@fix_chart_dataset_field_filter
fix(视图): 数据集字段过滤包含指标
This commit is contained in:
commit
0d03196feb
@ -187,13 +187,6 @@ const getFields = (id, chartId) => {
|
||||
state.quotaData = []
|
||||
}
|
||||
}
|
||||
watch(
|
||||
[() => state.searchField],
|
||||
newVal => {
|
||||
fieldFilter(newVal[0])
|
||||
},
|
||||
{ deep: true }
|
||||
)
|
||||
|
||||
const chartStyleShow = computed(() => {
|
||||
return view.value.type !== 'richText'
|
||||
@ -263,39 +256,39 @@ const queryList = computed(() => {
|
||||
})
|
||||
|
||||
const quotaData = computed(() => {
|
||||
let result = JSON.parse(JSON.stringify(state.quota))
|
||||
if (view.value?.type === 'table-info') {
|
||||
return state.quota?.filter(item => item.id !== '-1')
|
||||
result = result?.filter(item => item.id !== '-1')
|
||||
}
|
||||
return state.quota
|
||||
if (state.searchField) {
|
||||
result = result.filter(item =>
|
||||
item.name.toLowerCase().includes(state.searchField.toLowerCase())
|
||||
)
|
||||
}
|
||||
return result
|
||||
})
|
||||
provide('quotaData', quotaData)
|
||||
const dimensionData = computed(() => {
|
||||
let result = JSON.parse(JSON.stringify(state.dimensionData))
|
||||
if (state.searchField) {
|
||||
result = result.filter(item =>
|
||||
item.name.toLowerCase().includes(state.searchField.toLowerCase())
|
||||
)
|
||||
}
|
||||
return result
|
||||
})
|
||||
const realQuota = computed(() => {
|
||||
let result = JSON.parse(JSON.stringify(state.quota))
|
||||
if (view.value?.type === 'table-info') {
|
||||
result = result?.filter(item => item.id !== '-1')
|
||||
}
|
||||
return result
|
||||
})
|
||||
provide('quotaData', realQuota)
|
||||
|
||||
const startToMove = (e, item) => {
|
||||
e.dataTransfer.setData('dimension', JSON.stringify({ ...item, datasetId: view.value.tableId }))
|
||||
}
|
||||
|
||||
const fieldFilter = val => {
|
||||
if (val && val !== '') {
|
||||
state.dimensionData = JSON.parse(
|
||||
JSON.stringify(
|
||||
state.dimension.filter(ele => {
|
||||
return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase())
|
||||
})
|
||||
)
|
||||
)
|
||||
state.quotaData = JSON.parse(
|
||||
JSON.stringify(
|
||||
state.quota.filter(ele => {
|
||||
return ele.name.toLocaleLowerCase().includes(val.toLocaleLowerCase())
|
||||
})
|
||||
)
|
||||
)
|
||||
} else {
|
||||
state.dimensionData = JSON.parse(JSON.stringify(state.dimension))
|
||||
state.quotaData = JSON.parse(JSON.stringify(state.quota))
|
||||
}
|
||||
}
|
||||
|
||||
const dimensionItemChange = () => {
|
||||
recordSnapshotInfo('calcData')
|
||||
// do dimensionItemChange
|
||||
@ -1853,7 +1846,7 @@ const onRefreshChange = val => {
|
||||
<label>{{ t('chart.dimension') }}</label>
|
||||
<el-scrollbar class="drag-list">
|
||||
<draggable
|
||||
:list="state.dimensionData"
|
||||
:list="dimensionData"
|
||||
:group="dsFieldDragOptions.group"
|
||||
:move="onMove"
|
||||
item-key="id"
|
||||
|
Loading…
Reference in New Issue
Block a user