From 6f09319def608286218e562d8b270ee9e58444b4 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期四, 09 三月 2023 15:33:35 +0800
Subject: [PATCH] 2023-03-09

---
 src/menu/components/editor/braft-editor/options.jsx          |   16 +++++
 src/menu/components/form/step-form/index.jsx                 |    4 
 src/tabviews/custom/components/editor/braft-editor/index.jsx |   24 ++++----
 src/menu/components/form/tab-form/index.jsx                  |    4 
 src/templates/formtabconfig/index.jsx                        |    2 
 src/menu/components/form/simple-form/options.jsx             |   12 ++++
 src/menu/components/form/simple-form/index.jsx               |    4 
 src/tabviews/zshare/mutilform/index.jsx                      |    6 +-
 src/templates/modalconfig/index.jsx                          |    2 
 src/menu/components/editor/braft-editor/index.jsx            |   38 +++++++++++-
 src/menu/modalconfig/index.jsx                               |    2 
 src/menu/components/form/step-form/options.jsx               |   12 ++++
 src/mob/modalconfig/index.jsx                                |    2 
 13 files changed, 99 insertions(+), 29 deletions(-)

diff --git a/src/menu/components/editor/braft-editor/index.jsx b/src/menu/components/editor/braft-editor/index.jsx
index edc3cba..444a206 100644
--- a/src/menu/components/editor/braft-editor/index.jsx
+++ b/src/menu/components/editor/braft-editor/index.jsx
@@ -76,6 +76,10 @@
     }
   }
 
+  componentDidMount() {
+    MKEmitter.addListener('mkUpdateInter', this.mkUpdateInter)
+  }
+
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -86,6 +90,21 @@
   componentWillUnmount () {
     this.setState = () => {
       return
+    }
+    MKEmitter.removeListener('mkUpdateInter', this.mkUpdateInter)
+  }
+
+  mkUpdateInter = (inter, split) => {
+    const { card } = this.state
+    
+    if (card.wrap.datatype === 'public' && card.wrap.publicId === inter.uuid) {
+      let _card = {...card, columns: fromJS(inter.columns).toJS()}
+
+      split.delay = split.delay + 10
+
+      setTimeout(() => {
+        this.updateComponent(_card)
+      }, split.delay)
     }
   }
 
@@ -144,7 +163,21 @@
   }
 
   updateWrap = (res) => {
-    this.updateComponent({...this.state.card, wrap: res})
+    const { card } = this.state
+
+    let _card = {...card, wrap: res}
+
+    if (res.datatype === 'public') {
+      let interfaces = window.GLOB.customMenu.interfaces || []
+
+      let d = interfaces.filter(m => m.uuid === res.publicId && m.status === 'true')[0]
+
+      if (d) {
+        _card.columns = fromJS(d.columns).toJS()
+      }
+    }
+
+    this.updateComponent(_card)
   }
 
   clickComponent = (e) => {
@@ -178,8 +211,7 @@
             <UserComponent config={card}/>
             <DeleteOutlined className="close" title="鍒犻櫎缁勪欢" onClick={() => this.props.deletecomponent(card.uuid)} />
             <EditorContent config={card} updateConfig={this.updateComponent}/>
-            {card.wrap.datatype !== 'static' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : null}
-            {card.wrap.datatype === 'static' ? <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}} type="setting"/> : null}
+            {card.wrap.datatype === 'dynamic' ? <SettingComponent config={card} updateConfig={this.updateComponent} /> : <SettingOutlined style={{color: '#eeeeee', cursor: 'not-allowed'}} type="setting"/>}
           </div>
         } trigger="hover">
           <ToolOutlined />
diff --git a/src/menu/components/editor/braft-editor/options.jsx b/src/menu/components/editor/braft-editor/options.jsx
index 134bf6a..3c33098 100644
--- a/src/menu/components/editor/braft-editor/options.jsx
+++ b/src/menu/components/editor/braft-editor/options.jsx
@@ -69,6 +69,7 @@
       ],
       controlFields: [
         {field: 'field', values: ['dynamic', 'public']},
+        {field: 'empty', values: ['dynamic', 'public']},
         {field: 'publicId', values: ['public']},
         {field: 'encryption', values: ['dynamic', 'public']},
       ]
