@ctzy-web-client/plugin-component-vue 1.0.50 → 1.0.52

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 (26) hide show
  1. package/es/data-table/data-table.mjs +3 -54
  2. package/es/datatable-settings/datatable-settings.mjs +13 -1
  3. package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +17 -2
  4. package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +16 -2
  5. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +17 -3
  6. package/es/pct-filter-panel/pct-filter-panel.mjs +17 -11
  7. package/es/pct-filter-panel/use-filter-panel.mjs +13 -5
  8. package/es/utils.css +1 -1
  9. package/lib/data-table/data-table.js +2 -53
  10. package/lib/datatable-settings/datatable-settings.js +13 -1
  11. package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +16 -1
  12. package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +15 -1
  13. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +17 -3
  14. package/lib/pct-filter-panel/pct-filter-panel.js +16 -10
  15. package/lib/pct-filter-panel/use-filter-panel.js +13 -5
  16. package/lib/utils.css +1 -1
  17. package/package.json +1 -1
  18. package/src/data-table/data-table.vue +2 -64
  19. package/src/datatable-settings/datatable-settings.vue +4 -3
  20. package/src/pct-filter-panel/pct-compents/pct-Input-condition.vue +16 -2
  21. package/src/pct-filter-panel/pct-compents/pct-date-range-condition.vue +14 -3
  22. package/src/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.vue +14 -1
  23. package/src/pct-filter-panel/pct-filter-panel.vue +10 -5
  24. package/src/pct-filter-panel/use-filter-panel.js +18 -5
  25. /package/es/pct-filter-panel/pct-compents/{pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_cb2d8ca5_lang.mjs → pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c1065f11_lang.mjs} +0 -0
  26. /package/lib/pct-filter-panel/pct-compents/{pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_cb2d8ca5_lang.js → pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c1065f11_lang.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { defineComponent, useAttrs, ref, computed, nextTick, onMounted, onBeforeUnmount, unref, watch, provide, reactive, onUnmounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createVNode, mergeProps, withCtx, createBlock, createElementVNode, createCommentVNode, Fragment, renderList, createTextVNode, toDisplayString } from 'vue';
1
+ import { defineComponent, useAttrs, ref, computed, unref, watch, provide, reactive, nextTick, onUnmounted, openBlock, createElementBlock, normalizeClass, normalizeStyle, renderSlot, createVNode, mergeProps, withCtx, createBlock, createElementVNode, createCommentVNode, Fragment, renderList, createTextVNode, toDisplayString } from 'vue';
2
2
  import { ElMessage, ElTable, ElTableColumn, ElPagination } from 'element-plus';
3
3
  import { useService, useGlobalConfig, dataTableKey, useNamespace, useEventDispatcher } from '@ctzy-web-client/web-base-client-vue';
4
4
  import DynamicComponent from './dynamic-component.mjs';
@@ -81,57 +81,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
81
81
  const dataTable = props.dataTable;
82
82
  dataTable._userService = (_a = userService.value) == null ? void 0 : _a.getUserList;
83
83
  const dataTableEl = ref(null);
84
- const realHeight = computed(() => {
85
- if (props.height !== "auto") {
86
- return props.height;
87
- }
88
- return tableAutoHeight.value;
89
- });
90
- const maxHeight = ref(0);
91
- function updateMaxHeight(list) {
92
- nextTick(() => {
93
- if (!elTable.value)
94
- return;
95
- let h = (list == null ? void 0 : list.length) ? list.length * 64 + 62 : void 0;
96
- if (h) {
97
- elTable.value.$el.style.maxHeight = h + "px";
98
- } else {
99
- elTable.value.$el.style.maxHeight = "";
100
- }
101
- });
102
- }
103
- const tableAutoHeight = ref(300);
104
- const PAGINATION_HEIGHT = 160;
105
- function calcTableHeight() {
106
- nextTick(() => {
107
- if (!dataTableEl.value)
108
- return;
109
- const top = dataTableEl.value.offsetTop;
110
- const viewHeight = window.innerHeight;
111
- const height = viewHeight - top - PAGINATION_HEIGHT - 45;
112
- console.log(height);
113
- tableAutoHeight.value = Math.max(height, 100);
114
- });
115
- }
116
- let resizeTimer = null;
117
- function watchResize() {
118
- clearTimeout(resizeTimer);
119
- resizeTimer = setTimeout(calcTableHeight, 100);
120
- }
121
- onMounted(() => {
122
- calcTableHeight();
123
- window.addEventListener("resize", watchResize);
124
- nextTick(() => {
125
- var _a2;
126
- if ((_a2 = props.dataTable.data) == null ? void 0 : _a2.length) {
127
- updateMaxHeight(props.dataTable.data);
128
- }
129
- });
130
- });
131
- onBeforeUnmount(() => {
132
- window.removeEventListener("resize", watchResize);
133
- clearTimeout(resizeTimer);
134
- });
84
+ const realHeight = computed(() => props.height);
135
85
  const displayColumns = computed(
136
86
  () => unref(dataTable).getDisplayColumns() || []
137
87
  );
@@ -328,7 +278,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
328
278
  createVNode(unref(ElTable), mergeProps({
329
279
  class: "content",
330
280
  height: realHeight.value,
331
- "max-height": maxHeight.value,
332
281
  ref_key: "elTable",
333
282
  ref: elTable,
334
283
  data: data.value,
@@ -416,7 +365,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
416
365
  renderSlot(_ctx.$slots, "column-append")
417
366
  ]),
418
367
  _: 3
419
- }, 16, ["height", "max-height", "data", "row-key", "onSelectionChange", "border"])
368
+ }, 16, ["height", "data", "row-key", "onSelectionChange", "border"])
420
369
  ]),
421
370
  __props.showPagination ? (openBlock(), createElementBlock("div", {
422
371
  key: 0,
@@ -15,6 +15,7 @@ if (typeof __name === 'undefined') {
15
15
  });
16
16
  }
17
17
  }
18
+ const _hoisted_1 = { style: { "display": "flex", "align-items": "center" } };
18
19
  const __default__ = defineComponent({ name: "BwaDataTableSetting" });
