cnhis-design-vue 2.1.98 → 2.1.100

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 (119) hide show
  1. package/CHANGELOG.md +25 -10
  2. package/README.md +5 -8
  3. package/es/affix/index.js +8 -8
  4. package/es/age/index.js +10 -10
  5. package/es/alert/index.js +8 -8
  6. package/es/anchor/index.js +8 -8
  7. package/es/auto-complete/index.js +8 -8
  8. package/es/avatar/index.js +8 -8
  9. package/es/back-top/index.js +8 -8
  10. package/es/badge/index.js +8 -8
  11. package/es/base/index.js +8 -8
  12. package/es/big-table/index.js +68 -68
  13. package/es/breadcrumb/index.js +8 -8
  14. package/es/button/index.js +22 -22
  15. package/es/calendar/index.js +8 -8
  16. package/es/captcha/index.js +3 -3
  17. package/es/card/index.js +8 -8
  18. package/es/card-reader-sdk/index.js +604 -665
  19. package/es/carousel/index.js +8 -8
  20. package/es/cascader/index.js +8 -8
  21. package/es/checkbox/index.js +9 -9
  22. package/es/col/index.js +8 -8
  23. package/es/collapse/index.js +8 -8
  24. package/es/color-picker/index.js +1 -1
  25. package/es/comment/index.js +8 -8
  26. package/es/config-provider/index.js +8 -8
  27. package/es/date-picker/index.js +8 -8
  28. package/es/descriptions/index.js +8 -8
  29. package/es/divider/index.js +8 -8
  30. package/es/drag-layout/index.js +3 -3
  31. package/es/drawer/index.js +8 -8
  32. package/es/dropdown/index.js +8 -8
  33. package/es/editor/index.js +1 -1
  34. package/es/ellipsis/index.js +1 -1
  35. package/es/empty/index.js +8 -8
  36. package/es/fabric-chart/index.js +96 -59
  37. package/es/form/index.js +8 -8
  38. package/es/form-model/index.js +8 -8
  39. package/es/form-table/index.js +66 -66
  40. package/es/index/index.js +1355 -713
  41. package/es/index/style.css +1 -1
  42. package/es/input/index.js +9 -9
  43. package/es/input-number/index.js +8 -8
  44. package/es/layout/index.js +8 -8
  45. package/es/list/index.js +8 -8
  46. package/es/locale-provider/index.js +8 -8
  47. package/es/map/index.js +9 -9
  48. package/es/mentions/index.js +8 -8
  49. package/es/menu/index.js +8 -8
  50. package/es/message/index.js +8 -8
  51. package/es/multi-chat/index.js +76 -76
  52. package/es/multi-chat-client/index.js +70 -70
  53. package/es/multi-chat-history/index.js +4 -4
  54. package/es/multi-chat-record/index.js +14 -14
  55. package/es/multi-chat-setting/index.js +22 -22
  56. package/es/multi-chat-sip/index.js +1 -1
  57. package/es/notification/index.js +8 -8
  58. package/es/page-header/index.js +8 -8
  59. package/es/pagination/index.js +8 -8
  60. package/es/popconfirm/index.js +8 -8
  61. package/es/popover/index.js +8 -8
  62. package/es/progress/index.js +8 -8
  63. package/es/radio/index.js +9 -9
  64. package/es/rate/index.js +8 -8
  65. package/es/result/index.js +8 -8
  66. package/es/row/index.js +8 -8
  67. package/es/scale-container/index.js +1 -1
  68. package/es/scale-view/index.js +27 -27
  69. package/es/select/index.js +12 -12
  70. package/es/select-label/index.js +11 -11
  71. package/es/select-person/index.js +185 -152
  72. package/es/select-person/style.css +1 -1
  73. package/es/select-tag/index.js +4 -4
  74. package/es/shortcut-provider/index.js +4030 -0
  75. package/es/shortcut-provider/style.css +0 -0
  76. package/es/shortcut-setter/index.js +31 -15
  77. package/es/skeleton/index.js +8 -8
  78. package/es/slider/index.js +8 -8
  79. package/es/space/index.js +8 -8
  80. package/es/spin/index.js +8 -8
  81. package/es/statistic/index.js +8 -8
  82. package/es/steps/index.js +8 -8
  83. package/es/switch/index.js +8 -8
  84. package/es/table-filter/index.js +206 -159
  85. package/es/table-filter/style.css +1 -1
  86. package/es/tabs/index.js +8 -8
  87. package/es/tag/index.js +9 -9
  88. package/es/time-picker/index.js +8 -8
  89. package/es/timeline/index.js +8 -8
  90. package/es/tooltip/index.js +8 -8
  91. package/es/transfer/index.js +8 -8
  92. package/es/tree/index.js +8 -8
  93. package/es/tree-select/index.js +8 -8
  94. package/es/upload/index.js +8 -8
  95. package/es/utils/index.js +14 -1
  96. package/es/verification-code/index.js +2 -2
  97. package/lib/cui.common.js +9842 -7652
  98. package/lib/cui.umd.js +9842 -7652
  99. package/lib/cui.umd.min.js +70 -70
  100. package/package.json +3 -3
  101. package/packages/card-reader-sdk/index.js +1 -1
  102. package/packages/card-reader-sdk/src/cardReaderSDK.js +62 -21
  103. package/packages/card-reader-sdk/src/components/readCardDialog.vue +48 -0
  104. package/packages/card-reader-sdk/src/constants/index.js +66 -173
  105. package/packages/card-reader-sdk/src/insuranceSDK.js +15 -89
  106. package/packages/card-reader-sdk/src/utils/readHealthCard.jsx +57 -0
  107. package/packages/fabric-chart/src/fabric-chart/FabricPolylines.vue +42 -22
  108. package/packages/fabric-chart/src/fabric-chart/FabricTextGroup.vue +2 -0
  109. package/packages/index.js +5 -2
  110. package/packages/select-person/select-person.vue +2 -2
  111. package/packages/shortcut-provider/index.js +10 -0
  112. package/packages/shortcut-provider/src/ShortcutProvider.vue +33 -0
  113. package/packages/shortcut-provider/src/constants/index.js +4 -0
  114. package/packages/shortcut-provider/src/hooks/index.js +1 -0
  115. package/packages/shortcut-provider/src/hooks/useShortcuts.js +129 -0
  116. package/packages/shortcut-provider/src/utils/index.js +107 -0
  117. package/packages/shortcut-setter/src/ShortcutSetterItem.vue +13 -1
  118. package/packages/table-filter/src/base-search-com/BaseSearch.vue +29 -1
  119. package/src/utils/index.js +10 -0
