From d87530a16ed85534432e3c60c644dc96d63f6f69 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 02 十二月 2021 17:20:02 +0800
Subject: [PATCH] Merge branch 'master' into bms

---
 src/templates/zshare/verifycard/index.jsx |  128 +++++++++++++++++++++++++++++-------------
 1 files changed, 89 insertions(+), 39 deletions(-)

diff --git a/src/templates/zshare/verifycard/index.jsx b/src/templates/zshare/verifycard/index.jsx
index 94e8755..9d42d79 100644
--- a/src/templates/zshare/verifycard/index.jsx
+++ b/src/templates/zshare/verifycard/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { fromJS } from 'immutable'
+import { is, fromJS } from 'immutable'
 import { Form, Tabs, Row, Col, Radio, Button, Select, Popconfirm, notification, Modal, message, InputNumber, Tooltip, Typography } from 'antd'
 import { QuestionCircleOutlined, CheckCircleOutlined, StopOutlined, EditOutlined, SwapOutlined, DeleteOutlined } from '@ant-design/icons'
 import moment from 'moment'
@@ -97,15 +97,15 @@
         inputType: 'switch',
         render: (text, record) => record.status === 'false' ?
           (
-            <div>
+            <div style={{color: '#ff4d4f'}}>
               {this.props.dict['model.status.forbidden']}
-              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
+              <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
-            <div>
+            <div style={{color: '#26C281'}}>
               {this.props.dict['model.status.open']}
-              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
+              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
       }
@@ -133,15 +133,15 @@
         inputType: 'switch',
         render: (text, record) => record.status === 'false' ?
           (
-            <div>
+            <div style={{color: '#ff4d4f'}}>
               {this.props.dict['model.status.forbidden']}
-              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
+              <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
-            <div>
+            <div style={{color: '#26C281'}}>
               {this.props.dict['model.status.open']}
-              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
+              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
       },
@@ -207,15 +207,15 @@
         inputType: 'switch',
         render: (text, record) => record.status === 'false' ?
           (
-            <div>
+            <div style={{color: '#ff4d4f'}}>
               {this.props.dict['model.status.forbidden']}
-              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
+              <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
-            <div>
+            <div style={{color: '#26C281'}}>
               {this.props.dict['model.status.open']}
-              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
+              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
       }
