From fc8c8d714687a22f711d642d192bd4149f3b7e88 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 22 四月 2024 11:15:14 +0800
Subject: [PATCH] 2024-04-22

---
 src/tabviews/zshare/tablenodes/index.jsx                              |    6 
 src/menu/components/module/invoice/index.jsx                          |    4 
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx  |  161 +++++++++----
 src/tabviews/custom/components/module/account/index.jsx               |    3 
 src/tabviews/custom/components/module/invoice/invoiceTable/index.jsx  |   30 +
 src/tabviews/zshare/flowFloat/index.jsx                               |    6 
 src/tabviews/zshare/settingcomponent/index.jsx                        |    8 
 src/templates/zshare/verifycard/customscript/index.jsx                |   20 +
 src/tabviews/zshare/automatic/index.jsx                               |    6 
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss    |   28 ++
 src/tabviews/custom/components/module/invoice/index.scss              |   26 ++
 src/tabviews/custom/components/module/invoice/invoiceTable/index.scss |    2 
 src/tabviews/custom/components/chart/antv-X6/index.jsx                |   29 +
 src/tabviews/custom/components/module/invoice/subTable/index.jsx      |    7 
 src/tabviews/custom/components/module/invoice/index.jsx               |  169 +++++++++----
 src/menu/debug/index.jsx                                              |   10 
 src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx  |   10 
 src/menu/datasource/verifycard/index.jsx                              |    6 
 src/utils/utils.js                                                    |  150 +++++++++++
 src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx     |    2 
 20 files changed, 529 insertions(+), 154 deletions(-)

diff --git a/src/menu/components/module/invoice/index.jsx b/src/menu/components/module/invoice/index.jsx
index 0885bec..344641e 100644
--- a/src/menu/components/module/invoice/index.jsx
+++ b/src/menu/components/module/invoice/index.jsx
@@ -98,7 +98,9 @@
         ['鍗曚环', 'unitprice', 'Decimal(18,10)'],
         ['绋庡姟鍒嗙被缂栫爜', 'tax_classify_code'],
         ['绋庡姟鍒嗙被鍚嶇О', 'tax_classify_name'],
-        ['绋庣巼', 'tax_rate'],
+        // ['绋庣巼', 'tax_rate', 'Decimal(18,2)'],
+        ['涓�鑸撼绋庝汉绋庣巼', 'general_tax_rate', 'Decimal(18,2)'],
+        ['灏忚妯$撼绋庝汉寰佹敹鐜�', 'small_tax_rate', 'Decimal(18,2)'],
       ]
 
       details.forEach((cell, index) => {
diff --git a/src/menu/datasource/verifycard/index.jsx b/src/menu/datasource/verifycard/index.jsx
index d083aa3..b31ecfd 100644
--- a/src/menu/datasource/verifycard/index.jsx
+++ b/src/menu/datasource/verifycard/index.jsx
@@ -989,7 +989,7 @@
     insert into #${setting.tableName || 'tb'}
     (${n.join(',')})
     select ${n.join(',')}
-    from ${setting.dataresource ? `(${setting.dataresource}) tb` : setting.tableName || 'tb'}
+    from ${setting.dataresource ? `(${setting.dataresource.replace(/\n/g, ' ')}) tb` : setting.tableName || 'tb'}
     order by @orderBy@
     
     declare @mk_total int
@@ -1003,7 +1003,9 @@
         delete #${setting.tableName || 'tb'} where sort_id > @pageIndex@*@pageSize@ 
       
       if @pageIndex_top > 0
-        delete #${setting.tableName || 'tb'} where sort_id <= @pageIndex_top`
+        delete #${setting.tableName || 'tb'} where sort_id <= @pageIndex_top
+
+    drop table #${setting.tableName || 'tb'}`
 
     document.body.appendChild(oInput)
     oInput.select()
diff --git a/src/menu/debug/index.jsx b/src/menu/debug/index.jsx
index 7d77de4..243c492 100644
--- a/src/menu/debug/index.jsx
+++ b/src/menu/debug/index.jsx
@@ -1294,13 +1294,16 @@
         } else {
           _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
+            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(),upid=@time_id@,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@
+            
+            update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
+            where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
+
             if @check_userids@ != ''
             begin
-                  delete s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
                   insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid)
                   select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@)
                   insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
@@ -1308,7 +1311,8 @@
             end
             if @notice_userids@ != ''
             begin
-                  delete n
+                  update n
+                  set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
                   from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n
                   inner join (select ID from dbo.SplitComma(@notice_userids@)) s
                   on n.userid = s.id
diff --git a/src/tabviews/custom/components/chart/antv-X6/index.jsx b/src/tabviews/custom/components/chart/antv-X6/index.jsx
index 4e155ba..03c7b22 100644
--- a/src/tabviews/custom/components/chart/antv-X6/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/index.jsx
@@ -388,7 +388,8 @@
     status: 0,
     flowname: '',
     flowcode: '',
-    orgs: []
+    orgs: [],
+    empty: true
   }
 
   selectNode = null
@@ -526,6 +527,7 @@
                     worker_id: work.worker_id || '',
                     workercode: work.workercode || '',
                     workername: work.workername || '',
+                    job_type: job.job_type || '',
                     parentIds: [com.OrgCode, dep.co_pro_code, job.jobcode],
                     parentNames: [com.OrgName, dep.co_pro_name, job.jobname]
                   }
@@ -553,6 +555,7 @@
                     worker_id: work.worker_id || '',
                     workercode: work.workercode || '',
                     workername: work.workername || '',
+                    job_type: job.job_type || '',
                     parentIds: [com.OrgCode, dep.co_pro_code, job.jobcode, group.work_group],
                     parentNames: [com.OrgName, dep.co_pro_name, job.jobname, group.work_group]
                   }