@@ -152,17 +152,21 @@ export default {
152
152
 
153
153
  // 左键松开鼠标-批量删除
154
154
  this.isSelectArea = false;
155
- if (event.button === 1 && !event.target && this.selectArea) {
155
+ if (event.button === 1 && this.selectArea) {
156
156
  const points = this.selectArea.ponits;
157
- const delList = this.getAreaPonits(points);
158
- delList.length === 0 && this.removeSelectArea();
159
- if (delList.length > 0 && this.selectArea) {
160
- this.$emit('pointOperation', 'delete', delList);
157
+ const { polylineList, otherList } = this.getAreaPonits(points);
158
+ !polylineList.length && !otherList.length && this.removeSelectArea();
159
+ if (polylineList.length > 0 && this.selectArea) {
160
+ this.$emit('pointOperation', 'delete', polylineList);
161
+ this.currentDelPoint = null;
162
+ }
163
+ if (otherList.length > 0 && this.selectArea) {
164
+ Bus.$emit('deleteOther', otherList);
161
165
  this.currentDelPoint = null;
162
166
  }
163
167
  }
164
168
  });
165
- let selectAreaOrigin = { left: 0, top: 0 };
169
+ const selectAreaOrigin = { left: 0, top: 0 };
166
170
  this.canvas.on('mouse:down', event => {
167
171
  if (event.button !== 1) return;
168
172
 
@@ -234,36 +238,52 @@ export default {
234
238
  },
235
239
  // 获取选区内包含的节点
236
240
  getAreaPonits(points) {
237
- const delList = [];
241
+ const polylineList = [];
242
+ let otherList = [];
238
243
  const [x1, y1, x2, y2] = points;
239
244
  this.canvas.forEachObject(obj => {
240
- const { id, left, top } = obj;
245
+ const { id, left, top, currentDelPoint } = obj;
241
246
  const isArea = left >= x1 && left <= x2 && top >= y1 && top <= y2;
242
- if (id && /_polyline(Point)_/.test(id) && !id.includes('isTitle') && isArea) {
243
- if (this.currentDelPoint) {
244
- const { polylineIndex } = this.currentDelPoint;
245
- if (polylineIndex == obj.polylineIndex) {
246
- delList.push(this.getDataById(id));
247
+ if (isArea && this.isGridLimit(left, top) && id) {
248
+ if (/_polyline(Point)_/.test(id)) {
249
+ const data = this.getDataById(id);
250
+ if (currentDelPoint) {
251
+ if (currentDelPoint.polylineIndex == obj.polylineIndex) {
252
+ polylineList.push(data);
253
+ }
254
+ } else {
255
+ polylineList.push(data);
247
256
  }
248
- } else {
249
- delList.push(this.getDataById(id));
257
+ }
258
+ if (id.includes('_other') && obj.type === 'list' && !this.currentDelPoint) {
259
+ const data = {
260
+ type: obj.type,
261
+ index: obj.index,
262
+ dataIndex: obj.dataIndex
263
+ };
264
+ otherList.push(data);
250
265
  }
251
266
  }
252
267
  });
253
- return delList;
268
+ if (polylineList.length > 0) {
269
+ otherList = [];
270
+ }
271
+ return { polylineList, otherList };
254
272
  },
255
273
  // 创建选区
256
274
  createSelectArea(event, selectAreaOrigin) {
257
275
  this.selectArea && this.canvas.remove(this.selectArea);
276
+ const [x1, y1] = [selectAreaOrigin.left, selectAreaOrigin.top];
277
+ const [x2, y2] = [event.pointer.x, event.pointer.y];
258
278
  this.selectArea = new this.fabric.Rect({
259
279
  ...defaultVaule.style,
260
280
  fill: '#CAF982',
261
281
  opacity: 0.4,
262
- left: selectAreaOrigin.left,
263
- top: selectAreaOrigin.top,
264
- width: event.pointer.x - selectAreaOrigin.left,
265
- height: event.pointer.y - selectAreaOrigin.top,
266
- ponits: [selectAreaOrigin.left, selectAreaOrigin.top, event.pointer.x, event.pointer.y]
282
+ left: x1,
283
+ top: y1,
284
+ width: x2 - x1,
285
+ height: y2 - y1,
286
+ ponits: x1 < x2 ? [x1, y1, x2, y2] : [x2, y2, x1, y1]
267
287
  });
268
288
  this.canvas.add(this.selectArea);
269
289
  },
@@ -1010,7 +1030,7 @@ export default {
1010
1030
  polylineTypeId,
1011
1031
  polylineIndex: point.polylineIndex,
1012
1032
  scaleX: point.scale || 1,
1013
- scaleY: point.scale || 1,
1033
+ scaleY: point.scale || 1
1014
1034
  });
1015
1035
  clonedObj.hasControls = clonedObj.hasBorders = false;
1016
1036
  point.prePoints = [point.left, point.top];
@@ -124,6 +124,8 @@ export default {
124
124
  }
125
125
  }
126
126
  });
127
+
128
+ Bus.$on('deleteOther', otherList => this.$emit('deleteOther', otherList));
127
129
  },
128
130
  // 打开右键菜单
129
131
  openRightModal() {
package/packages/index.js CHANGED
@@ -89,6 +89,7 @@ import { default as FormTable } from './form-table';
89
89
  import { default as ShortcutSetter } from './shortcut-setter';
90
90
  import { default as Ellipsis } from './ellipsis';
91
91
  import { default as ScaleContainer } from './scale-container';
92
+ import { default as ShortcutProvider } from './shortcut-provider';
92
93
 
93
94
  const req = require.context('ant-design-vue/es/locale', true, /.js$/);
94
95
  const locales = {};
@@ -187,7 +188,8 @@ const components = [
187
188
  FormTable,
188
189
  ShortcutSetter,
189
190
  Ellipsis,
190
- ScaleContainer
191
+ ScaleContainer,
192
+ ShortcutProvider
191
193
  ];
192
194
 
193
195
  // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册
@@ -304,7 +306,8 @@ export {
304
306
  FormTable,
305
307
  ShortcutSetter,
306
308
  Ellipsis,
307
- ScaleContainer
309
+ ScaleContainer,
310
+ ShortcutProvider
308
311
  };
309
312
 
310
313
  export default {
@@ -126,7 +126,7 @@ import { Icon, Checkbox, Tree, Tooltip, Input, Spin } from 'ant-design-vue';
126
126
  import searchTree from './search-tree';
127
127
  import create from '@/core/create';
128
128
  import vexutils from '@/utils/vexutils';
129
- import { filterTree, deepTraversalFirst, getAllParentId } from '@/utils';
129
+ import { filterTree, deepTraversalFirst, getAllParentId, matchWdAndPy } from '@/utils';
130
130
 
131
131
  /**
132
132
  * 查询没有部门的分类时,parent_id_obj 为 undefined a-tree 展示异常。
@@ -1301,7 +1301,7 @@ export default create({
1301
1301
  copyData = copyData.filter(item => item.visible);
1302
1302
  const expandedKeys = [];
1303
1303
  vexutils.searchTree(copyData, item => {
1304
- if (item.visible && item.title.indexOf(this.title) !== -1) {
1304
+ if (item.visible && (item.title.indexOf(this.title) !== -1 || matchWdAndPy(this.title, item))) {
1305
1305
  const allParentIds = getAllParentId(copyData, item.key).filter(Boolean);
1306
1306
  expandedKeys.push(...allParentIds);
1307
1307
  }
@@ -0,0 +1,10 @@
1
+ // 导入组件
2
+ import ShortcutProvider from './src/ShortcutProvider.vue';
3
+
4
+ // 为组件提供 install 安装方法,供按需引入
5
+ ShortcutProvider.install = function(Vue) {
6
+ Vue.component(ShortcutProvider.name, ShortcutProvider);
7
+ };
8
+
9
+ // 默认导出组件
10
+ export default ShortcutProvider;
@@ -0,0 +1,33 @@
1
+ <script>
2
+ import create from '@/core/create';
3
+ import { ShortcutManager } from './hooks';
4
+
5
+ export default create({
6
+ name: 'shortcut-provider',
7
+ props: {},
8
+ provide() {
9
+ return {
10
+ $manager: () => this.manager
11
+ };
12
+ },
13
+ data() {
14
+ return {
15
+ manager: new ShortcutManager().start()
16
+ };
17
+ },
18
+ methods: {
19
+ getManager() {
20
+ return this.manager;
21
+ }
22
+ },
23
+ mounted() {},
24
+ beforeDestroy() {
25
+ this.manager.destroy();
26
+ },
27
+ render(h) {
28
+ return this.$slots.default ? h('div', this.$slots.default) : undefined;
29
+ }
30
+ });
31
+ </script>
32
+
33
+ <style lang="less"></style>
@@ -0,0 +1,4 @@
1
+ export const ShortcutStatus = {
2
+ INACTIVE: 0,
3
+ ACTIVE: 1
4
+ };
@@ -0,0 +1 @@
1
+ export * from './useShortcuts';
@@ -0,0 +1,129 @@
1
+ import { findAncestor } from '@/utils';
2
+ import { ShortcutStatus } from '../constants';
3
+ import { pick, omit } from 'xe-utils';
4
+
5
+ import { getDisplaySignature, getKeySignature, isInvalidKeyboardEvent, isInvalidSignature, isKeyboardEvent, isShortcutProvider, normalizeSignatureInfo } from '~/shortcut-provider/src/utils';
6
+
7
+ export const GlobalShortcutProvider = Symbol('Glob');
8
+ const ShortcutManagerCacheMap = new Map();
9
+
10
+ export class ShortcutManager {
11
+ shortcutCallbackMap = new Map([]);
12
+
13
+ shortcutCache = {};
14
+
15
+ environmentEle;
16
+
17
+ handle = null;
18
+
19
+ disabled = false;
20
+
21
+ static log(message, dryRun = false) {
22
+ const _message = `[ShortcutManager] ${message}`;
23
+ !dryRun && console.warn(_message);
24
+ return _message;
25
+ }
26
+
27
+ constructor(environmentEle = window, scope = GlobalShortcutProvider) {
28
+ this.environmentEle = environmentEle;
29
+ ShortcutManagerCacheMap.set(scope, this);
30
+ }
31
+
32
+ get traverse() {
33
+ return [...Object.values(this.shortcutCache)].sort((a, b) => (a.order || 0) - (b.order || 0));
34
+ }
35
+
36
+ query(key) {
37
+ return this.shortcutCache[key];
38
+ }
39
+
40
+ async update(key, info) {
41
+ const oldKeySignature = this.query(key)?.currentKeySignature;
42
+
43
+ info && checkSignature(this.shortcutCache, info);
44
+
45
+ const item = this.query(key);
46
+ if (!item) return;
47
+ await item.onUpdate?.(key, info ? normalizeSignatureInfo(info) : undefined);
48
+ checkSignature(this.shortcutCache, info);
49
+ item.currentKeySignature = getKeySignature(info);
50
+ item.shortcutSignature = normalizeSignatureInfo(info);
51
+ this.shortcutCallbackMap.set(item.currentKeySignature, this.shortcutCallbackMap.get(oldKeySignature));
52
+ this.shortcutCallbackMap.delete(oldKeySignature);
53
+
54
+ function checkSignature(shortcutCache, info) {
55
+ if (oldKeySignature === getKeySignature(info)) return;
56
+ if (Object.values(shortcutCache).some(v => v.currentKeySignature === getKeySignature(info))) {
57
+ throw `重复的快捷键=> ${getDisplaySignature(info)}`;
58
+ }
59
+ if (isInvalidSignature(info)) {
60
+ throw `非法的快捷键=>${info.key}`;
61
+ }
62
+ }
63
+ }
64
+
65
+ register(shortcutItem) {
66
+ const item = this.query(shortcutItem.key);
67
+ if (item) {
68
+ item.status = ShortcutStatus.ACTIVE;
69
+ this.shortcutCallbackMap.set(item.currentKeySignature, shortcutItem.callback);
70
+ Object.assign(item, pick(shortcutItem, ['debounce', 'debounceOption', 'label', 'order', 'key']));
71
+ return createHandler(item);
72
+ }
73
+
74
+ this.shortcutCache[shortcutItem.key] = omit(shortcutItem, ['callback']);
75
+ this.shortcutCallbackMap.set(shortcutItem.currentKeySignature, shortcutItem.callback);
76
+
77
+ return createHandler(this.shortcutCache[shortcutItem.key]);
78
+
79
+ function createHandler(shortcut) {
80
+ return {
81
+ stop: () => {
82
+ shortcut.status = ShortcutStatus.INACTIVE;
83
+ },
84
+ start: () => {
85
+ shortcut.status = ShortcutStatus.ACTIVE;
86
+ },
87
+ signature: () => shortcut.currentKeySignature
88
+ };
89
+ }
90
+ }
91
+
92
+ start() {
93
+ if (this.handle) {
94
+ ShortcutManager.log(`请勿重复启动=>${this}`);
95
+ return this;
96
+ }
97
+
98
+ this.handle = event => {
99
+ if (!isKeyboardEvent(event) || this.disabled) return;
100
+ const providerWrapper = findAncestor(event.target, isShortcutProvider);
101
+
102
+ if ((providerWrapper && providerWrapper !== this.environmentEle) || isInvalidKeyboardEvent(event)) {
103
+ return;
104
+ }
105
+ const keySignature = getKeySignature(event);
106
+
107
+ const callback = this.shortcutCallbackMap.get(keySignature);
108
+ if (!callback) return;
109
+ event.preventDefault();
110
+ const shortcutItem = Object.values(this.shortcutCache).find(item => item.currentKeySignature === keySignature);
111
+ if (!shortcutItem || shortcutItem.status !== ShortcutStatus.ACTIVE || shortcutItem.disabled) return;
112
+ callback(event);
113
+ };
114
+
115
+ this.environmentEle.addEventListener('keyup', this.handle, { capture: true });
116
+ return this;
117
+ }
118
+
119
+ destroy() {
120
+ this.handle && this.environmentEle.removeEventListener('keyup', this.handle, { capture: true });
121
+ this.handle = undefined;
122
+ this.clear();
123
+ }
124
+
125
+ clear() {
126
+ this.shortcutCallbackMap.clear();
127
+ this.shortcutCache = {};
128
+ }
129
+ }
@@ -0,0 +1,107 @@
1
+ import { isString } from 'xe-utils';
2
+
3
+ function isAlphanumeric(key) {
4
+ return /^[\dA-Za-z]$/.test(key);
5
+ }
6
+
7
+ function isPunctuation(key) {
8
+ return /^[,。;‘【】、\-=|+,./;’[\]\\ ]$/.test(key);
9
+ }
10
+
11
+ function isFnNumberChar(key) {
12
+ return /^[!@#$%^&*()_+|~!¥…()—|~]$/.test(key);
13
+ }
14
+
15
+ export function isKeyboardEvent(event) {
16
+ return Reflect.get(event, 'view') === window && Reflect.get(event, 'shiftKey') != undefined;
17
+ }
18
+
19
+ export function normalizeSignatureInfo(info) {
20
+ let ctrl, shift, alt;
21
+ const key = info.key?.toUpperCase() ?? '';
22
+
23
+ if (isKeyboardEvent(info)) {
24
+ ctrl = info.ctrlKey;
25
+ shift = info.shiftKey;
26
+ alt = info.altKey;
27
+ } else {
28
+ ctrl = !!info.ctrl;
29
+ shift = !!info.shift;
30
+ alt = !!info.alt;
31
+ }
32
+
33
+ return { ctrl, shift, alt, key };
34
+ }
35
+
36
+ export function getKeySignature(info) {
37
+ const { ctrl, shift, alt, key } = normalizeSignatureInfo(info);
38
+
39
+ return `${ctrl ? 'Ctrl_' : ''}${shift ? 'Shift_' : ''}${alt ? 'Alt_' : ''}${key}`;
40
+ }
41
+
42
+ const keyBlackList = ['CONTROL', 'ALT', 'SHIFT'];
43
+
44
+ export function inKeyBlackList(key) {
45
+ if (!isString(key)) return false;
46
+ return keyBlackList.includes(key.toUpperCase());
47
+ }
48
+
49
+ export function isInvalidKeyboardEvent(event) {
50
+ const target = event.target;
51
+ if (target.tagName !== 'INPUT') return false;
52
+ return isInvalidSignatureAtInput(event);
53
+ }
54
+
55
+ function isInvalidSignatureAtInput(info) {
56
+ const target = info.target;
57
+ if (target.classList.contains('shortcut-setter-item')) return true;
58
+ const { ctrl, shift, alt, key } = normalizeSignatureInfo(info);
59
+ if (ctrl || alt) return false;
60
+ if (shift) return isFnNumberChar(key);
61
+ return isAlphanumeric(key) || isPunctuation(key);
62
+ }
63
+
64
+ export function isInvalidSignature(info) {
65
+ const { key } = normalizeSignatureInfo(info);
66
+ // if (!ctrl && !shift && !alt) return /^F\d$/.test(key);
67
+ return inKeyBlackList(key);
68
+ }
69
+
70
+ export function getDisplaySignature(info) {
71
+ const { ctrl, shift, alt, key } = normalizeSignatureInfo(info);
72
+
73
+ return `${ctrl ? 'Ctrl + ' : ''}${alt ? 'Alt + ' : ''}${shift ? 'Shift + ' : ''}${inKeyBlackList(key) ? '' : displaySignatureEscape(key.replace(' ', 'SPACE'))}`;
74
+ }
75
+
76
+ function displaySignatureEscape(key) {
77
+ const escapeMap = {
78
+ '!': '1',
79
+ '!': '1',
80
+ '@': '2',
81
+ '#': '3',
82
+ $: '4',
83
+ '¥': '4',
84
+ '%': '5',
85
+ '…': '6',
86
+ '^': '6',
87
+ '&': '7',
88
+ '*': '8',
89
+ '(': '9',
90
+ '(': '9',
91
+ ')': '0',
92
+ ')': '0'
93
+ };
94
+
95
+ return escapeMap[key] || key;
96
+ }
97
+
98
+ export function transformKey2DisplaySignature(keySignature) {
99
+ return keySignature
100
+ .replace(' ', 'SPACE')
101
+ .replace(/[^_]$/, key => displaySignatureEscape(key))
102
+ .replace(/_/g, ' + ');
103
+ }
104
+
105
+ export function isShortcutProvider(ele) {
106
+ return ele && ele.getAttribute('is-shortcut-capture') != undefined;
107
+ }
@@ -3,10 +3,12 @@
3
3
  <label>
4
4
  {{ source.label ? `${source.label}:` : '' }}
5
5
  <a-input
6
+ :allowClear="source.clearable"
6
7
  v-bind="source.inputProps"
7
8
  ref="inputRef"
8
9
  :placeholder="parsedPlaceholder"
9
10
  :value="parsedContent"
11
+ @change="onChange"
10
12
  @focus.stop="onFocus"
11
13
  @blur.stop="onBlur"
12
14
  @keydown.stop.prevent="onKeydown"
@@ -40,7 +42,7 @@ export default {
40
42
  },
41
43
  async onKeyup(event) {
42
44
  try {
43
- if(this.currentContent===getDisplaySignature(event)) return
45
+ if (this.currentContent === getDisplaySignature(event)) return;
44
46
  await new Promise((resolve, reject) => {
45
47
  this.$emit('shortcutChange', { key: this.source.key, info: event, resolve, reject });
46
48
  });
@@ -58,6 +60,16 @@ export default {
58
60
  this.$refs.inputRef?.blur();
59
61
  this.isEdit = false;
60
62
  this.editContent = '';
63
+ },
64
+ onChange(event) {
65
+ if (!event || event.target.value !== '') return;
66
+ this.currentContent = '';
67
+ this.$emit('shortcutChange', {
68
+ key: this.source.key,
69
+ info: { key: '' },
70
+ resolve: () => null,
71
+ reject: () => null
72
+ });
61
73
  }
62
74
  },
63
75
  computed: {
@@ -251,7 +251,7 @@
251
251
  {{ item.alias || item.name }}
252
252
  </template>
253
253
  </a-button>
254
- <a-upload v-if="item.isImportGuage" method="post" :show-upload-list="false" :action="`${axios.defaults.baseURL}/guage/importGuage`" @change="handleUploadChange">
254
+ <a-upload v-if="item.isImportGuage" method="post" :customRequest="importGaugeCustomRequest" :show-upload-list="false">
255
255
  <!-- 上传配置文件 -->
256
256
  <a-button
257
257
  class="btn-custom-class"
@@ -412,6 +412,7 @@ import PrintBtn from '~/button/src/ButtonPrint/index';
412
412
 
413
413
  import outQuickSearch from '../components/out-quick-search/out-quick-search';
414
414
  import utils from '@/utils/utils-map';
415
+ import { isFunction } from 'xe-utils';
415
416
  import { durationMixin, $utils, filterApiFn, outQuickSearchFn, outQuickSearchDefCommon } from '../mixins/mixins';
416
417
  import tableSearchCon from '../mixins/tableSearchCon';
417
418
  import OutQuickMethod from '../mixins/out-quick-method'
@@ -566,6 +567,7 @@ export default create({
566
567
  action: ''
567
568
  })
568
569
  },
570
+ importGuageRequest: Function,
569
571
 
570
572
  /**
571
573
  * 打印配置
@@ -1685,6 +1687,32 @@ export default create({
1685
1687
  changeCardNewBatch(val) {
1686
1688
  this.$emit('changeCardNewBatch', val)
1687
1689
  },
1690
+ // 兼容二次开发平台
1691
+ importGaugeMethod(params, name) {
1692
+ let url = this.importGuageConfig?.action || `${this.axios.defaults.baseURL}/guage/importGuage`
1693
+ this.axios.post(url, params).then(({data}) => {
1694
+ if(data.result !== 'SUCCESS') {
1695
+ this.$message.error(data.resultMsg || `${name}导入失败`)
1696
+ return;
1697
+ }
1698
+ this.$message.success(`${name}导入成功`);
1699
+ this.$emit('importUpdate');
1700
+ })
1701
+ },
1702
+ // 量表导入自定义上传方法
1703
+ importGaugeCustomRequest(options) {
1704
+ let { file } = options;
1705
+ let formData = new FormData();
1706
+ formData.append("file", file);
1707
+
1708
+ this.$set(file, "status", "uploading");
1709
+ let curMehod = this.importGaugeMethod
1710
+ if(this.importGuageRequest && isFunction(this.importGuageRequest)) {
1711
+ curMehod = this.importGuageRequest
1712
+ }
1713
+ curMehod(formData, file.name)
1714
+ },
1715
+ // @change="handleUploadChange"
1688
1716
  handleUploadChange(info) {
1689
1717
  const { file, fileList } = info;
1690
1718
  if (file.status !== 'uploading') {
@@ -91,3 +91,13 @@ export const matchWdAndPy = (keyword, item) => {
91
91
  const wbCodeMatch = wbCode?.indexOf(keyword) > -1; // 五笔匹配
92
92
  return pyCodeMatch || wbCodeMatch;
93
93
  };
94
+
95
+ export function findAncestor(ele, finder) {
96
+ if (!ele) return ele;
97
+ if (finder(ele)) return ele;
98
+ let next = ele.parentElement;
99
+ while (next && !finder(next)) {
100
+ next = next.parentElement;
101
+ }
102
+ return next;
103
+ }