From 49f09cc6f8ff8c30a75ed1a9d6f510b69b73962a Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 十二月 2023 21:05:37 +0800
Subject: [PATCH] 2023-12-12

---
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx |  187 ++++++++++++++++++++++++++++++++--------------
 1 files changed, 128 insertions(+), 59 deletions(-)

diff --git a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx
index 83ef825..6444785 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx
@@ -1,42 +1,35 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Select, Input, Radio, Tooltip, InputNumber } from 'antd'
+import { Form, Row, Col, Input, Radio, Tooltip, InputNumber, Switch } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
+import MemberForm from './memberform'
 const { TextArea } = Input
 
 class NodeForm extends Component {
   static propTpyes = {
     node: PropTypes.any,
     data: PropTypes.any,
-    rolelist: PropTypes.array
+    orgs: PropTypes.array
   }
 
   state = {
-    ctrlType: this.props.data.ctrlType || 'role'
+    flowType: this.props.data.flowType || 'approval',
+    execCondition: this.props.data.execCondition === 'open',
   }
 
   handleConfirm = () => {
-    const { rolelist } = this.props
-
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
-          if (values.roleId) {
-            values.roleName = ''
-            rolelist.forEach(item => {
-              if (item.RoleID === values.roleId) {
-                values.roleName = item.RoleName
-              }
-            })
+          if (values.execCondition === true) {
+            values.execCondition = 'open'
+          } else if (values.execCondition === false) {
+            values.execCondition = 'close'
           }
-          if (values.depId) {
-            values.depName = ''
-            rolelist.forEach(item => {
-              if (item.RoleID === values.depId) {
-                values.depName = item.RoleName
-              }
-            })
+
+          if (values.matchVal) {
+            values.matchVal = values.matchVal.replace(/\t+|\v+|\s+/g, '')
           }
           resolve(values)
         } else {
@@ -47,9 +40,9 @@
   }
 
   render() {
-    const { node, rolelist } = this.props
+    const { node, orgs } = this.props
     const { getFieldDecorator } = this.props.form
-    const { ctrlType } = this.state
+    const { flowType, execCondition } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -61,6 +54,16 @@
       }
     }
     let data = this.props.data || {}
+    let nodetype = node.shape !== 'edge' ? 'node' : 'edge'
+    if (node.mknode === 'start') {
+      nodetype = 'start'
+    } else if (node.mknode === 'end') {
+      nodetype = 'end'
+    } else if (node.mknode === 'endEdge') {
+      nodetype = 'endEdge'
+    } else if (node.mknode === 'startEdge') {
+      nodetype = 'startEdge'
+    }
 
     return (
       <Form {...formItemLayout} className="normal-node-form">
@@ -68,7 +71,7 @@
           <Col span={12}>
             <Form.Item label="鐘舵�佸��">
               {getFieldDecorator('status', {
-                initialValue: data.status || 0,
+                initialValue: data.status,
                 rules: [
                   {
                     required: true,
@@ -76,7 +79,7 @@
                   }
                 ]
               })(
-                <InputNumber precision={0}/>
+                <InputNumber readOnly={nodetype !== 'node' && nodetype !== 'edge'} precision={0}/>
               )}
             </Form.Item>
           </Col>
@@ -89,7 +92,7 @@
               )}
             </Form.Item>
           </Col>
-          {node.shape !== 'edge' ? <Col span={12}>
+          {nodetype === 'node' ? <Col span={12}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="鏍囪灏嗕綔涓鸿妭鐐笽D">
                 <QuestionCircleOutlined className="mk-form-tip" />
@@ -103,50 +106,116 @@
               )}
             </Form.Item>
           </Col> : null}
