jianghu-ui 1.0.1
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.
- package/README.md +376 -0
- package/dist/jianghu-ui.css +2318 -0
- package/dist/jianghu-ui.js +2 -0
- package/dist/jianghu-ui.js.LICENSE.txt +1 -0
- package/package.json +56 -0
- package/src/Design.stories.mdx +195 -0
- package/src/Introduction.stories.mdx +148 -0
- package/src/components/JhAddressSelect/JhAddressSelect.md +250 -0
- package/src/components/JhAddressSelect/JhAddressSelect.stories.js +282 -0
- package/src/components/JhAddressSelect/JhAddressSelect.vue +261 -0
- package/src/components/JhCard/JhCard.md +246 -0
- package/src/components/JhCard/JhCard.stories.js +688 -0
- package/src/components/JhCard/JhCard.vue +604 -0
- package/src/components/JhCheckCard/JhCheckCard.md +245 -0
- package/src/components/JhCheckCard/JhCheckCard.stories.js +750 -0
- package/src/components/JhCheckCard/JhCheckCard.vue +476 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.md +70 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.stories.js +550 -0
- package/src/components/JhConfirmDialog/JhConfirmDialog.vue +181 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.md +56 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.stories.js +320 -0
- package/src/components/JhDateRangePicker/JhDateRangePicker.vue +307 -0
- package/src/components/JhDescriptions/JhDescriptions.md +724 -0
- package/src/components/JhDescriptions/JhDescriptions.stories.js +858 -0
- package/src/components/JhDescriptions/JhDescriptions.vue +933 -0
- package/src/components/JhDraggable/JhDraggable.md +66 -0
- package/src/components/JhDraggable/JhDraggable.stories.js +161 -0
- package/src/components/JhDraggable/JhDraggable.vue +254 -0
- package/src/components/JhDrawer/JhDrawer.md +68 -0
- package/src/components/JhDrawer/JhDrawer.stories.js +478 -0
- package/src/components/JhDrawer/JhDrawer.vue +281 -0
- package/src/components/JhDrawerForm/JhDrawerForm.md +69 -0
- package/src/components/JhDrawerForm/JhDrawerForm.stories.js +492 -0
- package/src/components/JhDrawerForm/JhDrawerForm.vue +297 -0
- package/src/components/JhEditableTable/JhEditableTable.md +507 -0
- package/src/components/JhEditableTable/JhEditableTable.stories.js +615 -0
- package/src/components/JhEditableTable/JhEditableTable.vue +685 -0
- package/src/components/JhFileInput/JhFileInput.md +56 -0
- package/src/components/JhFileInput/JhFileInput.stories.js +103 -0
- package/src/components/JhFileInput/JhFileInput.vue +253 -0
- package/src/components/JhForm/JhForm.md +676 -0
- package/src/components/JhForm/JhForm.stories.js +1375 -0
- package/src/components/JhForm/JhForm.vue +657 -0
- package/src/components/JhFormField/JhFormField.stories.js +217 -0
- package/src/components/JhFormField/JhFormField.vue +439 -0
- package/src/components/JhFormFields/JhFormFields.md +647 -0
- package/src/components/JhFormFields/JhFormFields.stories.js +922 -0
- package/src/components/JhFormFields/JhFormFields.vue +998 -0
- package/src/components/JhFormList/JhFormList.md +303 -0
- package/src/components/JhFormList/JhFormList.stories.js +661 -0
- package/src/components/JhFormList/JhFormList.vue +1127 -0
- package/src/components/JhJsonEditor/JhJsonEditor.md +54 -0
- package/src/components/JhJsonEditor/JhJsonEditor.stories.js +157 -0
- package/src/components/JhJsonEditor/JhJsonEditor.vue +178 -0
- package/src/components/JhLayout/JhLayout.md +580 -0
- package/src/components/JhLayout/JhLayout.stories.js +414 -0
- package/src/components/JhLayout/JhLayout.vue +387 -0
- package/src/components/JhList/JhList.md +441 -0
- package/src/components/JhList/JhList.stories.js +524 -0
- package/src/components/JhList/JhList.vue +571 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.md +56 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.stories.js +191 -0
- package/src/components/JhMarkdownEditor/JhMarkdownEditor.vue +188 -0
- package/src/components/JhMask/JhMask.md +62 -0
- package/src/components/JhMask/JhMask.stories.js +270 -0
- package/src/components/JhMask/JhMask.vue +123 -0
- package/src/components/JhMenu/JhMenu.md +85 -0
- package/src/components/JhMenu/JhMenu.stories.js +384 -0
- package/src/components/JhMenu/JhMenu.vue +545 -0
- package/src/components/JhModal/JhModal.md +68 -0
- package/src/components/JhModal/JhModal.stories.js +562 -0
- package/src/components/JhModal/JhModal.vue +235 -0
- package/src/components/JhModalForm/JhModalForm.md +69 -0
- package/src/components/JhModalForm/JhModalForm.stories.js +592 -0
- package/src/components/JhModalForm/JhModalForm.vue +298 -0
- package/src/components/JhPageContainer/JhPageContainer.md +409 -0
- package/src/components/JhPageContainer/JhPageContainer.stories.js +209 -0
- package/src/components/JhPageContainer/JhPageContainer.vue +72 -0
- package/src/components/JhQueryFilter/JhQueryFilter.md +77 -0
- package/src/components/JhQueryFilter/JhQueryFilter.stories.js +684 -0
- package/src/components/JhQueryFilter/JhQueryFilter.vue +429 -0
- package/src/components/JhScene/JhScene.md +64 -0
- package/src/components/JhScene/JhScene.stories.js +317 -0
- package/src/components/JhScene/JhScene.vue +376 -0
- package/src/components/JhStatisticCard/JhStatisticCard.md +363 -0
- package/src/components/JhStatisticCard/JhStatisticCard.stories.js +847 -0
- package/src/components/JhStatisticCard/JhStatisticCard.vue +459 -0
- package/src/components/JhStepsForm/JhStepsForm.md +666 -0
- package/src/components/JhStepsForm/JhStepsForm.stories.js +1224 -0
- package/src/components/JhStepsForm/JhStepsForm.vue +749 -0
- package/src/components/JhTable/JhTable.md +730 -0
- package/src/components/JhTable/JhTable.stories.js +1444 -0
- package/src/components/JhTable/JhTable.vue +2298 -0
- package/src/components/JhTableAttachment/JhTableAttachment.md +70 -0
- package/src/components/JhTableAttachment/JhTableAttachment.stories.js +198 -0
- package/src/components/JhTableAttachment/JhTableAttachment.vue +264 -0
- package/src/components/JhToast/JhToast.md +67 -0
- package/src/components/JhToast/JhToast.stories.js +386 -0
- package/src/components/JhToast/JhToast.vue +239 -0
- package/src/components/JhTreeSelect/JhTreeSelect.md +82 -0
- package/src/components/JhTreeSelect/JhTreeSelect.stories.js +391 -0
- package/src/components/JhTreeSelect/JhTreeSelect.vue +727 -0
- package/src/components/JhWaterMark/JhWaterMark.md +190 -0
- package/src/components/JhWaterMark/JhWaterMark.stories.js +675 -0
- package/src/components/JhWaterMark/JhWaterMark.vue +351 -0
- package/src/components/README.md +52 -0
- package/src/index.js +135 -0
- package/src/style/globalCSSJHV4.css +348 -0
- package/src/style/globalCSSVuetifyV4.css +637 -0
- package/src/style/storybook.css +4 -0
- package/src/tailwind.css +3 -0
- package/src/utils/vuetify.js +31 -0
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-dialog
|
|
3
|
+
v-model="isVisible"
|
|
4
|
+
:max-width="maxWidth"
|
|
5
|
+
:persistent="persistent"
|
|
6
|
+
@click:outside="handleClickOutside"
|
|
7
|
+
>
|
|
8
|
+
<v-card>
|
|
9
|
+
<v-card-title v-if="title || $slots.title">
|
|
10
|
+
<slot name="title">{{ title }}</slot>
|
|
11
|
+
</v-card-title>
|
|
12
|
+
|
|
13
|
+
<v-card-text v-if="content || $slots.default" :class="contentClass">
|
|
14
|
+
<slot>
|
|
15
|
+
<div v-html="content"></div>
|
|
16
|
+
</slot>
|
|
17
|
+
</v-card-text>
|
|
18
|
+
|
|
19
|
+
<v-card-actions>
|
|
20
|
+
<v-spacer></v-spacer>
|
|
21
|
+
<v-btn
|
|
22
|
+
v-if="showCancelButton"
|
|
23
|
+
:color="cancelButtonColor"
|
|
24
|
+
:text="cancelButtonText !== ''"
|
|
25
|
+
:disabled="loading"
|
|
26
|
+
@click="handleCancel"
|
|
27
|
+
>
|
|
28
|
+
{{ cancelButtonText || '取消' }}
|
|
29
|
+
</v-btn>
|
|
30
|
+
<v-btn
|
|
31
|
+
:color="confirmButtonColor"
|
|
32
|
+
:text="confirmButtonText !== ''"
|
|
33
|
+
:loading="loading"
|
|
34
|
+
@click="handleConfirm"
|
|
35
|
+
>
|
|
36
|
+
{{ confirmButtonText || '确定' }}
|
|
37
|
+
</v-btn>
|
|
38
|
+
</v-card-actions>
|
|
39
|
+
</v-card>
|
|
40
|
+
</v-dialog>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
export default {
|
|
45
|
+
name: 'JhConfirmDialog',
|
|
46
|
+
props: {
|
|
47
|
+
// 是否显示
|
|
48
|
+
value: {
|
|
49
|
+
type: Boolean,
|
|
50
|
+
default: false,
|
|
51
|
+
},
|
|
52
|
+
// 标题
|
|
53
|
+
title: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: '提示',
|
|
56
|
+
},
|
|
57
|
+
// 内容 (支持 HTML)
|
|
58
|
+
content: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: '',
|
|
61
|
+
},
|
|
62
|
+
// 内容样式类
|
|
63
|
+
contentClass: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: 'pa-6 text-pre-line',
|
|
66
|
+
},
|
|
67
|
+
// 最大宽度
|
|
68
|
+
maxWidth: {
|
|
69
|
+
type: [String, Number],
|
|
70
|
+
default: 420,
|
|
71
|
+
},
|
|
72
|
+
// 是否显示取消按钮
|
|
73
|
+
showCancelButton: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: true,
|
|
76
|
+
},
|
|
77
|
+
// 确认按钮文本
|
|
78
|
+
confirmButtonText: {
|
|
79
|
+
type: String,
|
|
80
|
+
default: '确定',
|
|
81
|
+
},
|
|
82
|
+
// 取消按钮文本
|
|
83
|
+
cancelButtonText: {
|
|
84
|
+
type: String,
|
|
85
|
+
default: '取消',
|
|
86
|
+
},
|
|
87
|
+
// 确认按钮颜色
|
|
88
|
+
confirmButtonColor: {
|
|
89
|
+
type: String,
|
|
90
|
+
default: 'primary',
|
|
91
|
+
},
|
|
92
|
+
// 取消按钮颜色
|
|
93
|
+
cancelButtonColor: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: 'default',
|
|
96
|
+
},
|
|
97
|
+
// 是否持久化(点击外部不关闭)
|
|
98
|
+
persistent: {
|
|
99
|
+
type: Boolean,
|
|
100
|
+
default: false,
|
|
101
|
+
},
|
|
102
|
+
// 是否在确认时显示加载状态
|
|
103
|
+
loading: {
|
|
104
|
+
type: Boolean,
|
|
105
|
+
default: false,
|
|
106
|
+
},
|
|
107
|
+
// 确认前的钩子函数,返回 false 可阻止关闭
|
|
108
|
+
beforeConfirm: {
|
|
109
|
+
type: Function,
|
|
110
|
+
default: null,
|
|
111
|
+
},
|
|
112
|
+
// 取消前的钩子函数,返回 false 可阻止关闭
|
|
113
|
+
beforeCancel: {
|
|
114
|
+
type: Function,
|
|
115
|
+
default: null,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
data() {
|
|
119
|
+
return {
|
|
120
|
+
isVisible: false,
|
|
121
|
+
};
|
|
122
|
+
},
|
|
123
|
+
watch: {
|
|
124
|
+
value(newVal) {
|
|
125
|
+
this.isVisible = newVal;
|
|
126
|
+
},
|
|
127
|
+
isVisible(newVal) {
|
|
128
|
+
if (newVal !== this.value) {
|
|
129
|
+
this.$emit('input', newVal);
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
mounted() {
|
|
134
|
+
this.isVisible = this.value;
|
|
135
|
+
},
|
|
136
|
+
methods: {
|
|
137
|
+
async handleConfirm() {
|
|
138
|
+
if (this.beforeConfirm) {
|
|
139
|
+
const result = await this.beforeConfirm();
|
|
140
|
+
if (result === false) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
this.$emit('confirm');
|
|
146
|
+
if (!this.loading) {
|
|
147
|
+
this.close();
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
async handleCancel() {
|
|
151
|
+
if (this.beforeCancel) {
|
|
152
|
+
const result = await this.beforeCancel();
|
|
153
|
+
if (result === false) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
this.$emit('cancel');
|
|
159
|
+
this.close();
|
|
160
|
+
},
|
|
161
|
+
handleClickOutside() {
|
|
162
|
+
if (!this.persistent) {
|
|
163
|
+
this.$emit('click-outside');
|
|
164
|
+
this.$emit('cancel');
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
close() {
|
|
168
|
+
this.isVisible = false;
|
|
169
|
+
},
|
|
170
|
+
open() {
|
|
171
|
+
this.isVisible = true;
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
</script>
|
|
176
|
+
|
|
177
|
+
<style scoped>
|
|
178
|
+
.text-pre-line {
|
|
179
|
+
white-space: pre-line;
|
|
180
|
+
}
|
|
181
|
+
</style>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# JhDateRangePicker - 日期范围选择器
|
|
2
|
+
|
|
3
|
+
JhDateRangePicker 集成快捷日期面板与 `v-date-picker`,可通过一个输入框完成常见时间段选择,适用于报表、统计筛选等场景。
|
|
4
|
+
|
|
5
|
+
## 功能特性
|
|
6
|
+
|
|
7
|
+
- 📆 **快捷选择**:内置最近 7/30/90 天、本月、上月、最近一年等常用区间
|
|
8
|
+
- 🧭 **所见即所得**:左侧快捷列表 + 右侧日历联动,选择即高亮
|
|
9
|
+
- 🧹 **一键清除**:输入框支持 `clearable`,可快速清空区间
|
|
10
|
+
- 🧱 **受控组件**:通过 `v-model` 保持外部状态同步,支持 `input/change` 事件
|
|
11
|
+
- 🎨 **风格统一**:继承 Vuetify 文本框交互,可配置 `filled/dense/outlined` 等外观
|
|
12
|
+
|
|
13
|
+
## 基础用法
|
|
14
|
+
|
|
15
|
+
```vue
|
|
16
|
+
<template>
|
|
17
|
+
<jh-date-range-picker
|
|
18
|
+
v-model="dateRange"
|
|
19
|
+
prefix="时间:"
|
|
20
|
+
:filled="false"
|
|
21
|
+
outlined
|
|
22
|
+
@change="reload"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## API
|
|
28
|
+
|
|
29
|
+
### Props
|
|
30
|
+
|
|
31
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
32
|
+
| --- | --- | --- | --- |
|
|
33
|
+
| value | v-model 绑定的日期数组,长度为 2 | string[] | [] |
|
|
34
|
+
| prefix | 输入框前缀文本 | string | `''` |
|
|
35
|
+
| filled | 是否使用 filled 风格 | boolean | true |
|
|
36
|
+
| dense | 是否紧凑 | boolean | true |
|
|
37
|
+
| outlined | 是否使用 outlined 风格 | boolean | false |
|
|
38
|
+
| hideDetails | 是否隐藏 `v-text-field` 底部提示 | boolean | true |
|
|
39
|
+
| clearable | 是否展示清空图标 | boolean | true |
|
|
40
|
+
|
|
41
|
+
### Events
|
|
42
|
+
|
|
43
|
+
| 事件名 | 说明 | 回调参数 |
|
|
44
|
+
| --- | --- | --- |
|
|
45
|
+
| input | `v-model` 值变化 | (value: string[]) |
|
|
46
|
+
| change | 用户确认或清空时触发 | (value: string[]) |
|
|
47
|
+
|
|
48
|
+
### Slots
|
|
49
|
+
|
|
50
|
+
当前组件不提供插槽。
|
|
51
|
+
|
|
52
|
+
## 使用建议
|
|
53
|
+
|
|
54
|
+
- 如果需要自定义默认区间,可在父组件中传入初始 `value` 或监听 `menu` 打开后赋值
|
|
55
|
+
- 组件默认返回 `YYYY-MM-DD` 字符串,如需传时间戳可在外层自行转换
|
|
56
|
+
- 结合 `JhQueryFilter` 等查询组件可以统一触发搜索逻辑
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import JhDateRangePicker from './JhDateRangePicker.vue';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: '基础组件/JhDateRangePicker - 日期范围',
|
|
5
|
+
component: JhDateRangePicker,
|
|
6
|
+
tags: ['autodocs'],
|
|
7
|
+
argTypes: {
|
|
8
|
+
prefix: {
|
|
9
|
+
control: 'text',
|
|
10
|
+
description: '输入框前缀文本',
|
|
11
|
+
},
|
|
12
|
+
filled: {
|
|
13
|
+
control: 'boolean',
|
|
14
|
+
description: '使用填充样式',
|
|
15
|
+
},
|
|
16
|
+
dense: {
|
|
17
|
+
control: 'boolean',
|
|
18
|
+
description: '使用紧凑模式',
|
|
19
|
+
},
|
|
20
|
+
outlined: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: '使用轮廓样式',
|
|
23
|
+
},
|
|
24
|
+
hideDetails: {
|
|
25
|
+
control: 'boolean',
|
|
26
|
+
description: '隐藏详情信息',
|
|
27
|
+
},
|
|
28
|
+
clearable: {
|
|
29
|
+
control: 'boolean',
|
|
30
|
+
description: '是否可清除',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
parameters: {
|
|
34
|
+
docs: {
|
|
35
|
+
description: {
|
|
36
|
+
component: `
|
|
37
|
+
|
|
38
|
+
一个功能丰富的日期范围选择器组件,支持快捷日期选择和自定义日期范围。
|
|
39
|
+
|
|
40
|
+
## 功能特性
|
|
41
|
+
|
|
42
|
+
- 日期范围选择
|
|
43
|
+
- 快捷日期选择:
|
|
44
|
+
- 最近7天、30天、90天、365天
|
|
45
|
+
- 本月、上月
|
|
46
|
+
- 支持清除功能
|
|
47
|
+
- 支持多种样式:filled、outlined、dense
|
|
48
|
+
- 自动日期排序
|
|
49
|
+
- 确认/取消操作
|
|
50
|
+
|
|
51
|
+
## 使用方法
|
|
52
|
+
|
|
53
|
+
\`\`\`vue
|
|
54
|
+
<jh-date-range-picker
|
|
55
|
+
v-model="dateRange"
|
|
56
|
+
prefix="选择日期:"
|
|
57
|
+
@change="handleDateChange"
|
|
58
|
+
/>
|
|
59
|
+
\`\`\`
|
|
60
|
+
|
|
61
|
+
## 事件
|
|
62
|
+
|
|
63
|
+
- \`input\`: v-model 绑定事件,参数为日期数组 [startDate, endDate]
|
|
64
|
+
- \`change\`: 日期变化事件,参数为日期数组 [startDate, endDate]
|
|
65
|
+
|
|
66
|
+
## 日期格式
|
|
67
|
+
|
|
68
|
+
日期格式为 YYYY-MM-DD,例如:['2024-01-01', '2024-01-31']
|
|
69
|
+
`,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
// 获取今天日期
|
|
76
|
+
const getToday = () => {
|
|
77
|
+
const date = new Date();
|
|
78
|
+
const year = date.getFullYear();
|
|
79
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
80
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
81
|
+
return `${year}-${month}-${day}`;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// 获取N天前的日期
|
|
85
|
+
const getDaysAgo = (days) => {
|
|
86
|
+
const date = new Date();
|
|
87
|
+
date.setDate(date.getDate() - days);
|
|
88
|
+
const year = date.getFullYear();
|
|
89
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
90
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
91
|
+
return `${year}-${month}-${day}`;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
// 基础示例
|
|
95
|
+
export const 基础示例 = {
|
|
96
|
+
args: {
|
|
97
|
+
value: [getDaysAgo(7), getToday()],
|
|
98
|
+
prefix: '',
|
|
99
|
+
filled: true,
|
|
100
|
+
dense: true,
|
|
101
|
+
outlined: false,
|
|
102
|
+
hideDetails: true,
|
|
103
|
+
clearable: true,
|
|
104
|
+
},
|
|
105
|
+
render: (args) => ({
|
|
106
|
+
components: { JhDateRangePicker },
|
|
107
|
+
data() {
|
|
108
|
+
return {
|
|
109
|
+
dateRange: args.value || [],
|
|
110
|
+
};
|
|
111
|
+
},
|
|
112
|
+
template: `
|
|
113
|
+
<div>
|
|
114
|
+
<jh-date-range-picker
|
|
115
|
+
v-model="dateRange"
|
|
116
|
+
:prefix="'${args.prefix}'"
|
|
117
|
+
:filled="${args.filled}"
|
|
118
|
+
:dense="${args.dense}"
|
|
119
|
+
:outlined="${args.outlined}"
|
|
120
|
+
:hide-details="${args.hideDetails}"
|
|
121
|
+
:clearable="${args.clearable}"
|
|
122
|
+
@change="handleChange"
|
|
123
|
+
/>
|
|
124
|
+
<v-card class="mt-4" outlined>
|
|
125
|
+
<v-card-text>
|
|
126
|
+
<h4>选中的日期范围:</h4>
|
|
127
|
+
<p v-if="dateRange && dateRange.length === 2">
|
|
128
|
+
{{ dateRange[0] }} ~ {{ dateRange[1] }}
|
|
129
|
+
</p>
|
|
130
|
+
<p v-else class="grey--text">未选择日期</p>
|
|
131
|
+
</v-card-text>
|
|
132
|
+
</v-card>
|
|
133
|
+
</div>
|
|
134
|
+
`,
|
|
135
|
+
methods: {
|
|
136
|
+
handleChange(value) {
|
|
137
|
+
console.log('Date range changed:', value);
|
|
138
|
+
this.dateRange = value;
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
}),
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// 带前缀
|
|
145
|
+
export const 带前缀 = {
|
|
146
|
+
args: {
|
|
147
|
+
...基础示例.args,
|
|
148
|
+
prefix: '日期范围:',
|
|
149
|
+
},
|
|
150
|
+
render: 基础示例.render,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// 轮廓样式
|
|
154
|
+
export const 轮廓样式 = {
|
|
155
|
+
args: {
|
|
156
|
+
...基础示例.args,
|
|
157
|
+
filled: false,
|
|
158
|
+
outlined: true,
|
|
159
|
+
},
|
|
160
|
+
render: 基础示例.render,
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
// 正常尺寸
|
|
164
|
+
export const 正常尺寸 = {
|
|
165
|
+
args: {
|
|
166
|
+
...基础示例.args,
|
|
167
|
+
dense: false,
|
|
168
|
+
},
|
|
169
|
+
render: 基础示例.render,
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
// 不可清除
|
|
173
|
+
export const 不可清除 = {
|
|
174
|
+
args: {
|
|
175
|
+
...基础示例.args,
|
|
176
|
+
clearable: false,
|
|
177
|
+
},
|
|
178
|
+
render: 基础示例.render,
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// 初始为空
|
|
182
|
+
export const 初始为空 = {
|
|
183
|
+
args: {
|
|
184
|
+
value: [],
|
|
185
|
+
prefix: '选择日期:',
|
|
186
|
+
filled: true,
|
|
187
|
+
dense: true,
|
|
188
|
+
outlined: false,
|
|
189
|
+
hideDetails: true,
|
|
190
|
+
clearable: true,
|
|
191
|
+
},
|
|
192
|
+
render: 基础示例.render,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
// 表单中使用
|
|
196
|
+
export const 表单中使用 = {
|
|
197
|
+
args: 基础示例.args,
|
|
198
|
+
render: (args) => ({
|
|
199
|
+
components: { JhDateRangePicker },
|
|
200
|
+
data() {
|
|
201
|
+
return {
|
|
202
|
+
formData: {
|
|
203
|
+
dateRange: [getDaysAgo(30), getToday()],
|
|
204
|
+
keyword: '',
|
|
205
|
+
status: '',
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
},
|
|
209
|
+
template: `
|
|
210
|
+
<v-card max-width="500">
|
|
211
|
+
<v-card-title>数据查询</v-card-title>
|
|
212
|
+
<v-card-text>
|
|
213
|
+
<v-form>
|
|
214
|
+
<jh-date-range-picker
|
|
215
|
+
v-model="formData.dateRange"
|
|
216
|
+
prefix="查询日期:"
|
|
217
|
+
filled
|
|
218
|
+
dense
|
|
219
|
+
hide-details="auto"
|
|
220
|
+
class="mb-4"
|
|
221
|
+
/>
|
|
222
|
+
<v-text-field
|
|
223
|
+
v-model="formData.keyword"
|
|
224
|
+
label="关键词"
|
|
225
|
+
filled
|
|
226
|
+
dense
|
|
227
|
+
hide-details="auto"
|
|
228
|
+
class="mb-4"
|
|
229
|
+
></v-text-field>
|
|
230
|
+
<v-select
|
|
231
|
+
v-model="formData.status"
|
|
232
|
+
:items="statusOptions"
|
|
233
|
+
label="状态"
|
|
234
|
+
filled
|
|
235
|
+
dense
|
|
236
|
+
hide-details="auto"
|
|
237
|
+
></v-select>
|
|
238
|
+
</v-form>
|
|
239
|
+
</v-card-text>
|
|
240
|
+
<v-card-actions>
|
|
241
|
+
<v-spacer></v-spacer>
|
|
242
|
+
<v-btn color="grey" text @click="reset">重置</v-btn>
|
|
243
|
+
<v-btn color="primary" @click="search">查询</v-btn>
|
|
244
|
+
</v-card-actions>
|
|
245
|
+
<v-divider></v-divider>
|
|
246
|
+
<v-card-text>
|
|
247
|
+
<h4>查询条件:</h4>
|
|
248
|
+
<pre>{{ formData }}</pre>
|
|
249
|
+
</v-card-text>
|
|
250
|
+
</v-card>
|
|
251
|
+
`,
|
|
252
|
+
computed: {
|
|
253
|
+
statusOptions() {
|
|
254
|
+
return [
|
|
255
|
+
{ text: '全部', value: '' },
|
|
256
|
+
{ text: '启用', value: 'active' },
|
|
257
|
+
{ text: '禁用', value: 'inactive' },
|
|
258
|
+
];
|
|
259
|
+
},
|
|
260
|
+
},
|
|
261
|
+
methods: {
|
|
262
|
+
search() {
|
|
263
|
+
console.log('Search with:', this.formData);
|
|
264
|
+
alert('查询条件:\\n' + JSON.stringify(this.formData, null, 2));
|
|
265
|
+
},
|
|
266
|
+
reset() {
|
|
267
|
+
this.formData = {
|
|
268
|
+
dateRange: [],
|
|
269
|
+
keyword: '',
|
|
270
|
+
status: '',
|
|
271
|
+
};
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
}),
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
// 多个选择器
|
|
278
|
+
export const 多个选择器 = {
|
|
279
|
+
args: 基础示例.args,
|
|
280
|
+
render: () => ({
|
|
281
|
+
components: { JhDateRangePicker },
|
|
282
|
+
data() {
|
|
283
|
+
return {
|
|
284
|
+
createDate: [getDaysAgo(7), getToday()],
|
|
285
|
+
updateDate: [getDaysAgo(3), getToday()],
|
|
286
|
+
};
|
|
287
|
+
},
|
|
288
|
+
template: `
|
|
289
|
+
<div>
|
|
290
|
+
<v-row>
|
|
291
|
+
<v-col cols="12" md="6">
|
|
292
|
+
<div class="mb-2 text-subtitle-2">创建日期</div>
|
|
293
|
+
<jh-date-range-picker
|
|
294
|
+
v-model="createDate"
|
|
295
|
+
prefix="创建:"
|
|
296
|
+
filled
|
|
297
|
+
dense
|
|
298
|
+
/>
|
|
299
|
+
</v-col>
|
|
300
|
+
<v-col cols="12" md="6">
|
|
301
|
+
<div class="mb-2 text-subtitle-2">更新日期</div>
|
|
302
|
+
<jh-date-range-picker
|
|
303
|
+
v-model="updateDate"
|
|
304
|
+
prefix="更新:"
|
|
305
|
+
filled
|
|
306
|
+
dense
|
|
307
|
+
/>
|
|
308
|
+
</v-col>
|
|
309
|
+
</v-row>
|
|
310
|
+
<v-card class="mt-4" outlined>
|
|
311
|
+
<v-card-text>
|
|
312
|
+
<h4>选中的日期:</h4>
|
|
313
|
+
<p><strong>创建日期:</strong>{{ createDate[0] }} ~ {{ createDate[1] }}</p>
|
|
314
|
+
<p><strong>更新日期:</strong>{{ updateDate[0] }} ~ {{ updateDate[1] }}</p>
|
|
315
|
+
</v-card-text>
|
|
316
|
+
</v-card>
|
|
317
|
+
</div>
|
|
318
|
+
`,
|
|
319
|
+
}),
|
|
320
|
+
};
|