Commit 84b8302c0921ea7fbcd1c42fa057b94660129857

Authored by vben
1 parent da4aea13

fix(table): fix table search criteria collapse failure

src/components/Form/src/BasicForm.vue
... ... @@ -24,9 +24,9 @@
24 24 </template>
25 25 <script lang="ts">
26 26 import type { FormActionType, FormProps, FormSchema } from './types/form';
27   - import type { Form as FormType, ValidateFields } from 'ant-design-vue/types/form/form';
28 27 import type { AdvanceState } from './types/hooks';
29 28 import type { Ref } from 'vue';
  29 + import type { ValidateFields } from 'ant-design-vue/lib/form/interface';
30 30  
31 31 import {
32 32 defineComponent,
... ... @@ -41,12 +41,13 @@
41 41 import { Form, Row } from 'ant-design-vue';
42 42 import FormItem from './FormItem';
43 43 import { basicProps } from './props';
44   - import { deepMerge } from '/@/utils';
45 44 import FormAction from './FormAction';
46 45  
47 46 import { dateItemType } from './helper';
48 47 import moment from 'moment';
49 48 import { cloneDeep } from 'lodash-es';
  49 + import { deepMerge } from '/@/utils';
  50 +
50 51 import { useFormValues } from './hooks/useFormValues';
51 52 import useAdvanced from './hooks/useAdvanced';
52 53 import { useFormAction } from './hooks/useFormAction';
... ... @@ -75,7 +76,7 @@
75 76 const defaultValueRef = ref<any>({});
76 77 const propsRef = ref<Partial<FormProps>>({});
77 78 const schemaRef = ref<FormSchema[] | null>(null);
78   - const formElRef = ref<Nullable<FormType>>(null);
  79 + const formElRef = ref<Nullable<FormActionType>>(null);
79 80  
80 81 const getMergePropsRef = computed(
81 82 (): FormProps => {
... ...
src/components/Form/src/FormAction.tsx
  1 +import type { ColEx } from './types/index';
  2 +
1 3 import { defineComponent, unref, computed, PropType } from 'vue';
2 4 import { Form, Col } from 'ant-design-vue';
3   -import type { ColEx } from './types/index';
4   -import { getSlot } from '/@/utils/helper/tsxHelper';
5 5 import Button from '/@/components/Button/index.vue';
6   -import { UpOutlined, DownOutlined } from '@ant-design/icons-vue';
  6 +import { BasicArrow } from '/@/components/Basic/index';
  7 +
  8 +import { getSlot } from '/@/utils/helper/tsxHelper';
7 9  
8 10 export default defineComponent({
9 11 name: 'BasicFormAction',
... ... @@ -107,11 +109,7 @@ export default defineComponent({
107 109 {() => (
108 110 <>
109 111 {isAdvanced ? '收起' : '展开'}
110   - {isAdvanced ? (
111   - <UpOutlined class="advanced-icon" />
112   - ) : (
113   - <DownOutlined class="advanced-icon" />
114   - )}
  112 + <BasicArrow expand={!isAdvanced} />
115 113 </>
116 114 )}
117 115 </Button>
... ...
src/components/Form/src/FormItem.tsx
1   -import type { ValidationRule } from 'ant-design-vue/types/form/form';
2 1 import type { PropType } from 'vue';
3 2 import type { FormProps } from './types/form';
4 3 import type { FormSchema } from './types/form';
  4 +import type { ValidationRule } from 'ant-design-vue/lib/form/Form';
5 5  
6 6 import { defineComponent, computed, unref, toRef } from 'vue';
7 7 import { Form, Col } from 'ant-design-vue';
... ... @@ -54,10 +54,25 @@ export default defineComponent({
54 54 };
55 55 });
56 56  
57   - const getShowRef = computed(() => {
58   - const { show, ifShow, isAdvanced } = props.schema;
  57 + const getDisableRef = computed(() => {
  58 + const { disabled: globDisabled } = props.formProps;
  59 + const { dynamicDisabled } = props.schema;
  60 + let disabled = !!globDisabled;
  61 + if (isBoolean(dynamicDisabled)) {
  62 + disabled = dynamicDisabled;
  63 + }
  64 +
  65 + if (isFunction(dynamicDisabled)) {
  66 + disabled = dynamicDisabled(unref(getValuesRef));
  67 + }
  68 +
  69 + return disabled;
  70 + });
  71 +
  72 + function getShow() {
  73 + const { show, ifShow } = props.schema;
59 74 const { showAdvancedButton } = props.formProps;
60   - const itemIsAdvanced = showAdvancedButton ? !!isAdvanced : true;
  75 + const itemIsAdvanced = showAdvancedButton ? !!props.schema.isAdvanced : true;
61 76 let isShow = true;
62 77 let isIfShow = true;
63 78  
... ... @@ -75,22 +90,7 @@ export default defineComponent({
75 90 }
76 91 isShow = isShow && itemIsAdvanced;
77 92 return { isShow, isIfShow };
78   - });
79   -
80   - const getDisableRef = computed(() => {
81   - const { disabled: globDisabled } = props.formProps;
82   - const { dynamicDisabled } = props.schema;
83   - let disabled = !!globDisabled;
84   - if (isBoolean(dynamicDisabled)) {
85   - disabled = dynamicDisabled;
86   - }
87   -
88   - if (isFunction(dynamicDisabled)) {
89   - disabled = dynamicDisabled(unref(getValuesRef));
90   - }
91   -
92   - return disabled;
93   - });
  93 + }
94 94  
95 95 function handleRules(): ValidationRule[] {
96 96 const {
... ... @@ -246,7 +246,7 @@ export default defineComponent({
246 246 <Form.Item
247 247 name={field}
248 248 colon={colon}
249   - {...itemProps}
  249 + {...(itemProps as any)}
250 250 label={renderLabelHelpMessage()}
251 251 rules={handleRules()}
252 252 labelCol={labelCol}
... ... @@ -261,7 +261,7 @@ export default defineComponent({
261 261 if (!componentMap.has(component)) return null;
262 262 const { baseColProps = {} } = props.formProps;
263 263 const realColProps = { ...baseColProps, ...colProps };
264   - const { isIfShow, isShow } = unref(getShowRef);
  264 + const { isIfShow, isShow } = getShow();
265 265 const getContent = () => {
266 266 return colSlot
267 267 ? getSlot(slots, colSlot)
... ...
src/components/Form/src/hooks/useAdvanced.ts
1 1 import type { ColEx } from '../types';
2 2 import type { AdvanceState } from '../types/hooks';
3   -import type { ComputedRef, Ref } from 'vue';
  3 +import { ComputedRef, Ref } from 'vue';
4 4 import type { FormProps, FormSchema } from '../types/form';
5 5  
6 6 import { computed, unref, watch } from 'vue';
... ... @@ -69,6 +69,7 @@ export default function ({
69 69 actionColOptions,
70 70 };
71 71 });
  72 +
72 73 watch(
73 74 [() => unref(getSchema), () => advanceState.isAdvanced, () => unref(realWidthRef)],
74 75 () => {
... ... @@ -169,6 +170,7 @@ export default function ({
169 170 itemColSum,
170 171 true
171 172 );
  173 +
172 174 emit('advanced-change');
173 175 }
174 176  
... ...
src/components/Menu/src/BasicMenu.tsx
... ... @@ -60,13 +60,13 @@ export default defineComponent({
60 60 const { showLogo, search } = props;
61 61 let offset = 0;
62 62 if (search) {
63   - offset += 60;
  63 + offset += 54;
64 64 }
65 65 if (showLogo) {
66   - offset += 54;
  66 + offset += 46;
67 67 }
68 68 return {
69   - height: `calc(100% - ${offset - 38}px)`,
  69 + height: `calc(100% - ${offset - 10}px)`,
70 70 position: 'relative',
71 71 overflow: 'auto',
72 72 };
... ...
src/components/Table/src/BasicTable.vue
... ... @@ -21,11 +21,9 @@
21 21 </BasicForm>
22 22 <Table
23 23 ref="tableElRef"
24   - v-bind="getBindValues"
25 24 :rowClassName="getRowClassName"
26   - :class="{
27   - hidden: !getEmptyDataIsShowTable,
28   - }"
  25 + v-bind="getBindValues"
  26 + v-show="getEmptyDataIsShowTable"
29 27 @change="handleTableChange"
30 28 >
31 29 <template #[item]="data" v-for="item in Object.keys($slots)">
... ... @@ -44,6 +42,8 @@
44 42 GetColumnsParams,
45 43 TableActionType,
46 44 SizeType,
  45 + SorterResult,
  46 + TableCustomRecord,
47 47 } from './types/table';
48 48  
49 49 import { isFunction, isString } from '/@/utils/is';
... ... @@ -64,7 +64,6 @@
64 64 import { ROW_KEY } from './const';
65 65 import { PaginationProps } from './types/pagination';
66 66 import { deepMerge } from '/@/utils';
67   - import { SorterResult, TableCustomRecord } from 'ant-design-vue/types/table/table';
68 67 import { useEvent } from '/@/hooks/event/useEvent';
69 68  
70 69 import './style/index.less';
... ... @@ -199,7 +198,7 @@
199 198 { immediate: true }
200 199 );
201 200  
202   - function getRowClassName(record: TableCustomRecord<any>, index: number) {
  201 + function getRowClassName(record: TableCustomRecord, index: number) {
203 202 const { striped, rowClassName } = unref(getMergeProps);
204 203 if (!striped) return;
205 204 if (rowClassName && isFunction(rowClassName)) {
... ... @@ -218,6 +217,7 @@
218 217  
219 218 function handleTableChange(
220 219 pagination: PaginationProps,
  220 + // @ts-ignore
221 221 filters: Partial<Record<string, string[]>>,
222 222 sorter: SorterResult<any>
223 223 ) {
... ...
src/layouts/default/LayoutHeader.tsx
... ... @@ -145,6 +145,7 @@ export default defineComponent({
145 145 <Badge
146 146 count={errorStore.getErrorListCountState}
147 147 offset={[0, 10]}
  148 + dot
148 149 overflowCount={99}
149 150 >
150 151 {() => (
... ...
src/layouts/default/actions/notice/NoticeActionItem.vue
1 1 <template>
2 2 <div class="layout-header__action-item notify-action">
3 3 <Popover title="" trigger="click">
4   - <Badge :count="count" :numberStyle="numberStyle">
  4 + <Badge :count="count" dot :numberStyle="numberStyle">
5 5 <BellOutlined class="layout-header__action-icon" />
6 6 </Badge>
7 7 <template #content>
... ... @@ -56,7 +56,7 @@
56 56  
57 57 .ant-badge-multiple-words {
58 58 padding: 0 4px;
59   - transform: translate(26%, -40%);
  59 + // transform: translate(26%, -40%);
60 60 }
61 61  
62 62 svg {
... ...
src/views/sys/login/Login.vue
... ... @@ -134,16 +134,17 @@
134 134 display: none;
135 135 height: 100%;
136 136 background: url(../../../assets/images/login/login-in.png) no-repeat;
137   - background-size: 100% 100%;
  137 + background-position: 50% 30%;
  138 + background-size: 80% 80%;
138 139  
139   - .respond-to(large, { display: block;});
  140 + .respond-to(xlarge, { display: block;});
140 141 }
141 142  
142 143 &-form {
143 144 width: 100%;
144 145 background: @white;
145 146 border: 10px solid rgba(255, 255, 255, 0.5);
146   - border-width: 10px;
  147 + border-width: 8px;
147 148 border-radius: 4px;
148 149 background-clip: padding-box;
149 150 .respond-to(xlarge, { margin: 0 56px});
... ... @@ -157,8 +158,11 @@
157 158 height: 100%;
158 159 justify-content: center;
159 160 align-items: center;
160   - .respond-to(large, { width: 40%;});
161   - .respond-to(xlarge, { width: 33.3%;});
  161 + .respond-to(large, {
  162 + width: 520px;
  163 + right: calc(50% - 260px);
  164 + });
  165 + .respond-to(xlarge, { width: 520px; right:0});
162 166 }
163 167  
164 168 &__content {
... ... @@ -174,7 +178,7 @@
174 178  
175 179 img {
176 180 display: inline-block;
177   - width: 80px;
  181 + width: 64px;
178 182 }
179 183  
180 184 h1 {
... ...