From d21470fe80e265cda2c355f636c3258eb0f56636 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 12 五月 2020 18:31:18 +0800
Subject: [PATCH] 2020-05-12

---
 src/templates/sharecomponent/columncomponent/index.jsx |   96 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 95 insertions(+), 1 deletions(-)

diff --git a/src/templates/sharecomponent/columncomponent/index.jsx b/src/templates/sharecomponent/columncomponent/index.jsx
index 240a4a6..4a514cc 100644
--- a/src/templates/sharecomponent/columncomponent/index.jsx
+++ b/src/templates/sharecomponent/columncomponent/index.jsx
@@ -13,6 +13,7 @@
 import ColspanForm from './colspanform'
 import GridBtnForm from './gridbtnform'
 import DragElement from './dragcolumn'
+import MarkColumn from './markcolumn'
 import './index.scss'
 
 const { confirm } = Modal
@@ -164,6 +165,16 @@
   }
 
   /**
+   * @description 璁剧疆鏍囧織
+   */
+  markElement = (card) => {
+    this.setState({
+      modaltype: 'mark',
+      card: card
+    })
+  }
+
+  /**
    * @description 鎿嶄綔鍒楃紪杈�
    */
   handleGridBtn = () => {
@@ -205,7 +216,7 @@
    */
   handleSubmit = () => {
     const { config } = this.props
-    const { modaltype } = this.state
+    const { modaltype, card } = this.state
 
     let _columnlist = fromJS(this.state.columnlist).toJS()
 
@@ -248,7 +259,25 @@
           return
         }
 
+        if (!card.focus && (card.type !== res.type || (res.field && card.field !== res.field))) {
+          let refers = []
+          _columnlist.forEach(column => {
+            if (column.marks && column.marks.filter(mark => mark.field === card.field || mark.contrastField === card.field).length > 0) {
+              refers.push(column.label)
+            }
+          })
+
+          if (refers.length > 0) {
+            notification.warning({
+              top: 92,
+              message: '鏄剧ず鍒椼��' + refers.join('銆�') + '銆嬫爣璁颁腑鍚湁璇ュ瓧娈碉紝姝ゆ淇敼浼氬鑷存爣璁板け鏁堬紝璇蜂慨鏀广��' + refers.join('銆�') + '銆嬫爣璁拌缃紒',
+              duration: 5
+            })
+          }
+        }
+
         this.setState({
+          card: null,
           columnlist: _columnlist,
           modaltype: ''
         })
@@ -281,6 +310,23 @@
         let _columnlist = fromJS(_this.state.columnlist).toJS()
 
         _columnlist = _columnlist.filter(item => item.uuid !== card.uuid)
+
+        if (card.field) {
+          let refers = []
+          _columnlist.forEach(column => {
+            if (column.marks && column.marks.filter(mark => mark.field === card.field || mark.contrastField === card.field).length > 0) {
+              refers.push(column.label)
+            }
+          })
+
+          if (refers.length > 0) {
+            notification.warning({
+              top: 92,
+              message: '鏄剧ず鍒椼��' + refers.join('銆�') + '銆嬫爣璁颁腑鍚湁璇ュ瓧娈碉紝鍒犻櫎浼氬鑷存爣璁板け鏁堬紝璇蜂慨鏀广��' + refers.join('銆�') + '銆嬫爣璁拌缃紒',
+              duration: 5
+            })
+          }
+        }
 
         _this.setState({
           columnlist: _columnlist
@@ -349,6 +395,33 @@
     })
   }
 
+  markSubmit = () => {
+    const { config } = this.props
+    const { card } = this.state
+    let _columnlist = fromJS(this.state.columnlist).toJS()
+    let _marks = this.refs.markRef.state.marks
+
+    if (_marks.length === 0) {
+      _marks = ''
+    }
+
+    _columnlist = _columnlist.map(item => {
+      if (item.uuid === card.uuid) {
+        item.marks = _marks
+      }
+        
+      return item
+    })
+
+    this.setState({
+      card: null,
+      columnlist: _columnlist,
+      modaltype: ''
+    })
+    this.props.updatecolumn({...config, columns: _columnlist})
+    
+  }
+
   /**
    * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊
    */
@@ -378,6 +451,7 @@
           handleList={this.handleList}
           handleMenu={this.handleColumn}
           deleteMenu={this.deleteElement}
+          markMenu={this.markElement}
           handleGridBtn={this.handleGridBtn}
           showfield={this.state.showField}
           placeholder={this.state.dict['header.form.column.placeholder']}
@@ -436,6 +510,26 @@
             wrappedComponentRef={(inst) => this.gridBtnFormRef = inst}
           />
         </Modal>
+        {/* 鎸夐挳浣跨敤绯荤粺瀛樺偍杩囩▼鏃讹紝楠岃瘉淇℃伅妯℃�佹 */}
+        <Modal
+          wrapClassName="model-table-column-mark-modal"
+          title={'鏍囪璁剧疆'}
+          visible={modaltype === 'mark'}
+          width={'75vw'}
+          maskClosable={false}
+          style={{minWidth: '900px', maxWidth: '1200px'}}
+          okText={dict['header.submit']}
+          onOk={this.markSubmit}
+          onCancel={() => { this.setState({ modaltype: '' }) }}
+          destroyOnClose
+        >
+          <MarkColumn
+            ref="markRef"
+            card={card}
+            dict={dict}
+            columns={columnlist}
+          />
+        </Modal>
         {this.state.loading && <Spin size="large" />}
       </div>
     )

--
Gitblit v1.8.0