cnhis-design-vue 3.1.0 → 3.1.1

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.1.1](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.1.0...v3.1.1) (2022-06-01)
6
+
7
+
8
+ ### Features
9
+
10
+ * 表格编辑调接口下拉框支持关键字搜索 ([93157a8](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/93157a8e6cfca91f7f146c61ba7986eaa2716d0f))
11
+ * 表格编辑默认状态设置、校验规则可配置 ([e9618a5](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/e9618a57b9c26dc1a354650bf631eadb91cd0552))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * 打印组件选择格式后下拉菜单未收起,也没有选定的格式样式标识 ([f64f656](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/f64f656dc87c0efef1fea114a57fdc94c179b4b6))
17
+ * big-table初始化会强制默认选中所有行 ([55eadeb](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/commit/55eadebe653f366d4fa27d5d82cfef6347d7f322))
18
+
5
19
  ## [3.1.0](http://120.25.59.85:3000/cnhis-frontend/cnhis-design-vue/compare/v3.0.9...v3.1.0) (2022-05-31)
6
20
 
7
21
 
@@ -13323,21 +13323,34 @@ var script$5 = defineComponent({
13323
13323
  emits: ["setOptions", "formChange"],
13324
13324
  setup(props, { attrs, slots, emit }) {
13325
13325
  const state = reactive({
13326
- options: []
13326
+ options: [],
13327
+ loading: false,
13328
+ keyword: "",
13329
+ config: {}
13327
13330
  });
13328
13331
  const setOptions = async () => {
13329
13332
  if (props.col.options) {
13330
13333
  state.options = JSON.parse(JSON.stringify(props.col.options));
13331
13334
  }
13332
13335
  else {
13333
- const optionsName = `${props.col.columnName}_options`;
13334
- state.options = props.row[optionsName] || await props.col.queryOptions();
13335
- if (!props.row[optionsName]) {
13336
- emit("setOptions", state.options);
13337
- }
13336
+ `${props.col.columnName}_options`;
13337
+ const obj = {
13338
+ keyword: state.keyword,
13339
+ row: props.row,
13340
+ column: props.col,
13341
+ index: props.index
13342
+ };
13343
+ state.options = await props.col.queryOptions(obj);
13344
+ state.loading = false;
13345
+ emit("setOptions", state.options);
13338
13346
  }
13339
13347
  };
13340
- setOptions();
13348
+ let selectSearch = (value) => {
13349
+ state.keyword = value;
13350
+ state.loading = true;
13351
+ setOptions();
13352
+ };
13353
+ selectSearch = xeUtils.debounce(selectSearch, 800);
13341
13354
  const onUpdateValue = (value) => {
13342
13355
  emit("formChange", {
13343
13356
  value,
@@ -13346,14 +13359,25 @@ var script$5 = defineComponent({
13346
13359
  index: props.index
13347
13360
  });
13348
13361
  };
13349
- console.log(attrs);
13350
- return () => [createVNode(NSelect, mergeProps(attrs, {
13362
+ const init = () => {
13363
+ if (props.col.options) {
13364
+ setOptions();
13365
+ }
13366
+ else {
13367
+ state.config.remote = true;
13368
+ state.config.onSearch = selectSearch;
13369
+ selectSearch("");
13370
+ }
13371
+ };
13372
+ init();
13373
+ return () => [createVNode(NSelect, mergeProps(attrs, state.config, {
13351
13374
  "options": state.options,
13352
13375
  "consistentMenuWidth": false,
13353
13376
  "clearable": true,
13354
13377
  "filterable": true,
13355
13378
  "to": false,
13356
13379
  "placeholder": "\u8BF7\u9009\u62E9",
13380
+ "loading": state.loading,
13357
13381
  "onUpdateValue": onUpdateValue
13358
13382
  }), null)];
13359
13383
  }
@@ -39741,7 +39765,7 @@ var script = /* @__PURE__ */ defineComponent({
39741
39765
  return;
39742
39766
  let currentPageTableData = table.getTableData()?.tableData;
39743
39767
  let currentPageSelectedRows = currentPageTableData.filter((row) => {
39744
- return currentCheckedKeys.value.includes(row[props.primaryKey]);
39768
+ return row[props.primaryKey] ? currentCheckedKeys.value.includes(row[props.primaryKey]) : false;
39745
39769
  });
39746
39770
  setCurrentCheckedLength();
39747
39771
  if (!currentPageSelectedRows || !currentPageSelectedRows.length) {
@@ -39862,6 +39886,9 @@ var script = /* @__PURE__ */ defineComponent({
39862
39886
  if (!isEdit || item.columnName === "operatorColumn" || !item.isEdit) {
39863
39887
  return formatter(params, item);
39864
39888
  }
39889
+ else if (isEdit && item.isEdit && item.checkEditStatus && item.checkEditStatus(params)) {
39890
+ return formatterEdit(params, item);
39891
+ }
39865
39892
  else {
39866
39893
  return createVNode("span", null, [getDefaultValue(params, item)]);
39867
39894
  }
@@ -41612,6 +41639,7 @@ var script = /* @__PURE__ */ defineComponent({
41612
41639
  iconClose: "iconfont icon-a-xitongtubiaotianjia"
41613
41640
  },
41614
41641
  "keyboard-config": _ctx.columnConfig.keyboardConfig || {},
41642
+ "edit-rules": _ctx.columnConfig.editRules || {},
41615
41643
  onCellDblclick: rowdblclick,
41616
41644
  onCellClick: handlerClickRow,
41617
41645
  onCheckboxChange: selectionChange,
@@ -41662,7 +41690,7 @@ var script = /* @__PURE__ */ defineComponent({
41662
41690
  }
41663
41691
  })]),
41664
41692
  _: 3
41665
- }, 8, ["seq-config", "tree-config", "row-id", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
41693
+ }, 8, ["seq-config", "tree-config", "row-id", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config", "edit-rules"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
41666
41694
  class: "refresh",
41667
41695
  onClick: hanldeClickRefresh
41668
41696
  }, [createVNode(unref(NIcon), {
@@ -611,3 +611,7 @@ body > .vxe-table--tooltip-wrapper {
611
611
  margin-left: 8px;
612
612
  margin-bottom: 8px;
613
613
  }
614
+
615
+ .rowFoldHideBtnList-dropdown .n-dropdown-menu-wrapper span.active {
616
+ color: #5585f5;
617
+ }
@@ -7898,18 +7898,65 @@ const __default__ = create({
7898
7898
  var script = /* @__PURE__ */ defineComponent({
7899
7899
  ...__default__,
7900
7900
  props: {
7901
- btnText: { type: String, required: false, default: "\u6253\u5370" },
7902
- printText: { type: String, required: false, default: "\u76F4\u63A5\u6253\u5370" },
7903
- previewText: { type: String, required: false, default: "\u6253\u5370\u9884\u89C8" },
7904
- formatEditText: { type: String, required: false, default: "\u683C\u5F0F\u7F16\u8F91" },
7905
- identityVerificationTitle: { type: String, required: false, default: "\u6253\u5370\u670D\u52A1\u8EAB\u4EFD\u6821\u9A8C" },
7906
- params: { type: Array, required: false, default: () => [] },
7907
- prevFn: { type: Function, required: false, default: () => Promise.resolve() },
7908
- verifyUser: { type: Function, required: false, default: () => Promise.resolve() },
7909
- queryPrintFormatByNumber: { type: Function, required: true, default: () => Promise.resolve({}) },
7910
- queryTemplateParams: { type: Function, required: false, default: () => Promise.resolve({}) },
7911
- strategy: { type: String, required: false, default: "MULTI" },
7912
- printParams: { type: Array, required: false }
7901
+ btnText: {
7902
+ type: String,
7903
+ required: false,
7904
+ default: "\u6253\u5370"
7905
+ },
7906
+ printText: {
7907
+ type: String,
7908
+ required: false,
7909
+ default: "\u76F4\u63A5\u6253\u5370"
7910
+ },
7911
+ previewText: {
7912
+ type: String,
7913
+ required: false,
7914
+ default: "\u6253\u5370\u9884\u89C8"
7915
+ },
7916
+ formatEditText: {
7917
+ type: String,
7918
+ required: false,
7919
+ default: "\u683C\u5F0F\u7F16\u8F91"
7920
+ },
7921
+ identityVerificationTitle: {
7922
+ type: String,
7923
+ required: false,
7924
+ default: "\u6253\u5370\u670D\u52A1\u8EAB\u4EFD\u6821\u9A8C"
7925
+ },
7926
+ params: {
7927
+ type: Array,
7928
+ required: false,
7929
+ default: () => []
7930
+ },
7931
+ prevFn: {
7932
+ type: Function,
7933
+ required: false,
7934
+ default: () => Promise.resolve()
7935
+ },
7936
+ verifyUser: {
7937
+ type: Function,
7938
+ required: false,
7939
+ default: () => Promise.resolve()
7940
+ },
7941
+ queryPrintFormatByNumber: {
7942
+ type: Function,
7943
+ required: true,
7944
+ default: () => Promise.resolve({})
7945
+ },
7946
+ queryTemplateParams: {
7947
+ type: Function,
7948
+ required: false,
7949
+ default: () => Promise.resolve({})
7950
+ },
7951
+ strategy: {
7952
+ type: String,
7953
+ required: false,
7954
+ default: "MULTI"
7955
+ },
7956
+ printParams: {
7957
+ type: Array,
7958
+ required: false
7959
+ }
7913
7960
  },
7914
7961
  emits: ["success", "error"],
7915
7962
  setup(__props, { emit }) {
@@ -7930,20 +7977,16 @@ var script = /* @__PURE__ */ defineComponent({
7930
7977
  watchPrintParamsReformatFn: null,
7931
7978
  spinTimer: null
7932
7979
  });
7933
- const options = reactive([
7934
- {
7980
+ const options = reactive([{
7935
7981
  label: props.printText,
7936
7982
  key: "printText"
7937
- },
7938
- {
7983
+ }, {
7939
7984
  label: props.previewText,
7940
7985
  key: "previewText"
7941
- },
7942
- {
7986
+ }, {
7943
7987
  label: props.formatEditText,
7944
7988
  key: "formatEditText"
7945
- }
7946
- ]);
7989
+ }]);
7947
7990
  const currentFormatItem = computed(() => {
7948
7991
  if (!state.currentFormatId)
7949
7992
  return {};
@@ -7951,6 +7994,13 @@ var script = /* @__PURE__ */ defineComponent({
7951
7994
  return state.formatList.find((item) => item.id === id);
7952
7995
  });
7953
7996
  const formatTitle = computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
7997
+ const renderLabel = (option) => {
7998
+ return createVNode("span", {
7999
+ "class": {
8000
+ "active": option.key === state.currentFormatId
8001
+ }
8002
+ }, [option.label]);
8003
+ };
7954
8004
  const getTemplateIdByFormatId = (id) => {
7955
8005
  let find = state.formatList.find((item) => item.id === id);
7956
8006
  return find.templateId;
@@ -8080,6 +8130,7 @@ var script = /* @__PURE__ */ defineComponent({
8080
8130
  break;
8081
8131
  default:
8082
8132
  state.currentFormatId = key;
8133
+ state.visible = false;
8083
8134
  break;
8084
8135
  }
8085
8136
  };
@@ -8253,48 +8304,51 @@ var script = /* @__PURE__ */ defineComponent({
8253
8304
  if (!val?.length)
8254
8305
  return false;
8255
8306
  reformatPrintParams();
8256
- }, { deep: true });
8307
+ }, {
8308
+ deep: true
8309
+ });
8257
8310
  return (_ctx, _cache) => {
8258
- return openBlock(), createElementBlock("span", { onClick: handleClickWrap }, [
8259
- createVNode(unref(NDropdown), {
8311
+ return openBlock(), createElementBlock("span", {
8312
+ onClick: handleClickWrap
8313
+ }, [createVNode(unref(NDropdown), {
8314
+ class: "rowFoldHideBtnList-dropdown",
8260
8315
  placement: "bottom-start",
8261
8316
  show: unref(state).visible,
8262
8317
  onClickoutside: handleClickOutside,
8263
8318
  options: unref(options),
8264
- onSelect: handleSelect
8319
+ onSelect: handleSelect,
8320
+ "render-label": renderLabel
8265
8321
  }, {
8266
- default: withCtx(() => [
8267
- renderSlot(_ctx.$slots, "button", {
8322
+ default: withCtx(() => [renderSlot(_ctx.$slots, "button", {
8268
8323
  handleClickPrintBtn: handleClickBtn,
8269
8324
  printSpinning: unref(state).spinning,
8270
8325
  printbtnText: __props.btnText,
8271
8326
  printVisible: unref(state).visible
8272
- }, () => [
8273
- createVNode(unref(NButton), {
8327
+ }, () => [createVNode(unref(NButton), {
8274
8328
  class: "dropdown-button",
8275
- style: { "margin": "0 8px 8px 0" },
8329
+ style: {
8330
+ "margin": "0 8px 8px 0"
8331
+ },
8276
8332
  onClick: withModifiers(handleClickBtn, ["stop"])
8277
8333
  }, {
8278
- default: withCtx(() => [
8279
- unref(state).spinning ? (openBlock(), createBlock(unref(NIcon), {
8334
+ default: withCtx(() => [unref(state).spinning ? (openBlock(), createBlock(unref(NIcon), {
8280
8335
  key: 0,
8281
8336
  component: unref(Reload),
8282
- style: { "line-height": "10px" }
8283
- }, null, 8, ["component"])) : createCommentVNode("v-if", true),
8284
- createTextVNode(" " + toDisplayString(__props.btnText) + " ", 1),
8285
- createVNode(unref(NIcon), { component: unref(ChevronDown) }, null, 8, ["component"])
8286
- ]),
8337
+ style: {
8338
+ "line-height": "10px"
8339
+ }
8340
+ }, null, 8, ["component"])) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(__props.btnText) + " ", 1), createVNode(unref(NIcon), {
8341
+ component: unref(ChevronDown)
8342
+ }, null, 8, ["component"])]),
8287
8343
  _: 1
8288
- }, 8, ["onClick"])
8289
- ])
8290
- ]),
8344
+ }, 8, ["onClick"])])]),
8291
8345
  _: 3
8292
- }, 8, ["show", "options"]),
8293
- createVNode(script$1, mergeProps({
8346
+ }, 8, ["show", "options"]), createVNode(script$1, mergeProps({
8294
8347
  modelValue: unref(state).identityVerification.visible,
8295
8348
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(state).identityVerification.visible = $event)
8296
- }, _ctx.$attrs, { onSuccess: verifiySuccess }), null, 16, ["modelValue"])
8297
- ]);
8349
+ }, _ctx.$attrs, {
8350
+ onSuccess: verifiySuccess
8351
+ }), null, 16, ["modelValue"])]);
8298
8352
  };
8299
8353
  }
8300
8354
  });
@@ -593,6 +593,10 @@ body > .vxe-table--tooltip-wrapper {
593
593
  margin-bottom: 8px;
594
594
  }
595
595
 
596
+ .rowFoldHideBtnList-dropdown .n-dropdown-menu-wrapper span.active {
597
+ color: #5585f5;
598
+ }
599
+
596
600
  .login-form[data-v-06588d4e] {
597
601
  padding-top: 15px;
598
602
  }
@@ -593,6 +593,10 @@ body > .vxe-table--tooltip-wrapper {
593
593
  margin-bottom: 8px;
594
594
  }
595
595
 
596
+ .rowFoldHideBtnList-dropdown .n-dropdown-menu-wrapper span.active {
597
+ color: #5585f5;
598
+ }
599
+
596
600
  .login-form[data-v-06588d4e] {
597
601
  padding-top: 15px;
598
602
  }
@@ -732,48 +736,6 @@ body > .vxe-table--tooltip-wrapper {
732
736
  z-index: 2001;
733
737
  }
734
738
 
735
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] {
736
- width: 100%;
737
- margin-bottom: 16px;
738
- overflow: hidden;
739
- cursor: pointer;
740
- color: #2e2e2e;
741
- }
742
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] {
743
- display: -webkit-box;
744
- display: -webkit-flex;
745
- display: -ms-flexbox;
746
- display: flex;
747
- -webkit-box-pack: center;
748
- -webkit-justify-content: center;
749
- -ms-flex-pack: center;
750
- justify-content: center;
751
- -webkit-box-align: center;
752
- -webkit-align-items: center;
753
- -ms-flex-align: center;
754
- align-items: center;
755
- width: 100%;
756
- height: 60px;
757
- padding: 0 8px;
758
- -webkit-box-sizing: border-box;
759
- box-sizing: border-box;
760
- margin-bottom: 8px;
761
- background: #f3f5f8;
762
- }
763
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966]-input[data-v-55852966] {
764
- width: 85%;
765
- overflow: hidden;
766
- text-overflow: ellipsis;
767
- white-space: nowrap;
768
- cursor: pointer !important;
769
- }
770
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"][disabled][data-v-55852966],
771
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"][disabled][data-v-55852966],
772
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"].disabled[data-v-55852966],
773
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"].disabled[data-v-55852966] {
774
- cursor: pointer !important;
775
- }
776
-
777
739
  .DragFormRightItem[data-v-2d9603cc] {
778
740
  position: relative;
779
741
  }
@@ -845,6 +807,48 @@ body > .vxe-table--tooltip-wrapper {
845
807
  color: red;
846
808
  }
847
809
 
810
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] {
811
+ width: 100%;
812
+ margin-bottom: 16px;
813
+ overflow: hidden;
814
+ cursor: pointer;
815
+ color: #2e2e2e;
816
+ }
817
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] {
818
+ display: -webkit-box;
819
+ display: -webkit-flex;
820
+ display: -ms-flexbox;
821
+ display: flex;
822
+ -webkit-box-pack: center;
823
+ -webkit-justify-content: center;
824
+ -ms-flex-pack: center;
825
+ justify-content: center;
826
+ -webkit-box-align: center;
827
+ -webkit-align-items: center;
828
+ -ms-flex-align: center;
829
+ align-items: center;
830
+ width: 100%;
831
+ height: 60px;
832
+ padding: 0 8px;
833
+ -webkit-box-sizing: border-box;
834
+ box-sizing: border-box;
835
+ margin-bottom: 8px;
836
+ background: #f3f5f8;
837
+ }
838
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966]-input[data-v-55852966] {
839
+ width: 85%;
840
+ overflow: hidden;
841
+ text-overflow: ellipsis;
842
+ white-space: nowrap;
843
+ cursor: pointer !important;
844
+ }
845
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"][disabled][data-v-55852966],
846
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"][disabled][data-v-55852966],
847
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"].disabled[data-v-55852966],
848
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"].disabled[data-v-55852966] {
849
+ cursor: pointer !important;
850
+ }
851
+
848
852
  ul[data-v-726261b7] {
849
853
  margin: 0;
850
854
  padding: 0;
package/es/grid/index.css CHANGED
@@ -592,6 +592,10 @@ body > .vxe-table--tooltip-wrapper {
592
592
  margin-bottom: 8px;
593
593
  }
594
594
 
595
+ .rowFoldHideBtnList-dropdown .n-dropdown-menu-wrapper span.active {
596
+ color: #5585f5;
597
+ }
598
+
595
599
  .login-form[data-v-06588d4e] {
596
600
  padding-top: 15px;
597
601
  }
@@ -731,48 +735,6 @@ body > .vxe-table--tooltip-wrapper {
731
735
  z-index: 2001;
732
736
  }
733
737
 
734
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] {
735
- width: 100%;
736
- margin-bottom: 16px;
737
- overflow: hidden;
738
- cursor: pointer;
739
- color: #2e2e2e;
740
- }
741
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] {
742
- display: -webkit-box;
743
- display: -webkit-flex;
744
- display: -ms-flexbox;
745
- display: flex;
746
- -webkit-box-pack: center;
747
- -webkit-justify-content: center;
748
- -ms-flex-pack: center;
749
- justify-content: center;
750
- -webkit-box-align: center;
751
- -webkit-align-items: center;
752
- -ms-flex-align: center;
753
- align-items: center;
754
- width: 100%;
755
- height: 60px;
756
- padding: 0 8px;
757
- -webkit-box-sizing: border-box;
758
- box-sizing: border-box;
759
- margin-bottom: 8px;
760
- background: #f3f5f8;
761
- }
762
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966]-input[data-v-55852966] {
763
- width: 85%;
764
- overflow: hidden;
765
- text-overflow: ellipsis;
766
- white-space: nowrap;
767
- cursor: pointer !important;
768
- }
769
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"][disabled][data-v-55852966],
770
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"][disabled][data-v-55852966],
771
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"].disabled[data-v-55852966],
772
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"].disabled[data-v-55852966] {
773
- cursor: pointer !important;
774
- }
775
-
776
738
  .DragFormRightItem[data-v-2d9603cc] {
777
739
  position: relative;
778
740
  }
@@ -844,6 +806,48 @@ body > .vxe-table--tooltip-wrapper {
844
806
  color: red;
845
807
  }
846
808
 
809
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] {
810
+ width: 100%;
811
+ margin-bottom: 16px;
812
+ overflow: hidden;
813
+ cursor: pointer;
814
+ color: #2e2e2e;
815
+ }
816
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] {
817
+ display: -webkit-box;
818
+ display: -webkit-flex;
819
+ display: -ms-flexbox;
820
+ display: flex;
821
+ -webkit-box-pack: center;
822
+ -webkit-justify-content: center;
823
+ -ms-flex-pack: center;
824
+ justify-content: center;
825
+ -webkit-box-align: center;
826
+ -webkit-align-items: center;
827
+ -ms-flex-align: center;
828
+ align-items: center;
829
+ width: 100%;
830
+ height: 60px;
831
+ padding: 0 8px;
832
+ -webkit-box-sizing: border-box;
833
+ box-sizing: border-box;
834
+ margin-bottom: 8px;
835
+ background: #f3f5f8;
836
+ }
837
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966]-input[data-v-55852966] {
838
+ width: 85%;
839
+ overflow: hidden;
840
+ text-overflow: ellipsis;
841
+ white-space: nowrap;
842
+ cursor: pointer !important;
843
+ }
844
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"][disabled][data-v-55852966],
845
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"][disabled][data-v-55852966],
846
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"].disabled[data-v-55852966],
847
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"].disabled[data-v-55852966] {
848
+ cursor: pointer !important;
849
+ }
850
+
847
851
 
