From 04c038af25f79ac7fc80e93054856a614f22b63b Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 12 六月 2024 16:43:39 +0800
Subject: [PATCH] 2024-06-12

---
 src/menu/datasource/verifycard/settingform/index.jsx |  125 +++++++++++++++++------------------------
 1 files changed, 52 insertions(+), 73 deletions(-)

diff --git a/src/menu/datasource/verifycard/settingform/index.jsx b/src/menu/datasource/verifycard/settingform/index.jsx
index 805305e..8a8c97c 100644
--- a/src/menu/datasource/verifycard/settingform/index.jsx
+++ b/src/menu/datasource/verifycard/settingform/index.jsx
@@ -5,8 +5,8 @@
 import { QuestionCircleOutlined, PlusOutlined } from '@ant-design/icons'
 
 import { formRule } from '@/utils/option.js'
-import Utils from '@/utils/utils.js'
 import MenuUtils from '@/utils/utils-custom.js'
+import { checkSQL } from '@/utils/utils-custom.js'
 import CodeMirror from '@/templates/zshare/codemirror'
 import KeyInterface from '@/components/keyInterface'
 import './index.scss'
@@ -105,59 +105,15 @@
           if (values.interType === 'system' && values.onload === 'false') {
             values.sync = 'false'
           }
+          if (values.interType === 'system' && values.database === 'sso') {
+            values.sync = 'false'
+          }
 
           // 鏁版嵁婧愬墠绔獙璇�
           if (values.interType === 'system' && values.execute !== 'false' && values.dataresource) {
-            let _quot = values.dataresource.match(/'{1}/g)
-            let _lparen = values.dataresource.match(/\({1}/g)
-            let _rparen = values.dataresource.match(/\){1}/g)
+            let pass = checkSQL(values.dataresource)
 
-            _quot = _quot ? _quot.length : 0
-            _lparen = _lparen ? _lparen.length : 0
-            _rparen = _rparen ? _rparen.length : 0
-
-            if (_quot % 2 !== 0) {
-              notification.warning({
-                top: 92,
-                message: '鏁版嵁婧愪腑\'蹇呴』鎴愬鍑虹幇',
-                duration: 5
-              })
-              reject()
-              return
-            } else if (_lparen !== _rparen) {
-              notification.warning({
-                top: 92,
-                message: '鏁版嵁婧愪腑()蹇呴』鎴愬鍑虹幇',
-                duration: 5
-              })
-              reject()
-              return
-            } else if (/--/ig.test(values.dataresource)) {
-              notification.warning({
-                top: 92,
-                message: '鏁版嵁婧愪腑锛屼笉鍙嚭鐜板瓧绗� -- 锛屾敞閲婅鐢� /*鍐呭*/',
-                duration: 5
-              })
-              reject()
-              return
-            } else if (/,,/ig.test(values.dataresource)) {
-              notification.warning({
-                top: 92,
-                message: '鏁版嵁婧愪腑锛屼笉鍙嚭鐜拌繛缁殑鑻辨枃閫楀彿锛�,,锛�',
-                duration: 5
-              })
-              reject()
-              return
-            }
-
-            let error = Utils.verifySql(values.dataresource)
-
-            if (error) {
-              notification.warning({
-                top: 92,
-                message: '鏁版嵁婧愪腑涓嶅彲浣跨敤' + error,
-                duration: 5
-              })
+            if (!pass) {
               reject()
               return
             }
@@ -311,7 +267,7 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col>
-            {setting.interType === 'outer' ? <Col span={8}>
+            {setting.interType === 'outer' ? <Col span={8} className="compact">
               <Form.Item label={
                 <Tooltip placement="topLeft" title="涓氬姟绯荤粺鎸囧悓涓�sso涓嬬殑鍏朵粬涓氬姟绯荤粺锛屽閮ㄧ郴缁熸寚涓嶅悓sso涓嬬殑鍏朵粬涓氬姟绯荤粺銆�">
                   <QuestionCircleOutlined className="mk-form-tip" />
@@ -331,6 +287,7 @@
                   <Radio value="false">涓氬姟</Radio>
                   <Radio value="true">鍗曠偣</Radio>
                   <Radio value="external">澶栭儴</Radio>
+                  <Radio value="custom">鑷畾涔�</Radio>
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
@@ -379,7 +336,7 @@
                 })(<KeyInterface type="develop"/>)}
               </Form.Item>
             </Col> : null}
-            {setting.interType === 'outer' && setting.sysInterface === 'false' ? <Col className="outer-interface" span={24}>
+            {setting.interType === 'outer' && (setting.sysInterface === 'false' || setting.sysInterface === 'custom') ? <Col className="outer-interface" span={24}>
               <Form.Item label={<Tooltip placement="topLeft" title="姝e紡绯荤粺鎺ュ彛鍦板潃锛屼负绌烘椂浣跨敤鎺ュ彛鍦板潃銆�">
                   <QuestionCircleOutlined className="mk-form-tip" />
                   姝e紡鍦板潃
@@ -401,6 +358,18 @@
                 })(<KeyInterface type="product"/>)}
               </Form.Item>
             </Col> : null}
+            {setting.interType === 'outer' && setting.sysInterface === 'custom' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}>
+              <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={
+                <Tooltip placement="topLeft" title="澶栭儴鎺ュ彛鍏ュ弬鍙婂嚭鍙傜殑鑷畾涔夊鐞嗐��">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  鑷畾涔夎剼鏈�
+                </Tooltip>
+              }>
+                {getFieldDecorator('js_script', {
+                  initialValue: setting.js_script || ''
+                })(<CodeMirror mode="text/javascript" theme="cobalt" />)}
+              </Form.Item>
+            </Col> : null}
             {setting.interType === 'outer' ? <Col span={8}>
               <Form.Item label="澶栭儴鍑芥暟">
                 {getFieldDecorator('outerFunc', {
@@ -409,7 +378,7 @@
               </Form.Item>
             </Col> : null}
             {setting.interType === 'system' ? <Col span={24} className="data-source" style={{paddingLeft: '7px'}}>
-              {window.GLOB.process ? <span className="process-btn" onClick={this.addProcess}>宸ヤ綔娴�</span> : null}
+              {window.GLOB.process && !['invoice', 'invTable'].includes(config.subtype) ? <span className="process-btn" onClick={this.addProcess}>宸ヤ綔娴�</span> : null}
               <Form.Item labelCol={{xs: { span: 24 }, sm: { span: 2 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 22 }} } label={
                 <Tooltip placement="topLeft" title={`浣跨敤绯荤粺鍑芥暟鏃讹紝闇�濉啓鏁版嵁婧愩�傛敞锛氭暟鎹潈闄愭浛鎹㈢ $@ -> /* 鎴� ''銆� @$ -> */ 鎴� ''銆俙}>
                   <QuestionCircleOutlined className="mk-form-tip" />
@@ -443,21 +412,21 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
-            <Col span={8}>
+            {!['invTable'].includes(config.subtype) ? <Col span={8}>
               <Form.Item label="涓婚敭">
                 {getFieldDecorator('primaryKey', {
                   initialValue: setting.primaryKey || ''
                 })(
-                  <Select>
+                  <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                     {columns.map((option, i) =>
                       <Select.Option key={i} value={option.field}>
-                        {option.label}
+                        {`${option.label}锛�${option.field}锛塦}
                       </Select.Option>
                     )}
                   </Select>
                 )}
               </Form.Item>
-            </Col>
+            </Col> : null}
             {/* 鏁扮粍鏁版嵁锛岄渶璁剧疆鎺掑簭瑙勫垯 */}
             {config.format === 'array' ? <Col span={8}>
               <Form.Item label={
@@ -488,7 +457,7 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
-            {!['navbar', 'balcony', 'menubar'].includes(config.type) && (!config.wrap || config.wrap.supType !== 'multi') && MenuType !== 'billPrint' ? <Col span={8}>
+            {!['balcony', 'menubar', 'commonbar', 'tabbar', 'invTable'].includes(config.subtype) && (!config.wrap || config.wrap.supType !== 'multi') && MenuType !== 'billPrint' ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'璇ョ粍浠跺鏋滃彈鍏朵粬缁勪欢鎺у埗锛岃閫夐」鐩稿簲鐨勭粍浠讹紝娌℃湁鏃堕�夆�滄棤鈥濄��'}>
                   <QuestionCircleOutlined className="mk-form-tip" />
@@ -521,12 +490,7 @@
               </Form.Item>
             </Col> : null}
             {config.pageable && setting.laypage !== 'false' ? <Col span={8}>
-              <Form.Item label={
-                <Tooltip placement="topLeft" title="閫夋嫨鍒嗛〉鏃舵湁鏁堛��">
-                  <QuestionCircleOutlined className="mk-form-tip" />
-                  姣忛〉鏁伴噺
-                </Tooltip>
-              }>
+              <Form.Item label="姣忛〉鏁伴噺">
                 {getFieldDecorator('pageSize', {
                   initialValue: setting.pageSize || 10,
                   rules: [
@@ -554,8 +518,24 @@
                 </Radio.Group>)}
               </Form.Item>
             </Col> : null}
+            {setting.interType === 'system' ? <Col span={8}>
+              <Form.Item label={
+                <Tooltip placement="topLeft" title="娴嬭瘯绯荤粺鏁版嵁搴撳潎鎸囧悜鏈湴锛屾寮忕郴缁熷彲浣跨敤鍗曠偣鏁版嵁搴撱��">
+                  <QuestionCircleOutlined className="mk-form-tip" />
+                  鏁版嵁搴�
+                </Tooltip>
+              }>
+                {getFieldDecorator('database', {
+                  initialValue: setting.database || 'local'
+                })(
+                <Radio.Group>
+                  <Radio value="local">鏈湴</Radio>
+                  <Radio value="sso">鍗曠偣</Radio>
+                </Radio.Group>)}
+              </Form.Item>
+            </Col> : null}
             {/* 1銆佷笉鍒嗛〉涓斾笉瀛樺湪涓婄骇妯″潡 */}
-            {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}>
+            {!['navbar', 'interface', 'calendar'].includes(config.type) && !['editable', 'basetable', 'dualdatacard', 'invoice', 'invTable'].includes(config.subtype) && (!config.pageable || (config.pageable && setting.laypage === 'false')) && (setting.supModule.length === 0 || setting.supModule[0] === 'empty') && setting.interType === 'system' && setting.onload !== 'false' ? <Col span={8}>
               <Form.Item label={
                 <Tooltip placement="topLeft" title={'鍒濆鍖栧姞杞芥椂锛屾槸鍚︿笌鍏朵粬缁勪欢涓�鍚屽姞杞芥暟鎹紝娉細濡傝彍鍗曟湭浣跨敤鍚庣缂撳瓨锛屽垯鏌ヨ璇彞澶т簬8000瀛楃鏃舵棤鏁堛��'}>
                   <QuestionCircleOutlined className="mk-form-tip" />
@@ -572,9 +552,9 @@
                 )}
               </Form.Item>
             </Col> : null}
-            {!['navbar', 'balcony', 'menubar', 'interface'].includes(config.type) && !['basetable'].includes(config.subtype) ? <Col span={8}>
+            {!['navbar', 'balcony', 'menubar'].includes(config.type) && !['basetable', 'invoice', 'invTable'].includes(config.subtype) ? <Col span={8}>
               <Form.Item label={
-                <Tooltip placement="topLeft" title={'浼樺厛浣跨敤鍚岀骇鐨勬悳绱㈡潯浠剁粍浠讹紝鍚岀骇鎼滅储涓嶅瓨鍦ㄦ椂锛屼緷娆″悜涓婇�夊彇锛屼笌褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵竴鍚岀敤浣滄暟鎹繃婊わ紙褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵紭鍏堬級銆�'}>
+                <Tooltip placement="topLeft" title={config.type === 'interface' ? '鍗曠嫭鎼滅储缁勪欢鍙綔涓哄叕鍏辨暟鎹簮鐨勬悳绱㈡潯浠躲��' : '浼樺厛浣跨敤鍚岀骇鐨勬悳绱㈡潯浠剁粍浠讹紝鍚岀骇鎼滅储涓嶅瓨鍦ㄦ椂锛屼緷娆″悜涓婇�夊彇锛屼笌褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵竴鍚岀敤浣滄暟鎹繃婊わ紙褰撳墠缁勪欢鐨勬悳绱㈡潯浠朵紭鍏堬級銆�'}>
                   <QuestionCircleOutlined className="mk-form-tip" />
                   澶栭儴鎼滅储
                 </Tooltip>
@@ -691,10 +671,10 @@
                 {getFieldDecorator('subKey', {
                   initialValue: setting.subKey || ''
                 })(
-                  <Select>
+                  <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                     {this.props.subColumns.map((option, i) =>
                       <Select.Option key={i} value={option.field}>
-                        {option.label}
+                        {`${option.label}锛�${option.field}锛塦}
                       </Select.Option>
                     )}
                   </Select>
@@ -706,10 +686,10 @@
                 {getFieldDecorator('subBID', {
                   initialValue: setting.subBID || ''
                 })(
-                  <Select>
+                  <Select showSearch filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}>
                     {this.props.subColumns.map((option, i) =>
                       <Select.Option key={i} value={option.field}>
-                        {option.label}
+                        {`${option.label}锛�${option.field}锛塦}
                       </Select.Option>
                     )}
                   </Select>
@@ -722,8 +702,7 @@
           wrapClassName="mk-flow-type"
           visible={visible}
           width={400}
-          maskClosable={false}
-          closable={false}
+          onCancel={() => this.setState({visible: false})}
           footer={[
             <Button key="cancel" className="mk-green" onClick={() => this.execAddProcess('flowstart')}>鍙戣捣</Button>,
             <Button key="confirm" className="mk-primary" onClick={() => this.execAddProcess('flowcheck')}>瀹℃壒</Button>

--
Gitblit v1.8.0