From 3df2d3624c6b768d29670b537f8d6a71d3ef122c Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期日, 12 四月 2020 22:04:53 +0800
Subject: [PATCH] 2020-04-12

---
 src/templates/zshare/modalform/index.jsx                      |    6 
 src/components/header/index.scss                              |   50 +++
 src/tabviews/formtab/index.jsx                                |   18 -
 src/components/header/index.jsx                               |  128 ++++++++
 src/templates/formtabconfig/index.jsx                         |   90 +++++
 src/templates/comtableconfig/index.jsx                        |  136 ++++++++-
 src/templates/zshare/columnform/index.jsx                     |    4 
 src/templates/zshare/verifycard/customscript/index.jsx        |    9 
 src/templates/subtableconfig/index.jsx                        |  118 +++++++
 src/templates/zshare/verifycardexcelin/index.jsx              |   41 ++
 src/templates/zshare/verifycardexcelin/customscript/index.jsx |   63 +++-
 src/tabviews/zshare/verifycard/index.jsx                      |    6 
 src/templates/modalconfig/index.jsx                           |   55 +++
 src/templates/zshare/verifycard/customform/index.jsx          |    9 
 src/locales/zh-CN/comtable.js                                 |    1 
 src/tabviews/commontable/index.jsx                            |    4 
 src/tabviews/zshare/verifycard/tabcard/index.jsx              |   48 ++-
 src/locales/en-US/comtable.js                                 |    1 
 18 files changed, 676 insertions(+), 111 deletions(-)

diff --git a/src/components/header/index.jsx b/src/components/header/index.jsx
index cd58ef4..761bfd3 100644
--- a/src/components/header/index.jsx
+++ b/src/components/header/index.jsx
@@ -4,12 +4,13 @@
 import {connect} from 'react-redux'
 import { is, fromJS } from 'immutable'
 import moment from 'moment'
