cnhis-design-vue 2.1.68 → 2.1.69
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 +28 -5
- 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 +68 -68
- 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 +1636 -644
- 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 +27 -27
- package/es/select/index.js +12 -12
- package/es/select-label/index.js +11 -11
- 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 +1301 -295
- 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 +19296 -1104
- package/lib/cui.umd.js +19296 -1104
- package/lib/cui.umd.min.js +155 -147
- package/package.json +1 -1
- package/packages/table-filter/src/base-search-com/BaseSearch.vue +60 -12
- package/packages/table-filter/src/classification/Classification-com.vue +5 -1
- package/packages/table-filter/src/components/c-tree-select/tree-select.vue +1 -1
- package/packages/table-filter/src/components/multi-select/multi-select.vue +1 -1
- package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +2 -2
- package/packages/table-filter/src/components/render-widget/components/CheckboxGroup.vue +52 -0
- package/packages/table-filter/src/components/render-widget/components/Select.vue +51 -0
- package/packages/table-filter/src/components/render-widget/components/index.js +7 -0
- package/packages/table-filter/src/components/render-widget/enums.js +29 -0
- package/packages/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +68 -0
- package/packages/table-filter/src/components/render-widget/index.vue +92 -0
- package/packages/table-filter/src/components/render-widget/widgetCfgMaps.js +140 -0
- package/packages/table-filter/src/components/search-modal/set-classification.vue +48 -22
- package/packages/table-filter/src/components/table-modal/TableModal.vue +6 -2
- package/packages/table-filter/src/const/dataOptions.js +8 -8
- package/packages/table-filter/src/mixins/mixins.js +24 -4
- package/packages/table-filter/src/mixins/renderWidget.js +89 -0
- package/packages/table-filter/src/mixins/tableSearchCon.js +4 -4
- package/packages/table-filter/src/quick-search/QuickSearch.vue +42 -10
package/package.json
CHANGED
|
@@ -47,13 +47,16 @@
|
|
|
47
47
|
<slot name="classification"></slot>
|
|
48
48
|
<li v-if="showQuickSearch" ref="quickSearchLi">
|
|
49
49
|
<a-button class="search-default" type="default" @click="foldQuickSearch">
|
|
50
|
-
<svg-icon icon-class="anniushaixuan" style="color:
|
|
50
|
+
<svg-icon icon-class="anniushaixuan" style="color: inherit; margin-right: 6px"></svg-icon>
|
|
51
51
|
筛选 {{ qqConObjCount ? `(${qqConObjCount})` : '' }}
|
|
52
52
|
</a-button>
|
|
53
53
|
</li>
|
|
54
54
|
<!-- start--筛选外显--start -->
|
|
55
55
|
<template v-for="item in outSearchFieldList">
|
|
56
|
-
<
|
|
56
|
+
<li class="outQuickSearch-li" v-if="item.isRender" :key="item._frontId">
|
|
57
|
+
<RenderWidget style="margin: 0 8px 8px 0" :cfg="item" v-model="item.value" @outFilterChange="outFilterChange" />
|
|
58
|
+
</li>
|
|
59
|
+
<outQuickSearch v-else :key="item.id + item.random_key" :item="item" :ref="item.columnName + item.random_key" :filterApiConfig="filterApiConfigOutSearch" @outFilterChange="outFilterChange"></outQuickSearch>
|
|
57
60
|
</template>
|
|
58
61
|
<!-- end--筛选外显--end -->
|
|
59
62
|
|
|
@@ -65,7 +68,7 @@
|
|
|
65
68
|
</template>
|
|
66
69
|
<!-- end--筛选外显 跨表--end -->
|
|
67
70
|
|
|
68
|
-
<li v-if="
|
|
71
|
+
<li v-if="isShowInputSearch" ref="inputSearchLi" class="baseSearch-input-search">
|
|
69
72
|
<template v-if="outSearchFieldList && outSearchFieldList.length">
|
|
70
73
|
<slot name="searchInput" :width="(searchInputWidth || inputSearchW)" :searchPlaceHolder="searchPlaceHolder" :showPlaceholderPrefix="showPlaceholderPrefix" :type="'outSearch'">
|
|
71
74
|
<a-input
|
|
@@ -116,6 +119,13 @@
|
|
|
116
119
|
查询
|
|
117
120
|
</a-button>
|
|
118
121
|
</li>
|
|
122
|
+
<!-- 无外显字段查询,且隐藏模糊搜索 -->
|
|
123
|
+
<li v-if="showApiSearch">
|
|
124
|
+
<a-button type="primary" @click="apiSearch" style="margin: 0 8px 8px 0">
|
|
125
|
+
<a-icon type="search" style="margin-right: 6px" />
|
|
126
|
+
查询
|
|
127
|
+
</a-button>
|
|
128
|
+
</li>
|
|
119
129
|
<li v-if="showResetFilterBtn">
|
|
120
130
|
<a-button @click="handleReset" style="margin: 0 8px 8px 0">
|
|
121
131
|
<svg-icon icon-class="xitongtubiaoliebiaocaozuoanniushanchu" style="margin-right: 6px"></svg-icon>
|
|
@@ -390,7 +400,7 @@
|
|
|
390
400
|
import moment from 'moment';
|
|
391
401
|
import 'moment/locale/zh-cn';
|
|
392
402
|
|
|
393
|
-
import
|
|
403
|
+
import _ from 'lodash';
|
|
394
404
|
import vexutils from '@/utils/vexutils';
|
|
395
405
|
import { Button, Icon, Dropdown, Select, Upload, DatePicker, Input, Menu } from 'ant-design-vue';
|
|
396
406
|
import resize from 'vue-resize-directive';
|
|
@@ -412,6 +422,8 @@ import preventReClick from '@/directive/preventReClick';
|
|
|
412
422
|
import getBtnIcon from '../components/button-icon/getBtnIcon.js';
|
|
413
423
|
import ButtonGroup from '../components/button-group/ButtonGroup.vue';
|
|
414
424
|
|
|
425
|
+
import RenderWidget from '../components/render-widget/index.vue';
|
|
426
|
+
|
|
415
427
|
const EVALUATEList = [
|
|
416
428
|
{
|
|
417
429
|
label: '一星',
|
|
@@ -465,6 +477,9 @@ export default create({
|
|
|
465
477
|
type: Number,
|
|
466
478
|
default: 0
|
|
467
479
|
},
|
|
480
|
+
searchInputPlaceHolder: {
|
|
481
|
+
type: String,
|
|
482
|
+
},
|
|
468
483
|
onSearch: Function,
|
|
469
484
|
rowBtnList: {
|
|
470
485
|
type: Array,
|
|
@@ -611,9 +626,13 @@ export default create({
|
|
|
611
626
|
default: 1000
|
|
612
627
|
},
|
|
613
628
|
isCardNewBatch: {type: Boolean, deafult: false},
|
|
614
|
-
isBatchSelect: {type: [Number, Boolean, String], default: ''}
|
|
629
|
+
isBatchSelect: {type: [Number, Boolean, String], default: ''},
|
|
630
|
+
isAvailableApiType: {type: Boolean, deafult: false},
|
|
631
|
+
apiSearch: Function,
|
|
632
|
+
tableDataType: String
|
|
615
633
|
},
|
|
616
634
|
components: {
|
|
635
|
+
RenderWidget,
|
|
617
636
|
[Button.name]: Button,
|
|
618
637
|
[Icon.name]: Icon,
|
|
619
638
|
[Dropdown.name]: Dropdown,
|
|
@@ -794,6 +813,8 @@ export default create({
|
|
|
794
813
|
};
|
|
795
814
|
},
|
|
796
815
|
searchPlaceHolder() {
|
|
816
|
+
if (this.searchInputPlaceHolder) return this.searchInputPlaceHolder;
|
|
817
|
+
|
|
797
818
|
if (!this.useFieldList?.length || this.showRelatedTreeBtn) return '请输入关键字搜索';
|
|
798
819
|
let str = '';
|
|
799
820
|
let strList = this.useFieldList
|
|
@@ -807,6 +828,9 @@ export default create({
|
|
|
807
828
|
return str || '请输入关键字搜索';
|
|
808
829
|
},
|
|
809
830
|
showRelatedSearch() {
|
|
831
|
+
// sql类型的列表, 且有筛选外显的时候不展示平铺列表的search
|
|
832
|
+
if (this.relatedSqlOutSearch) return false;
|
|
833
|
+
if (this.isAvailableApiType) return false;
|
|
810
834
|
return this.showRelatedTreeBtn && this.isShowSetting('hideSearch');
|
|
811
835
|
},
|
|
812
836
|
showQuickSearch() {
|
|
@@ -820,6 +844,18 @@ export default create({
|
|
|
820
844
|
},
|
|
821
845
|
isCard() {
|
|
822
846
|
return this.TypeOfDisplay === 'cardNew' && this.isBatchSelect == 1
|
|
847
|
+
},
|
|
848
|
+
showApiSearch(){
|
|
849
|
+
return !this.outSearchFieldList?.length && this.isAvailableApiType
|
|
850
|
+
},
|
|
851
|
+
// sql类型的列表, 且有筛选外显的时候不展示平铺列表的search
|
|
852
|
+
relatedSqlOutSearch() {
|
|
853
|
+
return this.tableDataType === 'SQL' && !!this.outSearchFieldList?.length
|
|
854
|
+
},
|
|
855
|
+
isShowInputSearch() {
|
|
856
|
+
if(!this.isShowSetting('hideSearch')) return false;
|
|
857
|
+
if(!this.showRelatedTreeBtn) return true;
|
|
858
|
+
return this.relatedSqlOutSearch;
|
|
823
859
|
}
|
|
824
860
|
},
|
|
825
861
|
data() {
|
|
@@ -1026,11 +1062,11 @@ export default create({
|
|
|
1026
1062
|
if (!this.validConObj(obj, this.searchFieldList, this.searchFieldLimit)) return false;
|
|
1027
1063
|
let copy = [];
|
|
1028
1064
|
if (this.outSearchFieldList.length) {
|
|
1029
|
-
copy = cloneDeep(this.outSearchFieldList, true);
|
|
1065
|
+
copy = _.cloneDeep(this.outSearchFieldList, true);
|
|
1030
1066
|
}
|
|
1031
1067
|
let copyRelation = [];
|
|
1032
1068
|
if (this.outRelationQuickSearch.length) {
|
|
1033
|
-
copyRelation = cloneDeep(this.outRelationQuickSearch, true);
|
|
1069
|
+
copyRelation = _.cloneDeep(this.outRelationQuickSearch, true);
|
|
1034
1070
|
}
|
|
1035
1071
|
this.$emit('onSave', obj, isOutFilter, copy, copyRelation, config);
|
|
1036
1072
|
this.modalVisible = false;
|
|
@@ -1476,7 +1512,7 @@ export default create({
|
|
|
1476
1512
|
if (!(btn.isShow == '1' && btn.type != 'LINK')) return;
|
|
1477
1513
|
btn.isHide = false;
|
|
1478
1514
|
btn.isButtonGroup = false;
|
|
1479
|
-
let cloneBtn = cloneDeep(btn);
|
|
1515
|
+
let cloneBtn = _.cloneDeep(btn);
|
|
1480
1516
|
this.setBtnStatus(cloneBtn);
|
|
1481
1517
|
// 按钮自适应 即使折叠也平铺显示出来
|
|
1482
1518
|
if (this.isShowSetting('buttonAdaption')) {
|
|
@@ -1758,14 +1794,20 @@ export default create({
|
|
|
1758
1794
|
this.handlerInitSearchItem(item.fieldList);
|
|
1759
1795
|
});
|
|
1760
1796
|
if (this.lastOutSearchFieldList.length > 0) {
|
|
1761
|
-
this.outSearchFieldList = cloneDeep(this.lastOutSearchFieldList);
|
|
1797
|
+
this.outSearchFieldList = _.cloneDeep(this.lastOutSearchFieldList);
|
|
1762
1798
|
}
|
|
1763
1799
|
if (this.lastOutRelationQuickSearch.length) {
|
|
1764
1800
|
this.outRelationQuickSearch = this.$utils.clone(this.lastOutRelationQuickSearch, true);
|
|
1765
1801
|
}
|
|
1766
1802
|
|
|
1767
1803
|
// 如有配置默认值
|
|
1768
|
-
|
|
1804
|
+
const isSetDefVal = this.outSearchFieldList.some(v => {
|
|
1805
|
+
if (this.isRender(v)) {
|
|
1806
|
+
return this.isExistDefValByRenderWidget(v);
|
|
1807
|
+
}
|
|
1808
|
+
return !!v.explicitDefaultVal
|
|
1809
|
+
});
|
|
1810
|
+
if (isSetDefVal) {
|
|
1769
1811
|
this.$emit('outSearchInit');
|
|
1770
1812
|
if ('reset' != config?.type) {
|
|
1771
1813
|
this.outFilterChange({ type: 'outSearchInit' });
|
|
@@ -1863,7 +1905,7 @@ export default create({
|
|
|
1863
1905
|
return paramsArray;
|
|
1864
1906
|
},
|
|
1865
1907
|
setPrintNumberToBtnList(printNumberList = [], btnList = []) {
|
|
1866
|
-
let cloneList = cloneDeep(btnList);
|
|
1908
|
+
let cloneList = _.cloneDeep(btnList);
|
|
1867
1909
|
|
|
1868
1910
|
printNumberList.forEach((item, index) => {
|
|
1869
1911
|
const i = cloneList.findIndex(v => v.settingObj[0].trigger_id == item.id);
|
|
@@ -2026,7 +2068,13 @@ export default create({
|
|
|
2026
2068
|
* 获取外显检索的默认值设置
|
|
2027
2069
|
*/
|
|
2028
2070
|
handleGetOutSearchInitValue() {
|
|
2029
|
-
|
|
2071
|
+
const isSetDefVal = this.outSearchFieldList.some(v => {
|
|
2072
|
+
if (this.isRender(v)) {
|
|
2073
|
+
return this.isExistDefValByRenderWidget(v);
|
|
2074
|
+
}
|
|
2075
|
+
return !!v.explicitDefaultVal
|
|
2076
|
+
});
|
|
2077
|
+
if (isSetDefVal) {
|
|
2030
2078
|
let conObj = this.getConObjParams() || [];
|
|
2031
2079
|
return conObj;
|
|
2032
2080
|
}
|
|
@@ -420,7 +420,11 @@
|
|
|
420
420
|
:tableId="tableId"
|
|
421
421
|
:classifyModal="classifyModal"
|
|
422
422
|
:filterApiConfig="filterApiConfig"
|
|
423
|
-
|
|
423
|
+
>
|
|
424
|
+
<template #searchCondition="{ attrs, listeners }">
|
|
425
|
+
<slot name="searchCondition" :attrs="attrs" :listeners="listeners"></slot>
|
|
426
|
+
</template>
|
|
427
|
+
</set-classification>
|
|
424
428
|
</div>
|
|
425
429
|
</template>
|
|
426
430
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
:allowClear="item.explicitRequired != 1"
|
|
16
16
|
treeNodeFilterProp="title"
|
|
17
17
|
ref="quickInputSelect"
|
|
18
|
-
:placeholder="`请选择${item.alias || item.title}`"
|
|
18
|
+
:placeholder="item.placeholder || `请选择${item.alias || item.title}`"
|
|
19
19
|
>
|
|
20
20
|
<a-icon slot="suffixIcon" type="smile" />
|
|
21
21
|
<span class="init-key-loading" v-if="key === '_init_key_'" slot="title" slot-scope="{ key, value }" style="color: #08c">
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<a-select
|
|
3
3
|
:mode="mode"
|
|
4
4
|
v-if="item.com == 'SelectMui'"
|
|
5
|
-
:placeholder="`请选择${item.alias || item.title}`"
|
|
5
|
+
:placeholder="item.placeholder || `请选择${item.alias || item.title}`"
|
|
6
6
|
:style="{width: `${item.advanceColWidth||160}px`}"
|
|
7
7
|
:dropdownMatchSelectWidth="false"
|
|
8
8
|
:maxTagCount="handleMaxTagCount(item)"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
margin: '0 8px 8px 0',
|
|
10
10
|
'font-family': item.PASSWORDTYPE ? 'text-security-disc' : 'inherit'
|
|
11
11
|
}"
|
|
12
|
-
:placeholder="`搜索${item.alias || item.title}`"
|
|
12
|
+
:placeholder="item.placeholder || `搜索${item.alias || item.title}`"
|
|
13
13
|
v-model="item.value"
|
|
14
14
|
allowClear
|
|
15
15
|
>
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
@change="outFilterChange"
|
|
56
56
|
@ok="outFilterChange"
|
|
57
57
|
v-model="item.value"
|
|
58
|
-
:placeholder="`请选择${item.alias || item.title}`"
|
|
58
|
+
:placeholder="item.placeholder || `请选择${item.alias || item.title}`"
|
|
59
59
|
v-if="item.com == 'DayPicker'"
|
|
60
60
|
style="margin: 0 8px 8px 0"
|
|
61
61
|
:showTime="false"
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<CheckboxGroup v-bind="$attrs" :value="valueCp" @change="onChange"></CheckboxGroup>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { Checkbox } from 'ant-design-vue';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
components: {
|
|
11
|
+
CheckboxGroup: Checkbox.Group,
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
value: {
|
|
15
|
+
type: [Array, String, Number],
|
|
16
|
+
},
|
|
17
|
+
multiple: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false,
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
model: {
|
|
23
|
+
prop: "value",
|
|
24
|
+
event: "update:value"
|
|
25
|
+
},
|
|
26
|
+
computed: {
|
|
27
|
+
valueCp: {
|
|
28
|
+
set(val) {
|
|
29
|
+
this.$emit("update:value", val);
|
|
30
|
+
},
|
|
31
|
+
get() {
|
|
32
|
+
return Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
methods: {
|
|
37
|
+
filterNewVal(val) {
|
|
38
|
+
return val.filter((v) => !this.valueCp.includes(v));
|
|
39
|
+
},
|
|
40
|
+
onChange(val) {
|
|
41
|
+
if (!this.multiple && Array.isArray(val)) {
|
|
42
|
+
this.valueCp = this.filterNewVal(val)[0];
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.valueCp = val;
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
</script>
|
|
51
|
+
<style lang='less'>
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Select v-bind="$attrs" v-on="$listeners" v-model="valueCp" :maxTagCount="maxTagCount" :maxTagPlaceholder="maxTagPlaceholder"></Select>
|
|
3
|
+
</template>
|
|
4
|
+
|
|
5
|
+
<script>
|
|
6
|
+
import { Select } from 'ant-design-vue';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
inheritAttrs: false,
|
|
10
|
+
components: {
|
|
11
|
+
Select,
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
value: {
|
|
15
|
+
type: [Array, String, Number],
|
|
16
|
+
},
|
|
17
|
+
componentCfg: {
|
|
18
|
+
type: Object
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
model: {
|
|
22
|
+
prop: "value",
|
|
23
|
+
event: "update:value"
|
|
24
|
+
},
|
|
25
|
+
computed: {
|
|
26
|
+
valueCp: {
|
|
27
|
+
set(val) {
|
|
28
|
+
this.$emit("update:value", val);
|
|
29
|
+
},
|
|
30
|
+
get() {
|
|
31
|
+
return this.value;
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
maxTagCount() {
|
|
35
|
+
if (!Array.isArray(this.value)) return undefined;
|
|
36
|
+
const len = this.value.length || 0;
|
|
37
|
+
return len > 1 ? 0 : 1;
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
methods: {
|
|
41
|
+
maxTagPlaceholder() {
|
|
42
|
+
if (!Array.isArray(this.value)) return undefined;
|
|
43
|
+
const { alias, title } = this.componentCfg;
|
|
44
|
+
const len = this.value.length || 0;
|
|
45
|
+
return this.value.length > 1 ? `已选${len}个${alias || title}` : "";
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
</script>
|
|
50
|
+
<style lang='less'>
|
|
51
|
+
</style>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export const WidgetTypeEnums = {
|
|
2
|
+
INPUT_NUMBER: "NUMBER",
|
|
3
|
+
INPUT: "TEXT",
|
|
4
|
+
SELECT: "SELECT",
|
|
5
|
+
DATE: "DATE",
|
|
6
|
+
DATE_TIME: "DATETIME",
|
|
7
|
+
CHECKBOX_GROUP: 'CHECKBOX_GROUP',
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const DatePresetValEnums = {
|
|
11
|
+
CUSTOM: "CUSTOM", // 自定义输入,特殊处理
|
|
12
|
+
|
|
13
|
+
NOW: "NOW",
|
|
14
|
+
TODAY: "TODAY",
|
|
15
|
+
TODAY_START: "TODAY_START",
|
|
16
|
+
TODAY_END: "TODAY_END",
|
|
17
|
+
TOMORROW: "TOMORROW",
|
|
18
|
+
TOMORROW_START: "TOMORROW_START",
|
|
19
|
+
TOMORROW_END: "TOMORROW_END",
|
|
20
|
+
YESTERDAY: "YESTERDAY",
|
|
21
|
+
YESTERDAY_START: "YESTERDAY_START",
|
|
22
|
+
YESTERDAY_END: "YESTERDAY_END",
|
|
23
|
+
|
|
24
|
+
WEEK_START: "THIS_WEEK_START",
|
|
25
|
+
WEEK_END: "THIS_WEEK_END",
|
|
26
|
+
|
|
27
|
+
MONTH_START: "THIS_MONTH_START",
|
|
28
|
+
MONTH_END: "THIS_MONTH_END",
|
|
29
|
+
};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { DatePresetValEnums } from '../enums';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
|
|
4
|
+
const Maps = new Map([
|
|
5
|
+
[
|
|
6
|
+
DatePresetValEnums.NOW,
|
|
7
|
+
() => moment(),
|
|
8
|
+
],
|
|
9
|
+
[
|
|
10
|
+
DatePresetValEnums.TODAY,
|
|
11
|
+
() => moment().startOf("day"),
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
DatePresetValEnums.TODAY_START,
|
|
15
|
+
() => moment().startOf("day")
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
DatePresetValEnums.TODAY_END,
|
|
19
|
+
() => moment().endOf("day")
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
DatePresetValEnums.TOMORROW,
|
|
23
|
+
() => moment().add(1, "days").startOf("day"),
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
DatePresetValEnums.TOMORROW_START,
|
|
27
|
+
() => moment().add(1, "days").startOf("day")
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
DatePresetValEnums.TOMORROW_END,
|
|
31
|
+
() => moment().add(1, "days").endOf("day")
|
|
32
|
+
],
|
|
33
|
+
[
|
|
34
|
+
DatePresetValEnums.YESTERDAY,
|
|
35
|
+
() => moment().subtract(1, "days").startOf("day"),
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
DatePresetValEnums.YESTERDAY_START,
|
|
39
|
+
() => moment().subtract(1, "days").startOf("day")
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
DatePresetValEnums.YESTERDAY_END,
|
|
43
|
+
() => moment().subtract(1, "days").endOf("day")
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
DatePresetValEnums.WEEK_START,
|
|
47
|
+
() => moment().startOf("week")
|
|
48
|
+
],
|
|
49
|
+
[
|
|
50
|
+
DatePresetValEnums.WEEK_END,
|
|
51
|
+
() => moment().endOf("week")
|
|
52
|
+
],
|
|
53
|
+
[
|
|
54
|
+
DatePresetValEnums.MONTH_START,
|
|
55
|
+
() => moment().startOf("month")
|
|
56
|
+
],
|
|
57
|
+
[
|
|
58
|
+
DatePresetValEnums.MONTH_END,
|
|
59
|
+
() => moment().endOf("month")
|
|
60
|
+
],
|
|
61
|
+
])
|
|
62
|
+
|
|
63
|
+
export const presetValToTimestamp = (presetVal, format = "x") => {
|
|
64
|
+
if (!Maps.has(presetVal)) return;
|
|
65
|
+
const fun = Maps.get(presetVal);
|
|
66
|
+
const val = fun().format(format);
|
|
67
|
+
return format === "x" || format === "X" ? Number(val) : val;
|
|
68
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
<script type="text/jsx">
|
|
2
|
+
import { WidgetTypeEnums } from './enums';
|
|
3
|
+
import { WidgetCfgMaps } from './widgetCfgMaps';
|
|
4
|
+
|
|
5
|
+
const UseSelfWidth = [WidgetTypeEnums.DATE, WidgetTypeEnums.DATE_TIME, WidgetTypeEnums.CHECKBOX_GROUP];
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
props: {
|
|
9
|
+
cfg: {
|
|
10
|
+
type: Object,
|
|
11
|
+
required: true,
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
model: {
|
|
15
|
+
event: "update:value",
|
|
16
|
+
prop: "value",
|
|
17
|
+
},
|
|
18
|
+
computed: {
|
|
19
|
+
valueCp: {
|
|
20
|
+
set(val) {
|
|
21
|
+
this.$emit("update:value", val);
|
|
22
|
+
},
|
|
23
|
+
get() {
|
|
24
|
+
return this.cfg.value;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
data() {
|
|
29
|
+
return {
|
|
30
|
+
initialProps: {},
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
methods: {
|
|
34
|
+
search() {
|
|
35
|
+
this.$emit("outFilterChange");
|
|
36
|
+
},
|
|
37
|
+
getEleWidth(cfg) {
|
|
38
|
+
const { widgetType } = cfg;
|
|
39
|
+
if (UseSelfWidth.includes(widgetType)) return;
|
|
40
|
+
return `${cfg.advanceColWidth||200}px`;
|
|
41
|
+
},
|
|
42
|
+
initComponentProps(cfg) {
|
|
43
|
+
const { widgetType, alias, title, placeholder: customPlaceholder, widgetCfg } = cfg;
|
|
44
|
+
const { props, handlerProps } = WidgetCfgMaps.get(widgetType);
|
|
45
|
+
let Props = { ...props };
|
|
46
|
+
if (handlerProps) {
|
|
47
|
+
Props = handlerProps(Props, { ...widgetCfg, title: alias || title });
|
|
48
|
+
}
|
|
49
|
+
if (customPlaceholder) {
|
|
50
|
+
Props.placeholder = customPlaceholder;
|
|
51
|
+
}
|
|
52
|
+
this.initialProps = Props;
|
|
53
|
+
if (Props.value) {
|
|
54
|
+
this.valueCp = Props.value;
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
generateWidget(cfg) {
|
|
58
|
+
const { widgetType } = cfg;
|
|
59
|
+
if (!WidgetCfgMaps.has(widgetType)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const { value } = cfg;
|
|
63
|
+
const { component, style, eventsBySearch = [] } = WidgetCfgMaps.get(widgetType);
|
|
64
|
+
const props = { ...this.initialProps, value };
|
|
65
|
+
|
|
66
|
+
const EventsBySearch = eventsBySearch.reduce((evts, item) => {
|
|
67
|
+
const { name, handler } = item;
|
|
68
|
+
let eventHandler = this.search;
|
|
69
|
+
if (handler) {
|
|
70
|
+
eventHandler = (e) => {
|
|
71
|
+
handler(e, this.search, props);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
...evts,
|
|
76
|
+
[name]: eventHandler,
|
|
77
|
+
};
|
|
78
|
+
}, {});
|
|
79
|
+
|
|
80
|
+
return <component style={{ width: this.getEleWidth(cfg), ...style }} attrs={{...props}} componentCfg={{...cfg}} on={{...EventsBySearch}} vModel={this.valueCp} />
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
created() {
|
|
84
|
+
this.initComponentProps(this.cfg);
|
|
85
|
+
},
|
|
86
|
+
render() {
|
|
87
|
+
return this.generateWidget(this.cfg);
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
</script>
|
|
91
|
+
<style lang='less' scoped>
|
|
92
|
+
</style>
|