bm-admin-ui 1.0.61-alpha → 1.0.62-alpha

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.
@@ -593,11 +593,15 @@ var picture = {
593
593
  listType: 'picture-card',
594
594
  text: '请选择',
595
595
  multiple: maxCount > 1,
596
+ accept: '.jpg,.png',
596
597
  },
597
598
  extraProps: {
598
599
  maxSize: 10,
599
600
  maxCount,
600
601
  },
602
+ customErrors: {
603
+ format: '请上传jpg、png格式的图片',
604
+ },
601
605
  defaultList: data.value,
602
606
  uploadRequest(inject, file) {
603
607
  return __awaiter(this, void 0, void 0, function* () {
@@ -623,7 +627,7 @@ var picture = {
623
627
  });
624
628
  },
625
629
  error(inject, error) {
626
- message.error(error.message);
630
+ message.error(error === null || error === void 0 ? void 0 : error.message);
627
631
  },
628
632
  },
629
633
  };
@@ -1506,14 +1510,25 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1506
1510
  const field = rule.field;
1507
1511
  const associatedFields = rule?.config?.associatedFields;
1508
1512
  let result = void 0;
1509
- if (row[field]) {
1510
- result = await props.extraConfig.product.fetch({ productCode: row[field] });
1513
+ try {
1514
+ if (row[field]) {
1515
+ result = await props.extraConfig.product.fetch({
1516
+ productCode: row[field]
1517
+ });
1518
+ }
1519
+ processAssociatedFields(field, associatedFields, row, result);
1520
+ return result;
1521
+ } catch (e) {
1522
+ row[field] = "";
1523
+ processAssociatedFields(field, associatedFields, row, result);
1524
+ return Promise.resolve(result);
1511
1525
  }
1526
+ }
1527
+ function processAssociatedFields(field, associatedFields, row, result) {
1512
1528
  if (associatedFields.length)
1513
1529
  associatedFields.forEach((item) => {
1514
1530
  row[productPicName(item.value, field)] = result ? result[productInfoKeyMap[item.value]] : void 0;
1515
1531
  });
1516
- return result;
1517
1532
  }
1518
1533
  function handleChange(e) {
1519
1534
  const file = e.target.files[0];
@@ -1696,11 +1711,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1696
1711
  return !formData.value[shopField];
1697
1712
  }
1698
1713
  function handlePressEnter(rule, row) {
1699
- queryProductInfo(rule, row).then((data2) => {
1700
- if (!data2) {
1701
- row[rule.field] = "";
1702
- }
1703
- });
1714
+ queryProductInfo(rule, row);
1704
1715
  }
1705
1716
  function handleProductInputChange(rule, row) {
1706
1717
  queryProductInfoDebounce(rule, row);
@@ -2090,6 +2101,9 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2090
2101
  tempSelected: {}
2091
2102
  };
2092
2103
  }
2104
+ function handleError(e) {
2105
+ message.error(e?.message);
2106
+ }
2093
2107
  props.value && initValue(props.value);
2094
2108
  props.extraConfig.materialTemp.getDict().then((data) => {
2095
2109
  measrueDicts.value = data;
@@ -2320,14 +2334,19 @@ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
2320
2334
  listType: "picture-card",
2321
2335
  text: "\u4E0A\u4F20\u56FE\u7247",
2322
2336
  multiple: true,
2323
- disabled: __props.disabled?.includes?.("uploadPic")
2337
+ disabled: __props.disabled?.includes?.("uploadPic"),
2338
+ accept: ".jpg,.png"
2324
2339
  },
2325
2340
  "extra-props": {
2326
2341
  maxCount: 9
2327
2342
  },
2328
2343
  "upload-request": __props.extraConfig.materialTemp.uploadRequest,
2329
2344
  "default-list": pane.uploadList,
2330
- onUpdate: handleUpload
2345
+ "custom-errors": {
2346
+ format: "\u8BF7\u4E0A\u4F20jpg\u3001png\u683C\u5F0F\u7684\u56FE\u7247"
2347
+ },
2348
+ onUpdate: handleUpload,
2349
+ onError: handleError
2331
2350
  }, null, 8, ["upload-props", "upload-request", "default-list"])
2332
2351
  ]),
2333
2352
  _: 2
