From c29a1e1c8278a25b83b6158c2d426aa26c427569 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 01 九月 2021 16:18:30 +0800
Subject: [PATCH] 2021-09-01

---
 src/menu/components/form/formaction/formconfig.jsx             |    5 ++
 src/utils/utils-datamanage.js                                  |   41 ++++++++++----------
 src/menu/components/share/actioncomponent/actionform/index.jsx |    2 +
 src/mob/searchconfig/index.jsx                                 |   28 +++++++++----
 src/templates/sharecomponent/tablecomponent/index.jsx          |    4 +
 src/tabviews/custom/index.jsx                                  |    8 ++--
 src/tabviews/custom/components/share/tabtransfer/index.jsx     |    2 
 src/views/appmanage/index.jsx                                  |    7 ++-
 src/menu/components/share/actioncomponent/formconfig.jsx       |    2 
 src/tabviews/custom/components/group/normal-group/index.jsx    |    2 
 src/menu/components/form/formaction/actionform/index.jsx       |    1 
 src/views/appmanage/submutilform/index.jsx                     |   17 ++++++++
 12 files changed, 78 insertions(+), 41 deletions(-)

diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx
index 381cf64..bdf1bf0 100644
--- a/src/menu/components/form/formaction/actionform/index.jsx
+++ b/src/menu/components/form/formaction/actionform/index.jsx
@@ -247,6 +247,7 @@
                   filterOption={(input, option) => option.props.children[2].toLowerCase().indexOf(input.toLowerCase()) >= 0}
                   onChange={(value) => {this.optionChange(item.key, value)}}
                   getPopupContainer={() => document.getElementById('winter')}
+                  allowClear={item.allowClear}
                 >
                   {item.options.map((option, index) =>
                     <Select.Option id={`${index}`} title={option.text} key={`${index}`} value={option.value}>
diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx
index f6e1da1..63770ba 100644
--- a/src/menu/components/form/formaction/formconfig.jsx
+++ b/src/menu/components/form/formaction/formconfig.jsx
@@ -31,7 +31,9 @@
     } else {
       menulist = []
     }
-    menulist.unshift({value: '', text: '鏃�'})
+    if (appType === 'mob') {
+      menulist.push({value: 'goback', text: '杩斿洖'})
+    }
   } else {
     menulist = sessionStorage.getItem('fstMenuList')
     if (menulist) {
@@ -248,6 +250,7 @@
       tooltip: '鎵ц鎴愬姛鍚庨渶瑕佹墦寮�鐨勮彍鍗曘��',
       initVal: card.linkmenu,
       required: false,
+      allowClear: true,
       options: menulist
     },
     {
diff --git a/src/menu/components/share/actioncomponent/actionform/index.jsx b/src/menu/components/share/actioncomponent/actionform/index.jsx
index c5ebebb..8fdc523 100644
--- a/src/menu/components/share/actioncomponent/actionform/index.jsx
+++ b/src/menu/components/share/actioncomponent/actionform/index.jsx
@@ -177,6 +177,8 @@
         }
       } else if (_funcType === 'mkBinding' || _funcType === 'mkUnBinding') {
         _options.push('execSuccess', 'execError')
+      } else if (_funcType === 'scan') {
+        _options.push('openmenu')
       } else if (_funcType === 'closetab') {
         _options.push('refreshTab')
       }
diff --git a/src/menu/components/share/actioncomponent/formconfig.jsx b/src/menu/components/share/actioncomponent/formconfig.jsx
index 04945f0..99bdf90 100644
--- a/src/menu/components/share/actioncomponent/formconfig.jsx
+++ b/src/menu/components/share/actioncomponent/formconfig.jsx
@@ -563,7 +563,7 @@
       forbid: appType !== 'pc' && appType !== 'mob',
       required: false,
       allowClear: true,
-      options: appMenus
+      options: appType !== 'mob' ? appMenus : [...appMenus, {value: 'goback', text: '杩斿洖'}]
     },
     {
       type: 'text',
diff --git a/src/mob/searchconfig/index.jsx b/src/mob/searchconfig/index.jsx
index 1d388a5..2ad5662 100644
--- a/src/mob/searchconfig/index.jsx
+++ b/src/mob/searchconfig/index.jsx
@@ -15,6 +15,7 @@
 import SettingForm from './settingform'
 import asyncComponent from '@/utils/asyncComponent'
 import { SearchItems } from './source'
+import MKEmitter from '@/utils/events.js'
 import './index.scss'
 
 const { Panel } = Collapse
@@ -43,7 +44,8 @@
     sqlVerifing: false,    // sql楠岃瘉
     showField: false,      // 鏄剧ず琛ㄥ崟瀛楁鍊�
     group: null,
-    editGroup: null
+    editGroup: null,
+    saving: false
   }
 
   /**
@@ -59,6 +61,10 @@
     })
   }
 
+  componentDidMount () {
+    MKEmitter.addListener('completeSave', this.completeSave)
+  }
+
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
    */