-          <Col span={12}>
-            <Form.Item label="绫诲瀷">
-              {getFieldDecorator('ctrlType', {
-                initialValue: data.ctrlType || 'role'
+          {nodetype === 'edge' ? <Col span={12}>
+            <Form.Item label="鎿嶄綔绫诲瀷">
+              {getFieldDecorator('flowType', {
+                initialValue: flowType
               })(
-                <Radio.Group onChange={(e) => this.setState({ctrlType: e.target.value})}>
-                  <Radio value="role">瑙掕壊</Radio>
-                  <Radio value="department">閮ㄩ棬</Radio>
-                  <Radio value="none">鏃�</Radio>
+                <Radio.Group onChange={(e) => this.setState({flowType: e.target.value})}>
+                  <Radio value="approval">瀹℃壒</Radio>
+                  <Radio value="reject">椹冲洖</Radio>
                 </Radio.Group>
               )}
             </Form.Item>
-          </Col>
-          {ctrlType === 'role' ? <Col span={12}>
-            <Form.Item label="瑙掕壊">
-              {getFieldDecorator('roleId', {
-                initialValue: data.roleId || '',
-                rules: [
-                  {
-                    required: true,
-                    message: '璇烽�夋嫨瑙掕壊!'
-                  }
-                ]
+          </Col> : null}
+          {nodetype === 'edge' ? <Col span={12}>
+            <Form.Item label="璁剧疆瀹℃壒浜�">
+              {getFieldDecorator('approver', {
+                initialValue: data.approver || 'member'
               })(
-                <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
-                  {rolelist.map(item => (<Select.Option key={item.RoleID} value={item.RoleID}>{item.RoleName}</Select.Option>))}
-                </Select>
+                <Radio.Group>
+                  <Radio value="member">鎸囧畾鎴愬憳</Radio>
+                  <Radio value="departmentManager">閮ㄩ棬涓荤</Radio>
+                  <Radio value="directManager">鐩村睘涓荤</Radio>
+                </Radio.Group>
               )}
             </Form.Item>
           </Col> : null}
-          {ctrlType === 'department' ? <Col span={12}>
-            <Form.Item label="閮ㄩ棬">
-              {getFieldDecorator('depId', {
-                initialValue: data.depId || '',
-                rules: [
-                  {
-                    required: true,
-                    message: '璇烽�夋嫨閮ㄩ棬!'
-                  }
-                ]
+          {nodetype === 'edge' && flowType !== 'reject' ? <Col span={12}>
+            <Form.Item label="瀹℃壒鏂瑰紡">
+              {getFieldDecorator('approvalMethod', {
+                initialValue: data.approvalMethod || 'orsign'
               })(
-                <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
-                  {rolelist.map(item => (<Select.Option key={item.RoleID} value={item.RoleID}>{item.RoleName}</Select.Option>))}
-                </Select>
+                <Radio.Group>
+                  <Radio value="countersign">浼氱</Radio>
+                  <Radio value="orsign">鎴栫</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {nodetype === 'edge' ? <Col span={12}>
+            <Form.Item label="瀹℃壒浜�">
+              {getFieldDecorator('members', {
+                initialValue: data.members || [],
+                rules: [{
+                  required: true,
+                  message: '璇锋坊鍔犲鎵逛汉!'
+                }]
+              })(
+                <MemberForm orgs={orgs} title="瀹℃壒浜�"/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {nodetype === 'edge' ? <Col span={12}>
+            <Form.Item label="鎶勯�佷汉">
+              {getFieldDecorator('copys', {
+                initialValue: data.copys || []
+              })(
+                <MemberForm orgs={orgs} title="鎶勯�佷汉"/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {nodetype === 'edge' && flowType !== 'reject' ? <Col span={12}>
+            <Form.Item label="鎵ц鏉′欢">
+              {getFieldDecorator('execCondition', {
+                valuePropName: 'checked',
+                initialValue: execCondition
+              })(
+                <Switch checkedChildren="寮�鍚�" unCheckedChildren="鍏抽棴" onChange={(val) => this.setState({execCondition: val})} />
+              )}
+            </Form.Item>
+          </Col> : null}
+          {nodetype === 'edge' && flowType !== 'reject' && execCondition ? <Col span={12}>
+            <Form.Item label="瀵规瘮鏂瑰紡">
+              {getFieldDecorator('match', {
+                initialValue: data.match || '='
+              })(
+                <Radio.Group>
+                  <Radio value="=">=</Radio>
+                  <Radio value="<">&lt;</Radio>
+                  <Radio value=">">&gt;</Radio>
+                  <Radio value="<=">&lt;=</Radio>
+                  <Radio value=">=">&gt;=</Radio>
+                  <Radio value="!=">!=</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {nodetype === 'edge' && flowType !== 'reject' && execCondition ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="瀵规瘮鍊间腑涓嶅彲鍖呭惈鍒惰〃绗︺�佺┖鏍笺�佹崲琛岀绛夈��">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                瀵规瘮鍊�
+              </Tooltip>
+            }>
+              {getFieldDecorator('matchVal', {
+                initialValue: data.matchVal || ''
+              })(
+                <Input placeholder="" autoComplete="off"/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {nodetype === 'node' ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鏍囪灏嗕綔涓鸿妭鐐笽D">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鏍囪
+              </Tooltip>
+            }>
+              {getFieldDecorator('sign', {
+                initialValue: data.sign || ''
+              })(
+                <Input placeholder="" autoComplete="off"/>
               )}
             </Form.Item>
           </Col> : null}

--
Gitblit v1.8.0