From 0eb129a9beddbb86ae74d7106a8e60823206b8d5 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 14 十二月 2023 11:29:15 +0800
Subject: [PATCH] 2023-12-14

---
 src/templates/zshare/verifycard/baseform/index.jsx |  125 ++++++++++++++++++++++++++++++++++++-----
 1 files changed, 108 insertions(+), 17 deletions(-)

diff --git a/src/templates/zshare/verifycard/baseform/index.jsx b/src/templates/zshare/verifycard/baseform/index.jsx
index 83c366d..e9f2311 100644
--- a/src/templates/zshare/verifycard/baseform/index.jsx
+++ b/src/templates/zshare/verifycard/baseform/index.jsx
@@ -1,11 +1,12 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { fromJS } from 'immutable'
-import { Form, Row, Col, Select, Radio, Tooltip, Input, notification } from 'antd'
+import { Form, Row, Col, Select, Radio, Tooltip, Input } from 'antd'
 import { QuestionCircleOutlined } from '@ant-design/icons'
 
 import Api from '@/api'
 import MkPrintTemps from '@/menu/components/share/actioncomponent/actionform/mkPrintTemps'
+import CodeMirror from '@/templates/zshare/codemirror'
 import './index.scss'
 
 const sysTempsIds = ['8IFltwzyKcu15iA8fqSyb6m-pMa88a3ZTu0No3vDHgo', 'LOB-bbt9jVncGh7IOAUdESh1Sgzcbt62UwOqSqcK9ok']
@@ -16,6 +17,7 @@
     verify: PropTypes.object,
     unionFields: PropTypes.array,
     notes: PropTypes.array,
+    emailCodes: PropTypes.array,
     appType: PropTypes.any,
     onChange: PropTypes.func
   }
@@ -128,10 +130,14 @@
     let error = ''
     if (verify.noteEnable === 'true' && !verify.noteCode) { // 寮�鍚煭淇℃椂锛岄渶瑕佹ā鏉跨紪鐮�
       error = '寮�鍚煭淇℃椂锛岄渶瑕侀�夋嫨鐭俊妯℃澘锛�'
+    } else if (verify.emailEnable === 'true' && !verify.emailCode) {
+      error = '寮�鍚偖浠跺彂閫佹椂锛岄渶瑕侀�夋嫨閭欢妯℃澘锛�'
     } else if (verify.printEnable === 'true' && !verify.printTempId) {
       error = '浣跨敤鍗曟嵁鎵撳嵃鏃讹紝闇�瑕侀�夋嫨鎵撳嵃妯℃澘锛�'
     } else if (verify.accountdate === 'true' && !verify.accountfield) {
       error = '寮�鍚处鏈熸椂锛岄渶瑕侀�夋嫨楠岃瘉鍏徃锛�'
+    } else if (verify.preHandle === 'true' && !verify.pre_func) {
+      error = '寮�鍚寜閽澶勭悊鏃讹紝闇�瑕佸~鍐欏鐞嗗嚱鏁帮紒'
     } else if (verify.wxNote === 'true') {
       if (!verify.wxTemplateId) {
         error = '寮�鍚叕浼楀彿娑堟伅鎺ㄩ�佹椂锛岄渶瑕侀�夋嫨娑堟伅妯℃澘锛�'
@@ -146,12 +152,17 @@
   }
 
   onOptionChange = (value, key) => {
-    const { verify, setting } = this.props
+    const { verify } = this.props
 
     let _verify = {...verify, [key]: value}
 
     if (_verify.noteEnable !== 'true') {
       _verify.noteCode = ''
+      _verify.noteId = ''
+    }
+    if (_verify.emailEnable !== 'true') {
+      _verify.emailCode = ''
+      _verify.emailId = ''
     }
     if (_verify.printEnable !== 'true') {
       _verify.printTempId = ''
@@ -159,6 +170,9 @@
     if (_verify.accountdate !== 'true') {
       _verify.accountfield = ''
       _verify.voucherdate = ''
+    }
+    if (_verify.preHandle !== 'true') {
+      _verify.pre_func = ''
     }
     if (_verify.wxNote !== 'true') {
       _verify.wxTemplateId = ''
@@ -175,15 +189,6 @@
       }
     }
 
-    if (verify.invalid !== 'true' && _verify.invalid === 'true' && setting.maxScript && setting.maxScript >= 300) {
-      notification.warning({
-        top: 92,
-        message: '鏁版嵁婧愪腑鑷畾涔夎剼鏈繃浜庡鏉傦紝涓嶈兘浣跨敤澶辨晥楠岃瘉锛�',
-        duration: 5
-      })
-      return
-    }
-
     this.props.onChange(_verify)
   }
 
@@ -191,6 +196,14 @@
     const { verify } = this.props
 
     let _verify = {...verify, noteCode: val, noteId: option.props.id}
+
+    this.props.onChange(_verify)
+  }
+
+  onEmailCodeChange = (val, option) => {
+    const { verify } = this.props
+
+    let _verify = {...verify, emailCode: val, emailId: option.props.id}
 
     this.props.onChange(_verify)
   }