19
20
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
20
21
  props: {
@@ -170,6 +171,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
170
171
  return (_ctx, _cache) => {
171
172
  const _component_RefreshRight = resolveComponent("RefreshRight");
172
173
  const _component_Close = resolveComponent("Close");
174
+ const _component_Rank = resolveComponent("Rank");
173
175
  return openBlock(), createBlock(unref(ElTooltip), mergeProps({
174
176
  visible: value.value,
175
177
  "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => value.value = $event)
@@ -267,10 +269,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
267
269
  createElementVNode("div", {
268
270
  class: normalizeClass(unref(ns).e("field-item"))
269
271
  }, [
270
- createElementVNode("span", null, toDisplayString(item.title), 1),
272
+ createElementVNode("span", _hoisted_1, [
273
+ createVNode(unref(ElIcon), { style: { "margin-right": "5px" } }, {
274
+ default: withCtx(() => [
275
+ createVNode(_component_Rank)
276
+ ]),
277
+ _: 1
278
+ }),
279
+ createTextVNode(" " + toDisplayString(item.title), 1)
280
+ ]),
271
281
  createVNode(unref(ElSwitch), {
272
282
  modelValue: item.visible,
273
283
  "onUpdate:modelValue": ($event) => item.visible = $event,
284
+ size: "small",
274
285
  disabled: item.settings.disabled,
275
286
  onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
276
287
  }, ["stop"])),
@@ -307,6 +318,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
307
318
  createVNode(unref(ElSwitch), {
308
319
  modelValue: column.visible,
309
320
  "onUpdate:modelValue": ($event) => column.visible = $event,
321
+ size: "small",
310
322
  disabled: column.settings.disabled,
311
323
  onChange: (val) => handleColumnVisibleChange(column, val)
312
324
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "onChange"])
@@ -1,4 +1,4 @@
1
- import { defineComponent, inject, computed, useAttrs, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, toDisplayString, createCommentVNode, createVNode } from 'vue';
1
+ import { defineComponent, inject, computed, useAttrs, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, toDisplayString, createCommentVNode, createVNode, withKeys } from 'vue';
2
2
  import { useNamespace, filterPanelItemKey } from '@ctzy-web-client/web-base-client-vue';
3
3
  import { dataProps } from '../../hooks/use-data/index.mjs';
4
4
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.mjs';
@@ -54,6 +54,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
54
54
  get: () => props.modelValue,
55
55
  set: (v) => emit("update:modelValue", v)
56
56
  });
57
+ const triggerSearch = inject("triggerSearch", () => {
58
+ });
59
+ const isChange = ref(false);
60
+ const handleChange = () => {
61
+ isChange.value = true;
62
+ };
63
+ const handleBlur = () => {
64
+ if (isChange.value) {
65
+ triggerSearch();
66
+ }
67
+ isChange.value = false;
68
+ };
57
69
  return (_ctx, _cache) => {
58
70
  const _component_el_input = resolveComponent("el-input");
59
71
  return openBlock(), createElementBlock("div", {
@@ -69,7 +81,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
69
81
  class: normalizeClass(unref(ns).e("search")),
70
82
  placeholder: placeholderStr.value,
71
83
  modelValue: modelValue.value,
72
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
84
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
85
+ onKeyup: withKeys(handleBlur, ["enter"]),
86
+ onBlur: handleBlur,
87
+ onChange: handleChange
73
88
  }, null, 8, ["prefix-icon", "class", "placeholder", "modelValue"])
74
89
  ], 2);
75
90
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent, inject, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, toDisplayString, createCommentVNode, createVNode } from 'vue';
1
+ import { defineComponent, inject, computed, ref, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, toDisplayString, createCommentVNode, createVNode } from 'vue';
2
2
  import { useNamespace, filterPanelItemKey } from '@ctzy-web-client/web-base-client-vue';
3
3
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.mjs';
4
4
 
@@ -41,6 +41,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
41
41
  var _a;
42
42
  return (_a = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a : null;
43
43
  });
44
+ const triggerSearch = inject("triggerSearch", () => {
45
+ });
46
+ const isChange = ref(false);
47
+ const handleChange = () => {
48
+ isChange.value = true;
49
+ };
50
+ const handleBlur = () => {
51
+ if (isChange.value) {
52
+ triggerSearch();
53
+ }
54
+ isChange.value = false;
55
+ };
44
56
  const value = computed({
45
57
  get: () => {
46
58
  if (props.modelValue && props.modelValue.start && props.modelValue.end) {
@@ -72,7 +84,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
72
84
  "range-separator": "\u81F3",
73
85
  "start-placeholder": "\u5F00\u59CB\u65E5\u671F",
74
86
  "end-placeholder": "\u7ED3\u675F\u65E5\u671F",
75
- "value-format": __props.valueFormat
87
+ "value-format": __props.valueFormat,
88
+ onBlur: handleBlur,
89
+ onChange: handleChange
76
90
  }, null, 8, ["modelValue", "value-format"])
77
91
  ], 2);
78
92
  };
@@ -4,7 +4,7 @@ import { useService, HttpRequest, useNamespace, filterPanelItemKey } from '@ctzy
4
4
  import { dataProps } from '../../hooks/use-data/index.mjs';
5
5
  import { pinyin } from 'pinyin-pro';
6
6
  import '../../advance-select/advance-option.mjs';
7
- import './pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_cb2d8ca5_lang.mjs';
7
+ import './pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c1065f11_lang.mjs';
8
8
  import './pct-multiple-menu-condition2.vue_vue_type_style_index_1_lang.mjs';
9
9
  import _export_sfc from '../../_virtual/_plugin-vue_export-helper.mjs';
10
10
 
@@ -45,7 +45,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
45
45
  remoteShowSuffix: { type: Boolean, default: true },
46
46
  reserveKeyword: { type: Boolean, default: false }
47
47
  },
48
- emits: ["update:modelValue", "search", "visible-change"],
48
+ emits: ["update:modelValue", "search", "visible-change", "searchBlur"],
49
49
  setup(__props, { emit: __emit }) {
50
50
  const httpRequest = useService(HttpRequest);
51
51
  const textRef = ref(null);
@@ -173,6 +173,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
173
173
  },
174
174
  set: (v) => emit("update:modelValue", v)
175
175
  });
176
+ const triggerSearch = inject("triggerSearch", () => {
177
+ });
178
+ const isChange = ref(false);
179
+ const handleChange = () => {
180
+ isChange.value = true;
181
+ };
182
+ const handleBlur = () => {
183
+ if (isChange.value) {
184
+ triggerSearch();
185
+ }
186
+ isChange.value = false;
187
+ };
176
188
  return (_ctx, _cache) => {
177
189
  return openBlock(), createElementBlock("div", {
178
190
  class: normalizeClass(unref(ns).e("conditbox"))
@@ -191,6 +203,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
191
203
  loading: loading.value,
192
204
  "remote-show-suffix": __props.remoteShowSuffix,
193
205
  onVisibleChange: visibleChange,
206
+ onBlur: handleBlur,
207
+ onChange: handleChange,
194
208
  remote: __props.remote,
195
209
  "remote-method": handleFieldSearch,
196
210
  "reserve-keyword": __props.reserveKeyword,
@@ -264,6 +278,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
264
278
  };
265
279
  }
266
280
  });
