widget.qw 1.0.40 → 1.0.41

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.
package/.env.development CHANGED
@@ -7,4 +7,4 @@ VITE_NEED_LOGIN_CODE=401
7
7
  # 注意:发布时 VITE_IS_DEBUG必须配置为false
8
8
  # 本地开发时 VITE_IS_DEBUG必须配置为true
9
9
  VITE_IS_DEBUG=true
10
- VITE_DEBUG_TOKEN= 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJIb3VNdSIsInJuU3RyIjoiekRaM2g2RFpGTzZta2psYnh4cmlZUHVGNmd0SnloOTUifQ.RbYHsukUgLZ6KwtktTHByCkRBLDs4Wrjz4Vb4mGSINg'
10
+ VITE_DEBUG_TOKEN= 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJsb2dpblR5cGUiOiJsb2dpbiIsImxvZ2luSWQiOiJIb3VNdVhpYW9IYW8iLCJyblN0ciI6IlJaejE1UnRiZEo4bkZ6alVLd29mUEg0RzhLQUwxQzlIIn0.2YiMlmAeY_RAhgTtRxeiuyINwgveEWQ3K6PapfP9kyY'
package/build/style.css CHANGED
@@ -817,27 +817,27 @@
817
817
  /* 防止压缩 */
818
818
  }
819
819
 