@@ -86,7 +87,7 @@
       field: 'field',
       label: '鏂囨湰瀛楁',
       initval: wrap.field || '',
-      tooltip: '閫夋嫨鍔ㄦ�佸�兼椂锛岄渶璁剧疆鏂囨湰瀛楁鎵嶅彲鐢熸晥銆�',
+      tooltip: '閫夋嫨鍔ㄦ�佸�兼椂锛岄渶璁剧疆鏂囨湰瀛楁鎵嶅彲鐢熸晥锛屼娇鐢ㄥ叕鍏辨暟鎹簮鏃讹紝闇�鍏堜繚瀛樻暟鎹簮鍚庡啀閫夊彇鏂囨湰瀛楁銆�',
       required: false,
       options: columns
     },
@@ -104,6 +105,19 @@
     },
     {
       type: 'radio',
+      field: 'empty',
+      label: '绌哄�奸殣钘�',
+      initval: wrap.empty || 'show',
+      tooltip: '褰撴煡璇㈡暟鎹负绌烘椂锛岄殣钘忚缁勪欢銆�',
+      required: false,
+      skip: true,
+      options: [
+        {value: 'show', label: '鍚�'},
+        {value: 'hidden', label: '鏄�'},
+      ],
+    },
+    {
+      type: 'radio',
       field: 'permission',
       label: '鏉冮檺楠岃瘉',
       initval: wrap.permission || 'false',
diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx
index b7e8139..1e19bcf 100644
--- a/src/menu/components/form/simple-form/index.jsx
+++ b/src/menu/components/form/simple-form/index.jsx
@@ -461,7 +461,7 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: `declare @mk_organization nvarchar(512)
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
             ${res.dataSource}`
         }
 
@@ -672,7 +672,7 @@
         } trigger="hover">
           <ToolOutlined />
         </Popover>
-        <div className="form-area">
+        <div className={`form-area mk-${card.wrap.formStyle || ''}`}>
           <PlusOutlined className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm}/>
           <FieldsComponent config={card.subcards[0]} type="form" plusFields={this.plusFields} />
           <span style={{color: 'red', marginLeft: '30px', cursor: 'pointer'}} onClick={this.clearGroup}>娓呯┖</span>
diff --git a/src/menu/components/form/simple-form/options.jsx b/src/menu/components/form/simple-form/options.jsx
index 2ddaa70..2197555 100644
--- a/src/menu/components/form/simple-form/options.jsx
+++ b/src/menu/components/form/simple-form/options.jsx
@@ -159,6 +159,18 @@
     },
     {
       type: 'radio',
+      field: 'formStyle',
+      label: '琛ㄥ崟鏍峰紡',
+      initval: wrap.formStyle || '',
+      required: false,
+      options: [
+        {value: '', label: '榛樿'},
+        {value: 'shadow', label: '闃村奖'},
+      ],
+      forbid: appType !== 'mob'
+    },
+    {
+      type: 'radio',
       field: 'goback',
       label: '绌哄�艰繑鍥�',
       initval: wrap.goback || 'false',
diff --git a/src/menu/components/form/step-form/index.jsx b/src/menu/components/form/step-form/index.jsx
index 9a38ddd..a8e7b35 100644
--- a/src/menu/components/form/step-form/index.jsx
+++ b/src/menu/components/form/step-form/index.jsx
@@ -563,7 +563,7 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: `declare @mk_organization nvarchar(512)
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
             ${res.dataSource}`
         }
 
@@ -830,7 +830,7 @@
           closeGroup={this.closeGroup}
           selectGroup={this.selectGroup}
         />
