cnhis-design-vue 2.1.79 → 2.1.80
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/CHANGELOG.md +38 -17
- package/es/affix/index.js +8 -8
- package/es/age/index.js +10 -10
- package/es/alert/index.js +8 -8
- package/es/anchor/index.js +8 -8
- package/es/auto-complete/index.js +8 -8
- package/es/avatar/index.js +8 -8
- package/es/back-top/index.js +8 -8
- package/es/badge/index.js +8 -8
- package/es/base/index.js +8 -8
- package/es/big-table/index.js +115 -95
- package/es/big-table/style.css +1 -1
- package/es/breadcrumb/index.js +8 -8
- package/es/button/index.js +22 -22
- package/es/calendar/index.js +8 -8
- package/es/captcha/index.js +3 -3
- package/es/card/index.js +8 -8
- package/es/carousel/index.js +8 -8
- package/es/cascader/index.js +8 -8
- package/es/checkbox/index.js +9 -9
- package/es/col/index.js +8 -8
- package/es/collapse/index.js +8 -8
- package/es/color-picker/index.js +1 -1
- package/es/comment/index.js +8 -8
- package/es/config-provider/index.js +8 -8
- package/es/date-picker/index.js +8 -8
- package/es/descriptions/index.js +8 -8
- package/es/divider/index.js +8 -8
- package/es/drag-layout/index.js +3 -3
- package/es/drawer/index.js +8 -8
- package/es/dropdown/index.js +8 -8
- package/es/editor/index.js +1 -1
- package/es/ellipsis/index.js +1 -1
- package/es/empty/index.js +8 -8
- package/es/fabric-chart/index.js +9 -9
- package/es/form/index.js +8 -8
- package/es/form-model/index.js +8 -8
- package/es/form-table/index.js +66 -66
- package/es/index/index.js +2794 -1422
- package/es/index/style.css +1 -1
- package/es/input/index.js +9 -9
- package/es/input-number/index.js +8 -8
- package/es/layout/index.js +8 -8
- package/es/list/index.js +8 -8
- package/es/locale-provider/index.js +8 -8
- package/es/map/index.js +9 -9
- package/es/mentions/index.js +8 -8
- package/es/menu/index.js +8 -8
- package/es/message/index.js +8 -8
- package/es/multi-chat/index.js +76 -76
- package/es/multi-chat-client/index.js +70 -70
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +14 -14
- package/es/multi-chat-setting/index.js +22 -22
- package/es/multi-chat-sip/index.js +1 -1
- package/es/notification/index.js +8 -8
- package/es/page-header/index.js +8 -8
- package/es/pagination/index.js +8 -8
- package/es/popconfirm/index.js +8 -8
- package/es/popover/index.js +8 -8
- package/es/progress/index.js +8 -8
- package/es/radio/index.js +9 -9
- package/es/rate/index.js +8 -8
- package/es/result/index.js +8 -8
- package/es/row/index.js +8 -8
- package/es/scale-container/index.js +1 -1
- package/es/scale-view/index.js +52 -50
- package/es/scale-view/style.css +1 -1
- package/es/select/index.js +12 -12
- package/es/select-label/index.js +36 -34
- package/es/select-label/style.css +1 -1
- package/es/select-person/index.js +2 -2
- package/es/shortcut-setter/index.js +10 -10
- package/es/skeleton/index.js +8 -8
- package/es/slider/index.js +8 -8
- package/es/space/index.js +8 -8
- package/es/spin/index.js +8 -8
- package/es/statistic/index.js +8 -8
- package/es/steps/index.js +8 -8
- package/es/switch/index.js +8 -8
- package/es/table-filter/index.js +2535 -1185
- package/es/table-filter/style.css +1 -1
- package/es/tabs/index.js +8 -8
- package/es/tag/index.js +9 -9
- package/es/time-picker/index.js +8 -8
- package/es/timeline/index.js +8 -8
- package/es/tooltip/index.js +8 -8
- package/es/transfer/index.js +8 -8
- package/es/tree/index.js +8 -8
- package/es/tree-select/index.js +8 -8
- package/es/upload/index.js +8 -8
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +3100 -1583
- package/lib/cui.umd.js +3100 -1583
- package/lib/cui.umd.min.js +54 -54
- package/package.json +1 -1
- package/packages/big-table/src/BigTable.vue +15 -3
- package/packages/big-table/src/assets/style/table-base.less +7 -4
- package/packages/select-label/select-label.vue +18 -2
- package/packages/table-filter/src/base-search-com/BaseSearch.vue +7 -15
- package/packages/table-filter/src/components/TextOverTooltip.vue +24 -11
- package/packages/table-filter/src/components/age-com/index.vue +3 -3
- package/packages/table-filter/src/components/checkbox-group/CheckboxGroup.vue +53 -0
- package/packages/table-filter/src/components/multi-select/multi-select.vue +7 -1
- package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +5 -119
- package/packages/table-filter/src/components/range-age/index.vue +11 -12
- package/packages/table-filter/src/components/render-widget/components/DateRangeQuick.vue +212 -0
- package/packages/table-filter/src/components/render-widget/components/NumberRange.vue +145 -0
- package/packages/table-filter/src/components/render-widget/components/SelectDynamic.vue +304 -0
- package/packages/table-filter/src/components/render-widget/components/index.js +4 -4
- package/packages/table-filter/src/components/render-widget/enums.js +27 -22
- package/packages/table-filter/src/components/render-widget/index.vue +38 -5
- package/packages/table-filter/src/components/render-widget/mixins/dynamic-method.js +158 -0
- package/packages/table-filter/src/components/render-widget/widgetCfgMaps.js +150 -45
- package/packages/table-filter/src/components/search-filter/SearchFilter.vue +3 -1
- package/packages/table-filter/src/mixins/mixins.js +192 -133
- package/packages/table-filter/src/mixins/out-quick-method.js +123 -0
- package/packages/table-filter/src/mixins/renderWidget.js +21 -13
- package/packages/table-filter/src/quick-search/QuickSearch.vue +144 -121
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="filter-date-range">
|
|
3
|
+
<a-radio-group v-model="con" buttonStyle="solid">
|
|
4
|
+
<a-radio-button
|
|
5
|
+
v-for="date in dateTeam0"
|
|
6
|
+
v-show="!showDate"
|
|
7
|
+
@click="clickRadioGroup(date.con)"
|
|
8
|
+
:key="date.con"
|
|
9
|
+
:value="date.con"
|
|
10
|
+
>
|
|
11
|
+
{{ getI18nText(date.title, date.name) }}
|
|
12
|
+
</a-radio-button>
|
|
13
|
+
<span :class="['check-date-btn', marginx]" @click="checkDate">
|
|
14
|
+
{{ getI18nText('1.1.4.52', '选择时间') }}
|
|
15
|
+
</span>
|
|
16
|
+
<div class="check-date" v-show="showDate">
|
|
17
|
+
<a-date-picker
|
|
18
|
+
v-model="value_start"
|
|
19
|
+
:format="format"
|
|
20
|
+
:show-time="showTimeStart"
|
|
21
|
+
:placeholder="placeholderS"
|
|
22
|
+
style="width: 120px"
|
|
23
|
+
allowClear
|
|
24
|
+
:disabledDate="current => disabledDatePicker(current, 'start')"
|
|
25
|
+
@change="dateChangeStr"
|
|
26
|
+
/>
|
|
27
|
+
|
|
28
|
+
<a-date-picker
|
|
29
|
+
v-model="value_end"
|
|
30
|
+
:format="format"
|
|
31
|
+
:show-time="showTimeEnd"
|
|
32
|
+
:placeholder="placeholderE"
|
|
33
|
+
style="width: 120px"
|
|
34
|
+
allowClear
|
|
35
|
+
:disabledDate="current => disabledDatePicker(current, 'end')"
|
|
36
|
+
@change="dateChangeEnd"
|
|
37
|
+
/>
|
|
38
|
+
</div>
|
|
39
|
+
</a-radio-group>
|
|
40
|
+
</div>
|
|
41
|
+
</template>
|
|
42
|
+
|
|
43
|
+
<script>
|
|
44
|
+
import { Radio, DatePicker } from 'ant-design-vue';
|
|
45
|
+
import { dataOptions } from '~/table-filter/src/const/dataOptions';
|
|
46
|
+
import moment from 'moment';
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
inheritAttrs: false,
|
|
50
|
+
components: {
|
|
51
|
+
[DatePicker.name]: DatePicker,
|
|
52
|
+
[Radio.Button.name]: Radio.Button,
|
|
53
|
+
[Radio.Group.name]: Radio.Group,
|
|
54
|
+
},
|
|
55
|
+
props: {
|
|
56
|
+
value: {
|
|
57
|
+
type: [Array, String, Number],
|
|
58
|
+
},
|
|
59
|
+
componentCfg: { type: Object },
|
|
60
|
+
placeholderS: String,
|
|
61
|
+
placeholderE: String,
|
|
62
|
+
fieldType: String
|
|
63
|
+
},
|
|
64
|
+
data(){
|
|
65
|
+
return {
|
|
66
|
+
showDate: false,
|
|
67
|
+
marginx: 'ml',
|
|
68
|
+
con: null,
|
|
69
|
+
value_start: null,
|
|
70
|
+
value_end: null,
|
|
71
|
+
...dataOptions
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
model: {
|
|
75
|
+
prop: "value",
|
|
76
|
+
event: "update:value"
|
|
77
|
+
},
|
|
78
|
+
computed: {
|
|
79
|
+
showTimeStart(){
|
|
80
|
+
if(this.fieldType === 'DATE') return false;
|
|
81
|
+
return { defaultValue: moment('00:00:00', 'HH:mm:ss') }
|
|
82
|
+
},
|
|
83
|
+
showTimeEnd(){
|
|
84
|
+
if(this.fieldType === 'DATE') return false;
|
|
85
|
+
return { defaultValue: moment('23:59:59', 'HH:mm:ss') }
|
|
86
|
+
},
|
|
87
|
+
format(){
|
|
88
|
+
if(this.fieldType === 'DATE') return 'YYYY-MM-DD';
|
|
89
|
+
return 'YYYY-MM-DD HH:mm:ss'
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
watch: {
|
|
93
|
+
value: {
|
|
94
|
+
immediate: true,
|
|
95
|
+
handler(val) {
|
|
96
|
+
if(!val && !this.componentCfg?.con) {
|
|
97
|
+
this.clearData()
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
created(){
|
|
103
|
+
this.init();
|
|
104
|
+
},
|
|
105
|
+
methods: {
|
|
106
|
+
handleMoment(val) {
|
|
107
|
+
if(!val || !val._isAMomentObject) return null;
|
|
108
|
+
return val.format(this.format) || null;
|
|
109
|
+
},
|
|
110
|
+
init(){
|
|
111
|
+
if(!this.value) return;
|
|
112
|
+
let resVal = this.value
|
|
113
|
+
if (
|
|
114
|
+
resVal?.length === 1 &&
|
|
115
|
+
resVal[0] &&
|
|
116
|
+
typeof resVal[0] === "string" &&
|
|
117
|
+
resVal[0].includes("~")
|
|
118
|
+
) {
|
|
119
|
+
resVal = resVal[0].split("~");
|
|
120
|
+
}
|
|
121
|
+
if(!Array.isArray(resVal)) return;
|
|
122
|
+
this.value_start = resVal[0];
|
|
123
|
+
this.value_end = resVal[1];
|
|
124
|
+
},
|
|
125
|
+
// 单选按钮组合点击取消选中状态
|
|
126
|
+
clickRadioGroup(con) {
|
|
127
|
+
this.$emit("update:value", []);
|
|
128
|
+
this.value_start = null;
|
|
129
|
+
this.value_end = null;
|
|
130
|
+
if (this.con == con) {
|
|
131
|
+
this.con = null;
|
|
132
|
+
} else {
|
|
133
|
+
this.con = con;
|
|
134
|
+
}
|
|
135
|
+
this.$emit('setCfgCon', this.con);
|
|
136
|
+
},
|
|
137
|
+
checkDate() {
|
|
138
|
+
this.showDate = !this.showDate;
|
|
139
|
+
this.showDate ? (this.marginx = "mr") : (this.marginx = "ml");
|
|
140
|
+
},
|
|
141
|
+
clearData(){
|
|
142
|
+
this.con = null;
|
|
143
|
+
this.value_start = null;
|
|
144
|
+
this.value_end = null;
|
|
145
|
+
this.marginx = 'ml';
|
|
146
|
+
this.showDate = false;
|
|
147
|
+
this.$emit('setCfgCon', this.con);
|
|
148
|
+
},
|
|
149
|
+
dateChangeStr(date){
|
|
150
|
+
this.$emit('setCfgCon', 'EQ')
|
|
151
|
+
let str = `${this.handleMoment(date) || ''}~${this.handleMoment(this.value_end) || ''}`
|
|
152
|
+
this.$emit("update:value", str);
|
|
153
|
+
},
|
|
154
|
+
dateChangeEnd(date){
|
|
155
|
+
this.$emit('setCfgCon', 'EQ')
|
|
156
|
+
let str = `${this.handleMoment(this.value_start) || ''}~${this.handleMoment(date) || ''}`
|
|
157
|
+
this.$emit("update:value", str);
|
|
158
|
+
},
|
|
159
|
+
/**
|
|
160
|
+
* 限制日期填写
|
|
161
|
+
*/
|
|
162
|
+
disabledDatePicker(current, t){
|
|
163
|
+
let f = false;
|
|
164
|
+
if(t=== 'start'){
|
|
165
|
+
const end_val = this.value_end;
|
|
166
|
+
f = end_val && current.valueOf() > end_val.valueOf();
|
|
167
|
+
} else if(t=== 'end') {
|
|
168
|
+
const start_val = this.value_start;
|
|
169
|
+
f = start_val && current.valueOf() <= start_val.valueOf();
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* 2 过去时间
|
|
173
|
+
* 3 未来时间
|
|
174
|
+
*/
|
|
175
|
+
let type = String(this.componentCfg?.advanceOptionSetting);
|
|
176
|
+
if(!['2','3'].includes(type)) return f;
|
|
177
|
+
if(type === '2'){
|
|
178
|
+
return current >= moment().endOf('day') || f;
|
|
179
|
+
} else if(type==='3'){
|
|
180
|
+
return current && current < moment().startOf('day') || f;
|
|
181
|
+
}
|
|
182
|
+
return f
|
|
183
|
+
},
|
|
184
|
+
getI18nText(i, d) {
|
|
185
|
+
if (Array.isArray(i)) {
|
|
186
|
+
return this.$t ? this.$t.apply(this, i) : d;
|
|
187
|
+
}
|
|
188
|
+
return this.$t ? this.$t(i) : d;
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
}
|
|
192
|
+
</script>
|
|
193
|
+
<style lang='less' scoped>
|
|
194
|
+
.check-date-btn {
|
|
195
|
+
display: inline-block;
|
|
196
|
+
line-height: 32px;
|
|
197
|
+
height: 32px;
|
|
198
|
+
padding: 0 10px;
|
|
199
|
+
background-color: #ddd;
|
|
200
|
+
cursor: pointer;
|
|
201
|
+
&.ml {
|
|
202
|
+
margin-left: 12px;
|
|
203
|
+
}
|
|
204
|
+
&.mr {
|
|
205
|
+
margin-right: 12px;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
.check-date {
|
|
209
|
+
display: inline-block;
|
|
210
|
+
line-height: 33px;
|
|
211
|
+
}
|
|
212
|
+
</style>
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="filter-number-range">
|
|
3
|
+
<span
|
|
4
|
+
class="ant-calendar-picker-input ant-input num-picker"
|
|
5
|
+
:class="{ 'num-picker-unit': componentCfg.inputUnit }"
|
|
6
|
+
>
|
|
7
|
+
<input
|
|
8
|
+
v-model="lessValue"
|
|
9
|
+
:title="`起始${componentCfg.title}`"
|
|
10
|
+
:placeholder="`起始${componentCfg.title}`"
|
|
11
|
+
@keyup.enter="changeFilterNumber"
|
|
12
|
+
@change="changeFilterNumber"
|
|
13
|
+
class="ant-calendar-range-picker-input"/>
|
|
14
|
+
<span class="ant-calendar-range-picker-separator"> ~ </span>
|
|
15
|
+
<input
|
|
16
|
+
v-model="bigValue"
|
|
17
|
+
:title="`截止${componentCfg.title}`"
|
|
18
|
+
:placeholder="`截止${componentCfg.title}`"
|
|
19
|
+
@keyup.enter="changeFilterNumber"
|
|
20
|
+
@change="changeFilterNumber"
|
|
21
|
+
class="ant-calendar-range-picker-input"/>
|
|
22
|
+
<template v-if="componentCfg.inputUnit"> {{ componentCfg.inputUnit }}</template>
|
|
23
|
+
<span
|
|
24
|
+
class="ant-input-suffix clear-number-icon"
|
|
25
|
+
v-if="lessValue || bigValue"
|
|
26
|
+
@click="clearFilterNumber"
|
|
27
|
+
><i
|
|
28
|
+
aria-label="图标: close-circle"
|
|
29
|
+
tabindex="-1"
|
|
30
|
+
class="anticon anticon-close-circle ant-input-clear-icon"
|
|
31
|
+
><svg
|
|
32
|
+
viewBox="64 64 896 896"
|
|
33
|
+
data-icon="close-circle"
|
|
34
|
+
width="1em"
|
|
35
|
+
height="1em"
|
|
36
|
+
fill="currentColor"
|
|
37
|
+
aria-hidden="true"
|
|
38
|
+
focusable="false"
|
|
39
|
+
class=""
|
|
40
|
+
>
|
|
41
|
+
<path
|
|
42
|
+
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm165.4 618.2l-66-.3L512 563.4l-99.3 118.4-66.1.3c-4.4 0-8-3.5-8-8 0-1.9.7-3.7 1.9-5.2l130.1-155L340.5 359a8.32 8.32 0 0 1-1.9-5.2c0-4.4 3.6-8 8-8l66.1.3L512 464.6l99.3-118.4 66-.3c4.4 0 8 3.5 8 8 0 1.9-.7 3.7-1.9 5.2L553.5 514l130 155c1.2 1.5 1.9 3.3 1.9 5.2 0 4.4-3.6 8-8 8z"
|
|
43
|
+
></path></svg></i></span
|
|
44
|
+
></span>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
47
|
+
|
|
48
|
+
<script>
|
|
49
|
+
import { Select } from 'ant-design-vue';
|
|
50
|
+
|
|
51
|
+
export default {
|
|
52
|
+
inheritAttrs: false,
|
|
53
|
+
components: {
|
|
54
|
+
Select,
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
value: {
|
|
58
|
+
type: [Array, String, Number],
|
|
59
|
+
},
|
|
60
|
+
componentCfg: {
|
|
61
|
+
type: Object
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
watch: {
|
|
65
|
+
value: {
|
|
66
|
+
immediate: true,
|
|
67
|
+
handler(val) {
|
|
68
|
+
if(!val) {
|
|
69
|
+
this.clearFilterNumber()
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
data(){
|
|
75
|
+
return {
|
|
76
|
+
lessValue: undefined,
|
|
77
|
+
bigValue: undefined
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
model: {
|
|
81
|
+
prop: "value",
|
|
82
|
+
event: "update:value"
|
|
83
|
+
},
|
|
84
|
+
computed: {},
|
|
85
|
+
created(){
|
|
86
|
+
this.init();
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
init(){
|
|
90
|
+
// 参数查询会被处理为["1~22"]
|
|
91
|
+
if(!this.value || !Array.isArray(this.value)) {
|
|
92
|
+
this.clearFilterNumber();
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
let resVal = this.value[0]
|
|
96
|
+
if(!resVal || typeof resVal !== 'string' || !resVal.includes('~')) {
|
|
97
|
+
this.clearFilterNumber();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.lessValue = resVal.split('~')?.[0] ?? undefined;
|
|
101
|
+
this.bigValue = resVal.split('~')?.[1] ?? undefined;
|
|
102
|
+
},
|
|
103
|
+
changeFilterNumber() {
|
|
104
|
+
let res = `${this.lessValue ?? ''}~${this.bigValue ?? ''}`
|
|
105
|
+
if (this.lessValue && this.bigValue && this.lessValue > this.bigValue) {
|
|
106
|
+
res = `${this.bigValue}~${this.lessValue}`
|
|
107
|
+
}
|
|
108
|
+
this.$emit("update:value", res);
|
|
109
|
+
},
|
|
110
|
+
clearFilterNumber() {
|
|
111
|
+
this.lessValue = undefined;
|
|
112
|
+
this.bigValue = undefined;
|
|
113
|
+
this.$emit("update:value", '');
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
<style lang='less' scoped>
|
|
119
|
+
/deep/ .num-picker {
|
|
120
|
+
position: relative;
|
|
121
|
+
display: flex;
|
|
122
|
+
&.num-picker-unit {
|
|
123
|
+
padding-right: 20px;
|
|
124
|
+
}
|
|
125
|
+
input {
|
|
126
|
+
text-align: left !important;
|
|
127
|
+
}
|
|
128
|
+
&:hover {
|
|
129
|
+
.clear-number-icon {
|
|
130
|
+
display: block;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/deep/ .ant-calendar-range-picker-input {
|
|
134
|
+
text-align: left;
|
|
135
|
+
}
|
|
136
|
+
.clear-number-icon {
|
|
137
|
+
position: absolute;
|
|
138
|
+
right: 5px;
|
|
139
|
+
top: 6px;
|
|
140
|
+
display: none;
|
|
141
|
+
cursor: pointer;
|
|
142
|
+
z-index: 1000;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
</style>
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="SelectDynamic">
|
|
3
|
+
<a-select
|
|
4
|
+
v-model="valueCp"
|
|
5
|
+
showSearch
|
|
6
|
+
:mode="mode"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
:dropdownMatchSelectWidth="true"
|
|
9
|
+
:maxTagCount="maxTagCount"
|
|
10
|
+
:maxTagPlaceholder="maxTagPlaceholder"
|
|
11
|
+
:filterOption="false"
|
|
12
|
+
:allowClear="true"
|
|
13
|
+
ref="quickInputSelect"
|
|
14
|
+
class="quick-dynamic-select"
|
|
15
|
+
:notFoundContent="componentCfg.fetchingWordbook ? undefined : '暂无数据'"
|
|
16
|
+
:class="{ 'quick-dynamic-select-mul': maxTagCount > 0 }"
|
|
17
|
+
@search="handleWordBookSearchRender($event, componentCfg)"
|
|
18
|
+
@dropdownVisibleChange="dropdownVisibleChangeRender($event, componentCfg)"
|
|
19
|
+
@change="handleChange($event, componentCfg)"
|
|
20
|
+
>
|
|
21
|
+
<template>
|
|
22
|
+
<a-select-option
|
|
23
|
+
v-for="(sea, k) in componentCfg.dataSource"
|
|
24
|
+
:key="k + sea.myName"
|
|
25
|
+
:value="sea.myName"
|
|
26
|
+
class="quick-dynamic-select-item"
|
|
27
|
+
>
|
|
28
|
+
<span v-for="(v, i) in showKeys" :key="i" :style="getShowKeysMax">
|
|
29
|
+
<Ellipsis :content="sea[v]"></Ellipsis>
|
|
30
|
+
</span>
|
|
31
|
+
</a-select-option>
|
|
32
|
+
</template>
|
|
33
|
+
<span slot="notFoundContent">暂无数据</span>
|
|
34
|
+
<div
|
|
35
|
+
slot="dropdownRender"
|
|
36
|
+
class="quick-dynamic-dropDown-container"
|
|
37
|
+
:class="{ 'quick-dynamic-dropDown-container-hasTitle': selectHasTitle }"
|
|
38
|
+
slot-scope="menu"
|
|
39
|
+
>
|
|
40
|
+
<a-spin v-if="componentCfg.fetchingWordbook" :spinning="componentCfg.fetchingWordbook" :tip="`加载中...`" >
|
|
41
|
+
<v-nodes :vnodes="menu" />
|
|
42
|
+
<!-- <select-pages v-if="!isnoPages" :searchPageConfig="componentCfg.searchPageConfig" :handleSearchChangePage="handleSearchChangePage" /> -->
|
|
43
|
+
</a-spin>
|
|
44
|
+
<template v-else-if="selectHasTitle">
|
|
45
|
+
<v-nodes :vnodes="menu" />
|
|
46
|
+
<div class="quick-dynamic-select-title">
|
|
47
|
+
<span v-for="(v, i) in _showKeys_" :key="i">
|
|
48
|
+
<Ellipsis :content="v"></Ellipsis>
|
|
49
|
+
</span>
|
|
50
|
+
</div>
|
|
51
|
+
</template>
|
|
52
|
+
<template v-else>
|
|
53
|
+
<v-nodes :vnodes="menu" />
|
|
54
|
+
</template>
|
|
55
|
+
</div>
|
|
56
|
+
<span slot="removeIcon">
|
|
57
|
+
<a-icon v-if="showRemoveIcon" type="close" />
|
|
58
|
+
<span v-else></span>
|
|
59
|
+
</span>
|
|
60
|
+
</a-select>
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
<script>
|
|
64
|
+
import { Select, Spin, Icon,Button } from 'ant-design-vue';
|
|
65
|
+
import selectPages from '@/component/select-pages';
|
|
66
|
+
import Ellipsis from '~/ellipsis'
|
|
67
|
+
export default {
|
|
68
|
+
name: "SelectDynamic",
|
|
69
|
+
components: {
|
|
70
|
+
Select,
|
|
71
|
+
[Select.name]: Select,
|
|
72
|
+
[Select.Option.name]: Select.Option,
|
|
73
|
+
[Spin.name]: Spin,
|
|
74
|
+
[Button.name]:Button,
|
|
75
|
+
[Icon.name]: Icon,
|
|
76
|
+
selectPages,
|
|
77
|
+
Ellipsis,
|
|
78
|
+
VNodes: {
|
|
79
|
+
functional: true,
|
|
80
|
+
render: (h, ctx) => ctx.props.vnodes
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
props: {
|
|
84
|
+
value: {
|
|
85
|
+
type: [Array, String, Number],
|
|
86
|
+
},
|
|
87
|
+
componentCfg: { type: Object },
|
|
88
|
+
placeholder: String,
|
|
89
|
+
mode: String,
|
|
90
|
+
handleWordBookSearchRender: Function,
|
|
91
|
+
dropdownVisibleChangeRender: Function
|
|
92
|
+
},
|
|
93
|
+
data() {
|
|
94
|
+
return {};
|
|
95
|
+
},
|
|
96
|
+
model: {
|
|
97
|
+
prop: "value",
|
|
98
|
+
event: "update:value"
|
|
99
|
+
},
|
|
100
|
+
computed: {
|
|
101
|
+
valueCp: {
|
|
102
|
+
set(val) {
|
|
103
|
+
this.$emit("update:value", val);
|
|
104
|
+
},
|
|
105
|
+
get() {
|
|
106
|
+
return this.value;
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
showSelectTitle() {
|
|
110
|
+
let { fetchingWordbook, dataSource } = this.componentCfg || {};
|
|
111
|
+
return !fetchingWordbook && !!dataSource?.length;
|
|
112
|
+
},
|
|
113
|
+
showKeys() {
|
|
114
|
+
let { showKeys } = this.componentCfg?.widgetCfg?.dynamicOptionInfo || {};
|
|
115
|
+
return showKeys;
|
|
116
|
+
},
|
|
117
|
+
_showKeys_() {
|
|
118
|
+
let { _showKeys_ } = this.componentCfg || {};
|
|
119
|
+
if(_showKeys_?.length) return _showKeys_;
|
|
120
|
+
return this.showKeys;
|
|
121
|
+
},
|
|
122
|
+
getShowKeysMax(){
|
|
123
|
+
let len = this.showKeys?.length || 1
|
|
124
|
+
let maxWidth = 100 / len
|
|
125
|
+
return {
|
|
126
|
+
maxWidth: `${maxWidth}%`
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
selectHasTitle() {
|
|
130
|
+
const {showSelectTitle, showKeys, componentCfg} = this;
|
|
131
|
+
return showSelectTitle && Array.isArray(showKeys) && showKeys?.length > 1 && componentCfg?.dataSource?.length;
|
|
132
|
+
},
|
|
133
|
+
maxTagCount() {
|
|
134
|
+
if (!Array.isArray(this.value)) return undefined;
|
|
135
|
+
const len = this.value.length || 0;
|
|
136
|
+
return len > 1 ? 0 : 1;
|
|
137
|
+
},
|
|
138
|
+
showRemoveIcon(){
|
|
139
|
+
let v = this.value;
|
|
140
|
+
let f = 1 == this?.componentCfg?.filterExplicit
|
|
141
|
+
if(Array.isArray(v) && f){
|
|
142
|
+
let l = v.length;
|
|
143
|
+
if(this.componentCfg.explicitRequired == 1){
|
|
144
|
+
return l > 1
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return true;
|
|
149
|
+
},
|
|
150
|
+
// 有没有分页配置
|
|
151
|
+
isnoPages(){
|
|
152
|
+
const { searchPageConfig } = this.componentCfg || {};
|
|
153
|
+
if(!searchPageConfig) return true;
|
|
154
|
+
|
|
155
|
+
return searchPageConfig.page <= 1 && !searchPageConfig.hasNextPage;
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
watch: {
|
|
159
|
+
// value: {
|
|
160
|
+
// immediate: true,
|
|
161
|
+
// handler(val) {}
|
|
162
|
+
// }
|
|
163
|
+
},
|
|
164
|
+
// 生命周期
|
|
165
|
+
created() {},
|
|
166
|
+
mounted() {
|
|
167
|
+
this.createSuffixIcon()
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
// 方法
|
|
171
|
+
methods: {
|
|
172
|
+
createSuffixIcon() {
|
|
173
|
+
if (this.mode === "default") return;
|
|
174
|
+
let refDom = this.$refs.quickInputSelect;
|
|
175
|
+
if (!refDom) return;
|
|
176
|
+
let selectDom = refDom.$el;
|
|
177
|
+
if (!selectDom) return;
|
|
178
|
+
|
|
179
|
+
let pDom = selectDom.querySelector(".ant-select-selection--multiple");
|
|
180
|
+
if(!pDom) return;
|
|
181
|
+
let hasTag = pDom.querySelector(".quick-dynamic-select-span");
|
|
182
|
+
if (!hasTag) {
|
|
183
|
+
let tag = document.createElement("span");
|
|
184
|
+
tag.className = "quick-dynamic-select-span";
|
|
185
|
+
let icon = `<i aria-label="图标: down" class="anticon anticon-down ant-select-arrow-icon"><svg viewBox="64 64 896 896" data-icon="down" width="1em" height="1em" fill="currentColor" aria-hidden="true" focusable="false" class=""><path d="M884 256h-75c-5.1 0-9.9 2.5-12.9 6.6L512 654.2 227.9 262.6c-3-4.1-7.8-6.6-12.9-6.6h-75c-6.5 0-10.3 7.4-6.5 12.7l352.6 486.1c12.8 17.6 39 17.6 51.7 0l352.6-486.1c3.9-5.3.1-12.7-6.4-12.7z"></path></svg></i>`;
|
|
186
|
+
tag.innerHTML = icon;
|
|
187
|
+
pDom.appendChild(tag);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
maxTagPlaceholder() {
|
|
191
|
+
if (!Array.isArray(this.value)) return undefined;
|
|
192
|
+
const { alias, title } = this.componentCfg;
|
|
193
|
+
const len = this.value.length || 0;
|
|
194
|
+
return this.value.length > 1 ? `已选${len}个${alias || title}` : "";
|
|
195
|
+
},
|
|
196
|
+
handleChange(val, item){
|
|
197
|
+
if(this.mode === 'multiple') return;
|
|
198
|
+
this.$emit('change')
|
|
199
|
+
},
|
|
200
|
+
handleSearchChangePage(type) {
|
|
201
|
+
let cType = type || 'next';
|
|
202
|
+
let { page, keyword = undefined } = this?.componentCfg?.searchPageConfig;
|
|
203
|
+
page = cType === 'next' ? page + 1 : page - 1;
|
|
204
|
+
this.handleWordBookSearchRender(keyword, this.componentCfg, { page });
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
</script>
|
|
209
|
+
<style lang="less">
|
|
210
|
+
.SelectDynamic {
|
|
211
|
+
width: 100%;
|
|
212
|
+
}
|
|
213
|
+
.ant-select-dropdown--empty {
|
|
214
|
+
.ant-select-dropdown-menu-item-disabled {
|
|
215
|
+
text-align: center;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
.quick-dynamic-select {
|
|
219
|
+
width: 100%;
|
|
220
|
+
height: 32px;
|
|
221
|
+
&.quick-dynamic-select-mul {
|
|
222
|
+
.ant-select-selection--multiple {
|
|
223
|
+
max-height: unset !important;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
.ant-select-selection--multiple {
|
|
227
|
+
position: relative;
|
|
228
|
+
max-height: 32px !important;
|
|
229
|
+
.quick-dynamic-select-span {
|
|
230
|
+
position: absolute;
|
|
231
|
+
right: 2px;
|
|
232
|
+
top: 4px;
|
|
233
|
+
top: 50%;
|
|
234
|
+
right: 11px;
|
|
235
|
+
transform-origin: 50% 50%;
|
|
236
|
+
margin-top: -7px;
|
|
237
|
+
line-height: 1;
|
|
238
|
+
font-size: 12px;
|
|
239
|
+
color: rgba(0, 0, 0, 0.25);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.c-s-title-line {
|
|
246
|
+
font-weight: 700;
|
|
247
|
+
color: #000;
|
|
248
|
+
font-size: 14px;
|
|
249
|
+
}
|
|
250
|
+
.c-s-content-item {
|
|
251
|
+
padding: 0 5px;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.quick-dynamic-dropDown-container {
|
|
255
|
+
position: relative;
|
|
256
|
+
.ant-select-dropdown-menu {
|
|
257
|
+
&::-webkit-scrollbar {
|
|
258
|
+
width: 4px;
|
|
259
|
+
height: 6px;
|
|
260
|
+
background-color: #f2f2f2;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/*定义滚动条轨道 内阴影+圆角*/
|
|
264
|
+
&::-webkit-scrollbar-track {
|
|
265
|
+
border-radius: 10px;
|
|
266
|
+
background-color: #f2f2f2;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/*定义滑块 内阴影+圆角*/
|
|
270
|
+
&::-webkit-scrollbar-thumb {
|
|
271
|
+
border-radius: 10px;
|
|
272
|
+
background-color: #dbdcdc;
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
&.quick-dynamic-dropDown-container-hasTitle {
|
|
276
|
+
padding-top: 32px;
|
|
277
|
+
}
|
|
278
|
+
.quick-dynamic-select-title {
|
|
279
|
+
position: absolute;
|
|
280
|
+
top: 0;
|
|
281
|
+
width: 100%;
|
|
282
|
+
padding: 5px 12px;
|
|
283
|
+
display: table;
|
|
284
|
+
table-layout: fixed;
|
|
285
|
+
color: #212121;
|
|
286
|
+
font-weight: 700;
|
|
287
|
+
font-size: 14px;
|
|
288
|
+
> span {
|
|
289
|
+
display: table-cell;
|
|
290
|
+
overflow-wrap: break-word;
|
|
291
|
+
word-break: break-word;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
.quick-dynamic-select-item {
|
|
295
|
+
display: flex;
|
|
296
|
+
> span {
|
|
297
|
+
flex: 1;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
.ant-select-dropdown-menu-item-disabled {
|
|
301
|
+
min-height: 42px;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import CheckboxGroup from './CheckboxGroup.vue';
|
|
2
2
|
import Select from './Select.vue';
|
|
3
|
+
import NumberRange from './NumberRange.vue';
|
|
4
|
+
import DateRangeQuick from './DateRangeQuick.vue';
|
|
5
|
+
import SelectDynamic from './SelectDynamic.vue';
|
|
3
6
|
|
|
4
|
-
export {
|
|
5
|
-
CheckboxGroup,
|
|
6
|
-
Select
|
|
7
|
-
}
|
|
7
|
+
export { CheckboxGroup, Select, NumberRange, DateRangeQuick, SelectDynamic };
|