267
- var PctMultipleMenuCondition = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-cb2d8ca5"], ["__file", "pct-multiple-menu-condition2.vue"]]);
281
+ var PctMultipleMenuCondition = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-c1065f11"], ["__file", "pct-multiple-menu-condition2.vue"]]);
268
282
 
269
283
  export { PctMultipleMenuCondition as default };
@@ -1,4 +1,4 @@
1
- import { defineComponent, watch, provide, reactive, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot, Fragment, renderList, createVNode, withCtx, createBlock, createCommentVNode, normalizeStyle, toDisplayString, isRef, createElementVNode, withModifiers, createTextVNode } from 'vue';
1
+ import { defineComponent, provide, watch, reactive, resolveComponent, openBlock, createElementBlock, normalizeClass, unref, renderSlot, Fragment, renderList, createVNode, withCtx, createBlock, createCommentVNode, normalizeStyle, toDisplayString, isRef, withKeys, createElementVNode, withModifiers, createTextVNode } from 'vue';
2
2
  import { useNamespace, filterPanelKey } from '@ctzy-web-client/web-base-client-vue';
3
3
  import { useFilterPanel } from './use-filter-panel.mjs';
4
4
  import PctFilterPanelItem from './pct-filter-panel-item.mjs';
@@ -72,6 +72,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
72
72
  handleReset,
73
73
  handleSearch
74
74
  } = useFilterPanel(props, { emit });
75
+ provide("triggerSearch", handleSearch);
75
76
  watch(
76
77
  filterPanel,
77
78
  (filterPanel2, _, onCleanup) => {
@@ -124,20 +125,23 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
124
125
  multiple: column.component !== "BwaSingleMenuCondition",
125
126
  showTitle: props.showTitle,
126
127
  showSearch: (_a = column.componentProps) == null ? void 0 : _a.showSearch,
127
- options: ((_b = column.componentProps) == null ? void 0 : _b.options) || []
128
+ options: ((_b = column.componentProps) == null ? void 0 : _b.options) || [],
129
+ onSearchBlur: _cache[0] || (_cache[0] = () => unref(handleSearch)())
128
130
  }, null, 8, ["modelValue", "onUpdate:modelValue", "column", "multiple", "showTitle", "showSearch", "options"])) : createCommentVNode("v-if", true),
129
131
  column.component === "BwaInputCondition" ? (openBlock(), createBlock(_component_BwaPctInputCondition, {
130
132
  key: 1,
131
133
  modelValue: data.value,
132
134
  "onUpdate:modelValue": ($event) => data.value = $event,
133
135
  column,
134
- showTitle: props.showTitle
136
+ showTitle: props.showTitle,
137
+ onSearchBlur: _cache[1] || (_cache[1] = () => unref(handleSearch)())
135
138
  }, null, 8, ["modelValue", "onUpdate:modelValue", "column", "showTitle"])) : createCommentVNode("v-if", true),
136
139
  column.component === "BwaDateRangeCondition" ? (openBlock(), createBlock(_component_BwaPctDateRangeCondition, {
137
140
  key: 2,
138
141
  modelValue: data.value,
139
142
  "onUpdate:modelValue": ($event) => data.value = $event,
140
- showTitle: props.showTitle
143
+ showTitle: props.showTitle,
144
+ onSearchBlur: _cache[2] || (_cache[2] = () => unref(handleSearch)())
141
145
  }, null, 8, ["modelValue", "onUpdate:modelValue", "showTitle"])) : createCommentVNode("v-if", true)
142
146
  ];
143
147
  }),
@@ -161,10 +165,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
161
165
  "suffix-icon": "Search",
162
166
  clearable: "",
163
167
  modelValue: unref(searchValue),
164
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(searchValue) ? searchValue.value = $event : null),
168
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => isRef(searchValue) ? searchValue.value = $event : null),
165
169
  placeholder: __props.searchPlaceholder,
166
- class: normalizeClass(unref(ns).e("search"))
167
- }, null, 8, ["modelValue", "placeholder", "class"])
170
+ class: normalizeClass(unref(ns).e("search")),
171
+ onBlur: unref(handleSearch),
172
+ onKeyup: withKeys(unref(handleSearch), ["enter"])
173
+ }, null, 8, ["modelValue", "placeholder", "class", "onBlur", "onKeyup"])
168
174
  ], 4)) : createCommentVNode("v-if", true),
