cnhis-design-vue 2.1.66 → 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.
Files changed (124) hide show
  1. package/CHANGELOG.md +51 -2
  2. package/es/affix/index.js +8 -8
  3. package/es/age/index.js +10 -10
  4. package/es/alert/index.js +8 -8
  5. package/es/anchor/index.js +8 -8
  6. package/es/auto-complete/index.js +8 -8
  7. package/es/avatar/index.js +8 -8
  8. package/es/back-top/index.js +8 -8
  9. package/es/badge/index.js +8 -8
  10. package/es/base/index.js +8 -8
  11. package/es/big-table/index.js +244 -164
  12. package/es/big-table/style.css +1 -1
  13. package/es/breadcrumb/index.js +8 -8
  14. package/es/button/index.js +22 -22
  15. package/es/calendar/index.js +8 -8
  16. package/es/captcha/index.js +3 -3
  17. package/es/card/index.js +8 -8
  18. package/es/carousel/index.js +8 -8
  19. package/es/cascader/index.js +8 -8
  20. package/es/checkbox/index.js +9 -9
  21. package/es/col/index.js +8 -8
  22. package/es/collapse/index.js +8 -8
  23. package/es/color-picker/index.js +1 -1
  24. package/es/comment/index.js +8 -8
  25. package/es/config-provider/index.js +8 -8
  26. package/es/date-picker/index.js +8 -8
  27. package/es/descriptions/index.js +8 -8
  28. package/es/divider/index.js +8 -8
  29. package/es/drag-layout/index.js +3 -3
  30. package/es/drawer/index.js +8 -8
  31. package/es/dropdown/index.js +8 -8
  32. package/es/editor/index.js +1 -1
  33. package/es/ellipsis/index.js +1 -1
  34. package/es/empty/index.js +8 -8
  35. package/es/fabric-chart/index.js +368 -353
  36. package/es/form/index.js +8 -8
  37. package/es/form-model/index.js +8 -8
  38. package/es/form-table/index.js +66 -66
  39. package/es/index/index.js +2195 -1114
  40. package/es/index/style.css +1 -1
  41. package/es/input/index.js +9 -9
  42. package/es/input-number/index.js +8 -8
  43. package/es/layout/index.js +8 -8
  44. package/es/list/index.js +8 -8
  45. package/es/locale-provider/index.js +8 -8
  46. package/es/map/index.js +9 -9
  47. package/es/mentions/index.js +8 -8
  48. package/es/menu/index.js +8 -8
  49. package/es/message/index.js +8 -8
  50. package/es/multi-chat/index.js +76 -76
  51. package/es/multi-chat-client/index.js +70 -70
  52. package/es/multi-chat-history/index.js +4 -4
  53. package/es/multi-chat-record/index.js +14 -14
  54. package/es/multi-chat-setting/index.js +22 -22
  55. package/es/multi-chat-sip/index.js +1 -1
  56. package/es/notification/index.js +8 -8
  57. package/es/page-header/index.js +8 -8
  58. package/es/pagination/index.js +8 -8
  59. package/es/popconfirm/index.js +8 -8
  60. package/es/popover/index.js +8 -8
  61. package/es/progress/index.js +8 -8
  62. package/es/radio/index.js +9 -9
  63. package/es/rate/index.js +8 -8
  64. package/es/result/index.js +8 -8
  65. package/es/row/index.js +8 -8
  66. package/es/scale-container/index.js +1 -1
  67. package/es/scale-view/index.js +53 -53
  68. package/es/scale-view/style.css +1 -1
  69. package/es/select/index.js +12 -12
  70. package/es/select-label/index.js +11 -11
  71. package/es/select-person/index.js +2 -2
  72. package/es/shortcut-setter/index.js +10 -10
  73. package/es/skeleton/index.js +8 -8
  74. package/es/slider/index.js +8 -8
  75. package/es/space/index.js +8 -8
  76. package/es/spin/index.js +8 -8
  77. package/es/statistic/index.js +8 -8
  78. package/es/steps/index.js +8 -8
  79. package/es/switch/index.js +8 -8
  80. package/es/table-filter/index.js +1293 -293
  81. package/es/table-filter/style.css +1 -1
  82. package/es/tabs/index.js +8 -8
  83. package/es/tag/index.js +9 -9
  84. package/es/time-picker/index.js +8 -8
  85. package/es/timeline/index.js +8 -8
  86. package/es/tooltip/index.js +8 -8
  87. package/es/transfer/index.js +8 -8
  88. package/es/tree/index.js +8 -8
  89. package/es/tree-select/index.js +8 -8
  90. package/es/upload/index.js +8 -8
  91. package/es/verification-code/index.js +2 -2
  92. package/lib/cui.common.js +2286 -1215
  93. package/lib/cui.umd.js +2286 -1215
  94. package/lib/cui.umd.min.js +45 -45
  95. package/package.json +1 -1
  96. package/packages/big-table/src/BigTable.vue +23 -4
  97. package/packages/big-table/src/assets/style/table-base.less +2 -1
  98. package/packages/big-table/src/components/AutoLayoutButton.vue +59 -31
  99. package/packages/big-table/src/utils/eventBroadcast.js +24 -0
  100. package/packages/fabric-chart/src/fabric-chart/FabricLines.vue +128 -110
  101. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +27 -20
  102. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +9 -8
  103. package/packages/fabric-chart/src/mixins/eventCommon.js +4 -4
  104. package/packages/fabric-chart/src/mixins/fabricCommon.js +8 -22
  105. package/packages/scale-view/formitem/r-choice.vue +29 -14
  106. package/packages/table-filter/src/base-search-com/BaseSearch.vue +54 -6
  107. package/packages/table-filter/src/classification/Classification-com.vue +5 -1
  108. package/packages/table-filter/src/components/c-tree-select/tree-select.vue +1 -1
  109. package/packages/table-filter/src/components/multi-select/multi-select.vue +1 -1
  110. package/packages/table-filter/src/components/out-quick-search/out-quick-search.vue +2 -2
  111. package/packages/table-filter/src/components/render-widget/components/CheckboxGroup.vue +52 -0
  112. package/packages/table-filter/src/components/render-widget/components/Select.vue +51 -0
  113. package/packages/table-filter/src/components/render-widget/components/index.js +7 -0
  114. package/packages/table-filter/src/components/render-widget/enums.js +29 -0
  115. package/packages/table-filter/src/components/render-widget/helpers/presetValToTimestamp.js +68 -0
  116. package/packages/table-filter/src/components/render-widget/index.vue +92 -0
  117. package/packages/table-filter/src/components/render-widget/widgetCfgMaps.js +140 -0
  118. package/packages/table-filter/src/components/search-modal/set-classification.vue +48 -22
  119. package/packages/table-filter/src/components/table-modal/TableModal.vue +6 -2
  120. package/packages/table-filter/src/const/dataOptions.js +8 -8
  121. package/packages/table-filter/src/mixins/mixins.js +24 -4
  122. package/packages/table-filter/src/mixins/renderWidget.js +89 -0
  123. package/packages/table-filter/src/mixins/tableSearchCon.js +4 -4
  124. package/packages/table-filter/src/quick-search/QuickSearch.vue +46 -14
