From 1dbd8e07e440e9245f10777e9e8fd2fe2b05f6af Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 27 九月 2021 23:39:07 +0800
Subject: [PATCH] 2021-09-27

---
 src/templates/modalconfig/index.jsx                   |    7 ---
 src/menu/modalconfig/index.jsx                        |    8 ---
 src/templates/modalconfig/settingform/index.jsx       |   33 +++++++++++++---
 src/menu/components/form/tab-form/index.jsx           |   10 ++++
 src/tabviews/zshare/actionList/normalbutton/index.jsx |    5 ++
 src/menu/components/form/normal-form/index.jsx        |   10 ++++
 src/tabviews/zshare/actionList/printbutton/index.jsx  |    5 ++
 7 files changed, 57 insertions(+), 21 deletions(-)

diff --git a/src/menu/components/form/normal-form/index.jsx b/src/menu/components/form/normal-form/index.jsx
index bedbe6c..14b0bce 100644
--- a/src/menu/components/form/normal-form/index.jsx
+++ b/src/menu/components/form/normal-form/index.jsx
@@ -282,6 +282,14 @@
     this.props.updateConfig(card)
   }
 
+  plusFields = (items) => {
+    let _group = fromJS(this.state.group).toJS()
+
+    _group.fields.push(...items)
+
+    this.updateGroup(_group)
+  }
+
   changecols = (type) => {
     let card = fromJS(this.state.card).toJS()
     let config = fromJS(this.state.group).toJS()
@@ -651,7 +659,7 @@
         />
         {group ? <div className="form-area">
           <Icon className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm} type="plus" />
-          <FieldsComponent config={group} type="form" updatefield={this.updateGroup} />
+          <FieldsComponent config={group} type="form" plusFields={this.plusFields} />
           <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} />
           {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(1)}>1鍒�</Button> : null}
           {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2鍒�</Button> : null}
diff --git a/src/menu/components/form/tab-form/index.jsx b/src/menu/components/form/tab-form/index.jsx
index e4fb94e..8e47deb 100644
--- a/src/menu/components/form/tab-form/index.jsx
+++ b/src/menu/components/form/tab-form/index.jsx
@@ -273,6 +273,14 @@
     this.setState({card, group})
     this.props.updateConfig(card)
   }
+
+  plusFields = (items) => {
+    let _group = fromJS(this.state.group).toJS()
+
+    _group.fields.push(...items)
+
+    this.updateGroup(_group)
+  }
   
   changecols = (type) => {
     let card = fromJS(this.state.card).toJS()
@@ -644,7 +652,7 @@
         />
         {group ? <div className="form-area">
           <Icon className="plus" title="娣诲姞琛ㄥ崟" onClick={this.addForm} type="plus" />
-          <FieldsComponent config={group} type="form" updatefield={this.updateGroup} />
+          <FieldsComponent config={group} type="form" plusFields={this.plusFields} />
           <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} />
           {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(1)}>1鍒�</Button> : null}
           {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(2)}>2鍒�</Button> : null}
diff --git a/src/menu/modalconfig/index.jsx b/src/menu/modalconfig/index.jsx
index bead002..1e68e7d 100644
--- a/src/menu/modalconfig/index.jsx
+++ b/src/menu/modalconfig/index.jsx
@@ -87,7 +87,7 @@
     let _config = fromJS(this.state.config).toJS()
 
     if (list.length > _config.fields.length) {
-      _config.fields = list.filter(item => !item.origin)
+      _config.fields = list
 
       this.setState({
         config: _config
@@ -212,8 +212,6 @@
         })
         return
       }
