cnhis-design-vue 2.1.18 → 2.1.21

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 (48) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/es/age/index.js +2 -2
  3. package/es/big-table/index.js +112 -134
  4. package/es/big-table/style.css +1 -1
  5. package/es/button/index.js +35 -38
  6. package/es/captcha/index.js +3 -3
  7. package/es/checkbox/index.js +1 -1
  8. package/es/color-picker/index.js +1 -1
  9. package/es/drag-layout/index.js +36 -39
  10. package/es/editor/index.js +11 -31
  11. package/es/fabric-chart/index.js +491 -393
  12. package/es/fabric-chart/style.css +1 -1
  13. package/es/form-table/index.js +62 -85
  14. package/es/index/index.js +971 -807
  15. package/es/index/style.css +1 -1
  16. package/es/input/index.js +1 -1
  17. package/es/map/index.js +1 -1
  18. package/es/multi-chat/index.js +210 -196
  19. package/es/multi-chat/style.css +1 -1
  20. package/es/multi-chat-client/index.js +203 -189
  21. package/es/multi-chat-client/style.css +1 -1
  22. package/es/multi-chat-history/index.js +37 -40
  23. package/es/multi-chat-record/index.js +37 -40
  24. package/es/multi-chat-setting/index.js +54 -57
  25. package/es/multi-chat-sip/index.js +1 -1
  26. package/es/radio/index.js +1 -1
  27. package/es/scale-view/index.js +70 -93
  28. package/es/select/index.js +36 -39
  29. package/es/select-label/index.js +47 -70
  30. package/es/select-person/index.js +35 -38
  31. package/es/table-filter/index.js +191 -186
  32. package/es/table-filter/style.css +1 -1
  33. package/es/tag/index.js +34 -37
  34. package/es/verification-code/index.js +2 -2
  35. package/lib/cui.common.js +1107 -939
  36. package/lib/cui.umd.js +1107 -939
  37. package/lib/cui.umd.min.js +79 -79
  38. package/package.json +2 -2
  39. package/packages/big-table/src/BigTable.vue +20 -19
  40. package/packages/fabric-chart/src/components/TimeScaleValue.vue +1 -5
  41. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +185 -90
  42. package/packages/fabric-chart/src/mixins/draw.js +70 -62
  43. package/packages/fabric-chart/src/mixins/eventCommon.js +9 -10
  44. package/packages/multi-chat/chat/chatFooter.vue +1 -5
  45. package/packages/multi-chat/chat/chatMain.vue +29 -5
  46. package/packages/table-filter/src/components/search-condition/SearchCondition.vue +1825 -1824
  47. package/packages/table-filter/src/const/dataOptions.js +10 -10
  48. package/packages/table-filter/src/quick-search/QuickSearch.vue +26 -0