-import {Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button } from 'antd'
+import {Dropdown, Menu, Icon, Modal, Form, notification, Switch, Button, Input } from 'antd'
 
 import asyncComponent from '@/utils/asyncComponent'
 import {
   toggleCollapse,
   modifyMainMenu,
+  modifyTabview,
   resetState,
   resetDebug,
   resetEditState,
@@ -31,6 +32,7 @@
 
 const EditMenu = asyncComponent(() => import('./editmenu'))
 const { confirm } = Modal
+const { Search } = Input
 
 class Header extends Component {
   static propTpyes = {
@@ -50,7 +52,9 @@
     loginVisible: false,
     loginLoading: false,
     avatar: avatar,
-    systems: []
+    systems: [],
+    searchkey: '',
+    thdMenuList: []
   }
 
   handleCollapse = () => {
@@ -438,6 +442,46 @@
     let _param = window.btoa('ud=' + sessionStorage.getItem('UserID') + '&sd=' + sessionStorage.getItem('SessionUid') + '&ld=' + sessionStorage.getItem('LoginUID') + '&un=' + sessionStorage.getItem('User_Name'))
     window.location.href = system.LinkUrl1 + '#/ssologin/' + _param
   }
+
+  dropdownMenuChange = (visible) => {
+    this.setState({searchkey: ''}, () => {
+      if (visible) {
+        setTimeout(() => {
+          let input = document.getElementById('thdMenu-search')
+
+          if (input) {
+            input.focus()
+          }
+        }, 500)
+      }
+    })
+  }
+
+  selectMenu = (item) => {
+    const { tabviews } = this.props
+    
+    let menu = JSON.parse(JSON.stringify(item))
+    menu.selected = true
+
+    let index = 0
+    let isexit = false
+    let tabs = tabviews.map((tab, i) => {
+      tab.selected = false
+
+      if (tab.MenuID === menu.MenuID) {
+        tab.selected = true
+        isexit = true
+      }
+
+      return tab
+    })
+
+    if (!isexit) {
+      tabs.splice(index + 1, 0, menu)
+    }
+
+    this.props.modifyTabview(tabs)
+  }
   
   UNSAFE_componentWillMount () {
     // 缁勪欢鍔犺浇鏃讹紝鑾峰彇鑿滃崟鏁版嵁
@@ -455,15 +499,53 @@
       if (!result) return
       if (result.status) {
         let _permMenus = {}
+        let menulist = []
+
         if (result.UserRoles) {
+          let iframes = ['Main/Index', 'bda/rdt', 'Home/rdt']
+
           result.UserRoles.forEach(role => {
             role.RoleMenu.forEach(menu => {
               if (!menu.MenuID) return
               _permMenus[menu.MenuID] = true
+
+              let _type = ''
+              if (menu.LinkUrl) {
+                if (menu.LinkUrl === 'CommonTable') {
+                  _type = 'CommonTable'
+                } else if (menu.LinkUrl === 'DataManage') {
+                  _type = 'DataManage'
+                } else if (iframes.includes(menu.LinkUrl.split('?')[0])) {
+                  _type = 'iframe'
+                }
+              }
+  
+              if (_type !== 'iframe') {
+                let pageParam = {}
+                try {
+                  pageParam = JSON.parse(menu.PageParam)
+                } catch (e) {
+                  pageParam = {}
+                }
+                _type = pageParam.Template || _type
+              }
+
+              menulist.push({
+                MenuID: menu.MenuID,
+                MenuName: menu.MenuName,
+                MenuNo: menu.MenuNo || '',
+                EasyCode: menu.EasyCode || '',
+                LinkUrl: menu.LinkUrl,
+                type: _type
+              })
             })
           })
         }
   
+        this.setState({
+          thdMenuList: menulist
+        })
+
         this.props.initMenuPermission(_permMenus)
       } else {
         notification.error({
@@ -480,6 +562,8 @@
   }
 
   render () {
+    const { thdMenuList, searchkey } = this.state
+
     const menu = (
       <Menu overlayclassname="header-dropdown">
         {this.props.debug && <Menu.Item key="0">
@@ -497,7 +581,7 @@
     )
 
     return (
-      <header className="header-container ant-menu-dark">
+      <header className="header-container ant-menu-dark" id="main-header-container">
         <div className={this.props.collapse ? "collapse header-logo" : "header-logo"}><img src={this.state.logourl} alt=""/></div>
         <div className={this.props.collapse ? "collapse header-collapse" : "header-collapse"} onClick={this.handleCollapse}>
           <Icon type={this.props.collapse ? 'menu-unfold' : 'menu-fold'} />
@@ -533,6 +617,42 @@
             </span>
           </div>
         </Dropdown>
+        {/* 鑿滃崟鎼滅储 */}
+        {!this.props.editState && thdMenuList.length > 0 ?
+          <Dropdown overlayClassName="menu-select-dropdown" getPopupContainer={() => document.getElementById('main-header-container')} overlay={
+            <div>
+              <Search
+                placeholder=""
+                id="thdMenu-search"
+                value={searchkey}
+                onChange={e => this.setState({searchkey: e.target.value})}
+                style={{ minWidth: '200px' }}
+                onSearch={(val, e) => {e.stopPropagation()}}
+                onClick={(e) => {e.stopPropagation()}}
+              />
+              <div className="menu-select-box">
+                <Menu>
+                  {thdMenuList.map(option => {
+                    if (searchkey) {
+                      if (
+                        option.MenuName.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 ||
+                        option.MenuNo.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0 ||
+                        option.EasyCode.toLowerCase().indexOf(searchkey.toLowerCase()) >= 0
+                      ) {
+                        return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item>
+                      } else {
+                        return null
+                      }
+                    }
+                    return <Menu.Item key={option.MenuID} onClick={() => this.selectMenu(option)}>{option.MenuName}</Menu.Item>
+                  })}
+                </Menu>
+              </div>
+            </div>
+          } trigger={['click']} className="search-menu" placement="bottomRight" onVisibleChange={this.dropdownMenuChange}>
+            <Icon className="search-menu" type="search" />
+          </Dropdown> : null
+        }
         {/* 淇敼瀵嗙爜 */}
         <Modal
           title={this.state.dict['header.password']}
@@ -567,6 +687,7 @@
 
 const mapStateToProps = (state) => {
   return {
+    tabviews: state.tabviews,
     collapse: state.collapse,
     selectmenu: state.selectedMainMenu,
     debug: state.debug,
@@ -581,6 +702,7 @@
 const mapDispatchToProps = (dispatch) => {
   return {
     toggleCollapse: (collapse) => dispatch(toggleCollapse(collapse)),
+    modifyTabview: (tabviews) => dispatch(modifyTabview(tabviews)),
     modifyMainMenu: (selectmenu) => dispatch(modifyMainMenu(selectmenu)),
     resetEditState: (state) => dispatch(resetEditState(state)),
     resetEditLevel: (level) => dispatch(resetEditLevel(level)),
diff --git a/src/components/header/index.scss b/src/components/header/index.scss
index 29ac023..1dad49d 100644
--- a/src/components/header/index.scss
+++ b/src/components/header/index.scss
@@ -123,6 +123,13 @@
     margin-left: 10px;
     cursor: pointer;
   }
+  .search-menu {
+    float: right;
+    font-size: 18px;
+    margin-top: 17px;
+    margin-right: 20px;
+    cursor: pointer;
+  }
   .level4-close {
     position: relative;
     top: 13px;
@@ -130,6 +137,49 @@
     height: 26px;
     padding: 0 10px;
   }
+  .menu-select-dropdown {
+    top: 48px!important;
+    box-shadow: 0px 0px 2px #cdcdcd;
+    border-radius: 0 0 4px 4px;
+    background: #ffffff;
+    .ant-input-affix-wrapper {
+      margin-top: 2px;
+    }
+    .menu-select-box {
+      max-height: 200px;
+      min-height: 50px;
+      overflow-y: auto;
+      background: #ffffff;
+      margin-bottom: 3px;
+      .ant-menu {
+        border-radius: 0 0 4px 4px;
+      }
+      .ant-menu-item {
+        padding: 0px 25px;
+        height: 26px;
+        line-height: 26px;
+        color: #000000;
+        cursor: pointer;
+      }
+      .ant-menu-item:hover {
+        background-color: #e6f7ff;
+      }
+    }
+    .menu-select-box::-webkit-scrollbar {
+      width: 7px;
+    }
+    .menu-select-box::-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);
+    }
+    .menu-select-box::-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);
+    }
+  }
 }
 .header-dropdown {
   li {
diff --git a/src/locales/en-US/comtable.js b/src/locales/en-US/comtable.js
index cb65f7b..864c45a 100644
--- a/src/locales/en-US/comtable.js
+++ b/src/locales/en-US/comtable.js
@@ -225,6 +225,7 @@
   'header.form.blacklist': '榛戝悕鍗�',
   'header.form.linkmenu': '鍏宠仈鑿滃崟',
   'header.form.clickscale': '鐐瑰嚮缂╂斁',
+  'header.form.easyCode': '鍔╄鐮�',
   'header.modal.form.edit': '琛ㄥ崟-缂栬緫',
   'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫',
   'header.modal.action.edit': '鎸夐挳-缂栬緫',
diff --git a/src/locales/zh-CN/comtable.js b/src/locales/zh-CN/comtable.js
index aaa9d25..e706c06 100644
--- a/src/locales/zh-CN/comtable.js
+++ b/src/locales/zh-CN/comtable.js
@@ -225,6 +225,7 @@
   'header.form.blacklist': '榛戝悕鍗�',
   'header.form.linkmenu': '鍏宠仈鑿滃崟',
   'header.form.clickscale': '鐐瑰嚮缂╂斁',
+  'header.form.easyCode': '鍔╄鐮�',
   'header.modal.form.edit': '琛ㄥ崟-缂栬緫',
   'header.modal.search.edit': '鎼滅储鏉′欢-缂栬緫',
   'header.modal.action.edit': '鎸夐挳-缂栬緫',
diff --git a/src/tabviews/commontable/index.jsx b/src/tabviews/commontable/index.jsx
index 8252bca..caf6215 100644
--- a/src/tabviews/commontable/index.jsx
+++ b/src/tabviews/commontable/index.jsx
@@ -166,6 +166,7 @@
 
       if (_curUserConfig) {
         config.setting = {...config.setting, ..._curUserConfig.setting}
+        config.easyCode = _curUserConfig.easyCode || config.easyCode || ''
 
         config.action = config.action.map(item => {
           if (item.execMode) {
@@ -1112,9 +1113,12 @@
       return
     }
 
+    let easyCode = userParam[this.props.MenuID] ? userParam[this.props.MenuID].easyCode : ''
+
     let param = {
       func: 'sPC_TrdMenu_UserParam',
       MenuID: this.props.MenuID,
+      EasyCode: easyCode || '',
       LongParam: _LongParam
     }
 
diff --git a/src/tabviews/formtab/index.jsx b/src/tabviews/formtab/index.jsx
index cf03b8e..b577bb7 100644
--- a/src/tabviews/formtab/index.jsx
+++ b/src/tabviews/formtab/index.jsx
@@ -138,15 +138,7 @@
         this.improveSelectOption(config.groups)
 
         if (config.setting.datatype === 'query' && config.setting.onload !== 'false') {
-          if (!this.props.param.primaryId) {
-            notification.warning({
-              top: 92,
-              message: '鏈幏鍙栧埌涓婚敭ID锛�',
-              duration: 10
-            })
-          } else {
-            this.loadmaindata()
-          }
+          this.loadmaindata()
         } else if (config.setting.datatype !== 'query' && (!this.props.param.primaryId || !this.props.param.data)) {
           notification.warning({
             top: 92,
@@ -375,15 +367,7 @@
         duration: 10
       })
       return null
-    } else if (!primaryId) {
-      notification.warning({
-        top: 92,
-        message: '鏈幏鍙栧埌涓婚敭鍊硷紒',
-        duration: 10
-      })
-      return null
     }
-
     
     let param = {
       func: 'sPC_Get_TableData',
diff --git a/src/tabviews/zshare/verifycard/index.jsx b/src/tabviews/zshare/verifycard/index.jsx
index 5442187..7d23bec 100644
--- a/src/tabviews/zshare/verifycard/index.jsx
+++ b/src/tabviews/zshare/verifycard/index.jsx
@@ -35,12 +35,12 @@
     this.setState({
       loadingview: true
     })
-    
 
     menuParam.push({
       uuid: MenuID,
       type: 'main',
       label: MenuName + '(涓昏〃)',
+      easyCode: config.easyCode || '',
       setting: {
         actionfixed: config.setting.actionfixed,
         columnfixed: config.setting.columnfixed,
@@ -313,6 +313,10 @@
           sort: index
         }
       })
+
+      if (tab.type === 'main') {
+        _tab.easyCode = tab.easyCode
+      }
        
       _config[tab.uuid] = _tab
     })
diff --git a/src/tabviews/zshare/verifycard/tabcard/index.jsx b/src/tabviews/zshare/verifycard/tabcard/index.jsx
index 0264edc..2e3c712 100644
--- a/src/tabviews/zshare/verifycard/tabcard/index.jsx
+++ b/src/tabviews/zshare/verifycard/tabcard/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Tabs, Row, Col, Radio, Table, Icon, Select, notification } from 'antd'
+import { Form, Tabs, Row, Col, Radio, Table, Icon, Select, notification, Input } from 'antd'
 
 import ActionForm from './actionform'
 import ColumnForm from './columnform'
@@ -516,6 +516,17 @@
     this.props.handleconfig(config.uuid, subconfig)
   }
 
+  changeEasyCode = ({ target: { value } }) => {
+    const { config } = this.props
+    let subconfig = JSON.parse(JSON.stringify(this.state.subconfig))
+
+    subconfig.easyCode = value
+
+    this.setState({
+      subconfig: subconfig
+    })
+    this.props.handleconfig(config.uuid, subconfig)
+  }
 
   render() {
     const { config } = this.props
@@ -536,23 +547,12 @@
         <TabPane tab="鍩虹璁剧疆" key="1">
           <Form {...formItemLayout}>
             <Row gutter={24}>
-              {config.type === 'main' ? <Col span={8}>
-                <Form.Item label="鍥哄畾鎸夐挳">
-                  <Radio.Group defaultValue={config.setting.actionfixed ? 'true' : 'false'} onChange={this.changebtnfix}>
-                    <Radio value="true">鏄�</Radio>
-                    <Radio value="false">鍚�</Radio>
-                  </Radio.Group>
+              {config.type === 'main' ? <Col span={9}>
+                <Form.Item label="鍔╄鐮�">
+                  <Input defaultValue={config.easyCode} placeholder="" autoComplete="off" onChange={this.changeEasyCode}/>
                 </Form.Item>
               </Col> : null}
-              {config.type === 'main' ? <Col span={8}>
-                <Form.Item label="鍥哄畾琛ㄥご">
-                  <Radio.Group defaultValue={config.setting.columnfixed ? 'true' : 'false'} onChange={this.changecolfix}>
-                    <Radio value="true">鏄�</Radio>
-                    <Radio value="false">鍚�</Radio>
-                  </Radio.Group>
-                </Form.Item>
-              </Col> : null}
-              <Col span={8}>
+              <Col span={9}>
                 <Form.Item label="琛ㄦ牸灞炴��">
                   <Select defaultValue={config.setting.tableType} onChange={this.changecheckbox}>
                     <Select.Option value="">涓嶅彲閫�</Select.Option>
@@ -561,6 +561,22 @@
                   </Select>
                 </Form.Item>
               </Col>
+              {config.type === 'main' ? <Col span={9}>
+                <Form.Item label="鍥哄畾鎸夐挳">
+                  <Radio.Group defaultValue={config.setting.actionfixed ? 'true' : 'false'} onChange={this.changebtnfix}>
+                    <Radio value="true">鏄�</Radio>
+                    <Radio value="false">鍚�</Radio>
+                  </Radio.Group>
+                </Form.Item>
+              </Col> : null}
+              {config.type === 'main' ? <Col span={9}>
+                <Form.Item label="鍥哄畾琛ㄥご">
+                  <Radio.Group defaultValue={config.setting.columnfixed ? 'true' : 'false'} onChange={this.changecolfix}>
+                    <Radio value="true">鏄�</Radio>
+                    <Radio value="false">鍚�</Radio>
+                  </Radio.Group>
+                </Form.Item>
+              </Col> : null}
             </Row>
           </Form>
         </TabPane>
diff --git a/src/templates/comtableconfig/index.jsx b/src/templates/comtableconfig/index.jsx
index e328ef9..832bea2 100644
--- a/src/templates/comtableconfig/index.jsx
+++ b/src/templates/comtableconfig/index.jsx
@@ -80,7 +80,8 @@
     thawBtnVisible: false,   // 瑙e喕鎸夐挳寮圭獥
     thawbtnlist: null,       // 瑙e喕鎸夐挳鍒楄〃
     thawButtons: [],         // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳
-    activeKey: '0'           // 榛樿灞曞紑鍩烘湰淇℃伅
+    activeKey: '0',          // 榛樿灞曞紑鍩烘湰淇℃伅
+    sqlVerifing: false       // sql楠岃瘉
   }
 
   /**
@@ -124,6 +125,7 @@
     _config.tabgroups = _config.tabgroups || ['tabs']
     _config.setting.subtabs = _config.setting.subtabs || []
     _config.Template = 'CommonTable'
+    _config.easyCode = _config.easyCode || ''
     
     let _oriActions = []
     if (_config.type === 'user') {
@@ -224,6 +226,14 @@
             MenuID: 'currenttab',
             text: this.state.dict['header.form.currenttab']
           }]
+        },
+        {
+          type: 'text',
+          key: 'easyCode',
+          label: this.state.dict['header.form.easyCode'],
+          initVal: _config.easyCode,
+          required: false,
+          readonly: false
         }
       ]
     })
@@ -733,11 +743,46 @@
 
         _search = _search.filter(item => !item.origin)
 
-        this.setState({
-          config: {...config, search: _search},
-          optionLibs: optionLibs,
-          modaltype: ''
-        })
+        if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
+          this.setState({
+            sqlVerifing: true
+          })
+  
+          let param = {
+            func: 's_debug_sql',
+            LText: res.dataSource
+          }
+          param.LText = Utils.formatOptions(param.LText)
+          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+          param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+  
+          if (window.GLOB.mainSystemApi && res.database === 'sso') {
+            param.rduri = window.GLOB.mainSystemApi
+          }
+          
+          Api.getLocalConfig(param).then(result => {
+            if (result.status) {
+              this.setState({
+                sqlVerifing: false,
+                config: {...config, search: _search},
+                optionLibs: optionLibs,
+                modaltype: ''
+              })
+            } else {
+              this.setState({sqlVerifing: false})
+              
+              Modal.error({
+                title: result.message
+              })
+            }
+          })
+        } else {
+          this.setState({
+            config: {...config, search: _search},
+            optionLibs: optionLibs,
+            modaltype: ''
+          })
+        }
       })
     } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') {
       this.actionFormRef.handleConfirm().then(res => {
@@ -1512,7 +1557,7 @@
       }
 
       let _LongParam = ''
-      let _config = {...config, tables: this.state.selectedTables}
+      let _config = {...config, tables: this.state.selectedTables, easyCode: res.easyCode}
       let _pageParam = {...menu.PageParam, OpenType: res.opentype}
 
       // 鏈缃暟鎹簮鎴栨爣绛句笉鍚堟硶鏃讹紝鍚敤鐘舵�佷负false
@@ -1731,6 +1776,7 @@
           ParentID: res.parentId,
           MenuID: menu.MenuID,
           MenuNo: res.menuNo,
+          EasyCode: res.easyCode,
           Template: menu.PageParam.Template || '',
           MenuName: res.menuName,
           PageParam: JSON.stringify(_pageParam),
@@ -2098,7 +2144,7 @@
       })
     } else {
       this.menuformRef.handleConfirm().then(res => {
-        let _config = {...config, tables: this.state.selectedTables}
+        let _config = {...config, tables: this.state.selectedTables, easyCode: res.easyCode}
         let _pageParam = {...menu.PageParam, OpenType: res.opentype}
         let _originMenu = {
           ...originMenu,
@@ -2436,10 +2482,71 @@
         Api.getLocalConfig(param)
       }
 
-      this.setState({
-        config: {...config, setting: res},
-        settingVisible: false,
-      })
+      
+
+      if (res.interType === 'inner' && !res.innerFunc && /\s/.test(res.dataresource)) {
+        this.setState({
+          sqlVerifing: true
+        })
+
+        let _dataresource = res.dataresource
+
+        if (res.queryType === 'statistics') {
+          let fieldmap = new Map()
+          let options = config.search.map(item => {
+            let _field = item.key
+            let _val = ''
+
+            if (fieldmap.has(_field)) {
+              _field = _field + '1'
+            }
+
+            fieldmap.set(item.key, true)
+
+            if (/date/.test(item.type)) {
+              _val = '1900-01-01'
+            }
+
+            return {
+              reg: new RegExp('@' + _field + '@', 'ig'),
+              value: _val
+            }
+          })
+
+          options.forEach(item => {
+            _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
+          })
+        }
+
+        let param = {
+          func: 's_debug_sql',
+          LText: _dataresource
+        }
+        param.LText = Utils.formatOptions(param.LText)
+        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+        
+        Api.getLocalConfig(param).then(result => {
+          if (result.status) {
+            this.setState({
+              sqlVerifing: false,
+              config: {...config, setting: res},
+              settingVisible: false
+            })
+          } else {
+            this.setState({sqlVerifing: false})
+            
+            Modal.error({
+              title: result.message
+            })
+          }
+        })
+      } else {
+        this.setState({
+          config: {...config, setting: res},
+          settingVisible: false
+        })
+      }
     })
   }
 
@@ -2458,7 +2565,7 @@
       })
     } else {
       this.menuformRef.handleConfirm().then(res => {
-        let _config = {...config, tables: this.state.selectedTables}
+        let _config = {...config, tables: this.state.selectedTables, easyCode: res.easyCode}
         let _pageParam = {...menu.PageParam, OpenType: res.opentype}
         let _originMenu = {
           ...originMenu,
@@ -3115,6 +3222,7 @@
           width={700}
           maskClosable={false}
           onOk={this.handleSubmit}
+          confirmLoading={this.state.sqlVerifing}
           onCancel={this.editModalCancel}
           destroyOnClose
         >
@@ -3310,7 +3418,7 @@
             <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>,
             <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>,
             <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>,
-            <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button>
+            <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button>
           ]}
           destroyOnClose
         >
diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx
index f38b376..d577483 100644
--- a/src/templates/formtabconfig/index.jsx
+++ b/src/templates/formtabconfig/index.jsx
@@ -69,7 +69,8 @@
     groupVisible: false,     // 缂栬緫缁勬ā鎬佹
     optionLibs: null,        // 鑷畾涔変笅鎷夐�夐」搴�
     activeKey: '0',          // 榛樿灞曞紑鍩烘湰淇℃伅
-    pasteVisible: false      // 绮樿创妯℃�佹
+    pasteVisible: false,     // 绮樿创妯℃�佹
+    sqlVerifing: false       // sql楠岃瘉
   }
 
   /**
@@ -723,11 +724,46 @@
           return
         }
 
-        this.setState({
-          config: {..._config, groups: _groups},
-          optionLibs: optionLibs,
-          modaltype: ''
-        })
+        if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
+          this.setState({
+            sqlVerifing: true
+          })
+  
+          let param = {
+            func: 's_debug_sql',
+            LText: res.dataSource
+          }
+          param.LText = Utils.formatOptions(param.LText)
+          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+          param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+  
+          if (window.GLOB.mainSystemApi && res.database === 'sso') {
+            param.rduri = window.GLOB.mainSystemApi
+          }
+          
+          Api.getLocalConfig(param).then(result => {
+            if (result.status) {
+              this.setState({
+                sqlVerifing: false,
+                config: {..._config, groups: _groups},
+                optionLibs: optionLibs,
+                modaltype: ''
+              })
+            } else {
+              this.setState({sqlVerifing: false})
+
+              Modal.error({
+                title: result.message
+              })
+            }
+          })
+        } else {
+          this.setState({
+            config: {..._config, groups: _groups},
+            optionLibs: optionLibs,
+            modaltype: ''
+          })
+        }
       })
     } else if (modaltype === 'actionEdit') {
       this.actionFormRef.handleConfirm().then(res => {
@@ -1583,10 +1619,41 @@
         Api.getLocalConfig(param)
       }
 
-      this.setState({
-        config: {...config, setting: res},
-        settingVisible: false,
-      })
+      if (res.interType === 'inner' && !res.innerFunc && res.dataresource && /\s/.test(res.dataresource)) {
+        this.setState({
+          sqlVerifing: true
+        })
+
+        let param = {
+          func: 's_debug_sql',
+          LText: res.dataresource
+        }
+
+        param.LText = Utils.formatOptions(param.LText)
+        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+        
+        Api.getLocalConfig(param).then(result => {
+          if (result.status) {
+            this.setState({
+              sqlVerifing: false,
+              config: {...config, setting: res},
+              settingVisible: false
+            })
+          } else {
+            this.setState({sqlVerifing: false})
+            
+            Modal.error({
+              title: result.message
+            })
+          }
+        })
+      } else {
+        this.setState({
+          config: {...config, setting: res},
+          settingVisible: false
+        })
+      }
     })
   }
 
@@ -2123,6 +2190,7 @@
           width={700}
           maskClosable={false}
           onOk={this.handleSubmit}
+          confirmLoading={this.state.sqlVerifing}
           onCancel={this.editModalCancel}
           destroyOnClose
         >
@@ -2238,7 +2306,7 @@
           footer={[
             <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>,
             <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>,
-            <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button>
+            <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button>
           ]}
           destroyOnClose
         >
diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 620b41b..1557bfb 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -68,7 +68,8 @@
     curgroup: null,        // 褰撳墠缁勶紝鏂板缓鎴栫紪杈�
     optionLibs: null,      // 鑷畾涔変笅鎷夐�夐」搴�
     sources: null,         // 琛ㄥ崟绫诲瀷
-    pasteVisible: null     // 琛ㄥ崟绮樿创
+    pasteVisible: null,    // 琛ㄥ崟绮樿创
+    sqlVerifing: false     // sql楠岃瘉
   }
 
   /**
@@ -633,13 +634,50 @@
 
       _config.fields = _config.fields.filter(item => !item.origin)
 
-      this.setState({
-        config: _config,
-        modalType: null,
-        card: null,
-        optionLibs: optionLibs,
-        visible: false
-      })
+      if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
+        this.setState({
+          sqlVerifing: true
+        })
+
+        let param = {
+          func: 's_debug_sql',
+          LText: res.dataSource
+        }
+        param.LText = Utils.formatOptions(param.LText)
+        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+
+        if (window.GLOB.mainSystemApi && res.database === 'sso') {
+          param.rduri = window.GLOB.mainSystemApi
+        }
+        
+        Api.getLocalConfig(param).then(result => {
+          if (result.status) {
+            this.setState({
+              sqlVerifing: false,
+              config: _config,
+              modalType: null,
+              card: null,
+              optionLibs: optionLibs,
+              visible: false
+            })
+          } else {
+            this.setState({sqlVerifing: false})
+            
+            Modal.error({
+              title: result.message
+            })
+          }
+        })
+      } else {
+        this.setState({
+          config: _config,
+          modalType: null,
+          card: null,
+          optionLibs: optionLibs,
+          visible: false
+        })
+      }
     })
   }
 
@@ -1341,6 +1379,7 @@
           width={700}
           onCancel={this.editModalCancel}
           onOk={this.handleSubmit}
+          confirmLoading={this.state.sqlVerifing}
           destroyOnClose
         >
           {<ModalForm
diff --git a/src/templates/subtableconfig/index.jsx b/src/templates/subtableconfig/index.jsx
index 8bab18e..692a4df 100644
--- a/src/templates/subtableconfig/index.jsx
+++ b/src/templates/subtableconfig/index.jsx
@@ -85,7 +85,8 @@
     thawBtnVisible: false,   // 瑙e喕鎸夐挳寮圭獥
     thawbtnlist: null,       // 瑙e喕鎸夐挳鍒楄〃
     thawButtons: [],         // 宸查�夋嫨瑕佽В鍐荤殑鎸夐挳
-    activeKey: '0'           // 榛樿灞曞紑鍩烘湰淇℃伅
+    activeKey: '0',          // 榛樿灞曞紑鍩烘湰淇℃伅
+    sqlVerifing: false       // sql楠岃瘉
   }
 
   /**
@@ -597,11 +598,46 @@
 
         _search = _search.filter(item => !item.origin)
 
-        this.setState({
-          config: {...config, search: _search},
-          optionLibs: optionLibs,
-          modaltype: ''
-        })
+        if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
+          this.setState({
+            sqlVerifing: true
+          })
+  
+          let param = {
+            func: 's_debug_sql',
+            LText: res.dataSource
+          }
+          param.LText = Utils.formatOptions(param.LText)
+          param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+          param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+  
+          if (window.GLOB.mainSystemApi && res.database === 'sso') {
+            param.rduri = window.GLOB.mainSystemApi
+          }
+          
+          Api.getLocalConfig(param).then(result => {
+            if (result.status) {
+              this.setState({
+                sqlVerifing: false,
+                config: {...config, search: _search},
+                optionLibs: optionLibs,
+                modaltype: ''
+              })
+            } else {
+              this.setState({sqlVerifing: false})
+              
+              Modal.error({
+                title: result.message
+              })
+            }
+          })
+        } else {
+          this.setState({
+            config: {...config, search: _search},
+            optionLibs: optionLibs,
+            modaltype: ''
+          })
+        }
       })
     } else if (modaltype === 'actionEdit' || modaltype === 'actionCopy') {
       this.actionFormRef.handleConfirm().then(res => {
@@ -1888,10 +1924,69 @@
         Api.getLocalConfig(param)
       }
 
-      this.setState({
-        config: {...config, setting: res},
-        settingVisible: false,
-      })
+      if (res.interType === 'inner' && !res.innerFunc && res.dataresource && /\s/.test(res.dataresource)) {
+        this.setState({
+          sqlVerifing: true
+        })
+
+        let _dataresource = res.dataresource
+
+        if (res.queryType === 'statistics') {
+          let fieldmap = new Map()
+          let options = config.search.map(item => {
+            let _field = item.key
+            let _val = ''
+
+            if (fieldmap.has(_field)) {
+              _field = _field + '1'
+            }
+
+            fieldmap.set(item.key, true)
+
+            if (/date/.test(item.type)) {
+              _val = '1900-01-01'
+            }
+
+            return {
+              reg: new RegExp('@' + _field + '@', 'ig'),
+              value: _val
+            }
+          })
+
+          options.forEach(item => {
+            _dataresource = _dataresource.replace(item.reg, `'${item.value}'`)
+          })
+        }
+
+        let param = {
+          func: 's_debug_sql',
+          LText: _dataresource
+        }
+        param.LText = Utils.formatOptions(param.LText)
+        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+        
+        Api.getLocalConfig(param).then(result => {
+          if (result.status) {
+            this.setState({
+              sqlVerifing: false,
+              config: {...config, setting: res},
+              settingVisible: false
+            })
+          } else {
+            this.setState({sqlVerifing: false})
+            
+            Modal.error({
+              title: result.message
+            })
+          }
+        })
+      } else {
+        this.setState({
+          config: {...config, setting: res},
+          settingVisible: false
+        })
+      }
     })
   }
 
@@ -2411,6 +2506,7 @@
           width={700}
           maskClosable={false}
           onOk={this.handleSubmit}
+          confirmLoading={this.state.sqlVerifing}
           onCancel={this.editModalCancel}
           destroyOnClose
         >
@@ -2579,7 +2675,7 @@
             <CreateInterface key="interface" dict={this.state.dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>,
             <CreateFunc key="create" dict={this.state.dict} ref="tableCreatFunc" trigger={this.tableCreatFunc}/>,
             <Button key="cancel" onClick={() => { this.setState({ settingVisible: false }) }}>{this.state.dict['header.cancel']}</Button>,
-            <Button key="confirm" type="primary" onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button>
+            <Button key="confirm" type="primary" loading={this.state.sqlVerifing} onClick={this.settingSave}>{this.state.dict['header.confirm']}</Button>
           ]}
           destroyOnClose
         >
diff --git a/src/templates/zshare/columnform/index.jsx b/src/templates/zshare/columnform/index.jsx
index 40d8022..1fce667 100644
--- a/src/templates/zshare/columnform/index.jsx
+++ b/src/templates/zshare/columnform/index.jsx
@@ -32,7 +32,7 @@
     let _type = this.props.formlist.filter(form => form.key === 'type')[0].initVal
     let _menulist = this.props.formlist.filter(form => form.key === 'linkmenu')[0] || ''
 
-    let _options = columnTypeOptions[_type]
+    let _options = JSON.parse(JSON.stringify(columnTypeOptions[_type]))
 
     this.setState({
       menulist: _menulist.options || [],
@@ -63,7 +63,7 @@
 
   typeChange = (key, value) => {
     if (key === 'type') {
-      let _options = columnTypeOptions[value]
+      let _options = JSON.parse(JSON.stringify(columnTypeOptions[value]))
 
       this.setState({
         formlist: this.props.formlist.map(item => {
diff --git a/src/templates/zshare/modalform/index.jsx b/src/templates/zshare/modalform/index.jsx
index d81a7e0..f8396a3 100644
--- a/src/templates/zshare/modalform/index.jsx
+++ b/src/templates/zshare/modalform/index.jsx
@@ -69,7 +69,7 @@
       }
     })
     
-    let _options = modalTypeOptions[type]
+    let _options = JSON.parse(JSON.stringify(modalTypeOptions[type]))
 
     if ((type === 'multiselect' || type === 'select' || type === 'link') && resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮
       _options = [..._options, 'options', 'quick']
@@ -128,7 +128,7 @@
 
   openTypeChange = (key, value) => {
     if (key === 'type') {
-      let _options = modalTypeOptions[value]
+      let _options = JSON.parse(JSON.stringify(modalTypeOptions[value]))
 
       if ((value === 'multiselect' || value === 'select' || value === 'link') && this.state.resourceType === '0') { // 閫夋嫨绫诲瀷銆佽嚜瀹氫箟璧勬簮
         _options = [..._options, 'options', 'quick']
@@ -241,7 +241,7 @@
     const { openType } = this.state
     let value = e.target.value
     if (key === 'resourceType') {
-      let _options = modalTypeOptions[openType]
+      let _options = JSON.parse(JSON.stringify(modalTypeOptions[openType]))
 
       if (value === '0') {
         _options = [..._options, 'options', 'quick']
diff --git a/src/templates/zshare/verifycard/customform/index.jsx b/src/templates/zshare/verifycard/customform/index.jsx
index 2217988..68c83e2 100644
--- a/src/templates/zshare/verifycard/customform/index.jsx
+++ b/src/templates/zshare/verifycard/customform/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Select, Button, notification } from 'antd'
+import { Form, Row, Col, Input, Select, Button, notification, Modal } from 'antd'
 import moment from 'moment'
 
 import Utils from '@/utils/utils.js'
@@ -96,10 +96,9 @@
             })
           } else {
             this.setState({loading: false})
-            notification.warning({
-              top: 92,
-              message: res.message,
-              duration: 10
+            
+            Modal.error({
+              title: res.message
             })
           }
         })
diff --git a/src/templates/zshare/verifycard/customscript/index.jsx b/src/templates/zshare/verifycard/customscript/index.jsx
index 3802050..52f237b 100644
--- a/src/templates/zshare/verifycard/customscript/index.jsx
+++ b/src/templates/zshare/verifycard/customscript/index.jsx
@@ -1,6 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Button, notification } from 'antd'
+import { Form, Row, Col, Input, Button, notification, Modal } from 'antd'
 import moment from 'moment'
 
 import Utils from '@/utils/utils.js'
@@ -91,10 +91,9 @@
             })
           } else {
             this.setState({loading: false})
-            notification.warning({
-              top: 92,
-              message: res.message,
-              duration: 10
+
+            Modal.error({
+              title: res.message
             })
           }
         })
diff --git a/src/templates/zshare/verifycardexcelin/customscript/index.jsx b/src/templates/zshare/verifycardexcelin/customscript/index.jsx
index 7302369..51513c3 100644
--- a/src/templates/zshare/verifycardexcelin/customscript/index.jsx
+++ b/src/templates/zshare/verifycardexcelin/customscript/index.jsx
@@ -1,6 +1,10 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
-import { Form, Row, Col, Input, Button, notification } from 'antd'
+import { Form, Row, Col, Input, Button, notification, Modal } from 'antd'
+import moment from 'moment'
+
+import Utils from '@/utils/utils.js'
+import Api from '@/api'
 import './index.scss'
 
 const { TextArea } = Input
@@ -11,23 +15,34 @@
     btn: PropTypes.object,          // 鎸夐挳淇℃伅
     scripts: PropTypes.array,       // 鑷畾涔夎剼鏈垪琛�
     isdefault: PropTypes.any,       // 鏄惁浣跨敤榛樿sql
-    usefulfields: PropTypes.string, // 鍙敤瀛楁
+    usefulfields: PropTypes.any,    // 鍙敤瀛楁
     scriptsChange: PropTypes.func   // 琛ㄥ崟
   }
 
   state = {
     editItem: null,
-    usefulfields: null
+    usefulfields: null,
+    loading: false,
+    verifySql: ''
   }
 
   UNSAFE_componentWillMount () {
-    const {usefulfields} = this.props
+    const {usefulfields, btn} = this.props
 
     let fields = usefulfields.map(item => item.Column)
-    fields = ['BID', 'ID', ...fields]
-    fields = Array.from(new Set(fields))
+    if (!fields.includes('ID')) {
+      fields.unshift('ID')
+    }
+    if (!fields.includes('BID')) {
+      fields.unshift('BID')
+    }
 
+    let _sql = `Declare @${btn.sheet} table (${usefulfields.map(item => item.Column + ' ' + item.type).join(',')},jskey nvarchar(50) )
+      Declare @UserName nvarchar(50),@FullName nvarchar(50)
+    `
+    
     this.setState({
+      verifySql: _sql,
       usefulfields: fields.join(', ')
     })
   }
@@ -40,7 +55,7 @@
 
       this.props.form.setFieldsValue({
         sql: `Insert into ${btn.sheet} (${fields},createuserid,createuser,createstaff,bid) 
-        Select ${fields},@userid,@username,@fullname,@BID From @${btn.sheet}`
+        Select ${fields},@userid@,@username,@fullname,@BID@ From @${btn.sheet}`
       })
     }
   }
@@ -106,12 +121,32 @@
           return
         }
 
-        this.props.scriptsChange(values)
-        this.setState({
-          editItem: null
-        })
-        this.props.form.setFieldsValue({
-          sql: ''
+        let param = {
+          func: 's_debug_sql',
+          LText: this.state.verifySql + values.sql
+        }
+        param.LText = Utils.formatOptions(param.LText)
+        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + '.000'
+        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+        
+        this.setState({loading: true})
+        Api.getLocalConfig(param).then(res => {
+          if (res.status) {
+            this.props.scriptsChange(values)
+            this.setState({
+              loading: false,
+              editItem: null
+            })
+            this.props.form.setFieldsValue({
+              sql: ''
+            })
+          } else {
+            this.setState({loading: false})
+
+            Modal.error({
+              title: res.message
+            })
+          }
         })
       }
     })
@@ -153,7 +188,7 @@
             </Form.Item>
           </Col>
           <Col span={3} className="add">
-            <Button onClick={this.handleConfirm} type="primary" className="add-row">
+            <Button onClick={this.handleConfirm} loading={this.state.loading} type="primary" className="add-row">
               纭畾
             </Button>
           </Col>
diff --git a/src/templates/zshare/verifycardexcelin/index.jsx b/src/templates/zshare/verifycardexcelin/index.jsx
index 3113e4e..c249aeb 100644
--- a/src/templates/zshare/verifycardexcelin/index.jsx
+++ b/src/templates/zshare/verifycardexcelin/index.jsx
@@ -10,6 +10,7 @@
 import './index.scss'
 
 const { TabPane } = Tabs
+const { confirm } = Modal
 
 class VerifyCard extends Component {
   static propTpyes = {
@@ -19,6 +20,7 @@
   }
 
   state = {
+    updateloading: false, // 淇敼涓�
     verify: {},
     excelColumns: [
       {
@@ -281,6 +283,8 @@
 
     this.setState({
       verify: verify
+    }, () => {
+      this.updateChange()
     })
   }
 
@@ -302,6 +306,8 @@
 
     this.setState({
       verify: verify
+    }, () => {
+      this.updateChange()
     })
   }
 
@@ -323,6 +329,23 @@
 
     this.setState({
       verify: verify
+    }, () => {
+      this.updateChange()
+    })
+  }
+
+  updateChange = () => {
+    let _loading = false
+    if (this.columnForm && this.columnForm.state.editItem) {
+      _loading = true
+    } else if (this.scriptsForm && this.scriptsForm.state.editItem) {
+      _loading = true
+    } else if (this.uniqueForm && this.uniqueForm.state.editItem) {
+      _loading = true
+    }
+
+    this.setState({
+      updateloading: _loading
     })
   }
 
@@ -363,6 +386,10 @@
         }
       }, 10)
     }
+
+    this.setState({
+      updateloading: true
+    })
   }
 
   handleStatus = (record, type) => {
@@ -491,7 +518,19 @@
             }
           }
 
-          resolve(_verify)
+          if (this.state.updateloading) {
+            confirm({
+              content: `瀛樺湪鏈繚瀛橀」锛岀‘瀹氭彁浜ゅ悧锛焋,
+              okText: this.props.dict['header.confirm'],
+              cancelText: this.props.dict['header.cancel'],
+              onOk() {
+                resolve(_verify)
+              },
+              onCancel() {}
+            })
+          } else {
+            resolve(_verify)
+          }
         } else {
           notification.warning({
             top: 92,

--
Gitblit v1.8.0