169
175
  __props.showFieldOptions ? (openBlock(), createBlock(PctFilterPanelItem, {
170
176
  key: 1,
@@ -174,7 +180,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
174
180
  __props.showFieldOptions ? (openBlock(), createBlock(_component_BwaAdvanceSelect, {
175
181
  key: 0,
176
182
  modelValue: unref(selectedColumnAttrNames),
177
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(selectedColumnAttrNames) ? selectedColumnAttrNames.value = $event : null),
183
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => isRef(selectedColumnAttrNames) ? selectedColumnAttrNames.value = $event : null),
178
184
  "show-selectIcon": false,
179
185
  onSearch: unref(handleFieldSearch),
180
186
  class: normalizeClass(unref(ns).e("options")),
@@ -205,7 +211,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
205
211
  }, {
206
212
  default: withCtx(() => [
207
213
  createVNode(_component_ElCheckbox, {
208
- onClick: _cache[1] || (_cache[1] = withModifiers(() => {
214
+ onClick: _cache[4] || (_cache[4] = withModifiers(() => {
209
215
  }, ["prevent"])),
210
216
  modelValue: unref(selectedColumnAttrNames).includes(column.fullAttrName),
211
217
  class: normalizeClass(unref(ns).be("filter", "checkbox"))
@@ -233,7 +239,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
233
239
  class: normalizeClass(unref(ns).e("reset")),
234
240
  onClick: unref(handleSearch)
235
241
  }, {
236
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
242
+ default: withCtx(() => [..._cache[6] || (_cache[6] = [
237
243
  createTextVNode(" \u67E5\u8BE2 ", -1)
238
244
  ])]),
239
245
  _: 1
@@ -242,7 +248,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
242
248
  class: normalizeClass(unref(ns).e("reset")),
243
249
  onClick: unref(handleReset)
244
250
  }, {
245
- default: withCtx(() => [..._cache[4] || (_cache[4] = [
251
+ default: withCtx(() => [..._cache[7] || (_cache[7] = [
246
252
  createTextVNode(" \u91CD\u7F6E ", -1)
247
253
  ])]),
248
254
  _: 1
@@ -54,12 +54,20 @@ const useFilterPanel = (props, context) => {
54
54
  const handleFieldSearch = (value) => {
55
55
  unref(filterPanel).fieldSearchValue = value;
56
56
  };
57
- const handleReset = () => {
58
- unref(filterPanel).resetFilterParams();
59
- context.emit("reset");
60
- };
57
+ let searchTimer = null;
58
+ let resetTimer = null;
61
59
  const handleSearch = () => {
62
- dataTable.value.load();
60
+ clearTimeout(searchTimer);
61
+ searchTimer = setTimeout(() => {
62
+ dataTable.value.load();
63
+ }, 100);
64
+ };
65
+ const handleReset = () => {
66
+ clearTimeout(resetTimer);
67
+ resetTimer = setTimeout(() => {
68
+ unref(filterPanel).resetFilterParams();
69
+ context.emit("reset");
70
+ }, 100);
63
71
  };
64
72
  useEventDispatcher(filterPanel, "params-change", () => {
65
73
  const _filterPanel = unref(filterPanel);
package/es/utils.css CHANGED
@@ -1 +1 @@
1
- .letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-cb2d8ca5]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-cb2d8ca5]{align-items:center;display:flex;width:100%}.option-text[data-v-cb2d8ca5]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1
+ .letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-c1065f11]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-c1065f11]{align-items:center;display:flex;width:100%}.option-text[data-v-c1065f11]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
@@ -85,57 +85,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
85
85
  const dataTable = props.dataTable;
86
86
  dataTable._userService = (_a = userService.value) == null ? void 0 : _a.getUserList;
87
87
  const dataTableEl = vue.ref(null);
88
- const realHeight = vue.computed(() => {
89
- if (props.height !== "auto") {
90
- return props.height;
91
- }
92
- return tableAutoHeight.value;
93
- });
94
- const maxHeight = vue.ref(0);
95
- function updateMaxHeight(list) {
96
- vue.nextTick(() => {
97
- if (!elTable.value)
98
- return;
99
- let h = (list == null ? void 0 : list.length) ? list.length * 64 + 62 : void 0;
100
- if (h) {
101
- elTable.value.$el.style.maxHeight = h + "px";
102
- } else {
103
- elTable.value.$el.style.maxHeight = "";
104
- }
105
- });
106
- }
107
- const tableAutoHeight = vue.ref(300);
108
- const PAGINATION_HEIGHT = 160;
109
- function calcTableHeight() {
110
- vue.nextTick(() => {
111
- if (!dataTableEl.value)
112
- return;
113
- const top = dataTableEl.value.offsetTop;
114
- const viewHeight = window.innerHeight;
115
- const height = viewHeight - top - PAGINATION_HEIGHT - 45;
116
- console.log(height);
117
- tableAutoHeight.value = Math.max(height, 100);
118
- });
119
- }
120
- let resizeTimer = null;
121
- function watchResize() {
122
- clearTimeout(resizeTimer);
123
- resizeTimer = setTimeout(calcTableHeight, 100);
124
- }
125
- vue.onMounted(() => {
126
- calcTableHeight();
127
- window.addEventListener("resize", watchResize);
128
- vue.nextTick(() => {
129
- var _a2;
130
- if ((_a2 = props.dataTable.data) == null ? void 0 : _a2.length) {
131
- updateMaxHeight(props.dataTable.data);
132
- }
133
- });
134
- });
135
- vue.onBeforeUnmount(() => {
136
- window.removeEventListener("resize", watchResize);
137
- clearTimeout(resizeTimer);
138
- });
88
+ const realHeight = vue.computed(() => props.height);
139
89
  const displayColumns = vue.computed(
140
90
  () => vue.unref(dataTable).getDisplayColumns() || []
141
91
  );
@@ -332,7 +282,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
332
282
  vue.createVNode(vue.unref(ElementPlus.ElTable), vue.mergeProps({
333
283
  class: "content",
334
284
  height: realHeight.value,
335
- "max-height": maxHeight.value,
336
285
  ref_key: "elTable",
337
286
  ref: elTable,
338
287
  data: data.value,
@@ -420,7 +369,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
420
369
  vue.renderSlot(_ctx.$slots, "column-append")
421
370
  ]),
422
371
  _: 3
423
- }, 16, ["height", "max-height", "data", "row-key", "onSelectionChange", "border"])
372
+ }, 16, ["height", "data", "row-key", "onSelectionChange", "border"])
424
373
  ]),
425
374
  __props.showPagination ? (vue.openBlock(), vue.createElementBlock("div", {
426
375
  key: 0,
@@ -19,6 +19,7 @@ if (typeof __name === 'undefined') {
19
19
  });
20
20
  }
21
21
  }
22
+ const _hoisted_1 = { style: { "display": "flex", "align-items": "center" } };
22
23
  const __default__ = vue.defineComponent({ name: "BwaDataTableSetting" });
23
24
  const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
24
25
  props: {
@@ -174,6 +175,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
174
175
  return (_ctx, _cache) => {
175
176
  const _component_RefreshRight = vue.resolveComponent("RefreshRight");
176
177
  const _component_Close = vue.resolveComponent("Close");
178
+ const _component_Rank = vue.resolveComponent("Rank");
177
179
  return vue.openBlock(), vue.createBlock(vue.unref(ElementPlus.ElTooltip), vue.mergeProps({
178
180
  visible: value.value,
179
181
  "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => value.value = $event)
@@ -271,10 +273,19 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
271
273
  vue.createElementVNode("div", {
272
274
  class: vue.normalizeClass(vue.unref(ns).e("field-item"))
273
275
  }, [
274
- vue.createElementVNode("span", null, vue.toDisplayString(item.title), 1),
276
+ vue.createElementVNode("span", _hoisted_1, [
277
+ vue.createVNode(vue.unref(ElementPlus.ElIcon), { style: { "margin-right": "5px" } }, {
278
+ default: vue.withCtx(() => [
279
+ vue.createVNode(_component_Rank)
280
+ ]),
281
+ _: 1
282
+ }),
283
+ vue.createTextVNode(" " + vue.toDisplayString(item.title), 1)
284
+ ]),
275
285
  vue.createVNode(vue.unref(ElementPlus.ElSwitch), {
276
286
  modelValue: item.visible,
277
287
  "onUpdate:modelValue": ($event) => item.visible = $event,
288
+ size: "small",
278
289
  disabled: item.settings.disabled,
279
290
  onMousedown: _cache[0] || (_cache[0] = vue.withModifiers(() => {
280
291
  }, ["stop"])),
@@ -311,6 +322,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
311
322
  vue.createVNode(vue.unref(ElementPlus.ElSwitch), {
312
323
  modelValue: column.visible,
313
324
  "onUpdate:modelValue": ($event) => column.visible = $event,
325
+ size: "small",
314
326
  disabled: column.settings.disabled,
315
327
  onChange: (val) => handleColumnVisibleChange(column, val)
316
328
  }, null, 8, ["modelValue", "onUpdate:modelValue", "disabled", "onChange"])
@@ -58,6 +58,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
58
58
  get: () => props.modelValue,
59
59
  set: (v) => emit("update:modelValue", v)
60
60
  });
61
+ const triggerSearch = vue.inject("triggerSearch", () => {
62
+ });
63
+ const isChange = vue.ref(false);
64
+ const handleChange = () => {
65
+ isChange.value = true;
66
+ };
67
+ const handleBlur = () => {
68
+ if (isChange.value) {
69
+ triggerSearch();
70
+ }
71
+ isChange.value = false;
72
+ };
61
73
  return (_ctx, _cache) => {
62
74
  const _component_el_input = vue.resolveComponent("el-input");
63
75
  return vue.openBlock(), vue.createElementBlock("div", {
@@ -73,7 +85,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
73
85
  class: vue.normalizeClass(vue.unref(ns).e("search")),
74
86
  placeholder: placeholderStr.value,
75
87
  modelValue: modelValue.value,
76
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event)
88
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => modelValue.value = $event),
89
+ onKeyup: vue.withKeys(handleBlur, ["enter"]),
90
+ onBlur: handleBlur,
91
+ onChange: handleChange
77
92
  }, null, 8, ["prefix-icon", "class", "placeholder", "modelValue"])
78
93
  ], 2);
79
94
  };
@@ -45,6 +45,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
45
45
  var _a;
46
46
  return (_a = filterPanelItem == null ? void 0 : filterPanelItem.column) != null ? _a : null;
47
47
  });
48
+ const triggerSearch = vue.inject("triggerSearch", () => {
49
+ });
50
+ const isChange = vue.ref(false);
51
+ const handleChange = () => {
52
+ isChange.value = true;
53
+ };
54
+ const handleBlur = () => {
55
+ if (isChange.value) {
56
+ triggerSearch();
57
+ }
58
+ isChange.value = false;
59
+ };
48
60
  const value = vue.computed({
49
61
  get: () => {
50
62
  if (props.modelValue && props.modelValue.start && props.modelValue.end) {
@@ -76,7 +88,9 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
76
88
  "range-separator": "\u81F3",
77
89
  "start-placeholder": "\u5F00\u59CB\u65E5\u671F",
78
90
  "end-placeholder": "\u7ED3\u675F\u65E5\u671F",
79
- "value-format": __props.valueFormat
91
+ "value-format": __props.valueFormat,
92
+ onBlur: handleBlur,
93
+ onChange: handleChange
80
94
  }, null, 8, ["modelValue", "value-format"])
81
95
  ], 2);
82
96
  };
@@ -8,7 +8,7 @@ var webBaseClientVue = require('@ctzy-web-client/web-base-client-vue');
8
8
  var index = require('../../hooks/use-data/index.js');
9
9
  var pinyinPro = require('pinyin-pro');
10
10
  require('../../advance-select/advance-option.js');
11
- require('./pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_cb2d8ca5_lang.js');
11
+ require('./pct-multiple-menu-condition2.vue_vue_type_style_index_0_scoped_c1065f11_lang.js');
12
12
  require('./pct-multiple-menu-condition2.vue_vue_type_style_index_1_lang.js');
13
13
  var _pluginVue_exportHelper = require('../../_virtual/_plugin-vue_export-helper.js');
14
14
 
@@ -49,7 +49,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
49
49
  remoteShowSuffix: { type: Boolean, default: true },
50
50
  reserveKeyword: { type: Boolean, default: false }
51
51
  },
52
- emits: ["update:modelValue", "search", "visible-change"],
52
+ emits: ["update:modelValue", "search", "visible-change", "searchBlur"],
53
53
  setup(__props, { emit: __emit }) {
54
54
  const httpRequest = webBaseClientVue.useService(webBaseClientVue.HttpRequest);
55
55
  const textRef = vue.ref(null);
@@ -177,6 +177,18 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
177
177
  },
178
178
  set: (v) => emit("update:modelValue", v)
179
179
  });
180
+ const triggerSearch = vue.inject("triggerSearch", () => {
181
+ });
182
+ const isChange = vue.ref(false);
183
+ const handleChange = () => {
184
+ isChange.value = true;
185
+ };
186
+ const handleBlur = () => {
187
+ if (isChange.value) {
188
+ triggerSearch();
189
+ }
190
+ isChange.value = false;
191
+ };
180
192
  return (_ctx, _cache) => {
181
193
  return vue.openBlock(), vue.createElementBlock("div", {
182
194
  class: vue.normalizeClass(vue.unref(ns).e("conditbox"))
@@ -195,6 +207,8 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
195
207
  loading: loading.value,
196
208
  "remote-show-suffix": __props.remoteShowSuffix,
197
209
  onVisibleChange: visibleChange,
210
+ onBlur: handleBlur,
211
+ onChange: handleChange,
198
212
  remote: __props.remote,
199
213
  "remote-method": handleFieldSearch,
200
214
  "reserve-keyword": __props.reserveKeyword,
@@ -268,6 +282,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
268
282
  };
269
283
  }
270
284
  });
271
- var PctMultipleMenuCondition = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__scopeId", "data-v-cb2d8ca5"], ["__file", "pct-multiple-menu-condition2.vue"]]);
285
+ var PctMultipleMenuCondition = /* @__PURE__ */ _pluginVue_exportHelper["default"](_sfc_main, [["__scopeId", "data-v-c1065f11"], ["__file", "pct-multiple-menu-condition2.vue"]]);
272
286
 
273
287
  exports["default"] = PctMultipleMenuCondition;
@@ -76,6 +76,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
76
76
  handleReset,
77
77
  handleSearch
78
78
  } = useFilterPanel.useFilterPanel(props, { emit });
79
+ vue.provide("triggerSearch", handleSearch);
79
80
  vue.watch(
80
81
  filterPanel,
81
82
  (filterPanel2, _, onCleanup) => {
@@ -128,20 +129,23 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
128
129
  multiple: column.component !== "BwaSingleMenuCondition",
129
130
  showTitle: props.showTitle,
130
131
  showSearch: (_a = column.componentProps) == null ? void 0 : _a.showSearch,
131
- options: ((_b = column.componentProps) == null ? void 0 : _b.options) || []
132
+ options: ((_b = column.componentProps) == null ? void 0 : _b.options) || [],
133
+ onSearchBlur: _cache[0] || (_cache[0] = () => vue.unref(handleSearch)())
132
134
  }, null, 8, ["modelValue", "onUpdate:modelValue", "column", "multiple", "showTitle", "showSearch", "options"])) : vue.createCommentVNode("v-if", true),
133
135
  column.component === "BwaInputCondition" ? (vue.openBlock(), vue.createBlock(_component_BwaPctInputCondition, {
134
136
  key: 1,
135
137
  modelValue: data.value,
136
138
  "onUpdate:modelValue": ($event) => data.value = $event,
137
139
  column,
138
- showTitle: props.showTitle
140
+ showTitle: props.showTitle,
141
+ onSearchBlur: _cache[1] || (_cache[1] = () => vue.unref(handleSearch)())
139
142
  }, null, 8, ["modelValue", "onUpdate:modelValue", "column", "showTitle"])) : vue.createCommentVNode("v-if", true),
140
143
  column.component === "BwaDateRangeCondition" ? (vue.openBlock(), vue.createBlock(_component_BwaPctDateRangeCondition, {
141
144
  key: 2,
142
145
  modelValue: data.value,
143
146
  "onUpdate:modelValue": ($event) => data.value = $event,
144
- showTitle: props.showTitle
147
+ showTitle: props.showTitle,
148
+ onSearchBlur: _cache[2] || (_cache[2] = () => vue.unref(handleSearch)())
145
149
  }, null, 8, ["modelValue", "onUpdate:modelValue", "showTitle"])) : vue.createCommentVNode("v-if", true)
146
150
  ];
147
151
  }),