@@ -1,1824 +1,1825 @@
1
- <template>
2
- <div :class="['SearchCondition-page', is_search_professional ? '_c_com-search-professional' : '']">
3
- <div class="inner-content">
4
- <div class="item-name" v-if="showItemName">
5
- <span class="label">筛选分类名称:</span>
6
- <!-- 1.1.6.6请输入分类名称 -->
7
- <a-input v-model="className" :placeholder="'请输入分类名称'" style="width: 250px" :maxLength="10" />
8
- </div>
9
- <div class="parent-names" v-if="showItemName">
10
- <!-- 1.9.362父类名称 -->
11
- <span class="label">{{ '父类名称' }}:</span>
12
- <div
13
- class="edit-tag"
14
- v-for="(item, index) in parentNames"
15
- :key="index"
16
- @dblclick="e => editParentName(e, item)"
17
- @click="handleParentNameSelect(item, index)"
18
- :class="{ 'edit-tag-select': item.selected && item.disabled }"
19
- >
20
- <a-input style="width: 100px" :value="item" :disabled="item.disabled" @blur="() => (item.disabled = true)" v-model="item.value" :maxLength="10" />
21
- <a-icon slot="suffix" type="close" @click="handleParentNamesRemove(index, item)" />
22
- </div>
23
- <template v-if="!parentNamesHasAdd">
24
- <a-button v-show="!showAdd" icon="plus" type="dashed" @click="handleParentNamesAdd">
25
- <!-- 1.9.363添加父类 -->
26
- {{ '添加父类' }}
27
- </a-button>
28
- <a-input class="edit-tag" v-model.trim="addVal" v-show="showAdd" style="width: 100px" @blur="hanldeBlur" :maxLength="10" />
29
- </template>
30
- </div>
31
- <div class="item-name" v-if="classify === 'custom' && !homeManage && !hideAddBtn">
32
- <span class="label" v-if="!isOnlyCondition"> 过滤条件: </span>
33
- <span @click="addAction" style="cursor: pointer">
34
- <a-icon type="plus-circle" class="blue" theme="filled" />
35
- <span>{{ isOnlyCondition ? '添加操作' : '添加' }}</span>
36
- </span>
37
- </div>
38
- <!-- 首页管理过滤条件支持选择分类 -->
39
- <div class="item-name" v-if="homeManage">
40
- <span class="label">选择筛选分类:</span>
41
- <a-select v-model="classify" style="width: 250px">
42
- <a-select-option :value="item.sid" v-for="item in classifyList" :key="item.sid">
43
- {{ item.name }}
44
- </a-select-option>
45
- <a-select-option value="custom"> 自定义 </a-select-option>
46
- </a-select>
47
- </div>
48
- <div class="item-name" v-if="classify === 'custom' && homeManage">
49
- <span class="label"> 过滤条件: </span>
50
- <span @click="addAction" style="cursor: pointer">
51
- <a-icon type="plus-circle" class="blue" theme="filled" />
52
- <span>添加</span>
53
- </span>
54
- </div>
55
- <ul class="item-list" v-if="classify === 'custom'" :class="{ 'list-onlyCondition': isOnlyCondition }">
56
- <li v-for="(item, index) in actionList" :key="index">
57
- <span class="index-span">{{ index + 1 }}&nbsp;&nbsp;&nbsp;</span>
58
- <!-- 选择 field_key -->
59
- <a-select
60
- class="form-item select-front-item"
61
- placeholder="请选择"
62
- allowClear
63
- v-model="item.field_key"
64
- :disabled="item.isIllegalField"
65
- showSearch
66
- :filterOption="filterOption"
67
- @select="changeColumnName($event, item)"
68
- @change="(...arg) => fieldselectONchange(item, 'changeColumnName', ...arg)"
69
- :dropdownMatchSelectWidth="false"
70
- >
71
- <a-select-option v-for="sea in item.searchList" :key="isBI ? sea.fieldId : sea.sid" :value="isBI ? sea.fieldId : sea.columnName" :title="sea.title || sea.columnName">{{
72
- handleName(sea)
73
- }}</a-select-option>
74
- </a-select>
75
- <!-- 选择 关系 -->
76
- <!-- 1.1.6.7请选择 -->
77
- <!-- 1.1.6.11暂无数据 -->
78
- <a-select
79
- v-model="item.con"
80
- showSearch
81
- :dropdownMatchSelectWidth="false"
82
- :filterOption="filterOption"
83
- :placeholder="'请选择'"
84
- class="form-item select-front-item"
85
- allowClear
86
- @select="selectChild($event, item)"
87
- @change="(...arg) => fieldselectONchange(item, 'selectChild', ...arg)"
88
- :disabled="item.isIllegalField"
89
- :notFoundContent="fetching ? undefined : '暂无数据'"
90
- >
91
- <a-select-option v-for="child in item.searchChildList" :key="child.name" :value="child.name" :title="child.desc">{{ child.desc }}</a-select-option>
92
- </a-select>
93
-
94
- <!-- 下拉框展示本列表相同数据类型 -->
95
- <a-select
96
- class="form-item"
97
- @select="compare_fieldOnChange($event, item)"
98
- v-show="visibleCompareField(item)"
99
- v-model="item.compare_field"
100
- showSearch
101
- :filterOption="filterOption"
102
- style="width: 120px"
103
- >
104
- <a-select-option v-for="date in item.selectList" :key="date.value" :value="date.value" :title="date.name">{{ date.name }}</a-select-option>
105
- </a-select>
106
-
107
- <div class="in-block def_item_input" :class="[item.showSelect ? 'show-small-select' : '']" v-show="visibleDefaultField(item)">
108
- <!-- 展示 -->
109
- <span v-show="item.showInput" class="val-input-wrap">
110
- <!-- 增加 showInput 插槽 支持自定义showInput 内容 -->
111
- <slot name="showInput" :item="item">
112
- <a-input-number :disabled="item.isIllegalField" v-if="showPercent(item)" class="CL-input" style="width: 200px" v-model="item.value" :min="0" :max="100" />
113
- <a-input v-else v-model="item.value" :disabled="item.isIllegalField" class="form-item" />
114
- </slot>
115
- </span>
116
- <a-select
117
- class="val-select-wrap"
118
- v-if="item.showSearch"
119
- v-model="item.wordValue"
120
- :disabled="item.isIllegalField"
121
- mode="multiple"
122
- :tokenSeparators="['|#|']"
123
- style="width: 160px"
124
- :filter-option="false"
125
- @dropdownVisibleChange="dropdownVisibleChange($event, item)"
126
- @search="e => handleSearch(e, item)"
127
- @select="handleSelect($event, item)"
128
- @deselect="handleDeSelect($event, item)"
129
- >
130
- <a-select-option v-for="sea in item.wordbookData" :key="item.sid + sea.myName" :value="sea.myName">
131
- {{ sea.showKeys || sea.myName }}
132
- </a-select-option>
133
- </a-select>
134
-
135
- <a-select v-show="item.showSelect" class="val-small-select-wrap" v-model="item.unit" showSearch :filterOption="filterOption" :disabled="item.isIllegalField" style="width: 66px">
136
- <a-select-option v-for="date in item.dateList" :key="date.value" :value="date.value" :title="date.name">{{ date.name }}</a-select-option>
137
- </a-select>
138
-
139
- <div class="date-item val-date-wrap" v-if="item.showDate">
140
- <a-date-picker
141
- :disabledDate="disabledStartDate || item.isIllegalField"
142
- format="YYYY-MM-DD"
143
- v-model="item.start_val"
144
- :placeholder="'请选择'"
145
- @openChange="handleStartOpenChange($event, item)"
146
- style="width: 120px"
147
- />
148
- <a-date-picker
149
- :disabledDate="disabledEndDate || item.isIllegalField"
150
- format="YYYY-MM-DD"
151
- :placeholder="'请选择'"
152
- v-model="item.end_val"
153
- :open="item.endOpen"
154
- @openChange="handleEndOpenChange($event, item)"
155
- style="width: 120px"
156
- />
157
- </div>
158
- <!-- 生日 -->
159
- <div class="date-item birthday-item val-birthday-wrap" v-if="item.showBirthdayDate">
160
- <div>
161
- <a-range-picker v-model="item.limit_date" :disabledDate="disabledDate || item.isIllegalField" @change="changeRange($event, item)" format="MM-DD" style="width: 180px" />
162
- <div class="age-wrap">
163
- <!-- 1.2.5.34年龄 -->
164
- <p>{{ '年龄' }}</p>
165
- <a-input :disabled="item.isIllegalField" style="width: 60px; margin-right: 10px" v-model="item.start_val" />
166
- <a-input :disabled="item.isIllegalField" style="width: 60px; margin-right: 10px" v-model="item.end_val" />
167
- <a-select :disabled="item.isIllegalField" v-model="item.unit" showSearch :filterOption="filterOption" defaultValue="YEAR" style="width: 60px">
168
- <a-select-option v-for="v in item.units" :key="v.con" :value="v.con">{{ v.title }}</a-select-option>
169
- </a-select>
170
- </div>
171
- </div>
172
- </div>
173
- <!-- 跨表 -->
174
-
175
- <div class="relation-item" v-show="item.showRelation">
176
- <a-select :disabled="item.isIllegalField" v-model="item.wordValue" showSearch :filterOption="filterOption" @select="handlerSelectRelation($event, item)" class="relation-width">
177
- <a-select-option v-for="word in item.relationData" :key="word.id" :value="word.tableId">{{ word.tableName }}</a-select-option>
178
- </a-select>
179
- <!-- 关联值 -->
180
- <a-input class="relation-width" disabled v-model="item.relationField" />
181
- <span class="relation-width blue relation-btn" @click="openRelationFilter(item, index)">
182
- <!-- 1.1.1.1.6点击设置过滤条件 -->
183
- {{ '点击设置过滤条件' }}</span
184
- >
185
- </div>
186
-
187
- <!-- 年龄 -->
188
- <!-- TODO:样式 -->
189
- <div v-if="item.showRangeAge" class="range-container val-range-wrap">
190
- <rangeAge
191
- :disabled="item.isIllegalField"
192
- :format="item.format"
193
- :defaultValue="{
194
- start_val: item.start_val,
195
- end_val: item.end_val
196
- }"
197
- @change="ageRangeOnChange($event, item)"
198
- ></rangeAge>
199
- </div>
200
- <div v-if="item.showAgeCom" class="range-container val-age-wrap">
201
- <age-com :disabled="item.isIllegalField" :format="item.format" @change="agecomOnChange($event, item)" :value="item.ageValue"></age-com>
202
- </div>
203
- </div>
204
- <!-- -->
205
- <span class="item-error" v-if="item.field_key && !searchListKey.includes(item.field_key)">检测到该筛选字段是非法无效的,请移除!</span>
206
- <!-- 1.1.1.3.3删除 -->
207
- <a-tooltip :title="'删除'" destroyTooltipOnHide>
208
- <svg-icon v-if="!isSee" v-show="noShowListDelIcon" @click="softDel(index)" class-name="svg-icon-btn is-danger form-action" icon-class="xitongtubiaoliebiaocaozuoanniushanchushixin" />
209
- </a-tooltip>
210
- </li>
211
- </ul>
212
- <div v-if="classify === 'custom' && !isOnlyCondition">
213
- <div style="margin-bottom: 6px" v-show="!is_search_professional">
214
- <!-- 筛选器逻辑编辑,不设置默认为AND1.2.4.9 -->
215
- {{ '筛选器逻辑编辑,不设置默认为AND' }} <br />
216
- 例子 (1 AND 2) OR 3
217
- </div>
218
- <div>
219
- <!-- 没啥用撑布局而已 -->
220
- <span v-if="is_search_professional" style="visibility: hidden;" class="index-span">{{ 1 }}&nbsp;&nbsp;&nbsp;</span>
221
-
222
- <a-input
223
- class="teavalue-wrap"
224
- v-model="teaValue"
225
- type="textarea"
226
- :placeholder="is_search_professional ? '筛选条件表达式,不设置默认为AND,例子(1 AND 2) OR 3' : ''"
227
- :rows="is_search_professional ? 1 : 3"
228
- />
229
- </div>
230
- </div>
231
- </div>
232
- <SearchFilter
233
- v-bind="$attrs"
234
- :visible="relationVisible"
235
- openType="relationTable"
236
- @saveAdd="relationSave"
237
- @cancelSaveAdd="relationCancel"
238
- :actionList_prop="relationAction"
239
- :searchFieldList="relationSearchFieldList"
240
- />
241
- </div>
242
- </template>
243
-
244
- <script>
245
- import moment from 'moment';
246
- import 'moment/locale/zh-cn';
247
- moment.locale('zh-cn');
248
- import rangeAge from '~/table-filter/src/components/range-age/index';
249
- import ageCom from '~/table-filter/src/components/age-com/index';
250
- import { Icon, Input, Button, InputNumber, Tooltip, Select, DatePicker, message } from 'ant-design-vue';
251
- import utils from '@/utils/utils-map';
252
- import FIELDTYPELIST from './fieldTypeList';
253
- import svgIcon from '@/component/svg/index.vue';
254
- import create from '@/core/create';
255
- import { filterApiFn } from '~/table-filter/src/mixins/mixins';
256
- export default create({
257
- name: 'search-condition',
258
- mixins: [filterApiFn],
259
- props: {
260
- isSee: Boolean,
261
- visible: Boolean,
262
- actionList_prop: Object,
263
- searchFieldList: {
264
- type: Array,
265
- default: () => []
266
- },
267
- showItemName: {
268
- default: true
269
- },
270
- saveEmpty: {
271
- default: false
272
- },
273
- // 首页管理
274
- homeManage: {
275
- default: false
276
- },
277
- tableId: {
278
- default: ''
279
- },
280
- isPersonalizedHome: {
281
- default: false
282
- },
283
- conditionList: {
284
- type: Array
285
- },
286
- source: {
287
- type: String
288
- },
289
- isBI: {
290
- default: false
291
- },
292
- // 自定义格式化 actionList 里的数据 (可搭配 slot插槽:showInput使用 )
293
- formatActionData: {
294
- type: Function,
295
- default: v => v
296
- },
297
- isOnlyCondition: Boolean,
298
- isCnHis: {
299
- // 2021/5/25 257针对云his做修改 只过滤搜索为禁用的条件 fjj需求
300
- type: Boolean,
301
- default: false
302
- },
303
- isAdmin: {
304
- type: Boolean,
305
- default: false
306
- },
307
-
308
- // 是否展示 CompareField
309
- showCompareField: {
310
- type: Boolean,
311
- default: false
312
- },
313
-
314
- hideAddBtn: {
315
- type: Boolean,
316
- default: false
317
- },
318
- openType: {
319
- type: String,
320
- default: ''
321
- }
322
- },
323
- data() {
324
- return {
325
- checkedItem: null,
326
- actionList: [],
327
- searchList: [],
328
- searchChildList: [],
329
- relationTableList: [], // 跨表
330
- isRelationList: [], // 跨表字段
331
- fieldTypeList: FIELDTYPELIST,
332
- dateList: [
333
- { name: '天', value: 'DAY' },
334
- { name: '周', value: 'WEEK' },
335
- { name: '月', value: 'MONTH' },
336
- { name: '季度', value: 'QUARTER' },
337
- { name: '年', value: 'YEAR' }
338
- ],
339
- dateTimeList: { name: '小时', value: 'HOUR' },
340
- relationSelect: [
341
- { desc: '存在跨表', name: 'QUOTE_IN' },
342
- { desc: '不存在跨表', name: 'QUOTE_NOTIN' }
343
- ],
344
- rangeAgeOptions: [
345
- { desc: '等于', name: 'IN' },
346
- { desc: '大于', name: 'BIG' },
347
- { desc: '大于等于', name: 'BIGEQ' },
348
- { desc: '小于', name: 'LESS' },
349
- { desc: '小于等于', name: 'LESSEQ' }
350
- ],
351
- start_val: null,
352
- end_val: null,
353
- className: '',
354
- teaValue: '',
355
- classifyId: '',
356
- // 跨表过滤
357
- relationVisible: false,
358
- relationAction: {},
359
- relationSearchFieldList: [],
360
- clcikRelationIndex: undefined,
361
- fetching: false,
362
- birthdayUnits: [
363
- { title: '天', units: 1, con: 'DAY' },
364
- { title: '周', units: 2, con: 'WEEK' },
365
- { title: '月', units: 1, con: 'MONTH' },
366
- { title: '岁', units: 1, con: 'YEAR' }
367
- ],
368
- limit_date: '',
369
- parentNames: [],
370
- // searchSelect
371
- searchItem: {},
372
- curWordbookData: undefined,
373
- curAutograph: '',
374
- classify: 'custom',
375
- classifyList: [],
376
- addVal: '',
377
- showAdd: false,
378
- birthdayFilter: ["BIG", "LESS", "BIGEQ", "LESSEQ", "IN_THE_PAST_DI", "IN_THE_FUTURE_DI"]
379
- };
380
- },
381
- computed: {
382
- parentNamesHasAdd() {
383
- return this.parentNames.some(v => v.isAdd);
384
- },
385
- showPercent() {
386
- return function(item) {
387
- return item.settingObj?.attr === 'PERCENTAGE' || false;
388
- };
389
- },
390
-
391
- searchListKey() {
392
- let res = [];
393
- this.searchList.forEach(v => {
394
- v.fieldId && res.push(v.fieldId);
395
- v.columnName && res.push(v.columnName);
396
- });
397
- return res;
398
- },
399
- // TODO:
400
- isOrgAdmin() {
401
- return this.isAdmin;
402
- },
403
- handleName() {
404
- return function(item, key = 'title') {
405
- let useKey = key;
406
- if (this.isBI) {
407
- useKey = 'remark';
408
- }
409
- return item.alias || item[useKey];
410
- };
411
- },
412
-
413
- is_search_professional() {
414
- return this.source == 'search-professional';
415
- },
416
-
417
- // 筛选分类“专业模式” 只有一条筛选数据,不可以删除。
418
- noShowListDelIcon() {
419
- let len = this?.actionList?.length || 0;
420
- return !(len === 1 && this.source == 'search-professional');
421
- }
422
- },
423
- // created() {
424
- // this.init();
425
- // },
426
- beforeCreate() {
427
- this.$options.components.SearchFilter = require('../search-filter/SearchFilter.vue').default;
428
- },
429
- components: {
430
- rangeAge,
431
- ageCom,
432
- [Icon.name]: Icon,
433
- [Input.name]: Input,
434
- [InputNumber.name]: InputNumber,
435
- [Button.name]: Button,
436
- [Select.name]: Select,
437
- [Select.Option.name]: Select.Option,
438
- [Tooltip.name]: Tooltip,
439
- [DatePicker.name]: DatePicker,
440
- [DatePicker.RangePicker.name]: DatePicker.RangePicker,
441
- svgIcon
442
- },
443
- watch: {
444
- searchFieldList: {
445
- immediate: true,
446
- deep: true,
447
- handler(val) {
448
- if (val && val.length > 0) {
449
- // 专业模式,刷新字段,不刷新设置的条件
450
- if (this.is_search_professional && this.initConditionsed) {
451
- return;
452
- }
453
- this.handleInitConditions();
454
- }
455
- }
456
- }
457
- },
458
- methods: {
459
- handleInitConditions() {
460
- if (this.homeManage) {
461
- this.getClassifyList();
462
- this.classify = this.actionList_prop.displayCategory || 'custom';
463
- if (this.actionList_prop.displayCategory) {
464
- this.actionList_prop.conObj = [];
465
- this.actionList_prop.preSqlExpression = '';
466
- }
467
- }
468
- let { relationTableList = [] } = this.$attrs;
469
- this.relationTableList = this.openType === 'relationTable' ? [] : relationTableList;
470
- this.init();
471
- this.backShow(this.actionList_prop);
472
- this.showItemName && this.getParentNames();
473
- this.initConditionsed = true;
474
- },
475
- async getClassifyList() {
476
- let params = { tableId: this.tableId };
477
- let res = await this.handleGetConfigApi(params, 'requestGetTableCondiTionList');
478
- if (res.status) {
479
- this.$emit('setConditionMap', res.data);
480
- this.classifyList = res?.data?.conditionList || [];
481
- }
482
- },
483
- getParentNames() {
484
- let parentNames = [];
485
- let displayCategoryList = this?.$attrs?.displayCategoryList || [];
486
- displayCategoryList.forEach(item => {
487
- if (item !== '未分类') {
488
- parentNames.push({
489
- disabled: true,
490
- selected: item === this.actionList_prop.displayCategory,
491
- value: item
492
- });
493
- }
494
- });
495
- this.parentNames = parentNames;
496
- },
497
- init(config = {}) {
498
- let mySearchFieldList = JSON.parse(JSON.stringify(this.searchFieldList)).filter(i => i.columnName !== 'operatorColumn' && i.isMerge != 1);
499
- if (mySearchFieldList && mySearchFieldList.length > 0) {
500
- if (this.isPersonalizedHome) {
501
- this.searchList = mySearchFieldList;
502
- } else {
503
- let searchList = mySearchFieldList
504
- .map(item => {
505
- let { settingObj = {} } = item;
506
- let notParticipatingSearch = false;
507
- if ('notParticipatingSearch' in settingObj) {
508
- notParticipatingSearch = settingObj.notParticipatingSearch != 1;
509
- } else {
510
- notParticipatingSearch = true;
511
- }
512
- const flag = this.isCnHis ? true : item.isSearch == 1 || item.isShowSearch == 1;
513
- if (flag && notParticipatingSearch) {
514
- return item;
515
- }
516
- return null;
517
- })
518
- .filter(Boolean);
519
- this.searchList = searchList;
520
- }
521
-
522
- if (this.searchList.length === 0) {
523
- return;
524
- }
525
-
526
- this.fieldTypeList.some(item => {
527
- if (this.searchList[0].fieldType == item.name) {
528
- this.$set(this, 'searchChildList', item.conList);
529
- return true;
530
- }
531
- });
532
- this.isRelationList = this.relationTableList.map(item => item.primaryField);
533
- this.actionList = [];
534
- this.className = '';
535
- this.teaValue = '';
536
-
537
- let isInitNoAdd = 'initNoAdd' == config?.type || '';
538
-
539
- if (isInitNoAdd) return;
540
-
541
- this.addAction();
542
- }
543
- },
544
- // 回显
545
- backShow(val) {
546
- if (!val || !Object.keys(val || {}).length) return;
547
- let obj = val;
548
- // 自定义菜单中 过滤 条件回显
549
- if (this.source === 'customMenuForm' && val.setting && utils.isJSON(val.setting)) {
550
- obj = JSON.parse(val.setting) || {};
551
- }
552
- if (!Object.keys(obj || {}).length) return;
553
- let relationFieldList = [];
554
- // this.className = obj.from == "edit" ? obj.name : "";
555
- this.className = obj.name;
556
- this.classifyId = obj.from == 'edit' ? obj.sid : '';
557
- this.teaValue = obj.sqlExpression;
558
- if (obj.conObj && !utils.isArray(obj.conObj)) {
559
- obj.conObj = JSON.parse(obj.conObj);
560
- }
561
- if (!obj.conObj || !obj.conObj.length) return;
562
- this.actionList = obj.conObj.map(item => {
563
- let curSet = this.searchList.find(v => (this.isBI ? v.fieldId : v.columnName) == item.field_key);
564
- if (curSet) {
565
- item.settingObj = curSet.settingObj;
566
- }
567
- if (item.con == 'CONVERT') {
568
- item.wordValue = item.value;
569
- } else if (item.con == 'QUOTE' || item.con == 'QUOTE_NOT') {
570
- item.wordValue = item.value.split('|#|');
571
- } else if (this.isRelationList.includes(item.field_key)) {
572
- item.wordValue = item.tableId;
573
- let curItem = this.relationTableList.find(v => v.tableId === item.tableId);
574
- if (curItem) {
575
- item.relationField = curItem.relationField;
576
- relationFieldList = JSON.parse(JSON.stringify(curItem.fieldList.fieldList) || []);
577
- }
578
- }
579
- let start_val = '';
580
- let end_val = '';
581
- let limit_date = [];
582
- let ageValue = {};
583
- if (item?.settingObj?.attr === 'PERCENTAGE') {
584
- if (item.value) {
585
- item.value = Number(item.value) * 100;
586
- }
587
- } else if (item && item.settingObj && item.settingObj.attr == 'BIRTHDAY') {
588
- start_val = item.start_val ? item.start_val : '';
589
- end_val = item.end_val ? item.end_val : '';
590
- if (item.limit_date) {
591
- let limitString = item.limit_date;
592
- if (Array.isArray(item.limit_date)) {
593
- let res = [];
594
- if (item.limit_date.length > 0) {
595
- item.limit_date.forEach(v => {
596
- v._d && res.push(utils.formatTime('MOUTH', v._d));
597
- });
598
- }
599
- if (res.length > 0) {
600
- item.curlimit_date = res.join('~');
601
- }
602
- } else if (utils.isString(limitString)) {
603
- let temp = [];
604
- item.curlimit_date = limitString;
605
- if (utils.isString(limitString)) {
606
- let res = limitString.split('~');
607
- if (res.length > 0) {
608
- for (let i = 0; i < res.length; i++) {
609
- temp.push(moment(res[i], 'MM-DD'));
610
- }
611
- limit_date = temp;
612
- }
613
- }
614
- }
615
- }
616
- } else if (item && item.settingObj && item.settingObj.attr == 'AGE') {
617
- this.$set(item, 'AGEAttr', true);
618
- start_val = item.start_val;
619
- end_val = item.end_val;
620
- ageValue = this.diffTime(item.value);
621
- // searchChildList
622
- // 大于(BIG),小于 LESS,大于等于BIGEQ,小于等于LESSEQ,等于(IN)
623
- } else {
624
- start_val = item.start_val ? moment(item.start_val, 'YYYY-MM-DD') : '';
625
- end_val = item.end_val ? moment(item.end_val, 'YYYY-MM-DD') : '';
626
- item.curlimit_date = '';
627
- }
628
-
629
- item.fieldType = item.fieldType || curSet?.fieldType;
630
-
631
- // 是否是自定义输入
632
- if (item.is_compare_field && this.showCompareField) {
633
- this.handleSetSelectList(item);
634
- }
635
- return {
636
- field_key: item.field_key,
637
- fieldId: item.field_key,
638
- fieldType: item.fieldType, // 字段类型
639
- con: item.con,
640
- unit: item.unit,
641
- start_val: start_val,
642
- end_val: end_val,
643
- limit_date: limit_date,
644
- curlimit_date: item.curlimit_date ? item.curlimit_date : '',
645
- searchList: this.searchList,
646
- searchChildList: this.searchChildList,
647
- dateList: this.dateList,
648
- wordValue: item.wordValue,
649
- word: item.wordValue,
650
- value: utils.isString(item.value) ? item.value : JSON.stringify(item.value),
651
- relationData: this.isRelationList.includes(item.field_key) ? [...this.relationTableList] : [],
652
- relationField: item.valueField || '',
653
- relationFieldList: relationFieldList || [],
654
- quote_con: item.quote_con || {},
655
- ageValue: ageValue || {},
656
-
657
- converFun: item.converFun || undefined,
658
- parameterConversionId: item.parameterConversionId || undefined,
659
- relationOrgId: item.relationOrgId || undefined,
660
- preConObj: item.preConObj || undefined,
661
- preSqlExpression: item.preSqlExpression || undefined,
662
- isIllegalField: this.isSee || (item.field_key && !this.searchListKey.includes(item.field_key)), // 非法字段
663
- wordbookValueList: item.wordbookValueList || [],
664
- wordbookData: [],
665
-
666
- is_compare_field: item.is_compare_field || false,
667
- selectList: item.selectList || [],
668
- customInput: false, // 自定义输入
669
- compare_field: item.compare_field // 选择的值
670
- };
671
- });
672
- this.actionList.forEach(item => {
673
- this.formatData(item.field_key, item);
674
- this.selectChild(item.con, item, true, { is_compare_field: item.is_compare_field });
675
- });
676
- },
677
- // 保存列表搜索分类
678
- saveAdd() {
679
- // 首页配置支持筛选分类
680
- if (this.homeManage && this.classify !== 'custom') {
681
- let classify = this.classifyList.find(item => item.sid === this.classify);
682
- let setting = {
683
- displayCategory: classify.sid,
684
- name: classify.name,
685
- sqlExpression: classify.sqlExpression,
686
- conObj: classify.conObj
687
- };
688
- let params = {
689
- id: classify.sid,
690
- tableId: this.tableId,
691
- setting: JSON.stringify(setting)
692
- };
693
- this.$emit('saveAdd', params);
694
- return;
695
- }
696
- if (this.homeManage && this.classify == 'custom') {
697
- this.actionList_prop.displayCategory = '';
698
- this.actionList_prop.name = '';
699
- }
700
- if (!this.className && this.showItemName) {
701
- // 1.1.7.3请输入搜索分类名称
702
- this.$message.warn(`请输入搜索分类名称!`, 2);
703
- return;
704
- }
705
- if (this.actionList && this.actionList.length > 0) {
706
- let conObj = this.getConditions();
707
-
708
- if (!conObj) {
709
- return;
710
- }
711
-
712
- if (this.isOnlyCondition) {
713
- this.$emit('saveAdd', conObj);
714
- return;
715
- }
716
- let displayCategory = this.parentNames.filter(item => item.selected)[0]?.value;
717
- let setting = {
718
- displayCategory,
719
- name: this.className, // 自定义名称
720
- sqlExpression: this.teaValue, // 文本域
721
- conObj
722
- };
723
- let params = {
724
- id: this.classifyId,
725
- tableId: this.tableId,
726
- setting: JSON.stringify(setting)
727
- };
728
- if (conObj.some(v => !v.con)) {
729
- return this.$message.warn('请完善筛选条件');
730
- }
731
- this.$emit('saveAdd', params);
732
- const { isInSearch } = this?.$attrs || {};
733
- // isInSearch = true,等待接口 /tableList/saveTableCondiTion 请求完成 再关闭弹窗。
734
- if (!isInSearch) {
735
- this.cancelSaveAdd(false);
736
- }
737
- } else {
738
- if (!this.saveEmpty) {
739
- // 1.1.6.18请设置搜索条件
740
- return this.$message.warn(`请设置搜索条件`, 2);
741
- }
742
- this.$emit('saveAdd', {
743
- setting: '{}'
744
- });
745
- this.cancelSaveAdd();
746
- }
747
- },
748
- getSqlExpression() {
749
- return this.teaValue;
750
- },
751
- getConditions() {
752
- let condition = [];
753
- for (let i = 0; i < this.actionList.length; i++) {
754
- let item = this.actionList[i];
755
- if (item.field_key && !this.searchListKey.includes(item.field_key)) {
756
- this.$message.error('检测到该筛选字段含有非法无效的,请移除!');
757
- return;
758
- }
759
- let attrType = item?.settingObj?.attr || '';
760
- let value = '';
761
- if (item.con == 'CONVERT') {
762
- value = item.wordValue.map(word => {
763
- return JSON.parse(word);
764
- });
765
- } else if (item.con == 'QUOTE' || item.con == 'QUOTE_NOT') {
766
- value = item.wordValue.join('|#|');
767
- } else {
768
- value = item.value;
769
- }
770
- let start_val = '';
771
- let end_val = '';
772
- let limit_date = [];
773
- if (item.settingObj && item.settingObj.attr == 'PERCENTAGE') {
774
- value = Number(value) / 100;
775
- } else if (item.settingObj && item.settingObj.attr == 'BIRTHDAY') {
776
- if (item.start_val) {
777
- let res = utils.validateBirthday(item.start_val, item.title, item.unit);
778
- if (!res) return;
779
- }
780
- if (item.end_val) {
781
- let res = utils.validateBirthday(item.end_val, item.title, item.unit);
782
- if (!res) return;
783
- }
784
- if (+item.start_val > +item.end_val) {
785
- // 1.9.47请输入有效范围
786
- this.$message.warning(`${item.title}请输入有效范围`, 2);
787
- return;
788
- }
789
- start_val = item.start_val ? item.start_val : '';
790
- end_val = item.end_val ? item.end_val : '';
791
-
792
- limit_date = item.curlimit_date ? item.curlimit_date : '';
793
- } else if (attrType == 'AGE') {
794
- start_val = item.start_val;
795
- end_val = item.end_val;
796
- value = item.value;
797
- } else {
798
- start_val = item.start_val ? item.start_val.format('YYYY-MM-DD') : '';
799
- end_val = item.end_val ? item.end_val.format('YYYY-MM-DD') : '';
800
- }
801
-
802
- let is_custom = this.showCompareField ? item.compare_field == '_custom__input_' : false;
803
-
804
- let temp = {
805
- field_key: item.field_key, // 一级value
806
- fieldId: item.field_key, // BI需要拿fieldId
807
- fieldType: item.fieldType, // 字段类型
808
- con: item.con, // 二级选择项value
809
- value: value, // input输入值
810
- start_val: start_val, // 开始时间
811
- end_val: end_val, // 结束时间
812
- unit: item.unit, // 选择时间单位
813
- limit_date: limit_date,
814
- tableId: (item.showRelation && item.wordValue) || undefined, // 关联表格ID
815
- valueField: item.relationField || undefined, // 关联字段
816
- quote_con: Object.keys(item.quote_con || {}).length ? item.quote_con : null, // 关联表格过滤项
817
- converFun: item.converFun || undefined,
818
- parameterConversionId: item.parameterConversionId || undefined,
819
- relationOrgId: item.relationOrgId || undefined,
820
- preConObj: item.preConObj || undefined,
821
- preSqlExpression: item.preSqlExpression || undefined,
822
- wordbookValueList: item.wordbookValueList,
823
- is_compare_field: is_custom ? false : item.is_compare_field, // 自定义输入的设为false
824
- compare_field: is_custom ? undefined : item.compare_field
825
- };
826
- condition.push(temp);
827
- }
828
- return [...condition];
829
- },
830
- // 第二层弹框添加分类按钮
831
- addAction(config = {}) {
832
- if (this.searchList.length === 0) {
833
- return message.warning('暂无字段可设置!');
834
- }
835
-
836
- // noDefault 不需要设置默认选中第一条数据
837
- // is_search_professional 专业模式 不需要默认选中第一条
838
- let noDefault = config?.noDefault || this.is_search_professional || false;
839
-
840
- let searchListDefaultItem = this.searchList[0];
841
- let searchListDefault = '',
842
- setting = {},
843
- settingObj = {};
844
-
845
- if (searchListDefaultItem) {
846
- searchListDefault = this.isBI ? searchListDefaultItem.fieldId : searchListDefaultItem.columnName;
847
- setting = searchListDefaultItem.setting;
848
- settingObj = searchListDefaultItem.settingObj;
849
- }
850
-
851
- if (noDefault) {
852
- searchListDefaultItem = {};
853
- searchListDefault = undefined;
854
- }
855
-
856
- this.actionList.push({
857
- field_key: searchListDefault,
858
- fieldId: searchListDefaultItem.fieldId,
859
- fieldType: searchListDefaultItem.fieldType, // 字段类型
860
- con: undefined,
861
- searchList: this.searchList,
862
- searchChildList: this.searchChildList,
863
- dateList: this.dateList,
864
- wordbookData: [],
865
- relationData: [...this.relationTableList],
866
- relationField: '',
867
- relationFieldList: [],
868
- quote_con: {},
869
- title: '',
870
- unit: 'YEAR',
871
- setting: setting,
872
- settingObj: settingObj,
873
- wordbookValueList: [],
874
- isIllegalField: this.isSee,
875
-
876
- is_compare_field: false,
877
- selectList: [],
878
- customInput: false, // 自定义输入
879
- compare_field: '' // 选择的值
880
- });
881
-
882
- if (noDefault) {
883
- return;
884
- }
885
-
886
- let actionInex = this.actionList.length - 1;
887
- this.changeColumnName(this.actionList[actionInex].field_key, this.actionList[actionInex]);
888
- },
889
- // 软删除
890
- softDel(index) {
891
- if (this.isSee) return;
892
- this.actionList.splice(index, 1);
893
- },
894
- cancelSaveAdd() {
895
- this.$emit('cancelSaveAdd');
896
- this.actionList = [];
897
- this.addVisible = false;
898
- this.showAdd = false;
899
- this.addVal = '';
900
- this.className = '';
901
- this.classifyId = '';
902
- this.teaValue = '';
903
- },
904
- // 第一个下拉框(1)根据不同类型,分别展示input select date
905
- changeColumnName(value, action) {
906
- action.con = undefined;
907
- let f = action.searchList.find(v => v.columnName == value);
908
- action.fieldType = f?.fieldType || undefined;
909
- this.$set(action, 'wordValue', []);
910
- this.$set(action, 'wordbookData', []);
911
- this.formatData(value, action);
912
- this.handleHideItem(action);
913
- this.handleHideCompareField(action);
914
- this.$set(action, 'isIllegalField', value && !this.searchListKey.includes(value));
915
- },
916
- // 数据处理
917
- formatData(value, action) {
918
- action.searchList.some(sea => {
919
- if ((this.isBI ? sea.fieldId : sea.columnName) == value) {
920
- action.fieldType = sea.fieldType;
921
-
922
- action.settingObj = sea.settingObj;
923
- let attrType = sea?.settingObj?.attr || '';
924
- let format = sea?.settingObj?.format || '';
925
- action.title = sea.title || '';
926
- if (sea.setting) {
927
- utils.isPlainObject(sea.setting) ? '' : (sea.setting = JSON.parse(sea.setting));
928
- if (!utils.isEmpty(sea.setting.wordbook)) {
929
- // 1.1.4.26引用
930
- // 1.2.5.52不引用
931
- action.searchChildList = [
932
- { desc: '引用', name: 'QUOTE' },
933
- { desc: '不引用', name: 'QUOTE_NOT' }
934
- ];
935
- let obj = {};
936
- if (sea.setting.wordbook.params) {
937
- sea.setting.wordbook.params.forEach(item => {
938
- obj[item.p_name] = item.p_value;
939
- });
940
- }
941
- this.$set(action, 'settingWordbook', {
942
- params: obj,
943
- id: sea.setting.wordbook.id
944
- });
945
- // this.getWordbookData(sea.setting.wordbook.id, obj).then(list => {
946
- // this.$set(action, "wordbookData", list);
947
- // });
948
- return true;
949
- } else if (sea.setting.showSetting && sea.setting.showSetting.length > 0) {
950
- // 1.1.4.27下拉选项
951
- action.searchChildList = [{ desc: '下拉选项', name: 'CONVERT' }];
952
- this.$set(action, 'wordValue', []);
953
- let showSetting = sea.setting.showSetting;
954
-
955
- // 字典推荐值
956
- let dictionItem = this.handleDictionDef(sea);
957
- if (dictionItem) {
958
- let { defaultValueTitle } = sea?.dictionarieObj || {};
959
- let hasDef = showSetting.find(item => item.change_text === defaultValueTitle);
960
- !hasDef && showSetting.unshift(dictionItem);
961
- }
962
- let wordbookData = showSetting.map((set, index) => {
963
- // 回显逻辑
964
- if (action.word) {
965
- utils.isString(action.word) ? (action.word = JSON.parse(action.word)) : '';
966
- let words = action.word.map(w => JSON.stringify(w));
967
- let filter = JSON.stringify(set.filter);
968
- if (words.includes(filter)) {
969
- action.wordValue.push(filter);
970
- }
971
- }
972
- return {
973
- name: set.change_text,
974
- showKeys: set.change_text,
975
- value: JSON.stringify(set.filter),
976
- myName: JSON.stringify(set.filter),
977
- id: (index + 9).toString(36) + index,
978
- sid: (index + 9).toString(36) + index
979
- };
980
- });
981
- action.wordbookData = wordbookData;
982
- return true;
983
- } else {
984
- let matchItem = this.fieldTypeList.find(item => sea.fieldType.toUpperCase() == item.name);
985
- let conList = this.searchChildList;
986
- if (matchItem) {
987
- // 关系 选项
988
- conList = matchItem.conList;
989
- }
990
- if (action?.settingObj?.attr === "BIRTHDAY") {
991
- conList = conList.filter(v => !this.birthdayFilter.includes(v.name)) || [];
992
- }
993
-
994
- action.searchChildList = conList;
995
- }
996
- // 通过 attr 判断类型,searchChildList
997
- if (attrType == 'AGE') {
998
- action.searchChildList = this.rangeAgeOptions;
999
- action.format = format.toUpperCase();
1000
- // action.ageValue = this.diffTime(action.value);
1001
- }
1002
- } else {
1003
- this.fieldTypeList.some(item => {
1004
- if (sea.fieldType == item.name) {
1005
- action.searchChildList = item.conList.filter(con => con.name != 'QUOTE' && con.name != 'CONVERT' && con.name != 'QUOTE_NOT');
1006
- return true;
1007
- }
1008
- });
1009
- }
1010
- // 跨表字段
1011
- if (this.isRelationList.includes(value) && !action.searchChildList.some(v => v.name == 'QUOTE_IN')) {
1012
- action.searchChildList.push(...this.relationSelect);
1013
- }
1014
- return true;
1015
- }
1016
- });
1017
- this.formatActionData(action);
1018
- },
1019
- // 字典推荐值 item处理
1020
- handleDictionDef(el) {
1021
- let { defaultValue, defaultValueTitle } = el?.dictionarieObj || {};
1022
- let dictionItem = null;
1023
- if (defaultValue && defaultValueTitle) {
1024
- dictionItem = {
1025
- change_text: defaultValueTitle,
1026
- filter: [
1027
- {
1028
- con: 'EQ',
1029
- field_key: el.columnName,
1030
- value: defaultValue
1031
- }
1032
- ]
1033
- };
1034
- }
1035
- return dictionItem;
1036
- },
1037
- getWordbookData(o, obj) {
1038
- let { id, filterKeys, wordbookType } = o;
1039
- let resFieldKeys = filterKeys && Array.isArray(filterKeys) ? JSON.stringify(filterKeys) : filterKeys;
1040
- let url = `/tableReader/getWordbookData`;
1041
- let params = {
1042
- wordbookId: id,
1043
- fieldKeys: resFieldKeys,
1044
- wordbookType: wordbookType || 'WORDBOOK',
1045
- ...obj
1046
- };
1047
- return this.handleGetConfigApi(params, 'requestGetWordbookData', { fields: o }).then(res => {
1048
- return res;
1049
- });
1050
- },
1051
- handleWordbookData(item, data) {
1052
- let { settingObj = {} } = item;
1053
- let { showKeys = [], defaultValue, defaultValueTitle } = settingObj.wordbook || {};
1054
- let defaultItem = null;
1055
- if (defaultValue && defaultValueTitle) {
1056
- defaultItem = {
1057
- myName: defaultValue,
1058
- showKeys: defaultValueTitle
1059
- };
1060
- }
1061
- if (data && data.result) {
1062
- // 数组赋值并添加唯一name
1063
- let wordbookData = data.map.rows.map(row => {
1064
- let showKeysStr = [];
1065
- showKeys.forEach(ren => {
1066
- showKeysStr.push(row[ren]);
1067
- });
1068
- return Object.assign(row, {
1069
- myName: String(row[item.settingObj.wordbook.field_key]),
1070
- showKeys: showKeysStr.join('')
1071
- });
1072
- });
1073
- // 数组对象去重
1074
- let obj = {};
1075
- wordbookData = wordbookData.reduce((cur, next) => {
1076
- obj[next.myName] ? '' : (obj[next.myName] = true && cur.push(next));
1077
- return cur;
1078
- }, []);
1079
- if (defaultItem) {
1080
- wordbookData.unshift(defaultItem);
1081
- }
1082
- this.$set(item, 'wordbookData', wordbookData);
1083
- }
1084
- },
1085
- dropdownVisibleChange(open, item) {
1086
- if (open) {
1087
- let obj = {};
1088
- if (item.settingObj?.wordbook?.params) {
1089
- item.settingObj.wordbook.params.forEach(item => {
1090
- obj[item.p_name] = item.p_value;
1091
- });
1092
- }
1093
- if (item.settingObj?.wordbook) {
1094
- obj.autograph = item.settingObj.wordbook.autograph;
1095
- }
1096
- this.curWordbookData = item.settingObj.wordbook;
1097
- this.curAutograph = item.settingObj.wordbook && item.settingObj.wordbook.autograph;
1098
- this.searchItem = item;
1099
- if (item.settingObj.showSetting && item.settingObj.showSetting.length) {
1100
- return;
1101
- }
1102
- this.getWordbookData(item.settingObj.wordbook, obj).then(({ data }) => {
1103
- this.handleWordbookData(item, data);
1104
- });
1105
- }
1106
- },
1107
- /**
1108
- * 输入自动联想
1109
- */
1110
- handleSearch(value, item) {
1111
- let params = {
1112
- keyword: value,
1113
- autograph: this.curAutograph
1114
- };
1115
- let obj = {};
1116
- if (item.settingObj?.wordbook?.params) {
1117
- item.settingObj.wordbook.params.forEach(item => {
1118
- obj[item.p_name] = item.p_value;
1119
- });
1120
- }
1121
- Object.assign(params, obj);
1122
-
1123
- this.getWordbookData(this.curWordbookData, params).then(({ data }) => {
1124
- this.handleWordbookData(this.searchItem, data);
1125
- });
1126
- },
1127
- handleSelect(value, item) {
1128
- let { wordbookData = [], wordbookValueList = [] } = item;
1129
- if (!wordbookData.length) return;
1130
- let matchItem = wordbookData.find(v => v.myName === value);
1131
- let hasItem = wordbookValueList.some(v => v.myName === value);
1132
- if (hasItem) return;
1133
- wordbookValueList.push(matchItem);
1134
- },
1135
- handleDeSelect(value, item) {
1136
- let { wordbookValueList = [] } = item;
1137
- let matchIndex = wordbookValueList.findIndex(v => v.myName === value);
1138
- if (matchIndex < 0) return;
1139
- wordbookValueList.splice(matchIndex, 1);
1140
- },
1141
-
1142
- selectChild(value, item, isInitSet, config = {}) {
1143
- let attr = item?.settingObj?.attr || '';
1144
- let arr = [
1145
- 'TODAY',
1146
- 'THIS_WEEK',
1147
- 'THIS_MONTH',
1148
- 'THIS_SEASON',
1149
- 'THIS_YEAR',
1150
- 'NULL',
1151
- 'NOT_NULL',
1152
- 'TOMORROW',
1153
- 'YESTERDAY',
1154
- 'NEXT_WEEK',
1155
- 'UP_WEEK',
1156
- 'NEXT_MONTH',
1157
- 'UP_MONTH',
1158
- 'NEXT_SEASON',
1159
- 'UP_SEASON',
1160
- 'NEXT_YEAR',
1161
- 'UP_YEAR'
1162
- ];
1163
- let ageList = ['BIG', 'BIGEQ', 'LESS', 'LESSEQ'];
1164
- // 自定义输入关系的“key”
1165
- const customTypes = ['EQ', 'IN', 'NEQ'];
1166
- const numbercustoms = ['EQ', 'NEQ', 'BIG', 'LESS', 'BIGEQ', 'LESSEQ'];
1167
-
1168
- item.showRangeAge = false; // 年龄范围
1169
- item.showAgeCom = false; // 年龄范围
1170
- let inRelation = ['QUOTE_IN', 'QUOTE_NOTIN'];
1171
- if (arr.includes(value)) {
1172
- item.showInput = false;
1173
- item.showSelect = false;
1174
- item.showDate = false;
1175
- item.showSearch = false;
1176
- item.showRelation = false;
1177
- this.initBirthdayParams(item);
1178
- } else if (['IN_THE_PAST', 'IN_THE_FUTURE', 'N_', 'L_', 'IN_THE_PAST_DI', 'IN_THE_FUTURE_DI'].includes(value)) {
1179
- // 以前、以后、过去内、未来内
1180
- // L_ N_ IN_THE_PAST IN_THE_FUTURE 添加小时
1181
- // 过去第 未来第
1182
- // IN_THE_PAST_DI IN_THE_FUTURE_DI
1183
- item.showSelect = true;
1184
- item.showInput = true;
1185
- item.showDate = false;
1186
- item.showSearch = false;
1187
- item.showRelation = false;
1188
- if (value == 'IN_THE_PAST_DI' || value == 'IN_THE_FUTURE_DI') {
1189
- this.$set(item, 'dateList', this.dateList);
1190
- } else {
1191
- let dateList = this.dateList.concat(this.dateTimeList);
1192
- this.$set(item, 'dateList', dateList);
1193
- }
1194
- if (!isInitSet) {
1195
- this.$set(item, 'unit', 'DAY');
1196
- }
1197
- this.initBirthdayParams(item);
1198
- } else if (value == 'IN') {
1199
- // field_key: "birthday"
1200
- if (attr == 'BIRTHDAY') {
1201
- item.showBirthdayDate = true;
1202
- item.showDate = false;
1203
- item.units = this.birthdayUnits.filter(i => i.units === 1);
1204
- } else if (attr == 'AGE') {
1205
- item.showRangeAge = true;
1206
- } else {
1207
- item.showDate = true;
1208
- this.initBirthdayParams(item);
1209
- }
1210
- item.showSelect = false;
1211
- item.showInput = false;
1212
- item.showSearch = false;
1213
- item.showRelation = false;
1214
- } else if (value == 'CONVERT' || value == 'QUOTE' || value == 'QUOTE_NOT') {
1215
- item.showDate = false;
1216
- item.showSelect = false;
1217
- item.showInput = false;
1218
- item.showSearch = true;
1219
- item.showRelation = false;
1220
- this.initBirthdayParams(item);
1221
- let showSetting = false;
1222
- if (item.settingObj?.showSetting?.length) {
1223
- showSetting = true;
1224
- }
1225
- // 这里wordbookValueList替换wordbookData 还是有点问题 需要根据具体场景再修改
1226
- if (!showSetting && item.wordbookValueList?.length) {
1227
- this.$set(item, 'wordbookData', item.wordbookValueList);
1228
- }
1229
- } else if (inRelation.includes(value)) {
1230
- // 跨表查询
1231
- item.showRelation = true;
1232
- item.showInput = false;
1233
- item.showSelect = false;
1234
- item.showDate = false;
1235
- item.showSearch = false;
1236
- this.initBirthdayParams(item);
1237
- } else if (attr == 'AGE') {
1238
- if (ageList.includes(value)) {
1239
- item.showAgeCom = true;
1240
- }
1241
- } else {
1242
- item.showSelect = false;
1243
- item.showDate = false;
1244
- if (item.settingObj && item.settingObj.attr == 'BIRTHDAY') {
1245
- item.showInput = false;
1246
- } else {
1247
- item.showInput = true;
1248
- }
1249
- item.showSearch = false;
1250
- item.showRelation = false;
1251
- this.initBirthdayParams(item);
1252
- }
1253
-
1254
- if (!this.showCompareField) return;
1255
-
1256
- let s_type = config?.type;
1257
- if (s_type === '_custom__input_') return;
1258
-
1259
- if (customTypes.includes(value) || (['NUMBER', 'DATE', 'DATETIME', 'TIME'].includes(item.fieldType) && numbercustoms.includes(value))) {
1260
- this.$set(item, 'is_compare_field', true);
1261
- this.$set(item, 'customInput', false);
1262
- this.handleSetSelectList(item);
1263
- if (Array.isArray(item.selectList)) {
1264
- // 默认选中第一
1265
- if (item.selectList.length > 1) {
1266
- let [a] = item.selectList;
1267
- this.$set(item, 'compare_field', a.value);
1268
- setTimeout(() => {
1269
- // 里面递归调用 selectChild ,异步等待,第一个方法执行完成
1270
- this.compare_fieldOnChange(a.value, item);
1271
- }, 100);
1272
- } else {
1273
- let selectList = item?.selectList || [];
1274
- let len = selectList?.length || 0;
1275
- let onlyCustomInput = len === 1 ? selectList[0].value === '_custom__input_' : false;
1276
- // selectList 只有一个选项并且 _custom__input_ ,隐藏 select ,展示 customInput
1277
- if (onlyCustomInput) {
1278
- this.$set(item, 'customInput', true);
1279
- item.compare_field = '_custom__input_';
1280
- return;
1281
- }
1282
- }
1283
- }
1284
-
1285
- if (isInitSet) {
1286
- // 如果是 is_compare_field 字段 并有值compare_field
1287
- if (config.is_compare_field && item.compare_field) {
1288
- this.$set(item, 'is_compare_field', true);
1289
- } else if (item.start_val || item.end_val || item.value || item.wordValue || item.showSelect) {
1290
- // 自定义输入回填
1291
- this.$set(item, 'customInput', true);
1292
- item.compare_field = '_custom__input_';
1293
- return;
1294
- }
1295
- }
1296
- this.handleHideItem(item, false);
1297
- } else {
1298
- item.customInput = true;
1299
- item.is_compare_field = false;
1300
- item['compare_field'] && (item['compare_field'] = undefined);
1301
- }
1302
- },
1303
- handleHideItem(item, reset = true) {
1304
- item.showRangeAge = false; // 年龄范围
1305
- item.showAgeCom = false; // 年龄范围
1306
- item.showInput = false;
1307
- item.showSelect = false;
1308
- item.showDate = false;
1309
- item.showSearch = false;
1310
- item.showRelation = false;
1311
-
1312
- // item.value = "";
1313
- // this.$set(item, 'value', '');
1314
- reset && this.$set(item, 'value', '');
1315
- },
1316
- disabledStartDate(start_val) {
1317
- const end_val = this.end_val;
1318
- if (!start_val || !end_val) {
1319
- return false;
1320
- }
1321
- return start_val.valueOf() > end_val.valueOf();
1322
- },
1323
- disabledEndDate(end_val) {
1324
- const start_val = this.start_val;
1325
- if (!end_val || !start_val) {
1326
- return false;
1327
- }
1328
- return start_val.valueOf() >= end_val.valueOf();
1329
- },
1330
- handleStartOpenChange(open, item) {
1331
- if (!open) {
1332
- this.$set(item, 'endOpen', true);
1333
- }
1334
- },
1335
- handleEndOpenChange(open, item) {
1336
- this.$set(item, 'endOpen', open);
1337
- },
1338
- // 日期选择范围
1339
- disabledDate(current) {
1340
- return (current && current < moment().startOf('year')) || current > moment().endOf('year');
1341
- },
1342
- changeRange(value, item) {
1343
- let res = [];
1344
- if (value.length > 0) {
1345
- value.forEach(item => {
1346
- item._d && res.push(utils.formatTime('MOUTH', item._d));
1347
- });
1348
- }
1349
- if (res.length > 0) {
1350
- item.curlimit_date = res.join('~');
1351
- }
1352
- },
1353
- // 选择关联表
1354
- handlerSelectRelation(e, item) {
1355
- let curItem = this.relationTableList.find(v => v.tableId === e);
1356
- curItem && (item.relationField = curItem.relationField);
1357
- item.relationFieldList = JSON.parse(JSON.stringify(curItem?.fieldList?.fieldList || []));
1358
- item.converFun = curItem.converFun || undefined;
1359
- item.parameterConversionId = curItem.parameterConversionId || undefined;
1360
- item.relationOrgId = curItem.relationOrgId || undefined;
1361
- item.preConObj = curItem.preConObj || undefined;
1362
- item.preSqlExpression = curItem.preSqlExpression || undefined;
1363
- },
1364
- openRelationFilter(data, i) {
1365
- this.clcikRelationIndex = i;
1366
- this.relationAction = data.quote_con;
1367
- this.relationSearchFieldList = data.relationFieldList;
1368
- this.relationVisible = true;
1369
- // sqlExpression
1370
- },
1371
- relationCancel() {
1372
- this.relationVisible = false;
1373
- this.relationAction = {};
1374
- this.relationSearchFieldList = [];
1375
- },
1376
- relationSave(data) {
1377
- let { setting = '' } = data;
1378
- let settingObj = JSON.parse(setting);
1379
- this.actionList[this.clcikRelationIndex].quote_con = {
1380
- conObj: settingObj.conObj,
1381
- sqlExpression: settingObj.sqlExpression
1382
- };
1383
- this.relationCancel();
1384
- },
1385
- initBirthdayParams(item) {
1386
- item.showBirthdayDate = false;
1387
- item.unit = item.unit || 'YEAR';
1388
- item.units = this.birthdayUnits.filter(i => i.units === 1);
1389
- },
1390
- handleParentNamesAdd(e) {
1391
- const nextInput = e?.target?.nextElementSibling;
1392
- setTimeout(() => {
1393
- nextInput && nextInput.focus();
1394
- });
1395
- this.showAdd = true;
1396
- },
1397
- hanldeBlur() {
1398
- this.showAdd = false;
1399
- if (!this.addVal) return;
1400
- this.parentNames.forEach(v => (v.selected = false));
1401
- this.parentNames.push({
1402
- disabled: true,
1403
- value: this.addVal,
1404
- selected: true,
1405
- isAdd: true
1406
- });
1407
- this.addVal = '';
1408
- },
1409
- editParentName(e, item) {
1410
- item.disabled = false;
1411
- setTimeout(() => {
1412
- e.target.focus();
1413
- }, 0);
1414
- },
1415
- handleParentNameSelect(item, index) {
1416
- if (!item.disabled) return;
1417
- this.parentNames.forEach((pItem, pIndex) => {
1418
- if (pIndex !== index) {
1419
- pItem.selected = false;
1420
- }
1421
- });
1422
- item.selected = !item.selected;
1423
- },
1424
- handleParentNamesRemove(index, item) {
1425
- // this.parentNames.splice(index, 1);
1426
- this.handleParent(index, item);
1427
- },
1428
- handleParent(index, item) {
1429
- let { conditionList } = this;
1430
- if (!conditionList || !conditionList.length) {
1431
- this.parentNames.splice(index, 1);
1432
- return;
1433
- }
1434
- let hasItem = conditionList.filter(v => v.displayCategory === item.value);
1435
- if (!hasItem || !hasItem.length) {
1436
- this.parentNames.splice(index, 1);
1437
- return;
1438
- }
1439
- this.$message.error('该分类下有已有数据,请删除该分类下的筛选集后重试!');
1440
- },
1441
- getParentSelectedStyle(item) {
1442
- if (item.selected && item.disabled) {
1443
- return {
1444
- backgroundColor: '#2D7AFF',
1445
- color: '#fff'
1446
- };
1447
- }
1448
- return null;
1449
- },
1450
-
1451
- // 年龄组件变化
1452
- ageRangeOnChange(obj, item) {
1453
- let s = obj.star_val;
1454
- let e = obj.end_val;
1455
- this.$set(item, 'start_val', isNaN(s) ? undefined : s);
1456
- this.$set(item, 'end_val', isNaN(e) ? undefined : e);
1457
- },
1458
-
1459
- agecomOnChange(obj, item) {
1460
- this.$set(item, 'value', isNaN(obj.days) ? undefined : obj.days);
1461
- },
1462
-
1463
- diffTime(days) {
1464
- let d = +days;
1465
- if (isNaN(d)) return {};
1466
- if (typeof d == 'number') {
1467
- let next = 0;
1468
- let year = Math.floor(d / 365);
1469
- next = d % 365;
1470
- let month = Math.floor(next / 30);
1471
- next = next % 30;
1472
- let day = next;
1473
-
1474
- return { year, month, day, d };
1475
- }
1476
- return {};
1477
- },
1478
-
1479
- filterOption(...arg) {
1480
- return utils.filterOption(...arg);
1481
- },
1482
-
1483
- /**
1484
- * 选中字段
1485
- */
1486
- handleSetSelectList(item) {
1487
- let list = this.searchList
1488
- .filter(v => v.fieldType == item.fieldType && (this.isBI ? v.fieldId : v.columnName) != item.field_key)
1489
- .map(v => {
1490
- return {
1491
- value: this.isBI ? v.fieldId : v.columnName,
1492
- name: v.alias || v.title
1493
- };
1494
- });
1495
-
1496
- list.unshift({
1497
- value: '_custom__input_',
1498
- name: '自定义输入'
1499
- });
1500
-
1501
- this.$set(item, 'selectList', list);
1502
- },
1503
-
1504
- /**
1505
- * 切换字段选项
1506
- */
1507
- compare_fieldOnChange(e, item) {
1508
- if (e === '_custom__input_') {
1509
- item.customInput = true;
1510
- this.selectChild(item.con, item, false, { type: '_custom__input_' });
1511
- } else {
1512
- item.customInput = false;
1513
- this.$set(item, 'value', '');
1514
- }
1515
- },
1516
-
1517
- checkCustomInput(item) {
1518
- /**
1519
- * 判断可选的 是否 只有 “_custom__input_”
1520
- */
1521
- let selectList = item?.selectList || [];
1522
- let len = selectList?.length || 0;
1523
- let onlyCustomInput = len === 1 ? selectList[0].value === '_custom__input_' : false;
1524
- return onlyCustomInput;
1525
- },
1526
-
1527
- visibleCompareField(item) {
1528
- if (!this.showCompareField) return false;
1529
- let onlyCustomInput = this.checkCustomInput(item);
1530
- /**
1531
- * 展示 compare_field 条件
1532
- * 1. 是is_compare_field 字段 并且有字段可选
1533
- */
1534
- return item.is_compare_field && !onlyCustomInput;
1535
- },
1536
-
1537
- visibleDefaultField(item) {
1538
- /**
1539
- * 展示默认字段的条件
1540
- * 1. 非 is_compare_field 字段
1541
- * 2. is_compare_field 字段,选中 自定义输入 is_compare_field
1542
- * 3. 是 is_compare_field 字段 ,没有可选的 onlyCustomInput
1543
- */
1544
- if (!this.showCompareField) return true;
1545
- let onlyCustomInput = this.checkCustomInput(item);
1546
- return item.customInput || !item.is_compare_field || onlyCustomInput;
1547
- },
1548
-
1549
- handleHideCompareField(item) {
1550
- if (!this.showCompareField) return;
1551
- item.customInput = false;
1552
- item.is_compare_field = false;
1553
- item.compare_field = undefined;
1554
- },
1555
-
1556
- checkActionList() {
1557
- let f = this.actionList.every(v => !v.field_key);
1558
- return f;
1559
- },
1560
-
1561
- /**
1562
- * select 变化
1563
- */
1564
- fieldselectONchange(item, eventName, value, vnode) {
1565
- // 清空操作
1566
- if (value === undefined) {
1567
- eventName === 'changeColumnName' && this.handleResetColumnName(item);
1568
- eventName === 'selectChild' && this.handleResetSelectChild(item);
1569
- }
1570
- },
1571
-
1572
- handleResetColumnName(item) {
1573
- item.con = undefined;
1574
- this.$set(item, 'wordValue', []);
1575
- this.$set(item, 'wordbookData', []);
1576
- this.handleHideItem(item);
1577
- },
1578
-
1579
- handleResetSelectChild(item) {
1580
- this.$set(item, 'wordValue', []);
1581
- this.$set(item, 'wordbookData', []);
1582
- this.$set(item, 'value', undefined);
1583
- this.$set(item, 'showSelect', undefined);
1584
- this.$set(item, 'start_val', null);
1585
- this.$set(item, 'end_val', null);
1586
- this.handleHideItem(item);
1587
- }
1588
- }
1589
- });
1590
- </script>
1591
-
1592
- <style lang="less" scoped>
1593
- .inner-content {
1594
- color: #000;
1595
- & > p > span {
1596
- cursor: pointer;
1597
- }
1598
- .item-name {
1599
- display: flex;
1600
- height: 32px;
1601
- line-height: 32px;
1602
- margin-bottom: 10px;
1603
- .label {
1604
- width: 120px;
1605
- text-align: right;
1606
- }
1607
- }
1608
- .parent-names {
1609
- display: flex;
1610
- align-items: center;
1611
- flex-wrap: wrap;
1612
- line-height: 32px;
1613
- .label {
1614
- display: inline-block;
1615
- height: 32px;
1616
- line-height: 32px;
1617
- margin-bottom: 10px;
1618
- width: 120px;
1619
- text-align: right;
1620
- }
1621
- /deep/ .ant-btn-dashed {
1622
- border-color: #a6a6a6;
1623
- color: #a6a6a6;
1624
- }
1625
-
1626
- .edit-tag {
1627
- position: relative;
1628
- margin-right: 10px;
1629
- margin-bottom: 10px;
1630
- /deep/ .anticon-close {
1631
- position: absolute;
1632
- right: 5px;
1633
- line-height: 36px;
1634
- color: #2d7aff;
1635
- }
1636
- /deep/ .ant-input-disabled {
1637
- color: #2d7aff;
1638
- background-color: rgba(45, 122, 255, 0.1);
1639
- opacity: 1;
1640
- border-color: #2d7aff;
1641
- cursor: pointer;
1642
- }
1643
- /deep/.ant-input-group-addon,
1644
- /deep/.ant-input:not(:hover),
1645
- /deep/.ant-input-number:not(:hover) {
1646
- border-color: #2d7aff !important;
1647
- }
1648
- &.edit-tag-select {
1649
- /deep/ .ant-input-disabled {
1650
- color: #fff;
1651
- background-color: #2d7aff;
1652
- }
1653
- /deep/ .anticon-close {
1654
- color: #fff;
1655
- }
1656
- }
1657
- }
1658
- /deep/ .ant-btn {
1659
- margin-bottom: 10px;
1660
- }
1661
- }
1662
- .item-list {
1663
- padding-top: 12px;
1664
- margin-top: 16px;
1665
- margin-bottom: 6px;
1666
- border-top: 1px solid #e6e6e6;
1667
- &.list-onlyCondition {
1668
- padding-top: 0;
1669
- border-top: 0px;
1670
- }
1671
- li {
1672
- margin-bottom: 10px;
1673
- }
1674
- .form-item {
1675
- width: 120px;
1676
- margin-right: 10px;
1677
- }
1678
- .form-action {
1679
- font-size: 16px;
1680
- float: right;
1681
- margin-top: 6px;
1682
- cursor: pointer;
1683
- }
1684
- .date-item {
1685
- display: inline-block;
1686
- }
1687
- .birthday-item {
1688
- > div {
1689
- display: inline-block;
1690
- margin-top: 5px;
1691
- p {
1692
- display: inline-block;
1693
- margin: 0 10px 0 15px;
1694
- }
1695
- > span {
1696
- margin-top: 5px;
1697
- }
1698
- }
1699
- .age-wrap {
1700
- display: inline-block;
1701
- }
1702
- }
1703
- .relation-item {
1704
- display: inline-block;
1705
- .relation-width {
1706
- width: 150px;
1707
- margin-right: 10px;
1708
- }
1709
- .relation-btn {
1710
- cursor: pointer;
1711
- }
1712
- }
1713
- .range-container {
1714
- display: inline-block;
1715
- width: 442px;
1716
- /* line-height: 1.5; */
1717
- vertical-align: bottom;
1718
- }
1719
- .item-error {
1720
- color: red;
1721
- display: inline-block;
1722
- }
1723
- }
1724
- .index-span {
1725
- width: 30px;
1726
- display: inline-block;
1727
- }
1728
- }
1729
- .blue {
1730
- color: #2d7aff;
1731
- margin-right: 8px;
1732
- }
1733
- .red {
1734
- color: #e02020;
1735
- }
1736
-
1737
- .in-block {
1738
- display: inline-block;
1739
- }
1740
- </style>
1741
-
1742
- <style lang="less">
1743
- // 专业模式下的样式修改
1744
- ._c_com-search-professional {
1745
- .inner-content {
1746
- .item-list {
1747
- > li {
1748
- position: relative;
1749
- .def_item_input {
1750
- position: absolute;
1751
- width: 100%;
1752
- }
1753
- .show-small-select {
1754
- .val-small-select-wrap {
1755
- width: 66px !important;
1756
- }
1757
- .val-input-wrap {
1758
- width: 34% !important;
1759
- }
1760
- }
1761
- }
1762
- }
1763
-
1764
- .item-error {
1765
- display: block;
1766
- padding-left: 29px;
1767
- }
1768
- .form-action {
1769
- position: absolute;
1770
- right: 0px;
1771
- top: 0;
1772
- }
1773
- }
1774
-
1775
- .select-front-item {
1776
- width: 23% !important;
1777
- }
1778
- .val-input-wrap {
1779
- width: 42%;
1780
- display: inline-block;
1781
- .ant-input {
1782
- width: 100% !important;
1783
- }
1784
- }
1785
- .val-select-wrap,
1786
- .val-age-wrap,
1787
- .val-date-wrap {
1788
- width: 42% !important;
1789
-
1790
- .ant-calendar-picker {
1791
- width: 50% !important;
1792
- }
1793
- }
1794
-
1795
- .val-range-wrap {
1796
- width: 42% !important;
1797
- .ant-input-group {
1798
- .age-com {
1799
- // 年龄组件 单位
1800
- .age-com-suffix {
1801
- padding: 0 1px;
1802
- }
1803
- .ant-input-number {
1804
- // 修改宽度
1805
- width: 100%;
1806
- // 隐藏数字操作项
1807
- .ant-input-number-handler-wrap {
1808
- display: none;
1809
- }
1810
- // 修改inputpadding
1811
- .ant-input-number-input-wrap {
1812
- input {
1813
- padding: 0 2px;
1814
- }
1815
- }
1816
- }
1817
- }
1818
- }
1819
- }
1820
- .teavalue-wrap {
1821
- width: calc(88% + 20px);
1822
- }
1823
- }
1824
- </style>
1
+ <template>
2
+ <div :class="['SearchCondition-page', is_search_professional ? '_c_com-search-professional' : '']">
3
+ <div class="inner-content">
4
+ <div class="item-name" v-if="showItemName">
5
+ <span class="label">筛选分类名称:</span>
6
+ <!-- 1.1.6.6请输入分类名称 -->
7
+ <a-input v-model="className" :placeholder="'请输入分类名称'" style="width: 250px" :maxLength="10" />
8
+ </div>
9
+ <div class="parent-names" v-if="showItemName">
10
+ <!-- 1.9.362父类名称 -->
11
+ <span class="label">{{ '父类名称' }}:</span>
12
+ <div
13
+ class="edit-tag"
14
+ v-for="(item, index) in parentNames"
15
+ :key="index"
16
+ @dblclick="e => editParentName(e, item)"
17
+ @click="handleParentNameSelect(item, index)"
18
+ :class="{ 'edit-tag-select': item.selected && item.disabled }"
19
+ >
20
+ <a-input style="width: 100px" :value="item" :disabled="item.disabled" @blur="() => (item.disabled = true)" v-model="item.value" :maxLength="10" />
21
+ <a-icon slot="suffix" type="close" @click="handleParentNamesRemove(index, item)" />
22
+ </div>
23
+ <template v-if="!parentNamesHasAdd">
24
+ <a-button v-show="!showAdd" icon="plus" type="dashed" @click="handleParentNamesAdd">
25
+ <!-- 1.9.363添加父类 -->
26
+ {{ '添加父类' }}
27
+ </a-button>
28
+ <a-input class="edit-tag" v-model.trim="addVal" v-show="showAdd" style="width: 100px" @blur="hanldeBlur" :maxLength="10" />
29
+ </template>
30
+ </div>
31
+ <div class="item-name" v-if="classify === 'custom' && !homeManage && !hideAddBtn">
32
+ <span class="label" v-if="!isOnlyCondition"> 过滤条件: </span>
33
+ <span @click="addAction" style="cursor: pointer">
34
+ <a-icon type="plus-circle" class="blue" theme="filled" />
35
+ <span>{{ isOnlyCondition ? '添加操作' : '添加' }}</span>
36
+ </span>
37
+ </div>
38
+ <!-- 首页管理过滤条件支持选择分类 -->
39
+ <div class="item-name" v-if="homeManage">
40
+ <span class="label">选择筛选分类:</span>
41
+ <a-select v-model="classify" style="width: 250px">
42
+ <a-select-option :value="item.sid" v-for="item in classifyList" :key="item.sid">
43
+ {{ item.name }}
44
+ </a-select-option>
45
+ <a-select-option value="custom"> 自定义 </a-select-option>
46
+ </a-select>
47
+ </div>
48
+ <div class="item-name" v-if="classify === 'custom' && homeManage">
49
+ <span class="label"> 过滤条件: </span>
50
+ <span @click="addAction" style="cursor: pointer">
51
+ <a-icon type="plus-circle" class="blue" theme="filled" />
52
+ <span>添加</span>
53
+ </span>
54
+ </div>
55
+ <ul class="item-list" v-if="classify === 'custom'" :class="{ 'list-onlyCondition': isOnlyCondition }">
56
+ <li v-for="(item, index) in actionList" :key="index">
57
+ <span class="index-span">{{ index + 1 }}&nbsp;&nbsp;&nbsp;</span>
58
+ <!-- 选择 field_key -->
59
+ <a-select
60
+ class="form-item select-front-item"
61
+ placeholder="请选择"
62
+ allowClear
63
+ v-model="item.field_key"
64
+ :disabled="item.isIllegalField"
65
+ showSearch
66
+ :filterOption="filterOption"
67
+ @select="changeColumnName($event, item)"
68
+ @change="(...arg) => fieldselectONchange(item, 'changeColumnName', ...arg)"
69
+ :dropdownMatchSelectWidth="false"
70
+ >
71
+ <a-select-option v-for="sea in item.searchList" :key="isBI ? sea.fieldId : sea.sid" :value="isBI ? sea.fieldId : sea.columnName" :title="sea.title || sea.columnName">{{
72
+ handleName(sea)
73
+ }}</a-select-option>
74
+ </a-select>
75
+ <!-- 选择 关系 -->
76
+ <!-- 1.1.6.7请选择 -->
77
+ <!-- 1.1.6.11暂无数据 -->
78
+ <a-select
79
+ v-model="item.con"
80
+ showSearch
81
+ :dropdownMatchSelectWidth="false"
82
+ :filterOption="filterOption"
83
+ :placeholder="'请选择'"
84
+ class="form-item select-front-item"
85
+ allowClear
86
+ @select="selectChild($event, item)"
87
+ @change="(...arg) => fieldselectONchange(item, 'selectChild', ...arg)"
88
+ :disabled="item.isIllegalField"
89
+ :notFoundContent="fetching ? undefined : '暂无数据'"
90
+ >
91
+ <a-select-option v-for="child in item.searchChildList" :key="child.name" :value="child.name" :title="child.desc">{{ child.desc }}</a-select-option>
92
+ </a-select>
93
+
94
+ <!-- 下拉框展示本列表相同数据类型 -->
95
+ <a-select
96
+ class="form-item"
97
+ @select="compare_fieldOnChange($event, item)"
98
+ v-show="visibleCompareField(item)"
99
+ v-model="item.compare_field"
100
+ showSearch
101
+ :filterOption="filterOption"
102
+ style="width: 120px"
103
+ >
104
+ <a-select-option v-for="date in item.selectList" :key="date.value" :value="date.value" :title="date.name">{{ date.name }}</a-select-option>
105
+ </a-select>
106
+
107
+ <div class="in-block def_item_input" :class="[item.showSelect ? 'show-small-select' : '']" v-show="visibleDefaultField(item)">
108
+ <!-- 展示 -->
109
+ <span v-show="item.showInput" class="val-input-wrap">
110
+ <!-- 增加 showInput 插槽 支持自定义showInput 内容 -->
111
+ <slot name="showInput" :item="item">
112
+ <a-input-number :disabled="item.isIllegalField" v-if="showPercent(item)" class="CL-input" style="width: 200px" v-model="item.value" :min="0" :max="100" />
113
+ <a-input v-else v-model="item.value" :disabled="item.isIllegalField" class="form-item" />
114
+ </slot>
115
+ </span>
116
+ <a-select
117
+ class="val-select-wrap"
118
+ v-if="item.showSearch"
119
+ v-model="item.wordValue"
120
+ :disabled="item.isIllegalField"
121
+ mode="multiple"
122
+ :tokenSeparators="['|#|']"
123
+ style="width: 160px"
124
+ :filter-option="false"
125
+ @dropdownVisibleChange="dropdownVisibleChange($event, item)"
126
+ @search="e => handleSearch(e, item)"
127
+ @select="handleSelect($event, item)"
128
+ @deselect="handleDeSelect($event, item)"
129
+ >
130
+ <a-select-option v-for="sea in item.wordbookData" :key="item.sid + sea.myName" :value="sea.myName">
131
+ {{ sea.showKeys || sea.myName }}
132
+ </a-select-option>
133
+ </a-select>
134
+
135
+ <a-select v-show="item.showSelect" class="val-small-select-wrap" v-model="item.unit" showSearch :filterOption="filterOption" :disabled="item.isIllegalField" style="width: 66px">
136
+ <a-select-option v-for="date in item.dateList" :key="date.value" :value="date.value" :title="date.name">{{ date.name }}</a-select-option>
137
+ </a-select>
138
+
139
+ <div class="date-item val-date-wrap" v-if="item.showDate">
140
+ <a-date-picker
141
+ :disabledDate="disabledStartDate || item.isIllegalField"
142
+ format="YYYY-MM-DD"
143
+ v-model="item.start_val"
144
+ :placeholder="'请选择'"
145
+ @openChange="handleStartOpenChange($event, item)"
146
+ style="width: 120px"
147
+ />
148
+ <a-date-picker
149
+ :disabledDate="disabledEndDate || item.isIllegalField"
150
+ format="YYYY-MM-DD"
151
+ :placeholder="'请选择'"
152
+ v-model="item.end_val"
153
+ :open="item.endOpen"
154
+ @openChange="handleEndOpenChange($event, item)"
155
+ style="width: 120px"
156
+ />
157
+ </div>
158
+ <!-- 生日 -->
159
+ <div class="date-item birthday-item val-birthday-wrap" v-if="item.showBirthdayDate">
160
+ <div>
161
+ <a-range-picker v-model="item.limit_date" :disabledDate="disabledDate || item.isIllegalField" @change="changeRange($event, item)" format="MM-DD" style="width: 180px" />
162
+ <div class="age-wrap">
163
+ <!-- 1.2.5.34年龄 -->
164
+ <p>{{ '年龄' }}</p>
165
+ <a-input :disabled="item.isIllegalField" style="width: 60px; margin-right: 10px" v-model="item.start_val" />
166
+ <a-input :disabled="item.isIllegalField" style="width: 60px; margin-right: 10px" v-model="item.end_val" />
167
+ <a-select :disabled="item.isIllegalField" v-model="item.unit" showSearch :filterOption="filterOption" defaultValue="YEAR" style="width: 60px">
168
+ <a-select-option v-for="v in item.units" :key="v.con" :value="v.con">{{ v.title }}</a-select-option>
169
+ </a-select>
170
+ </div>
171
+ </div>
172
+ </div>
173
+ <!-- 跨表 -->
174
+
175
+ <div class="relation-item" v-show="item.showRelation">
176
+ <a-select :disabled="item.isIllegalField" v-model="item.wordValue" showSearch :filterOption="filterOption" @select="handlerSelectRelation($event, item)" class="relation-width">
177
+ <a-select-option v-for="word in item.relationData" :key="word.id" :value="word.tableId">{{ word.tableName }}</a-select-option>
178
+ </a-select>
179
+ <!-- 关联值 -->
180
+ <a-input class="relation-width" disabled v-model="item.relationField" />
181
+ <span class="relation-width blue relation-btn" @click="openRelationFilter(item, index)">
182
+ <!-- 1.1.1.1.6点击设置过滤条件 -->
183
+ {{ '点击设置过滤条件' }}</span
184
+ >
185
+ </div>
186
+
187
+ <!-- 年龄 -->
188
+ <!-- TODO:样式 -->
189
+ <div v-if="item.showRangeAge" class="range-container val-range-wrap">
190
+ <rangeAge
191
+ :disabled="item.isIllegalField"
192
+ :format="item.format"
193
+ :defaultValue="{
194
+ start_val: item.start_val,
195
+ end_val: item.end_val
196
+ }"
197
+ @change="ageRangeOnChange($event, item)"
198
+ ></rangeAge>
199
+ </div>
200
+ <div v-if="item.showAgeCom" class="range-container val-age-wrap">
201
+ <age-com :disabled="item.isIllegalField" :format="item.format" @change="agecomOnChange($event, item)" :value="item.ageValue"></age-com>
202
+ </div>
203
+ </div>
204
+ <!-- -->
205
+ <span class="item-error" v-if="item.field_key && !searchListKey.includes(item.field_key)">检测到该筛选字段是非法无效的,请移除!</span>
206
+ <!-- 1.1.1.3.3删除 -->
207
+ <a-tooltip :title="'删除'" destroyTooltipOnHide>
208
+ <svg-icon v-if="!isSee" v-show="noShowListDelIcon" @click="softDel(index)" class-name="svg-icon-btn is-danger form-action" icon-class="xitongtubiaoliebiaocaozuoanniushanchushixin" />
209
+ </a-tooltip>
210
+ </li>
211
+ </ul>
212
+ <div v-if="classify === 'custom' && !isOnlyCondition">
213
+ <div style="margin-bottom: 6px" v-show="!is_search_professional">
214
+ <!-- 筛选器逻辑编辑,不设置默认为AND1.2.4.9 -->
215
+ {{ '筛选器逻辑编辑,不设置默认为AND' }} <br />
216
+ 例子 (1 AND 2) OR 3
217
+ </div>
218
+ <div>
219
+ <!-- 没啥用撑布局而已 -->
220
+ <span v-if="is_search_professional" style="visibility: hidden;" class="index-span">{{ 1 }}&nbsp;&nbsp;&nbsp;</span>
221
+
222
+ <a-input
223
+ class="teavalue-wrap"
224
+ v-model="teaValue"
225
+ type="textarea"
226
+ :placeholder="is_search_professional ? '筛选条件表达式,不设置默认为AND,例子(1 AND 2) OR 3' : ''"
227
+ :rows="is_search_professional ? 1 : 3"
228
+ />
229
+ </div>
230
+ </div>
231
+ </div>
232
+ <SearchFilter
233
+ v-bind="$attrs"
234
+ :visible="relationVisible"
235
+ openType="relationTable"
236
+ @saveAdd="relationSave"
237
+ @cancelSaveAdd="relationCancel"
238
+ :actionList_prop="relationAction"
239
+ :searchFieldList="relationSearchFieldList"
240
+ />
241
+ </div>
242
+ </template>
243
+
244
+ <script>
245
+ import moment from 'moment';
246
+ import 'moment/locale/zh-cn';
247
+ moment.locale('zh-cn');
248
+ import rangeAge from '~/table-filter/src/components/range-age/index';
249
+ import ageCom from '~/table-filter/src/components/age-com/index';
250
+ import { Icon, Input, Button, InputNumber, Tooltip, Select, DatePicker, message } from 'ant-design-vue';
251
+ import utils from '@/utils/utils-map';
252
+ import FIELDTYPELIST from './fieldTypeList';
253
+ import svgIcon from '@/component/svg/index.vue';
254
+ import create from '@/core/create';
255
+ import { filterApiFn } from '~/table-filter/src/mixins/mixins';
256
+ export default create({
257
+ name: 'search-condition',
258
+ mixins: [filterApiFn],
259
+ props: {
260
+ isSee: Boolean,
261
+ visible: Boolean,
262
+ actionList_prop: Object,
263
+ searchFieldList: {
264
+ type: Array,
265
+ default: () => []
266
+ },
267
+ showItemName: {
268
+ default: true
269
+ },
270
+ saveEmpty: {
271
+ default: false
272
+ },
273
+ // 首页管理
274
+ homeManage: {
275
+ default: false
276
+ },
277
+ tableId: {
278
+ default: ''
279
+ },
280
+ isPersonalizedHome: {
281
+ default: false
282
+ },
283
+ conditionList: {
284
+ type: Array
285
+ },
286
+ source: {
287
+ type: String
288
+ },
289
+ isBI: {
290
+ default: false
291
+ },
292
+ // 自定义格式化 actionList 里的数据 (可搭配 slot插槽:showInput使用 )
293
+ formatActionData: {
294
+ type: Function,
295
+ default: v => v
296
+ },
297
+ isOnlyCondition: Boolean,
298
+ isCnHis: {
299
+ // 2021/5/25 257针对云his做修改 只过滤搜索为禁用的条件 fjj需求
300
+ type: Boolean,
301
+ default: false
302
+ },
303
+ isAdmin: {
304
+ type: Boolean,
305
+ default: false
306
+ },
307
+
308
+ // 是否展示 CompareField
309
+ showCompareField: {
310
+ type: Boolean,
311
+ default: false
312
+ },
313
+
314
+ hideAddBtn: {
315
+ type: Boolean,
316
+ default: false
317
+ },
318
+ openType: {
319
+ type: String,
320
+ default: ''
321
+ }
322
+ },
323
+ data() {
324
+ return {
325
+ checkedItem: null,
326
+ actionList: [],
327
+ searchList: [],
328
+ searchChildList: [],
329
+ relationTableList: [], // 跨表
330
+ isRelationList: [], // 跨表字段
331
+ fieldTypeList: FIELDTYPELIST,
332
+ dateList: [
333
+ { name: '天', value: 'DAY' },
334
+ { name: '周', value: 'WEEK' },
335
+ { name: '月', value: 'MONTH' },
336
+ { name: '季度', value: 'QUARTER' },
337
+ { name: '年', value: 'YEAR' }
338
+ ],
339
+ dateTimeList: { name: '小时', value: 'HOUR' },
340
+ relationSelect: [
341
+ { desc: '存在跨表', name: 'QUOTE_IN' },
342
+ { desc: '不存在跨表', name: 'QUOTE_NOTIN' }
343
+ ],
344
+ rangeAgeOptions: [
345
+ { desc: '等于', name: 'IN' },
346
+ { desc: '大于', name: 'BIG' },
347
+ { desc: '大于等于', name: 'BIGEQ' },
348
+ { desc: '小于', name: 'LESS' },
349
+ { desc: '小于等于', name: 'LESSEQ' }
350
+ ],
351
+ start_val: null,
352
+ end_val: null,
353
+ className: '',
354
+ teaValue: '',
355
+ classifyId: '',
356
+ // 跨表过滤
357
+ relationVisible: false,
358
+ relationAction: {},
359
+ relationSearchFieldList: [],
360
+ clcikRelationIndex: undefined,
361
+ fetching: false,
362
+ birthdayUnits: [
363
+ { title: '天', units: 1, con: 'DAY' },
364
+ { title: '周', units: 2, con: 'WEEK' },
365
+ { title: '月', units: 1, con: 'MONTH' },
366
+ { title: '岁', units: 1, con: 'YEAR' }
367
+ ],
368
+ limit_date: '',
369
+ parentNames: [],
370
+ // searchSelect
371
+ searchItem: {},
372
+ curWordbookData: undefined,
373
+ curAutograph: '',
374
+ classify: 'custom',
375
+ classifyList: [],
376
+ addVal: '',
377
+ showAdd: false,
378
+ birthdayFilter: ["BIG", "LESS", "BIGEQ", "LESSEQ", "IN_THE_PAST_DI", "IN_THE_FUTURE_DI"]
379
+ };
380
+ },
381
+ computed: {
382
+ parentNamesHasAdd() {
383
+ return this.parentNames.some(v => v.isAdd);
384
+ },
385
+ showPercent() {
386
+ return function(item) {
387
+ return item.settingObj?.attr === 'PERCENTAGE' || false;
388
+ };
389
+ },
390
+
391
+ searchListKey() {
392
+ let res = [];
393
+ this.searchList.forEach(v => {
394
+ v.fieldId && res.push(v.fieldId);
395
+ v.columnName && res.push(v.columnName);
396
+ });
397
+ return res;
398
+ },
399
+ // TODO:
400
+ isOrgAdmin() {
401
+ return this.isAdmin;
402
+ },
403
+ handleName() {
404
+ return function(item, key = 'title') {
405
+ let useKey = key;
406
+ if (this.isBI) {
407
+ useKey = 'remark';
408
+ }
409
+ return item.alias || item[useKey];
410
+ };
411
+ },
412
+
413
+ is_search_professional() {
414
+ return this.source == 'search-professional';
415
+ },
416
+
417
+ // 筛选分类“专业模式” 只有一条筛选数据,不可以删除。
418
+ noShowListDelIcon() {
419
+ let len = this?.actionList?.length || 0;
420
+ return !(len === 1 && this.source == 'search-professional');
421
+ }
422
+ },
423
+ // created() {
424
+ // this.init();
425
+ // },
426
+ beforeCreate() {
427
+ this.$options.components.SearchFilter = require('../search-filter/SearchFilter.vue').default;
428
+ },
429
+ components: {
430
+ rangeAge,
431
+ ageCom,
432
+ [Icon.name]: Icon,
433
+ [Input.name]: Input,
434
+ [InputNumber.name]: InputNumber,
435
+ [Button.name]: Button,
436
+ [Select.name]: Select,
437
+ [Select.Option.name]: Select.Option,
438
+ [Tooltip.name]: Tooltip,
439
+ [DatePicker.name]: DatePicker,
440
+ [DatePicker.RangePicker.name]: DatePicker.RangePicker,
441
+ svgIcon
442
+ },
443
+ watch: {
444
+ searchFieldList: {
445
+ immediate: true,
446
+ deep: true,
447
+ handler(val) {
448
+ if (val && val.length > 0) {
449
+ // 专业模式,刷新字段,不刷新设置的条件
450
+ if (this.is_search_professional && this.initConditionsed) {
451
+ return;
452
+ }
453
+ this.handleInitConditions();
454
+ }
455
+ }
456
+ }
457
+ },
458
+ methods: {
459
+ handleInitConditions() {
460
+ if (this.homeManage) {
461
+ this.getClassifyList();
462
+ this.classify = this.actionList_prop.displayCategory || 'custom';
463
+ if (this.actionList_prop.displayCategory) {
464
+ this.actionList_prop.conObj = [];
465
+ this.actionList_prop.preSqlExpression = '';
466
+ }
467
+ }
468
+ let { relationTableList = [] } = this.$attrs;
469
+ this.relationTableList = this.openType === 'relationTable' ? [] : relationTableList;
470
+ this.init();
471
+ this.backShow(this.actionList_prop);
472
+ this.showItemName && this.getParentNames();
473
+ this.initConditionsed = true;
474
+ },
475
+ async getClassifyList() {
476
+ let params = { tableId: this.tableId };
477
+ let res = await this.handleGetConfigApi(params, 'requestGetTableCondiTionList');
478
+ if (res.status) {
479
+ this.$emit('setConditionMap', res.data);
480
+ this.classifyList = res?.data?.conditionList || [];
481
+ }
482
+ },
483
+ getParentNames() {
484
+ let parentNames = [];
485
+ let displayCategoryList = this?.$attrs?.displayCategoryList || [];
486
+ displayCategoryList.forEach(item => {
487
+ if (item !== '未分类') {
488
+ parentNames.push({
489
+ disabled: true,
490
+ selected: item === this.actionList_prop.displayCategory,
491
+ value: item
492
+ });
493
+ }
494
+ });
495
+ this.parentNames = parentNames;
496
+ },
497
+ init(config = {}) {
498
+ let mySearchFieldList = JSON.parse(JSON.stringify(this.searchFieldList)).filter(i => i.columnName !== 'operatorColumn' && i.isMerge != 1);
499
+ if (mySearchFieldList && mySearchFieldList.length > 0) {
500
+ if (this.isPersonalizedHome) {
501
+ this.searchList = mySearchFieldList;
502
+ } else {
503
+ let searchList = mySearchFieldList
504
+ .map(item => {
505
+ let { settingObj = {} } = item;
506
+ let notParticipatingSearch = false;
507
+ if ('notParticipatingSearch' in settingObj) {
508
+ notParticipatingSearch = settingObj.notParticipatingSearch != 1;
509
+ } else {
510
+ notParticipatingSearch = true;
511
+ }
512
+ const flag = this.isCnHis ? true : item.isSearch == 1 || item.isShowSearch == 1;
513
+ if (flag && notParticipatingSearch) {
514
+ return item;
515
+ }
516
+ return null;
517
+ })
518
+ .filter(Boolean);
519
+ this.searchList = searchList;
520
+ }
521
+
522
+ if (this.searchList.length === 0) {
523
+ return;
524
+ }
525
+
526
+ this.fieldTypeList.some(item => {
527
+ if (this.searchList[0].fieldType == item.name) {
528
+ this.$set(this, 'searchChildList', item.conList);
529
+ return true;
530
+ }
531
+ });
532
+ this.isRelationList = this.relationTableList.map(item => item.primaryField);
533
+ this.actionList = [];
534
+ this.className = '';
535
+ this.teaValue = '';
536
+
537
+ let isInitNoAdd = 'initNoAdd' == config?.type || '';
538
+
539
+ if (isInitNoAdd) return;
540
+
541
+ this.addAction();
542
+ }
543
+ },
544
+ // 回显
545
+ backShow(val) {
546
+ if (!val || !Object.keys(val || {}).length) return;
547
+ let obj = val;
548
+ // 自定义菜单中 过滤 条件回显
549
+ if (this.source === 'customMenuForm' && val.setting && utils.isJSON(val.setting)) {
550
+ obj = JSON.parse(val.setting) || {};
551
+ }
552
+ if (!Object.keys(obj || {}).length) return;
553
+ let relationFieldList = [];
554
+ // this.className = obj.from == "edit" ? obj.name : "";
555
+ this.className = obj.name;
556
+ this.classifyId = obj.from == 'edit' ? obj.sid : '';
557
+ this.teaValue = obj.sqlExpression;
558
+ if (obj.conObj && !utils.isArray(obj.conObj)) {
559
+ obj.conObj = JSON.parse(obj.conObj);
560
+ }
561
+ if (!obj.conObj || !obj.conObj.length) return;
562
+ this.actionList = obj.conObj.map(item => {
563
+ let curSet = this.searchList.find(v => (this.isBI ? v.fieldId : v.columnName) == item.field_key);
564
+ if (curSet) {
565
+ item.settingObj = curSet.settingObj;
566
+ }
567
+ if (item.con == 'CONVERT') {
568
+ item.wordValue = item.value;
569
+ } else if (item.con == 'QUOTE' || item.con == 'QUOTE_NOT') {
570
+ item.wordValue = item.value.split('|#|');
571
+ } else if (this.isRelationList.includes(item.field_key)) {
572
+ item.wordValue = item.tableId;
573
+ let curItem = this.relationTableList.find(v => v.tableId === item.tableId);
574
+ if (curItem) {
575
+ item.relationField = curItem.relationField;
576
+ relationFieldList = JSON.parse(JSON.stringify(curItem.fieldList.fieldList) || []);
577
+ }
578
+ }
579
+ let start_val = '';
580
+ let end_val = '';
581
+ let limit_date = [];
582
+ let ageValue = {};
583
+ if (item?.settingObj?.attr === 'PERCENTAGE') {
584
+ if (item.value) {
585
+ item.value = Number(item.value) * 100;
586
+ }
587
+ } else if (item && item.settingObj && item.settingObj.attr == 'BIRTHDAY') {
588
+ start_val = item.start_val ? item.start_val : '';
589
+ end_val = item.end_val ? item.end_val : '';
590
+ if (item.limit_date) {
591
+ let limitString = item.limit_date;
592
+ if (Array.isArray(item.limit_date)) {
593
+ let res = [];
594
+ if (item.limit_date.length > 0) {
595
+ item.limit_date.forEach(v => {
596
+ v._d && res.push(utils.formatTime('MOUTH', v._d));
597
+ });
598
+ }
599
+ if (res.length > 0) {
600
+ item.curlimit_date = res.join('~');
601
+ }
602
+ } else if (utils.isString(limitString)) {
603
+ let temp = [];
604
+ item.curlimit_date = limitString;
605
+ if (utils.isString(limitString)) {
606
+ let res = limitString.split('~');
607
+ if (res.length > 0) {
608
+ for (let i = 0; i < res.length; i++) {
609
+ temp.push(moment(res[i], 'MM-DD'));
610
+ }
611
+ limit_date = temp;
612
+ }
613
+ }
614
+ }
615
+ }
616
+ } else if (item && item.settingObj && item.settingObj.attr == 'AGE') {
617
+ this.$set(item, 'AGEAttr', true);
618
+ start_val = item.start_val;
619
+ end_val = item.end_val;
620
+ ageValue = this.diffTime(item.value);
621
+ // searchChildList
622
+ // 大于(BIG),小于 LESS,大于等于BIGEQ,小于等于LESSEQ,等于(IN)
623
+ } else {
624
+ start_val = item.start_val ? moment(item.start_val, 'YYYY-MM-DD') : '';
625
+ end_val = item.end_val ? moment(item.end_val, 'YYYY-MM-DD') : '';
626
+ item.curlimit_date = '';
627
+ }
628
+
629
+ item.fieldType = item.fieldType || curSet?.fieldType;
630
+
631
+ // 是否是自定义输入
632
+ if (item.is_compare_field && this.showCompareField) {
633
+ this.handleSetSelectList(item);
634
+ }
635
+ return {
636
+ field_key: item.field_key,
637
+ fieldId: item.field_key,
638
+ fieldType: item.fieldType, // 字段类型
639
+ con: item.con,
640
+ unit: item.unit,
641
+ start_val: start_val,
642
+ end_val: end_val,
643
+ limit_date: limit_date,
644
+ curlimit_date: item.curlimit_date ? item.curlimit_date : '',
645
+ searchList: this.searchList,
646
+ searchChildList: this.searchChildList,
647
+ dateList: this.dateList,
648
+ wordValue: item.wordValue,
649
+ word: item.wordValue,
650
+ value: utils.isString(item.value) ? item.value : JSON.stringify(item.value),
651
+ relationData: this.isRelationList.includes(item.field_key) ? [...this.relationTableList] : [],
652
+ relationField: item.valueField || '',
653
+ relationFieldList: relationFieldList || [],
654
+ quote_con: item.quote_con || {},
655
+ ageValue: ageValue || {},
656
+
657
+ converFun: item.converFun || undefined,
658
+ parameterConversionId: item.parameterConversionId || undefined,
659
+ relationOrgId: item.relationOrgId || undefined,
660
+ preConObj: item.preConObj || undefined,
661
+ preSqlExpression: item.preSqlExpression || undefined,
662
+ isIllegalField: this.isSee || (item.field_key && !this.searchListKey.includes(item.field_key)), // 非法字段
663
+ wordbookValueList: item.wordbookValueList || [],
664
+ wordbookData: [],
665
+
666
+ is_compare_field: item.is_compare_field || false,
667
+ selectList: item.selectList || [],
668
+ customInput: false, // 自定义输入
669
+ compare_field: item.compare_field // 选择的值
670
+ };
671
+ });
672
+ this.actionList.forEach(item => {
673
+ this.formatData(item.field_key, item);
674
+ this.selectChild(item.con, item, true, { is_compare_field: item.is_compare_field });
675
+ });
676
+ },
677
+ // 保存列表搜索分类
678
+ saveAdd() {
679
+ // 首页配置支持筛选分类
680
+ if (this.homeManage && this.classify !== 'custom') {
681
+ let classify = this.classifyList.find(item => item.sid === this.classify);
682
+ let setting = {
683
+ displayCategory: classify.sid,
684
+ name: classify.name,
685
+ sqlExpression: classify.sqlExpression,
686
+ conObj: classify.conObj
687
+ };
688
+ let params = {
689
+ id: classify.sid,
690
+ tableId: this.tableId,
691
+ setting: JSON.stringify(setting)
692
+ };
693
+ this.$emit('saveAdd', params);
694
+ return;
695
+ }
696
+ if (this.homeManage && this.classify == 'custom') {
697
+ this.actionList_prop.displayCategory = '';
698
+ this.actionList_prop.name = '';
699
+ }
700
+ if (!this.className && this.showItemName) {
701
+ // 1.1.7.3请输入搜索分类名称
702
+ this.$message.warn(`请输入搜索分类名称!`, 2);
703
+ return;
704
+ }
705
+ if (this.actionList && this.actionList.length > 0) {
706
+ let conObj = this.getConditions();
707
+
708
+ if (!conObj) {
709
+ return;
710
+ }
711
+
712
+ if (this.isOnlyCondition) {
713
+ this.$emit('saveAdd', conObj);
714
+ return;
715
+ }
716
+ let displayCategory = this.parentNames.filter(item => item.selected)[0]?.value;
717
+ let setting = {
718
+ displayCategory,
719
+ name: this.className, // 自定义名称
720
+ sqlExpression: this.teaValue, // 文本域
721
+ conObj
722
+ };
723
+ let params = {
724
+ id: this.classifyId,
725
+ tableId: this.tableId,
726
+ setting: JSON.stringify(setting)
727
+ };
728
+ if (conObj.some(v => !v.con)) {
729
+ return this.$message.warn('请完善筛选条件');
730
+ }
731
+ this.$emit('saveAdd', params);
732
+ const { isInSearch } = this?.$attrs || {};
733
+ // isInSearch = true,等待接口 /tableList/saveTableCondiTion 请求完成 再关闭弹窗。
734
+ if (!isInSearch) {
735
+ this.cancelSaveAdd(false);
736
+ }
737
+ } else {
738
+ if (!this.saveEmpty) {
739
+ // 1.1.6.18请设置搜索条件
740
+ return this.$message.warn(`请设置搜索条件`, 2);
741
+ }
742
+ this.$emit('saveAdd', {
743
+ setting: '{}'
744
+ });
745
+ this.cancelSaveAdd();
746
+ }
747
+ },
748
+ getSqlExpression() {
749
+ return this.teaValue;
750
+ },
751
+ getConditions() {
752
+ let condition = [];
753
+ for (let i = 0; i < this.actionList.length; i++) {
754
+ let item = this.actionList[i];
755
+ if (item.field_key && !this.searchListKey.includes(item.field_key)) {
756
+ this.$message.error('检测到该筛选字段含有非法无效的,请移除!');
757
+ return;
758
+ }
759
+ let attrType = item?.settingObj?.attr || '';
760
+ let value = '';
761
+ if (item.con == 'CONVERT') {
762
+ value = item.wordValue.map(word => {
763
+ return JSON.parse(word);
764
+ });
765
+ } else if (item.con == 'QUOTE' || item.con == 'QUOTE_NOT') {
766
+ value = item.wordValue.join('|#|');
767
+ } else {
768
+ value = item.value;
769
+ }
770
+ let start_val = '';
771
+ let end_val = '';
772
+ let limit_date = [];
773
+ if (item.settingObj && item.settingObj.attr == 'PERCENTAGE') {
774
+ value = Number(value) / 100;
775
+ } else if (item.settingObj && item.settingObj.attr == 'BIRTHDAY') {
776
+ if (item.start_val) {
777
+ let res = utils.validateBirthday(item.start_val, item.title, item.unit);
778
+ if (!res) return;
779
+ }
780
+ if (item.end_val) {
781
+ let res = utils.validateBirthday(item.end_val, item.title, item.unit);
782
+ if (!res) return;
783
+ }
784
+ if (+item.start_val > +item.end_val) {
785
+ // 1.9.47请输入有效范围
786
+ this.$message.warning(`${item.title}请输入有效范围`, 2);
787
+ return;
788
+ }
789
+ start_val = item.start_val ? item.start_val : '';
790
+ end_val = item.end_val ? item.end_val : '';
791
+
792
+ limit_date = item.curlimit_date ? item.curlimit_date : '';
793
+ } else if (attrType == 'AGE') {
794
+ start_val = item.start_val;
795
+ end_val = item.end_val;
796
+ value = item.value;
797
+ } else {
798
+ start_val = item.start_val ? item.start_val.format('YYYY-MM-DD') : '';
799
+ end_val = item.end_val ? item.end_val.format('YYYY-MM-DD') : '';
800
+ }
801
+
802
+ let is_custom = this.showCompareField ? item.compare_field == '_custom__input_' : false;
803
+
804
+ let temp = {
805
+ field_key: item.field_key, // 一级value
806
+ fieldId: item.field_key, // BI需要拿fieldId
807
+ fieldType: item.fieldType, // 字段类型
808
+ con: item.con, // 二级选择项value
809
+ value: value, // input输入值
810
+ start_val: start_val, // 开始时间
811
+ end_val: end_val, // 结束时间
812
+ unit: item.unit, // 选择时间单位
813
+ limit_date: limit_date,
814
+ tableId: (item.showRelation && item.wordValue) || undefined, // 关联表格ID
815
+ valueField: item.relationField || undefined, // 关联字段
816
+ quote_con: Object.keys(item.quote_con || {}).length ? item.quote_con : null, // 关联表格过滤项
817
+ converFun: item.converFun || undefined,
818
+ parameterConversionId: item.parameterConversionId || undefined,
819
+ relationOrgId: item.relationOrgId || undefined,
820
+ preConObj: item.preConObj || undefined,
821
+ preSqlExpression: item.preSqlExpression || undefined,
822
+ wordbookValueList: item.wordbookValueList,
823
+ is_compare_field: is_custom ? false : item.is_compare_field, // 自定义输入的设为false
824
+ compare_field: is_custom ? undefined : item.compare_field
825
+ };
826
+ condition.push(temp);
827
+ }
828
+ return [...condition];
829
+ },
830
+ // 第二层弹框添加分类按钮
831
+ addAction(config = {}) {
832
+ if (this.searchList.length === 0) {
833
+ return message.warning('暂无字段可设置!');
834
+ }
835
+
836
+ // noDefault 不需要设置默认选中第一条数据
837
+ // is_search_professional 专业模式 不需要默认选中第一条
838
+ let noDefault = config?.noDefault || this.is_search_professional || false;
839
+
840
+ let searchListDefaultItem = this.searchList[0];
841
+ let searchListDefault = '',
842
+ setting = {},
843
+ settingObj = {};
844
+
845
+ if (searchListDefaultItem) {
846
+ searchListDefault = this.isBI ? searchListDefaultItem.fieldId : searchListDefaultItem.columnName;
847
+ setting = searchListDefaultItem.setting;
848
+ settingObj = searchListDefaultItem.settingObj;
849
+ }
850
+
851
+ if (noDefault) {
852
+ searchListDefaultItem = {};
853
+ searchListDefault = undefined;
854
+ }
855
+
856
+ this.actionList.push({
857
+ field_key: searchListDefault,
858
+ fieldId: searchListDefaultItem.fieldId,
859
+ fieldType: searchListDefaultItem.fieldType, // 字段类型
860
+ con: undefined,
861
+ searchList: this.searchList,
862
+ searchChildList: this.searchChildList,
863
+ dateList: this.dateList,
864
+ wordbookData: [],
865
+ relationData: [...this.relationTableList],
866
+ relationField: '',
867
+ relationFieldList: [],
868
+ quote_con: {},
869
+ title: '',
870
+ unit: 'YEAR',
871
+ setting: setting,
872
+ settingObj: settingObj,
873
+ wordbookValueList: [],
874
+ isIllegalField: this.isSee,
875
+
876
+ is_compare_field: false,
877
+ selectList: [],
878
+ customInput: false, // 自定义输入
879
+ compare_field: '' // 选择的值
880
+ });
881
+
882
+ if (noDefault) {
883
+ return;
884
+ }
885
+
886
+ let actionInex = this.actionList.length - 1;
887
+ this.changeColumnName(this.actionList[actionInex].field_key, this.actionList[actionInex]);
888
+ },
889
+ // 软删除
890
+ softDel(index) {
891
+ if (this.isSee) return;
892
+ this.actionList.splice(index, 1);
893
+ },
894
+ cancelSaveAdd() {
895
+ this.$emit('cancelSaveAdd');
896
+ this.actionList = [];
897
+ this.addVisible = false;
898
+ this.showAdd = false;
899
+ this.addVal = '';
900
+ this.className = '';
901
+ this.classifyId = '';
902
+ this.teaValue = '';
903
+ },
904
+ // 第一个下拉框(1)根据不同类型,分别展示input select date
905
+ changeColumnName(value, action) {
906
+ action.con = undefined;
907
+ let f = action.searchList.find(v => v.columnName == value);
908
+ action.fieldType = f?.fieldType || undefined;
909
+ this.$set(action, 'wordValue', []);
910
+ this.$set(action, 'wordbookData', []);
911
+ this.formatData(value, action);
912
+ this.handleHideItem(action);
913
+ this.handleHideCompareField(action);
914
+ this.$set(action, 'isIllegalField', value && !this.searchListKey.includes(value));
915
+ },
916
+ // 数据处理
917
+ formatData(value, action) {
918
+ action.searchList.some(sea => {
919
+ if ((this.isBI ? sea.fieldId : sea.columnName) == value) {
920
+ action.fieldType = sea.fieldType;
921
+
922
+ action.settingObj = sea.settingObj;
923
+ let attrType = sea?.settingObj?.attr || '';
924
+ let format = sea?.settingObj?.format || '';
925
+ action.title = sea.title || '';
926
+ if (sea.setting) {
927
+ utils.isPlainObject(sea.setting) ? '' : (sea.setting = JSON.parse(sea.setting));
928
+ if (!utils.isEmpty(sea.setting.wordbook)) {
929
+ // 1.1.4.26引用
930
+ // 1.2.5.52不引用
931
+ action.searchChildList = [
932
+ { desc: '引用', name: 'QUOTE' },
933
+ { desc: '不引用', name: 'QUOTE_NOT' }
934
+ ];
935
+ let obj = {};
936
+ if (sea.setting.wordbook.params) {
937
+ sea.setting.wordbook.params.forEach(item => {
938
+ obj[item.p_name] = item.p_value;
939
+ });
940
+ }
941
+ this.$set(action, 'settingWordbook', {
942
+ params: obj,
943
+ id: sea.setting.wordbook.id
944
+ });
945
+ // this.getWordbookData(sea.setting.wordbook.id, obj).then(list => {
946
+ // this.$set(action, "wordbookData", list);
947
+ // });
948
+ return true;
949
+ } else if (sea.setting.showSetting && sea.setting.showSetting.length > 0) {
950
+ // 1.1.4.27下拉选项
951
+ action.searchChildList = [{ desc: '下拉选项', name: 'CONVERT' }];
952
+ this.$set(action, 'wordValue', []);
953
+ let showSetting = sea.setting.showSetting;
954
+
955
+ // 字典推荐值
956
+ let dictionItem = this.handleDictionDef(sea);
957
+ if (dictionItem) {
958
+ let { defaultValueTitle } = sea?.dictionarieObj || {};
959
+ let hasDef = showSetting.find(item => item.change_text === defaultValueTitle);
960
+ !hasDef && showSetting.unshift(dictionItem);
961
+ }
962
+ let wordbookData = showSetting.map((set, index) => {
963
+ // 回显逻辑
964
+ if (action.word) {
965
+ utils.isString(action.word) ? (action.word = JSON.parse(action.word)) : '';
966
+ let words = action.word.map(w => JSON.stringify(w));
967
+ let filter = JSON.stringify(set.filter);
968
+ if (words.includes(filter)) {
969
+ action.wordValue.push(filter);
970
+ }
971
+ }
972
+ return {
973
+ name: set.change_text,
974
+ showKeys: set.change_text,
975
+ value: JSON.stringify(set.filter),
976
+ myName: JSON.stringify(set.filter),
977
+ id: (index + 9).toString(36) + index,
978
+ sid: (index + 9).toString(36) + index
979
+ };
980
+ });
981
+ action.wordbookData = wordbookData;
982
+ return true;
983
+ } else {
984
+ let matchItem = this.fieldTypeList.find(item => sea.fieldType.toUpperCase() == item.name);
985
+ let conList = this.searchChildList;
986
+ if (matchItem) {
987
+ // 关系 选项
988
+ conList = matchItem.conList;
989
+ }
990
+ if (action?.settingObj?.attr === "BIRTHDAY") {
991
+ conList = conList.filter(v => !this.birthdayFilter.includes(v.name)) || [];
992
+ }
993
+
994
+ action.searchChildList = conList;
995
+ }
996
+ // 通过 attr 判断类型,searchChildList
997
+ if (attrType == 'AGE') {
998
+ action.searchChildList = this.rangeAgeOptions;
999
+ action.format = format.toUpperCase();
1000
+ // action.ageValue = this.diffTime(action.value);
1001
+ }
1002
+ } else {
1003
+ this.fieldTypeList.some(item => {
1004
+ if (sea.fieldType == item.name) {
1005
+ action.searchChildList = item.conList.filter(con => con.name != 'QUOTE' && con.name != 'CONVERT' && con.name != 'QUOTE_NOT');
1006
+ return true;
1007
+ }
1008
+ });
1009
+ }
1010
+ // 跨表字段
1011
+ if (this.isRelationList.includes(value) && !action.searchChildList.some(v => v.name == 'QUOTE_IN')) {
1012
+ action.searchChildList.push(...this.relationSelect);
1013
+ }
1014
+ return true;
1015
+ }
1016
+ });
1017
+ this.formatActionData(action);
1018
+ },
1019
+ // 字典推荐值 item处理
1020
+ handleDictionDef(el) {
1021
+ let { defaultValue, defaultValueTitle } = el?.dictionarieObj || {};
1022
+ let dictionItem = null;
1023
+ if (defaultValue && defaultValueTitle) {
1024
+ dictionItem = {
1025
+ change_text: defaultValueTitle,
1026
+ filter: [
1027
+ {
1028
+ con: 'EQ',
1029
+ field_key: el.columnName,
1030
+ value: defaultValue
1031
+ }
1032
+ ]
1033
+ };
1034
+ }
1035
+ return dictionItem;
1036
+ },
1037
+ getWordbookData(o, obj) {
1038
+ let { id, filterKeys, wordbookType } = o;
1039
+ let resFieldKeys = filterKeys && Array.isArray(filterKeys) ? JSON.stringify(filterKeys) : filterKeys;
1040
+ let url = `/tableReader/getWordbookData`;
1041
+ let params = {
1042
+ wordbookId: id,
1043
+ fieldKeys: resFieldKeys,
1044
+ wordbookType: wordbookType || 'WORDBOOK',
1045
+ ...obj
1046
+ };
1047
+ return this.handleGetConfigApi(params, 'requestGetWordbookData', { fields: o }).then(res => {
1048
+ return res;
1049
+ });
1050
+ },
1051
+ handleWordbookData(item, data) {
1052
+ let { settingObj = {} } = item;
1053
+ let { showKeys = [], defaultValue, defaultValueTitle } = settingObj.wordbook || {};
1054
+ let defaultItem = null;
1055
+ if (defaultValue && defaultValueTitle) {
1056
+ defaultItem = {
1057
+ myName: defaultValue,
1058
+ showKeys: defaultValueTitle
1059
+ };
1060
+ }
1061
+ if (data && data.result) {
1062
+ // 数组赋值并添加唯一name
1063
+ let wordbookData = data.map.rows.map(row => {
1064
+ let showKeysStr = [];
1065
+ showKeys.forEach(ren => {
1066
+ showKeysStr.push(row[ren]);
1067
+ });
1068
+ return Object.assign(row, {
1069
+ myName: String(row[item.settingObj.wordbook.field_key]),
1070
+ showKeys: showKeysStr.join('')
1071
+ });
1072
+ });
1073
+ // 数组对象去重
1074
+ let obj = {};
1075
+ wordbookData = wordbookData.reduce((cur, next) => {
1076
+ obj[next.myName] ? '' : (obj[next.myName] = true && cur.push(next));
1077
+ return cur;
1078
+ }, []);
1079
+ if (defaultItem) {
1080
+ wordbookData.unshift(defaultItem);
1081
+ }
1082
+ this.$set(item, 'wordbookData', wordbookData);
1083
+ }
1084
+ },
1085
+ dropdownVisibleChange(open, item) {
1086
+ if (open) {
1087
+ let obj = {};
1088
+ if (item.settingObj?.wordbook?.params) {
1089
+ item.settingObj.wordbook.params.forEach(item => {
1090
+ obj[item.p_name] = item.p_value;
1091
+ });
1092
+ }
1093
+ if (item.settingObj?.wordbook) {
1094
+ obj.autograph = item.settingObj.wordbook.autograph;
1095
+ }
1096
+ this.curWordbookData = item.settingObj.wordbook;
1097
+ this.curAutograph = item.settingObj.wordbook && item.settingObj.wordbook.autograph;
1098
+ this.searchItem = item;
1099
+ if (item.settingObj.showSetting && item.settingObj.showSetting.length) {
1100
+ return;
1101
+ }
1102
+ this.getWordbookData(item.settingObj.wordbook, obj).then(({ data }) => {
1103
+ this.handleWordbookData(item, data);
1104
+ });
1105
+ }
1106
+ },
1107
+ /**
1108
+ * 输入自动联想
1109
+ */
1110
+ handleSearch(value, item) {
1111
+ let params = {
1112
+ keyword: value,
1113
+ autograph: this.curAutograph
1114
+ };
1115
+ let obj = {};
1116
+ if (item.settingObj?.wordbook?.params) {
1117
+ item.settingObj.wordbook.params.forEach(item => {
1118
+ obj[item.p_name] = item.p_value;
1119
+ });
1120
+ }
1121
+ Object.assign(params, obj);
1122
+
1123
+ this.getWordbookData(this.curWordbookData, params).then(({ data }) => {
1124
+ this.handleWordbookData(this.searchItem, data);
1125
+ });
1126
+ },
1127
+ handleSelect(value, item) {
1128
+ let { wordbookData = [], wordbookValueList = [] } = item;
1129
+ if (!wordbookData.length) return;
1130
+ let matchItem = wordbookData.find(v => v.myName === value);
1131
+ let hasItem = wordbookValueList.some(v => v.myName === value);
1132
+ if (hasItem) return;
1133
+ wordbookValueList.push(matchItem);
1134
+ },
1135
+ handleDeSelect(value, item) {
1136
+ let { wordbookValueList = [] } = item;
1137
+ let matchIndex = wordbookValueList.findIndex(v => v.myName === value);
1138
+ if (matchIndex < 0) return;
1139
+ wordbookValueList.splice(matchIndex, 1);
1140
+ },
1141
+
1142
+ selectChild(value, item, isInitSet, config = {}) {
1143
+ let attr = item?.settingObj?.attr || '';
1144
+ let arr = [
1145
+ 'TODAY',
1146
+ 'THIS_WEEK',
1147
+ 'THIS_MONTH',
1148
+ 'THIS_SEASON',
1149
+ 'THIS_YEAR',
1150
+ 'NULL',
1151
+ 'NOT_NULL',
1152
+ 'TOMORROW',
1153
+ 'YESTERDAY',
1154
+ 'NEXT_WEEK',
1155
+ 'UP_WEEK',
1156
+ 'NEXT_MONTH',
1157
+ 'UP_MONTH',
1158
+ 'NEXT_SEASON',
1159
+ 'UP_SEASON',
1160
+ 'NEXT_YEAR',
1161
+ 'UP_YEAR'
1162
+ ];
1163
+ let ageList = ['BIG', 'BIGEQ', 'LESS', 'LESSEQ'];
1164
+ // 自定义输入关系的“key”
1165
+ const customTypes = ['EQ', 'IN', 'NEQ'];
1166
+ const numbercustoms = ['EQ', 'NEQ', 'BIG', 'LESS', 'BIGEQ', 'LESSEQ'];
1167
+
1168
+ item.showRangeAge = false; // 年龄范围
1169
+ item.showAgeCom = false; // 年龄范围
1170
+ let inRelation = ['QUOTE_IN', 'QUOTE_NOTIN'];
1171
+ if (arr.includes(value)) {
1172
+ item.showInput = false;
1173
+ item.showSelect = false;
1174
+ item.showDate = false;
1175
+ item.showSearch = false;
1176
+ item.showRelation = false;
1177
+ this.initBirthdayParams(item);
1178
+ } else if (['IN_THE_PAST', 'IN_THE_FUTURE', 'N_', 'L_', 'IN_THE_PAST_DI', 'IN_THE_FUTURE_DI'].includes(value)) {
1179
+ // 以前、以后、过去内、未来内
1180
+ // L_ N_ IN_THE_PAST IN_THE_FUTURE 添加小时
1181
+ // 过去第 未来第
1182
+ // IN_THE_PAST_DI IN_THE_FUTURE_DI
1183
+ item.showSelect = true;
1184
+ item.showInput = true;
1185
+ item.showDate = false;
1186
+ item.showSearch = false;
1187
+ item.showRelation = false;
1188
+ if (value == 'IN_THE_PAST_DI' || value == 'IN_THE_FUTURE_DI') {
1189
+ this.$set(item, 'dateList', this.dateList);
1190
+ } else {
1191
+ let dateList = this.dateList.concat(this.dateTimeList);
1192
+ this.$set(item, 'dateList', dateList);
1193
+ }
1194
+ if (!isInitSet) {
1195
+ this.$set(item, 'unit', 'DAY');
1196
+ }
1197
+ this.initBirthdayParams(item);
1198
+ } else if (value == 'IN') {
1199
+ // field_key: "birthday"
1200
+ if (attr == 'BIRTHDAY') {
1201
+ item.showBirthdayDate = true;
1202
+ item.showDate = false;
1203
+ item.units = this.birthdayUnits.filter(i => i.units === 1);
1204
+ } else if (attr == 'AGE') {
1205
+ item.showRangeAge = true;
1206
+ } else {
1207
+ item.showDate = true;
1208
+ this.initBirthdayParams(item);
1209
+ }
1210
+ item.showSelect = false;
1211
+ item.showInput = false;
1212
+ item.showSearch = false;
1213
+ item.showRelation = false;
1214
+ } else if (value == 'CONVERT' || value == 'QUOTE' || value == 'QUOTE_NOT') {
1215
+ item.showDate = false;
1216
+ item.showSelect = false;
1217
+ item.showInput = false;
1218
+ item.showSearch = true;
1219
+ item.showRelation = false;
1220
+ this.initBirthdayParams(item);
1221
+ let showSetting = false;
1222
+ if (item.settingObj?.showSetting?.length) {
1223
+ showSetting = true;
1224
+ }
1225
+ // 这里wordbookValueList替换wordbookData 还是有点问题 需要根据具体场景再修改
1226
+ if (!showSetting && item.wordbookValueList?.length) {
1227
+ this.$set(item, 'wordbookData', item.wordbookValueList);
1228
+ }
1229
+ } else if (inRelation.includes(value)) {
1230
+ // 跨表查询
1231
+ item.showRelation = true;
1232
+ item.showInput = false;
1233
+ item.showSelect = false;
1234
+ item.showDate = false;
1235
+ item.showSearch = false;
1236
+ this.initBirthdayParams(item);
1237
+ } else if (attr == 'AGE') {
1238
+ if (ageList.includes(value)) {
1239
+ item.showAgeCom = true;
1240
+ }
1241
+ } else {
1242
+ item.showSelect = false;
1243
+ item.showDate = false;
1244
+ if (item.settingObj && item.settingObj.attr == 'BIRTHDAY') {
1245
+ item.showInput = false;
1246
+ } else {
1247
+ item.showInput = true;
1248
+ }
1249
+ item.showSearch = false;
1250
+ item.showRelation = false;
1251
+ this.initBirthdayParams(item);
1252
+ }
1253
+
1254
+ if (!this.showCompareField) return;
1255
+
1256
+ let s_type = config?.type;
1257
+ if (s_type === '_custom__input_') return;
1258
+
1259
+ if (customTypes.includes(value) || (['NUMBER', 'DATE', 'DATETIME', 'TIME'].includes(item.fieldType) && numbercustoms.includes(value))) {
1260
+ this.$set(item, 'is_compare_field', true);
1261
+ this.$set(item, 'customInput', false);
1262
+ this.handleSetSelectList(item);
1263
+ if (Array.isArray(item.selectList)) {
1264
+ // 默认选中第一
1265
+ if (item.selectList.length > 1) {
1266
+ let [a] = item.selectList;
1267
+ let compare_val = isInitSet? item.compare_field || a.value : a.value;
1268
+ this.$set(item, 'compare_field', compare_val);
1269
+ setTimeout(() => {
1270
+ // 里面递归调用 selectChild ,异步等待,第一个方法执行完成
1271
+ this.compare_fieldOnChange(compare_val, item);
1272
+ }, 100);
1273
+ } else {
1274
+ let selectList = item?.selectList || [];
1275
+ let len = selectList?.length || 0;
1276
+ let onlyCustomInput = len === 1 ? selectList[0].value === '_custom__input_' : false;
1277
+ // selectList 只有一个选项并且 是 _custom__input_ ,隐藏 select ,展示 customInput
1278
+ if (onlyCustomInput) {
1279
+ this.$set(item, 'customInput', true);
1280
+ item.compare_field = '_custom__input_';
1281
+ return;
1282
+ }
1283
+ }
1284
+ }
1285
+
1286
+ if (isInitSet) {
1287
+ // 如果是 is_compare_field 字段 并有值compare_field
1288
+ if (config.is_compare_field && item.compare_field) {
1289
+ this.$set(item, 'is_compare_field', true);
1290
+ } else if (item.start_val || item.end_val || item.value || item.wordValue || item.showSelect) {
1291
+ // 自定义输入回填
1292
+ this.$set(item, 'customInput', true);
1293
+ item.compare_field = '_custom__input_';
1294
+ return;
1295
+ }
1296
+ }
1297
+ this.handleHideItem(item, false);
1298
+ } else {
1299
+ item.customInput = true;
1300
+ item.is_compare_field = false;
1301
+ item['compare_field'] && (item['compare_field'] = undefined);
1302
+ }
1303
+ },
1304
+ handleHideItem(item, reset = true) {
1305
+ item.showRangeAge = false; // 年龄范围
1306
+ item.showAgeCom = false; // 年龄范围
1307
+ item.showInput = false;
1308
+ item.showSelect = false;
1309
+ item.showDate = false;
1310
+ item.showSearch = false;
1311
+ item.showRelation = false;
1312
+
1313
+ // item.value = "";
1314
+ // this.$set(item, 'value', '');
1315
+ reset && this.$set(item, 'value', '');
1316
+ },
1317
+ disabledStartDate(start_val) {
1318
+ const end_val = this.end_val;
1319
+ if (!start_val || !end_val) {
1320
+ return false;
1321
+ }
1322
+ return start_val.valueOf() > end_val.valueOf();
1323
+ },
1324
+ disabledEndDate(end_val) {
1325
+ const start_val = this.start_val;
1326
+ if (!end_val || !start_val) {
1327
+ return false;
1328
+ }
1329
+ return start_val.valueOf() >= end_val.valueOf();
1330
+ },
1331
+ handleStartOpenChange(open, item) {
1332
+ if (!open) {
1333
+ this.$set(item, 'endOpen', true);
1334
+ }
1335
+ },
1336
+ handleEndOpenChange(open, item) {
1337
+ this.$set(item, 'endOpen', open);
1338
+ },
1339
+ // 日期选择范围
1340
+ disabledDate(current) {
1341
+ return (current && current < moment().startOf('year')) || current > moment().endOf('year');
1342
+ },
1343
+ changeRange(value, item) {
1344
+ let res = [];
1345
+ if (value.length > 0) {
1346
+ value.forEach(item => {
1347
+ item._d && res.push(utils.formatTime('MOUTH', item._d));
1348
+ });
1349
+ }
1350
+ if (res.length > 0) {
1351
+ item.curlimit_date = res.join('~');
1352
+ }
1353
+ },
1354
+ // 选择关联表
1355
+ handlerSelectRelation(e, item) {
1356
+ let curItem = this.relationTableList.find(v => v.tableId === e);
1357
+ curItem && (item.relationField = curItem.relationField);
1358
+ item.relationFieldList = JSON.parse(JSON.stringify(curItem?.fieldList?.fieldList || []));
1359
+ item.converFun = curItem.converFun || undefined;
1360
+ item.parameterConversionId = curItem.parameterConversionId || undefined;
1361
+ item.relationOrgId = curItem.relationOrgId || undefined;
1362
+ item.preConObj = curItem.preConObj || undefined;
1363
+ item.preSqlExpression = curItem.preSqlExpression || undefined;
1364
+ },
1365
+ openRelationFilter(data, i) {
1366
+ this.clcikRelationIndex = i;
1367
+ this.relationAction = data.quote_con;
1368
+ this.relationSearchFieldList = data.relationFieldList;
1369
+ this.relationVisible = true;
1370
+ // sqlExpression
1371
+ },
1372
+ relationCancel() {
1373
+ this.relationVisible = false;
1374
+ this.relationAction = {};
1375
+ this.relationSearchFieldList = [];
1376
+ },
1377
+ relationSave(data) {
1378
+ let { setting = '' } = data;
1379
+ let settingObj = JSON.parse(setting);
1380
+ this.actionList[this.clcikRelationIndex].quote_con = {
1381
+ conObj: settingObj.conObj,
1382
+ sqlExpression: settingObj.sqlExpression
1383
+ };
1384
+ this.relationCancel();
1385
+ },
1386
+ initBirthdayParams(item) {
1387
+ item.showBirthdayDate = false;
1388
+ item.unit = item.unit || 'YEAR';
1389
+ item.units = this.birthdayUnits.filter(i => i.units === 1);
1390
+ },
1391
+ handleParentNamesAdd(e) {
1392
+ const nextInput = e?.target?.nextElementSibling;
1393
+ setTimeout(() => {
1394
+ nextInput && nextInput.focus();
1395
+ });
1396
+ this.showAdd = true;
1397
+ },
1398
+ hanldeBlur() {
1399
+ this.showAdd = false;
1400
+ if (!this.addVal) return;
1401
+ this.parentNames.forEach(v => (v.selected = false));
1402
+ this.parentNames.push({
1403
+ disabled: true,
1404
+ value: this.addVal,
1405
+ selected: true,
1406
+ isAdd: true
1407
+ });
1408
+ this.addVal = '';
1409
+ },
1410
+ editParentName(e, item) {
1411
+ item.disabled = false;
1412
+ setTimeout(() => {
1413
+ e.target.focus();
1414
+ }, 0);
1415
+ },
1416
+ handleParentNameSelect(item, index) {
1417
+ if (!item.disabled) return;
1418
+ this.parentNames.forEach((pItem, pIndex) => {
1419
+ if (pIndex !== index) {
1420
+ pItem.selected = false;
1421
+ }
1422
+ });
1423
+ item.selected = !item.selected;
1424
+ },
1425
+ handleParentNamesRemove(index, item) {
1426
+ // this.parentNames.splice(index, 1);
1427
+ this.handleParent(index, item);
1428
+ },
1429
+ handleParent(index, item) {
1430
+ let { conditionList } = this;
1431
+ if (!conditionList || !conditionList.length) {
1432
+ this.parentNames.splice(index, 1);
1433
+ return;
1434
+ }
1435
+ let hasItem = conditionList.filter(v => v.displayCategory === item.value);
1436
+ if (!hasItem || !hasItem.length) {
1437
+ this.parentNames.splice(index, 1);
1438
+ return;
1439
+ }
1440
+ this.$message.error('该分类下有已有数据,请删除该分类下的筛选集后重试!');
1441
+ },
1442
+ getParentSelectedStyle(item) {
1443
+ if (item.selected && item.disabled) {
1444
+ return {
1445
+ backgroundColor: '#2D7AFF',
1446
+ color: '#fff'
1447
+ };
1448
+ }
1449
+ return null;
1450
+ },
1451
+
1452
+ // 年龄组件变化
1453
+ ageRangeOnChange(obj, item) {
1454
+ let s = obj.star_val;
1455
+ let e = obj.end_val;
1456
+ this.$set(item, 'start_val', isNaN(s) ? undefined : s);
1457
+ this.$set(item, 'end_val', isNaN(e) ? undefined : e);
1458
+ },
1459
+
1460
+ agecomOnChange(obj, item) {
1461
+ this.$set(item, 'value', isNaN(obj.days) ? undefined : obj.days);
1462
+ },
1463
+
1464
+ diffTime(days) {
1465
+ let d = +days;
1466
+ if (isNaN(d)) return {};
1467
+ if (typeof d == 'number') {
1468
+ let next = 0;
1469
+ let year = Math.floor(d / 365);
1470
+ next = d % 365;
1471
+ let month = Math.floor(next / 30);
1472
+ next = next % 30;
1473
+ let day = next;
1474
+
1475
+ return { year, month, day, d };
1476
+ }
1477
+ return {};
1478
+ },
1479
+
1480
+ filterOption(...arg) {
1481
+ return utils.filterOption(...arg);
1482
+ },
1483
+
1484
+ /**
1485
+ * 选中字段
1486
+ */
1487
+ handleSetSelectList(item) {
1488
+ let list = this.searchList
1489
+ .filter(v => v.fieldType == item.fieldType && (this.isBI ? v.fieldId : v.columnName) != item.field_key)
1490
+ .map(v => {
1491
+ return {
1492
+ value: this.isBI ? v.fieldId : v.columnName,
1493
+ name: v.alias || v.title
1494
+ };
1495
+ });
1496
+
1497
+ list.unshift({
1498
+ value: '_custom__input_',
1499
+ name: '自定义输入'
1500
+ });
1501
+
1502
+ this.$set(item, 'selectList', list);
1503
+ },
1504
+
1505
+ /**
1506
+ * 切换字段选项
1507
+ */
1508
+ compare_fieldOnChange(e, item) {
1509
+ if (e === '_custom__input_') {
1510
+ item.customInput = true;
1511
+ this.selectChild(item.con, item, false, { type: '_custom__input_' });
1512
+ } else {
1513
+ item.customInput = false;
1514
+ this.$set(item, 'value', '');
1515
+ }
1516
+ },
1517
+
1518
+ checkCustomInput(item) {
1519
+ /**
1520
+ * 判断可选的 是否 只有 “_custom__input_”
1521
+ */
1522
+ let selectList = item?.selectList || [];
1523
+ let len = selectList?.length || 0;
1524
+ let onlyCustomInput = len === 1 ? selectList[0].value === '_custom__input_' : false;
1525
+ return onlyCustomInput;
1526
+ },
1527
+
1528
+ visibleCompareField(item) {
1529
+ if (!this.showCompareField) return false;
1530
+ let onlyCustomInput = this.checkCustomInput(item);
1531
+ /**
1532
+ * 展示 compare_field 条件
1533
+ * 1. 是is_compare_field 字段 并且有字段可选
1534
+ */
1535
+ return item.is_compare_field && !onlyCustomInput;
1536
+ },
1537
+
1538
+ visibleDefaultField(item) {
1539
+ /**
1540
+ * 展示默认字段的条件
1541
+ * 1. is_compare_field 字段
1542
+ * 2. 是 is_compare_field 字段,选中 自定义输入 is_compare_field
1543
+ * 3. 是 is_compare_field 字段 ,没有可选的 onlyCustomInput
1544
+ */
1545
+ if (!this.showCompareField) return true;
1546
+ let onlyCustomInput = this.checkCustomInput(item);
1547
+ return item.customInput || !item.is_compare_field || onlyCustomInput;
1548
+ },
1549
+
1550
+ handleHideCompareField(item) {
1551
+ if (!this.showCompareField) return;
1552
+ item.customInput = false;
1553
+ item.is_compare_field = false;
1554
+ item.compare_field = undefined;
1555
+ },
1556
+
1557
+ checkActionList() {
1558
+ let f = this.actionList.every(v => !v.field_key);
1559
+ return f;
1560
+ },
1561
+
1562
+ /**
1563
+ * select 变化
1564
+ */
1565
+ fieldselectONchange(item, eventName, value, vnode) {
1566
+ // 清空操作
1567
+ if (value === undefined) {
1568
+ eventName === 'changeColumnName' && this.handleResetColumnName(item);
1569
+ eventName === 'selectChild' && this.handleResetSelectChild(item);
1570
+ }
1571
+ },
1572
+
1573
+ handleResetColumnName(item) {
1574
+ item.con = undefined;
1575
+ this.$set(item, 'wordValue', []);
1576
+ this.$set(item, 'wordbookData', []);
1577
+ this.handleHideItem(item);
1578
+ },
1579
+
1580
+ handleResetSelectChild(item) {
1581
+ this.$set(item, 'wordValue', []);
1582
+ this.$set(item, 'wordbookData', []);
1583
+ this.$set(item, 'value', undefined);
1584
+ this.$set(item, 'showSelect', undefined);
1585
+ this.$set(item, 'start_val', null);
1586
+ this.$set(item, 'end_val', null);
1587
+ this.handleHideItem(item);
1588
+ }
1589
+ }
1590
+ });
1591
+ </script>
1592
+
1593
+ <style lang="less" scoped>
1594
+ .inner-content {
1595
+ color: #000;
1596
+ & > p > span {
1597
+ cursor: pointer;
1598
+ }
1599
+ .item-name {
1600
+ display: flex;
1601
+ height: 32px;
1602
+ line-height: 32px;
1603
+ margin-bottom: 10px;
1604
+ .label {
1605
+ width: 120px;
1606
+ text-align: right;
1607
+ }
1608
+ }
1609
+ .parent-names {
1610
+ display: flex;
1611
+ align-items: center;
1612
+ flex-wrap: wrap;
1613
+ line-height: 32px;
1614
+ .label {
1615
+ display: inline-block;
1616
+ height: 32px;
1617
+ line-height: 32px;
1618
+ margin-bottom: 10px;
1619
+ width: 120px;
1620
+ text-align: right;
1621
+ }
1622
+ /deep/ .ant-btn-dashed {
1623
+ border-color: #a6a6a6;
1624
+ color: #a6a6a6;
1625
+ }
1626
+
1627
+ .edit-tag {
1628
+ position: relative;
1629
+ margin-right: 10px;
1630
+ margin-bottom: 10px;
1631
+ /deep/ .anticon-close {
1632
+ position: absolute;
1633
+ right: 5px;
1634
+ line-height: 36px;
1635
+ color: #2d7aff;
1636
+ }
1637
+ /deep/ .ant-input-disabled {
1638
+ color: #2d7aff;
1639
+ background-color: rgba(45, 122, 255, 0.1);
1640
+ opacity: 1;
1641
+ border-color: #2d7aff;
1642
+ cursor: pointer;
1643
+ }
1644
+ /deep/.ant-input-group-addon,
1645
+ /deep/.ant-input:not(:hover),
1646
+ /deep/.ant-input-number:not(:hover) {
1647
+ border-color: #2d7aff !important;
1648
+ }
1649
+ &.edit-tag-select {
1650
+ /deep/ .ant-input-disabled {
1651
+ color: #fff;
1652
+ background-color: #2d7aff;
1653
+ }
1654
+ /deep/ .anticon-close {
1655
+ color: #fff;
1656
+ }
1657
+ }
1658
+ }
1659
+ /deep/ .ant-btn {
1660
+ margin-bottom: 10px;
1661
+ }
1662
+ }
1663
+ .item-list {
1664
+ padding-top: 12px;
1665
+ margin-top: 16px;
1666
+ margin-bottom: 6px;
1667
+ border-top: 1px solid #e6e6e6;
1668
+ &.list-onlyCondition {
1669
+ padding-top: 0;
1670
+ border-top: 0px;
1671
+ }
1672
+ li {
1673
+ margin-bottom: 10px;
1674
+ }
1675
+ .form-item {
1676
+ width: 120px;
1677
+ margin-right: 10px;
1678
+ }
1679
+ .form-action {
1680
+ font-size: 16px;
1681
+ float: right;
1682
+ margin-top: 6px;
1683
+ cursor: pointer;
1684
+ }
1685
+ .date-item {
1686
+ display: inline-block;
1687
+ }
1688
+ .birthday-item {
1689
+ > div {
1690
+ display: inline-block;
1691
+ margin-top: 5px;
1692
+ p {
1693
+ display: inline-block;
1694
+ margin: 0 10px 0 15px;
1695
+ }
1696
+ > span {
1697
+ margin-top: 5px;
1698
+ }
1699
+ }
1700
+ .age-wrap {
1701
+ display: inline-block;
1702
+ }
1703
+ }
1704
+ .relation-item {
1705
+ display: inline-block;
1706
+ .relation-width {
1707
+ width: 150px;
1708
+ margin-right: 10px;
1709
+ }
1710
+ .relation-btn {
1711
+ cursor: pointer;
1712
+ }
1713
+ }
1714
+ .range-container {
1715
+ display: inline-block;
1716
+ width: 442px;
1717
+ /* line-height: 1.5; */
1718
+ vertical-align: bottom;
1719
+ }
1720
+ .item-error {
1721
+ color: red;
1722
+ display: inline-block;
1723
+ }
1724
+ }
1725
+ .index-span {
1726
+ width: 30px;
1727
+ display: inline-block;
1728
+ }
1729
+ }
1730
+ .blue {
1731
+ color: #2d7aff;
1732
+ margin-right: 8px;
1733
+ }
1734
+ .red {
1735
+ color: #e02020;
1736
+ }
1737
+
1738
+ .in-block {
1739
+ display: inline-block;
1740
+ }
1741
+ </style>
1742
+
1743
+ <style lang="less">
1744
+ // 专业模式下的样式修改
1745
+ ._c_com-search-professional {
1746
+ .inner-content {
1747
+ .item-list {
1748
+ > li {
1749
+ position: relative;
1750
+ .def_item_input {
1751
+ position: absolute;
1752
+ width: 100%;
1753
+ }
1754
+ .show-small-select {
1755
+ .val-small-select-wrap {
1756
+ width: 66px !important;
1757
+ }
1758
+ .val-input-wrap {
1759
+ width: 34% !important;
1760
+ }
1761
+ }
1762
+ }
1763
+ }
1764
+
1765
+ .item-error {
1766
+ display: block;
1767
+ padding-left: 29px;
1768
+ }
1769
+ .form-action {
1770
+ position: absolute;
1771
+ right: 0px;
1772
+ top: 0;
1773
+ }
1774
+ }
1775
+
1776
+ .select-front-item {
1777
+ width: 23% !important;
1778
+ }
1779
+ .val-input-wrap {
1780
+ width: 42%;
1781
+ display: inline-block;
1782
+ .ant-input {
1783
+ width: 100% !important;
1784
+ }
1785
+ }
1786
+ .val-select-wrap,
1787
+ .val-age-wrap,
1788
+ .val-date-wrap {
1789
+ width: 42% !important;
1790
+
1791
+ .ant-calendar-picker {
1792
+ width: 50% !important;
1793
+ }
1794
+ }
1795
+
1796
+ .val-range-wrap {
1797
+ width: 42% !important;
1798
+ .ant-input-group {
1799
+ .age-com {
1800
+ // 年龄组件 单位
1801
+ .age-com-suffix {
1802
+ padding: 0 1px;
1803
+ }
1804
+ .ant-input-number {
1805
+ // 修改宽度
1806
+ width: 100%;
1807
+ // 隐藏数字操作项
1808
+ .ant-input-number-handler-wrap {
1809
+ display: none;
1810
+ }
1811
+ // 修改inputpadding
1812
+ .ant-input-number-input-wrap {
1813
+ input {
1814
+ padding: 0 2px;
1815
+ }
1816
+ }
1817
+ }
1818
+ }
1819
+ }
1820
+ }
1821
+ .teavalue-wrap {
1822
+ width: calc(88% + 20px);
1823
+ }
1824
+ }
1825
+ </style>