848
852
  .popver-content {
849
853
  height: 400px;
package/es/index.css CHANGED
@@ -1043,6 +1043,10 @@ ul[data-v-726261b7] {
1043
1043
  margin-bottom: 8px;
1044
1044
  }
1045
1045
 
1046
+ .rowFoldHideBtnList-dropdown .n-dropdown-menu-wrapper span.active {
1047
+ color: #5585f5;
1048
+ }
1049
+
1046
1050
  .df[data-v-3b67e11b] {
1047
1051
  display: -webkit-box;
1048
1052
  display: -webkit-flex;
package/es/index.js CHANGED
@@ -38481,21 +38481,34 @@ var script$d = defineComponent({
38481
38481
  emits: ["setOptions", "formChange"],
38482
38482
  setup(props, { attrs, slots, emit }) {
38483
38483
  const state = reactive({
38484
- options: []
38484
+ options: [],
38485
+ loading: false,
38486
+ keyword: "",
38487
+ config: {}
38485
38488
  });
38486
38489
  const setOptions = async () => {
38487
38490
  if (props.col.options) {
38488
38491
  state.options = JSON.parse(JSON.stringify(props.col.options));
38489
38492
  }
38490
38493
  else {
38491
- const optionsName = `${props.col.columnName}_options`;
38492
- state.options = props.row[optionsName] || await props.col.queryOptions();
38493
- if (!props.row[optionsName]) {
38494
- emit("setOptions", state.options);
38495
- }
38494
+ `${props.col.columnName}_options`;
38495
+ const obj = {
38496
+ keyword: state.keyword,
38497
+ row: props.row,
38498
+ column: props.col,
38499
+ index: props.index
38500
+ };
38501
+ state.options = await props.col.queryOptions(obj);
38502
+ state.loading = false;
38503
+ emit("setOptions", state.options);
38496
38504
  }
38497
38505
  };
38498
- setOptions();
38506
+ let selectSearch = (value) => {
38507
+ state.keyword = value;
38508
+ state.loading = true;
38509
+ setOptions();
38510
+ };
38511
+ selectSearch = xeUtils.debounce(selectSearch, 800);
38499
38512
  const onUpdateValue = (value) => {
38500
38513
  emit("formChange", {
38501
38514
  value,
@@ -38504,14 +38517,25 @@ var script$d = defineComponent({
38504
38517
  index: props.index
38505
38518
  });
38506
38519
  };
38507
- console.log(attrs);
38508
- return () => [createVNode(NSelect, mergeProps(attrs, {
38520
+ const init = () => {
38521
+ if (props.col.options) {
38522
+ setOptions();
38523
+ }
38524
+ else {
38525
+ state.config.remote = true;
38526
+ state.config.onSearch = selectSearch;
38527
+ selectSearch("");
38528
+ }
38529
+ };
38530
+ init();
38531
+ return () => [createVNode(NSelect, mergeProps(attrs, state.config, {
38509
38532
  "options": state.options,
38510
38533
  "consistentMenuWidth": false,
38511
38534
  "clearable": true,
38512
38535
  "filterable": true,
38513
38536
  "to": false,
38514
38537
  "placeholder": "\u8BF7\u9009\u62E9",
38538
+ "loading": state.loading,
38515
38539
  "onUpdateValue": onUpdateValue
38516
38540
  }), null)];
38517
38541
  }
@@ -39742,7 +39766,7 @@ var script$8 = /* @__PURE__ */ defineComponent({
39742
39766
  return;
39743
39767
  let currentPageTableData = table.getTableData()?.tableData;
39744
39768
  let currentPageSelectedRows = currentPageTableData.filter((row) => {
39745
- return currentCheckedKeys.value.includes(row[props.primaryKey]);
39769
+ return row[props.primaryKey] ? currentCheckedKeys.value.includes(row[props.primaryKey]) : false;
39746
39770
  });
39747
39771
  setCurrentCheckedLength();
39748
39772
  if (!currentPageSelectedRows || !currentPageSelectedRows.length) {
@@ -39863,6 +39887,9 @@ var script$8 = /* @__PURE__ */ defineComponent({
39863
39887
  if (!isEdit || item.columnName === "operatorColumn" || !item.isEdit) {
39864
39888
  return formatter(params, item);
39865
39889
  }
39890
+ else if (isEdit && item.isEdit && item.checkEditStatus && item.checkEditStatus(params)) {
39891
+ return formatterEdit(params, item);
39892
+ }
39866
39893
  else {
39867
39894
  return createVNode("span", null, [getDefaultValue(params, item)]);
39868
39895
  }
@@ -41613,6 +41640,7 @@ var script$8 = /* @__PURE__ */ defineComponent({
41613
41640
  iconClose: "iconfont icon-a-xitongtubiaotianjia"
41614
41641
  },
41615
41642
  "keyboard-config": _ctx.columnConfig.keyboardConfig || {},
41643
+ "edit-rules": _ctx.columnConfig.editRules || {},
41616
41644
  onCellDblclick: rowdblclick,
41617
41645
  onCellClick: handlerClickRow,
41618
41646
  onCheckboxChange: selectionChange,
@@ -41663,7 +41691,7 @@ var script$8 = /* @__PURE__ */ defineComponent({
41663
41691
  }
41664
41692
  })]),
41665
41693
  _: 3
41666
- }, 8, ["seq-config", "tree-config", "row-id", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
41694
+ }, 8, ["seq-config", "tree-config", "row-id", "show-footer", "checkbox-config", "row-style", "edit-config", "expand-config", "keyboard-config", "edit-rules"]), createCommentVNode(" `${refreshRow}\u6761\u66F4\u65B0` "), withDirectives(createElementVNode("div", {
41667
41695
  class: "refresh",
41668
41696
  onClick: hanldeClickRefresh
41669
41697
  }, [createVNode(unref(NIcon), {
@@ -45290,18 +45318,65 @@ const __default__$1 = create({
45290
45318
  var script$2 = /* @__PURE__ */ defineComponent({
45291
45319
  ...__default__$1,
45292
45320
  props: {
45293
- btnText: { type: String, required: false, default: "\u6253\u5370" },
45294
- printText: { type: String, required: false, default: "\u76F4\u63A5\u6253\u5370" },
45295
- previewText: { type: String, required: false, default: "\u6253\u5370\u9884\u89C8" },
45296
- formatEditText: { type: String, required: false, default: "\u683C\u5F0F\u7F16\u8F91" },
45297
- identityVerificationTitle: { type: String, required: false, default: "\u6253\u5370\u670D\u52A1\u8EAB\u4EFD\u6821\u9A8C" },
45298
- params: { type: Array, required: false, default: () => [] },
45299
- prevFn: { type: Function, required: false, default: () => Promise.resolve() },
45300
- verifyUser: { type: Function, required: false, default: () => Promise.resolve() },
45301
- queryPrintFormatByNumber: { type: Function, required: true, default: () => Promise.resolve({}) },
45302
- queryTemplateParams: { type: Function, required: false, default: () => Promise.resolve({}) },
45303
- strategy: { type: String, required: false, default: "MULTI" },
45304
- printParams: { type: Array, required: false }
45321
+ btnText: {
45322
+ type: String,
45323
+ required: false,
45324
+ default: "\u6253\u5370"
45325
+ },
45326
+ printText: {
45327
+ type: String,
45328
+ required: false,
45329
+ default: "\u76F4\u63A5\u6253\u5370"
45330
+ },
45331
+ previewText: {
45332
+ type: String,
45333
+ required: false,
45334
+ default: "\u6253\u5370\u9884\u89C8"
45335
+ },
45336
+ formatEditText: {
45337
+ type: String,
45338
+ required: false,
45339
+ default: "\u683C\u5F0F\u7F16\u8F91"
45340
+ },
45341
+ identityVerificationTitle: {
45342
+ type: String,
45343
+ required: false,
45344
+ default: "\u6253\u5370\u670D\u52A1\u8EAB\u4EFD\u6821\u9A8C"
45345
+ },
45346
+ params: {
45347
+ type: Array,
45348
+ required: false,
45349
+ default: () => []
45350
+ },
45351
+ prevFn: {
45352
+ type: Function,
45353
+ required: false,
45354
+ default: () => Promise.resolve()
45355
+ },
45356
+ verifyUser: {
45357
+ type: Function,
45358
+ required: false,
45359
+ default: () => Promise.resolve()
45360
+ },
45361
+ queryPrintFormatByNumber: {
45362
+ type: Function,
45363
+ required: true,
45364
+ default: () => Promise.resolve({})
45365
+ },
45366
+ queryTemplateParams: {
45367
+ type: Function,
45368
+ required: false,
45369
+ default: () => Promise.resolve({})
45370
+ },
45371
+ strategy: {
45372
+ type: String,
45373
+ required: false,
45374
+ default: "MULTI"
45375
+ },
45376
+ printParams: {
45377
+ type: Array,
45378
+ required: false
45379
+ }
45305
45380
  },
45306
45381
  emits: ["success", "error"],
45307
45382
  setup(__props, { emit }) {
@@ -45322,20 +45397,16 @@ var script$2 = /* @__PURE__ */ defineComponent({
45322
45397
  watchPrintParamsReformatFn: null,
45323
45398
  spinTimer: null
45324
45399
  });
45325
- const options = reactive([
45326
- {
45400
+ const options = reactive([{
45327
45401
  label: props.printText,
45328
45402
  key: "printText"
45329
- },
45330
- {
45403
+ }, {
45331
45404
  label: props.previewText,
45332
45405
  key: "previewText"
45333
- },
45334
- {
45406
+ }, {
45335
45407
  label: props.formatEditText,
45336
45408
  key: "formatEditText"
45337
- }
45338
- ]);
45409
+ }]);
45339
45410
  const currentFormatItem = computed(() => {
45340
45411
  if (!state.currentFormatId)
45341
45412
  return {};
@@ -45343,6 +45414,13 @@ var script$2 = /* @__PURE__ */ defineComponent({
45343
45414
  return state.formatList.find((item) => item.id === id);
45344
45415
  });
45345
45416
  const formatTitle = computed(() => currentFormatItem.value.name || "\u683C\u5F0F\u9009\u62E9");
45417
+ const renderLabel = (option) => {
45418
+ return createVNode("span", {
45419
+ "class": {
45420
+ "active": option.key === state.currentFormatId
45421
+ }
45422
+ }, [option.label]);
45423
+ };
45346
45424
  const getTemplateIdByFormatId = (id) => {
45347
45425
  let find = state.formatList.find((item) => item.id === id);
45348
45426
  return find.templateId;
@@ -45472,6 +45550,7 @@ var script$2 = /* @__PURE__ */ defineComponent({
45472
45550
  break;
45473
45551
  default:
45474
45552
  state.currentFormatId = key;
45553
+ state.visible = false;
45475
45554
  break;
45476
45555
  }
45477
45556
  };
@@ -45645,48 +45724,51 @@ var script$2 = /* @__PURE__ */ defineComponent({
45645
45724
  if (!val?.length)
45646
45725
  return false;
45647
45726
  reformatPrintParams();
45648
- }, { deep: true });
45727
+ }, {
45728
+ deep: true
45729
+ });
45649
45730
  return (_ctx, _cache) => {
45650
- return openBlock(), createElementBlock("span", { onClick: handleClickWrap }, [
45651
- createVNode(unref(NDropdown), {
45731
+ return openBlock(), createElementBlock("span", {
45732
+ onClick: handleClickWrap
45733
+ }, [createVNode(unref(NDropdown), {
45734
+ class: "rowFoldHideBtnList-dropdown",
45652
45735
  placement: "bottom-start",
45653
45736
  show: unref(state).visible,
45654
45737
  onClickoutside: handleClickOutside,
45655
45738
  options: unref(options),
45656
- onSelect: handleSelect
45739
+ onSelect: handleSelect,
45740
+ "render-label": renderLabel
45657
45741
  }, {
45658
- default: withCtx(() => [
45659
- renderSlot(_ctx.$slots, "button", {
45742
+ default: withCtx(() => [renderSlot(_ctx.$slots, "button", {
45660
45743
  handleClickPrintBtn: handleClickBtn,
45661
45744
  printSpinning: unref(state).spinning,
45662
45745
  printbtnText: __props.btnText,
45663
45746
  printVisible: unref(state).visible
45664
- }, () => [
45665
- createVNode(unref(NButton), {
45747
+ }, () => [createVNode(unref(NButton), {
45666
45748
  class: "dropdown-button",
45667
- style: { "margin": "0 8px 8px 0" },
45749
+ style: {
45750
+ "margin": "0 8px 8px 0"
45751
+ },
45668
45752
  onClick: withModifiers(handleClickBtn, ["stop"])
45669
45753
  }, {
45670
- default: withCtx(() => [
45671
- unref(state).spinning ? (openBlock(), createBlock(unref(NIcon), {
45754
+ default: withCtx(() => [unref(state).spinning ? (openBlock(), createBlock(unref(NIcon), {
45672
45755
  key: 0,
45673
45756
  component: unref(Reload),
45674
- style: { "line-height": "10px" }
45675
- }, null, 8, ["component"])) : createCommentVNode("v-if", true),
45676
- createTextVNode(" " + toDisplayString(__props.btnText) + " ", 1),
45677
- createVNode(unref(NIcon), { component: unref(ChevronDown) }, null, 8, ["component"])
45678
- ]),
45757
+ style: {
45758
+ "line-height": "10px"
45759
+ }
45760
+ }, null, 8, ["component"])) : createCommentVNode("v-if", true), createTextVNode(" " + toDisplayString(__props.btnText) + " ", 1), createVNode(unref(NIcon), {
45761
+ component: unref(ChevronDown)
45762
+ }, null, 8, ["component"])]),
45679
45763
  _: 1
45680
- }, 8, ["onClick"])
45681
- ])
45682
- ]),
45764
+ }, 8, ["onClick"])])]),
45683
45765
  _: 3
45684
- }, 8, ["show", "options"]),
45685
- createVNode(script$3, mergeProps({
45766
+ }, 8, ["show", "options"]), createVNode(script$3, mergeProps({
45686
45767
  modelValue: unref(state).identityVerification.visible,
45687
45768
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(state).identityVerification.visible = $event)
45688
- }, _ctx.$attrs, { onSuccess: verifiySuccess }), null, 16, ["modelValue"])
45689
- ]);
45769
+ }, _ctx.$attrs, {
45770
+ onSuccess: verifiySuccess
45771
+ }), null, 16, ["modelValue"])]);
45690
45772
  };
45691
45773
  }
45692
45774
  });
@@ -593,6 +593,10 @@ body > .vxe-table--tooltip-wrapper {
593
593
  margin-bottom: 8px;
594
594
  }
595
595
 
596
+ .rowFoldHideBtnList-dropdown .n-dropdown-menu-wrapper span.active {
597
+ color: #5585f5;
598
+ }
599
+
596
600
  .login-form[data-v-06588d4e] {
597
601
  padding-top: 15px;
598
602
  }
@@ -732,48 +736,6 @@ body > .vxe-table--tooltip-wrapper {
732
736
  z-index: 2001;
733
737
  }
734
738
 
735
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] {
736
- width: 100%;
737
- margin-bottom: 16px;
738
- overflow: hidden;
739
- cursor: pointer;
740
- color: #2e2e2e;
741
- }
742
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] {
743
- display: -webkit-box;
744
- display: -webkit-flex;
745
- display: -ms-flexbox;
746
- display: flex;
747
- -webkit-box-pack: center;
748
- -webkit-justify-content: center;
749
- -ms-flex-pack: center;
750
- justify-content: center;
751
- -webkit-box-align: center;
752
- -webkit-align-items: center;
753
- -ms-flex-align: center;
754
- align-items: center;
755
- width: 100%;
756
- height: 60px;
757
- padding: 0 8px;
758
- -webkit-box-sizing: border-box;
759
- box-sizing: border-box;
760
- margin-bottom: 8px;
761
- background: #f3f5f8;
762
- }
763
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966]-input[data-v-55852966] {
764
- width: 85%;
765
- overflow: hidden;
766
- text-overflow: ellipsis;
767
- white-space: nowrap;
768
- cursor: pointer !important;
769
- }
770
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"][disabled][data-v-55852966],
771
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"][disabled][data-v-55852966],
772
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"].disabled[data-v-55852966],
773
- .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"].disabled[data-v-55852966] {
774
- cursor: pointer !important;
775
- }
776
-
777
739
  .DragFormRightItem[data-v-2d9603cc] {
778
740
  position: relative;
779
741
  }
@@ -845,6 +807,48 @@ body > .vxe-table--tooltip-wrapper {
845
807
  color: red;
846
808
  }
847
809
 
810
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] {
811
+ width: 100%;
812
+ margin-bottom: 16px;
813
+ overflow: hidden;
814
+ cursor: pointer;
815
+ color: #2e2e2e;
816
+ }
817
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] {
818
+ display: -webkit-box;
819
+ display: -webkit-flex;
820
+ display: -ms-flexbox;
821
+ display: flex;
822
+ -webkit-box-pack: center;
823
+ -webkit-justify-content: center;
824
+ -ms-flex-pack: center;
825
+ justify-content: center;
826
+ -webkit-box-align: center;
827
+ -webkit-align-items: center;
828
+ -ms-flex-align: center;
829
+ align-items: center;
830
+ width: 100%;
831
+ height: 60px;
832
+ padding: 0 8px;
833
+ -webkit-box-sizing: border-box;
834
+ box-sizing: border-box;
835
+ margin-bottom: 8px;
836
+ background: #f3f5f8;
837
+ }
838
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966]-input[data-v-55852966] {
839
+ width: 85%;
840
+ overflow: hidden;
841
+ text-overflow: ellipsis;
842
+ white-space: nowrap;
843
+ cursor: pointer !important;
844
+ }
845
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"][disabled][data-v-55852966],
846
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"][disabled][data-v-55852966],
847
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="radio"].disabled[data-v-55852966],
848
+ .DragFormLeftItem[data-v-55852966] .left-content[data-v-55852966] .style-box[data-v-55852966] input[type="checkbox"].disabled[data-v-55852966] {
849
+ cursor: pointer !important;
850
+ }
851
+
848
852
 
849
853
  .popver-content {
850
854
  height: 400px;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cnhis-design-vue",
3
3
  "private": false,
4
- "version": "3.1.0",
4
+ "version": "3.1.1",
5
5
  "main": "es/index.js",
6
6
  "module": "es/index.js",
7
7
  "scripts": {
@@ -97,6 +97,7 @@
97
97
  iconClose: 'iconfont icon-a-xitongtubiaotianjia',
98
98
  }"
99
99
  :keyboard-config="columnConfig.keyboardConfig || {}"
100
+ :edit-rules="columnConfig.editRules || {}"
100
101
  @cell-dblclick="rowdblclick"
101
102
  @cell-click="handlerClickRow"
102
103
  @checkbox-change="selectionChange"
@@ -475,7 +476,7 @@ const setCurrentPageRowChecked = () => {
475
476
  if (!table) return;
476
477
  let currentPageTableData = table.getTableData()?.tableData;
477
478
  let currentPageSelectedRows = currentPageTableData.filter((row: any) => {
478
- return currentCheckedKeys.value.includes(row[props.primaryKey]);
479
+ return (row[props.primaryKey] ? currentCheckedKeys.value.includes(row[props.primaryKey]) : false)
479
480
  });
480
481
  setCurrentCheckedLength();
481
482
  if (!currentPageSelectedRows || !currentPageSelectedRows.length) {
@@ -655,6 +656,8 @@ const formatColumns = (map: any) => {
655
656
  default: (params: any) => {
656
657
  if(!isEdit || item.columnName === 'operatorColumn' || !item.isEdit) {
657
658
  return formatter(params, item)
659
+ } else if (isEdit && item.isEdit && item.checkEditStatus && item.checkEditStatus(params)) {
660
+ return formatterEdit(params, item)
658
661
  } else {
659
662
  return <span>{getDefaultValue(params, item)}</span>
660
663
  }
@@ -1,6 +1,7 @@
1
1
  <script lang="tsx">
2
2
  import { defineComponent, ref, reactive } from 'vue'
3
3
  import { NSelect } from 'naive-ui'
4
+ import vexutils from '@/utils/vexutils.js'
4
5
 
5
6
  export default defineComponent({
6
7
  name: 'EditSelect',
@@ -26,8 +27,12 @@ export default defineComponent({
26
27
  setup (props, { attrs, slots, emit }) {
27
28
 
28
29
  const state = reactive({
29
- options: [] as any
30
+ options: [] as any,
31
+ loading: false,
32
+ keyword: '',
33
+ config: {} as any
30
34
  })
35
+
31
36
  const setOptions = async () => {
32
37
  if (props.col.options) {
33
38
  state.options = JSON.parse(JSON.stringify(props.col.options))
@@ -35,29 +40,53 @@ export default defineComponent({
35
40
  // 此处需要缓存第一次请求到的options,不需要每次都请求,
36
41
  // 此处的row参数应当是selectTable的row
37
42
  const optionsName = `${props.col.columnName}_options`
38
- state.options = props.row[optionsName] || await props.col.queryOptions()
39
- if (!props.row[optionsName]) {
40
- emit('setOptions', state.options)
43
+ const obj = {
44
+ keyword: state.keyword,
45
+ row: props.row,
46
+ column: props.col,
47
+ index: props.index
41
48
  }
49
+ // state.options = props.row[optionsName] || await props.col.queryOptions(obj)
50
+ state.options = await props.col.queryOptions(obj)
51
+ state.loading = false
52
+ // if (!props.row[optionsName]) {
53
+ emit('setOptions', state.options)
54
+ // }
42
55
  }
43
56
  }
44
-
45
- setOptions()
46
-
57
+
58
+ let selectSearch = (value: string) => {
59
+ state.keyword = value
60
+ state.loading = true
61
+ setOptions()
62
+ }
63
+ selectSearch = vexutils.debounce(selectSearch, 800)
47
64
  const onUpdateValue = (value: any[] | string | number | null) => {
48
65
  emit('formChange', { value, row: props.row, column: props.col, index: props.index })
49
66
  }
50
67
 
51
- console.log(attrs)
68
+ const init = () => {
69
+ if (props.col.options) {
70
+ setOptions()
71
+ } else {
72
+ state.config.remote = true
73
+ state.config.onSearch = selectSearch
74
+ // 初始化搜索
75
+ selectSearch('')
76
+ }
77
+ }
78
+ init()
52
79
  return () => [
53
80
  <NSelect
54
81
  {...attrs}
82
+ {...state.config}
55
83
  options={state.options}
56
84
  consistentMenuWidth={false}
57
85
  clearable
58
86
  filterable
59
87
  to={false}
60
88
  placeholder="请选择"
89
+ loading={state.loading}
61
90
  onUpdateValue={onUpdateValue}
62
91
  />
63
92
  ]
@@ -1,11 +1,13 @@
1
1
  <template>
2
2
  <span @click="handleClickWrap">
3
3
  <NDropdown
4
+ class="rowFoldHideBtnList-dropdown"
4
5
  placement="bottom-start"
5
6
  :show="state.visible"
6
7
  @clickoutside="handleClickOutside"
7
8
  :options="options"
8
9
  @select="handleSelect"
10
+ :render-label="renderLabel"
9
11
  >
10
12
  <slot
11
13
  name="button"
@@ -30,14 +32,14 @@
30
32
  </span>
31
33
  </template>
32
34
 
33
- <script lang="ts">
35
+ <script lang="tsx">
34
36
  import create from '@/core/create.js';
35
37
  export default create({
36
38
  name: "ButtonPrint"
37
39
  })
38
40
  </script>
39
41
 
40
- <script setup lang="ts">
42
+ <script setup lang="tsx">
41
43
  import { ref, reactive, computed, watch, onMounted, nextTick } from 'vue'
42
44
  import { NDropdown, NButton, NIcon } from 'naive-ui'
43
45
  import { ChevronDown, Reload } from "@vicons/ionicons5";
@@ -117,6 +119,9 @@ const currentFormatItem = computed(() => {
117
119
  })
118
120
  const formatTitle = computed(() => (currentFormatItem.value as any).name || '格式选择')
119
121
 
122
+ const renderLabel = (option: DropdownOption) => {
123
+ return <span class={{'active': option.key === state.currentFormatId}}>{option.label}</span>
124
+ }
120
125
  const getTemplateIdByFormatId = (id: string | number) => {
121
126
  let find: any = state.formatList.find((item: any) => item.id === id);
122
127
  return find.templateId;
@@ -266,6 +271,7 @@ const handleSelect = (key: string) => {
266
271
  break;
267
272
  default:
268
273
  state.currentFormatId = key;
274
+ state.visible = false
269
275
  break;
270
276
  }
271
277
  }
@@ -393,7 +399,6 @@ const initCRM = async (formatListResult: any) => {
393
399
  } else {
394
400
  return requestError();
395
401
  }
396
-
397
402
  state.printParams = formatParams(state.templateParams, props.params);
398
403
  }
399
404
  const init = async () => {
@@ -474,3 +479,10 @@ watch(() => props.params,
474
479
  margin-bottom: 8px;
475
480
  }
476
481
  </style>
482
+ <style lang="less">
483
+ .rowFoldHideBtnList-dropdown {
484
+ .n-dropdown-menu-wrapper span.active {
485
+ color: #5585f5;
486
+ }
487
+ }
488
+ </style>