@@ -165,10 +169,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
165
169
  "suffix-icon": "Search",
166
170
  clearable: "",
167
171
  modelValue: vue.unref(searchValue),
168
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(searchValue) ? searchValue.value = $event : null),
172
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => vue.isRef(searchValue) ? searchValue.value = $event : null),
169
173
  placeholder: __props.searchPlaceholder,
170
- class: vue.normalizeClass(vue.unref(ns).e("search"))
171
- }, null, 8, ["modelValue", "placeholder", "class"])
174
+ class: vue.normalizeClass(vue.unref(ns).e("search")),
175
+ onBlur: vue.unref(handleSearch),
176
+ onKeyup: vue.withKeys(vue.unref(handleSearch), ["enter"])
177
+ }, null, 8, ["modelValue", "placeholder", "class", "onBlur", "onKeyup"])
172
178
  ], 4)) : vue.createCommentVNode("v-if", true),
173
179
  __props.showFieldOptions ? (vue.openBlock(), vue.createBlock(pctFilterPanelItem["default"], {
174
180
  key: 1,
@@ -178,7 +184,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
178
184
  __props.showFieldOptions ? (vue.openBlock(), vue.createBlock(_component_BwaAdvanceSelect, {
179
185
  key: 0,
180
186
  modelValue: vue.unref(selectedColumnAttrNames),
181
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(selectedColumnAttrNames) ? selectedColumnAttrNames.value = $event : null),
187
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => vue.isRef(selectedColumnAttrNames) ? selectedColumnAttrNames.value = $event : null),
182
188
  "show-selectIcon": false,
183
189
  onSearch: vue.unref(handleFieldSearch),
184
190
  class: vue.normalizeClass(vue.unref(ns).e("options")),
@@ -209,7 +215,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
209
215
  }, {
210
216
  default: vue.withCtx(() => [
211
217
  vue.createVNode(_component_ElCheckbox, {
212
- onClick: _cache[1] || (_cache[1] = vue.withModifiers(() => {
218
+ onClick: _cache[4] || (_cache[4] = vue.withModifiers(() => {
213
219
  }, ["prevent"])),
214
220
  modelValue: vue.unref(selectedColumnAttrNames).includes(column.fullAttrName),
215
221
  class: vue.normalizeClass(vue.unref(ns).be("filter", "checkbox"))
@@ -237,7 +243,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
237
243
  class: vue.normalizeClass(vue.unref(ns).e("reset")),
238
244
  onClick: vue.unref(handleSearch)
239
245
  }, {
240
- default: vue.withCtx(() => [..._cache[3] || (_cache[3] = [
246
+ default: vue.withCtx(() => [..._cache[6] || (_cache[6] = [
241
247
  vue.createTextVNode(" \u67E5\u8BE2 ", -1)
242
248
  ])]),
243
249
  _: 1
@@ -246,7 +252,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
246
252
  class: vue.normalizeClass(vue.unref(ns).e("reset")),
247
253
  onClick: vue.unref(handleReset)
248
254
  }, {
249
- default: vue.withCtx(() => [..._cache[4] || (_cache[4] = [
255
+ default: vue.withCtx(() => [..._cache[7] || (_cache[7] = [
250
256
  vue.createTextVNode(" \u91CD\u7F6E ", -1)
251
257
  ])]),
252
258
  _: 1
@@ -58,12 +58,20 @@ const useFilterPanel = (props, context) => {
58
58
  const handleFieldSearch = (value) => {
59
59
  vue.unref(filterPanel).fieldSearchValue = value;
60
60
  };
61
- const handleReset = () => {
62
- vue.unref(filterPanel).resetFilterParams();
63
- context.emit("reset");
64
- };
61
+ let searchTimer = null;
62
+ let resetTimer = null;
65
63
  const handleSearch = () => {
66
- dataTable.value.load();
64
+ clearTimeout(searchTimer);
65
+ searchTimer = setTimeout(() => {
66
+ dataTable.value.load();
67
+ }, 100);
68
+ };
69
+ const handleReset = () => {
70
+ clearTimeout(resetTimer);
71
+ resetTimer = setTimeout(() => {
72
+ vue.unref(filterPanel).resetFilterParams();
73
+ context.emit("reset");
74
+ }, 100);
67
75
  };
68
76
  webBaseClientVue.useEventDispatcher(filterPanel, "params-change", () => {
69
77
  const _filterPanel = vue.unref(filterPanel);
package/lib/utils.css CHANGED
@@ -1 +1 @@
1
- .letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-cb2d8ca5]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-cb2d8ca5]{align-items:center;display:flex;width:100%}.option-text[data-v-cb2d8ca5]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
1
+ .letter-circle[data-v-9ba46efc]{align-items:center;border-radius:50%;color:#fff;display:flex;font-size:14px;height:24px;justify-content:center;margin-right:8px;width:24px}.pct-select-ellipsis .el-select-dropdown__item{box-sizing:border-box!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;width:100%!important}.letter-circle[data-v-c1065f11]{align-items:center;border-radius:50%;color:#fff;display:flex;flex-shrink:0;font-size:12px;height:22px;justify-content:center;width:22px}.option-container[data-v-c1065f11]{align-items:center;display:flex;width:100%}.option-text[data-v-c1065f11]{flex:1;margin-left:8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ctzy-web-client/plugin-component-vue",
3
- "version": "1.0.50",
3
+ "version": "1.0.52",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "exports": {
@@ -5,7 +5,7 @@
5
5
  <ElTable
6
6
  class="content"
7
7
  :height="realHeight"
8
- :max-height="maxHeight"
8
+
9
9
  ref="elTable"
10
10
  :data="data"
11
11
  :row-key="dataTable.primaryKey"
@@ -204,70 +204,8 @@ dataTable._userService = userService.value?.getUserList
204
204
 
205
205
  const dataTableEl = ref(null);
206
206
  // const realHeight = computed(() => props.height)
207
- const realHeight = computed(() => {
208
- // 如果用户传了 height,就用用户的
209
- if (props.height !== 'auto') {
210
- return props.height
211
- }
212
- // 否则自动计算表格高度
213
- return tableAutoHeight.value
214
- })
215
- const maxHeight = ref(0)
216
-
217
- // 计算最大高度
218
- function updateMaxHeight(list) {
219
- nextTick(()=>{
220
- if(!elTable.value) return
221
- let h = list?.length ? list.length * 64 + 62 : undefined
222
- if(h){
223
- elTable.value.$el.style.maxHeight = h + 'px'
224
- }else{
225
- elTable.value.$el.style.maxHeight = ''
226
- }
227
- })
228
- }
229
- // ====================
230
- // 自动高度计算(react-base-table 同款逻辑)
231
- // ====================
232
- const tableAutoHeight = ref(300)
233
-
234
-
235
- // 分页高度(固定,根据你的样式调整)
236
- const PAGINATION_HEIGHT = 160
237
-
238
- // 计算表格高度 = 屏幕高度 - 自身offsetTop高度 - 分页高度
239
- function calcTableHeight() {
240
- nextTick(() => {
241
- if (!dataTableEl.value) return
242
- const top = dataTableEl.value.offsetTop // 自动获取顶部距离
243
- const viewHeight = window.innerHeight
244
- const height = viewHeight - top - PAGINATION_HEIGHT-45
245
- console.log(height)
246
- tableAutoHeight.value = Math.max(height, 100) // 最小200px
247
-
248
- })
249
- }
250
-
251
- // 防抖监听窗口缩放
252
- let resizeTimer = null
253
- function watchResize() {
254
- clearTimeout(resizeTimer)
255
- resizeTimer = setTimeout(calcTableHeight, 100)
256
- }
257
- onMounted(() => {
258
- calcTableHeight()
259
- window.addEventListener('resize', watchResize)
260
- nextTick(()=>{
261
- if(props.dataTable.data?.length){
262
- updateMaxHeight(props.dataTable.data)
263
- }
264
- })
265
- })
207
+ const realHeight = computed(() => props.height)
266
208
 
267
- onBeforeUnmount(() => {
268
- window.removeEventListener('resize', watchResize)
269
- clearTimeout(resizeTimer)
270
- })
271
209
 
272
210
  const displayColumns = computed(
273
211
  () => unref(dataTable).getDisplayColumns() || []
@@ -66,12 +66,13 @@
66
66
  <template #default="{ item }">
67
67
  <div :class="ns.be('section', 'content')">
68
68
  <div :class="ns.e('field-item')">
69
- <span>
69
+ <span style="display: flex;align-items: center">
70
+ <el-icon style="margin-right: 5px"><Rank /></el-icon>
70
71
  {{ item.title }}
71
72
  </span>
72
73
  <ElSwitch
73
74
  v-model="item.visible"
74
-
75
+ size="small"
75
76
  :disabled="item.settings.disabled"
76
77
  @mousedown.stop
77
78
  @change="(val) => handleColumnVisibleChange(item, val)"
@@ -102,7 +103,7 @@
102
103
  </span>
103
104
  <ElSwitch
104
105
  v-model="column.visible"
105
-
106
+ size="small"
106
107
  :disabled="column.settings.disabled"
107
108
  @change="(val) => handleColumnVisibleChange(column, val)"
108
109
  />
@@ -3,18 +3,21 @@
3
3
  <span v-if="showTitle" :class="ns.e('title')">{{column.title}}</span>
4
4
  <el-input
5
5
  :prefix-icon="showIcon ? prefixIcon : ''"
6
-
6
+
7
7
  clearable
8
8
  :class="ns.e('search')"
9
9
  :placeholder="placeholderStr"
10
10
  v-model="modelValue"
11
+ @keyup.enter="handleBlur"
12
+ @blur="handleBlur"
13
+ @change="handleChange"
11
14
  />
12
15
  </div>
13
16
  </template>
14
17
 
15
18
  <script setup>
16
19
  import { useNamespace, filterPanelItemKey } from '@ctzy-web-client/web-base-client-vue';
17
- import {computed, defineEmits, inject, useAttrs} from 'vue';
20
+ import {computed, defineEmits, inject, ref, useAttrs} from 'vue';
18
21
  import {dataProps} from "../../hooks/use-data";
19
22
  const ns = useNamespace('pct-input');
20
23
  const emit = defineEmits(['update:modelValue']);
@@ -56,6 +59,17 @@ const modelValue = computed({
56
59
  get: () => props.modelValue,
57
60
  set: (v) => emit('update:modelValue', v),
58
61
  });
62
+ const triggerSearch = inject('triggerSearch', () => {});
63
+ const isChange = ref(false)
64
+ const handleChange = () => {
65
+ isChange.value = true
66
+ }
67
+ const handleBlur = () => {
68
+ if (isChange.value) {
69
+ triggerSearch();
70
+ }
71
+ isChange.value = false
72
+ };
59
73
  </script>
60
74
 
61
75
  <style scoped>
@@ -8,13 +8,14 @@
8
8
  start-placeholder="开始日期"
9
9
  end-placeholder="结束日期"
10
10
  :value-format="valueFormat"
11
-
11
+ @blur="handleBlur"
12
+ @change="handleChange"
12
13
  />
13
14
  </div>
14
15
  </template>
15
16
 
16
17
  <script setup>
17
- import {computed, inject} from 'vue';
18
+ import {computed, inject, ref} from 'vue';
18
19
  import {useNamespace, filterPanelItemKey} from '@ctzy-web-client/web-base-client-vue';
19
20
  const ns = useNamespace('pct-daterange');
20
21
  defineOptions({
@@ -41,7 +42,17 @@ const emit = defineEmits(['update:modelValue']);
41
42
 
42
43
  const filterPanelItem = inject(filterPanelItemKey);
43
44
  const column = computed(() => filterPanelItem?.column ?? null);
44
-
45
+ const triggerSearch = inject('triggerSearch', () => {});
46
+ const isChange = ref(false)
47
+ const handleChange = () => {
48
+ isChange.value = true
49
+ }
50
+ const handleBlur = () => {
51
+ if (isChange.value) {
52
+ triggerSearch();
53
+ }
54
+ isChange.value = false
55
+ };
45
56
  const value = computed({
46
57
  get: () => {
47
58
  if (props.modelValue && props.modelValue.start && props.modelValue.end) {
@@ -11,6 +11,8 @@
11
11
  :loading="loading"
12
12
  :remote-show-suffix="remoteShowSuffix"
13
13
  @visible-change="visibleChange"
14
+ @blur="handleBlur"
15
+ @change="handleChange"
14
16
  :remote="remote"
15
17
  :remote-method="handleFieldSearch"
16
18
  :reserve-keyword="reserveKeyword"
@@ -126,7 +128,7 @@ const attrs = useAttrs();
126
128
  const showTitle = computed(() => attrs.showTitle);
127
129
  const data = ref([]);
128
130
  const loading = ref(false);
129
- const emit = defineEmits(['update:modelValue', 'search', 'visible-change']);
131
+ const emit = defineEmits(['update:modelValue', 'search', 'visible-change','searchBlur']);
130
132
  const filterPanelItem = inject(filterPanelItemKey, null);
131
133
  const column = computed(() => filterPanelItem?.column ?? null);
132
134
 
@@ -223,6 +225,17 @@ const modelValue = computed({
223
225
  : (props.modelValue ?? ''),
224
226
  set: (v) => emit('update:modelValue', v),
225
227
  });
228
+ const triggerSearch = inject('triggerSearch', () => {});
229
+ const isChange = ref(false)
230
+ const handleChange = () => {
231
+ isChange.value = true
232
+ }
233
+ const handleBlur = () => {
234
+ if (isChange.value) {
235
+ triggerSearch();
236
+ }
237
+ isChange.value = false
238
+ };
226
239
  </script>
227
240
 
228
241
  <style scoped>
@@ -17,17 +17,20 @@
17
17
  :showTitle="props.showTitle"
18
18
  :showSearch="column.componentProps?.showSearch"
19
19
  :options="column.componentProps?.options || []"
20
+ @searchBlur="() => handleSearch()"
20
21
  />
21
22
  <BwaPctInputCondition
22
23
  v-if="column.component === 'BwaInputCondition'"
23
24
  v-model="data.value"
24
25
  :column="column"
25
26
  :showTitle="props.showTitle"
27
+ @searchBlur="() => handleSearch()"
26
28
  />
27
29
  <BwaPctDateRangeCondition
28
30
  v-if="column.component === 'BwaDateRangeCondition'"
29
31
  v-model="data.value"
30
32
  :showTitle="props.showTitle"
33
+ @searchBlur="() => handleSearch()"
31
34
  />
32
35
  </template>
33
36
  </PctFilterPanelItem>
@@ -42,11 +45,13 @@
42
45
  <div v-if="showTitle" :class="ns.e('title')" style="padding-right: 8px">{{searchTitle}}</div>
43
46
  <ElInput
44
47
  suffix-icon="Search"
45
-
48
+
46
49
  clearable
47
50
  v-model="searchValue"
48
51
  :placeholder="searchPlaceholder"
49
52
  :class="ns.e('search')"
53
+ @blur="handleSearch"
54
+ @keyup.enter="handleSearch"
50
55
  />
51
56
  </div>
52
57
  <PctFilterPanelItem v-if="showFieldOptions" style="width: auto;padding-right: 16px">
@@ -60,7 +65,7 @@
60
65
  >
61
66
  <template #reference-content>
62
67
  <ElButton
63
-
68
+
64
69
  :class="ns.e('filterBut')"
65
70
  >
66
71
  <div :class="ns.be('filter', 'plus')"></div>
@@ -90,7 +95,7 @@
90
95
 
91
96
 
92
97
  <ElButton
93
-
98
+
94
99
  type="primary"
95
100
  :class="ns.e('reset')"
96
101
  @click="handleSearch"
@@ -98,7 +103,7 @@
98
103
  查询
99
104
  </ElButton>
100
105
  <ElButton
101
-
106
+
102
107
  :class="ns.e('reset')"
103
108
  @click="handleReset"
104
109
  >
@@ -175,7 +180,7 @@ const {
175
180
  handleReset,
176
181
  handleSearch
177
182
  } = useFilterPanel(props, { emit });
178
-
183
+ provide('triggerSearch', handleSearch);
179
184
  watch(
180
185
  filterPanel,
181
186
  (filterPanel, _, onCleanup) => {
@@ -77,13 +77,26 @@ export const useFilterPanel = (props, context) => {
77
77
  unref(filterPanel).fieldSearchValue = value;
78
78
  };
79
79
 
80
+ // 顶部加这两个定时器
81
+ let searchTimer = null;
82
+ let resetTimer = null;
83
+
84
+ // 查询(防重复)
85
+ const handleSearch = () => {
86
+ clearTimeout(searchTimer);
87
+ searchTimer = setTimeout(() => {
88
+ dataTable.value.load();
89
+ }, 100);
90
+ };
91
+
92
+ // 重置(防重复)
80
93
  const handleReset = () => {
81
- unref(filterPanel).resetFilterParams();
82
- context.emit('reset');
94
+ clearTimeout(resetTimer);
95
+ resetTimer = setTimeout(() => {
96
+ unref(filterPanel).resetFilterParams();
97
+ context.emit('reset');
98
+ }, 100);
83
99
  };
84
- const handleSearch = () => {
85
- dataTable.value.load()
86
- }
87
100
 
88
101
  useEventDispatcher(filterPanel, 'params-change', () => {
89
102
  const _filterPanel = unref(filterPanel);