@@ -228,7 +228,7 @@
         render: (text) => {
           let title = text.match(/^\s*\/\*.+\*\//)
           title = title && title[0] ? title[0] : ''
-          text = title ? text.replace(title, '') : text
+          // text = title ? text.replace(title, '') : text
 
           return (
             <div>
@@ -259,15 +259,15 @@
         width: '9%',
         render: (text, record) => record.status === 'false' ?
           (
-            <div>
+            <div style={{color: '#ff4d4f'}}>
               {this.props.dict['model.status.forbidden']}
-              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
+              <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
-            <div>
+            <div style={{color: '#26C281'}}>
               {this.props.dict['model.status.open']}
-              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
+              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
       },
@@ -298,7 +298,7 @@
         render: (text) => {
           let title = text.match(/^\s*\/\*.+\*\//)
           title = title && title[0] ? title[0] : ''
-          text = title ? text.replace(title, '') : text
+          // text = title ? text.replace(title, '') : text
 
           return (
             <div>
@@ -314,11 +314,11 @@
         width: '10%',
         render: (text, record) => {
           if (record.position === 'init') {
-            return '鍒濆鍖�'
+            return <span style={{color: 'orange'}}>鍒濆鍖�</span>
           } else if (record.position === 'front') {
-            return 'sql鍓�'
+            return <span style={{color: '#26C281'}}>sql鍓�</span>
           } else {
-            return 'sql鍚�'
+            return <span style={{color: '#1890ff'}}>sql鍚�</span>
           }
         }
       },
@@ -328,22 +328,22 @@
         width: '10%',
         render: (text, record) => record.status === 'false' ?
           (
-            <div>
+            <div style={{color: '#ff4d4f'}}>
               {this.props.dict['model.status.forbidden']}
-              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
+              <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
-            <div>
+            <div style={{color: '#26C281'}}>
               {this.props.dict['model.status.open']}
-              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
+              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
       },
       {
         title: '鎿嶄綔',
         align: 'center',
-        width: '20%',
+        width: '140px',
         dataIndex: 'operation',
         render: (text, record) =>
           (<div style={{textAlign: 'center'}}>
@@ -367,7 +367,7 @@
         render: (text) => {
           let title = text.match(/^\s*\/\*.+\*\//)
           title = title && title[0] ? title[0] : ''
-          text = title ? text.replace(title, '') : text
+          // text = title ? text.replace(title, '') : text
 
           return (
             <div>
@@ -383,9 +383,9 @@
         width: '10%',
         render: (text, record) => {
           if (record.position === 'front') {
-            return 'sql鍓�'
+            return <span style={{color: '#26C281'}}>sql鍓�</span>
           } else {
-            return 'sql鍚�'
+            return <span style={{color: '#1890ff'}}>sql鍚�</span>
           }
         }
       },
@@ -395,15 +395,15 @@
         width: '10%',
         render: (text, record) => record.status === 'false' ?
           (
-            <div>
+            <div style={{color: '#ff4d4f'}}>
               {this.props.dict['model.status.forbidden']}
-              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
+              <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
-            <div>
+            <div style={{color: '#26C281'}}>
               {this.props.dict['model.status.open']}
-              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
+              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
       },
@@ -496,15 +496,15 @@
         width: '8%',
         render: (text, record) => record.status === 'false' ?
           (
-            <div>
+            <div style={{color: '#ff4d4f'}}>
               {this.props.dict['model.status.forbidden']}
-              <StopOutlined style={{marginLeft: '5px', color: '#ff4d4f'}} />
+              <StopOutlined style={{marginLeft: '5px'}} />
             </div>
           ) :
           (
-            <div>
+            <div style={{color: '#26C281'}}>
               {this.props.dict['model.status.open']}
-              <CheckCircleOutlined style={{marginLeft: '5px', color: '#52c41a'}}/>
+              <CheckCircleOutlined style={{marginLeft: '5px'}}/>
             </div>
           )
       },
@@ -573,9 +573,20 @@
       })
     }
 
+    _verify.customverifys.forEach((item, i) => {
+      item.$index = i + 1
+    })
+    _verify.scripts.forEach((item, i) => {
+      item.$index = i + 1
+    })
+    _verify.cbScripts.forEach((item, i) => {
+      item.$index = i + 1
+    })
+
     this.setState({
       setting: config.setting || {},
-      verify: _verify
+      verify: _verify,
+      oriVerify: fromJS(_verify).toJS()
     })
 
     if (config.Template !== 'FormTab' && (card.intertype === 'inner' || card.intertype === 'outer')) { // 鍐呴儴鎴栧閮ㄦ帴鍙�
@@ -1398,6 +1409,45 @@
     })
   }
 
+  handleCancel = () => {
+    const { verify, oriVerify } = this.state
+    // 琛ㄥ崟鎻愪氦鏃舵鏌ヨ緭鍏ュ�兼槸鍚︽纭�
+    return new Promise((resolve, reject) => {
+      let msg = ''
+      if (this.customForm && this.customForm.state.editItem) {
+        msg = '鑷畾涔夐獙璇�'
+      } else if (this.customForm && this.customForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.customForm.props.form.getFieldValue('sql'))) {
+        msg = '鑷畾涔夐獙璇�'
+      } else if (this.orderForm && this.orderForm.state.editItem) {
+        msg = '鍗曞彿鐢熸垚'
+      } else if (this.scriptsForm && this.scriptsForm.state.editItem) {
+        msg = '鑷畾涔夎剼鏈�'
+      } else if (this.scriptsForm && this.scriptsForm.props.form.getFieldValue('sql') && !/^\s+$/.test(this.scriptsForm.props.form.getFieldValue('sql'))) {
+        msg = '鑷畾涔夎剼鏈�'
+      }
+
+      if (!is(fromJS(verify), fromJS(oriVerify))) {
+        confirm({
+          content: '楠岃瘉淇℃伅宸蹭慨鏀癸紝纭畾鍙栨秷鍚楋紵',
+          onOk() {
+            resolve()
+          },
+          onCancel() {}
+        })
+      } else if (msg) {
+        confirm({
+          content: msg + '鏈繚瀛橈紝纭畾鍙栨秷鍚楋紵',
+          onOk() {
+            resolve()
+          },
+          onCancel() {}
+        })
+      } else {
+        resolve()
+      }
+    })
+  }
+
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
    */

--
Gitblit v1.8.0