szld-libs 0.2.92 → 0.2.94

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.
@@ -7,15 +7,11 @@ export declare function isBase64(str: string): boolean;
7
7
  * 处理表单提交数据,将表单值合并到原始数据attrvalue中
8
8
  * @param originalData 原始数据
9
9
  * @param allValues 表单提交值
10
+ * @param isListToObj 是否将列表转换为提交数据格式对象,默认false
10
11
  * @returns
11
12
  */
12
- export declare const handleSubmitForm: (originalData: any, allValues: any) => {
13
- updatedData: {
14
- data: {
15
- asid: any;
16
- data_list: any[];
17
- };
18
- };
13
+ export declare const handleSubmitForm: (originalData: any, allValues: any, isListToObj?: boolean) => {
14
+ updatedData: any;
19
15
  uploadedFiles: any[];
20
16
  };
21
17
  /**
@@ -1,7 +1,6 @@
1
1
  import { message } from "antd";
2
2
  import dayjs from "dayjs";
3
3
  import _ from "lodash";
4
- import { handleObjDetailToSignleAttrList } from "./szxkFunc";
5
4
  function getJson(jsonStr) {
6
5
  try {
7
6
  return JSON.parse(jsonStr);
@@ -28,7 +27,7 @@ function isBase64(str) {
28
27
  const base64Regex = /^[A-Za-z0-9+/]+(?:=?=?)$/;
29
28
  return base64Regex.test(str);
30
29
  }
31
- const handleSubmitForm = (originalData, allValues) => {
30
+ const handleSubmitForm = (originalData, allValues, isListToObj) => {
32
31
  let updatedData = _.cloneDeep(originalData);
33
32
  let uploadedFiles = [];
34
33
  const processAttrList = (attrList) => {
@@ -138,7 +137,7 @@ const handleSubmitForm = (originalData, allValues) => {
138
137
  processAttrList(updatedData.attr_list);
139
138
  }
140
139
  return {
141
- updatedData: handleAttrListToObj(updatedData.attr_list || []),
140
+ updatedData: isListToObj ? handleAttrListToObj(updatedData.attr_list || []) : updatedData,
142
141
  uploadedFiles
143
142
  };
144
143
  };
@@ -314,7 +313,6 @@ const handleAttrListToObj = (attrList) => {
314
313
  const { attrvalue = [], children = [] } = item || {};
315
314
  if (Array.isArray(attrvalue) && (attrvalue == null ? void 0 : attrvalue.length)) {
316
315
  item.children = attrvalue.map((v) => {
317
- return handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
318
316
  });
319
317
  result[key] = {
320
318
  asid: ((_e = (_d = (_c = item.children) == null ? void 0 : _c[0]) == null ? void 0 : _d[0]) == null ? void 0 : _e.asid) || "",
@@ -7,15 +7,11 @@ export declare function isBase64(str: string): boolean;
7
7
  * 处理表单提交数据,将表单值合并到原始数据attrvalue中
8
8
  * @param originalData 原始数据
9
9
  * @param allValues 表单提交值
10
+ * @param isListToObj 是否将列表转换为提交数据格式对象,默认false
10
11
  * @returns
11
12
  */
12
- export declare const handleSubmitForm: (originalData: any, allValues: any) => {
13
- updatedData: {
14
- data: {
15
- asid: any;
16
- data_list: any[];
17
- };
18
- };
13
+ export declare const handleSubmitForm: (originalData: any, allValues: any, isListToObj?: boolean) => {
14
+ updatedData: any;
19
15
  uploadedFiles: any[];
20
16
  };
21
17
  /**
@@ -3,7 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const antd = require("antd");
4
4
  const dayjs = require("dayjs");
5
5
  const _ = require("lodash");
6
- const szxkFunc = require("./szxkFunc");
7
6
  function getJson(jsonStr) {
8
7
  try {
9
8
  return JSON.parse(jsonStr);
@@ -30,7 +29,7 @@ function isBase64(str) {
30
29
  const base64Regex = /^[A-Za-z0-9+/]+(?:=?=?)$/;
31
30
  return base64Regex.test(str);
32
31
  }
33
- const handleSubmitForm = (originalData, allValues) => {
32
+ const handleSubmitForm = (originalData, allValues, isListToObj) => {
34
33
  let updatedData = _.cloneDeep(originalData);
35
34
  let uploadedFiles = [];
36
35
  const processAttrList = (attrList) => {
@@ -140,7 +139,7 @@ const handleSubmitForm = (originalData, allValues) => {
140
139
  processAttrList(updatedData.attr_list);
141
140
  }
142
141
  return {
143
- updatedData: handleAttrListToObj(updatedData.attr_list || []),
142
+ updatedData: isListToObj ? handleAttrListToObj(updatedData.attr_list || []) : updatedData,
144
143
  uploadedFiles
145
144
  };
146
145
  };
@@ -316,7 +315,6 @@ const handleAttrListToObj = (attrList) => {
316
315
  const { attrvalue = [], children = [] } = item || {};
317
316
  if (Array.isArray(attrvalue) && (attrvalue == null ? void 0 : attrvalue.length)) {
318
317
  item.children = attrvalue.map((v) => {
319
- return szxkFunc.handleObjDetailToSignleAttrList((children == null ? void 0 : children[0]) || [], v);
320
318
  });
321
319
  result[key] = {
322
320
  asid: ((_e = (_d = (_c = item.children) == null ? void 0 : _c[0]) == null ? void 0 : _d[0]) == null ? void 0 : _e.asid) || "",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.2.92",
4
+ "version": "0.2.94",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",