cnhis-design-vue 2.1.140 → 2.1.141

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 (46) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/es/age/index.js +2 -2
  3. package/es/big-table/index.js +26 -26
  4. package/es/button/index.js +2 -2
  5. package/es/captcha/index.js +3 -3
  6. package/es/card-reader-sdk/index.js +1 -1
  7. package/es/checkbox/index.js +1 -1
  8. package/es/color-picker/index.js +1 -1
  9. package/es/drag-layout/index.js +3 -3
  10. package/es/editor/index.js +1 -1
  11. package/es/ellipsis/index.js +1 -1
  12. package/es/fabric-chart/index.js +278 -142
  13. package/es/form-table/index.js +20 -20
  14. package/es/full-calendar/index.js +4 -4
  15. package/es/index/index.js +523 -348
  16. package/es/index/style.css +1 -1
  17. package/es/input/index.js +1 -1
  18. package/es/map/index.js +1 -1
  19. package/es/multi-chat/index.js +25 -25
  20. package/es/multi-chat-client/index.js +19 -19
  21. package/es/multi-chat-history/index.js +4 -4
  22. package/es/multi-chat-record/index.js +4 -4
  23. package/es/multi-chat-setting/index.js +20 -20
  24. package/es/multi-chat-sip/index.js +1 -1
  25. package/es/radio/index.js +1 -1
  26. package/es/scale-container/index.js +1 -1
  27. package/es/scale-view/index.js +27 -27
  28. package/es/select/index.js +4 -4
  29. package/es/select-label/index.js +3 -3
  30. package/es/select-person/index.js +32 -28
  31. package/es/select-person/style.css +1 -1
  32. package/es/select-tag/index.js +4 -4
  33. package/es/shortcut-setter/index.js +2 -2
  34. package/es/slider-tree/index.js +1 -1
  35. package/es/table-filter/index.js +71 -36
  36. package/es/tag/index.js +1 -1
  37. package/es/verification-code/index.js +2 -2
  38. package/lib/cui.common.js +549 -374
  39. package/lib/cui.umd.js +549 -374
  40. package/lib/cui.umd.min.js +8 -8
  41. package/package.json +1 -1
  42. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +88 -6
  43. package/packages/select-person/select-person.vue +76 -67
  44. package/packages/table-filter/src/components/render-widget/components/CheckboxGroup.vue +18 -4
  45. package/packages/table-filter/src/components/render-widget/index.vue +2 -2
  46. package/packages/table-filter/src/components/render-widget/widgetCfgMaps.js +2 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
- "version": "2.1.140",
3
+ "version": "2.1.141",
4
4
  "description": "前端业务UI库",
5
5
  "keyword": "cnhis-design-vue vue cnhis",
6
6
  "homepage": "http://dv.cnhis.com/",
@@ -14,7 +14,7 @@ import DropPopup from '../components/DropPopup';
14
14
  import MouseRightClick from '../components/MouseRightClick';
15
15
  import eventCommon from '../mixins/eventCommon';
16
16
  import Bus from '../utils/bus';
17
- import { cloneDeep } from 'lodash';
17
+ import { cloneDeep, isNumber } from 'lodash';
18
18
  import { sortByTime } from '../utils';
19
19
 