820
- .widget[data-v-210abf3c] {
820
+ .widget[data-v-655ddd86] {
821
821
  /* 统一字段间距 */
822
822
  }
823
- .widget[data-v-210abf3c] .van-cell {
823
+ .widget[data-v-655ddd86] .van-cell {
824
824
  align-items: center;
825
825
  }
826
- .widget[data-v-210abf3c] .van-field__label {
826
+ .widget[data-v-655ddd86] .van-field__label {
827
827
  width: 90px;
828
828
  flex: none;
829
829
  }
830
- .widget .readonly-field[data-v-210abf3c] {
830
+ .widget .readonly-field[data-v-655ddd86] {
831
831
  /* 添加必填星号对齐 */
832
832
  }
833
- .widget .readonly-field[data-v-210abf3c] .van-field__control {
833
+ .widget .readonly-field[data-v-655ddd86] .van-field__control {
834
834
  color: #323233;
835
835
  /* 修改文字颜色与普通字段一致 */
836
836
  padding-right: 16px;
837
837
  }
838
- .widget .readonly-field.van-field--required[data-v-210abf3c] .van-field__label::before {
838
+ .widget .readonly-field.van-field--required[data-v-655ddd86] .van-field__label::before {
839
839
  margin-right: 4px;
840
840
  }
841
- .widget .readonly-field[data-v-210abf3c] {
841
+ .widget .readonly-field[data-v-655ddd86] {
842
842
  margin: 4px 0;
843
843
  }
@@ -20584,8 +20584,12 @@ const _sfc_main$1 = {
20584
20584
  __name: "CascaderPicker",
20585
20585
  props: {
20586
20586
  modelValue: {
20587
- type: String,
20588
- default: ""
20587
+ type: [String, Array, Number],
20588
+ default: null
20589
+ },
20590
+ multiple: {
20591
+ type: Boolean,
20592
+ default: false
20589
20593
  },
20590
20594
  label: {
20591
20595
  type: String,
@@ -20629,7 +20633,8 @@ const _sfc_main$1 = {
20629
20633
  const props = __props;
20630
20634
  const data2 = reactive({
20631
20635
  isShowPop: false,
20632
- selectedNode: {}
20636
+ selectedNodes: [],
20637
+ selectedNodeId: null
20633
20638
  });
20634
20639
  const modelValue = useVModel(props, "modelValue", emit);
20635
20640
  const {
@@ -20641,13 +20646,47 @@ const _sfc_main$1 = {
20641
20646
  onMounted(() => {
20642
20647
  });
20643
20648
  const onSelect = (node) => {
20644
- data2.selectedNode = node;
20645
- emit("select", data2.selectedNode);
20649
+ if (!props.multiple) {
20650
+ data2.selectedNodes = [node];
20651
+ emit("select", data2.selectedNodes[0]);
20652
+ modelValue.value = node.id;
20653
+ } else {
20654
+ let one = data2.selectedNodes.find((item) => item.id === node.id);
20655
+ if (!one)
20656
+ data2.selectedNodes = [...data2.selectedNodes, node];
20657
+ emit("select", data2.selectedNodes);
20658
+ modelValue.value = data2.selectedNodes.map((item) => item.id);
20659
+ }
20646
20660
  };
20647
- const onDelete = () => {
20648
- data2.selectedNode = {};
20649
- modelValue.value = null;
20661
+ const onDelete = (idx) => {
20662
+ if (!props.multiple) {
20663
+ modelValue.value = null;
20664
+ } else {
20665
+ modelValue.value.splice(idx, 1);
20666
+ }
20650
20667
  };
20668
+ watch(() => JSON.stringify(modelValue.value), (n, o) => __async(this, null, function* () {
20669
+ if (!props.multiple) {
20670
+ data2.selectedNodeId = modelValue.value;
20671
+ } else {
20672
+ data2.selectedNodes = [];
20673
+ modelValue.value.forEach((id) => __async(this, null, function* () {
20674
+ let params = {};
20675
+ params.id = id;
20676
+ params.isReturnParent = false;
20677
+ params.hasChildren = false;
20678
+ params.hasUsers = true;
20679
+ yield props.idQueryNode(params, (node) => {
20680
+ let one = util.findNode(id, node.children);
20681
+ if (one) {
20682
+ data2.selectedNodes = [...data2.selectedNodes, one];
20683
+ }
20684
+ });
20685
+ }));
20686
+ }
20687
+ }), {
20688
+ immediate: true
20689
+ });
20651
20690
  return (_ctx, _cache) => {
20652
20691
  const _component_van_tag = resolveComponent("van-tag");
20653
20692
  const _component_van_field = resolveComponent("van-field");
@@ -20666,7 +20705,7 @@ const _sfc_main$1 = {
20666
20705
  _: 2
20667
20706
  }, [unref(modelValue) ? {
20668
20707
  name: "input",
20669
- fn: withCtx(() => [unref(modelValue) ? (openBlock(), createBlock(_component_van_tag, {
20708
+ fn: withCtx(() => [!props.multiple ? (openBlock(), createBlock(_component_van_tag, {
20670
20709
  key: 0,
20671
20710
  class: "selected-node",
20672
20711
  closeable: !unref(isDisabled),
@@ -20677,15 +20716,30 @@ const _sfc_main$1 = {
20677
20716
  }, {
20678
20717
  default: withCtx(() => {
20679
20718
  var _a;
20680
- return [createTextVNode(toDisplayString((_a = data2.selectedNode) == null ? void 0 : _a.path), 1)];
20719
+ return [createTextVNode(toDisplayString((_a = data2.selectedNodes[0]) == null ? void 0 : _a.path), 1)];
20681
20720
  }),
20682
20721
  _: 1
20683
- }, 8, ["closeable", "onClose"])) : createCommentVNode("", true)])
20722
+ }, 8, ["closeable", "onClose"])) : createCommentVNode("", true), props.multiple ? (openBlock(true), createElementBlock(Fragment, {
20723
+ key: 1
20724
+ }, renderList(data2.selectedNodes, (item, i) => {
20725
+ return openBlock(), createBlock(_component_van_tag, {
20726
+ class: "selected-node",
20727
+ key: i,
20728
+ closeable: !unref(isDisabled),
20729
+ color: "#fff",
20730
+ "text-color": "#333",
20731
+ size: "medium",
20732
+ onClose: withModifiers(($event) => onDelete(i), ["stop"])
20733
+ }, {
20734
+ default: withCtx(() => [createTextVNode(toDisplayString(item.path), 1)]),
20735
+ _: 2
20736
+ }, 1032, ["closeable", "onClose"]);
20737
+ }), 128)) : createCommentVNode("", true)])
20684
20738
  } : void 0]), 1032, ["label", "required", "rules", "disabled", "placeholder", "is-link"])) : createCommentVNode("", true), createVNode(CascaderPop, {
20685
20739
  show: data2.isShowPop,
20686
20740
  "onUpdate:show": _cache[1] || (_cache[1] = ($event) => data2.isShowPop = $event),
20687
- modelValue: unref(modelValue),
20688
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
20741
+ modelValue: data2.selectedNodeId,
20742
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => data2.selectedNodeId = $event),
20689
20743
  placeholder: props.placeholder,
20690
20744
  onSelect,
20691
20745
  keywordQueryNode: props.keywordQueryNode,
@@ -20694,16 +20748,16 @@ const _sfc_main$1 = {
20694
20748
  };
20695
20749
  }
20696
20750
  };
20697
- var SingleApiPicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => '@charset "UTF-8";\n.widget[data-v-210abf3c] {\n /* \u7EDF\u4E00\u5B57\u6BB5\u95F4\u8DDD */\n}\n.widget[data-v-210abf3c] .van-cell {\n align-items: center;\n}\n.widget[data-v-210abf3c] .van-field__label {\n width: 90px;\n flex: none;\n}\n.widget .readonly-field[data-v-210abf3c] {\n /* \u6DFB\u52A0\u5FC5\u586B\u661F\u53F7\u5BF9\u9F50 */\n}\n.widget .readonly-field[data-v-210abf3c] .van-field__control {\n color: #323233;\n /* \u4FEE\u6539\u6587\u5B57\u989C\u8272\u4E0E\u666E\u901A\u5B57\u6BB5\u4E00\u81F4 */\n padding-right: 16px;\n}\n.widget .readonly-field.van-field--required[data-v-210abf3c] .van-field__label::before {\n margin-right: 4px;\n}\n.widget .readonly-field[data-v-210abf3c] {\n margin: 4px 0;\n}')();
20751
+ var SingleApiPicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => '@charset "UTF-8";\n.widget[data-v-655ddd86] {\n /* \u7EDF\u4E00\u5B57\u6BB5\u95F4\u8DDD */\n}\n.widget[data-v-655ddd86] .van-cell {\n align-items: center;\n}\n.widget[data-v-655ddd86] .van-field__label {\n width: 90px;\n flex: none;\n}\n.widget .readonly-field[data-v-655ddd86] {\n /* \u6DFB\u52A0\u5FC5\u586B\u661F\u53F7\u5BF9\u9F50 */\n}\n.widget .readonly-field[data-v-655ddd86] .van-field__control {\n color: #323233;\n /* \u4FEE\u6539\u6587\u5B57\u989C\u8272\u4E0E\u666E\u901A\u5B57\u6BB5\u4E00\u81F4 */\n padding-right: 16px;\n}\n.widget .readonly-field.van-field--required[data-v-655ddd86] .van-field__label::before {\n margin-right: 4px;\n}\n.widget .readonly-field[data-v-655ddd86] {\n margin: 4px 0;\n}')();
20698
20752
  const _hoisted_1 = {
20699
20753
  class: "widget"
20700
20754
  };
20701
20755
  const _sfc_main = {
20702
20756
  __name: "SingleApiPicker",
20703
20757
  props: {
20704
- modelValue: {
20705
- type: String,
20706
- default: null
20758
+ multiple: {
20759
+ type: Boolean,
20760
+ default: false
20707
20761
  },
20708
20762
  label: {
20709
20763
  type: String,
@@ -20772,7 +20826,8 @@ const _sfc_main = {
20772
20826
  const _component_van_field = resolveComponent("van-field");
20773
20827
  const _component_van_picker = resolveComponent("van-picker");
20774
20828
  const _component_van_popup = resolveComponent("van-popup");
20775
- return openBlock(), createElementBlock("div", _hoisted_1, [createVNode(_component_van_field, {
20829
+ return openBlock(), createElementBlock("div", _hoisted_1, [!unref(isGone) && !props.multiple ? (openBlock(), createBlock(_component_van_field, {
20830
+ key: 0,
20776
20831
  modelValue: unref(formatLabel),
20777
20832
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(formatLabel) ? formatLabel.value = $event : null),
20778
20833
  "is-link": !unref(isReadonly) && !unref(isDisabled),
@@ -20782,7 +20837,7 @@ const _sfc_main = {
20782
20837
  required: unref(isRequired),
20783
20838
  disabled: unref(isDisabled),
20784
20839
  onClick: onShow
20785
- }, null, 8, ["modelValue", "is-link", "label", "placeholder", "required", "disabled"]), createVNode(_component_van_popup, {
20840
+ }, null, 8, ["modelValue", "is-link", "label", "placeholder", "required", "disabled"])) : createCommentVNode("", true), createVNode(_component_van_popup, {
20786
20841
  show: data2.isShow,
20787
20842
  "onUpdate:show": _cache[1] || (_cache[1] = ($event) => data2.isShow = $event),
20788
20843
  "destroy-on-close": "",
@@ -20799,7 +20854,7 @@ const _sfc_main = {
20799
20854
  };
20800
20855
  }
20801
20856
  };
20802
- var SingleApiPicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-210abf3c"]]);
20857
+ var SingleApiPicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-655ddd86"]]);
20803
20858
  const secret_notify = () => {
20804
20859
  showNotify({ type: "danger", message: "\u4E25\u683C\u6267\u884C\u4FE1\u606F\u4FDD\u5BC6\u8981\u6C42\uFF0C\u5207\u5B9E\u9632\u8303\u4F01\u4E1A\u6CC4\u5BC6\u98CE\u9669", duration: 3e3 });
20805
20860
  };
@@ -20587,8 +20587,12 @@ var __async = (__this, __arguments, generator) => {
20587
20587
  __name: "CascaderPicker",
20588
20588
  props: {
20589
20589
  modelValue: {
20590
- type: String,
20591
- default: ""
20590
+ type: [String, Array, Number],
20591
+ default: null
20592
+ },
20593
+ multiple: {
20594
+ type: Boolean,
20595
+ default: false
20592
20596
  },
20593
20597
  label: {
20594
20598
  type: String,
@@ -20632,7 +20636,8 @@ var __async = (__this, __arguments, generator) => {
20632
20636
  const props = __props;
20633
20637
  const data2 = vue.reactive({
20634
20638
  isShowPop: false,
20635
- selectedNode: {}
20639
+ selectedNodes: [],
20640
+ selectedNodeId: null
20636
20641
  });
20637
20642
  const modelValue = useVModel(props, "modelValue", emit);
20638
20643
  const {
@@ -20644,13 +20649,47 @@ var __async = (__this, __arguments, generator) => {
20644
20649
  vue.onMounted(() => {
20645
20650
  });
20646
20651
  const onSelect = (node) => {
20647
- data2.selectedNode = node;
20648
- emit("select", data2.selectedNode);
20652
+ if (!props.multiple) {
20653
+ data2.selectedNodes = [node];
20654
+ emit("select", data2.selectedNodes[0]);
20655
+ modelValue.value = node.id;
20656
+ } else {
20657
+ let one = data2.selectedNodes.find((item) => item.id === node.id);
20658
+ if (!one)
20659
+ data2.selectedNodes = [...data2.selectedNodes, node];
20660
+ emit("select", data2.selectedNodes);
20661
+ modelValue.value = data2.selectedNodes.map((item) => item.id);
20662
+ }
20649
20663
  };
20650
- const onDelete = () => {
20651
- data2.selectedNode = {};
20652
- modelValue.value = null;
20664
+ const onDelete = (idx) => {
20665
+ if (!props.multiple) {
20666
+ modelValue.value = null;
20667
+ } else {
20668
+ modelValue.value.splice(idx, 1);
20669
+ }
20653
20670
  };
20671
+ vue.watch(() => JSON.stringify(modelValue.value), (n, o) => __async(this, null, function* () {
20672
+ if (!props.multiple) {
20673
+ data2.selectedNodeId = modelValue.value;
20674
+ } else {
20675
+ data2.selectedNodes = [];
20676
+ modelValue.value.forEach((id) => __async(this, null, function* () {
20677
+ let params = {};
20678
+ params.id = id;
20679
+ params.isReturnParent = false;
20680
+ params.hasChildren = false;
20681
+ params.hasUsers = true;
20682
+ yield props.idQueryNode(params, (node) => {
20683
+ let one = util.findNode(id, node.children);
20684
+ if (one) {
20685
+ data2.selectedNodes = [...data2.selectedNodes, one];
20686
+ }
20687
+ });
20688
+ }));
20689
+ }
20690
+ }), {
20691
+ immediate: true
20692
+ });
20654
20693
  return (_ctx, _cache) => {
20655
20694
  const _component_van_tag = vue.resolveComponent("van-tag");
20656
20695
  const _component_van_field = vue.resolveComponent("van-field");
@@ -20669,7 +20708,7 @@ var __async = (__this, __arguments, generator) => {
20669
20708
  _: 2
20670
20709
  }, [vue.unref(modelValue) ? {
20671
20710
  name: "input",
20672
- fn: vue.withCtx(() => [vue.unref(modelValue) ? (vue.openBlock(), vue.createBlock(_component_van_tag, {
20711
+ fn: vue.withCtx(() => [!props.multiple ? (vue.openBlock(), vue.createBlock(_component_van_tag, {
20673
20712
  key: 0,
20674
20713
  class: "selected-node",
20675
20714
  closeable: !vue.unref(isDisabled),
@@ -20680,15 +20719,30 @@ var __async = (__this, __arguments, generator) => {
20680
20719
  }, {
20681
20720
  default: vue.withCtx(() => {
20682
20721
  var _a;
20683
- return [vue.createTextVNode(vue.toDisplayString((_a = data2.selectedNode) == null ? void 0 : _a.path), 1)];
20722
+ return [vue.createTextVNode(vue.toDisplayString((_a = data2.selectedNodes[0]) == null ? void 0 : _a.path), 1)];
20684
20723
  }),
20685
20724
  _: 1
20686
- }, 8, ["closeable", "onClose"])) : vue.createCommentVNode("", true)])
20725
+ }, 8, ["closeable", "onClose"])) : vue.createCommentVNode("", true), props.multiple ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, {
20726
+ key: 1
20727
+ }, vue.renderList(data2.selectedNodes, (item, i) => {
20728
+ return vue.openBlock(), vue.createBlock(_component_van_tag, {
20729
+ class: "selected-node",
20730
+ key: i,
20731
+ closeable: !vue.unref(isDisabled),
20732
+ color: "#fff",
20733
+ "text-color": "#333",
20734
+ size: "medium",
20735
+ onClose: vue.withModifiers(($event) => onDelete(i), ["stop"])
20736
+ }, {
20737
+ default: vue.withCtx(() => [vue.createTextVNode(vue.toDisplayString(item.path), 1)]),
20738
+ _: 2
20739
+ }, 1032, ["closeable", "onClose"]);
20740
+ }), 128)) : vue.createCommentVNode("", true)])
20687
20741
  } : void 0]), 1032, ["label", "required", "rules", "disabled", "placeholder", "is-link"])) : vue.createCommentVNode("", true), vue.createVNode(CascaderPop, {
20688
20742
  show: data2.isShowPop,
20689
20743
  "onUpdate:show": _cache[1] || (_cache[1] = ($event) => data2.isShowPop = $event),
20690
- modelValue: vue.unref(modelValue),
20691
- "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null),
20744
+ modelValue: data2.selectedNodeId,
20745
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => data2.selectedNodeId = $event),
20692
20746
  placeholder: props.placeholder,
20693
20747
  onSelect,
20694
20748
  keywordQueryNode: props.keywordQueryNode,
@@ -20697,16 +20751,16 @@ var __async = (__this, __arguments, generator) => {
20697
20751
  };
20698
20752
  }
20699
20753
  };
20700
- var SingleApiPicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => '@charset "UTF-8";\n.widget[data-v-210abf3c] {\n /* \u7EDF\u4E00\u5B57\u6BB5\u95F4\u8DDD */\n}\n.widget[data-v-210abf3c] .van-cell {\n align-items: center;\n}\n.widget[data-v-210abf3c] .van-field__label {\n width: 90px;\n flex: none;\n}\n.widget .readonly-field[data-v-210abf3c] {\n /* \u6DFB\u52A0\u5FC5\u586B\u661F\u53F7\u5BF9\u9F50 */\n}\n.widget .readonly-field[data-v-210abf3c] .van-field__control {\n color: #323233;\n /* \u4FEE\u6539\u6587\u5B57\u989C\u8272\u4E0E\u666E\u901A\u5B57\u6BB5\u4E00\u81F4 */\n padding-right: 16px;\n}\n.widget .readonly-field.van-field--required[data-v-210abf3c] .van-field__label::before {\n margin-right: 4px;\n}\n.widget .readonly-field[data-v-210abf3c] {\n margin: 4px 0;\n}')();
20754
+ var SingleApiPicker_vue_vue_type_style_index_0_scoped_true_lang = /* @__PURE__ */ (() => '@charset "UTF-8";\n.widget[data-v-655ddd86] {\n /* \u7EDF\u4E00\u5B57\u6BB5\u95F4\u8DDD */\n}\n.widget[data-v-655ddd86] .van-cell {\n align-items: center;\n}\n.widget[data-v-655ddd86] .van-field__label {\n width: 90px;\n flex: none;\n}\n.widget .readonly-field[data-v-655ddd86] {\n /* \u6DFB\u52A0\u5FC5\u586B\u661F\u53F7\u5BF9\u9F50 */\n}\n.widget .readonly-field[data-v-655ddd86] .van-field__control {\n color: #323233;\n /* \u4FEE\u6539\u6587\u5B57\u989C\u8272\u4E0E\u666E\u901A\u5B57\u6BB5\u4E00\u81F4 */\n padding-right: 16px;\n}\n.widget .readonly-field.van-field--required[data-v-655ddd86] .van-field__label::before {\n margin-right: 4px;\n}\n.widget .readonly-field[data-v-655ddd86] {\n margin: 4px 0;\n}')();
20701
20755
  const _hoisted_1 = {
20702
20756
  class: "widget"
20703
20757
  };
20704
20758
  const _sfc_main = {
20705
20759
  __name: "SingleApiPicker",
20706
20760
  props: {
20707
- modelValue: {
20708
- type: String,
20709
- default: null
20761
+ multiple: {
20762
+ type: Boolean,
20763
+ default: false
20710
20764
  },
20711
20765
  label: {
20712
20766
  type: String,
@@ -20775,7 +20829,8 @@ var __async = (__this, __arguments, generator) => {
20775
20829
  const _component_van_field = vue.resolveComponent("van-field");
20776
20830
  const _component_van_picker = vue.resolveComponent("van-picker");
20777
20831
  const _component_van_popup = vue.resolveComponent("van-popup");
20778
- return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [vue.createVNode(_component_van_field, {
20832
+ return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [!vue.unref(isGone) && !props.multiple ? (vue.openBlock(), vue.createBlock(_component_van_field, {
20833
+ key: 0,
20779
20834
  modelValue: vue.unref(formatLabel),
20780
20835
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.isRef(formatLabel) ? formatLabel.value = $event : null),
20781
20836
  "is-link": !vue.unref(isReadonly) && !vue.unref(isDisabled),
@@ -20785,7 +20840,7 @@ var __async = (__this, __arguments, generator) => {
20785
20840
  required: vue.unref(isRequired),
20786
20841
  disabled: vue.unref(isDisabled),
20787
20842
  onClick: onShow
20788
- }, null, 8, ["modelValue", "is-link", "label", "placeholder", "required", "disabled"]), vue.createVNode(_component_van_popup, {
20843
+ }, null, 8, ["modelValue", "is-link", "label", "placeholder", "required", "disabled"])) : vue.createCommentVNode("", true), vue.createVNode(_component_van_popup, {
20789
20844
  show: data2.isShow,
20790
20845
  "onUpdate:show": _cache[1] || (_cache[1] = ($event) => data2.isShow = $event),
20791
20846
  "destroy-on-close": "",
@@ -20802,7 +20857,7 @@ var __async = (__this, __arguments, generator) => {
20802
20857
  };
20803
20858
  }
20804
20859
  };
20805
- var SingleApiPicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-210abf3c"]]);
20860
+ var SingleApiPicker = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-655ddd86"]]);
20806
20861
  const secret_notify = () => {
20807
20862
  showNotify({ type: "danger", message: "\u4E25\u683C\u6267\u884C\u4FE1\u606F\u4FDD\u5BC6\u8981\u6C42\uFF0C\u5207\u5B9E\u9632\u8303\u4F01\u4E1A\u6CC4\u5BC6\u98CE\u9669", duration: 3e3 });
20808
20863
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "widget.qw",
3
3
  "private": false,
4
- "version": "1.0.40",
4
+ "version": "1.0.41",
5
5
  "description": "marqstree Vue3组件库",
6
6
  "main": "build/widget.qw.es.js",
7
7
  "keywords": [
@@ -3,15 +3,19 @@
3
3
  :disabled="isDisabled" :placeholder="props.placeholder" :is-link="isReadonly ? false : true"
4
4
  @click="data.isShowPop = !isReadonly" label-class="label">
5
5
  <template #input v-if="modelValue">
6
- <van-tag class="selected-node" v-if="modelValue" :closeable="!isDisabled" color="#fff" text-color="#333"
7
- size="medium" @close.stop="onDelete">
8
- {{ data.selectedNode?.path }}
6
+ <van-tag class="selected-node" v-if="!props.multiple" :closeable="!isDisabled" color="#fff"
7
+ text-color="#333" size="medium" @close.stop="onDelete">
8
+ {{ data.selectedNodes[0]?.path }}
9
+ </van-tag>
10
+ <van-tag class="selected-node" v-if="props.multiple" v-for="(item, i) in data.selectedNodes" :key="i"
11
+ :closeable="!isDisabled" color="#fff" text-color="#333" size="medium" @close.stop="onDelete(i)">
12
+ {{ item.path }}
9
13
  </van-tag>
10
14
  </template>
11
15
  </van-field>
12
16
 
13
- <CascaderPop v-model:show="data.isShowPop" v-model="modelValue" :placeholder="props.placeholder" @select="onSelect"
14
- :keywordQueryNode="props.keywordQueryNode" :idQueryNode="props.idQueryNode" />
17
+ <CascaderPop v-model:show="data.isShowPop" v-model="data.selectedNodeId" :placeholder="props.placeholder"
18
+ @select="onSelect" :keywordQueryNode="props.keywordQueryNode" :idQueryNode="props.idQueryNode" />
15
19
  </template>
16
20
 
17
21
  <script setup>
@@ -22,8 +26,12 @@ import CascaderPop from './CascaderPop.vue'
22
26
 
23
27
  const props = defineProps({
24
28
  modelValue: {
25
- type: String,
26
- default: '',
29
+ type: [String, Array, Number],
30
+ default: null,
31
+ },
32
+ multiple: {
33
+ type: Boolean,
34
+ default: false
27
35
  },
28
36
  label: {
29
37
  type: String,
@@ -62,7 +70,8 @@ const props = defineProps({
62
70
  // 弹出层
63
71
  const data = reactive({
64
72
  isShowPop: false,
65
- selectedNode: {}
73
+ selectedNodes: [],
74
+ selectedNodeId: null
66
75
  })
67
76
 
68
77
  // 定义emit
@@ -75,14 +84,51 @@ onMounted(() => {
75
84
  })
76
85
 
77
86
  const onSelect = (node) => {
78
- data.selectedNode = node
79
- emit('select', data.selectedNode)
87
+ if (!props.multiple) {
88
+ data.selectedNodes = [node]
89
+ emit('select', data.selectedNodes[0])
90
+ modelValue.value = node.id
91
+ }
92
+ else {
93
+ let one = data.selectedNodes.find(item => item.id === node.id)
94
+ if (!one)
95
+ data.selectedNodes = [...data.selectedNodes, node]
96
+ emit('select', data.selectedNodes)
97
+ modelValue.value = data.selectedNodes.map(item=>item.id)
98
+ }
80
99
  }
81
100
 
82
- const onDelete = () => {
83
- data.selectedNode = {}
84
- modelValue.value = null
101
+ const onDelete = (idx) => {
102
+ if (!props.multiple) {
103
+ modelValue.value = null
104
+ } else {
105
+ modelValue.value.splice(idx, 1)
106
+ }
85
107
  }
108
+
109
+ watch(() => JSON.stringify(modelValue.value), async (n, o) => {
110
+ if (!props.multiple) {
111
+ data.selectedNodeId = modelValue.value
112
+ } else {
113
+ data.selectedNodes = []
114
+ modelValue.value.forEach(async(id) => {
115
+ let params = {}
116
+ params.id = id
117
+ params.isReturnParent = false
118
+ params.hasChildren = false
119
+ params.hasUsers=true
120
+ await props.idQueryNode(params,(node)=>{
121
+ let one = util.findNode(id, node.children)
122
+ if(one){
123
+ data.selectedNodes = [...data.selectedNodes, one]
124
+ }
125
+ })
126
+ })
127
+
128
+ }
129
+ }, {
130
+ immediate: true
131
+ })
86
132
  </script>
87
133
 
88
134
  <style scoped></style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="widget">
3
- <van-field v-model="formatLabel" :is-link="!isReadonly && !isDisabled" :label="props.label" :placeholder="props.placeholder" readonly
3
+ <van-field v-if="!isGone && !props.multiple" v-model="formatLabel" :is-link="!isReadonly && !isDisabled" :label="props.label" :placeholder="props.placeholder" readonly
4
4
  :required="isRequired" :disabled="isDisabled" @click="onShow" />
5
5
  <van-popup v-model:show="data.isShow" destroy-on-close round position="bottom">
6
6
  <van-picker :columns="props.options" @cancel="onCancel" @confirm="onConfirm" />
@@ -14,9 +14,9 @@ import util from '../util'
14
14
  import { useVModel } from '@vueuse/core'
15
15
 
16
16
  const props = defineProps({
17
- modelValue: {
18
- type: String,
19
- default: null
17
+ multiple:{
18
+ type:Boolean,
19
+ default:false
20
20
  },
21
21
  label: {
22
22
  type: String,
Binary file