From 53b9fb93d0376eb02bb996935f1720b4e95cd897 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 12 十月 2022 14:41:06 +0800
Subject: [PATCH] 2022-10-12

---
 src/menu/components/share/searchcomponent/index.jsx |   53 ++++++++++++++++++++++-------------------------------
 1 files changed, 22 insertions(+), 31 deletions(-)

diff --git a/src/menu/components/share/searchcomponent/index.jsx b/src/menu/components/share/searchcomponent/index.jsx
index 66c998f..e03d2e9 100644
--- a/src/menu/components/share/searchcomponent/index.jsx
+++ b/src/menu/components/share/searchcomponent/index.jsx
@@ -1,7 +1,6 @@
 import React, {Component} from 'react'
 import PropTypes from 'prop-types'
 import { is, fromJS } from 'immutable'
-import {connect} from 'react-redux'
 import { Modal, notification } from 'antd'
 import moment from 'moment'
 
@@ -25,7 +24,7 @@
   }
 
   state = {
-    dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
+    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     searchlist: null,    // 鎼滅储鏉′欢闆�
     sqlVerifing: false,  // sql楠岃瘉涓�
     visible: false,      // 妯℃�佹鎺у埗
@@ -103,18 +102,20 @@
     let linkableFields = []
 
     searchlist.forEach(item => {
-      if (item.uuid !== card.uuid && (item.type === 'select' || item.type === 'link')) {
-        linkableFields.push({
-          value: item.field,
-          text: item.label
-        })
-      }
+      if (item.uuid === card.uuid) return
+      if (!['select', 'link', 'checkcard'].includes(item.type)) return
+      if (item.type === 'checkcard' && item.multiple === 'true') return
+      
+      linkableFields.push({
+        value: item.field,
+        text: item.label
+      })
     })
 
     this.setState({
       visible: true,
       card: card,
-      formlist: getSearchForm(card, linkableFields)
+      formlist: getSearchForm(card, linkableFields, [], 'header')
     })
   }
 
@@ -198,40 +199,41 @@
       if (fieldrepet) {
         notification.warning({
           top: 92,
-          message: this.state.dict['model.field.exist'] + ' !',
+          message: '瀛楁宸插瓨鍦�!',
           duration: 5
         })
         return
       } else if (labelrepet) {
         notification.warning({
           top: 92,
-          message: this.state.dict['model.name.exist'] + ' !',
+          message: '鍚嶇О宸插瓨鍦�!',
           duration: 5
         })
         return
       }
 
-      if ((res.type === 'select' || res.type === 'multiselect' || res.type === 'link') && res.resourceType === '1' && /\s/.test(res.dataSource)) {
+      if (['select', 'multiselect', 'link', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) {
         this.setState({
           sqlVerifing: true
         })
 
         let param = {
           func: 's_debug_sql',
+          exec_type: 'y',
           LText: res.dataSource
         }
 
-        param.LText = param.LText.replace(/@\$|\$@/ig, '')
+        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+        param.LText = param.LText.replace(/@\$|\$@/ig, '').replace(/@(BID|ID|LoginUID|SessionUid|UserID|Appkey|time_id)@/ig, `'${param.timestamp}'`)
         
         param.LText = Utils.formatOptions(param.LText)
-        param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
-        param.secretkey = Utils.encrypt(param.LText, param.timestamp)
+        param.secretkey = Utils.encrypt('', param.timestamp)
 
         if (window.GLOB.mainSystemApi && res.database === 'sso') {
           param.rduri = window.GLOB.mainSystemApi
         }
         
-        Api.getLocalConfig(param).then(result => {
+        Api.genericInterface(param).then(result => {
           if (result.status) {
             this.setState({
               sqlVerifing: false,
@@ -264,11 +266,10 @@
    */
   deleteElement = (card) => {
     const { config } = this.props
-    const { dict } = this.state
     let _this = this
 
     confirm({
-      content: dict['model.confirm'] + dict['model.delete'] + ` - ${card.label} 锛焋,
+      content: `纭畾鍒犻櫎 - ${card.label} 锛焋,
       onOk() {
         let _searchlist = fromJS(_this.state.searchlist).toJS()
 
@@ -288,7 +289,7 @@
     const { dict, searchlist, visible, sqlVerifing } = this.state
 
     return (
-      <div className="model-custom-header-search-list">
+      <div className={'model-custom-header-search-list search-length' + (searchlist.length)}>
         <DragElement
           list={searchlist}
           handleList={this.handleList}
@@ -297,7 +298,7 @@
         />
         {/* 缂栬緫鎼滅储鏉′欢 */}
         <Modal
-          title={dict['model.searchCriteria'] + '-' + dict['model.edit']}
+          title="鎼滅储鏉′欢-缂栬緫"
           visible={visible}
           width={850}
           maskClosable={false}
@@ -319,14 +320,4 @@
   }
 }
 
-const mapStateToProps = (state) => {
-  return {
-    menu: state.customMenu
-  }
-}
-
-const mapDispatchToProps = () => {
-  return {}
-}
-
-export default connect(mapStateToProps, mapDispatchToProps)(SearchComponent)
\ No newline at end of file
+export default SearchComponent
\ No newline at end of file

--
Gitblit v1.8.0