@fmdeui/fmui 1.0.167 → 1.0.169

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.
@@ -111,7 +111,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
111
111
  const emits = __emit;
112
112
  const slots = useSlots();
113
113
  const isDefaultSelectVal = ref(true);
114
- const forbidden = ref(true);
115
114
  const isRadio = ref(false);
116
115
  const isQueryVisible = ref(false);
117
116
  const isVisible = ref(false);
@@ -144,7 +143,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
144
143
  }
145
144
  });
146
145
  const state = reactive({
147
- defaultSelectValue: props.defaultSelectVal,
146
+ defaultSelectValue: Array.isArray(props.defaultSelectVal) ? props.defaultSelectVal : props.defaultSelectVal ? [props.defaultSelectVal] : [],
148
147
  // 默认选中
149
148
  tableData: props.table.data,
150
149
  // table数据
@@ -204,8 +203,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
204
203
  watch(
205
204
  () => props.defaultSelectVal,
206
205
  (val) => {
207
- state.defaultSelectValue = val;
208
- if (val.length > 0) {
206
+ const valArray = Array.isArray(val) ? val : val ? [val] : [];
207
+ state.defaultSelectValue = valArray;
208
+ if (valArray.length > 0) {
209
209
  if (props.multiple) {
210
210
  if (isDefaultSelectVal.value) {
211
211
  defaultSelect(state.defaultSelectValue);
@@ -246,6 +246,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
246
246
  });
247
247
  const internalLoading = ref(false);
248
248
  const internalQueryParams = reactive({ ...props.queryParams });
249
+ const fromqueryParams = reactive({});
249
250
  const fetchTableData = async (isResetPage = false) => {
250
251
  if (!props.apiService) return;
251
252
  internalLoading.value = true;
@@ -256,12 +257,18 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
256
257
  const requestParams = {
257
258
  page: pagination.currentPage,
258
259
  pageSize: pagination.pageSize,
259
- ...internalQueryParams
260
+ ...internalQueryParams,
261
+ ...fromqueryParams
260
262
  };
261
263
  const res = await useBaseApi(props.apiService).post(requestParams, props.apiAction);
262
264
  const formatted = props.responseFormatter(res);
263
265
  pagination.total = formatted.total;
264
266
  state.tableData = formatted.data;
267
+ if (formatted.data && formatted.data.length > 0) {
268
+ formatted.data.forEach((item) => {
269
+ state.tabularMap[item[props.keywords.value]] = item[props.keywords.label];
270
+ });
271
+ }
265
272
  if (props.useVirtual) {
266
273
  saveDATA.value = formatted.data;
267
274
  updateRenderData(scrollTopNum.value);
@@ -342,6 +349,11 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
342
349
  const handleEvent = () => {
343
350
  selectRef.value.expanded = true;
344
351
  };
352
+ const handleSubmit = (from) => {
353
+ selectRef.value.expanded = true;
354
+ fromqueryParams.value = from;
355
+ fetchTableData(true);
356
+ };
345
357
  const queryVisibleChange = (val) => {
346
358
  isQueryVisible.value = val;
347
359
  };
@@ -389,16 +401,21 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
389
401
  };
390
402
  const findLabel = () => {
391
403
  nextTick(() => {
392
- var _a;
404
+ var _a, _b;
393
405
  if (props.multiple) {
394
- (_a = selectRef.value.selected) == null ? void 0 : _a.forEach((item) => {
395
- item.currentLabel = item.value;
406
+ (_b = (_a = selectRef.value) == null ? void 0 : _a.selected) == null ? void 0 : _b.forEach((item) => {
407
+ var _a2;
408
+ const targetId = item.value;
409
+ const foundLabel = state.tabularMap[targetId] || ((_a2 = state.tableData.find((row) => row[props.keywords.value] === targetId)) == null ? void 0 : _a2[props.keywords.label]) || targetId;
410
+ item.currentLabel = foundLabel;
396
411
  });
397
412
  } else {
413
+ const isObj = state.defaultValue && typeof state.defaultValue === "object";
414
+ const currentLabel = isObj ? state.defaultValue[props.keywords.label] : "";
398
415
  if (props.isRadioEchoLabel) {
399
- selectDefaultLabel.value = state.defaultValue && state.defaultValue[props.keywords.label] || props.radioSelectValLabel;
416
+ selectDefaultLabel.value = currentLabel || props.radioSelectValLabel || "";
400
417
  } else {
401
- selectDefaultLabel.value = state.defaultValue && state.defaultValue[props.keywords.label] || "";
418
+ selectDefaultLabel.value = currentLabel;
402
419
  }
403
420
  }
404
421
  });
@@ -423,7 +440,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
423
440
  nowIndex.value = -1;
424
441
  radioVal.value = "";
425
442
  isDefaultSelectVal.value = true;
426
- forbidden.value = false;
427
443
  }
428
444
  };
429
445
  const defaultSelect = (defaultSelectVal) => {
@@ -563,15 +579,9 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
563
579
  isDefaultSelectVal.value = false;
564
580
  radioClick(row, rowValue);
565
581
  };
566
- const isForbidden = () => {
567
- forbidden.value = false;
568
- setTimeout(() => {
569
- forbidden.value = true;
570
- }, 0);
571
- };
572
582
  const radioClick = (row, rowValue) => {
573
- forbidden.value = !forbidden.value;
574
- if (radioVal.value === rowValue) {
583
+ const isAlreadySelected = state.defaultValue && state.defaultValue[props.keywords.value] === rowValue;
584
+ if (isAlreadySelected) {
575
585
  if (!props.radioSameIsCancel) return;
576
586
  clear();
577
587
  } else {
@@ -585,7 +595,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
585
595
  }
586
596
  };
587
597
  const updateState = (row, rowValue) => {
588
- isForbidden();
589
598
  radioVal.value = rowValue;
590
599
  state.defaultValue = row;
591
600
  emits("radioChange", row, rowValue);
@@ -639,7 +648,6 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
639
648
  }
640
649
  nowIndex.value = -1;
641
650
  radioVal.value = "";
642
- forbidden.value = false;
643
651
  selectDefaultLabel.value = null;
644
652
  resetDefaultState();
645
653
  emits("radioChange", null, null);
@@ -726,7 +734,8 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
726
734
  ref_key: "fQueryConditionRef",
727
735
  ref: fQueryConditionRef,
728
736
  boolEnter: false,
729
- onHandleEvent: handleEvent
737
+ onHandleEvent: handleEvent,
738
+ onSubmit: handleSubmit
730
739
  }, _ctx.$attrs),
731
740
  createSlots({
732
741
  _: 2
@@ -824,7 +833,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
824
833
  createVNode(_component_el_radio, {
825
834
  modelValue: radioVal.value,
826
835
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => radioVal.value = $event),
827
- label: scope.row[__props.keywords.label],
836
+ label: scope.row[__props.keywords.value],
828
837
  value: scope.row[__props.keywords.value],
829
838
  disabled: scope.row.isRadioDisabled,
830
839
  onClick: withModifiers(($event) => radioChangeHandle($event, scope.row, scope.row[__props.keywords.value]), ["stop"])
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! fmdeui-fmui v1.0.167 */
1
+ /*! fmdeui-fmui v1.0.169 */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vxe-table'), require('@vxe-ui/plugin-render-element'), require('@vxe-ui/plugin-export-xlsx'), require('vxe-pc-ui'), require('exceljs'), require('@element-plus/icons-vue'), require('vue'), require('element-plus'), require('lodash-es'), require('js-cookie'), require('pinia'), require('vue-router'), require('@vueuse/core'), require('crypto-js'), require('xlsx-js-style'), require('vue-i18n'), require('sortablejs'), require('screenfull'), require('push.js'), require('mitt'), require('@microsoft/signalr'), require('axios')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'vxe-table', '@vxe-ui/plugin-render-element', '@vxe-ui/plugin-export-xlsx', 'vxe-pc-ui', 'exceljs', '@element-plus/icons-vue', 'vue', 'element-plus', 'lodash-es', 'js-cookie', 'pinia', 'vue-router', '@vueuse/core', 'crypto-js', 'xlsx-js-style', 'vue-i18n', 'sortablejs', 'screenfull', 'push.js', 'mitt', '@microsoft/signalr', 'axios'], factory) :
@@ -23154,7 +23154,6 @@
23154
23154
  const emits = __emit;
23155
23155
  const slots = vue.useSlots();
23156
23156
  const isDefaultSelectVal = vue.ref(true);
23157
- const forbidden = vue.ref(true);
23158
23157
  const isRadio = vue.ref(false);
23159
23158
  const isQueryVisible = vue.ref(false);
23160
23159
  const isVisible = vue.ref(false);
@@ -23187,7 +23186,7 @@
23187
23186
  }
23188
23187
  });
23189
23188
  const state = vue.reactive({
23190
- defaultSelectValue: props.defaultSelectVal,
23189
+ defaultSelectValue: Array.isArray(props.defaultSelectVal) ? props.defaultSelectVal : props.defaultSelectVal ? [props.defaultSelectVal] : [],
23191
23190
  // 默认选中
23192
23191
  tableData: props.table.data,
23193
23192
  // table数据
@@ -23247,8 +23246,9 @@
23247
23246
  vue.watch(
23248
23247
  () => props.defaultSelectVal,
23249
23248
  (val) => {
23250
- state.defaultSelectValue = val;
23251
- if (val.length > 0) {
23249
+ const valArray = Array.isArray(val) ? val : val ? [val] : [];
23250
+ state.defaultSelectValue = valArray;
23251
+ if (valArray.length > 0) {
23252
23252
  if (props.multiple) {
23253
23253
  if (isDefaultSelectVal.value) {
23254
23254
  defaultSelect(state.defaultSelectValue);
@@ -23289,6 +23289,7 @@
23289
23289
  });
23290
23290
  const internalLoading = vue.ref(false);
23291
23291
  const internalQueryParams = vue.reactive({ ...props.queryParams });
23292
+ const fromqueryParams = vue.reactive({});
23292
23293
  const fetchTableData = async (isResetPage = false) => {
23293
23294
  if (!props.apiService) return;
23294
23295
  internalLoading.value = true;
@@ -23299,12 +23300,18 @@
23299
23300
  const requestParams = {
23300
23301
  page: pagination.currentPage,
23301
23302
  pageSize: pagination.pageSize,
23302
- ...internalQueryParams
23303
+ ...internalQueryParams,
23304
+ ...fromqueryParams
23303
23305
  };
23304
23306
  const res = await useBaseApi(props.apiService).post(requestParams, props.apiAction);
23305
23307
  const formatted = props.responseFormatter(res);
23306
23308
  pagination.total = formatted.total;
23307
23309
  state.tableData = formatted.data;
23310
+ if (formatted.data && formatted.data.length > 0) {
23311
+ formatted.data.forEach((item) => {
23312
+ state.tabularMap[item[props.keywords.value]] = item[props.keywords.label];
23313
+ });
23314
+ }
23308
23315
  if (props.useVirtual) {
23309
23316
  saveDATA.value = formatted.data;
23310
23317
  updateRenderData(scrollTopNum.value);
@@ -23385,6 +23392,11 @@
23385
23392
  const handleEvent = () => {
23386
23393
  selectRef.value.expanded = true;
23387
23394
  };
23395
+ const handleSubmit = (from) => {
23396
+ selectRef.value.expanded = true;
23397
+ fromqueryParams.value = from;
23398
+ fetchTableData(true);
23399
+ };
23388
23400
  const queryVisibleChange = (val) => {
23389
23401
  isQueryVisible.value = val;
23390
23402
  };
@@ -23432,16 +23444,21 @@
23432
23444
  };
23433
23445
  const findLabel = () => {
23434
23446
  vue.nextTick(() => {
23435
- var _a;
23447
+ var _a, _b;
23436
23448
  if (props.multiple) {
23437
- (_a = selectRef.value.selected) == null ? void 0 : _a.forEach((item) => {
23438
- item.currentLabel = item.value;
23449
+ (_b = (_a = selectRef.value) == null ? void 0 : _a.selected) == null ? void 0 : _b.forEach((item) => {
23450
+ var _a2;
23451
+ const targetId = item.value;
23452
+ const foundLabel = state.tabularMap[targetId] || ((_a2 = state.tableData.find((row) => row[props.keywords.value] === targetId)) == null ? void 0 : _a2[props.keywords.label]) || targetId;
23453
+ item.currentLabel = foundLabel;
23439
23454
  });
23440
23455
  } else {
23456
+ const isObj = state.defaultValue && typeof state.defaultValue === "object";
23457
+ const currentLabel = isObj ? state.defaultValue[props.keywords.label] : "";
23441
23458
  if (props.isRadioEchoLabel) {
23442
- selectDefaultLabel.value = state.defaultValue && state.defaultValue[props.keywords.label] || props.radioSelectValLabel;
23459
+ selectDefaultLabel.value = currentLabel || props.radioSelectValLabel || "";
23443
23460
  } else {
23444
- selectDefaultLabel.value = state.defaultValue && state.defaultValue[props.keywords.label] || "";
23461
+ selectDefaultLabel.value = currentLabel;
23445
23462
  }
23446
23463
  }
23447
23464
  });
@@ -23466,7 +23483,6 @@
23466
23483
  nowIndex.value = -1;
23467
23484
  radioVal.value = "";
23468
23485
  isDefaultSelectVal.value = true;
23469
- forbidden.value = false;
23470
23486
  }
23471
23487
  };
23472
23488
  const defaultSelect = (defaultSelectVal) => {
@@ -23606,15 +23622,9 @@
23606
23622
  isDefaultSelectVal.value = false;
23607
23623
  radioClick(row, rowValue);
23608
23624
  };
23609
- const isForbidden = () => {
23610
- forbidden.value = false;
23611
- setTimeout(() => {
23612
- forbidden.value = true;
23613
- }, 0);
23614
- };
23615
23625
  const radioClick = (row, rowValue) => {
23616
- forbidden.value = !forbidden.value;
23617
- if (radioVal.value === rowValue) {
23626
+ const isAlreadySelected = state.defaultValue && state.defaultValue[props.keywords.value] === rowValue;
23627
+ if (isAlreadySelected) {
23618
23628
  if (!props.radioSameIsCancel) return;
23619
23629
  clear();
23620
23630
  } else {
@@ -23628,7 +23638,6 @@
23628
23638
  }
23629
23639
  };
23630
23640
  const updateState = (row, rowValue) => {
23631
- isForbidden();
23632
23641
  radioVal.value = rowValue;
23633
23642
  state.defaultValue = row;
23634
23643
  emits("radioChange", row, rowValue);
@@ -23682,7 +23691,6 @@
23682
23691
  }
23683
23692
  nowIndex.value = -1;
23684
23693
  radioVal.value = "";
23685
- forbidden.value = false;
23686
23694
  selectDefaultLabel.value = null;
23687
23695
  resetDefaultState();
23688
23696
  emits("radioChange", null, null);
@@ -23769,7 +23777,8 @@
23769
23777
  ref_key: "fQueryConditionRef",
23770
23778
  ref: fQueryConditionRef,
23771
23779
  boolEnter: false,
23772
- onHandleEvent: handleEvent
23780
+ onHandleEvent: handleEvent,
23781
+ onSubmit: handleSubmit
23773
23782
  }, _ctx.$attrs),
23774
23783
  vue.createSlots({
23775
23784
  _: 2
@@ -23867,7 +23876,7 @@
23867
23876
  vue.createVNode(_component_el_radio, {
23868
23877
  modelValue: radioVal.value,
23869
23878
  "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => radioVal.value = $event),
23870
- label: scope.row[__props.keywords.label],
23879
+ label: scope.row[__props.keywords.value],
23871
23880
  value: scope.row[__props.keywords.value],
23872
23881
  disabled: scope.row.isRadioDisabled,
23873
23882
  onClick: vue.withModifiers(($event) => radioChangeHandle($event, scope.row, scope.row[__props.keywords.value]), ["stop"])