| | |
| | | <ArtTableHeader v-model:columns="columnChecks" :loading="loading" @refresh="refreshData"> |
| | | <template #left> |
| | | <ElSpace wrap> |
| | | <ElButton v-auth="'add'" @click="showDialog('add')" v-ripple>新增配置</ElButton> |
| | | <ElButton v-auth="'add'" @click="showDialog('add')" v-ripple> |
| | | {{ t('pages.system.config.buttons.add') }} |
| | | </ElButton> |
| | | <ElButton |
| | | v-auth="'delete'" |
| | | type="danger" |
| | |
| | | @click="handleBatchDelete" |
| | | v-ripple |
| | | > |
| | | 批量删除 |
| | | {{ t('common.actions.batchDelete') }} |
| | | </ElButton> |
| | | </ElSpace> |
| | | </template> |
| | |
| | | |
| | | <script setup> |
| | | import { ElMessage } from 'element-plus' |
| | | import { useI18n } from 'vue-i18n' |
| | | import { useAuth } from '@/hooks/core/useAuth' |
| | | import { useTable } from '@/hooks/core/useTable' |
| | | import { useCrudPage } from '@/views/system/common/useCrudPage' |
| | |
| | | |
| | | defineOptions({ name: 'Config' }) |
| | | |
| | | const { t } = useI18n() |
| | | const { hasAuth } = useAuth() |
| | | const searchForm = ref(createConfigSearchState()) |
| | | const detailDrawerVisible = ref(false) |
| | |
| | | |
| | | const searchItems = computed(() => [ |
| | | { |
| | | label: '关键字', |
| | | label: t('table.keyword'), |
| | | key: 'condition', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入配置名称' |
| | | placeholder: t('pages.system.config.search.conditionPlaceholder') |
| | | } |
| | | }, |
| | | { |
| | | label: '标识', |
| | | label: t('pages.system.config.table.flag'), |
| | | key: 'flag', |
| | | type: 'input', |
| | | props: { |
| | | clearable: true, |
| | | placeholder: '请输入配置标识' |
| | | placeholder: t('pages.system.config.search.flagPlaceholder') |
| | | } |
| | | }, |
| | | { |
| | | label: '类型', |
| | | label: t('pages.system.config.table.type'), |
| | | key: 'type', |
| | | type: 'select', |
| | | props: { |
| | | clearable: true, |
| | | options: getConfigTypeOptions() |
| | | placeholder: t('pages.system.config.placeholders.type'), |
| | | options: getConfigTypeOptions(t) |
| | | } |
| | | }, |
| | | { |
| | | label: '状态', |
| | | label: t('table.status'), |
| | | key: 'status', |
| | | type: 'select', |
| | | props: { |
| | | clearable: true, |
| | | options: [ |
| | | { label: '正常', value: 1 }, |
| | | { label: '冻结', value: 0 } |
| | | { label: t('common.status.normal'), value: 1 }, |
| | | { label: t('common.status.frozen'), value: 0 } |
| | | ] |
| | | } |
| | | } |
| | |
| | | } catch (error) { |
| | | detailDrawerVisible.value = false |
| | | detailData.value = {} |
| | | ElMessage.error(error?.message || '获取配置详情失败') |
| | | ElMessage.error(error?.message || t('pages.system.config.messages.detailFailed')) |
| | | } finally { |
| | | detailLoading.value = false |
| | | } |
| | |
| | | dialogVisible.value = true |
| | | dialogType.value = 'edit' |
| | | } catch (error) { |
| | | ElMessage.error(error?.message || '获取配置详情失败') |
| | | ElMessage.error(error?.message || t('pages.system.config.messages.detailFailed')) |
| | | } |
| | | } |
| | | |
| | |
| | | paginationKey: getConfigPaginationKey(), |
| | | columnsFactory: () => |
| | | createConfigTableColumns({ |
| | | t, |
| | | handleView: openDetail, |
| | | handleEdit: openEditDialog, |
| | | handleDelete: hasAuth('delete') ? (row) => handleDeleteAction?.(row) : null |
| | |
| | | saveRequest: fetchSaveConfig, |
| | | updateRequest: fetchUpdateConfig, |
| | | deleteRequest: fetchDeleteConfig, |
| | | entityName: '配置', |
| | | entityName: t('pages.system.config.entity'), |
| | | resolveRecordLabel: (record) => record?.name || record?.flag || record?.id, |
| | | refreshCreate, |
| | | refreshUpdate, |