@@ -66,6 +72,11 @@
     this.setState = () => {
       return
     }
+    MKEmitter.removeListener('completeSave', this.completeSave)
+  }
+
+  completeSave = () => {
+    this.setState({saving: false})
   }
 
   /**
@@ -275,13 +286,12 @@
   submitConfig = () => {
     const { config } = this.state
 
-    this.setState({originConfig: fromJS(config).toJS()})
+    this.setState({originConfig: fromJS(config).toJS(), saving: true})
     this.props.handleSave(config)
-    notification.success({
-      top: 92,
-      message: '淇濆瓨鎴愬姛銆�',
-      duration: 1
-    })
+
+    setTimeout(() => {
+      MKEmitter.emit('triggerMenuSave')
+    }, 100)
   }
 
   cancelConfig = () => {
@@ -461,7 +471,7 @@
   }
 
   render () {
-    const { dict, group, editGroup } = this.state
+    const { dict, group, editGroup, saving } = this.state
     return (
       <div className="mob-search-board">
         <DndProvider backend={HTML5Backend}>
@@ -477,7 +487,7 @@
             </Collapse>
           </div>
           <div className="modal-control">
-            <Button type="primary" onClick={this.submitConfig}>淇濆瓨</Button>
+            <Button type="primary" loading={saving} onClick={this.submitConfig}>淇濆瓨</Button>
             <Button onClick={this.cancelConfig}>鍏抽棴</Button>
             {!group.floor ? <Button onClick={this.returnUp}>杩斿洖涓婄骇</Button> : null}
             <PasteComponent insert={this.insert} />
diff --git a/src/tabviews/custom/components/group/normal-group/index.jsx b/src/tabviews/custom/components/group/normal-group/index.jsx
index 9fde7b5..c2f3198 100644
--- a/src/tabviews/custom/components/group/normal-group/index.jsx
+++ b/src/tabviews/custom/components/group/normal-group/index.jsx
@@ -76,7 +76,7 @@
           item.setting.sync = 'false'
           item.setting.onload = 'false'
         } else {
-          params.push(getStructDefaultParam(item, searchlist))
+          params.push(getStructDefaultParam(item, searchlist, params.length === 0))
         }
       } else {
         item.setting.sync = 'false'
diff --git a/src/tabviews/custom/components/share/tabtransfer/index.jsx b/src/tabviews/custom/components/share/tabtransfer/index.jsx
index cf7fe9d..bb74ab9 100644
--- a/src/tabviews/custom/components/share/tabtransfer/index.jsx
+++ b/src/tabviews/custom/components/share/tabtransfer/index.jsx
@@ -90,7 +90,7 @@
           item.setting.sync = 'false'
           item.setting.onload = 'false'
         } else {
-          params.push(getStructDefaultParam(item, searchlist))
+          params.push(getStructDefaultParam(item, searchlist, params.length === 0))
         }
       } else {
         item.setting.sync = 'false'
diff --git a/src/tabviews/custom/index.jsx b/src/tabviews/custom/index.jsx
index 11d0459..572dc3e 100644
--- a/src/tabviews/custom/index.jsx
+++ b/src/tabviews/custom/index.jsx
@@ -812,13 +812,13 @@
     return components.map(component => {
       if (component.type === 'tabs') {
         component.subtabs = component.subtabs.map(tab => {
-          tab.components = this.formatSetting(tab.components, [], [], inherit, regs, balMap)
+          tab.components = this.formatSetting(tab.components, null, null, inherit, regs, balMap)
           tab = {...tab, ...inherit}
           return tab
         })
         return component
       } else if (component.type === 'group') {
-        component.components = this.formatSetting(component.components, [], [], inherit, regs, balMap)
+        component.components = this.formatSetting(component.components, null, null, inherit, regs, balMap)
         component = {...component, ...inherit}
         return component
       }
@@ -882,7 +882,7 @@
       // floor    缁勪欢鐨勫眰绾�
       // dataName 绯荤粺鐢熸垚鐨勬暟鎹簮鍚嶇О
       // pageable 鏄惁鍒嗛〉锛岀粍浠跺睘鎬э紝涓嶅垎椤电殑缁勪欢鎵嶅彲浠ョ粺涓�鏌ヨ
-      if (component.floor === 1 && component.dataName && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') {
+      if (params && component.dataName && (!component.pageable || (component.pageable && !component.setting.laypage)) && component.setting.onload === 'true' && component.setting.sync === 'true') {
         let searchlist = []
         if (component.search && component.search.length > 0) {
           searchlist = Utils.initMainSearch(component.search)
@@ -900,7 +900,7 @@
           component.setting.sync = 'false'
           component.setting.onload = 'false'
         } else {
-          params.push(getStructDefaultParam(component, searchlist))
+          params.push(getStructDefaultParam(component, searchlist, params.length === 0))
         }
       } else if (component.floor === 1) {
         component.setting.sync = 'false'
diff --git a/src/templates/sharecomponent/tablecomponent/index.jsx b/src/templates/sharecomponent/tablecomponent/index.jsx
index 8c8f4b4..d6aca93 100644
--- a/src/templates/sharecomponent/tablecomponent/index.jsx
+++ b/src/templates/sharecomponent/tablecomponent/index.jsx
@@ -182,6 +182,7 @@
               let _type = item.FieldType.toLowerCase()
               let _decimal = 0
               let _length = 50
+
               if (/^nvarchar/.test(_type)) {
                 try { // 瀛樺湪max
                   _length = +_type.match(/\d+/)[0] || 50
@@ -209,7 +210,8 @@
                 type: _type,
                 datatype: _type,
                 decimal: _decimal,
-                length: _length
+                length: _length,
+                $datatype: item.FieldType.toLowerCase()
               }
             })
           }
diff --git a/src/utils/utils-datamanage.js b/src/utils/utils-datamanage.js
index b1bab66..13b2678 100644
--- a/src/utils/utils-datamanage.js
+++ b/src/utils/utils-datamanage.js
@@ -601,7 +601,7 @@
 /**
  * @description 鐢熸垚鍗曚釜缁勪欢sPC_Get_structured_data璇锋眰鍙傛暟
  */