@@ -2613,6 +2632,7 @@ var product = {
2613
2632
  on: {
2614
2633
  change(inject, value) {
2615
2634
  inject.self.value = value;
2635
+ inject.self.props.defalutValue = value;
2616
2636
  nextTick(() => {
2617
2637
  inject.api.validateField(inject.self.field);
2618
2638
  });
@@ -2639,6 +2659,10 @@ var product = {
2639
2659
  on: {
2640
2660
  change(inject, value) {
2641
2661
  inject.self.value = value;
2662
+ inject.self.props.defalutValue = value;
2663
+ nextTick(() => {
2664
+ inject.api.validateField(inject.self.field);
2665
+ });
2642
2666
  },
2643
2667
  },
2644
2668
  };
@@ -3997,7 +3997,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3997
3997
  message.error("\u8BE5\u63A7\u4EF6\u5DF2\u88AB\u8BBE\u4E3A\u6570\u636E\u8FC7\u6EE4\u6761\u4EF6\uFF0C\u4E0D\u53EF\u5220\u9664\u3002");
3998
3998
  return;
3999
3999
  }
4000
- if (props.flowCondition[targetRule.field]) {
4000
+ if (props.flowCondition?.[targetRule.field]) {
4001
4001
  message.error(
4002
4002
  `\u8BE5\u7EC4\u4EF6\u5728\u201C${props.flowCondition[targetRule.field]}\u201D\u5DF2\u88AB\u8BBE\u4E3A\u5BA1\u6279\u6761\u4EF6\uFF0C\u4E0D\u53EF\u5220\u9664\u3002`
4003
4003
  );
@@ -4375,7 +4375,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4375
4375
  })) : createCommentVNode("v-if", true)
4376
4376
  ])) : createCommentVNode("v-if", true),
4377
4377
  createElementVNode("div", _hoisted_6, [
4378
- _ctx.flowCondition[activeRule.value.field] ? (openBlock(), createElementBlock("div", _hoisted_7, [
4378
+ _ctx.flowCondition?.[activeRule.value.field] ? (openBlock(), createElementBlock("div", _hoisted_7, [
4379
4379
  createVNode(unref(ExclamationCircleFilled), { style: { "color": "#2f4eed" } }),
4380
4380
  createTextVNode(" \u8BE5\u7EC4\u4EF6\u5728\u201C" + toDisplayString(_ctx.flowCondition[activeRule.value.field]) + "\u201D\u5DF2\u88AB\u8BBE\u4E3A\u5BA1\u6279\u6761\u4EF6\uFF0C" + toDisplayString(flowConditionTipMap[activeRule.value?.config?.config?.name]), 1)
4381
4381
  ])) : createCommentVNode("v-if", true),
@@ -604,11 +604,15 @@ var picture = {
604
604
  listType: 'picture-card',
605
605
  text: '请选择',
606
606
  multiple: maxCount > 1,
607
+ accept: '.jpg,.png',
607
608
  },
608
609
  extraProps: {
609
610
  maxSize: 10,
610
611
  maxCount,
611
612
  },
613
+ customErrors: {
614
+ format: '请上传jpg、png格式的图片',
615
+ },
612
616
  defaultList: data.value,
613
617
  uploadRequest(inject, file) {
614
618
  return __awaiter(this, void 0, void 0, function* () {
@@ -634,7 +638,7 @@ var picture = {
634
638
  });
635
639
  },
636
640
  error(inject, error) {
637
- antDesignVue.message.error(error.message);
641
+ antDesignVue.message.error(error === null || error === void 0 ? void 0 : error.message);
638
642
  },
639
643
  },
640
644
  };
@@ -1517,14 +1521,25 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1517
1521
  const field = rule.field;
1518
1522
  const associatedFields = rule?.config?.associatedFields;
1519
1523
  let result = void 0;
1520
- if (row[field]) {
1521
- result = await props.extraConfig.product.fetch({ productCode: row[field] });
1524
+ try {
1525
+ if (row[field]) {
1526
+ result = await props.extraConfig.product.fetch({
1527
+ productCode: row[field]
1528
+ });
1529
+ }
1530
+ processAssociatedFields(field, associatedFields, row, result);
1531
+ return result;
1532
+ } catch (e) {
1533
+ row[field] = "";
1534
+ processAssociatedFields(field, associatedFields, row, result);
1535
+ return Promise.resolve(result);
1522
1536
  }
1537
+ }
1538
+ function processAssociatedFields(field, associatedFields, row, result) {
1523
1539
  if (associatedFields.length)
1524
1540
  associatedFields.forEach((item) => {
1525
1541
  row[productPicName(item.value, field)] = result ? result[productInfoKeyMap[item.value]] : void 0;
1526
1542
  });
1527
- return result;
1528
1543
  }
1529
1544
  function handleChange(e) {
1530
1545
  const file = e.target.files[0];
@@ -1707,11 +1722,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1707
1722
  return !formData.value[shopField];
1708
1723
  }
1709
1724
  function handlePressEnter(rule, row) {
1710
- queryProductInfo(rule, row).then((data2) => {
1711
- if (!data2) {
1712
- row[rule.field] = "";
1713
- }
1714
- });
1725
+ queryProductInfo(rule, row);
1715
1726
  }
1716
1727
  function handleProductInputChange(rule, row) {
1717
1728
  queryProductInfoDebounce(rule, row);
@@ -2101,6 +2112,9 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2101
2112
  tempSelected: {}
2102
2113
  };
2103
2114
  }
2115
+ function handleError(e) {
2116
+ antDesignVue.message.error(e?.message);
2117
+ }
2104
2118
  props.value && initValue(props.value);
2105
2119
  props.extraConfig.materialTemp.getDict().then((data) => {
2106
2120
  measrueDicts.value = data;
@@ -2331,14 +2345,19 @@ const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2331
2345
  listType: "picture-card",
2332
2346
  text: "\u4E0A\u4F20\u56FE\u7247",
2333
2347
  multiple: true,
2334
- disabled: __props.disabled?.includes?.("uploadPic")
2348
+ disabled: __props.disabled?.includes?.("uploadPic"),
2349
+ accept: ".jpg,.png"
2335
2350
  },
2336
2351
  "extra-props": {
2337
2352
  maxCount: 9
2338
2353
  },
2339
2354
  "upload-request": __props.extraConfig.materialTemp.uploadRequest,
2340
2355
  "default-list": pane.uploadList,
2341
- onUpdate: handleUpload
2356
+ "custom-errors": {
2357
+ format: "\u8BF7\u4E0A\u4F20jpg\u3001png\u683C\u5F0F\u7684\u56FE\u7247"
2358
+ },
2359
+ onUpdate: handleUpload,
2360
+ onError: handleError
2342
2361
  }, null, 8, ["upload-props", "upload-request", "default-list"])
2343
2362
  ]),