@@ -590,8 +593,8 @@
     const { BID } = this.state
 
     if (!BID) {
+      this.cells = []
       if (!is(fromJS(this.data), fromJS([]))) {
-        this.cells = []
         this.handleData()
       }
       this.setState({empty: true})
@@ -624,7 +627,8 @@
         status: item.status || 0,
         flowname: item.works_flow_name || '',
         flowcode: item.works_flow_code || '',
-        loading: false
+        loading: false,
+        empty: cells.length === 0
       })
 
       if (result.message) {
@@ -1003,8 +1007,19 @@
       if (!isNew) return
 
       let target = edge.getTargetCell()
+      let source = edge.getSourceCell()
 
-      if (!target) return
+      if (!target || !source) return
+
+      if (source.prop('mknode') === 'end') {
+        notification.warning({
+          top: 92,
+          message: '缁撴潫鑺傜偣涓嶅彲娣诲姞鍒嗘敮锛�',
+          duration: 2
+        })
+        graph.removeCells([edge])
+        return
+      }
 
       let mkdata = target.prop('mkdata')
 
@@ -1012,6 +1027,8 @@
         edge.prop('mknode', 'endEdge')
       } else if (target.prop('mknode') === 'start') {
         edge.prop('mknode', 'startEdge')
+      } else if (source.prop('mknode') === 'start') {
+        edge.prop('mknode', 'firstEdge')
       }
       if (mkdata) {
         edge.prop('mkdata', {status: mkdata.status, statusName: mkdata.statusName})
@@ -2224,12 +2241,12 @@
   }
 
   render() {
-    const { loading, config, node, orgs, status, flowname } = this.state
+    const { loading, config, node, orgs, status, flowname, empty } = this.state
 
     let style = {...config.style}
 
     if (config.plot.function === 'show') {
-      if (config.plot.empty === 'hidden' && this.cells.length === 0) {
+      if (config.plot.empty === 'hidden' && empty) {
         style.position = 'absolute'
         style.width = '100%'
         style.zIndex = -1
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 9ff4eb4..e125341 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.jsx
@@ -496,10 +496,12 @@
         </Form>
         <Modal
           title={mknode && mknode.shape === 'edge' ? '杩炵嚎缂栬緫' : '鑺傜偣缂栬緫'}
+          wrapClassName="mk-x6-modal"
           visible={visible}
           closable={false}
           maskClosable={false}
           width={1050}
+          centered={true}
           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 a161a64..f8b1118 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/index.scss
@@ -110,6 +110,7 @@
 }
 
 .normal-node-form {
+  padding: 0 24px;
   >.ant-row >.ant-col-24 {
     .ant-form-item-label {
       width: 16%;
@@ -117,6 +118,12 @@
     .ant-form-item-control-wrapper {
       width: 84%;
     }
+  }
+  .mk-split {
+    color: var(--mk-sys-color);
+    border-bottom: 1px solid #e8e8e8;
+    padding-left: 15px;
+    padding-bottom: 5px;
   }
   .member-input {
     display: inline-block;
@@ -179,7 +186,26 @@
     }
   }
 }
-
+.mk-x6-modal {
+  .ant-modal-body {
+    max-height: calc(100vh - 170px);
+    overflow-y: auto;
+  }
+  .ant-modal-body::-webkit-scrollbar {
+    width: 7px;
+  }
+  .ant-modal-body::-webkit-scrollbar-thumb {
+    border-radius: 5px;
+    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.13);
+    background: rgba(0, 0, 0, 0.13);
+  }
+  .ant-modal-body::-webkit-scrollbar-track {
+    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.05);
+    border-radius: 3px;
+    border: 1px solid rgba(0, 0, 0, 0.07);
+    background: rgba(0, 0, 0, 0);
+  }
+}
 .member-modal {
   .ant-modal {
     top: 50px;
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 cec9966..7980951 100644
--- a/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx
+++ b/src/tabviews/custom/components/chart/antv-X6/nodeupdate/nodeform.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Radio, Tooltip, InputNumber, Switch } from 'antd'
+import { Form, Row, Col, Input, Radio, Tooltip, InputNumber, Switch, notification } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import MemberForm from './memberform'
@@ -15,14 +15,57 @@
   }
 
   state = {
-    flowType: this.props.data.flowType || 'approval',
-    execCondition: this.props.data.execCondition === 'open',
+    flowType: 'approval',
+    execCondition: false,
+    approvalMethod: 'orsign',
+    readOnly: false,
+    options: []
+  }
+
+  UNSAFE_componentWillMount() {
+    const { node, data } = this.props
+
+    let options = []
+    let readOnly = false
+
+    if (node.mknode === 'start') {
+      readOnly = true
+    } else if (node.mknode === 'end') {
+
+    } else if (node.mknode === 'endEdge') {
+      options = ['approvalMethod']
+    } else if (node.mknode === 'startEdge') {
+      readOnly = true
+    } else if (node.mknode === 'firstEdge') {
+      options = ['approver', 'members', 'copys']
+    } else if (node.shape !== 'edge') { // node
+      options = ['sign']
+    } else {
+      options = ['flowType', 'approvalMethod', 'approver', 'members', 'copys', 'execCondition']
+    }
+
+    this.setState({
+      flowType: data.flowType || 'approval',
+      execCondition: options.includes('execCondition') && data.execCondition === 'open',
+      approvalMethod: data.approvalMethod || 'orsign',
+      options,
+      readOnly
+    })
   }
 
   handleConfirm = () => {
     return new Promise((resolve, reject) => {
       this.props.form.validateFieldsAndScroll((err, values) => {
         if (!err) {
+          if (values.approvalMethod === 'countersign' && values.members.length > 5) {
+            notification.warning({
+              top: 92,
+              message: '浼氱鏃跺鎵逛汉涓嶅彲瓒呰繃5浜猴紒',
+              duration: 10
+            })
+            return
+          }
+
           if (values.execCondition === true) {
             values.execCondition = 'open'
           } else if (values.execCondition === false) {
@@ -41,9 +84,9 @@
   }
 
   render() {
-    const { node, orgs } = this.props
+    const { orgs } = this.props
     const { getFieldDecorator } = this.props.form
-    const { flowType, execCondition } = this.state
+    const { flowType, execCondition, approvalMethod, readOnly, options } = this.state
     const formItemLayout = {
       labelCol: {
         xs: { span: 24 },
@@ -55,32 +98,22 @@
       }
     }
     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">
         <Row gutter={24}>
+          {options.includes('approver') ? <Col span={24}>
+            <p className="mk-split">鎸夐挳鎵ц鍛戒护</p>
+          </Col> : null}
           <Col span={12}>
             <Form.Item label="鐘舵�佸��">
               {getFieldDecorator('status', {
                 initialValue: data.status,
                 rules: [
-                  {
-                    required: true,
-                    message: '璇疯緭鍏ョ姸鎬佸��!'
-                  }
+                  { required: true, message: '璇疯緭鍏ョ姸鎬佸��!' }
                 ]
               })(
-                <InputNumber readOnly={nodetype === 'start' || nodetype === 'startEdge'} precision={0} onPressEnter={() => this.props.handleSubmit()}/>
+                <InputNumber readOnly={readOnly} precision={0} onPressEnter={() => this.props.handleSubmit()}/>
               )}
             </Form.Item>
           </Col>
@@ -93,7 +126,7 @@
               )}
             </Form.Item>
           </Col>
-          {nodetype === 'node' ? <Col span={12}>
+          {options.includes('sign') ? <Col span={12}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="鏍囪灏嗕綔涓鸿妭鐐笽D">
                 <QuestionCircleOutlined className="mk-form-tip" />
@@ -107,7 +140,7 @@
               )}
             </Form.Item>
           </Col> : null}
-          {nodetype === 'edge' ? <Col span={12}>
+          {options.includes('flowType') ? <Col span={12}>
             <Form.Item label="鎿嶄綔绫诲瀷">
               {getFieldDecorator('flowType', {
                 initialValue: flowType
@@ -119,7 +152,48 @@
               )}
             </Form.Item>
           </Col> : null}
-          {nodetype === 'edge' ? <Col span={12}>
+          {options.includes('approvalMethod') && flowType !== 'reject' ? <Col span={12}>
+            <Form.Item label="瀹℃壒鏂瑰紡">
+              {getFieldDecorator('approvalMethod', {
+                initialValue: approvalMethod
+              })(
+                <Radio.Group onChange={(e) => this.setState({approvalMethod: e.target.value})}>
+                  <Radio value="orsign">鎴栫</Radio>
+                  <Radio value="countersign">浼氱</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
+          {options.includes('approvalMethod') && flowType !== 'reject' && approvalMethod === 'countersign' ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="绀轰緥锛氣�滆储鍔$粡鐞嗗紶鎬诲凡瀹℃牳鈥濓紝鍏朵腑鈥滃凡瀹℃牳鈥濅负浼氱鏍囪銆�">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                浼氱鏍囪
+              </Tooltip>
+            }>
+              {getFieldDecorator('mark', {
+                initialValue: data.mark || '宸插鏍�',
+                rules: [
+                  { required: true, message: '璇疯緭鍏ヤ細绛炬爣璁�!' }
+                ]
+              })(
+                <Input autoComplete="off" onPressEnter={() => this.props.handleSubmit()}/>
+              )}
+            </Form.Item>
+          </Col> : null}
+          <Col span={24}>
+            <Form.Item label="澶囨敞">
+              {getFieldDecorator('remark', {
+                initialValue: data.remark || ''
+              })(
+                <TextArea rows={2}/>
+              )}
+            </Form.Item>
+          </Col>
+          {options.includes('approver') ? <Col span={24}>
+            <p className="mk-split">涓嬩竴姝ュ鎵规潈闄�</p>
+          </Col> : null}
+          {options.includes('approver') ? <Col span={12}>
             <Form.Item label="璁剧疆瀹℃壒浜�">
               {getFieldDecorator('approver', {
                 initialValue: data.approver || 'member'
@@ -132,32 +206,19 @@
               )}
             </Form.Item>
           </Col> : null}
-          {nodetype === 'edge' && flowType !== 'reject' ? <Col span={12}>
-            <Form.Item label="瀹℃壒鏂瑰紡">
-              {getFieldDecorator('approvalMethod', {
-                initialValue: data.approvalMethod || 'orsign'
-              })(
-                <Radio.Group>
-                  <Radio value="countersign">浼氱</Radio>
-                  <Radio value="orsign">鎴栫</Radio>
-                </Radio.Group>
-              )}
-            </Form.Item>
-          </Col> : null}
-          {nodetype === 'edge' ? <Col span={12}>
+          {options.includes('members') ? <Col span={12}>
             <Form.Item label="瀹℃壒浜�">
               {getFieldDecorator('members', {
                 initialValue: data.members || [],
-                rules: [{
-                  required: true,
-                  message: '璇锋坊鍔犲鎵逛汉!'
-                }]
+                rules: [
+                  { required: true, message: '璇锋坊鍔犲鎵逛汉!' }
+                ]
               })(
                 <MemberForm orgs={orgs} title="瀹℃壒浜�"/>
               )}
             </Form.Item>
           </Col> : null}
-          {nodetype === 'edge' ? <Col span={12}>
+          {options.includes('copys') ? <Col span={12}>
             <Form.Item label="鎶勯�佷汉">
               {getFieldDecorator('copys', {
                 initialValue: data.copys || []
@@ -166,7 +227,10 @@
               )}
             </Form.Item>
           </Col> : null}
-          {nodetype === 'edge' && flowType !== 'reject' ? <Col span={12}>
+          {options.includes('execCondition') && flowType !== 'reject' ? <Col span={24}>
+            <p className="mk-split">鍒嗘敮鎵ц鏉′欢</p>
+          </Col> : null}
+          {options.includes('execCondition') && flowType !== 'reject' ? <Col span={12}>
             <Form.Item label="鎵ц鏉′欢">
               {getFieldDecorator('execCondition', {
                 valuePropName: 'checked',
@@ -176,7 +240,7 @@
               )}
             </Form.Item>
           </Col> : null}
-          {nodetype === 'edge' && flowType !== 'reject' && execCondition ? <Col span={12}>
+          {flowType !== 'reject' && execCondition ? <Col span={12}>
             <Form.Item label="瀵规瘮鏂瑰紡">
               {getFieldDecorator('match', {
                 initialValue: data.match || '='
@@ -192,7 +256,7 @@
               )}
             </Form.Item>
           </Col> : null}
-          {nodetype === 'edge' && flowType !== 'reject' && execCondition ? <Col span={12}>
+          {flowType !== 'reject' && execCondition ? <Col span={12}>
             <Form.Item label={
               <Tooltip placement="topLeft" title="瀵规瘮鍊间腑涓嶅彲鍖呭惈鍒惰〃绗︺�佺┖鏍笺�佹崲琛岀绛夈��">
                 <QuestionCircleOutlined className="mk-form-tip" />
@@ -206,15 +270,6 @@
               )}
             </Form.Item>
           </Col> : null}
-          <Col span={24}>
-            <Form.Item label="澶囨敞">
-              {getFieldDecorator('remark', {
-                initialValue: data.remark || ''
-              })(
-                <TextArea rows={2}/>
-              )}
-            </Form.Item>
-          </Col>
         </Row>
       </Form>
     )
diff --git a/src/tabviews/custom/components/module/account/index.jsx b/src/tabviews/custom/components/module/account/index.jsx
index 234db66..eec9ca5 100644
--- a/src/tabviews/custom/components/module/account/index.jsx
+++ b/src/tabviews/custom/components/module/account/index.jsx
@@ -81,6 +81,9 @@
         map.set(item.id, true)
 
         if (item.selected === 'true' && !activeItem) {
+          if (res.invoice_type) {
+            item.invoice_type = res.invoice_type.map(cell => ({value: cell.invoice_type_code, label: cell.invoice_type_name}))
+          }
           activeItem = item
         }
         if (item.months) {
diff --git a/src/tabviews/custom/components/module/invoice/index.jsx b/src/tabviews/custom/components/module/invoice/index.jsx
index 6307d89..7be4d48 100644
--- a/src/tabviews/custom/components/module/invoice/index.jsx
+++ b/src/tabviews/custom/components/module/invoice/index.jsx
@@ -1,11 +1,12 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Select, Form, Input, Button, Modal } from 'antd'
+import { Select, Form, Input, Button, Modal, Spin } from 'antd'
 import { EllipsisOutlined } from '@ant-design/icons'
 import moment from 'moment'
 
-// import Api from '@/api'
+import Api from '@/api'
+import UtilsDM from '@/utils/utils-datamanage.js'
 // import Utils from '@/utils/utils.js'
 import MKEmitter from '@/utils/events.js'
 import InvoiceTable from './invoiceTable'
@@ -48,7 +49,10 @@
     payee: '',
     reviewer: '',
     drawer: '',
-    details: []
+    details: [],
+    book: null,
+    loading: false,
+    tax_type: ''
   }
 
   UNSAFE_componentWillMount () {
@@ -74,15 +78,35 @@
     _config.buyer = this.formatSetting(_config.buyer, 'buyer')
     _config.detail = this.formatSetting(_config.detail, 'detail')
 
+    let book = null
+    let pas = {}
+    if (config.wrap.supBook) {
+      book = window.GLOB.CacheData.get(config.wrap.supBook) || null
+
+      if (book) {
+        pas = this.resetParam(book)
+      }
+    }
+
     this.setState({
       BID: BID || '',
-      config: _config
+      config: _config,
+      book,
+      ...pas
     })
   }
 
   componentDidMount () {
-    this.loadData()
+    const { config } = this.props
+
     MKEmitter.addListener('reloadData', this.reloadData)
+    MKEmitter.addListener('resetSelectLine', this.resetParentParam)
+
+    if (config.wrap.datatype === 'dynamic' && config.setting.onload === 'true') {
+      setTimeout(() => {
+        this.loadData()
+      }, config.setting.delay || 0)
+    }
   }
 
   shouldComponentUpdate (nextProps, nextState) {
@@ -97,6 +121,7 @@
       return
     }
     MKEmitter.removeListener('reloadData', this.reloadData)
+    MKEmitter.removeListener('resetSelectLine', this.resetParentParam)
   }
 
   formatSetting = (item, type) => {
@@ -114,13 +139,18 @@
       })
     } else {
       item.columns = item.columns.map(cell => {
-        if (['Description', 'id'].includes(cell.field)) {
+        if (cell.field === 'general_tax_rate') {
+          cell.field = 'tax_rate'
+          cell.label = '绋庣巼'
+        }
+        if (['Description', 'id', 'small_tax_rate'].includes(cell.field)) {
           cell.Hide = 'true'
         } else if (['spec'].includes(cell.field)) {
           cell.Width = 150
         } else if (['unit', 'unitprice', 'tax_rate'].includes(cell.field)) {
           cell.Width = 80
         }
+
         return cell
       })
     }
@@ -191,59 +221,77 @@
     return item
   }
 
-  reloadData = (menuId) => {
-    // const { config } = this.props
-    // const { activeItem } = this.state
-    
-    // if (config.uuid !== menuId) return
+  resetParentParam = (MenuID, id, data) => {
+    const { config } = this.state
 
-    // if (activeItem) {
-    //   MKEmitter.emit('resetSelectLine', config.uuid, activeItem.id, activeItem)
-    // } else {
-    //   this.loadData()
-    // }
+    if (config.wrap.supBook === MenuID) {
+      let pas = this.resetParam(data)
+
+      this.setState({ book: data, ...pas }, () => {
+        this.loadData()
+      })
+      return
+    }
+
+    if (!config.wrap.supModule || config.wrap.supModule !== MenuID) return
+    if (id !== this.state.BID || id !== '') {
+      this.setState({ BID: id }, () => {
+        this.loadData()
+      })
+    }
   }
 
-  loadData = () => {
-    // let param = {
-    //   func: 's_get_fcc_book_data',
-    //   dataM: sessionStorage.getItem('dataM') === 'true' ? 'Y' : '',
-    //   mk_organization: sessionStorage.getItem('organization') || ''
-    // }
+  resetParam = (book) => {
+    return {
+      invTypes: book.invoice_type || [],
+      orgname: book.orgname || '',
+      tax_no: book.tax_no || '',
+      addr: book.addr || '',
+      tel: book.tel || '',
+      bank_name: book.bank_name || '',
+      account_no: book.account_no || '',
+      payee: book.payee || '',
+      reviewer: book.reviewer || '',
+      drawer: book.drawer || '',
+      tax_type: book.tax_type || ''
+    }
+  }
 
-    // Api.genericInterface(param).then(res => {
-    //   if (!res.status) {
-    //     notification.warning({
-    //       top: 92,
-    //       message: res.message,
-    //       duration: 5
-    //     })
-    //     return
-    //   }
+  reloadData = (menuId) => {
+    const { config } = this.state
+    
+    if (config.uuid !== menuId) return
 
-    //   let books = res.book || []
-    //   let activeItem = null
-    //   let map = new Map()
-    //   books = books.filter(item => {
-    //     if (!item.id) return false
-    //     if (map.has(item.id)) return false
-    //     map.set(item.id, true)
+    this.loadData()
+  }
 
-    //     if (item.selected === 'true' && !activeItem) {
-    //       activeItem = item
-    //     }
-    //     if (item.months) {
-    //       item.date = item.months.replace('-', '骞�') + '鏈�'
-    //     }
-    //     return true
-    //   })
+  async loadData() {
+    const { config, BID } = this.state
 
-    //   this.setState({books, activeItem})
+    if (config.wrap.datatype !== 'dynamic') return
 
-    //   if (activeItem) {
-    //     MKEmitter.emit('resetSelectLine', this.props.config.uuid, activeItem.id, activeItem)
-    //   }
-    // })
+    let param = UtilsDM.getQueryDataParams(config.setting, [], config.setting.order, 1, 1, BID)
+
+    this.setState({
+      loading: true
+    })
+
+    let result = await Api.genericInterface(param)
+    if (result.status) {
+
+      this.setState({
+        loading: false
+      })
+
+      UtilsDM.querySuccess(result)
+    } else {
+      this.setState({
+        loading: false
+      })
+      this.timer && this.timer.stop()
+
+      UtilsDM.queryFail(result)
+    }
   }
 
   changeType = (val) => {
@@ -266,10 +314,25 @@
   }
 
   render() {
-    const { config, invTypes, date, from_to_name, from_to_tax_no, from_to_addr, from_to_tel, from_to_bank_name, from_to_account_no, from_to_mob, from_to_email, orgname, tax_no, addr, tel, bank_name, account_no, remark, reviewer, drawer, payee, details, visible } = this.state
+    const { config, book, loading, invTypes, date, from_to_name, from_to_tax_no, from_to_addr, from_to_tel, from_to_bank_name, from_to_account_no, from_to_mob, from_to_email, orgname, tax_no, addr, tel, bank_name, account_no, remark, reviewer, drawer, payee, details, visible, tax_type } = this.state
+
+    if (!book || (config.wrap.datatype === 'dynamic' && !tax_no)) {
+      return <div className="menu-invoice-wrap" style={config.style}>
+        <div className="loading-mask">
+          <div className="ant-spin-blur"></div>
+          <Spin />
+        </div>
+      </div>
+    }
 
     return (
       <div className="menu-invoice-wrap" style={config.style}>
+        {loading ?
+          <div className="loading-mask">
+            <div className="ant-spin-blur"></div>
+            <Spin />
+          </div> : null
+        }
         <div className="inv-action">
           <Button className="mk-bill">淇濆瓨鍗曟嵁</Button>
           <Button className="mk-submit">鎻愪氦寮�绁�</Button>
@@ -316,7 +379,7 @@
             </div>
           </div>
           <div className="inv-details">
-            <InvoiceTable data={details} config={config.detail} onChange={(details) => this.setState({details})}/>
+            <InvoiceTable data={details} config={config.detail} tax_type={tax_type} onChange={(details) => this.setState({details})}/>
           </div>
           <div className="inv-main-content">
             <div className="inv-buyer">
diff --git a/src/tabviews/custom/components/module/invoice/index.scss b/src/tabviews/custom/components/module/invoice/index.scss
index 49e58ea..3774eff 100644
--- a/src/tabviews/custom/components/module/invoice/index.scss
+++ b/src/tabviews/custom/components/module/invoice/index.scss
@@ -6,6 +6,7 @@
   background-repeat: no-repeat;
   background-size: cover;
   color: #000000;
+  min-height: 500px;
   --inv-color: #13509c;
 
   .inv-action {
@@ -50,6 +51,9 @@
         .ant-select-selection__placeholder {
           text-align: center;
           font-family: kaiti;
+          height: 30px;
+          line-height: 30px;
+          margin-top: -12px;
         }
       }
     }
@@ -91,6 +95,7 @@
   }
   .ant-input.ant-input-disabled {
     cursor: text;
+    color: rgba(0, 0, 0, 0.85);
     background: transparent!important;
   }
 
@@ -219,6 +224,27 @@
       }
     }
   }
+
+  .loading-mask {
+    position: absolute;
+    left: 0px;
+    top: 0;
+    right: 0px;
+    bottom: 0px;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+    text-align: justify;
+    z-index: 1;
+
+    .ant-spin-blur {
+      position: absolute;
+      width: 100%;
+      height: 100%;
+      opacity: 0.5;
+      background: #ffffff;
+    }
+  }
 }
 .inv-table {
   .ant-table .ant-table-tbody tr:hover td {
diff --git a/src/tabviews/custom/components/module/invoice/invoiceTable/index.jsx b/src/tabviews/custom/components/module/invoice/invoiceTable/index.jsx
index 791d755..9d2efd2 100644
--- a/src/tabviews/custom/components/module/invoice/invoiceTable/index.jsx
+++ b/src/tabviews/custom/components/module/invoice/invoiceTable/index.jsx
@@ -52,6 +52,13 @@
           }
         }
       }
+
+      if (line.amount_line) {
+        line.tax_amount = line.amount_line - line.amount_line / (line.tax_rate + 1)
+        line.tax_amount = Math.round(line.tax_amount * 100) / 100
+      } else {
+        line.tax_amount = 0
+      }
     } else {
       line[key] = value
     }
@@ -88,8 +95,8 @@
       <div className="mk-td">
         <InputNumber value={amount_line} onChange={(val) => this.setState({amount_line: val})} onBlur={(e) => this.onChange(e.target.value, 'amount_line')}/>
       </div>
-      <div className="mk-td">{line.tax_name}</div>
-      <div className="mk-td mk-right">{line.tax_amount} <span className="del-line" onClick={() => delLine(line.uuid)}></span> </div>
+      <div className="mk-td mk-right">{line.tax_name}</div>
+      <div className="mk-td mk-right">{line.tax_amount.toFixed(2)} <span className="del-line" onClick={() => delLine(line.uuid)}></span> </div>
     </div>
   }
 }
@@ -230,7 +237,7 @@
       tax += item.tax_amount
     })
 
-    this.setState({total: {price, tax, sum: price + tax, sumName: this.changeMoneyToChinese(price + tax)}})
+    this.setState({total: {price, tax, sum: price, sumName: this.changeMoneyToChinese(price)}})
   }
 
   resetDetails = (data) => {
@@ -304,8 +311,8 @@
         item.spec = prod.spec
         item.unit = prod.unit
         item.unitprice = prod.unitprice
-        item.tax_rate = prod.tax_rate
-        item.tax_name = prod.tax_rate
+        item.tax_rate = prod.tax_rate || 0
+        item.tax_name = prod.tax_rate * 100 + '%'
 
         item.productcode = prod.productcode
         item.Description = prod.Description
@@ -315,7 +322,12 @@
         if (item.bill_count && item.unitprice) {
           item.amount_line = Math.round(item.unitprice * item.bill_count * 100) / 100
         }
-        // item.tax_amount = prod.productname
+        if (item.amount_line) {
+          item.tax_amount = item.amount_line - item.amount_line / (item.tax_rate + 1)
+          item.tax_amount = Math.round(item.tax_amount * 100) / 100
+        } else {
+          item.tax_amount = 0
+        }
       }
 
       return item
@@ -329,7 +341,7 @@
   }
 
   render() {
-    const { config } = this.props
+    const { config, tax_type } = this.props
     const { editKey, data, total, visible } = this.state
 
     return (
@@ -358,7 +370,7 @@
             <div className="mk-td mk-right">{item.unitprice || ''}</div>
             <div className="mk-td mk-right">{item.amount_line || ''}</div>
             <div className="mk-td mk-right">{item.tax_name}</div>
-            <div className="mk-td mk-right">{item.tax_amount}</div>
+            <div className="mk-td mk-right">{item.tax_amount.toFixed(2)}</div>
           </div>
         })}
         <div className="mk-total">
@@ -384,7 +396,7 @@
           onCancel={() => { this.setState({ visible: false }) }}
           footer={null}
         >
-          <SubTable config={config} onChange={this.changeDetail}/>
+          <SubTable config={config} tax_type={tax_type} onChange={this.changeDetail}/>
         </Modal>
       </div>
     )
diff --git a/src/tabviews/custom/components/module/invoice/invoiceTable/index.scss b/src/tabviews/custom/components/module/invoice/invoiceTable/index.scss
index fe39f35..d0a87e3 100644
--- a/src/tabviews/custom/components/module/invoice/invoiceTable/index.scss
+++ b/src/tabviews/custom/components/module/invoice/invoiceTable/index.scss
@@ -59,7 +59,7 @@
       display: flex;
       justify-content: center;
       align-items: center;
-      padding: 0 3px;
+      padding: 0 5px;
     }
     .mk-td:not(:last-child) {
       border-right: var(--inv-color, #13509c) 1px solid;
diff --git a/src/tabviews/custom/components/module/invoice/subTable/index.jsx b/src/tabviews/custom/components/module/invoice/subTable/index.jsx
index 04ab0e9..953fbe3 100644
--- a/src/tabviews/custom/components/module/invoice/subTable/index.jsx
+++ b/src/tabviews/custom/components/module/invoice/subTable/index.jsx
@@ -138,7 +138,7 @@
    * @description 鏁版嵁鍔犺浇
    */
   async loadData () {
-    const { config } = this.props
+    const { config, tax_type } = this.props
     const { search, pageIndex, pageSize } = this.state
 
     this.setState({
@@ -167,6 +167,11 @@
         item.key = index
         item.$Index = start + index + ''
 
+        if (tax_type) {
+          item.tax_rate = tax_type === 'special_invoice' ? item.general_tax_rate : item.small_tax_rate
+          item.tax_rate = isNaN(item.tax_rate) ? 0 : +item.tax_rate
+        }
+
         return item
       })
 
diff --git a/src/tabviews/zshare/automatic/index.jsx b/src/tabviews/zshare/automatic/index.jsx
index 8d3f243..d165c28 100644
--- a/src/tabviews/zshare/automatic/index.jsx
+++ b/src/tabviews/zshare/automatic/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Button, message } from 'antd'
+import { Button, message, Tooltip } from 'antd'
 
 import MKEmitter from '@/utils/events.js'
 // import './index.scss'
@@ -224,7 +224,9 @@
 
     return (
       <div className="tool-wrap">
-        <Button icon={running ? 'pause' : 'forward'} shape="circle" onClick={this.trigger}/>
+        <Tooltip placement="left" title="鏃犱汉鍊煎畧">
+          <Button icon={running ? 'pause' : 'forward'} shape="circle" onClick={this.trigger}/>
+        </Tooltip>
       </div>
     )
   }
diff --git a/src/tabviews/zshare/flowFloat/index.jsx b/src/tabviews/zshare/flowFloat/index.jsx
index 5aab582..631b307 100644
--- a/src/tabviews/zshare/flowFloat/index.jsx
+++ b/src/tabviews/zshare/flowFloat/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Button, Modal, notification, Spin, Empty } from 'antd'
+import { Button, Modal, notification, Spin, Empty, Tooltip } from 'antd'
 import { BranchesOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
@@ -191,7 +191,9 @@
 
     return (
       <div className="tool-wrap">
-        <Button shape="circle" onClick={this.trigger}><BranchesOutlined /></Button>
+        <Tooltip placement="left" title="宸ヤ綔娴�">
+          <Button shape="circle" onClick={this.trigger}><BranchesOutlined /></Button>
+        </Tooltip>
         <Modal
           wrapClassName="flow-setting-modal"
           title="宸ヤ綔娴�"
diff --git a/src/tabviews/zshare/settingcomponent/index.jsx b/src/tabviews/zshare/settingcomponent/index.jsx
index f2488e9..77e2230 100644
--- a/src/tabviews/zshare/settingcomponent/index.jsx
+++ b/src/tabviews/zshare/settingcomponent/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Button, Modal, notification, Spin, Empty } from 'antd'
+import { Button, Modal, notification, Spin, Empty, Tooltip } from 'antd'
 
 import Api from '@/api'
 import MKEmitter from '@/utils/events.js'
@@ -522,10 +522,12 @@
 
     return (
       <div className="tool-wrap">
-        <Button icon="setting" shape="circle" onClick={this.trigger}/>
+        <Tooltip placement="left" title="鑷畾涔夎缃�">
+          <Button icon="setting" shape="circle" onClick={this.trigger}/>
+        </Tooltip>
         <Modal
           wrapClassName="custom-setting-modal"
-          title={'鑷畾涔夎缃�'}
+          title="鑷畾涔夎缃�"
           maskClosable={false}
           width={950}
           visible={visible}
diff --git a/src/tabviews/zshare/tablenodes/index.jsx b/src/tabviews/zshare/tablenodes/index.jsx
index 49f6f32..4a258bc 100644
--- a/src/tabviews/zshare/tablenodes/index.jsx
+++ b/src/tabviews/zshare/tablenodes/index.jsx
@@ -1,7 +1,7 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import { Modal, Button, notification, Spin, Input, Typography, message } from 'antd'
+import { Modal, Button, notification, Spin, Input, Typography, message, Tooltip } from 'antd'
 
 import Api from '@/api'
 import G6 from "@antv/g6"
@@ -477,7 +477,9 @@
 
     return (
       <div className="tool-wrap">
-        <Button icon="fork" shape="circle" onClick={this.trigger}/>
+        <Tooltip placement="left" title="琛ㄥ叧绯诲浘">
+          <Button icon="fork" shape="circle" onClick={this.trigger}/>
+        </Tooltip>
         <Modal
           title=""
           wrapClassName="view-table-modal"
diff --git a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
index 7b86cb8..c58226f 100644
--- a/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
+++ b/src/templates/sharecomponent/actioncomponent/verifyexcelin/index.jsx
@@ -716,9 +716,17 @@
         if (!err) {
           let _verify = {...verify, ...values}
 
-          if (_verify.excelHandle !== 'true') {
+          if (_verify.excelHandle !== 'true') { 
             delete _verify.excel_func
           }
+          if (_verify.default === 'false' && _verify.scripts.length === 0) {
+            notification.warning({
+              top: 92,
+              message: '涓嶆墽琛岄粯璁ql鏃讹紝蹇呴』璁剧疆鑷畾涔夎剼鏈紒',
+              duration: 5
+            })
+            return
+          }
 
           let cols = _verify.columns.map(col => col.Column.toLowerCase())
           cols = Array.from(new Set(cols))
diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx
index 3112852..bc6d3cd 100644
--- a/src/templates/zshare/verifycard/customscript/index.jsx
+++ b/src/templates/zshare/verifycard/customscript/index.jsx
@@ -150,13 +150,16 @@
           } else {
             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
+              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(),upid=@time_id@,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@
+              
+              update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
+              where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
+
               if @check_userids@ != ''
               begin
-                    delete s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
                     insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid)
                     select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@)
                     insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
@@ -164,7 +167,8 @@
               end
               if @notice_userids@ != ''
               begin
-                    delete n
+                    update n
+                    set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
                     from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n
                     inner join (select ID from dbo.SplitComma(@notice_userids@)) s
                     on n.userid = s.id
@@ -281,13 +285,16 @@
         insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
         select @ID@,@works_flow_code@,@works_flow_detail_id@,@userid@,@start_type@,@userid@,@UserName,@FullName,@time_id@`
       } else {
-        value = `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
+        value = `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(),upid=@time_id@,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@
+        
+        update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
+        where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
+  
         if @check_userids@ != ''
         begin
-              delete s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
               insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid)
               select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@)
               insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
@@ -295,7 +302,8 @@
         end
         if @notice_userids@ != ''
         begin
-              delete n
+              update n
+              set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
               from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n
               inner join (select ID from dbo.SplitComma(@notice_userids@)) s
               on n.userid = s.id
diff --git a/src/utils/utils.js b/src/utils/utils.js
index c46bc39..46e40aa 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -2135,6 +2135,7 @@
     let statusName = ''
     let detailId = ''
     let error = ''
+    let userid = sessionStorage.getItem('UserID') || ''
 
     if (verify.flowType === 'start') {
       target = flow.cells.filter(cell => cell.mknode === 'start')[0]
@@ -2263,7 +2264,15 @@
       error = '琛屼俊鎭腑鏃犲伐浣滄祦鍙傛暟'
     }
 
-    if (verify.flowSql === 'true' && target) {
+    if (error) {
+      status = 0
+      statusName = '寮傚父'
+
+      _sql += `
+      /* 宸ヤ綔娴佸紓甯竤ql */
+      select @ErrorCode='E',@retmsg='${error}' goto aaa
+      `
+    } else if (verify.flowSql === 'true' && target) {
       if (verify.flowType === 'start') {
         _sql += `
       /* 宸ヤ綔娴侀粯璁ql */
@@ -2274,16 +2283,124 @@
       insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
       select @ID@,@works_flow_code@,@works_flow_detail_id@,@userid@,@start_type@,@userid@,@UserName,@FullName,@time_id@
       `
+      } else if (line && line.approvalMethod === 'countersign' && (!node.checkIds || !node.checkIds.includes(userid))) {
+        status = 0
+        statusName = '寮傚父'
+
+        _sql += `
+        /* 宸ヤ綔娴佸紓甯竤ql */
+        select @ErrorCode='E',@retmsg='褰撳墠鐢ㄦ埛涓嶅湪瀹℃壒浜哄垪琛ㄤ腑' goto aaa
+        `
+      } else if (line && line.approvalMethod === 'countersign' && node.checkIds.length > 1) {
+        let label = ''
+        let field = ''
+        let mark = line.mark || '宸插鏍�'
+        let _declare = []
+        let _select = []
+        let _select2 = []
+        let _where = []
+        let fields = ['statuscharone', 'statuschartwo', 'statuscharthree', 'statuscharfour', 'statuscharfive']
+        node.checkUsers.forEach((user, index) => {
+          if (user.worker_id === userid) {
+            field = fields[index]
+            label = `'${user.parentNames[2] || ''}${user.workername || ''}${mark}'`
+          } else {
+            _declare.push(`@works_flow_${fields[index]} nvarchar(50)`)
+            _select.push(`@works_flow_${fields[index]}=''`)
+            _select2.push(`@works_flow_${fields[index]}=${fields[index]}`)
+            _where.push(`@works_flow_${fields[index]}!=''`)
+          }
+        })
+        _declare = _declare.join(',')
+        _select = _select.join(',')
+        _select2 = _select2.join(',')
+        _where = _where.join(' and ')
+
+        _sql += `
+      /* 宸ヤ綔娴侀粯璁ql */
+      declare ${_declare},@works_flow_key_id nvarchar(50),@works_flow_key_status nvarchar(20),@s_my_works_flow_log_param  nvarchar(max),@s_my_works_flow_log_status int,@s_my_works_flow_log_statusname nvarchar(50),@s_my_works_flow_log_detail_id  nvarchar(50)
+      select ${_select},@works_flow_key_id='',@works_flow_key_status ='',@s_my_works_flow_log_param='',@s_my_works_flow_log_status=0,@s_my_works_flow_log_statusname='',@s_my_works_flow_log_detail_id=''
+
+      select ${_select2},@works_flow_key_id=id,@s_my_works_flow_log_param=works_flow_param,@s_my_works_flow_log_status=status,@s_my_works_flow_log_statusname=statusname,@s_my_works_flow_log_detail_id=works_flow_detail_id
+      from s_my_works_flow where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
+
+      if ${_where}
+      begin
+          set @works_flow_key_status='Y'
+      end
+
+      if @works_flow_key_status='Y'
+      begin
+            update s_my_works_flow set ${field}=${label},status=@status@,statusname=@statusname@,works_flow_param=@works_flow_param@,works_flow_detail_id=@works_flow_detail_id@,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname
+            where id=@works_flow_key_id
+
+            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,${field})
+            select @ID@,@works_flow_code@,@works_flow_name@ ,@works_flow_param@,@status@,@statusname@,@works_flow_detail_id@,@work_group@,@work_grade@,@time_id@,${label}
+            
+            update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
+            where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
+
+            if @check_userids@ != ''
+            begin
+                  insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid)
+                  select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@)
+                  insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
+                  select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@check_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@)
+            end
+            if @notice_userids@ != ''
+            begin
+                  update n
+                  set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
+                  from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n
+                  inner join (select ID from dbo.SplitComma(@notice_userids@)) s
+                  on n.userid = s.id
+                  insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
+                  select @ID@,@works_flow_code@,@works_flow_detail_id@,ID,@notice_type@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@notice_userids@)
+            end
+      end
+      else
+      begin
+            update s_my_works_flow set ${field}=${label},modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname
+            where id =@works_flow_key_id
+
+            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,${field})
+            select @ID@,@works_flow_code@,@works_flow_name@ ,@s_my_works_flow_log_param,@s_my_works_flow_log_status,@s_my_works_flow_log_statusname,@s_my_works_flow_log_detail_id,@work_group@,@work_grade@,@time_id@,${label}
+          
+            update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
+            where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 and userid =@userid@
+      end
+      `
       } else {
         _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
+      set @retmsg =''
+      select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0 and userid =@userid@
+
+      if @retmsg =''
+      begin
+          select @retmsg='X' from s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and userid=@userid@
+
+          if @retmsg !='' 
+          begin
+              select @ErrorCode='E', @retmsg='褰撳墠鍗曟嵁宸插鏍革紝璇峰埛鏂板悗閲嶈瘯'
+            goto aaa 
+          end
+
+          select @retmsg='椤甸潰鏁版嵁宸叉洿鏂帮紝鎴栨病鏈夊綋鍓嶅崟鎹殑瀹℃壒鏉冮檺'
+            goto aaa 
+      end
+      set @retmsg=''
+
+      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(),upid=@time_id@,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@
+      
+      update s_my_works_flow_role set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
+      where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
+
       if @check_userids@ != ''
       begin
-            delete s_my_works_flow_role where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0
             insert into s_my_works_flow_role (works_flow_id,works_flow_code,userid,works_flow_detail_id,createuserid,CreateUser,CreateStaff,upid)
             select @ID@,@works_flow_code@,ID,@works_flow_detail_id@,@userid@,@UserName,@FullName,@time_id@ from dbo.SplitComma(@check_userids@)
             insert into s_my_works_flow_notice (works_flow_id,works_flow_code,works_flow_detail_id,userid,notice_type,createuserid,CreateUser,CreateStaff,upid)
@@ -2291,7 +2408,8 @@
       end
       if @notice_userids@ != ''
       begin
-            delete n
+            update n
+            set deleted=10,modifydate=getdate(),upid=@time_id@,modifyuserid=@userid@,modifyuser=@username,modifystaff=@fullname 
             from (select * from s_my_works_flow_notice where works_flow_id=@ID@ and works_flow_code=@works_flow_code@ and deleted=0) n
             inner join (select ID from dbo.SplitComma(@notice_userids@)) s
             on n.userid = s.id
@@ -2310,12 +2428,27 @@
       `
     }
 
