cnhis-design-vue 2.1.68 → 2.1.70
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 +39 -9
- package/es/age/index.js +2 -2
- package/es/big-table/index.js +51 -46
- package/es/big-table/style.css +1 -1
- package/es/button/index.js +2 -2
- package/es/captcha/index.js +3 -3
- package/es/checkbox/index.js +1 -1
- package/es/color-picker/index.js +1 -1
- package/es/drag-layout/index.js +3 -3
- package/es/editor/index.js +1 -1
- package/es/ellipsis/index.js +1 -1
- package/es/fabric-chart/index.js +9 -9
- package/es/form-table/index.js +20 -20
- package/es/index/index.js +1430 -433
- package/es/index/style.css +1 -1
- package/es/input/index.js +1 -1
- package/es/map/index.js +1 -1
- package/es/multi-chat/index.js +25 -25
- package/es/multi-chat-client/index.js +19 -19
- package/es/multi-chat-history/index.js +4 -4
- package/es/multi-chat-record/index.js +4 -4
- package/es/multi-chat-setting/index.js +20 -20
- package/es/multi-chat-sip/index.js +1 -1
- package/es/radio/index.js +1 -1
- package/es/scale-container/index.js +1 -1
- package/es/scale-view/index.js +27 -27
- package/es/select/index.js +4 -4
- package/es/select-label/index.js +3 -3
- package/es/select-person/index.js +2 -2
- package/es/shortcut-setter/index.js +2 -2
- package/es/table-filter/index.js +1275 -269
- package/es/table-filter/style.css +1 -1
- package/es/tag/index.js +1 -1
- package/es/verification-code/index.js +2 -2
- package/lib/cui.common.js +19267 -1070
- package/lib/cui.umd.js +19267 -1070
- package/lib/cui.umd.min.js +155 -147
- package/package.json +1 -1
- package/packages/big-table/src/BigTable.vue +1 -1
- package/packages/big-table/src/utils/bigTableProps.js +5 -0
- 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
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { WidgetTypeEnums, DatePresetValEnums } from './enums';
|
|
2
|
+
import { InputNumber, Input, DatePicker } from 'ant-design-vue';
|
|
3
|
+
import { CheckboxGroup, Select } from './components';
|
|
4
|
+
import moment from 'moment';
|
|
5
|
+
import { presetValToTimestamp } from './helpers/presetValToTimestamp';
|
|
6
|
+
|
|
7
|
+
const SetDefVal = (defaultValue) => defaultValue
|
|
8
|
+
|
|
9
|
+
export const WidgetCfgMaps = new Map([
|
|
10
|
+
[
|
|
11
|
+
WidgetTypeEnums.INPUT_NUMBER,
|
|
12
|
+
{
|
|
13
|
+
component: InputNumber,
|
|
14
|
+
props: {
|
|
15
|
+
allowClear: true,
|
|
16
|
+
},
|
|
17
|
+
eventsBySearch: [{
|
|
18
|
+
name: "keydown",
|
|
19
|
+
handler(e, search) {
|
|
20
|
+
if (e.key === 'Enter') {
|
|
21
|
+
search();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}],
|
|
25
|
+
handlerProps(props, { title } = {}) {
|
|
26
|
+
const Props = { ...props, placeholder: `输入${title}` };
|
|
27
|
+
return Props;
|
|
28
|
+
},
|
|
29
|
+
setDefaultValue: SetDefVal,
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
[
|
|
33
|
+
WidgetTypeEnums.INPUT,
|
|
34
|
+
{
|
|
35
|
+
component: Input,
|
|
36
|
+
props: {
|
|
37
|
+
allowClear: true,
|
|
38
|
+
},
|
|
39
|
+
eventsBySearch: [{
|
|
40
|
+
name: "keydown",
|
|
41
|
+
handler(e, search) {
|
|
42
|
+
if (e.key === 'Enter') {
|
|
43
|
+
search();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}],
|
|
47
|
+
handlerProps(props, { title } = {}) {
|
|
48
|
+
const Props = { ...props, placeholder: `搜索${title}` };
|
|
49
|
+
return Props;
|
|
50
|
+
},
|
|
51
|
+
setDefaultValue: SetDefVal,
|
|
52
|
+
}
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
WidgetTypeEnums.SELECT,
|
|
56
|
+
{
|
|
57
|
+
component: Select,
|
|
58
|
+
props: {
|
|
59
|
+
allowClear: true,
|
|
60
|
+
options: [],
|
|
61
|
+
showSearch: true,
|
|
62
|
+
mode: "default",
|
|
63
|
+
showArrow: true,
|
|
64
|
+
},
|
|
65
|
+
eventsBySearch: [{
|
|
66
|
+
name: "change",
|
|
67
|
+
handler(e, search, props) {
|
|
68
|
+
const { mode } = props;
|
|
69
|
+
if (mode !== 'multiple') {
|
|
70
|
+
search();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}],
|
|
74
|
+
handlerProps(props, { valueList, multiple, title } = {}) {
|
|
75
|
+
const Props = { ...props, placeholder: `请选择${title}` };
|
|
76
|
+
if (Array.isArray(valueList)) Props.options = valueList.map(({ value, label }) => ({ value, label }));
|
|
77
|
+
if (multiple) Props.mode = "multiple";
|
|
78
|
+
return Props;
|
|
79
|
+
},
|
|
80
|
+
setDefaultValue: SetDefVal,
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
WidgetTypeEnums.DATE,
|
|
85
|
+
{
|
|
86
|
+
component: DatePicker,
|
|
87
|
+
props: {
|
|
88
|
+
allowClear: true,
|
|
89
|
+
valueFormat: "YYYY-MM-DD HH:mm:ss"
|
|
90
|
+
},
|
|
91
|
+
handlerProps(props, { title } = {}) {
|
|
92
|
+
const Props = { ...props, placeholder: `请选择${title}` };
|
|
93
|
+
return Props;
|
|
94
|
+
},
|
|
95
|
+
setDefaultValue(defaultValue, defValueUnit) {
|
|
96
|
+
if (defValueUnit && defValueUnit !== DatePresetValEnums.CUSTOM) {
|
|
97
|
+
return presetValToTimestamp(defValueUnit, "YYYY-MM-DD HH:mm:ss");
|
|
98
|
+
}
|
|
99
|
+
return defaultValue;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
],
|
|
103
|
+
[
|
|
104
|
+
WidgetTypeEnums.DATE_TIME,
|
|
105
|
+
{
|
|
106
|
+
component: DatePicker,
|
|
107
|
+
props: {
|
|
108
|
+
allowClear: true,
|
|
109
|
+
valueFormat: "YYYY-MM-DD HH:mm:ss",
|
|
110
|
+
"show-time": { defaultValue: moment('00:00:00', 'HH:mm:ss') }
|
|
111
|
+
},
|
|
112
|
+
handlerProps(props, { title } = {}) {
|
|
113
|
+
const Props = { ...props, placeholder: `请选择${title}` };
|
|
114
|
+
return Props;
|
|
115
|
+
},
|
|
116
|
+
setDefaultValue(defaultValue, defValueUnit) {
|
|
117
|
+
if (defValueUnit && defValueUnit !== DatePresetValEnums.CUSTOM) {
|
|
118
|
+
return presetValToTimestamp(defValueUnit, "YYYY-MM-DD HH:mm:ss");
|
|
119
|
+
}
|
|
120
|
+
return defaultValue;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
[
|
|
125
|
+
WidgetTypeEnums.CHECKBOX_GROUP,
|
|
126
|
+
{
|
|
127
|
+
component: CheckboxGroup,
|
|
128
|
+
props: {},
|
|
129
|
+
style: {
|
|
130
|
+
"line-height": "32px"
|
|
131
|
+
},
|
|
132
|
+
handlerProps(props, { valueList, multiple } = {}) {
|
|
133
|
+
const Props = { ...props, multiple };
|
|
134
|
+
if (Array.isArray(valueList)) Props.options = valueList.map(({ value, label }) => ({ value, label }));
|
|
135
|
+
return Props;
|
|
136
|
+
},
|
|
137
|
+
setDefaultValue: SetDefVal,
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<div class="search">
|
|
3
3
|
<TableModal
|
|
4
4
|
v-bind="$attrs"
|
|
5
|
-
:dataSource="
|
|
5
|
+
:dataSource="curConditionList"
|
|
6
6
|
:visibleIn="oneVisible"
|
|
7
7
|
@handleOk="oneSave"
|
|
8
8
|
@close="oneCancel"
|
|
@@ -18,20 +18,26 @@
|
|
|
18
18
|
<a-button type="primary" @click="add">新增</a-button>
|
|
19
19
|
</template>
|
|
20
20
|
</TableModal>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
21
|
+
<slot
|
|
22
|
+
name="searchCondition"
|
|
23
|
+
:attrs="{ ...$attrs, visible: addVisible, loading: saveLoading, conditionList, actionList_prop, searchFieldList, isInSearch: true, isCnHis: true, showCompareField: true, filterApiConfig }"
|
|
24
|
+
:listeners="{ saveAdd, cancelSaveAdd }"
|
|
25
|
+
ref="searchFilter">
|
|
26
|
+
<SearchFilter
|
|
27
|
+
ref="searchFilter"
|
|
28
|
+
v-bind="$attrs"
|
|
29
|
+
:visible="addVisible"
|
|
30
|
+
@saveAdd="saveAdd"
|
|
31
|
+
@cancelSaveAdd="cancelSaveAdd"
|
|
32
|
+
:conditionList="curConditionList"
|
|
33
|
+
:actionList_prop="actionList_prop"
|
|
34
|
+
:searchFieldList="newSearchFieldList"
|
|
35
|
+
:isInSearch="true"
|
|
36
|
+
:isCnHis="true"
|
|
37
|
+
:showCompareField="true"
|
|
38
|
+
:filterApiConfig="filterApiConfig"
|
|
39
|
+
/>
|
|
40
|
+
</slot>
|
|
35
41
|
</div>
|
|
36
42
|
</template>
|
|
37
43
|
|
|
@@ -45,6 +51,7 @@ import { filterApiFn } from '~/table-filter/src/mixins/mixins';
|
|
|
45
51
|
import TableModal from '../table-modal/TableModal';
|
|
46
52
|
import SearchFilter from '../search-filter/SearchFilter';
|
|
47
53
|
import { Button } from 'ant-design-vue';
|
|
54
|
+
import vexutils from '@/utils/vexutils';
|
|
48
55
|
export default {
|
|
49
56
|
mixins: [filterApiFn],
|
|
50
57
|
name: 'set-classification',
|
|
@@ -77,11 +84,12 @@ export default {
|
|
|
77
84
|
searchName: this.searchDefName || '全部数据',
|
|
78
85
|
confirmLoading: false,
|
|
79
86
|
// oneVisible: false,
|
|
80
|
-
|
|
87
|
+
curConditionList: [],
|
|
81
88
|
addVisible: false,
|
|
82
89
|
actionList_prop: {},
|
|
83
90
|
selectKeys: [],
|
|
84
|
-
newSearchFieldList: []
|
|
91
|
+
newSearchFieldList: [],
|
|
92
|
+
saveLoading: false
|
|
85
93
|
};
|
|
86
94
|
},
|
|
87
95
|
computed: {
|
|
@@ -109,6 +117,17 @@ export default {
|
|
|
109
117
|
this.newSearchFieldList = val.filter(i => i.columnName !== 'operatorColumn');
|
|
110
118
|
}
|
|
111
119
|
}
|
|
120
|
+
},
|
|
121
|
+
addVisible: {
|
|
122
|
+
handler(val) {
|
|
123
|
+
if (!val) this.actionList_prop = {};
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
conditionList: {
|
|
127
|
+
immediate: true,
|
|
128
|
+
handler(value) {
|
|
129
|
+
this.curConditionList = vexutils.clone(value, true);
|
|
130
|
+
}
|
|
112
131
|
}
|
|
113
132
|
},
|
|
114
133
|
methods: {
|
|
@@ -151,7 +170,7 @@ export default {
|
|
|
151
170
|
},
|
|
152
171
|
oneCancel() {
|
|
153
172
|
this.setOneVisible(false);
|
|
154
|
-
this.
|
|
173
|
+
this.curConditionList.forEach(item => {
|
|
155
174
|
item.checked = false;
|
|
156
175
|
});
|
|
157
176
|
},
|
|
@@ -160,20 +179,25 @@ export default {
|
|
|
160
179
|
this.addVisible = true;
|
|
161
180
|
},
|
|
162
181
|
edit(item, name) {
|
|
163
|
-
this.addVisible = true;
|
|
164
182
|
this.actionList_prop = Object.assign(item, { from: 'edit' });
|
|
183
|
+
this.$nextTick(() => {
|
|
184
|
+
this.addVisible = true;
|
|
185
|
+
});
|
|
165
186
|
},
|
|
166
187
|
copy(item, name) {
|
|
167
|
-
this.addVisible = true;
|
|
168
188
|
this.actionList_prop = Object.assign(item, { from: 'copy' });
|
|
189
|
+
this.$nextTick(() => {
|
|
190
|
+
this.addVisible = true;
|
|
191
|
+
});
|
|
169
192
|
},
|
|
170
193
|
// 保存列表搜索分类
|
|
171
194
|
async saveAdd(params) {
|
|
172
195
|
try {
|
|
173
196
|
Object.assign(params, {
|
|
174
197
|
tableId: this.$attrs.tableId,
|
|
175
|
-
conditionList: JSON.stringify(this.
|
|
198
|
+
conditionList: JSON.stringify(this.curConditionList)
|
|
176
199
|
});
|
|
200
|
+
this.saveLoading = true;
|
|
177
201
|
// TODO:api
|
|
178
202
|
let res = await this.handleGetConfigApi(params, 'requestSaveTableCondiTion');
|
|
179
203
|
if (!res) return;
|
|
@@ -185,6 +209,8 @@ export default {
|
|
|
185
209
|
this.addVisible = false;
|
|
186
210
|
} catch (error) {
|
|
187
211
|
console.log(error);
|
|
212
|
+
} finally {
|
|
213
|
+
this.saveLoading = false;
|
|
188
214
|
}
|
|
189
215
|
},
|
|
190
216
|
cancelSaveAdd() {
|
|
@@ -192,7 +218,7 @@ export default {
|
|
|
192
218
|
this.actionList_prop = {};
|
|
193
219
|
},
|
|
194
220
|
changeData(data, checkedItem) {
|
|
195
|
-
this.
|
|
221
|
+
this.curConditionList = data;
|
|
196
222
|
this.checkedItem = checkedItem;
|
|
197
223
|
},
|
|
198
224
|
async delItem(checkedItem, name) {
|
|
@@ -142,6 +142,7 @@ import { Modal, Icon, Button, Tooltip, Switch, Popconfirm } from 'ant-design-vue
|
|
|
142
142
|
import { filterApiFn } from '~/table-filter/src/mixins/mixins';
|
|
143
143
|
import draggable from 'vuedraggable';
|
|
144
144
|
import svgIcon from '@/component/svg/index.vue';
|
|
145
|
+
import vexutils from '@/utils/vexutils';
|
|
145
146
|
export default {
|
|
146
147
|
mixins: [filterApiFn],
|
|
147
148
|
inject: { isShowResetButton: { from: 'root_isShowResetButton' } },
|
|
@@ -177,7 +178,7 @@ export default {
|
|
|
177
178
|
},
|
|
178
179
|
data() {
|
|
179
180
|
return {
|
|
180
|
-
homeList:
|
|
181
|
+
homeList: [],
|
|
181
182
|
visible: this.visibleIn,
|
|
182
183
|
isChangeWindow: false,
|
|
183
184
|
modalWidth: this.type == 'other' ? '100%' : '860px',
|
|
@@ -191,10 +192,13 @@ export default {
|
|
|
191
192
|
dataSource: {
|
|
192
193
|
deep: false,
|
|
193
194
|
handler(value) {
|
|
194
|
-
this.homeList = value;
|
|
195
|
+
this.homeList = vexutils.clone(value, true);
|
|
195
196
|
}
|
|
196
197
|
}
|
|
197
198
|
},
|
|
199
|
+
mounted(){
|
|
200
|
+
this.homeList = vexutils.clone(this.dataSource, true);
|
|
201
|
+
},
|
|
198
202
|
methods: {
|
|
199
203
|
/**
|
|
200
204
|
* 保存
|
|
@@ -5,28 +5,28 @@ export const dataOptions = {
|
|
|
5
5
|
{ con: 'YESTERDAY', title: '1.1.4.39', name: '昨天' },
|
|
6
6
|
{ con: 'THIS_WEEK', title: '1.1.4.40', name: '本周' },
|
|
7
7
|
{ con: 'NEXT_WEEK', title: '1.1.4.41', name: '下周' },
|
|
8
|
-
{ con: '
|
|
8
|
+
{ con: 'LAST_WEEK', title: '1.1.4.42', name: '上周' },
|
|
9
9
|
{ con: 'THIS_MONTH', title: '1.1.4.43', name: '本月' },
|
|
10
10
|
{ con: 'NEXT_MONTH', title: '1.1.4.44', name: '下月' },
|
|
11
|
-
{ con: '
|
|
11
|
+
{ con: 'LAST_MONTH', title: '1.1.4.45', name: '上月' },
|
|
12
12
|
{ con: 'THIS_SEASON', title: '1.1.4.46', name: '本季度' },
|
|
13
13
|
{ con: 'NEXT_SEASON', title: '1.1.4.47', name: '下季度' },
|
|
14
|
-
{ con: '
|
|
14
|
+
{ con: 'LAST_SEASON', title: '1.1.4.48', name: '上季度' },
|
|
15
15
|
{ con: 'THIS_YEAR', title: '1.1.4.49', name: '本年' },
|
|
16
16
|
{ con: 'NEXT_YEAR', title: '1.1.4.50', name: '下年' },
|
|
17
|
-
{ con: '
|
|
17
|
+
{ con: 'LAST_YEAR', title: '1.1.4.51', name: '上年' }
|
|
18
18
|
],
|
|
19
19
|
dateTeam2: [
|
|
20
20
|
{ con: 'TODAY', title: '1.1.4.37', name: '今天' },
|
|
21
21
|
{ con: 'YESTERDAY', title: '1.1.4.39', name: '昨天' },
|
|
22
22
|
{ con: 'THIS_WEEK', title: '1.1.4.40', name: '本周' },
|
|
23
|
-
{ con: '
|
|
23
|
+
{ con: 'LAST_WEEK', title: '1.1.4.42', name: '上周' },
|
|
24
24
|
{ con: 'THIS_MONTH', title: '1.1.4.43', name: '本月' },
|
|
25
|
-
{ con: '
|
|
25
|
+
{ con: 'LAST_MONTH', title: '1.1.4.45', name: '上月' },
|
|
26
26
|
{ con: 'THIS_SEASON', title: '1.1.4.46', name: '本季度' },
|
|
27
|
-
{ con: '
|
|
27
|
+
{ con: 'LAST_SEASON', title: '1.1.4.48', name: '上季度' },
|
|
28
28
|
{ con: 'THIS_YEAR', title: '1.1.4.49', name: '本年' },
|
|
29
|
-
{ con: '
|
|
29
|
+
{ con: 'LAST_YEAR', title: '1.1.4.51', name: '上年' }
|
|
30
30
|
],
|
|
31
31
|
dateTeam3: [
|
|
32
32
|
{ con: 'TODAY', title: '1.1.4.37', name: '今天' },
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import renderWidget from './renderWidget';
|
|
2
|
+
|
|
1
3
|
const DURATIONS = {
|
|
2
4
|
minute: '分钟',
|
|
3
5
|
hour: '小时',
|
|
@@ -390,10 +392,14 @@ export const $utils = {
|
|
|
390
392
|
|
|
391
393
|
// start--- 筛选外显 ---start
|
|
392
394
|
export const outQuickSearchFn = {
|
|
395
|
+
mixins: [renderWidget],
|
|
393
396
|
methods: {
|
|
394
397
|
handlerInitSearchItem(arr) {
|
|
395
398
|
if (!Array.isArray(arr)) return;
|
|
396
399
|
arr.forEach(el => {
|
|
400
|
+
// 直接渲染相应组件,不经过下面的字段判断
|
|
401
|
+
if (this.initRenderWidgetCfg(el)) return;
|
|
402
|
+
|
|
397
403
|
el.setting = typeof el.setting == "string" ? JSON.parse(el.setting) : el.setting;
|
|
398
404
|
const attr = el?.settingObj?.attr || "";
|
|
399
405
|
const isPreciseSearch = el?.settingObj?.isPreciseSearch || "";
|
|
@@ -413,12 +419,20 @@ export const outQuickSearchFn = {
|
|
|
413
419
|
// 设置了默认值
|
|
414
420
|
let df = el.explicitDefaultVal;
|
|
415
421
|
if(df){
|
|
416
|
-
|
|
417
|
-
|
|
422
|
+
if (df == 'firstOption') {
|
|
423
|
+
tvalue = String(advanceOptionSetting) === '0' ? 0 : [0];
|
|
424
|
+
} else {
|
|
418
425
|
if(String(advanceOptionSetting) === '0'){
|
|
419
|
-
|
|
426
|
+
// 单选
|
|
427
|
+
const index = showSetting.findIndex(v => v.change_text == df);
|
|
428
|
+
if (index > -1) tvalue = index;
|
|
420
429
|
} else {
|
|
421
|
-
|
|
430
|
+
// 多选 多默认值 处理
|
|
431
|
+
const dfs = df.split(',');
|
|
432
|
+
dfs.forEach((d) => {
|
|
433
|
+
const index = showSetting.findIndex(v => v.change_text == d);
|
|
434
|
+
if (index > -1) tvalue.push(index);
|
|
435
|
+
});
|
|
422
436
|
}
|
|
423
437
|
}
|
|
424
438
|
}
|
|
@@ -546,6 +560,12 @@ export const outQuickSearchFn = {
|
|
|
546
560
|
}
|
|
547
561
|
let conObj = [];
|
|
548
562
|
arr.forEach(item => {
|
|
563
|
+
const renderConObj = this.getRenderSearchConObj(item);
|
|
564
|
+
if (renderConObj) {
|
|
565
|
+
conObj.push(renderConObj);
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
|
|
549
569
|
let temp = {
|
|
550
570
|
field_key: item.columnName,
|
|
551
571
|
con: item.con,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { WidgetCfgMaps } from '../components/render-widget/widgetCfgMaps';
|
|
2
|
+
import { WidgetTypeEnums, DatePresetValEnums } from '../components/render-widget/enums';
|
|
3
|
+
|
|
4
|
+
function randomkey() {
|
|
5
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, c => {
|
|
6
|
+
const r = (Math.random() * 16) | 0;
|
|
7
|
+
const v = c === "x" ? r : (r & 0x3) | 0x8;
|
|
8
|
+
return v.toString(16);
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// 外层换行
|
|
13
|
+
const BlockEle = [WidgetTypeEnums.CHECKBOX_GROUP];
|
|
14
|
+
|
|
15
|
+
export default {
|
|
16
|
+
methods: {
|
|
17
|
+
isRender(cfg) {
|
|
18
|
+
return cfg.widgetCfg?.isRender;
|
|
19
|
+
},
|
|
20
|
+
getDefValByRenderWidget(cfg) {
|
|
21
|
+
const { widgetType, defaultValue, defValueUnit } = cfg.widgetCfg || {};
|
|
22
|
+
const Widget = WidgetCfgMaps.get(widgetType);
|
|
23
|
+
let defVal;
|
|
24
|
+
if (Widget) {
|
|
25
|
+
const { setDefaultValue } = Widget;
|
|
26
|
+
if (setDefaultValue) defVal = setDefaultValue(defaultValue, defValueUnit);
|
|
27
|
+
}
|
|
28
|
+
return defVal;
|
|
29
|
+
},
|
|
30
|
+
initRenderWidgetCfg(cfg) {
|
|
31
|
+
const isRender = this.isRender(cfg);
|
|
32
|
+
if (!isRender) return isRender;
|
|
33
|
+
|
|
34
|
+
const { widgetType } = cfg.widgetCfg || {};
|
|
35
|
+
|
|
36
|
+
this.$set(cfg, "_frontId", randomkey());
|
|
37
|
+
this.$set(cfg, "isRender", isRender);
|
|
38
|
+
this.$set(cfg, "widgetType", widgetType);
|
|
39
|
+
this.$set(cfg, "con", "EQ");
|
|
40
|
+
|
|
41
|
+
if (BlockEle.includes(widgetType)) this.$set(cfg, "_isBlock", true);
|
|
42
|
+
|
|
43
|
+
this.$set(cfg, 'value', this.getDefValByRenderWidget(cfg));
|
|
44
|
+
|
|
45
|
+
return isRender;
|
|
46
|
+
},
|
|
47
|
+
getRenderSearchConObj(cfg) {
|
|
48
|
+
const isRender = this.isRender(cfg);
|
|
49
|
+
if (!isRender) return null;
|
|
50
|
+
const { columnName, con, value, widgetType } = cfg;
|
|
51
|
+
|
|
52
|
+
let unit = null;
|
|
53
|
+
// 时间组件 unit 设置为自定义
|
|
54
|
+
const dateWidgetTypes = [WidgetTypeEnums.DATE, WidgetTypeEnums.DATE_TIME];
|
|
55
|
+
if (dateWidgetTypes.includes(widgetType)) {
|
|
56
|
+
unit = DatePresetValEnums.CUSTOM;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const val = Array.isArray(value) ? value : value ? [value] : [];
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
field_key: columnName,
|
|
63
|
+
con,
|
|
64
|
+
value: val.length > 0 ? val : null,
|
|
65
|
+
unit,
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
getDefValByRenderConObj(conObj, cfg) {
|
|
69
|
+
const isRender = this.isRender(cfg);
|
|
70
|
+
if (!isRender) return null;
|
|
71
|
+
const { widgetType, multiple } = cfg.widgetCfg || {};
|
|
72
|
+
const { value } = conObj;
|
|
73
|
+
if ((widgetType === WidgetTypeEnums.SELECT || widgetType === WidgetTypeEnums.CHECKBOX_GROUP) && multiple) {
|
|
74
|
+
return Array.isArray(value) ? value : value ? [value] : [];
|
|
75
|
+
}
|
|
76
|
+
return !Array.isArray(value) ? value : value[0];
|
|
77
|
+
},
|
|
78
|
+
isExistDefValByRenderWidget(cfg) {
|
|
79
|
+
const { defaultValue, defValueUnit } = cfg.widgetCfg || {};
|
|
80
|
+
return !!(defaultValue || defValueUnit);
|
|
81
|
+
},
|
|
82
|
+
resetRenderWidgetValue(cfg) {
|
|
83
|
+
const isRender = this.isRender(cfg);
|
|
84
|
+
if (!isRender) return isRender;
|
|
85
|
+
cfg.value = undefined;
|
|
86
|
+
return isRender;
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
}
|
|
@@ -25,16 +25,16 @@ export default {
|
|
|
25
25
|
YESTERDAY: 1 / 30,
|
|
26
26
|
THIS_WEEK: 7 / 30,
|
|
27
27
|
NEXT_WEEK: 7 / 30,
|
|
28
|
-
|
|
28
|
+
LAST_WEEK: 7 / 30,
|
|
29
29
|
THIS_MONTH: 1,
|
|
30
30
|
NEXT_MONTH: 1,
|
|
31
|
-
|
|
31
|
+
LAST_MONTH: 1,
|
|
32
32
|
THIS_SEASON: 3,
|
|
33
33
|
NEXT_SEASON: 3,
|
|
34
|
-
|
|
34
|
+
LAST_SEASON: 3,
|
|
35
35
|
THIS_YEAR: 12,
|
|
36
36
|
NEXT_YEAR: 12,
|
|
37
|
-
|
|
37
|
+
LAST_YEAR: 12
|
|
38
38
|
};
|
|
39
39
|
const unitToMonth = {
|
|
40
40
|
HOUR: 1 / 24 / 30,
|