-        {group ? <div className="form-area">
+        {group ? <div className={`form-area mk-${card.wrap.formStyle || ''}`}>
           <PlusOutlined className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm}/>
           <FieldsComponent config={group} type="form" plusFields={this.plusFields} />
           <span style={{color: 'red', marginLeft: '30px', cursor: 'pointer'}} onClick={this.clearGroup}>娓呯┖</span>
diff --git a/src/menu/components/form/step-form/options.jsx b/src/menu/components/form/step-form/options.jsx
index 3d87ab2..dae0a31 100644
--- a/src/menu/components/form/step-form/options.jsx
+++ b/src/menu/components/form/step-form/options.jsx
@@ -124,6 +124,18 @@
     },
     {
       type: 'radio',
+      field: 'formStyle',
+      label: '琛ㄥ崟鏍峰紡',
+      initval: wrap.formStyle || '',
+      required: false,
+      options: [
+        {value: '', label: '榛樿'},
+        {value: 'shadow', label: '闃村奖'},
+      ],
+      forbid: appType !== 'mob'
+    },
+    {
+      type: 'radio',
       field: 'goback',
       label: '绌哄�艰繑鍥�',
       initval: wrap.goback || 'false',
diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx
index b8c0790..489a3c2 100644
--- a/src/menu/components/form/tab-form/index.jsx
+++ b/src/menu/components/form/tab-form/index.jsx
@@ -568,7 +568,7 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: `declare @mk_organization nvarchar(512)
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
             ${res.dataSource}`
         }
 
@@ -832,7 +832,7 @@
           closeGroup={this.closeGroup}
           selectGroup={this.selectGroup}
         />
-        {group ? <div className="form-area">
+        {group ? <div className={`form-area mk-${card.wrap.formStyle || ''}`}>
           <PlusOutlined className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm}/>
           <FieldsComponent config={group} type="form" plusFields={this.plusFields} />
           <span style={{color: 'red', marginLeft: '30px', cursor: 'pointer'}} onClick={this.clearGroup}>娓呯┖</span>
diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx
index fd50e7b..c0da35b 100644
--- a/src/menu/modalconfig/index.jsx
+++ b/src/menu/modalconfig/index.jsx
@@ -265,7 +265,7 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: `declare @mk_organization nvarchar(512)
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
             ${res.dataSource}`
         }
 
diff --git a/src/mob/modalconfig/index.jsx b/src/mob/modalconfig/index.jsx
index b1db259..8bcad78 100644
--- a/src/mob/modalconfig/index.jsx
+++ b/src/mob/modalconfig/index.jsx
@@ -261,7 +261,7 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: `declare @mk_organization nvarchar(512)
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
             ${res.dataSource}`
         }
 
diff --git a/src/tabviews/custom/components/editor/braft-editor/index.jsx b/src/tabviews/custom/components/editor/braft-editor/index.jsx
index d6c7450..434ed5d 100644
--- a/src/tabviews/custom/components/editor/braft-editor/index.jsx
+++ b/src/tabviews/custom/components/editor/braft-editor/index.jsx
@@ -31,7 +31,7 @@
     const { data, initdata } = this.props
     let _config = fromJS(this.props.config).toJS()
 
-    let _data = {}
+    let _data = { $$empty: true }
     let _sync = false
 
     let BID = ''
@@ -50,20 +50,18 @@
       _sync = _config.setting.sync === 'true'
 
       if (_sync && data) {
-        _data = data[_config.dataName] || {}
+        _data = data[_config.dataName] || {$$empty: true}
         if (_data && Array.isArray(_data)) {
-          _data = _data[0] || {}
+          _data = _data[0] || {$$empty: true}
         }
         _sync = false
       } else if (_sync && initdata) {
-        _data = initdata || {}
+        _data = initdata
         if (_data && Array.isArray(_data)) {
-          _data = _data[0] || {}
+          _data = _data[0] || {$$empty: true}
         }
         _sync = false
       }