2344
2363
  _: 2
@@ -2624,6 +2643,7 @@ var product = {
2624
2643
  on: {
2625
2644
  change(inject, value) {
2626
2645
  inject.self.value = value;
2646
+ inject.self.props.defalutValue = value;
2627
2647
  vue.nextTick(() => {
2628
2648
  inject.api.validateField(inject.self.field);
2629
2649
  });
@@ -2650,6 +2670,10 @@ var product = {
2650
2670
  on: {
2651
2671
  change(inject, value) {
2652
2672
  inject.self.value = value;
2673
+ inject.self.props.defalutValue = value;
2674
+ vue.nextTick(() => {
2675
+ inject.api.validateField(inject.self.field);
2676
+ });
2653
2677
  },
2654
2678
  },
2655
2679
  };
@@ -4007,7 +4007,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4007
4007
  antDesignVue.message.error("\u8BE5\u63A7\u4EF6\u5DF2\u88AB\u8BBE\u4E3A\u6570\u636E\u8FC7\u6EE4\u6761\u4EF6\uFF0C\u4E0D\u53EF\u5220\u9664\u3002");
4008
4008
  return;
4009
4009
  }
4010
- if (props.flowCondition[targetRule.field]) {
4010
+ if (props.flowCondition?.[targetRule.field]) {
4011
4011
  antDesignVue.message.error(
4012
4012
  `\u8BE5\u7EC4\u4EF6\u5728\u201C${props.flowCondition[targetRule.field]}\u201D\u5DF2\u88AB\u8BBE\u4E3A\u5BA1\u6279\u6761\u4EF6\uFF0C\u4E0D\u53EF\u5220\u9664\u3002`
4013
4013
  );
@@ -4385,7 +4385,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
4385
4385
  })) : vue.createCommentVNode("v-if", true)
4386
4386
  ])) : vue.createCommentVNode("v-if", true),
4387
4387
  vue.createElementVNode("div", _hoisted_6, [
4388
- _ctx.flowCondition[activeRule.value.field] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
4388
+ _ctx.flowCondition?.[activeRule.value.field] ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_7, [
4389
4389
  vue.createVNode(vue.unref(iconsVue.ExclamationCircleFilled), { style: { "color": "#2f4eed" } }),
4390
4390
  vue.createTextVNode(" \u8BE5\u7EC4\u4EF6\u5728\u201C" + vue.toDisplayString(_ctx.flowCondition[activeRule.value.field]) + "\u201D\u5DF2\u88AB\u8BBE\u4E3A\u5BA1\u6279\u6761\u4EF6\uFF0C" + vue.toDisplayString(flowConditionTipMap[activeRule.value?.config?.config?.name]), 1)
4391
4391
  ])) : vue.createCommentVNode("v-if", true),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bm-admin-ui",
3
- "version": "1.0.61-alpha",
3
+ "version": "1.0.62-alpha",
4
4
  "private": false,
5
5
  "description": "An Admin Component Library for Bm",
6
6
  "license": "UNLICENSED",