Kaynağa Gözat

fix: DIYTable保存时多次stringify问题

ZhaoJun 1 yıl önce
ebeveyn
işleme
82bcddeb32

+ 2 - 3
src/pages/Detail/CommitAuditModal.js

@@ -194,7 +194,7 @@ function CommitAuditModal(props) {
   };
 
   const getFromData = idList => {
-    const data = formComponentValues;
+    const data = JSON.parse(JSON.stringify(formComponentValues));
     const result = [];
     //获取流转节点的层级关系
     let len = 0;
@@ -218,7 +218,7 @@ function CommitAuditModal(props) {
       let values = data[approvalNode.Id] || prevValues || [];
       values.forEach(tempValue => {
         if (tempValue.type === 'DIYTable') {
-          tempValue.value = [...tempValue.value.map(item => JSON.stringify(item))];
+          tempValue.value = tempValue.value.map(item => JSON.stringify(item));
         }
       });
 
@@ -702,7 +702,6 @@ function CommitAuditModal(props) {
     setLoading(true);
     try {
       const formList = getFromData(result);
-      console.log(formList);
       let params = {
         desc: fieldsValue.desc,
         // 审核流程id

+ 1 - 6
src/pages/Detail/FormAndFilesNode.js

@@ -46,14 +46,9 @@ const renderFrom = data => {
   try {
     const ding_schema = JSON.parse(data)[0];
     const formData = JSON.parse(ding_schema)?.formComponentValues;
-
     formData.forEach(item => {
       if (item.type === 'DIYTable') {
-        item.value = item.value.map(row => {
-          const sss = JSON.parse(row);
-          const s = JSON.parse(sss);
-          return s;
-        });
+        item.value = item.value.map(row => JSON.parse(row));
       }
     });
     if (formData.length == 0) return <Empty description="没有表单信息" />;