Browse Source

Merge branch 'develop' into develop_0715

xujunjie 2 years ago
parent
commit
d0d5337fd4

+ 1 - 0
public/luckysheet.html

@@ -16,6 +16,7 @@
   <script src="/bom/Luckysheet/luckysheet.umd.js"></script> -->
 
   <!-- 本地开发使用路径 -->
+
   <link rel='stylesheet' href='http://localhost:3000/plugins/css/pluginsCss.css' />
   <link rel='stylesheet' href='http://localhost:3000/plugins/plugins.css' />
   <link rel='stylesheet' href='http://localhost:3000/css/luckysheet.css' />

+ 13 - 0
src/components/DDComponents/DDDateField/index.js

@@ -0,0 +1,13 @@
+import React from 'react';
+import { DatePicker } from 'antd';
+
+function DDDateField(props) {
+  const { format, disabled, onChange } = props;
+
+  const handleChange = date => {
+    onChange?.(date.format('YYYY-MM-DD'));
+  };
+  return <DatePicker disabled={disabled} format={format.replace("yyyy","YYYY").replace("dd","DD")} onChange={handleChange} />;
+}
+
+export default DDDateField;

+ 22 - 0
src/components/DDComponents/DDDateRangeField/index.js

@@ -0,0 +1,22 @@
+import React from 'react';
+import { DatePicker } from 'antd';
+
+const { RangePicker } = DatePicker;
+
+function DDDateRangeField(props) {
+  const { format, disabled, onChange } = props;
+
+  const handleChange = date => {
+    let value = [date[0].format('YYYY-MM-DD'), date[1].format('YYYY-MM-DD')];
+    onChange?.(JSON.stringify(value));
+  };
+  return (
+    <RangePicker
+      disabled={disabled}
+      format={format.replace('yyyy', 'YYYY').replace('dd', 'DD')}
+      onChange={handleChange}
+    />
+  );
+}
+
+export default DDDateRangeField;

+ 12 - 3
src/components/DDComponents/DDMultiSelectField/index.js

@@ -3,7 +3,7 @@ import { Select } from 'antd';
 
 const { Option } = Select;
 
