diff --git a/src/components/table/fieldRender/index.vue b/src/components/table/fieldRender/index.vue index e6cf2a0..dec164c 100644 --- a/src/components/table/fieldRender/index.vue +++ b/src/components/table/fieldRender/index.vue @@ -40,10 +40,9 @@ -
+
+ {{ field.customTemplate ? field.customTemplate(row, field, fieldValue, column, index) : '' }} +
import { ref, inject } from 'vue' -import type { TagProps, TableColumnCtx } from 'element-plus' +import type { TagProps } from 'element-plus' import type TableStoreClass from '@/utils/tableStore' import { fullUrl, timeFormat } from '@/utils/common' +import { VxeColumnProps } from 'vxe-table/types/all' const TableStore = inject('tableStore') as TableStoreClass interface Props { row: TableRow field: TableColumn - column: TableColumnCtx + column: VxeColumnProps index: number } const props = defineProps() // 字段值(单元格值) -const fieldName = ref(props.field.prop) +const fieldName = ref(props.field.field) const fieldValue = ref(fieldName.value ? props.row[fieldName.value] : '') if (fieldName.value && fieldName.value.indexOf('.') > -1) { let fieldNameArr = fieldName.value.split('.') diff --git a/src/components/table/index.vue b/src/components/table/index.vue index ca28378..968624e 100644 --- a/src/components/table/index.vue +++ b/src/components/table/index.vue @@ -7,6 +7,7 @@ :border="true" v-loading="tableStore.table.loading" stripe + size="small" @checkbox-change="onSelectionChange" v-bind="$attrs" :column-config="{resizable: true}" @@ -95,8 +96,8 @@ const pageSizes = computed(() => { /* * 记录选择的项 */ -const onSelectionChange = (selection: TableRow[]) => { - tableStore.onTableAction('selection-change', selection) +const onSelectionChange = (selection: any) => { + // tableStore.onTableAction('selection-change', selection) } const getRef = () => { diff --git a/src/stores/constant/cacheKey.ts b/src/stores/constant/cacheKey.ts index c3c13ad..73d1f45 100644 --- a/src/stores/constant/cacheKey.ts +++ b/src/stores/constant/cacheKey.ts @@ -9,4 +9,6 @@ export const ADMIN_INFO = 'adminInfo' export const STORE_CONFIG = 'storeConfig' // 后台标签页 -export const STORE_TAB_VIEW_CONFIG = 'storeTabViewConfig' \ No newline at end of file +export const STORE_TAB_VIEW_CONFIG = 'storeTabViewConfig' +// 字典 +export const DICT_DATA = 'dictData' \ No newline at end of file diff --git a/src/stores/dictData.ts b/src/stores/dictData.ts new file mode 100644 index 0000000..2e666b0 --- /dev/null +++ b/src/stores/dictData.ts @@ -0,0 +1,30 @@ +import { defineStore } from 'pinia' +import { DICT_DATA } from '@/stores/constant/cacheKey' +import type { DictData, BasicDictData } from '@/stores/interface/index' +import { reactive } from 'vue' + +export const useDictData = defineStore( + 'dictData', + () => { + const state: DictData = reactive({ + basic: [], + // 其他接口获取的字典,比如区域 + }) + const setBasicData = (data: BasicDictData[]) => { + state.basic = data + } + const getBasicData = (code: string) => { + return state.basic.filter(item => item.code === code)[0]?.children || [] + } + return { + state, + setBasicData, + getBasicData + } + }, + { + persist: { + key: DICT_DATA + } + } +) diff --git a/src/stores/interface/index.ts b/src/stores/interface/index.ts index 6360031..de44fb4 100644 --- a/src/stores/interface/index.ts +++ b/src/stores/interface/index.ts @@ -41,5 +41,18 @@ export interface AdminInfo { last_login_time: string token: string refresh_token: string - super:boolean + super: boolean +} + +export interface DictData { + basic: BasicDictData[] +} + +export interface BasicDictData { + name: string + id: string + code: string + value: null + sort: number | null + children?: BasicDictData[] } diff --git a/src/views/voltage/sags/operationsManagement/index.vue b/src/views/voltage/sags/operationsManagement/index.vue index 33aaf23..8442827 100644 --- a/src/views/voltage/sags/operationsManagement/index.vue +++ b/src/views/voltage/sags/operationsManagement/index.vue @@ -20,7 +20,7 @@