@lx-frontend/wrap-element-ui 1.0.18 → 1.0.19-beta.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/package.json
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import dayjs from "dayjs";
|
|
2
|
+
|
|
3
|
+
/** 开始日期禁用配置 */
|
|
4
|
+
export function genStartDateDisabledOptions(endDate: string, limit: number = 0) {
|
|
5
|
+
return {
|
|
6
|
+
disabledDate: (time: Date) => {
|
|
7
|
+
if (!endDate) return false;
|
|
8
|
+
|
|
9
|
+
const currentDate = dayjs(time);
|
|
10
|
+
return currentDate.isAfter(dayjs(endDate).add(limit, 'day'), 'day');
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** 结束日期禁用配置 */
|
|
16
|
+
export function genEndDateDisabledOptions(startDate: string, limit: number = 0) {
|
|
17
|
+
return {
|
|
18
|
+
disabledDate: (time: Date) => {
|
|
19
|
+
if (!startDate) return false;
|
|
20
|
+
|
|
21
|
+
const currentDate = dayjs(time);
|
|
22
|
+
return currentDate.isBefore(dayjs(startDate).subtract(limit, 'day'), 'day');
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
v-for="({
|
|
9
9
|
isEmpty = true, key, type, prop, label, placeholder, candidate, filterable=false, withoutAll=false, collapseTags=false,
|
|
10
10
|
clearable=false, multiple=false, multipleLimit=0, changeCb, inputLimitCallback, slotName, dateType='date',
|
|
11
|
-
doubleIsInline = true, maxlength = 255,
|
|
11
|
+
doubleIsInline = true, maxlength = 255, doubleDatePickerLimit = 30,
|
|
12
12
|
}) in config"
|
|
13
13
|
:key="label"
|
|
14
14
|
:label="showLabel ? label : ''"
|
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
format="yyyy-MM-dd"
|
|
86
86
|
type="date"
|
|
87
87
|
:placeholder="(placeholder || [])[0] || '开始日期'"
|
|
88
|
+
:picker-options="genStartDateDisabledOptions(formData[prop[1]], doubleDatePickerLimit)"
|
|
88
89
|
/>
|
|
89
90
|
<el-date-picker
|
|
90
91
|
@input="val => handleInput(val, prop[1], '', key)"
|
|
@@ -94,6 +95,7 @@
|
|
|
94
95
|
format="yyyy-MM-dd"
|
|
95
96
|
type="date"
|
|
96
97
|
:placeholder="(placeholder || [])[1] || '结束日期'"
|
|
98
|
+
:picker-options="genEndDateDisabledOptions(formData[prop[0]], doubleDatePickerLimit)"
|
|
97
99
|
/>
|
|
98
100
|
<el-checkbox
|
|
99
101
|
:value="checkedIds[key]"
|
|
@@ -124,6 +126,8 @@
|
|
|
124
126
|
</template>
|
|
125
127
|
|
|
126
128
|
<script>
|
|
129
|
+
import { genStartDateDisabledOptions, genEndDateDisabledOptions } from './helper';
|
|
130
|
+
|
|
127
131
|
export default {
|
|
128
132
|
name: 'SearchForm',
|
|
129
133
|
props: {
|
|
@@ -187,6 +191,8 @@ export default {
|
|
|
187
191
|
this.initialData = Object.freeze({ ...this.formData })
|
|
188
192
|
},
|
|
189
193
|
methods: {
|
|
194
|
+
genStartDateDisabledOptions,
|
|
195
|
+
genEndDateDisabledOptions,
|
|
190
196
|
handleInput (val, prop, inputLimitCallback, key) {
|
|
191
197
|
if (inputLimitCallback && !inputLimitCallback(val)) return false
|
|
192
198
|
if (val) {
|