hy-dispatch-ui-v3 0.2.69 → 0.2.70

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.
@@ -92,6 +92,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
92
92
  showAddBtn: {
93
93
  type: Boolean,
94
94
  default: true
95
+ },
96
+ // 提交数据之前处理
97
+ beforeSubmitHandler: {
98
+ type: Function
95
99
  }
96
100
  }, {
97
101
  "modelValue": { type: Boolean, default: false },
@@ -186,8 +190,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
186
190
  batchTableFormRef.value.nextStep();
187
191
  }
188
192
  async function onSubmitHandler() {
189
- const res = await batchTableFormRef.value.validate();
193
+ let res = batchTableFormRef.value.validate();
190
194
  if (props.uploadType === "custom") {
195
+ if (res.total === res.success && props.beforeSubmitHandler) {
196
+ await props.beforeSubmitHandler(res.dataSource);
197
+ res = batchTableFormRef.value.validate();
198
+ }
191
199
  const dataSource = batchTableFormRef.value.getTableDataSource();
192
200
  onTableSubmitHandler({
193
201
  ...res,
@@ -361,6 +369,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
361
369
  onExpandRowChange: __props.onExpandRowChange,
362
370
  "submit-handler": __props.submitHandler,
363
371
  showAddBtn: __props.showAddBtn,
372
+ beforeSubmitHandler: __props.beforeSubmitHandler,
364
373
  onTableDataChange: tableDataChange,
365
374
  onUploading: onTableUploadingHandler,
366
375
  onUploaded: onTableUploadedHandler,
@@ -382,7 +391,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
382
391
  ])
383
392
  };
384
393
  })
385
- ]), 1032, ["step", "onUpdate:step", "tableColumns", "formColumns", "rules", "emptyText", "fontSize", "rowClickExpand", "columnNum", "size", "beforeDataHandle", "beforeDataListHandle", "onExpandRowChange", "submit-handler", "showAddBtn", "onOptionsStatus"])) : createCommentVNode("v-if", true)
394
+ ]), 1032, ["step", "onUpdate:step", "tableColumns", "formColumns", "rules", "emptyText", "fontSize", "rowClickExpand", "columnNum", "size", "beforeDataHandle", "beforeDataListHandle", "onExpandRowChange", "submit-handler", "showAddBtn", "beforeSubmitHandler", "onOptionsStatus"])) : createCommentVNode("v-if", true)
386
395
  ])
387
396
  ])
388
397
  ]),
@@ -77,6 +77,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
77
77
  // 外部整体数据处理
78
78
  beforeDataListHandle: {
79
79
  type: Function
80
+ },
81
+ // 提交数据之前处理
82
+ beforeSubmitHandler: {
83
+ type: Function
80
84
  }
81
85
  }, {
82
86
  "step": { type: Number, default: 1 },
@@ -252,9 +256,13 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
252
256
  emits("submitting");
253
257
  for (let i = 0; i <= dataSource.length - 1; i++) {
254
258
  const target = dataSource[i];
255
- const { onlyId, errorMsg, errorMap, children, ...data } = target;
259
+ let { onlyId, errorMsg, errorMap, children, ...data } = target;
256
260
  setSubmitProgress(Math.floor((i + 1) / total * 100));
257
- if (errorMsg) {
261
+ if (!errorMsg && props.beforeSubmitHandler) {
262
+ await props.beforeSubmitHandler([data]);
263
+ errorMsg = data.errorMsg;
264
+ }
265
+ if (errorMsg && errorMsg.message) {
258
266
  continue;
259
267
  }
260
268
  try {
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.2.68";
1
+ const version = "0.2.69";
2
2
 
3
3
  export { version };
@@ -96,6 +96,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
96
96
  showAddBtn: {
97
97
  type: Boolean,
98
98
  default: true
99
+ },
100
+ // 提交数据之前处理
101
+ beforeSubmitHandler: {
102
+ type: Function
99
103
  }
100
104
  }, {
101
105
  "modelValue": { type: Boolean, default: false },
@@ -190,8 +194,12 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
190
194
  batchTableFormRef.value.nextStep();
191
195
  }
192
196
  async function onSubmitHandler() {
193
- const res = await batchTableFormRef.value.validate();
197
+ let res = batchTableFormRef.value.validate();
194
198
  if (props.uploadType === "custom") {
199
+ if (res.total === res.success && props.beforeSubmitHandler) {
200
+ await props.beforeSubmitHandler(res.dataSource);
201
+ res = batchTableFormRef.value.validate();
202
+ }
195
203
  const dataSource = batchTableFormRef.value.getTableDataSource();
196
204
  onTableSubmitHandler({
197
205
  ...res,
@@ -365,6 +373,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
365
373
  onExpandRowChange: __props.onExpandRowChange,
366
374
  "submit-handler": __props.submitHandler,
367
375
  showAddBtn: __props.showAddBtn,
376
+ beforeSubmitHandler: __props.beforeSubmitHandler,
368
377
  onTableDataChange: tableDataChange,
369
378
  onUploading: onTableUploadingHandler,
370
379
  onUploaded: onTableUploadedHandler,
@@ -386,7 +395,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
386
395
  ])
387
396
  };
388
397
  })
389
- ]), 1032, ["step", "onUpdate:step", "tableColumns", "formColumns", "rules", "emptyText", "fontSize", "rowClickExpand", "columnNum", "size", "beforeDataHandle", "beforeDataListHandle", "onExpandRowChange", "submit-handler", "showAddBtn", "onOptionsStatus"])) : vue.createCommentVNode("v-if", true)
398
+ ]), 1032, ["step", "onUpdate:step", "tableColumns", "formColumns", "rules", "emptyText", "fontSize", "rowClickExpand", "columnNum", "size", "beforeDataHandle", "beforeDataListHandle", "onExpandRowChange", "submit-handler", "showAddBtn", "beforeSubmitHandler", "onOptionsStatus"])) : vue.createCommentVNode("v-if", true)
390
399
  ])
391
400
  ])
392
401
  ]),
@@ -81,6 +81,10 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
81
81
  // 外部整体数据处理
82
82
  beforeDataListHandle: {
83
83
  type: Function
84
+ },
85
+ // 提交数据之前处理
86
+ beforeSubmitHandler: {
87
+ type: Function
84
88
  }
85
89
  }, {
86
90
  "step": { type: Number, default: 1 },
@@ -256,9 +260,13 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
256
260
  emits("submitting");
257
261
  for (let i = 0; i <= dataSource.length - 1; i++) {
258
262
  const target = dataSource[i];
259
- const { onlyId, errorMsg, errorMap, children, ...data } = target;
263
+ let { onlyId, errorMsg, errorMap, children, ...data } = target;
260
264
  setSubmitProgress(Math.floor((i + 1) / total * 100));
261
- if (errorMsg) {
265
+ if (!errorMsg && props.beforeSubmitHandler) {
266
+ await props.beforeSubmitHandler([data]);
267
+ errorMsg = data.errorMsg;
268
+ }
269
+ if (errorMsg && errorMsg.message) {
262
270
  continue;
263
271
  }
264
272
  try {
package/lib/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use strict';
2
2
 
3
- const version = "0.2.68";
3
+ const version = "0.2.69";
4
4
 
5
5
  exports.version = version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hy-dispatch-ui-v3",
3
- "version": "0.2.69",
3
+ "version": "0.2.70",
4
4
  "main": "lib/index.js",
5
5
  "module": "es/index.mjs",
6
6
  "scripts": {