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 |   57 ++++++++++++++++++++-------------------------------------
 1 files changed, 20 insertions(+), 37 deletions(-)

diff --git a/src/menu/components/form/simple-form/index.jsx b/src/menu/components/form/simple-form/index.jsx
index d2b0877..ac0ecf3 100644
--- a/src/menu/components/form/simple-form/index.jsx
+++ b/src/menu/components/form/simple-form/index.jsx
@@ -9,12 +9,10 @@
 import asyncComponent from '@/utils/asyncComponent'
 import asyncIconComponent from '@/utils/asyncIconComponent'
 import { getModalForm } from '@/templates/zshare/formconfig'
-import { resetStyle } from '@/utils/utils-custom.js'
+import { resetStyle, getTables } from '@/utils/utils-custom.js'
 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,12 +55,9 @@
       let _card = {
         uuid: card.uuid,
         type: card.type,
-        tabId: card.tabId || '',
-        parentId: card.parentId || '',
         format: 'object',   // 缁勪欢灞炴�� - 鏁版嵁鏍煎紡
         pageable: false,    // 缁勪欢灞炴�� - 鏄惁鍙垎椤�
         switchable: false,  // 缁勪欢灞炴�� - 鏁版嵁鏄惁鍙垏鎹�
-        dataName: card.dataName || '',
         width: card.width || 24,
         name: card.name,
         subtype: card.subtype,
@@ -111,10 +105,6 @@
     }
   }
 
-  componentDidMount () {
-    MKEmitter.addListener('submitComponentStyle', this.updateComponentStyle)
-  }
-
   shouldComponentUpdate (nextProps, nextState) {
     return !is(fromJS(this.state), fromJS(nextState))
   }
@@ -126,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})
-    })
   }
 
   /**
@@ -173,6 +145,10 @@
         card.errors.push({ level: 0, detail: '鏈缃笂绾х粍浠讹紒'})
       }
 
+      if (card.errors.length === 0) {
+        card.$tables = getTables(card)
+      }
+
       card.subcards.forEach(item => {
         item.fields.forEach(m => {
           if (m.type === 'linkMain' && !supModule) {
@@ -182,6 +158,8 @@
       })
     } else {
       let supModule = card.wrap.supModule ? card.wrap.supModule[card.wrap.supModule.length - 1] : ''
+
+      card.$tables = getTables(card)
 
       card.subcards.forEach(item => {
         item.fields.forEach(m => {
@@ -216,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) => {
@@ -451,7 +429,7 @@
       standardform,
       visible: true,
       editform: _form,
-      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields)
+      formlist: getModalForm(_form, _inputfields, _tabfields, _linkableFields, _linksupFields, card.columns)
     })
   }
 
@@ -503,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)
@@ -642,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}>
@@ -672,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}
@@ -682,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}
@@ -711,7 +695,7 @@
           </div>
         </div>
         <Modal
-          title={this.state.dict['model.edit']}
+          title="缂栬緫"
           visible={this.state.visible}
           width={950}
           maskClosable={false}
@@ -721,7 +705,6 @@
           destroyOnClose
         >
           <ModalForm
-            dict={this.state.dict}
             card={this.state.editform}
             formlist={this.state.formlist}
             inputSubmit={this.handleSubmit}

--
Gitblit v1.8.0