diff --git a/README.md b/README.md index 41475d923..a9b100d89 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ - [x] 动态表格(完善中) - [x] 动态表单(完善中) - [ ] 电商 SKU 功能演示 -- [ ] 纯前端导出 PDF 动态分页 +- [ ] 纯前端导出 PDF 自动分页 - [ ] 其他... ## Project setup diff --git a/src/api/demos/hero.ts b/src/api/demos/hero.ts new file mode 100644 index 000000000..1bd00a32d --- /dev/null +++ b/src/api/demos/hero.ts @@ -0,0 +1,15 @@ +import { request, BaseResponse } from '@/utils/request'; + +export function getHeroList(query: API.PageParams) { + return request>( + { + url: '/demos/hero/list', + method: 'get', + params: query, + }, + { + isMock: true, + isGetDataDirectly: false, + }, + ); +} diff --git a/src/components/JSON-schema-form/helper.ts b/src/components/JSON-schema-form/helper.ts index 0a71cc9d2..7e2a5e097 100644 --- a/src/components/JSON-schema-form/helper.ts +++ b/src/components/JSON-schema-form/helper.ts @@ -14,6 +14,7 @@ export function createPlaceholderMessage(component: ComponentMapType, label = '' 'Select', 'Cascader', 'Checkbox', + 'CheckboxGroup', 'Switch', 'TreeSelect', ]; diff --git a/src/components/JSON-schema-form/schema-form-item.vue b/src/components/JSON-schema-form/schema-form-item.vue index ff9edebd1..cd9085f80 100644 --- a/src/components/JSON-schema-form/schema-form-item.vue +++ b/src/components/JSON-schema-form/schema-form-item.vue @@ -2,11 +2,11 @@ { const { label, helpMessage, helpComponentProps, subLabel } = props.schemaItem; const renderLabel = subLabel ? ( @@ -167,7 +167,7 @@ ); - } + }); const getComponentsProps = computed(() => { const { schemaItem, tableAction, formModel, formActionType } = props; @@ -192,7 +192,7 @@ } } - function handleRules(): ValidationRule[] { + const getRules = computed(() => { const { rules: defRules = [], component, @@ -200,8 +200,13 @@ label, dynamicRules, required, + field, } = props.schemaItem; + if (field == 'field5') { + console.log('rules', props.schemaItem); + } + if (isFunction(dynamicRules)) { return dynamicRules(unref(getValues)) as ValidationRule[]; } @@ -214,10 +219,11 @@ : globalRulesMessageJoinLabel; const defaultMsg = isString(component) ? `${createPlaceholderMessage(component, label)}${joinLabel ? label : ''}` - : ''; + : undefined; function validator(rule: any, value: any) { const msg = rule.message || defaultMsg; + if (value === undefined || isNull(value)) { // 空值 return Promise.reject(msg); @@ -277,7 +283,7 @@ } return rules; - } + }); onMounted(async () => { if (getComponentProps.value?.request) { diff --git a/src/components/dynamic-table/components/query-form/index.vue b/src/components/dynamic-table/components/query-form/index.vue index 554f2cca8..916ab4fbb 100644 --- a/src/components/dynamic-table/components/query-form/index.vue +++ b/src/components/dynamic-table/components/query-form/index.vue @@ -76,7 +76,10 @@ const formItemSchemas = computed(() => { return props.columns - .filter((n) => !n.hideInSearch && !!getColumnKey(n)) + .filter((n) => { + const field = getColumnKey(n); + return !n.hideInSearch && !!field && field !== '$action'; + }) .map((n) => { return { field: n.formItemProps?.field ?? n.searchField ?? getColumnKey(n), diff --git a/src/components/dynamic-table/components/table-settings/column-setting.vue b/src/components/dynamic-table/components/table-settings/column-setting.vue index e9ca34d80..e158d31ea 100644 --- a/src/components/dynamic-table/components/table-settings/column-setting.vue +++ b/src/components/dynamic-table/components/table-settings/column-setting.vue @@ -3,7 +3,6 @@ -
列展示 - 序号列 - + + 边框 + 重置
-