20
20
  const rightClickNode = [
@@ -69,6 +69,8 @@ export default {
69
69
  data() {
70
70
  this.markData = sortByTime(cloneDeep(this.templateData.bottom?.list));
71
71
  this.markObjs = [];
72
+ this.otherListPointHeightRange = [];
73
+ this.inputObj = null;
72
74
  return {
73
75
  leftStartX: 0,
74
76
  isDropVisible: false,
@@ -79,7 +81,11 @@ export default {
79
81
  activeEvent: null // 当前可右键活动的对象
80
82
  };
81
83
  },
82
- mounted() {},
84
+ mounted() {
85
+ setTimeout(() => {
86
+ document.addEventListener('keydown', this.handleInputBoxEnterEvent, true);
87
+ });
88
+ },
83
89
  computed: {
84
90
  girdLineStyle() {
85
91
  return Object.assign({}, defaultVaule.borderStyle, this.templateData.borderStyle || {});
@@ -123,18 +129,82 @@ export default {
123
129
  },
124
130
  createEvent() {
125
131
  this.canvas.on('mouse:up', event => {
126
- if (event.button === 3) {
127
- const { x, y } = event.pointer;
128
- if (this.isGridLimit(x, y)) {
132
+ const { button, target, pointer } = event;
133
+ const { x, y } = pointer;
134
+ if (this.isGridLimit(x, y)) {
135
+ if (button === 3) {
129
136
  this.activeEvent = event;
130
137
  !this.isAddEventListenerContextmenu && this.canvas.wrapperEl.addEventListener('contextmenu', this.addEventListenerContextmenu, true);
131
138
  this.isAddEventListenerContextmenu = true;
132
139
  }
140
+ if (button === 1) {
141
+ if (!this.otherListPointHeightRange?.length || this.inputObj) return;
142
+ if (target?.id && (!target?.id?.includes('_other') || target?.type !== 'list')) return;
143
+ let content = '';
144
+ if (target) {
145
+ if (target.moving) {
146
+ target.moving = false;
147
+ return;
148
+ } else {
149
+ content = target.origin?.value?.toString();
150
+ }
151
+ }
152
+ const item = this.otherListPointHeightRange.find(({ y1, y2 }) => y >= y1 && y <= y2);
153
+ if (isNumber(item?.dataIndex)) {
154
+ this.inputObj = new this.fabric.Textbox(content, {
155
+ left: x,
156
+ top: y,
157
+ width: 100,
158
+ height: 100,
159
+ fontSize: 18,
160
+ objectCaching: false,
161
+ hasControls: false,
162
+ borderColor: '#000',
163
+ editingBorderColor: '#000',
164
+ backgroundColor: '#fff',
165
+ fontFamily: '微软雅黑',
166
+ otherListPointHeightRangeItem: { ...item, left: x, target }
167
+ });
168
+ this.canvas.add(this.inputObj).setActiveObject(this.inputObj);
169
+ this.inputObj.enterEditing();
170
+ if (content) {
171
+ this.inputObj.setSelectionEnd(content.length);
172
+ }
173
+ }
174
+ }
175
+ }
176
+ });
177
+
178
+ this.canvas.on('selection:cleared', ({ deselected }) => {
179
+ if (deselected?.find(obj => obj.otherListPointHeightRangeItem)) {
180
+ let { text, otherListPointHeightRangeItem } = this.inputObj;
181
+ text = text.replace(/^\s+|\s+$/g, '');
182
+ this.canvas.remove(this.inputObj);
183
+ this.inputObj = null;
184
+ if (!text) return;
185
+ const { dataList, left, target } = otherListPointHeightRangeItem;
186
+ if (target) {
187
+ const params = this.getOtherParams(target);
188
+ if (text == target.origin?.value) return
189
+ this.$emit('otherChange', { ...params, data: { ...params.data, value: text } });
190
+ } else {
191
+ const index = dataList.findIndex(_left => _left > left);
192
+ const params = this.getOtherParams(otherListPointHeightRangeItem);
193
+ this.$emit('addOhter', { ...params, index: !~index ? dataList.length : index, data: { ...params.data, value: text } });
194
+ }
133
195
  }
134
196
  });
135
197
 
136
198
  Bus.$on('deleteOther', otherList => this.$emit('deleteOther', otherList));
137
199
  },
200
+ handleInputBoxEnterEvent(e) {
201
+ if (!this.inputObj || ![13, 27].includes(e.keyCode)) return;
202
+ if (e.keyCode === 27) {
203
+ this.inputObj.text = '';
204
+ }
205
+ this.inputObj.exitEditing();
206
+ this.canvas.discardActiveObject(this.inputObj);
207
+ },
138
208
  // 打开右键菜单
139
209
  openRightModal() {
140
210
  // 一下方法不会生效,因为,polylines组件中timeRangeData.enabled设置为false操作晚于当前操作,需换一种方式
@@ -288,6 +358,7 @@ export default {
288
358
  this.canvas.add(...textList);
289
359
  },
290
360
  async drawTextDataGroupList(list) {
361
+ this.otherListPointHeightRange = [];
291
362
  let textList = [];
292
363
  const { originX, originY } = this.propItems;
293
364
  let top = originY + 10;
@@ -317,6 +388,13 @@ export default {
317
388
  });
318
389
  this.setMovingEvent(title, originOptions);
319
390
  textList.push(title);
391
+ this.otherListPointHeightRange.push({
392
+ type: 'list',
393
+ dataIndex: index,
394
+ dataList: title.dataList,
395
+ y1: top - title.height / 2,
396
+ y2: top + title.height / 2
397
+ });
320
398
  const { icon: _icon = { type: 'circle' }, dataList } = item || {};
321
399
  let prevPoint;
322
400
  for (let i = 0, len = dataList.length; i < len; i++) {
@@ -412,7 +490,7 @@ export default {
412
490
  const index = dataList.findIndex(_left => _left > left);
413
491
  // 使用定时器,是因为:防止上方移除重绘过慢新增完后再次触发移除重绘导致页面多次重绘节点
414
492
  setTimeout(() => {
415
- this.$emit('addOhter', { ...this.getOtherParams(point), index: !~index ? (dataList.length ? dataList.length - 1 : 0) : index });
493
+ this.$emit('addOhter', { ...this.getOtherParams(point), index: !~index ? dataList.length : index });
416
494
  });
417
495
  }
418
496
  });
@@ -424,6 +502,7 @@ export default {
424
502
  if (this.eventStyle.evented) {
425
503
  const { endX, originX } = this.propItems;
426
504
  point.on('moving', () => {
505
+ point.moving = true;
427
506
  point.setCoords();
428
507
  const { prevPoint, nextPoint } = point;
429
508
  const limitLeft = prevPoint?.left || originX;
@@ -825,6 +904,9 @@ export default {
825
904
  );
826
905
  }
827
906
  }
907
+ },
908
+ beforeDestroy() {
909
+ document.removeEventListener('keydown', this.handleInputBoxEnterEvent);
828
910
  }
829
911
  };
830
912
  </script>
@@ -18,70 +18,72 @@
18
18
  <div class="type-btn" :class="{ 'type-active': typeActiveIndex === 1 }" @click="onTypeClick(1)">选科室</div>
19
19
  <div class="type-btn" :class="{ 'type-active': typeActiveIndex === 2 }" @click="onTypeClick(2)">选角色</div>
20
20
  </div>
21
- <template v-if="!isSingleCheck">
22
- <a-checkbox v-if="searchTreeVisable" v-model="searchChecked" :indeterminate="searchIndeterminate" @change="radioChange">
23
- <!-- {{ $t("1.10.139") }} -->
24
- 全选
25
- </a-checkbox>
26
-
27
- <a-checkbox v-else v-model="singleChecked" :indeterminate="indeterminate" @change="radioChange">
28
- <!-- {{ $t("1.10.139") }} -->
29
- 全选
30
- </a-checkbox>
31
- </template>
32
-
33
- <div v-show="search.status == 3 || (search.status == 0 && treeData.temp && treeData.temp.length == 0)" class="no-data-tips">
34
- 查无结果
35
- </div>
36
- <!-- main tree -->
37
- <a-tree
38
- class="main-tree-container"
39
- v-show="search.status == 0"
40
- ref="antTree"
41
- v-model="checkedKeys.temp"
42
- @expand="onExpand"
43
- @check="onTreeCheck"
44
- checkable
45
- :expandedKeys="expandedKeys"
46
- :autoExpandParent="autoExpandParent"
47
- :checkStrictly="checkStrictly"
48
- :selectable="false"
49
- :treeData="treeData.temp"
50
- :load-data="getLoadChildData"
51
- :disabled="isDetail"
52
- >
53
- <template slot="custom" slot-scope="scope">
54
- <span v-if="scope.isLeaf">
55
- <a-tooltip :title="`${scope.title} ${scope.sub_title}`" :mouseEnterDelay="0.3">
56
- <span class="c-title">{{ scope.title || scope.key }}&thinsp; </span>
57
- <span class="c-sub-title">{{ scope.sub_title }}</span>
58
- </a-tooltip>
59
- </span>
60
- <span v-else class="p-title">
61
- <span v-if="scope.title">{{ scope.title }}</span>
62
- <span v-else>{{ scope.key }}</span>
63
- {{ treeCount(scope.count) }}
64
- </span>
21
+ <div class="tree-wrap">
22
+ <template v-if="!isSingleCheck">
23
+ <a-checkbox v-if="searchTreeVisable" v-model="searchChecked" :indeterminate="searchIndeterminate" @change="radioChange">
24
+ <!-- {{ $t("1.10.139") }} -->
25
+ 全选
26
+ </a-checkbox>
27
+
28
+ <a-checkbox v-else v-model="singleChecked" :indeterminate="indeterminate" @change="radioChange">
29
+ <!-- {{ $t("1.10.139") }} -->
30
+ 全选
31
+ </a-checkbox>
65
32
  </template>
66
- </a-tree>
67
- <!-- search tree -->
68
- <searchTree
69
- v-on="$listeners"
70
- ref="searchTree"
71
- :visable="searchTreeVisable"
72
- :formatTreeData="treeData.search"
73
- :searchValue="searchValue"
74
- :allCheckedKeys="checkedKeys"
75
- :defaultExpandedKeys="search.defaultExpandedKeys"
76
- :dataListKeys="search.dataListKeys"
77
- :searchNoMore="searchNoMore"
78
- :loadMorenLoadinng="loadMorenLoadinng"
79
- @addCheckedkeysMain="addCheckedkeysMain"
80
- @removeCheckedkeysMain="removeCheckedkeysMain"
81
- @addCheckedkeysOther="addCheckedkeysOther"
82
- @removeCheckedkeysOther="removeCheckedkeysOther"
83
- @searchOnloadMore="searchOnloadMore"
84
- ></searchTree>
33
+
34
+ <div v-show="search.status == 3 || (search.status == 0 && treeData.temp && treeData.temp.length == 0)" class="no-data-tips">
35
+ 查无结果
36
+ </div>
37
+ <!-- main tree -->
38
+ <a-tree
39
+ class="main-tree-container"
40
+ v-show="search.status == 0"
41
+ ref="antTree"
42
+ v-model="checkedKeys.temp"
43
+ @expand="onExpand"
44
+ @check="onTreeCheck"
45
+ checkable
46
+ :expandedKeys="expandedKeys"
47
+ :autoExpandParent="autoExpandParent"
48
+ :checkStrictly="checkStrictly"
49
+ :selectable="false"
50
+ :treeData="treeData.temp"
51
+ :load-data="getLoadChildData"
52
+ :disabled="isDetail"
53
+ >
54
+ <template slot="custom" slot-scope="scope">
55
+ <span v-if="scope.isLeaf">
56
+ <a-tooltip :title="`${scope.title} ${scope.sub_title}`" :mouseEnterDelay="0.3">
57
+ <span class="c-title">{{ scope.title || scope.key }}&thinsp; </span>
58
+ <span class="c-sub-title">{{ scope.sub_title }}</span>
59
+ </a-tooltip>
60
+ </span>
61
+ <span v-else class="p-title">
62
+ <span v-if="scope.title">{{ scope.title }}</span>
63
+ <span v-else>{{ scope.key }}</span>
64
+ {{ treeCount(scope.count) }}
65
+ </span>
66
+ </template>
67
+ </a-tree>
68
+ <!-- search tree -->
69
+ <searchTree
70
+ v-on="$listeners"
71
+ ref="searchTree"
72
+ :visable="searchTreeVisable"
73
+ :formatTreeData="treeData.search"
74
+ :searchValue="searchValue"
75
+ :allCheckedKeys="checkedKeys"
76
+ :defaultExpandedKeys="search.defaultExpandedKeys"
77
+ :dataListKeys="search.dataListKeys"
78
+ :searchNoMore="searchNoMore"
79
+ :loadMorenLoadinng="loadMorenLoadinng"
80
+ @addCheckedkeysMain="addCheckedkeysMain"
81
+ @removeCheckedkeysMain="removeCheckedkeysMain"
82
+ @addCheckedkeysOther="addCheckedkeysOther"
83
+ @removeCheckedkeysOther="removeCheckedkeysOther"
84
+ @searchOnloadMore="searchOnloadMore"
85
+ ></searchTree>
86
+ </div>
85
87
  </div>
86
88
  <!-- 树已选的数据 -->
87
89
  <div class="select-wrap">
@@ -427,6 +429,11 @@ export default create({
427
429
  handler() {
428
430
  this.$set(this.dataList, 'main', []);
429
431
  this.$set(this.dataList, 'dept', []);
432
+ this.$set(this.checkedKeys, 'main', []);
433
+ this.$set(this.checkedKeys, 'dept', []);
434
+ this.$set(this.checkedKeys, 'temp', []);
435
+ this.singleChecked = false;
436
+ this.indeterminate = false;
430
437
  this.handleData();
431
438
  this.staticDataInit();
432
439
  this.staticDeptAndRoleDataInit();
@@ -453,17 +460,16 @@ export default create({
453
460
  if (this.getLoadChildData) {
454
461
  this.getDefaultList();
455
462
  } else {
456
- this.$nextTick(() => {
463
+ setTimeout(() => {
457
464
  const userIds = this.defaultList.filter(item => item.itemType === 'person').map(item => item.id);
458
465
  const deptIds = this.defaultList.filter(item => item.itemType === 'dept').map(item => item.id);
459
466
  const roleIds = this.defaultList.filter(item => item.itemType === 'role').map(item => item.id);
460
467
  const key = ['main', 'dept', 'role'][this.typeActiveIndex];
461
- console.log(deptIds, key, '666 init');
462
468
  this.checkedKeys.main = userIds;
463
469
  this.checkedKeys.dept = deptIds;
464
470
  this.checkedKeys.role = roleIds;
465
471
  this.checkedKeys.temp = this.checkedKeys[key];
466
- });
472
+ }, 300);
467
473
  }
468
474
  },
469
475
 
@@ -1527,7 +1533,6 @@ export default create({
1527
1533
  padding: 22px 12px 0;
1528
1534
  max-height: 376px;
1529
1535
  height: 376px;
1530
- overflow-y: auto;
1531
1536
  &.people-tree-left {
1532
1537
  display: flex;
1533
1538
  flex-direction: column;
@@ -1550,6 +1555,10 @@ export default create({
1550
1555
  border-bottom-left-radius: 0;
1551
1556
  }
1552
1557
  }
1558
+ .tree-wrap {
1559
+ flex: 1;
1560
+ overflow-y: auto;
1561
+ }
1553
1562
  /deep/ .main-tree-container {
1554
1563
  > li {
1555
1564
  width: 100%;
@@ -14,10 +14,10 @@ export default {
14
14
  value: {
15
15
  type: [Array, String, Number],
16
16
  },
17
- multiple: {
18
- type: Boolean,
19
- default: false,
20
- }
17
+ multiple: {type: Boolean, default: false},
18
+ explicitRequired: {type: Number, default: 0},
19
+ filterExplicit: {type: Number, default: 0},
20
+ showMode: {type: String, default: 'DROPDOWN'},
21
21
  },
22
22
  model: {
23
23
  prop: "value",
@@ -31,6 +31,10 @@ export default {
31
31
  get() {
32
32
  return Array.isArray(this.value) ? this.value : this.value ? [this.value] : [];
33
33
  }
34
+ },
35
+ // 筛选外显, 外显必填并且为平铺时, 最少得一个选项
36
+ isNotEmpty() {
37
+ return this.explicitRequired == 1 && this.filterExplicit == 1 && this.showMode === 'TILE'
34
38
  }
35
39
  },
36
40
  methods: {
@@ -38,6 +42,16 @@ export default {
38
42
  return val.filter((v) => !this.valueCp.includes(v));
39
43
  },
40
44
  onChange(val) {
45
+ if(this.isNotEmpty) {
46
+ if(Array.isArray(val) && (!val || !val.length)){
47
+ this.$message.warning('至少选中一个');
48
+ return
49
+ }
50
+ if(!Array.isArray(val) && !val){
51
+ this.$message.warning('至少选中一个');
52
+ return
53
+ }
54
+ }
41
55
  if (!this.multiple && Array.isArray(val)) {
42
56
  this.valueCp = this.filterNewVal(val)[0];
43
57
  this.$emit("change");
@@ -79,11 +79,11 @@ export default {
79
79
  return `unset`;
80
80
  },
81
81
  initComponentProps(cfg) {
82
- const { widgetType, alias, title, placeholder: customPlaceholder, widgetCfg, fieldType, explicitRequired, optionSetting } = cfg;
82
+ const { widgetType, alias, title, placeholder: customPlaceholder, widgetCfg, fieldType, explicitRequired, optionSetting, filterExplicit } = cfg;
83
83
  const { props, handlerProps } = WidgetCfgMaps.get(widgetType);
84
84
  let Props = { ...props };
85
85
  if (handlerProps) {
86
- Props = handlerProps(Props, { ...widgetCfg, title: alias || title, fieldType, isQuick: this.isQuick, explicitRequired, optionSetting });
86
+ Props = handlerProps(Props, { ...widgetCfg, title: alias || title, fieldType, isQuick: this.isQuick, explicitRequired, optionSetting, filterExplicit });
87
87
  }
88
88
  if (customPlaceholder) {
89
89
  Props.placeholder = customPlaceholder;
@@ -160,9 +160,9 @@ export const WidgetCfgMaps = new Map([
160
160
  }
161
161
  }
162
162
  ],
163
- handlerProps(props, { valueList, multiple, explicitRequired } = {}) {
163
+ handlerProps(props, { valueList, multiple, explicitRequired, filterExplicit, showMode } = {}) {
164
164
  const allowClear = explicitRequired != 1;
165
- const Props = { ...props, multiple, allowClear };
165
+ const Props = { ...props, multiple, allowClear, explicitRequired, filterExplicit, showMode };
166
166
  if (Array.isArray(valueList)) Props.options = valueList.map(({ value, label }) => ({ value, label }));
167
167
  return Props;
168
168
  },