-export function getStructDefaultParam (component, searchlist) {
+export function getStructDefaultParam (component, searchlist, first) {
   const { columns, setting, dataName, format } = component
 
   let arr_field = columns.map(col => col.field)
@@ -644,10 +644,28 @@
     _dataresource = `select top 1000 ${arr_field.join(',')} from ${_dataresource} ${_search} `
   }
 
+  if (first) {
+    let userName = sessionStorage.getItem('User_Name') || ''
+    let fullName = sessionStorage.getItem('Full_Name') || ''
+    let RoleID = sessionStorage.getItem('role_id') || ''
+    let departmentcode = sessionStorage.getItem('departmentcode') || ''
+    let organization = sessionStorage.getItem('organization') || ''
+    let city = sessionStorage.getItem('city') || ''
+  
+    if (sessionStorage.getItem('isEditState') === 'true') {
+      userName = sessionStorage.getItem('CloudUserName') || ''
+      fullName = sessionStorage.getItem('CloudFullName') || ''
+    }
+    _customScript = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@departmentcode nvarchar(50),@organization nvarchar(50),@login_city nvarchar(50)
+      select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @departmentcode='${departmentcode}', @organization='${organization}', @login_city='${city}'
+      ${_customScript}
+    `
+  }
+
   // 娴嬭瘯绯荤粺鎵撳嵃鏌ヨ璇彞
   if ((options.sysType === 'local' && !window.GLOB.systemType) || window.debugger === true) {
-    _customScript &&  console.info(`${setting.$name ? `/*${setting.$name} 鑷畾涔夎剼鏈�*/\n` : ''}${_dataresource ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`)
-    _dataresource &&  console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧�*/\n` : ''}` + _dataresource)
+    _customScript && console.info(`${setting.$name ? `/*${setting.$name} 鑷畾涔夎剼鏈紙鍚屾鏌ヨ锛�/\n` : ''}${_dataresource ? '' : '/*涓嶆墽琛岄粯璁ql*/\n'}${_customScript}`)
+    _dataresource && console.info(`${setting.$name ? `/*${setting.$name} 鏁版嵁婧愶紙鍚屾鏌ヨ锛�*/\n` : ''}` + _dataresource)
   }
 
   return {
@@ -669,27 +687,10 @@
 export function getStructuredParams (params, config, BID = '') {
   let LText_field = []
   let diffUser = false
-  let userName = sessionStorage.getItem('User_Name') || ''
-  let fullName = sessionStorage.getItem('Full_Name') || ''
-  let RoleID = sessionStorage.getItem('role_id') || ''
-  let departmentcode = sessionStorage.getItem('departmentcode') || ''
-  let organization = sessionStorage.getItem('organization') || ''
-  let city = sessionStorage.getItem('city') || ''
-
-  if (sessionStorage.getItem('isEditState') === 'true') {
-    userName = sessionStorage.getItem('CloudUserName') || ''
-    fullName = sessionStorage.getItem('CloudFullName') || ''
-  }
   
   let _LText = params.map((item, index) => {
     let _script = item.script
 
-    if (index === 0) {
-      _script = `declare @ErrorCode nvarchar(50),@retmsg nvarchar(4000),@UserName nvarchar(50),@FullName nvarchar(50),@RoleID nvarchar(512),@departmentcode nvarchar(50),@organization nvarchar(50),@login_city nvarchar(50)
-        select @ErrorCode='',@retmsg ='',@UserName='${userName}', @FullName='${fullName}', @RoleID='${RoleID}', @departmentcode='${departmentcode}', @organization='${organization}', @login_city='${city}'
-        ${_script}
-      `
-    }
     if (!diffUser && (/@userid@/ig.test(item.sql) || /@userid@/ig.test(_script))) {
       diffUser = true
     }
diff --git a/src/views/appmanage/index.jsx b/src/views/appmanage/index.jsx
index 0c1e89a..0440218 100644
--- a/src/views/appmanage/index.jsx
+++ b/src/views/appmanage/index.jsx
@@ -468,6 +468,7 @@
               }
               cell.copyright = _param.copyright || ''
               cell.logo = _param.logo || ''
+              cell.apptype = _param.apptype || ''
             }
 
             return cell
@@ -600,7 +601,7 @@
     sublist = sublist.filter(item => item.ID !== record.ID)
 
     // param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}'`)
-    param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}','${window.btoa(window.encodeURIComponent(JSON.stringify({copyright: item.copyright || '', logo: item.logo || ''})))}'`)
+    param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}','${window.btoa(window.encodeURIComponent(JSON.stringify({copyright: item.copyright || '', logo: item.logo || '', apptype: item.apptype || ''})))}'`)
     param.LText = param.LText.join(' union all ')
     param.LText = Utils.formatOptions(param.LText)
     
