From b20d0f21e53b3730de9ad1e7d96f25512620ff77 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 09 十月 2023 16:22:02 +0800
Subject: [PATCH] 2023-10-09

---
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss     |    1 
 src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx  |   11 -
 src/tabviews/custom/components/chart/antv-X6/index.jsx                 |  162 ++++++++++++++++-
 src/utils/utils-datamanage.js                                          |   21 ++
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx   |   64 ++++++
 src/menu/components/card/cardcellcomponent/index.jsx                   |    5 
 src/templates/zshare/verifycard/baseform/index.jsx                     |   29 +++
 src/templates/zshare/verifycard/index.jsx                              |   15 -
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/memberform.jsx |    2 
 src/utils/utils-custom.js                                              |   81 ++++-----
 src/utils/utils.js                                                     |  116 +++++++++++-
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx      |    2 
 12 files changed, 408 insertions(+), 101 deletions(-)

diff --git a/src/menu/components/card/cardcellcomponent/index.jsx b/src/menu/components/card/cardcellcomponent/index.jsx
index 1100466..3495c10 100644
--- a/src/menu/components/card/cardcellcomponent/index.jsx
+++ b/src/menu/components/card/cardcellcomponent/index.jsx
@@ -451,10 +451,7 @@
           } else if (res.class !== cell.class || res.show !== cell.show || !res.style) {
             let cl = res.class.replace('border-', '')
             let style = {}
-            if (res.show === 'link' || res.show === 'icon') {
-              style.color = color[cl]
-              style.backgroundColor = 'transparent'
-            } else if (res.class === 'default') {
+            if (res.class === 'default') {
               style.color = 'rgba(0, 0, 0, 0.65)'
               style.backgroundColor = '#fff'
               style.borderColor = '#d9d9d9'
diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx
index 97525bc..faedfd9 100644
--- a/src/tabviews/custom/components/chart/antv-X6/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx
@@ -989,7 +989,7 @@
     })
     graph.on('edge:click', ({ edge }) => {
       this.selectNode = edge
-      
+
       this.setState({node: edge.store.data})
 
       graph.clearTransformWidgets()
@@ -1561,19 +1561,41 @@
       let start_num = 0
       let end_num = 0
       let unvalid = false
+      let map = new Map()
+      let appMap = new Map()
       
       nodes.cells.forEach(item => {
-        if (item.mknode === 'start') {
+        if (item.shape === 'mk-text' || item.shape === 'lane') return
+
+        if (!item.mkdata) {
+          unvalid = true
+        } else if (item.mknode === 'start') {
           start_num++
         } else if (item.mknode === 'end') {
           end_num++
-        } else if (item.shape === 'edge' && item.mknode !== 'endEdge' && item.mknode !== 'startEdge') {
-          if (!item.mkdata.members || item.mkdata.members.length === 0) {
+        } else if (item.shape === 'edge') {
+          if (item.mknode !== 'endEdge' && item.mknode !== 'startEdge' && (!item.mkdata.members || item.mkdata.members.length === 0)) {
             unvalid = true
+          } else if (item.mknode === 'startEdge' || item.mkdata.flowType === 'reject') {
+            if (map.has(item.source.cell)) {
+              unvalid = true
+            } else {
+              map.set(item.source.cell, true)
+            }
+          } else if (item.mkdata.flowType === 'approval' || item.mknode === 'endEdge') {
+            let val = ''
+            if (item.mkdata.execCondition === 'open') {
+              val = item.mkdata.match + item.mkdata.matchVal
+            }
+            if (appMap.has(item.source.cell + val)) {
+              unvalid = true
+            } else {
+              appMap.set(item.source.cell + val, true)
+            }
           }
         }
-
       })
+
       if (start_num !== 1 || end_num !== 1 || unvalid) {
         _status = 0
       }
@@ -1993,15 +2015,49 @@
       let start_num = 0
       let end_num = 0
       let unvalidId = ''
-      
+      let emptyNode = null
+      let emptyEdge = null
+      let map = new Map()
+      let appMap = new Map()
+      let rejectId = ''
+      let approvalId = ''
+
       nodes.cells.forEach(item => {
-        if (item.mknode === 'start') {
+        if (item.shape === 'mk-text' || item.shape === 'lane') return
+
+        if (!item.mkdata) {
+          if (item.shape !== 'edge') {
+            if (!emptyNode) {
+              emptyNode = item
+            }
+          } else {
+            if (!emptyEdge) {
+              emptyEdge = item
+            }
+          }
+        } else if (item.mknode === 'start') {
           start_num++
         } else if (item.mknode === 'end') {
           end_num++
-        } else if (item.shape === 'edge' && item.mknode !== 'endEdge' && item.mknode !== 'startEdge') {
-          if (!item.mkdata.members || item.mkdata.members.length === 0) {
+        } else if (item.shape === 'edge' && !unvalidId && !rejectId && !approvalId) {
+          if (item.mknode !== 'endEdge' && item.mknode !== 'startEdge' && (!item.mkdata.members || item.mkdata.members.length === 0)) {
             unvalidId = item.id
+          } else if (item.mknode === 'startEdge' || item.mkdata.flowType === 'reject') {
+            if (map.has(item.source.cell)) {
+              rejectId = item.source.cell
+            } else {
+              map.set(item.source.cell, true)
+            }
+          } else if (item.mkdata.flowType === 'approval' || item.mknode === 'endEdge') {
+            let val = ''
+            if (item.mkdata.execCondition === 'open') {
+              val = item.mkdata.match + item.mkdata.matchVal
+            }
+            if (appMap.has(item.source.cell + val)) {
+              approvalId = item.source.cell
+            } else {
+              appMap.set(item.source.cell + val, item)
+            }
           }
         }
       })
@@ -2030,21 +2086,97 @@
           message: '缁撴潫鑺傜偣涓嶅彲娣诲姞澶氫釜锛�',
           duration: 2
         })
-      } else if (unvalidId) {
-        let edge = this.mkGraph.getCellById(unvalidId)
+      } else if (emptyNode) {
+        let errmsg = '閮ㄥ垎鑺傜偣鏈缃熀鏈俊鎭��'
+        if (emptyNode.attrs && emptyNode.attrs.text && emptyNode.attrs.text.text) {
+          errmsg = '鑺傜偣銆�' + emptyNode.attrs.text.text + '銆嬫湭璁剧疆鍩烘湰淇℃伅銆�'
+        }
+        notification.warning({
+          top: 92,
+          message: errmsg,
+          duration: 2
+        })
+      } else if (emptyEdge) {
+        let errmsg = '閮ㄥ垎杩炵嚎鏈缃熀鏈俊鎭��'
 
-        let node = edge.getTargetCell()
+        let edge = this.mkGraph.getCellById(emptyEdge.id)
+        let target = edge.getTargetCell()
+
+        let t_label = ''
+        if (target.attrs && target.attrs.text && target.attrs.text.text) {
+          t_label = target.attrs.text.text
+        }
+
+        let source = edge.getSourceCell()
+
+        let s_label = ''
+        if (source.attrs && source.attrs.text && source.attrs.text.text) {
+          s_label = source.attrs.text.text
+        }
+
+        if (t_label && s_label) {
+          errmsg = '鑺傜偣銆�' + s_label + '銆嬩笌鑺傜偣銆�' + t_label + '銆嬮棿杩炵嚎鏈缃熀鏈俊鎭��'
+        }
+
+        notification.warning({
+          top: 92,
+          message: errmsg,
+          duration: 2
+        })
+      } else if (rejectId) {
+        let node = this.mkGraph.getCellById(rejectId)
 
         let title = ''
-        if (node.attrs && node.attrs.text) {
-          title = node.attrs.text.text + ''
+        if (node.attrs && node.attrs.text && node.attrs.text.text) {
+          title = '鑺傜偣銆�' + node.attrs.text.text + '銆�'
         } else if (node.mkdata) {
           title = '鐘舵�侊細' + node.mkdata.status + ' - ' + node.mkdata.statusName
         }
 
         notification.warning({
           top: 92,
-          message: '杩炴帴锛�' + title + '锛夌殑绾挎湭璁剧疆瀹℃壒浜猴紒',
+          message: title + ' 涓嶅彲璁剧疆涓ゆ潯椹冲洖杩炵嚎锛�',
+          duration: 2
+        })
+      } else if (approvalId) {
+        let node = this.mkGraph.getCellById(approvalId)
+
+        let title = ''
+        if (node.attrs && node.attrs.text && node.attrs.text.text) {
+          title = '鑺傜偣銆�' + node.attrs.text.text + '銆�'
+        } else if (node.mkdata) {
+          title = '鐘舵�侊細' + node.mkdata.status + ' - ' + node.mkdata.statusName
+        }
+
+        notification.warning({
+          top: 92,
+          message: title + ' 鍚庣殑瀹℃壒鍒嗘敮鎵ц鏉′欢閲嶅锛�',
+          duration: 2
+        })
+      } else if (unvalidId) {
+        let edge = this.mkGraph.getCellById(unvalidId)
+
+        let node = edge.getTargetCell()
+
+        let title = ''
+        if (node.attrs && node.attrs.text && node.attrs.text.text) {
+          title = node.attrs.text.text
+        } else if (node.mkdata) {
+          title = '鐘舵�侊細' + node.mkdata.status + ' - ' + node.mkdata.statusName
+        }
+
+        let source = edge.getSourceCell()
+
+        let s_label = ''
+        if (source.attrs && source.attrs.text && source.attrs.text.text) {
+          s_label = source.attrs.text.text
+        } else if (source.mkdata) {
+          s_label = '鐘舵�侊細' + source.mkdata.status + ' - ' + source.mkdata.statusName
+        }
+
+        notification.warning({
+          top: 92,
+          message: '鑺傜偣銆�' + s_label + '銆嬩笌銆�' + title + '銆嬮棿杩炵嚎鏈缃鎵逛汉锛�',
           duration: 2
         })
       } else {
diff --git a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx
index bf50398..9ff4eb4 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx
@@ -499,7 +499,7 @@
           visible={visible}
           closable={false}
           maskClosable={false}
-          width={1000}
+          width={1050}
           onOk={this.confirm}
           onCancel={() => this.setState({visible: false})}
           destroyOnClose
diff --git a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss
index 893aaf2..aa7ebb2 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss
@@ -130,6 +130,7 @@
     background-image: none;
     border: 1px solid #d9d9d9;
     border-radius: 4px;
+    vertical-align: middle;
 
     .anticon-form {
       float: right;
diff --git a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/memberform.jsx b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/memberform.jsx
index 65f565d..0d89461 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/memberform.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/memberform.jsx
@@ -175,7 +175,7 @@
 
     return (
       <>
-        <div className="member-input">{value.length}浜�<FormOutlined onClick={this.trigger} /></div>
+        <div className="member-input">{value.length > 0 ? value.length + '浜�' : ''}<FormOutlined onClick={this.trigger} /></div>
         <Modal
           wrapClassName="member-modal"
           title="閫夋嫨浜哄憳"
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 4d6fc81..3de31eb 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx
@@ -14,13 +14,17 @@
   }
 
   state = {
-    flowType: this.props.data.flowType || 'approval'
+    flowType: this.props.data.flowType || 'approval',
+    execCondition: this.props.data.execCondition || 'close',
   }
 
   handleConfirm = () => {
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
+          if (values.matchVal) {
+            values.matchVal = values.matchVal.replace(/\t+|\v+|\s+/g, '')
+          }
           resolve(values)
         } else {
           reject(err)
@@ -32,7 +36,7 @@
   render() {
     const { node, orgs } = this.props
     const { getFieldDecorator } = this.props.form
-    const { flowType } = this.state
+    const { flowType, execCondition } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -155,6 +159,62 @@
               )}
             </Form.Item>
           </Col> : null}
+          {nodetype === 'edge' && flowType !== 'reject' ? <Col span={12}>
+            <Form.Item label="鎵ц鏉′欢">
+              {getFieldDecorator('execCondition', {
+                initialValue: execCondition
+              })(
+                <Radio.Group onChange={(e) => this.setState({execCondition: e.target.value})}>
+                  <Radio value="close">鍏抽棴</Radio>
+                  <Radio value="open">寮�鍚�</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {nodetype === 'edge' && flowType !== 'reject' && execCondition === 'open' ? <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 === 'open' ? <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}
           <Col span={24}>
             <Form.Item label="澶囨敞">
               {getFieldDecorator('remark', {
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx
index 04b1446..20bb8e3 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelout/utils.jsx
@@ -67,14 +67,7 @@
     let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript)
     
     // 姝e垯鏇挎崲
-    let _regoptions = regoptions.map(item => {
-      return {
-        reg: new RegExp('@' + item.key + '@', 'ig'),
-        value: `'0'`
-      }
-    })
-
-    _regoptions.push({
+    regoptions.push({
       reg: new RegExp('@orderBy@', 'ig'),
       value: verify.order
     }, {
@@ -85,7 +78,7 @@
       value: 1
     })
 
-    _regoptions.forEach(item => {
+    regoptions.forEach(item => {
       _dataresource = _dataresource.replace(item.reg, item.value)
       _customScript = _customScript.replace(item.reg, item.value)
       _tailScript = _tailScript.replace(item.reg, item.value)
diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx
index 6ea9c9e..83c366d 100644
--- a/src/templates/zshare/verifycard/baseform/index.jsx
+++ b/src/templates/zshare/verifycard/baseform/index.jsx
@@ -279,7 +279,7 @@
   }
 
   render() {
-    const { unionFields, verify, notes, card, appType } = this.props
+    const { unionFields, verify, notes, card, appType, columns } = this.props
     const { wxTemps, selectTemp } = this.state
     const formItemLayout = {
       labelCol: {
@@ -290,6 +290,17 @@
         xs: { span: 24 },
         sm: { span: 16 }
       }
+    }
+
+    let _columns = []
+    if (window.GLOB.process) {
+      _columns = columns.filter(col => {
+        if (!col.field) return false
+        if (col.field.toLowerCase() === 'id') return false
+        if (col.type === 'text' && col.fieldlength > 100)  return false
+  
+        return true
+      })
     }
 
     return (
@@ -462,6 +473,22 @@
               </Radio.Group>
             </Form.Item>
           </Col> : null}
+          {window.GLOB.process && verify.workFlow === 'true' && verify.flowType === 'approval' ? <Col span={8}>
+            <Form.Item label={
+              <Tooltip placement="bottomLeft" title="濡傛灉瀹℃壒瀛樺湪澶氭潯鍒嗘敮锛屽彲娣诲姞瀹℃壒娴佺▼鐨勬帶鍒跺瓧娈碉紝閫氳繃琛屼俊鎭帶鍒舵祦绋嬭蛋鍚戙�傛敞锛氶渶鍦ㄦ祦绋嬪浘涓畬鍠勫垎鏀殑鎵ц鏉′欢銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                娴佺▼鎺у埗
+              </Tooltip>
+            }>
+              <Select allowClear value={verify.flowBranch} onChange={(val) => {this.onOptionChange(val || '', 'flowBranch')}}>
+                {_columns.map(option =>
+                  <Select.Option key={option.field} value={option.field}>
+                    {option.label}
+                  </Select.Option>
+                )}
+              </Select>
+            </Form.Item>
+          </Col> : null}
           <Col span={24}></Col>
           <Col span={8}>
             <Form.Item label={
diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 3103749..df7c6dc 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -626,7 +626,7 @@
       oriVerify: fromJS(_verify).toJS()
     })
 
-    if (config.Template !== 'FormTab' && card.intertype === 'inner') {
+    if (card.intertype === 'inner') {
       return
     }
 
@@ -637,11 +637,6 @@
           field: card.field,
           label: card.label,
           type: 'text'
-        })
-        resolve(_fields)
-      } else if (config.Template === 'FormTab') {
-        config.groups.forEach(group => {
-          _fields.push(...group.sublist)
         })
         resolve(_fields)
       } else if (card.modal && (card.OpenType === 'pop' || !card.OpenType)) {
@@ -1553,7 +1548,7 @@
   }
 
   render() {
-    const { card } = this.props
+    const { card, columns } = this.props
     const { activeKey, verifyInter, setting, verify, fields, uniqueFields, uniqueColumns, unionFields, onceUniqueColumns, columnsFields, contrastColumns, customColumns, orderColumns, scriptsColumns, cbScriptsColumns, orderModular, orderModularDetail, voucher, voucherDetail, notes, appType } = this.state
     const formItemLayout = {
       labelCol: {
@@ -1576,7 +1571,7 @@
               {verify.default === 'false' ? <span className="count-tip"><ExclamationOutlined style={{color: 'orange'}}/></span> : null}
             </span>
           } key="base">
-            <BaseForm card={card} appType={appType} unionFields={unionFields} setting={setting} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/>
+            <BaseForm card={card} appType={appType} columns={columns} unionFields={unionFields} setting={setting} verify={verify} notes={notes} onChange={(verify) => this.setState({verify})} wrappedComponentRef={(inst) => this.baseForm = inst}/>
           </TabPane> : null}
           {verifyInter === 'system' ? <TabPane tab={
             <span>
@@ -1612,7 +1607,7 @@
               fields={fields}
               btn={this.props.card}
               billcodes={verify.billcodes}
-              columns={this.props.columns}
+              columns={columns}
               modular={orderModular}
               modularDetail={orderModularDetail}
               orderChange={this.orderChange}
@@ -1641,7 +1636,7 @@
           } key="voucher">
             <VoucherForm
               voucher={voucher}
-              columns={this.props.columns}
+              columns={columns}
               voucherobj={verify.voucher}
               voucherDetail={voucherDetail}
               voucherChange={this.voucherChange}
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 59816a5..657a6f3 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -1546,6 +1546,11 @@
     } else if (card.type !== 'balcony' && !card.setting.supModule) {  // 鎮诞妗嗕笂绾х粍浠堕渶鍗曠嫭璁剧疆
       errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'})
     }
+    if (card.subtype === 'dualdatacard' && card.subColumns) {
+      card.subColumns.forEach(col => {
+        columns.push(col.field)
+      })
+    }
   } else if ((card.type === 'balcony' || card.type === 'card') && card.wrap.datatype === 'public') {
     columns = card.columns.map(c => c.field)
   }
@@ -1553,6 +1558,31 @@
   let doubleClick = ''
   if (card.type === 'table') {
     doubleClick = card.wrap.doubleClick || ''
+  }
+
+  let checkBtn = (cell) => {
+    if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
+      if (!cell.modal || cell.modal.fields.length === 0) {
+        errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
+      }
+    } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
+      errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣})
+    } else if (cell.OpenType === 'excelOut') {
+      if (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0) {
+        errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣})
+      } else if (cell.intertype === 'system' && cell.verify.dataType !== 'custom' && card.$c_ds && columns.length > 0) {
+        let cols = []
+        cell.verify.columns.forEach(col => {
+          if (col.output === 'false' || col.Column === '$Index') return
+          if (!columns.includes(col.Column)) {
+            cols.push(col.Column)
+          }
+        })
+        if (cols.length) {
+          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楋紙${cols.join('銆�')}锛夊湪瀛楁闆嗕腑涓嶅瓨鍦紒`})
+        }
+      }
+    }
   }
 
   if (card.$c_ac) {
@@ -1565,15 +1595,7 @@
       //     errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑寮圭獥鏍囩鏈惎鐢╜})
       //   }
       // }
-      if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
-        if (!cell.modal || cell.modal.fields.length === 0) {
-          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
-        }
-      } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
-        errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣})
-      } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) {
-        errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣})
-      }
+      checkBtn(cell)
       if (doubleClick === cell.uuid) {
         doubleClick = ''
       }
@@ -1586,15 +1608,7 @@
       item.elements.forEach(cell => {
         if (cell.eleType === 'button') {
           if (cell.hidden === 'true') return
-          if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
-            if (!cell.modal || cell.modal.fields.length === 0) {
-              errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
-            }
-          } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
-            errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣})
-          } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) {
-            errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣})
-          }
+          checkBtn(cell)
           if (linkbtn && linkbtn === cell.uuid) {
             linkbtn = ''
           }
@@ -1607,15 +1621,7 @@
         item.backElements.forEach(cell => {
           if (cell.eleType === 'button') {
             if (cell.hidden === 'true') return
-            if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
-              if (!cell.modal || cell.modal.fields.length === 0) {
-                errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
-              }
-            } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
-              errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣})
-            } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) {
-              errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣})
-            }
+            checkBtn(cell)
             if (linkbtn && linkbtn === cell.uuid) {
               linkbtn = ''
             }
@@ -1639,15 +1645,7 @@
     card.elements.forEach(cell => {
       if (cell.eleType === 'button') {
         if (cell.hidden === 'true') return
-        if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
-          if (!cell.modal || cell.modal.fields.length === 0) {
-            errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
-          }
-        } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
-          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣})
-        } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) {
-          errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣})
-        }
+        checkBtn(cell)
       } else if (cell.datatype === 'dynamic' && cell.field && !columns.includes(cell.field)) {
         errors.push({ level: 1, detail: `鍗$墖涓姩鎬佸瓧娈碘��${cell.field}鈥濇棤鏁坄})
       }
@@ -1660,15 +1658,8 @@
         col.elements.forEach(cell => {
           if (cell.eleType === 'button') {
             if (cell.hidden === 'true') return
-            if (cell.OpenType === 'pop' || (cell.OpenType === 'funcbutton' && cell.execMode === 'pop')) {
-              if (!cell.modal || cell.modal.fields.length === 0) {
-                errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑琛ㄥ崟灏氭湭娣诲姞`})
-              }
-            } else if (cell.OpenType === 'excelIn' && (!cell.verify || !cell.verify.sheet || !cell.verify.columns || cell.verify.columns.length === 0)) {
-              errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎叆鍒楁湭璁剧疆锛乣})
-            } else if (cell.OpenType === 'excelOut' && (!cell.verify || !cell.verify.columns || cell.verify.columns.length === 0)) {
-              errors.push({ level: 0, detail: `鎸夐挳鈥�${cell.label}鈥濅腑瀵煎嚭鍒楁湭璁剧疆锛乣})
-            }
+
+            checkBtn(cell)
 
             if (doubleClick === cell.uuid) {
               doubleClick = ''
diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js
index 3bac86d..4544fe1 100644
--- a/src/utils/utils-datamanage.js
+++ b/src/utils/utils-datamanage.js
@@ -212,7 +212,14 @@
     }
 
     if (_customScript) {
-      if (LText) {
+      if (DateCount) {
+        DateCount = `${DateCount}
+          ${_tailScript}
+          aaa:
+          if @ErrorCode!=''
+            insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' 
+        `
+      } else if (LText) {
         LText = `${LText}
           ${_tailScript}
           aaa:
@@ -227,6 +234,17 @@
             insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' 
         `
       }
+    } else if (_tailScript && DateCount) {
+      LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
+        Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
+        ${LText}
+      `
+      DateCount = `${DateCount}
+        ${_tailScript}
+        aaa:
+        if @ErrorCode!=''
+          insert into tmp_err_retmsg (ID, ErrorCode, retmsg, CreateUserID) select @time_id@,@ErrorCode, @retmsg,'${sessionStorage.getItem('UserID') || ''}' 
+      `
     } else if (_tailScript) {
       LText = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20),@mk_nation nvarchar(50),@mk_province nvarchar(50),@mk_city nvarchar(50),@mk_district nvarchar(50),@mk_address nvarchar(100)
         Select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @mk_departmentcode='${departmentcode}', @mk_organization='${organization}', @mk_user_type='${mk_user_type}', @mk_nation='${nation}', @mk_province='${province}', @mk_city='${city}', @mk_district='${district}', @mk_address='${address}'
@@ -247,6 +265,7 @@
     if (window.GLOB.debugger === true) {
       _customScript && console.info(`${setting.$name ? `/*${setting.$name} 鑷畾涔夎剼鏈�*/\n` : ''}${LText ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`)
       LText && console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧�*/\n` : ''}` + LText.replace(/\n\s{8}/ig, '\n'))
+      DateCount && console.info(`${setting.$name ? `/*${setting.$name} 鎬绘暟鏌ヨ*/\n` : ''}` + DateCount.replace(/\n\s{8}/ig, '\n'))
     }
 
     if (setting.$name) {
diff --git a/src/utils/utils.js b/src/utils/utils.js
index e874151..a3f7acc 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -2117,6 +2117,7 @@
     let status = 0
     let statusName = ''
     let detailId = ''
+    let error = ''
 
     if (verify.flowType === 'start') {
       target = flow.cells.filter(cell => cell.mknode === 'start')[0]
@@ -2125,17 +2126,112 @@
         detailId = target.id
         status = target.mkdata.status
         statusName = target.mkdata.statusName
+      } else {
+        error = '宸ヤ綔娴佹棤寮�濮嬭妭鐐�'
       }
     } else if (_data.works_flow_param) {
-      node = JSON.parse(window.decodeURIComponent(window.atob(_data.works_flow_param)))
+      try {
+        node = JSON.parse(window.decodeURIComponent(window.atob(_data.works_flow_param)))
+      } catch (e) {
+        node = null
+      }
 
       if (node) {
         let lines = flow.cells.filter(cell => cell.shape === 'edge' && cell.source.cell === node.id)
         if (verify.flowType === 'reject') {
           line = lines.filter(cell => cell.mkdata.flowType === 'reject' || cell.mknode === 'startEdge')[0]
         } else {
-          line = lines.filter(cell => cell.mkdata.flowType !== 'reject' && cell.mknode !== 'startEdge')[0]
+          let endEdge = null
+          lines = lines.filter(cell => {
+            if (cell.mknode === 'endEdge') {
+              endEdge = cell
+              return false
+            }
+
+            return cell.mkdata.flowType !== 'reject' && cell.mknode !== 'startEdge'
+          })
+
+          if (lines.length === 0) {
+            if (!endEdge) {
+              error = '鏃犲彲鎵ц鐨勬祦绋嬪垎鏀�'
+            } else {
+              line = endEdge
+            }
+          } else {
+            let branchKey = verify.flowBranch ? verify.flowBranch.toLowerCase() : ''
+  
+            if (!branchKey) {
+              lines.forEach(line => {
+                if (line.mkdata.execCondition === 'open') {
+                  error = '鎸夐挳鏈缃祦绋嬫帶鍒跺瓧娈点��'
+                }
+              })
+              if (!error) {
+                line = lines[0]
+              }
+            } else if (!_data.hasOwnProperty(branchKey)) {
+              error = '琛屼俊鎭腑鏃犳祦绋嬫帶鍒跺瓧娈点��'
+            } else {
+              if (endEdge) {
+                line = endEdge
+              }
+
+              let equalLine = null
+              let gtOrLtLine = []
+              let unEqualLine = null
+              let branchVal = _data[branchKey]
+
+              if (branchVal && typeof(branchVal) === 'string' && !isNaN(branchVal)) {
+                branchVal = +branchVal
+              }
+
+              lines.forEach(item => {
+                if (item.mkdata.execCondition !== 'open') {
+                  line = item
+                } else {
+                  if (item.mkdata.match === '=') {
+                    if (item.mkdata.matchVal === branchVal + '') {
+                      equalLine = item
+                    }
+                  } else if (item.mkdata.match === '!=') {
+                    if (item.mkdata.matchVal !== branchVal + '') {
+                      unEqualLine = item
+                    }
+                  } else {
+                    if (item.mkdata.match === '<') {
+                      if (item.mkdata.matchVal < branchVal) {
+                        gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)})
+                      }
+                    } else if (item.mkdata.match === '>') {
+                      if (item.mkdata.matchVal > branchVal) {
+                        gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)})
+                      }
+                    } else if (item.mkdata.match === '<=') {
+                      if (item.mkdata.matchVal <= branchVal) {
+                        gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)})
+                      }
+                    } else if (item.mkdata.match === '>=') {
+                      if (item.mkdata.matchVal >= branchVal) {
+                        gtOrLtLine.push({...item, dist: Math.abs(item.mkdata.matchVal - branchVal)})
+                      }
+                    }
+                  }
+                }
+              })
+
+              if (equalLine) {
+                line = equalLine
+              } else if (gtOrLtLine.length > 0) {
+                gtOrLtLine.sort((a, b) => a.dist - b.dist)
+                line = gtOrLtLine[0]
+              } else if (unEqualLine) {
+                line = unEqualLine
+              }
+            }
+          }
         }
+      } else {
+        error = '琛屼俊鎭腑宸ヤ綔娴佸弬鏁版棤娉曡В鏋�'
       }
       
       if (line) {
@@ -2143,7 +2239,11 @@
         status = line.mkdata.status
         statusName = line.mkdata.statusName
         target = flow.cells.filter(cell => cell.id === line.target.cell)[0]
+      } else if (!error) {
+        error = '宸ヤ綔娴佷腑鏃犲搴旀祦绋�'
       }
+    } else {
+      error = '琛屼俊鎭腑鏃犲伐浣滄祦鍙傛暟'
     }
 
     if (verify.flowSql === 'true' && target) {
@@ -2184,20 +2284,12 @@
       `
       }
     } else if (verify.flowSql === 'true') {
-      target = flow.cells.filter(cell => cell.mknode === 'start')[0]
-
-      if (target) {
-        detailId = target.id
-      }
-
       status = 0
       statusName = '寮傚父'
+
       _sql += `
       /* 宸ヤ綔娴佸紓甯竤ql */
-      update s_my_works_flow set status=@status@,statusname=@statusname@,works_flow_param=@works_flow_param@,works_flow_detail_id=@works_flow_detail_id@,modifydate=getdate(),modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname
-      where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
-      insert into s_my_works_flow_log (works_flow_id,works_flow_code,works_flow_name,works_flow_param,status,statusname,works_flow_detail_id,work_group,work_grade,upid)
-      select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@time_id@
+      select @ErrorCode='E',@retmsg='${error || '宸ヤ綔娴佹墽琛屽紓甯�'}' goto aaa
       `
     }
 

--
Gitblit v1.8.0