| | |
| | | </template> |
| | | <div class="w100 h100"> |
| | | <div class="h-full flex-column"> |
| | | <ColFilter class="flex-0 ml-auto mb-2" :column-list="tableCheckData" /> |
| | | <ColFilter class="flex-0 ml-auto mb-2" :column-list="tableCheckData" @change="colFilterChange" /> |
| | | <el-table v-loading="tableLoading" ref="draggableTableRef" class="flex-auto" border :data="tableData" highlight-current-row> |
| | | <el-table-column |
| | | v-for="item in visibleTableColumns" |
| | |
| | | // import TableSearch from './search/index.vue'; |
| | | import type { Attach } from '../hook/useAttach'; |
| | | import ColFilter from '/@/components/table/colFilter/ColFilter.vue'; |
| | | import { LocalPlus } from '/@/utils/storage'; |
| | | const dialogIsShow = defineModel({ |
| | | type: Boolean, |
| | | }); |
| | |
| | | const tableData = ref([]); |
| | | |
| | | const tableColumns = ref([]); |
| | | |
| | | const tableCheckData = computed(() => { |
| | | return tableColumns.value.map((item) => { |
| | | return { |
| | |
| | | }; |
| | | }); |
| | | }); |
| | | |
| | | const visibleTableColumns = computed(() => { |
| | | return tableColumns.value.filter((item) => item.isShow); |
| | | }); |
| | |
| | | () => dialogIsShow.value, |
| | | (val) => { |
| | | if (!val) return; |
| | | tableColumns.value = (props.data?.model?.columns || []).map((item) => { |
| | | const data = (props.data?.model?.columns || []).map((item) => { |
| | | return { |
| | | name: item, |
| | | title: item, |
| | | isShow: true, |
| | | }; |
| | | }); |
| | | |
| | | const finalData = getStoreCols(data); |
| | | tableColumns.value = finalData; |
| | | tableData.value = parseRecordData(props.data?.model?.values || [], tableColumns.value); |
| | | } |
| | | ); |
| | | |
| | | //#region ====================== 选择列记忆 ====================== |
| | | const colFilterChange = () => { |
| | | storeCols(tableColumns.value); |
| | | }; |
| | | const storeCols = (colList: any[]) => { |
| | | const key = colList.map((item) => item.label).join(','); |
| | | if (!key) return; |
| | | LocalPlus.set(`${key}-table-preview`, colList, 7); |
| | | }; |
| | | const getStoreCols = (colList: any[]) => { |
| | | if (colList.length === 0) return colList; |
| | | const key = colList.map((item) => item.label).join(','); |
| | | if (!key) return colList; |
| | | const storeValue = LocalPlus.get(`${key}-table-preview`); |
| | | |
| | | if (!storeValue) { |
| | | return colList; |
| | | } else { |
| | | return storeValue; |
| | | } |
| | | }; |
| | | |
| | | //#endregion |
| | | </script> |
| | | <style scoped lang="scss"> |
| | | .set-permission { |