From af6486b3629d23e426ce85b87dbc20dfa15b1afe Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 07 十一月 2022 18:50:27 +0800
Subject: [PATCH] 2022-11-07

---
 src/menu/components/form/simple-form/index.jsx |   48 +++++++++++++-----------------------------------
 1 files changed, 13 insertions(+), 35 deletions(-)

diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx
index 7d659ad..ac0ecf3 100644
--- a/src/menu/components/form/simple-form/index.jsx
+++ b/src/menu/components/form/simple-form/index.jsx
@@ -13,8 +13,6 @@
 import MKEmitter from '@/utils/events.js'
 import Utils from '@/utils/utils.js'
 import getWrapForm from './options'
-import zhCN from '@/locales/zh-CN/model.js'
-import enUS from '@/locales/en-US/model.js'
 import './index.scss'
 
 const ModalForm = asyncComponent(() => import('@/templates/zshare/modalform'))
@@ -39,7 +37,6 @@
   }
 
   state = {
-    dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS,
     appType: sessionStorage.getItem('appType'),
     card: null,
     back: false,
@@ -58,8 +55,6 @@
       let _card = {
         uuid: card.uuid,
         type: card.type,
-        tabId: card.tabId || '',
-        parentId: card.parentId || '',
         format: 'object',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
         pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
         switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
@@ -110,10 +105,6 @@
     }
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -125,24 +116,6 @@
     this.setState = () => {
       return
     }
-    MKEmitter.removeListener('submitComponentStyle', this.updateComponentStyle)
-  }
-
-  updateComponentStyle = (parentId, keys, style) => {
-    const { card } = this.state
-
-    if (card.uuid !== parentId) return
-
-    let subcards = card.subcards.map(item => {
-      if (keys.includes(item.uuid)) {
-        item.style = {...item.style, ...style}
-      }
-      return item
-    })
-
-    this.setState({card: {...card, subcards: []}}, () => {
-      this.updateComponent({...card, subcards: subcards})
-    })
   }
 
   /**
@@ -221,7 +194,7 @@
   changeStyle = () => {
     const { card } = this.state
 
-    MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow'], card.style, this.getStyle)
+    MKEmitter.emit('changeStyle', ['height', 'background', 'border', 'padding', 'margin', 'shadow', 'clear'], card.style, this.getStyle)
   }
 
   getStyle = (style) => {
@@ -456,7 +429,7 @@
       standardform,
       visible: true,
       editform: _form,
-      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields)
+      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, card.columns)
     })
   }
 
@@ -508,6 +481,7 @@
 
         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 = param.LText.replace(/\n/g, ' ')
         
         param.LText = Utils.formatOptions(param.LText)
         param.secretkey = Utils.encrypt('', param.timestamp)
@@ -647,12 +621,18 @@
   clickComponent = (e) => {
     if (sessionStorage.getItem('style-control') === 'true' || sessionStorage.getItem('style-control') === 'component') {
       e.stopPropagation()
-      MKEmitter.emit('clickComponent', this.state.card)
+      MKEmitter.emit('clickComponent', this.state.card.uuid, null, (style) => {
+        let _card = {...this.state.card}
+        _card.style = {..._card.style, ...style}
+
+        this.setState({ card: _card })
+        this.props.updateConfig(_card)
+      })
     }
   }
 
   render() {
-    const { card, dict, appType } = this.state
+    const { card, appType } = this.state
 
     return (
       <div className="menu-simple-form-edit-box" style={resetStyle(card.style)} onClick={this.clickComponent} id={card.uuid}>
@@ -677,7 +657,7 @@
           <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>
-          <Switch checkedChildren={dict['model.switch.open']} unCheckedChildren={dict['model.switch.close']} defaultChecked={this.state.showField} onChange={(val) => this.setState({showField: val})} />
+          <Switch checkedChildren="寮�" unCheckedChildren="鍏�" 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}
           {appType !== 'mob' ? <Button className="mk-cols-change" onClick={() => this.changecols(3)}>3鍒�</Button> : null}
@@ -687,7 +667,6 @@
             list={card.subcards[0].fields}
             setting={card.subcards[0].setting}
             showField={this.state.showField}
-            placeholder={dict['header.form.modal.placeholder']}
             handleList={this.handleList}
             handleForm={this.handleForm}
             closeForm={this.closeForm}
@@ -716,7 +695,7 @@
           </div>
         </div>
         <Modal
-          title={this.state.dict['model.edit']}
+          title="缂栬緫"
           visible={this.state.visible}
           width={950}
           maskClosable={false}
@@ -726,7 +705,6 @@
           destroyOnClose
         >
           <ModalForm
-            dict={this.state.dict}
             card={this.state.editform}
             formlist={this.state.formlist}
             inputSubmit={this.handleSubmit}

--
Gitblit v1.8.0