-function DDSelectField(props) {
+function DDMultiSelectField(props) {
   const { options, disabled, onChange } = props;
 
   return (
@@ -18,7 +18,16 @@ function DDSelectField(props) {
     >
       {options?.map(cur => {
         if (typeof cur == 'string') {
-          cur = JSON.parse(cur);
+          try {
+            // 判断是否为json字符串
+            cur = JSON.parse(cur);
+          } catch (error) {
+            // 拼接成对象
+            cur = {
+              key: cur,
+              value: cur,
+            };
+          }
         }
 
         return (
@@ -31,4 +40,4 @@ function DDSelectField(props) {
   );
 }
 
-export default DDSelectField;
+export default DDMultiSelectField;

+ 41 - 0
src/components/DDComponents/DDSelectField/index.js

@@ -0,0 +1,41 @@
+import React from 'react';
+import { Select } from 'antd';
+
+const { Option } = Select;
+
+function DDSelectField(props) {
+  const { options, disabled, onChange } = props;
+
+  return (
+    <Select
+      style={{ width: '100%' }}
+      disabled={disabled}
+      onChange={value => {
+        onChange(JSON.stringify(value));
+      }}
+    >
+      {options?.map(cur => {
+        if (typeof cur == 'string') {
+          try {
+            // 判断是否为json字符串
+            cur = JSON.parse(cur);
+          } catch (error) {
+            // 拼接成对象
+            cur = {
+              key: cur,
+              value: cur,
+            };
+          }
+        }
+
+        return (
+          <Option key={cur.key} value={cur.value}>
+            {cur.value}
+          </Option>
+        );
+      })}
+    </Select>
+  );
+}
+
+export default DDSelectField;

+ 6 - 5
src/components/DDComponents/InnerContactField/index.js

@@ -15,11 +15,12 @@ function InnerContactField(props) {
       }}
       filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
     >
-      {userList.map(item => (
-        <Option key={item.ID} value={item.DingUserId}>
-          {item.CName}
-        </Option>
-      ))}
+      {userList
+        .map(item => (
+          <Option key={item.ID} value={item.ID}>
+            {item.CName}
+          </Option>
+        ))}
     </Select>
   );
 }

+ 2 - 1
src/components/DDComponents/NumberField/index.js

@@ -2,10 +2,11 @@ import React from 'react';
 import { InputNumber } from 'antd';
 
 function NumberField(props) {
-  const { onChange,disabled, unit } = props;
+  const { onChange, disabled, unit } = props;
 
   return (
     <InputNumber
+      style={{ width: '100%' }}
       disabled={disabled}
       formatter={value => `${value}${unit || ''}`}
       onChange={e => {

+ 18 - 18
src/components/DDComponents/index.js

@@ -6,6 +6,9 @@ import DepartmentField from './DepartmentField';
 import DDMultiSelectField from './DDMultiSelectField';
 import NumberField from './NumberField';
 import DDPhotoField from './DDPhotoField';
+import DDSelectField from './DDSelectField';
+import DDDateField from './DDDateField';
+import DDDateRangeField from './DDDateRangeField';
 
 const { Option } = Select;
 const { RangePicker } = DatePicker;
@@ -54,33 +57,20 @@ export default function DDComponents(props) {
       component = <NumberField disabled={disabled} unit={unit} />;
       break;
     case 'DDSelectField': //单选框
-      component = (
-        <Select style={{ width: '100%' }} onChange={onChange}>
-          {options?.map(cur => {
-            if (typeof cur == 'string') {
-              cur = JSON.parse(cur);
-            }
-
-            return (
-              <Option key={cur.key} value={cur.value}>
-                {cur.value}
-              </Option>
-            );
-          })}
-        </Select>
-      );
+      component = <DDSelectField options={options} onChange={onChange} disabled={disabled} />;
       break;
     case 'DDMultiSelectField': //多选框
       component = <DDMultiSelectField disabled={disabled} options={options} />;
       break;
     case 'DDDateField': //日期控件
-      component = <DatePicker format={format} onChange={onChange} />;
+      component = <DDDateField format={format} disabled={disabled} />;
       break;
     case 'DDDateRangeField': //时间区间控件
-      component = <RangePicker format={format} onChange={onChange} />;
+      component = <DDDateRangeField format={format} disabled={disabled} />;
       break;
     case 'TextNote': //文本说明控件
-      // component = <p style={{textAlign: align}}></p>
+      console.info('文本说明控件!');
+      console.log(item);
       break;
     case 'PhoneField': //电话控件
       component = <PhoneField onChange={onChange} />;
@@ -100,6 +90,8 @@ export default function DDComponents(props) {
       //     <Button icon={<PlusOutlined />}>添加附件</Button>
       //   </Upload>
       // );
+      console.info('附件控件未渲染!');
+      console.log(item);
       break;
     case 'InnerContactField': //联系人控件
       component = <InnerContactField onChange={onChange}></InnerContactField>;
@@ -108,12 +100,20 @@ export default function DDComponents(props) {
       component = <DepartmentField />;
       break;
     case 'RelateField': //关联审批单
+      console.info('关联审批单控件未渲染!');
+      console.log(item);
       break;
     case 'AddressField': //省市区控件
+      console.info('省市区控件未渲染!');
+      console.log(item);
       break;
     case 'StarRatingField': //评分控件
+      console.info('评分控件未渲染!');
+      console.log(item);
       break;
     case 'FormRelateField': //关联控件
+      console.info('关联控件未渲染!');
+      console.log(item);
       break;
   }
 

+ 15 - 1
src/pages/PurchaseAdmin/PurchaseList/Detail/AuditDetailed.js

@@ -80,11 +80,25 @@ const AuditDetailed = props => {
         if (currentValue != value) return null;
       }
     }
+    const formLabel = useMemo(() => {
+      let formLabel = '';
+      if (bizAlias) {
+        formLabel = bizAlias;
+      } else {
+        try {
+          // 判断label是否为JSON数组
+          formLabel = JSON.parse(label).join(',');
+        } catch (error) {
+          formLabel = label;
+        }
+      }
+      return formLabel;
+    }, []);
 
     const component = DDComponents({ item });
     if (!component) return null;
     return (
-      <Form.Item label={bizAlias || label}>
+      <Form.Item label={formLabel}>
         {form.getFieldDecorator(id, {
           rules: [{ required }],
         })(component)}

+ 6 - 0
src/pages/PurchaseAdmin/PurchaseList/Detail/CommitAuditModal.js

@@ -33,6 +33,7 @@ function CommitAuditModal(props) {
     const data = treeData(currentId);
     if (data.length <= 0) setAuditId(currentId);
     setData(data);
+
   }, [auditId, version.template_node_id, visible]);
 
   useEffect(() => {
@@ -50,6 +51,7 @@ function CommitAuditModal(props) {
       });
     };
     fun(list);
+
     const fun2 = list => {
       const parents = list.filter(item => list.findIndex(node => node.Id == item.parentId) == -1);
       let translator = (parents, children) => {
@@ -96,6 +98,7 @@ function CommitAuditModal(props) {
     let targetIds = edges
       .filter(edge => edge.source.cell == currentId)
       .map(item => item.target.cell);
+
     edges.filter(edge => edge.source.cell == currentId);
     let auditNodes = nodes.filter(node => {
       if (type && node.name != type) {
@@ -122,6 +125,7 @@ function CommitAuditModal(props) {
 
   const onChange = value => {
     changeAudit(value[value.length - 1]);
+
     setAuditListFun();
   };
   //处理tabs页
@@ -179,6 +183,7 @@ function CommitAuditModal(props) {
     setAuditList(addAuditList);
   };
 
+
   const getFromData = idList => {
     const data = formComponentValues;
     const result = [];
@@ -253,6 +258,7 @@ function CommitAuditModal(props) {
       })
       .filter(item => item);
     let serviceNode = flowDetail.nodes.find?.(item => item.Id == fieldsValue.next_template_node_id);
+
     if (!serviceNode) {
       message.error('请选择需要流转的业务节点。');
       return;