diff --git a/src/modules/smart-system/views/category/CategoryListView.api.ts b/src/modules/smart-system/views/category/CategoryListView.api.ts index 71c3a308d..c3e9bf243 100644 --- a/src/modules/smart-system/views/category/CategoryListView.api.ts +++ b/src/modules/smart-system/views/category/CategoryListView.api.ts @@ -1,7 +1,7 @@ import { ApiServiceEnum, defHttp } from '@/utils/http/axios'; enum Api { - list = '/sys/category/list', + list = '/sys/category/listFilterTenant', saveUpdate = '/sys/category/saveUpdate', batchDeleteById = '/sys/category/batchDeleteById', getById = '/sys/category/getById', diff --git a/src/modules/smart-system/views/category/CategoryListView.config.ts b/src/modules/smart-system/views/category/CategoryListView.config.ts index 374d8397e..247e29746 100644 --- a/src/modules/smart-system/views/category/CategoryListView.config.ts +++ b/src/modules/smart-system/views/category/CategoryListView.config.ts @@ -1,5 +1,6 @@ import type { SmartColumn, SmartSearchFormSchema } from '@/components/SmartTable'; import type { FormSchema } from '@/components/Form'; +import { ComputedRef, unref } from 'vue'; export const getTableColumns = (): SmartColumn[] => { return [ @@ -64,7 +65,10 @@ export const getTableColumns = (): SmartColumn[] => { ]; }; -export const getFormSchemas = (t: Function): FormSchema[] => { +export const getFormSchemas = ( + t: Function, + getIsPlatformTenant: ComputedRef, +): FormSchema[] => { return [ { field: 'id', @@ -111,7 +115,19 @@ export const getFormSchemas = (t: Function): FormSchema[] => { { field: 'remark', label: t('common.table.remark'), - component: 'Input', + component: 'InputTextArea', + }, + { + label: t('common.title.tenantCommonYn'), + field: 'tenantCommonYn', + component: 'Switch', + defaultValue: false, + ifShow() { + return unref(getIsPlatformTenant); + }, + dynamicDisabled({ model }) { + return model.parentId !== 0; + }, }, ]; }; diff --git a/src/modules/smart-system/views/category/CategoryListView.vue b/src/modules/smart-system/views/category/CategoryListView.vue index e8da3eb24..2da597bb0 100644 --- a/src/modules/smart-system/views/category/CategoryListView.vue +++ b/src/modules/smart-system/views/category/CategoryListView.vue @@ -18,15 +18,24 @@ import { getFormSchemas, getTableColumns, getSearchFormSchemas } from './CategoryListView.config'; import { listApi, deleteApi, saveUpdateApi, getByIdApi } from './CategoryListView.api'; + import { storeToRefs } from 'pinia'; + import { useUserStore } from '@/store/modules/user'; const { t } = useI18n(); const { getTableSize } = useSizeSetting(); + const { getIsPlatformTenant } = storeToRefs(useUserStore()); + const getTableActions = (row): ActionItem[] => { return [ { label: t('system.views.category.button.addChild'), - onClick: () => showAddModal({ parentId: row.id, parentName: row.categoryName }), + onClick: () => + showAddModal({ + parentId: row.id, + parentName: row.categoryName, + tenantCommonYn: row.tenantCommonYn, + }), }, { label: t('common.button.edit'), @@ -61,7 +70,7 @@ }, addEditConfig: { formConfig: { - schemas: getFormSchemas(t), + schemas: getFormSchemas(t, getIsPlatformTenant), baseColProps: { span: 24 }, labelCol: { span: 6 }, wrapperCol: { span: 17 },