@@ -824,7 +825,7 @@
 
       if (visible === 'edit') {
         // param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`)
-        param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}','${window.btoa(window.encodeURIComponent(JSON.stringify({copyright: item.copyright || '', logo: item.logo || ''})))}'`)
+        param.LText = selectApp.sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}','${window.btoa(window.encodeURIComponent(JSON.stringify({copyright: item.copyright || '', logo: item.logo || '', apptype: item.apptype || ''})))}'`)
         param.LText = param.LText.join(' union all ')
         param.LText = Utils.formatOptions(param.LText)
       }
@@ -910,7 +911,7 @@
       }
 
       // param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','${item.login_types || 'true'}','${item.link_type || 'true'}','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}'`)
-      param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}','${window.btoa(window.encodeURIComponent(JSON.stringify({copyright: item.copyright || '', logo: item.logo || ''})))}'`)
+      param.LText = sublist.map(item => `select '${item.ID}','${item.typename}','${selectApp.ID}','${sessionStorage.getItem('CloudUserID') || ''}','${window.GLOB.appkey || ''}','false','false','${item.role_type || 'true'}','${item.lang || 'zh-CN'}','${item.css || ''}','${item.title || ''}','${item.favicon || ''}','${item.user_binding || ''}','${item.sms_id || ''}','${window.btoa(window.encodeURIComponent(JSON.stringify({copyright: item.copyright || '', logo: item.logo || '', apptype: item.apptype || ''})))}'`)
       param.LText = param.LText.join(' union all ')
       param.LText = Utils.formatOptions(param.LText)
 
diff --git a/src/views/appmanage/submutilform/index.jsx b/src/views/appmanage/submutilform/index.jsx
index dd46068..e61f347 100644
--- a/src/views/appmanage/submutilform/index.jsx
+++ b/src/views/appmanage/submutilform/index.jsx
@@ -223,6 +223,23 @@
               )}
             </Form.Item>
           </Col>
+          {typename !== 'pc' ? <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鍦ㄤ娇鐢ㄦ槑绉戜簯APP鏃讹紝椤甸潰鐨勫垏鎹㈡ā寮�">
+                <Icon type="question-circle" />
+                搴旂敤妯″紡
+              </Tooltip>
+            }>
+              {getFieldDecorator('apptype', {
+                initialValue: card ? card.apptype || 'H5' : 'H5'
+              })(
+                <Radio.Group>
+                  <Radio value="H5">H5</Radio>
+                  <Radio value="app">app</Radio>
+                </Radio.Group>
+              )}
+            </Form.Item>
+          </Col> : null}
         </Row>
       </Form>
     )

--
Gitblit v1.8.0