@@ -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>
@@ -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="conditionList"
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
- <SearchFilter
22
- ref="searchFilter"
23
- v-bind="$attrs"
24
- :visible="addVisible"
25
- @saveAdd="saveAdd"
26
- @cancelSaveAdd="cancelSaveAdd"
27
- :conditionList="conditionList"
28
- :actionList_prop="actionList_prop"
29
- :searchFieldList="newSearchFieldList"
30
- :isInSearch="true"
31
- :isCnHis="true"
32
- :showCompareField="true"
33
- :filterApiConfig="filterApiConfig"
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
- // conditionList: [],
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.conditionList.forEach(item => {
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.conditionList)
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.conditionList = data;
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: this.dataSource,
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: 'UP_WEEK', title: '1.1.4.42', name: '上周' },
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: 'UP_MONTH', title: '1.1.4.45', name: '上月' },
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: 'UP_SEASON', title: '1.1.4.48', name: '上季度' },
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: 'UP_YEAR', title: '1.1.4.51', name: '上年' }
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: 'UP_WEEK', title: '1.1.4.42', name: '上周' },
23
+ { con: 'LAST_WEEK', title: '1.1.4.42', name: '上周' },
24
24
  { con: 'THIS_MONTH', title: '1.1.4.43', name: '本月' },
25
- { con: 'UP_MONTH', title: '1.1.4.45', name: '上月' },
25
+ { con: 'LAST_MONTH', title: '1.1.4.45', name: '上月' },
26
26
  { con: 'THIS_SEASON', title: '1.1.4.46', name: '本季度' },
27
- { con: 'UP_SEASON', title: '1.1.4.48', name: '上季度' },
27
+ { con: 'LAST_SEASON', title: '1.1.4.48', name: '上季度' },
28
28
  { con: 'THIS_YEAR', title: '1.1.4.49', name: '本年' },
29
- { con: 'UP_YEAR', title: '1.1.4.51', name: '上年' }
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
- let i = df == 'firstOption' ? 0 : showSetting.findIndex(v => v.change_text == df);
417
- if(i > -1){
422
+ if (df == 'firstOption') {
423
+ tvalue = String(advanceOptionSetting) === '0' ? 0 : [0];
424
+ } else {
418
425
  if(String(advanceOptionSetting) === '0'){
419
- tvalue = i
426
+ // 单选
427
+ const index = showSetting.findIndex(v => v.change_text == df);
428
+ if (index > -1) tvalue = index;
420
429
  } else {
421
- tvalue.push(i)
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
- UP_WEEK: 7 / 30,
28
+ LAST_WEEK: 7 / 30,
29
29
  THIS_MONTH: 1,
30
30
  NEXT_MONTH: 1,
31
- UP_MONTH: 1,
31
+ LAST_MONTH: 1,
32
32
  THIS_SEASON: 3,
33
33
  NEXT_SEASON: 3,
34
- UP_SEASON: 3,
34
+ LAST_SEASON: 3,
35
35
  THIS_YEAR: 12,
36
36
  NEXT_YEAR: 12,
37
- UP_YEAR: 12
37
+ LAST_YEAR: 12
38
38
  };
39
39
  const unitToMonth = {
40
40
  HOUR: 1 / 24 / 30,