@peng_kai/kit 0.3.0-beta.36 → 0.3.0-beta.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,7 @@ import { computed, toRef } from 'vue';
|
|
|
5
5
|
import dayjs from '../../../../libs/dayjs';
|
|
6
6
|
import { type ItemSchema, useAntdForm } from '../../../../antd';
|
|
7
7
|
import { PictureCardUpload } from '../../../components/upload';
|
|
8
|
+
import InputNumberRange from '../../../../antd/components/InputNumberRange.vue';
|
|
8
9
|
|
|
9
10
|
export interface IConfigDetail {
|
|
10
11
|
category_id: number
|
|
@@ -43,6 +44,8 @@ export enum FormTypes {
|
|
|
43
44
|
SINGLE_DATE_PICKER = 13,
|
|
44
45
|
/** 日期范围选择器 */
|
|
45
46
|
RANGE_DATE_PICKER = 14,
|
|
47
|
+
/** 数字范围输入框 */
|
|
48
|
+
NUMBER_RANGE = 15,
|
|
46
49
|
}
|
|
47
50
|
|
|
48
51
|
const antdPropsResolvers: Record<number, (config: IConfigDetail) => IConfigDetail> = {
|
|
@@ -122,6 +125,12 @@ const antdPropsResolvers: Record<number, (config: IConfigDetail) => IConfigDetai
|
|
|
122
125
|
|
|
123
126
|
return config;
|
|
124
127
|
},
|
|
128
|
+
[FormTypes.NUMBER_RANGE](config) {
|
|
129
|
+
config.value = config.value === '' ? undefined : config.value.split(',');
|
|
130
|
+
const [min, max] = config.options?.split(',') || [];
|
|
131
|
+
config.options = { min: Number(min), max: Number(max) };
|
|
132
|
+
return config;
|
|
133
|
+
},
|
|
125
134
|
};
|
|
126
135
|
|
|
127
136
|
const antdValueResolvers: Record<number, (value: any) => any> = {
|
|
@@ -154,6 +163,11 @@ const antdValueResolvers: Record<number, (value: any) => any> = {
|
|
|
154
163
|
|
|
155
164
|
return value;
|
|
156
165
|
},
|
|
166
|
+
[FormTypes.NUMBER_RANGE](value) {
|
|
167
|
+
if (Array.isArray(value))
|
|
168
|
+
return value.join(',');
|
|
169
|
+
return value;
|
|
170
|
+
},
|
|
157
171
|
};
|
|
158
172
|
</script>
|
|
159
173
|
|
|
@@ -291,6 +305,10 @@ defineExpose({ reset, validate });
|
|
|
291
305
|
<RangePicker v-model:value="settingForm.state[item.key]" v-bind="item.options" />
|
|
292
306
|
</slot>
|
|
293
307
|
|
|
308
|
+
<slot v-else-if="item.form_type === FormTypes.NUMBER_RANGE" :name="FormTypes.NUMBER_RANGE">
|
|
309
|
+
<InputNumberRange v-model:value="settingForm.state[item.key]" v-bind="item.options" />
|
|
310
|
+
</slot>
|
|
311
|
+
|
|
294
312
|
<span v-else class="text-red">没有找到预设 form_type:{{ item.form_type }},可以通过 {{ item.key }} 插槽自定义</span>
|
|
295
313
|
</template>
|
|
296
314
|
</FormItem>
|