-    } else {
-      _data = {}
     }
 
     if (_config.wrap.minHeight) {
@@ -116,11 +114,11 @@
     const { sync, config } = this.state
 
     if (sync && !is(fromJS(this.props.data), fromJS(nextProps.data))) {
-      let _data = {}
+      let _data = {$$empty: true}
       if (nextProps.data && nextProps.data[config.dataName]) {
         _data = nextProps.data[config.dataName]
         if (_data && Array.isArray(_data)) {
-          _data = _data[0]
+          _data = _data[0] || {$$empty: true}
         }
       }
 
@@ -172,13 +170,13 @@
     
     if (config.wrap.datatype === 'static') {
       this.setState({
-        data: {},
+        data: {$$empty: true},
         loading: false
       })
       return
     } else if (config.setting.supModule && !BID) { // BID 涓嶅瓨鍦ㄦ椂锛屼笉鍋氭煡璇�
       this.setState({
-        data: {},
+        data: {$$empty: true},
         loading: false
       })
       return
@@ -200,7 +198,7 @@
 
     let result = await Api.genericInterface(param)
     if (result.status) {
-      let _data = result.data && result.data[0] ? result.data[0] : {}
+      let _data = result.data && result.data[0] ? result.data[0] : {$$empty: true}
 
       this.setState({
         data: _data,
@@ -221,6 +219,8 @@
   render() {
     const { config, loading, data } = this.state
 
+    if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null
+
     return (
       <div className="custom-braft-editor-box" id={'anchor' + config.uuid} style={config.style}>
         {loading ?
diff --git a/src/tabviews/zshare/mutilform/index.jsx b/src/tabviews/zshare/mutilform/index.jsx
index 9d4eacd..b7d6cd6 100644
--- a/src/tabviews/zshare/mutilform/index.jsx
+++ b/src/tabviews/zshare/mutilform/index.jsx
@@ -544,7 +544,7 @@
     let cache = action.setting.cache !== 'false'
     let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')
 
-    let _sql = `Declare @mk_organization nvarchar(512)  select @mk_organization='${sessionStorage.getItem('organization') || ''}'\n`
+    let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)  select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n`
     let _sso = _sql
 
     deForms.forEach(item => {
@@ -666,7 +666,7 @@
   improveSimpleActionForm = (deForms) => {
     let cache = this.props.action.setting.cache !== 'false'
     let debug = window.GLOB.debugger === true || (window.debugger === true && options.sysType !== 'cloud')
-    let _sql = `Declare @mk_organization nvarchar(512)  select @mk_organization='${sessionStorage.getItem('organization') || ''}'\n`
+    let _sql = `Declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)  select @mk_departmentcode='${sessionStorage.getItem('departmentcode') || ''}',@mk_organization='${sessionStorage.getItem('organization') || ''}',@mk_user_type='${sessionStorage.getItem('mk_user_type') || ''}'\n`
 
     let deffers = deForms.map((form, index) => {
       let param = {
@@ -901,7 +901,7 @@
 
     formlist.forEach((item, index) => {
       if (item.hidden) return
-      if (item.empty === 'hidden' && item.options.length === 0) return
+      if (item.empty === 'hidden' && item.oriOptions.length === 0) return
 
       if (item.type === 'split') {
         fields.push(
diff --git a/src/templates/formtabconfig/index.jsx b/src/templates/formtabconfig/index.jsx
index 7e9a3b1..a3e43f0 100644
--- a/src/templates/formtabconfig/index.jsx
+++ b/src/templates/formtabconfig/index.jsx
@@ -518,7 +518,7 @@
           let param = {
             func: 's_debug_sql',
             exec_type: 'y',
-            LText: `declare @mk_organization nvarchar(512)
+            LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
               ${res.dataSource}`
           }
 
diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 13a2736..b4d6d8b 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -399,7 +399,7 @@
         let param = {
           func: 's_debug_sql',
           exec_type: 'y',
-          LText: `declare @mk_organization nvarchar(512)
+          LText: `declare @mk_departmentcode nvarchar(512),@mk_organization nvarchar(512),@mk_user_type nvarchar(20)
             ${res.dataSource}`
         }
 

--
Gitblit v1.8.0