-
-      _config.fields = _config.fields.filter(item => !item.origin)
 
       if (['select', 'multiselect', 'link', 'checkbox', 'radio', 'checkcard'].includes(res.type) && res.resourceType === '1' && /\s/.test(res.dataSource)) {
         this.setState({
@@ -414,10 +412,6 @@
 
   plusFields = (items) => {
     let _config = fromJS(this.state.config).toJS()
-
-    if (_config.fields[0] && _config.fields[0].origin) {
-      _config.fields = _config.fields.filter(item => !item.origin)
-    }
 
     _config.fields.push(...items)
 
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 90353f7..0bf6a30 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -1530,6 +1530,7 @@
    */
   execError = (res) => {
     const { btn } = this.props
+    const { btnconfig } = this.state
 
     if (res.ErrCode === 'E') {
       Modal.error({
@@ -1599,6 +1600,10 @@
       }
     }
 
+    if (btnconfig && btnconfig.setting && btnconfig.setting.errFocus) {
+      MKEmitter.emit('mkFC', 'focus', btnconfig.setting.errFocus)
+    }
+
     if (btn.execError !== 'never') {
       MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
     }
diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index 2520eac..ec7be3e 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -1241,6 +1241,7 @@
    */
   execError = (res) => {
     const { btn } = this.props
+    const { btnconfig } = this.state
 
     if (res.ErrCode === 'E') {
       Modal.error({
@@ -1267,6 +1268,10 @@
       loading: false
     })
 
+    if (btnconfig && btnconfig.setting && btnconfig.setting.errFocus) {
+      MKEmitter.emit('mkFC', 'focus', btnconfig.setting.errFocus)
+    }
+
     if (btn.execError !== 'never') {
       MKEmitter.emit('refreshByButtonResult', btn.$menuId, btn.execError, btn)
     }
diff --git a/src/templates/modalconfig/index.jsx b/src/templates/modalconfig/index.jsx
index 096eb2c..93f2dfb 100644
--- a/src/templates/modalconfig/index.jsx
+++ b/src/templates/modalconfig/index.jsx
@@ -677,11 +677,7 @@
                     return (<SourceElement key={index} content={item}/>)
                   })}
                 </div>
-                <FieldsComponent
-                  config={config}
-                  type="form"
-                  updatefield={this.updateconfig}
-                />
+                <FieldsComponent config={config} type="form" plusFields={this.plusFields}/>
               </Panel>
             </Collapse>
           </div>
@@ -763,7 +759,6 @@
         >
           <SettingForm
             config={config}
-            dict={dict}
             isSubTab={!!this.props.editTab}
             inputSubmit={this.settingSave}
             wrappedComponentRef={(inst) => this.settingRef = inst}
diff --git a/src/templates/modalconfig/settingform/index.jsx b/src/templates/modalconfig/settingform/index.jsx
index 0773bf1..ebe4427 100644
--- a/src/templates/modalconfig/settingform/index.jsx
+++ b/src/templates/modalconfig/settingform/index.jsx
@@ -7,7 +7,6 @@
 
 class SettingForm extends Component {
   static propTpyes = {
-    dict: PropTypes.object,     // 瀛楀吀椤�
     config: PropTypes.object,   // 琛ㄥ崟閰嶇疆淇℃伅
     isSubTab: PropTypes.bool,   // 鏄惁涓哄瓙鏍囩
     inputSubmit: PropTypes.any  // 鍥炶溅鎻愪氦浜嬩欢
@@ -64,7 +63,7 @@
   }
 
   render() {
-    const { config, dict } = this.props
+    const { config } = this.props
     const { fields, appType, display } = this.state
     const { getFieldDecorator } = this.props.form
 
@@ -115,17 +114,15 @@
             </Form.Item>
           </Col> : null}
           <Col span={12}>
-            <Form.Item label="鐒︾偣">
+            <Form.Item label="鍒濆鐒︾偣">
               {getFieldDecorator('focus', {
                 initialValue: config.setting.focus || ''
               })(
                 <Select
                   showSearch
+                  allowClear
                   filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
                 >
-                  <Select.Option value="">
-                    {dict['model.empty']}
-                  </Select.Option>
                   {fields.map(option =>
                     <Select.Option id={option.uuid} title={option.label} key={option.uuid} value={option.field}>
                       {option.label}
@@ -135,6 +132,30 @@
               )}
             </Form.Item>
           </Col>
+          <Col span={12}>
+            <Form.Item label={
+              <Tooltip placement="topLeft" title="鎵ц澶辫触鏃堕渶瑕佽仛鐒︾殑琛ㄥ崟銆�">
+                <Icon type="question-circle" />
+                澶辫触鐒︾偣
+              </Tooltip>
+            }>
+              {getFieldDecorator('errFocus', {
+                initialValue: config.setting.errFocus || ''
+              })(
+                <Select
+                  showSearch
+                  allowClear
+                  filterOption={(input, option) => option.props.children.toLowerCase().indexOf(input.toLowerCase()) >= 0}
+                >
+                  {fields.map(option =>
+                    <Select.Option key={option.uuid} value={option.uuid}>
+                      {option.label}
+                    </Select.Option>
+                  )}
+                </Select>
+              )}
+            </Form.Item>
+          </Col>
           {appType !== 'mob' ? <Col span={12}>
             <Form.Item label="琛ㄥ崟鎺掑垪">
               {getFieldDecorator('align', {

--
Gitblit v1.8.0