vue2-client 1.10.33 → 1.10.35
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 +107 -107
- package/src/App.vue +196 -196
- package/src/base-client/components/common/XAddNativeForm/demo.vue +43 -43
- package/src/base-client/components/common/XAddReport/XAddReport.vue +1 -1
- package/src/base-client/components/common/XConversation/XConversation.vue +12 -0
- package/src/base-client/components/common/XForm/XForm.vue +393 -393
- package/src/base-client/components/common/XForm/XFormItem.vue +1248 -1248
- package/src/base-client/components/common/XFormCol/XFormCol.vue +157 -157
- package/src/base-client/components/common/XFormTable/XFormTable.vue +12 -0
- package/src/base-client/components/common/XIntervalPicker/XIntervalPicker.vue +121 -121
- package/src/base-client/components/common/XReportDrawer/XReportDrawer.vue +1 -1
- package/src/base-client/components/common/XReportGrid/XReport.vue +1079 -1070
- package/src/base-client/components/common/XReportGrid/XReportDemo.vue +46 -47
- package/src/base-client/components/common/XReportGrid/XReportDesign.vue +628 -628
- package/src/base-client/components/common/XReportGrid/XReportJsonRender.vue +380 -380
- package/src/base-client/components/common/XReportGrid/XReportTrGroup.vue +1104 -1104
- package/src/base-client/components/common/XReportGrid/print.js +184 -184
- package/src/base-client/components/common/XTab/XTab.vue +57 -25
- package/src/components/cache/AKeepAlive.js +179 -179
- package/src/layouts/BlankView.vue +78 -78
- package/src/pages/ReportGrid/index.vue +76 -76
- package/src/router/async/router.map.js +2 -2
- package/src/utils/microAppUtils.js +49 -49
|
@@ -1,157 +1,157 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<a-col :style="computedStyles">
|
|
3
|
-
<div
|
|
4
|
-
class="x-form-col-wrapper"
|
|
5
|
-
:style="computedWrapperStyles"
|
|
6
|
-
>
|
|
7
|
-
<slot></slot>
|
|
8
|
-
</div>
|
|
9
|
-
</a-col>
|
|
10
|
-
</template>
|
|
11
|
-
|
|
12
|
-
<script>
|
|
13
|
-
const BREAKPOINTS = {
|
|
14
|
-
xs: 576,
|
|
15
|
-
sm: 768,
|
|
16
|
-
md: 992,
|
|
17
|
-
lg: 1200,
|
|
18
|
-
xl: 1600,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const defaultFlex = {
|
|
22
|
-
xs: 24,
|
|
23
|
-
sm: 24,
|
|
24
|
-
md: 8,
|
|
25
|
-
lg: 8,
|
|
26
|
-
xl: 6,
|
|
27
|
-
xxl: 6,
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
function debounce (fn, delay) {
|
|
31
|
-
let timeout = null
|
|
32
|
-
return function (...args) {
|
|
33
|
-
if (timeout) clearTimeout(timeout)
|
|
34
|
-
timeout = setTimeout(() => {
|
|
35
|
-
fn.apply(this, args)
|
|
36
|
-
}, delay)
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default {
|
|
41
|
-
name: 'XFormCol',
|
|
42
|
-
props: {
|
|
43
|
-
flex: {
|
|
44
|
-
type: Object,
|
|
45
|
-
default: () => ({
|
|
46
|
-
xs: 24,
|
|
47
|
-
sm: 24,
|
|
48
|
-
md: 8,
|
|
49
|
-
lg: 6,
|
|
50
|
-
xl: 6,
|
|
51
|
-
xxl: 6,
|
|
52
|
-
}),
|
|
53
|
-
},
|
|
54
|
-
occupyCol: {
|
|
55
|
-
type: Number,
|
|
56
|
-
default: 1,
|
|
57
|
-
},
|
|
58
|
-
layout: {
|
|
59
|
-
type: String,
|
|
60
|
-
default: 'horizontal',
|
|
61
|
-
},
|
|
62
|
-
labelCol: {
|
|
63
|
-
type: Object,
|
|
64
|
-
default: () => { return { span: 8 } }
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
computed: {
|
|
68
|
-
computedFlex () {
|
|
69
|
-
const parentWidth = this.parentWidth
|
|
70
|
-
return this.getFlex(parentWidth, this.flex)
|
|
71
|
-
},
|
|
72
|
-
computedWrapperStyles () {
|
|
73
|
-
const realFlex = this.flex.fullWidth ? this.getFlex(this.parentWidth) : this.computedFlex
|
|
74
|
-
// 1. 计算列数
|
|
75
|
-
const columnsCount = 24 / realFlex
|
|
76
|
-
// 2. 计算基准列宽
|
|
77
|
-
const baseColumnWidth = (this.parentWidth / columnsCount) - ((columnsCount - 1) * 16)
|
|
78
|
-
// 3. 计算label宽度
|
|
79
|
-
const labelWidth = Math.max(baseColumnWidth / (24 / this.labelCol.span), 80)
|
|
80
|
-
// 计算左右偏移量
|
|
81
|
-
const offset = this.labelCol.offset ? (this.labelCol.offset / 24) * 100 : 0
|
|
82
|
-
if (this.layout === 'vertical') {
|
|
83
|
-
return {
|
|
84
|
-
'--form-label-width': '',
|
|
85
|
-
'--form-offset': '',
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return {
|
|
89
|
-
'--form-label-width': `${labelWidth}px`,
|
|
90
|
-
'--form-offset': `${offset}%`,
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
computedStyles () {
|
|
94
|
-
const realFlex = Math.min(this.computedFlex * this.occupyCol, 24)
|
|
95
|
-
const flexValue = (realFlex / 24) * 100
|
|
96
|
-
|
|
97
|
-
return {
|
|
98
|
-
flex: `0 0 ${flexValue}%`,
|
|
99
|
-
maxWidth: `${flexValue}%`,
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
},
|
|
103
|
-
data () {
|
|
104
|
-
return {
|
|
105
|
-
parentWidth: 0,
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
methods: {
|
|
109
|
-
getFlex (parentWidth, flex = defaultFlex) {
|
|
110
|
-
if (parentWidth === 0) {
|
|
111
|
-
return flex.md
|
|
112
|
-
}
|
|
113
|
-
if (parentWidth < BREAKPOINTS.xs) return flex.xs
|
|
114
|
-
if (parentWidth < BREAKPOINTS.sm) return flex.sm
|
|
115
|
-
if (parentWidth < BREAKPOINTS.md) return flex.md
|
|
116
|
-
if (parentWidth < BREAKPOINTS.lg) return flex.lg
|
|
117
|
-
if (parentWidth < BREAKPOINTS.xl) return flex.xl
|
|
118
|
-
return flex.xxl
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
mounted () {
|
|
122
|
-
// 根据父容器宽度响应式
|
|
123
|
-
this.$nextTick(() => {
|
|
124
|
-
const container = this.$el.parentNode
|
|
125
|
-
this.parentWidth = container.offsetWidth
|
|
126
|
-
const updateWidth = debounce((width) => {
|
|
127
|
-
this.parentWidth = width
|
|
128
|
-
}, 100)
|
|
129
|
-
|
|
130
|
-
this.resizeObserver = new ResizeObserver((entries) => {
|
|
131
|
-
for (const entry of entries) {
|
|
132
|
-
updateWidth(entry.contentRect.width)
|
|
133
|
-
}
|
|
134
|
-
})
|
|
135
|
-
this.resizeObserver.observe(container)
|
|
136
|
-
})
|
|
137
|
-
},
|
|
138
|
-
beforeUnmount () {
|
|
139
|
-
if (this.resizeObserver) {
|
|
140
|
-
this.resizeObserver.disconnect()
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
}
|
|
144
|
-
</script>
|
|
145
|
-
|
|
146
|
-
<style lang="less" scoped>
|
|
147
|
-
.x-form-col-wrapper {
|
|
148
|
-
:deep(.ant-form-item) {
|
|
149
|
-
.ant-form-item-label {
|
|
150
|
-
max-width: var(--form-label-width);
|
|
151
|
-
}
|
|
152
|
-
.ant-form-item-control-wrapper {
|
|
153
|
-
width: calc(100% - var(--form-label-width) - var(--form-offset) - var(--form-offset));
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<a-col :style="computedStyles">
|
|
3
|
+
<div
|
|
4
|
+
class="x-form-col-wrapper"
|
|
5
|
+
:style="computedWrapperStyles"
|
|
6
|
+
>
|
|
7
|
+
<slot></slot>
|
|
8
|
+
</div>
|
|
9
|
+
</a-col>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script>
|
|
13
|
+
const BREAKPOINTS = {
|
|
14
|
+
xs: 576,
|
|
15
|
+
sm: 768,
|
|
16
|
+
md: 992,
|
|
17
|
+
lg: 1200,
|
|
18
|
+
xl: 1600,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const defaultFlex = {
|
|
22
|
+
xs: 24,
|
|
23
|
+
sm: 24,
|
|
24
|
+
md: 8,
|
|
25
|
+
lg: 8,
|
|
26
|
+
xl: 6,
|
|
27
|
+
xxl: 6,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function debounce (fn, delay) {
|
|
31
|
+
let timeout = null
|
|
32
|
+
return function (...args) {
|
|
33
|
+
if (timeout) clearTimeout(timeout)
|
|
34
|
+
timeout = setTimeout(() => {
|
|
35
|
+
fn.apply(this, args)
|
|
36
|
+
}, delay)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export default {
|
|
41
|
+
name: 'XFormCol',
|
|
42
|
+
props: {
|
|
43
|
+
flex: {
|
|
44
|
+
type: Object,
|
|
45
|
+
default: () => ({
|
|
46
|
+
xs: 24,
|
|
47
|
+
sm: 24,
|
|
48
|
+
md: 8,
|
|
49
|
+
lg: 6,
|
|
50
|
+
xl: 6,
|
|
51
|
+
xxl: 6,
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
occupyCol: {
|
|
55
|
+
type: Number,
|
|
56
|
+
default: 1,
|
|
57
|
+
},
|
|
58
|
+
layout: {
|
|
59
|
+
type: String,
|
|
60
|
+
default: 'horizontal',
|
|
61
|
+
},
|
|
62
|
+
labelCol: {
|
|
63
|
+
type: Object,
|
|
64
|
+
default: () => { return { span: 8 } }
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
computed: {
|
|
68
|
+
computedFlex () {
|
|
69
|
+
const parentWidth = this.parentWidth
|
|
70
|
+
return this.getFlex(parentWidth, this.flex)
|
|
71
|
+
},
|
|
72
|
+
computedWrapperStyles () {
|
|
73
|
+
const realFlex = this.flex.fullWidth ? this.getFlex(this.parentWidth) : this.computedFlex
|
|
74
|
+
// 1. 计算列数
|
|
75
|
+
const columnsCount = 24 / realFlex
|
|
76
|
+
// 2. 计算基准列宽
|
|
77
|
+
const baseColumnWidth = (this.parentWidth / columnsCount) - ((columnsCount - 1) * 16)
|
|
78
|
+
// 3. 计算label宽度
|
|
79
|
+
const labelWidth = Math.max(baseColumnWidth / (24 / this.labelCol.span), 80)
|
|
80
|
+
// 计算左右偏移量
|
|
81
|
+
const offset = this.labelCol.offset ? (this.labelCol.offset / 24) * 100 : 0
|
|
82
|
+
if (this.layout === 'vertical') {
|
|
83
|
+
return {
|
|
84
|
+
'--form-label-width': '',
|
|
85
|
+
'--form-offset': '',
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
'--form-label-width': `${labelWidth}px`,
|
|
90
|
+
'--form-offset': `${offset}%`,
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
computedStyles () {
|
|
94
|
+
const realFlex = Math.min(this.computedFlex * this.occupyCol, 24)
|
|
95
|
+
const flexValue = (realFlex / 24) * 100
|
|
96
|
+
|
|
97
|
+
return {
|
|
98
|
+
flex: `0 0 ${flexValue}%`,
|
|
99
|
+
maxWidth: `${flexValue}%`,
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
data () {
|
|
104
|
+
return {
|
|
105
|
+
parentWidth: 0,
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
methods: {
|
|
109
|
+
getFlex (parentWidth, flex = defaultFlex) {
|
|
110
|
+
if (parentWidth === 0) {
|
|
111
|
+
return flex.md
|
|
112
|
+
}
|
|
113
|
+
if (parentWidth < BREAKPOINTS.xs) return flex.xs
|
|
114
|
+
if (parentWidth < BREAKPOINTS.sm) return flex.sm
|
|
115
|
+
if (parentWidth < BREAKPOINTS.md) return flex.md
|
|
116
|
+
if (parentWidth < BREAKPOINTS.lg) return flex.lg
|
|
117
|
+
if (parentWidth < BREAKPOINTS.xl) return flex.xl
|
|
118
|
+
return flex.xxl
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
mounted () {
|
|
122
|
+
// 根据父容器宽度响应式
|
|
123
|
+
this.$nextTick(() => {
|
|
124
|
+
const container = this.$el.parentNode
|
|
125
|
+
this.parentWidth = container.offsetWidth
|
|
126
|
+
const updateWidth = debounce((width) => {
|
|
127
|
+
this.parentWidth = width
|
|
128
|
+
}, 100)
|
|
129
|
+
|
|
130
|
+
this.resizeObserver = new ResizeObserver((entries) => {
|
|
131
|
+
for (const entry of entries) {
|
|
132
|
+
updateWidth(entry.contentRect.width)
|
|
133
|
+
}
|
|
134
|
+
})
|
|
135
|
+
this.resizeObserver.observe(container)
|
|
136
|
+
})
|
|
137
|
+
},
|
|
138
|
+
beforeUnmount () {
|
|
139
|
+
if (this.resizeObserver) {
|
|
140
|
+
this.resizeObserver.disconnect()
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
}
|
|
144
|
+
</script>
|
|
145
|
+
|
|
146
|
+
<style lang="less" scoped>
|
|
147
|
+
.x-form-col-wrapper {
|
|
148
|
+
:deep(.ant-form-item) {
|
|
149
|
+
.ant-form-item-label {
|
|
150
|
+
max-width: var(--form-label-width);
|
|
151
|
+
}
|
|
152
|
+
.ant-form-item-control-wrapper {
|
|
153
|
+
width: calc(100% - var(--form-label-width) - var(--form-offset) - var(--form-offset));
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
</style>
|
|
@@ -159,6 +159,18 @@ export default {
|
|
|
159
159
|
return null
|
|
160
160
|
},
|
|
161
161
|
},
|
|
162
|
+
setGlobalData: {
|
|
163
|
+
default: () => () => {
|
|
164
|
+
console.warn('setGlobalData is not provided.')
|
|
165
|
+
return null
|
|
166
|
+
},
|
|
167
|
+
},
|
|
168
|
+
getGlobalData: {
|
|
169
|
+
default: () => () => {
|
|
170
|
+
console.warn('getGlobalData is not provided.')
|
|
171
|
+
return null
|
|
172
|
+
},
|
|
173
|
+
},
|
|
162
174
|
getSelectedData: {
|
|
163
175
|
default: () => () => {
|
|
164
176
|
console.warn('getSelectedData is not provided.')
|
|
@@ -1,121 +1,121 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div>
|
|
3
|
-
<!-- 新增/修改模式 -->
|
|
4
|
-
<a-input
|
|
5
|
-
v-if="mode === '新增/修改'"
|
|
6
|
-
v-model="singleValue"
|
|
7
|
-
:read-only="readOnly"
|
|
8
|
-
:disabled="disabled"
|
|
9
|
-
style="width:100%"
|
|
10
|
-
:placeholder="placeholder"
|
|
11
|
-
@blur="handleBlur"
|
|
12
|
-
@change="handleSingleChange"/>
|
|
13
|
-
<!-- 查询模式 -->
|
|
14
|
-
<a-input-group v-else compact>
|
|
15
|
-
<a-input
|
|
16
|
-
v-model="localValue[0]"
|
|
17
|
-
class="intervalPicker-begin"
|
|
18
|
-
:placeholder="startPlaceholder"
|
|
19
|
-
@change="handleChange"/>
|
|
20
|
-
<a-input
|
|
21
|
-
class="intervalPicker-center"
|
|
22
|
-
style="backgroundColor: #fff"
|
|
23
|
-
placeholder="~"
|
|
24
|
-
disabled
|
|
25
|
-
/>
|
|
26
|
-
<a-input
|
|
27
|
-
v-model="localValue[1]"
|
|
28
|
-
class="intervalPicker-end"
|
|
29
|
-
:placeholder="endPlaceholder"
|
|
30
|
-
@change="handleChange"/>
|
|
31
|
-
</a-input-group>
|
|
32
|
-
</div>
|
|
33
|
-
</template>
|
|
34
|
-
|
|
35
|
-
<script>
|
|
36
|
-
export default {
|
|
37
|
-
name: 'XIntervalPicker',
|
|
38
|
-
props: {
|
|
39
|
-
value: {
|
|
40
|
-
type: [Array, String, Number],
|
|
41
|
-
default: () => undefined
|
|
42
|
-
},
|
|
43
|
-
mode: {
|
|
44
|
-
type: String,
|
|
45
|
-
default: '查询'
|
|
46
|
-
},
|
|
47
|
-
readOnly: {
|
|
48
|
-
type: Boolean,
|
|
49
|
-
default: false
|
|
50
|
-
},
|
|
51
|
-
disabled: {
|
|
52
|
-
type: Boolean,
|
|
53
|
-
default: false
|
|
54
|
-
},
|
|
55
|
-
placeholder: {
|
|
56
|
-
type: String,
|
|
57
|
-
default: '请输入'
|
|
58
|
-
},
|
|
59
|
-
startPlaceholder: {
|
|
60
|
-
type: String,
|
|
61
|
-
default: '起始值'
|
|
62
|
-
},
|
|
63
|
-
endPlaceholder: {
|
|
64
|
-
type: String,
|
|
65
|
-
default: '结束值'
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
data () {
|
|
69
|
-
return {
|
|
70
|
-
localValue: ['', ''],
|
|
71
|
-
singleValue: ''
|
|
72
|
-
}
|
|
73
|
-
},
|
|
74
|
-
watch: {
|
|
75
|
-
value: {
|
|
76
|
-
handler (newVal) {
|
|
77
|
-
if (this.mode === '新增/修改') {
|
|
78
|
-
this.singleValue = newVal || ''
|
|
79
|
-
} else {
|
|
80
|
-
this.localValue = Array.isArray(newVal) ? [...newVal] : ['', '']
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
immediate: true
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
methods: {
|
|
87
|
-
handleChange () {
|
|
88
|
-
// 如果两个输入框都为空或undefined,则发出undefined
|
|
89
|
-
if (!this.localValue[0] && !this.localValue[1]) {
|
|
90
|
-
this.$emit('input', undefined)
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
// 否则发出当前数组值
|
|
94
|
-
this.$emit('input', this.localValue)
|
|
95
|
-
},
|
|
96
|
-
handleSingleChange () {
|
|
97
|
-
this.$emit('input', this.singleValue || undefined)
|
|
98
|
-
},
|
|
99
|
-
handleBlur (e) {
|
|
100
|
-
this.$emit('blur', e)
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
</script>
|
|
105
|
-
|
|
106
|
-
<style lang="less" scoped>
|
|
107
|
-
.intervalPicker-begin {
|
|
108
|
-
width: calc(50% - 14px);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.intervalPicker-center {
|
|
112
|
-
width: 30px;
|
|
113
|
-
border-left: 0;
|
|
114
|
-
pointer-events: none;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
.intervalPicker-end {
|
|
118
|
-
width: calc(50% - 14px);
|
|
119
|
-
border-left: 0;
|
|
120
|
-
}
|
|
121
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<!-- 新增/修改模式 -->
|
|
4
|
+
<a-input
|
|
5
|
+
v-if="mode === '新增/修改'"
|
|
6
|
+
v-model="singleValue"
|
|
7
|
+
:read-only="readOnly"
|
|
8
|
+
:disabled="disabled"
|
|
9
|
+
style="width:100%"
|
|
10
|
+
:placeholder="placeholder"
|
|
11
|
+
@blur="handleBlur"
|
|
12
|
+
@change="handleSingleChange"/>
|
|
13
|
+
<!-- 查询模式 -->
|
|
14
|
+
<a-input-group v-else compact>
|
|
15
|
+
<a-input
|
|
16
|
+
v-model="localValue[0]"
|
|
17
|
+
class="intervalPicker-begin"
|
|
18
|
+
:placeholder="startPlaceholder"
|
|
19
|
+
@change="handleChange"/>
|
|
20
|
+
<a-input
|
|
21
|
+
class="intervalPicker-center"
|
|
22
|
+
style="backgroundColor: #fff"
|
|
23
|
+
placeholder="~"
|
|
24
|
+
disabled
|
|
25
|
+
/>
|
|
26
|
+
<a-input
|
|
27
|
+
v-model="localValue[1]"
|
|
28
|
+
class="intervalPicker-end"
|
|
29
|
+
:placeholder="endPlaceholder"
|
|
30
|
+
@change="handleChange"/>
|
|
31
|
+
</a-input-group>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script>
|
|
36
|
+
export default {
|
|
37
|
+
name: 'XIntervalPicker',
|
|
38
|
+
props: {
|
|
39
|
+
value: {
|
|
40
|
+
type: [Array, String, Number],
|
|
41
|
+
default: () => undefined
|
|
42
|
+
},
|
|
43
|
+
mode: {
|
|
44
|
+
type: String,
|
|
45
|
+
default: '查询'
|
|
46
|
+
},
|
|
47
|
+
readOnly: {
|
|
48
|
+
type: Boolean,
|
|
49
|
+
default: false
|
|
50
|
+
},
|
|
51
|
+
disabled: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
default: false
|
|
54
|
+
},
|
|
55
|
+
placeholder: {
|
|
56
|
+
type: String,
|
|
57
|
+
default: '请输入'
|
|
58
|
+
},
|
|
59
|
+
startPlaceholder: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: '起始值'
|
|
62
|
+
},
|
|
63
|
+
endPlaceholder: {
|
|
64
|
+
type: String,
|
|
65
|
+
default: '结束值'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
data () {
|
|
69
|
+
return {
|
|
70
|
+
localValue: ['', ''],
|
|
71
|
+
singleValue: ''
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
watch: {
|
|
75
|
+
value: {
|
|
76
|
+
handler (newVal) {
|
|
77
|
+
if (this.mode === '新增/修改') {
|
|
78
|
+
this.singleValue = newVal || ''
|
|
79
|
+
} else {
|
|
80
|
+
this.localValue = Array.isArray(newVal) ? [...newVal] : ['', '']
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
immediate: true
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
methods: {
|
|
87
|
+
handleChange () {
|
|
88
|
+
// 如果两个输入框都为空或undefined,则发出undefined
|
|
89
|
+
if (!this.localValue[0] && !this.localValue[1]) {
|
|
90
|
+
this.$emit('input', undefined)
|
|
91
|
+
return
|
|
92
|
+
}
|
|
93
|
+
// 否则发出当前数组值
|
|
94
|
+
this.$emit('input', this.localValue)
|
|
95
|
+
},
|
|
96
|
+
handleSingleChange () {
|
|
97
|
+
this.$emit('input', this.singleValue || undefined)
|
|
98
|
+
},
|
|
99
|
+
handleBlur (e) {
|
|
100
|
+
this.$emit('blur', e)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
</script>
|
|
105
|
+
|
|
106
|
+
<style lang="less" scoped>
|
|
107
|
+
.intervalPicker-begin {
|
|
108
|
+
width: calc(50% - 14px);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.intervalPicker-center {
|
|
112
|
+
width: 30px;
|
|
113
|
+
border-left: 0;
|
|
114
|
+
pointer-events: none;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.intervalPicker-end {
|
|
118
|
+
width: calc(50% - 14px);
|
|
119
|
+
border-left: 0;
|
|
120
|
+
}
|
|
121
|
+
</style>
|