+    let checkIds = []
+    let checkUsers = []
+    let work_grade = sessionStorage.getItem('work_grade') || 0
     if (verify.flowType !== 'start') {
       if (line) {
-        let checkIds = []
         let noticeIds = []
         line.mkdata.members && line.mkdata.members.forEach(item => {
-          checkIds.push(item.worker_id)
+          if (line.mkdata.approver === 'departmentManager') {
+            if (item.job_type === 'manage' && departmentcode === item.parentIds[1]) {
+              checkIds.push(item.worker_id)
+              checkUsers.push(item)
+            }
+          } else if (line.mkdata.approver === 'directManager') {
+            if (departmentcode === item.parentIds[1] && item.work_grade > work_grade) {
+              checkIds.push(item.worker_id)
+              checkUsers.push(item)
+            }
+          } else {
+            checkIds.push(item.worker_id)
+            checkUsers.push(item)
+          }
         })
         line.mkdata.copys && line.mkdata.copys.forEach(item => {
           noticeIds.push(item.worker_id)
@@ -2337,9 +2470,10 @@
 
     _sql = _sql.replace(/@works_flow_code@/ig, `'${flow.flow_code}'`)
     _sql = _sql.replace(/@works_flow_name@/ig, `'${flow.flow_name}'`)
+
     if (target) {
       let label = target.attrs && target.attrs.text && target.attrs.text.text ? target.attrs.text.text : ''
-      let msg = {...target.mkdata, label: label, id: target.id}
+      let msg = {...target.mkdata, label: label, id: target.id, checkIds, checkUsers}
       _sql = _sql.replace(/@works_flow_param@/ig, `'${window.btoa(window.encodeURIComponent(JSON.stringify(msg)))}'`)
     } else {
       _sql = _sql.replace(/@works_flow_param@/ig, `''`)
@@ -2348,7 +2482,7 @@
     _sql = _sql.replace(/@status@/ig, `'${status}'`)
     _sql = _sql.replace(/@statusname@/ig, `'${statusName}'`)
     _sql = _sql.replace(/@work_group@/ig, `'${sessionStorage.getItem('work_group') || ''}'`)
-    _sql = _sql.replace(/@work_grade@/ig, `'${sessionStorage.getItem('work_grade') || 0}'`)
+    _sql = _sql.replace(/@work_grade@/ig, `'${work_grade}'`)
   }
 
   if (_backCustomScript) {

--
Gitblit v1.8.0