@@ -279,7 +292,7 @@
   }
 
   render() {
-    const { unionFields, verify, notes, card, appType, columns } = this.props
+    const { unionFields, verify, notes, emailCodes, card, appType, columns } = this.props
     const { wxTemps, selectTemp } = this.state
     const formItemLayout = {
       labelCol: {
@@ -320,8 +333,13 @@
             </Form.Item>
           </Col> : null}
           {card.intertype !== 'inner' ? <Col span={8}>
-            <Form.Item label={'澶辨晥楠岃瘉'}>
-              <Radio.Group value={verify.invalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}>
+            <Form.Item label={
+              verify.limitText ? <Tooltip placement="bottomLeft" title={verify.limitText}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                澶辨晥楠岃瘉
+              </Tooltip> : '澶辨晥楠岃瘉'
+            }>
+              <Radio.Group value={verify.invalid} disabled={verify.limitInvalid} onChange={(e) => {this.onOptionChange(e.target.value, 'invalid')}}>
                 <Radio value="true">寮�鍚�</Radio>
                 <Radio value="false">涓嶅紑鍚�</Radio>
               </Radio.Group>
@@ -383,7 +401,7 @@
                 鐭俊妯℃澘
               </Tooltip>
             } required>
-              <Select value={verify.noteCode} onSelect={this.onNoteCodeChange}>
+              <Select value={verify.noteCode || ''} onSelect={this.onNoteCodeChange}>
                 {notes.map(option =>
                   <Select.Option key={option.value} id={option.id} value={option.value}>
                     {option.name}
@@ -399,7 +417,7 @@
                 鍙戦�佹柟寮�
               </Tooltip>
             }>
-              <Radio.Group value={verify.noteType} onChange={(e) => {this.onOptionChange(e.target.value, 'noteType')}}>
+              <Radio.Group value={verify.noteType || 'N'} onChange={(e) => {this.onOptionChange(e.target.value, 'noteType')}}>
                 <Radio value="Y">瀹炴椂</Radio>
                 <Radio value="N">瀹氭椂</Radio>
               </Radio.Group>
@@ -412,7 +430,63 @@
                 鐭俊鍐呭
               </Tooltip>
             }>
-              <Radio.Group value={verify.noteTemp} onChange={(e) => {this.onOptionChange(e.target.value, 'noteTemp')}}>
+              <Radio.Group value={verify.noteTemp || 'Y'} onChange={(e) => {this.onOptionChange(e.target.value, 'noteTemp')}}>
+                <Radio value="Y">鐩稿悓</Radio>
+                <Radio value="N">涓嶅悓</Radio>
+              </Radio.Group>
+            </Form.Item>
+          </Col> : null}
+          <Col span={24}></Col>
+          <Col span={8}>
+            <Form.Item label={
+              <Tooltip placement="bottomLeft" title={'閫夋嫨鍙戦�侀偖浠舵椂锛岄渶瀹屽杽閭欢璁剧疆銆�'}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鍙戦�侀偖浠�
+              </Tooltip>
+            }>
+              <Radio.Group value={verify.emailEnable} onChange={(e) => {this.onOptionChange(e.target.value, 'emailEnable')}}>
+                <Radio value="true">寮�鍚�</Radio>
+                <Radio value="false">涓嶅紑鍚�</Radio>
+              </Radio.Group>
+            </Form.Item>
+          </Col>
+          {verify.emailEnable === 'true' ? <Col span={8}>
+            <Form.Item label={
+              <Tooltip placement="bottomLeft" title={<span>閭欢妯℃澘娣诲姞鍦板潃锛�<a target="_blank" rel="noopener noreferrer" href="https://cloud.mk9h.cn/admin/index.html">浜戜腑蹇�</a>-&gt;搴旂敤鏈嶅姟-&gt;寮�鍙戣�呬腑蹇�-&gt;閭欢妯℃澘銆�</span>}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                閭欢妯℃澘
+              </Tooltip>
+            } required>
+              <Select value={verify.emailCode || ''} onSelect={this.onEmailCodeChange}>
+                {emailCodes.map(option =>
+                  <Select.Option key={option.value} id={option.id} value={option.value}>
+                    {option.name}
+                  </Select.Option>
+                )}
+              </Select>
+            </Form.Item>
+          </Col> : null}
+          {verify.emailEnable === 'true' ? <Col span={8}>
+            <Form.Item label={
+              <Tooltip placement="bottomLeft" title={'瀹炴椂鍙戦�佹渶澶氬悓鏃跺彂閫�5涓敤鎴凤紝瀹氭椂鍙戦�佹渶澶氬悓鏃跺彂閫�100涓敤鎴枫��'}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鍙戦�佹柟寮�
+              </Tooltip>
+            }>
+              <Radio.Group value={verify.emailType || 'N'} onChange={(e) => {this.onOptionChange(e.target.value, 'emailType')}}>
+                <Radio value="Y">瀹炴椂</Radio>
+                <Radio value="N">瀹氭椂</Radio>
+              </Radio.Group>
+            </Form.Item>
+          </Col> : null}
+          {verify.emailEnable === 'true' ? <Col span={8}>
+            <Form.Item label={
+              <Tooltip placement="bottomLeft" title={'褰撳悜澶氫釜鐢ㄦ埛鍙戦�佺煭淇℃椂锛岀煭淇″唴瀹规槸鍚︾浉鍚屻��'}>
+                <QuestionCircleOutlined className="mk-form-tip" />
+                閭欢鍐呭
+              </Tooltip>
+            }>
+              <Radio.Group value={verify.emailTemp || 'Y'} onChange={(e) => {this.onOptionChange(e.target.value, 'emailTemp')}}>
                 <Radio value="Y">鐩稿悓</Radio>
                 <Radio value="N">涓嶅悓</Radio>
               </Radio.Group>
@@ -620,6 +694,23 @@
               </div>
             </div>
           </Col> : null}
+          <Col span={24}></Col>
+          <Col span={8}>
+            <Form.Item label={
+              <Tooltip placement="topRight" title="杩愯鏃朵慨鏀规寜閽弬鏁帮紝鍏ュ弬涓猴紙btn, systemType锛夈�傛敞锛歴ystemType涓虹郴缁熺被鍨嬶紝姝e紡绯荤粺涓簆roduction">
+                <QuestionCircleOutlined className="mk-form-tip" />
+                鎸夐挳棰勫鐞�
+              </Tooltip>
+            }>
+              <Radio.Group value={verify.preHandle || 'false'} onChange={(e) => {this.onOptionChange(e.target.value, 'preHandle')}}>
+                <Radio value="true">寮�鍚�</Radio>
+                <Radio value="false">涓嶅紑鍚�</Radio>
+              </Radio.Group>
+            </Form.Item>
+          </Col>
+          {verify.preHandle === 'true' ? <Col span={24} style={{paddingLeft: '50px'}}>
+            <CodeMirror mode="text/javascript" theme="cobalt" value={verify.pre_func || ''} onChange={(val) => {this.onOptionChange(val, 'pre_func')}} />
+          </Col> : null}
         </Row>
       </Form>
     )

--
Gitblit v1.8.0