xujunjie пре 2 година
родитељ
комит
1226868641

+ 36 - 0
src/components/DDComponents/DDAttachment/index.js

@@ -0,0 +1,36 @@
+import React, { useState, useEffect } from 'react';
+import { Upload, Button, message } from 'antd';
+import { PlusOutlined } from '@ant-design/icons';
+
+const CORP_ID = 'ding0cdce2d5dbf986d9';
+const AGENT_ID = '1788653353';
+
+function DDAttachment(props) {
+  const { disabled, onChange, spaceId = '213865445' } = props;
+  const [value, setValue] = useState([]);
+
+  const upload = () => {
+    // dd.biz.util.uploadAttachment({
+    //   // image: { multiple: true, compress: false, max: 9, spaceId: '12345' },
+    //   space: { corpId: CORP_ID, spaceId: spaceId, isCopy: 1, max: 9 },
+    //   file: { spaceId: spaceId, max: 1 },
+    //   types: ['file', 'space'], //PC端支持["photo","file","space"]
+    //   onSuccess: function(result) {
+    //     //onSuccess将在文件上传成功之后调用
+    //     onChange?.(result.data);
+    //   },
+    //   onFail: function(err) {
+    //     console.log(err);
+    //     message.error('附件上传失败');
+    //   },
+    // });
+  };
+
+  return (
+    <div onClick={upload}>
+      <Button icon={<PlusOutlined />}>添加附件</Button>
+    </div>
+  );
+}
+
+export default DDAttachment;

+ 2 - 2
src/components/DDComponents/InnerContactField/index.js

@@ -11,8 +11,8 @@ function InnerContactField(props) {
     <Select
       showSearch
       onChange={value => {
-        onChange(JSON.stringify([String(16569001414345099)]));
-        // onChange(JSON.stringify([String(value)]));
+        onChange(JSON.stringify(['16569001414345099']));
+        // onChange(JSON.stringify([value + ""]));
       }}
       filterOption={(input, option) => option.children.toLowerCase().includes(input.toLowerCase())}
     >

+ 7 - 15
src/components/DDComponents/index.js

@@ -9,6 +9,7 @@ import DDPhotoField from './DDPhotoField';
 import DDSelectField from './DDSelectField';
 import DDDateField from './DDDateField';
 import DDDateRangeField from './DDDateRangeField';
+import DDAttachment from './DDAttachment';
 
 const { Option } = Select;
 const { RangePicker } = DatePicker;
@@ -95,13 +96,8 @@ export default function DDComponents(props) {
       component = <TableField item={item} />;
       break;
     case 'DDAttachment': //附件
-      // component = (
-      //   <Upload>
-      //     <Button icon={<PlusOutlined />}>添加附件</Button>
-      //   </Upload>
-      // );
-      console.info('附件控件未渲染!');
-      console.log(item);
+      // component = <DDAttachment />
+      component = '附件控件未渲染!'
       break;
     case 'InnerContactField': //联系人控件
       component = <InnerContactField onChange={onChange}></InnerContactField>;
@@ -110,20 +106,16 @@ export default function DDComponents(props) {
       component = <DepartmentField onChange={onChange} />;
       break;
     case 'RelateField': //关联审批单
-      console.info('关联审批单控件未渲染!');
-      console.log(item);
+      component = '关联审批单控件未渲染!'
       break;
     case 'AddressField': //省市区控件
-      console.info('省市区控件未渲染!');
-      console.log(item);
+      component = '省市区控件未渲染!'
       break;
     case 'StarRatingField': //评分控件
-      console.info('评分控件未渲染!');
-      console.log(item);
+      component = '评分控件未渲染!'
       break;
     case 'FormRelateField': //关联控件
-      console.info('关联控件未渲染!');
-      console.log(item);
+      component = '关联控件未渲染!'
       break;
   }
 

+ 10 - 4
src/pages/PurchaseAdmin/PurchaseList/Detail/AuditDetailed.js

@@ -106,16 +106,22 @@ const AuditDetailed = props => {
     if (!component) return null;
     return (
       <Form.Item label={formLabel}>
-        {form.getFieldDecorator(id, {
-          rules: [{ required }],
-        })(component)}
+        {typeof component == 'string'
+          ? component
+          : form.getFieldDecorator(id, {
+              rules: [{ required }],
+            })(component)}
         {notUpper == 1 && <p>大写</p>}
       </Form.Item>
     );
   };
 
   return (
-    <Form layout="vertical" autoComplete="off">
+    <Form
+      style={{ height: '400px', overflowY: 'scroll', paddingRight: 20 }}
+      layout="vertical"
+      autoComplete="off"
+    >
       {items.map(item => GetComponent(item))}
     </Form>
   );

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

@@ -1,6 +1,6 @@
 import React, { useEffect, useState, useRef, useMemo } from 'react';
 import '@ant-design/compatible/assets/index.css';
-import { Modal, Input, Select, message, Cascader, Form, Tabs } from 'antd';
+import { Modal, Input, Select, message, Cascader, Form, Tabs, Row, Col, Empty } from 'antd';
 import { connect } from 'dva';
 import { isArray, result } from 'lodash';
 import { useForm } from 'rc-field-form';
@@ -334,6 +334,7 @@ function CommitAuditModal(props) {
       confirmLoading={loading}
       destroyOnClose
       title="提交流转目标"
+      width={1000}
       visible={visible}
       onCancel={() => {
         setAuditId();
@@ -365,11 +366,20 @@ function CommitAuditModal(props) {
           //   <AuditDetailed />
           // </TabPane>
           <TabPane tab={item.name} key={`${idx}_${item.title}`}>
-            {item.FormComponents}
-            <AuditFlow
-              processCode={item.formCode}
-              formComponentValues={formComponentValues[item.nodeId]}
-            />
+            <Row>
+              <Col span={17}>{item.FormComponents}</Col>
+              <Col offset={1} span={4}>
+                {!formComponentValues[item.nodeId] ? (
+                  <Empty description="请先填写表单" />
+                ) : (
+                  <AuditFlow
+                    processCode={item.formCode}
+                    formComponentValues={formComponentValues[item.nodeId]}
+                    direction={'vertical'}
+                  />
+                )}
+              </Col>
+            </Row>
           </TabPane>
         ))}
       </Tabs>