From ba9e189dd33c8d48f7f4ac36bcefeef9afb426f8 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期一, 17 七月 2023 23:40:49 +0800
Subject: [PATCH] 2023-07-17

---
 src/tabviews/custom/components/form/step-form/index.jsx |   57 +++++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/src/tabviews/custom/components/form/step-form/index.jsx b/src/tabviews/custom/components/form/step-form/index.jsx
index da6c1eb..3965ad6 100644
--- a/src/tabviews/custom/components/form/step-form/index.jsx
+++ b/src/tabviews/custom/components/form/step-form/index.jsx
@@ -62,6 +62,7 @@
           _data = _data[0] || {$$empty: true}
         }
         _sync = false
+        _data.$$uuid = _data[config.setting.primaryKey] || ''
       }
     } else {
       _data = {$$empty: true}
@@ -97,11 +98,21 @@
 
     let _group = config.subcards[0]
 
-    if (_data && config.wrap.statusControl && _data[config.wrap.statusControl]) {
-      let _status = _data[config.wrap.statusControl]
+    if (_data && config.wrap.statusControl && _data[config.wrap.statusControl] !== undefined) {
+      let _status = _data[config.wrap.statusControl] + ''
 
       let _groups = config.subcards.filter(item => item.setting.status === _status)[0]
       _group = _groups || _group
+    }
+
+    config.titleStyle = {}
+    config.sortStyle = {}
+
+    if (config.style.fontSize) {
+      let size = parseInt(config.style.fontSize)
+      config.titleStyle = {fontSize: size}
+      let s = size * 1.5 + 'px'
+      config.sortStyle = {width: s, height: s, lineHeight: s, borderRadius: s}
     }
 
     this.setState({
@@ -159,8 +170,10 @@
         }
       }
 
-      if (config.wrap.statusControl && _data[config.wrap.statusControl]) {
-        let _status = _data[config.wrap.statusControl]
+      _data.$$uuid = _data[config.setting.primaryKey] || ''
+
+      if (config.wrap.statusControl && _data[config.wrap.statusControl] !== undefined) {
+        let _status = _data[config.wrap.statusControl] + ''
         let _groups = config.subcards.filter(item => item.setting.status === _status)[0]
         _group = _groups || _group
       }
@@ -192,7 +205,7 @@
 
     if (group.uuid !== menuId) return
 
-    if (position === 'mainline' && config.setting.supModule && BID) {
+    if ((position === 'mainline' || position === 'popclose') && config.setting.supModule && BID) {
       MKEmitter.emit('reloadData', config.setting.supModule, BID)
     } else {
       this.loadData()
@@ -272,6 +285,7 @@
       }, () => {
         this.setState({data: {$$empty: true}})
       })
+      MKEmitter.emit('resetSelectLine', config.uuid, '', '')
       return
     }
 
@@ -294,12 +308,14 @@
       let _data = result.data && result.data[0] ? result.data[0] : {$$empty: true}
       let _group = this.state.group
 
+      _data.$$uuid = _data[config.setting.primaryKey] || ''
+
       if (type === 'refresh') {
         _group = config.subcards[0]
       }
 
-      if (config.wrap.statusControl && _data[config.wrap.statusControl]) {
-        let _status = _data[config.wrap.statusControl]
+      if (config.wrap.statusControl && _data[config.wrap.statusControl] !== undefined) {
+        let _status = _data[config.wrap.statusControl] + ''
         let _groups = config.subcards.filter(item => item.setting.status === _status)[0]
         _group = _groups || _group
       }
@@ -318,16 +334,33 @@
       }, () => {
         this.setState({group: _group})
       })
+
+      MKEmitter.emit('resetSelectLine', config.uuid, _data.$$uuid, _data)
+
+      if (result.message) {
+        if (result.ErrCode === 'Y') {
+          Modal.success({
+            title: result.message
+          })
+        } else if (result.ErrCode === 'S') {
+          notification.success({
+            top: 92,
+            message: result.message,
+            duration: 2
+          })
+        }
+      }
     } else {
       this.setState({
         loading: false,
       })
       
+      if (!result.message) return
       if (result.ErrCode === 'N') {
         Modal.error({
           title: result.message,
         })
-      } else {
+      } else if (result.ErrCode !== '-2') {
         notification.error({
           top: 92,
           message: result.message,
@@ -380,6 +413,9 @@
   render() {
     const { config, loading, BID, BData, data, group, dict, step } = this.state
 
+    if (config.wrap.empty === 'hidden' && (!data || data.$$empty)) return null
+    if (config.idCtrl && (!data || data.$$empty)) return null
+    
     return (
       <div className="custom-normal-form-box" id={'anchor' + config.uuid} style={{...config.style}}>
         {loading ?
@@ -390,8 +426,8 @@
         }
         {config.wrap.groupLabel !== 'hidden' ? <div className="mk-normal-form-title">
           {config.subcards.map(card => (
-            <div key={card.uuid} className={'form-title' + (card.sort <= step ? ' active' : '')}>
-              <span className="form-sort" style={{background: config.wrap.color}}>{card.sort}</span>
+            <div key={card.uuid} style={config.titleStyle} className={'form-title' + (card.sort <= step ? ' active' : '')}>
+              <span className="form-sort" style={{background: config.wrap.color, ...config.sortStyle}}>{card.sort}</span>
               <span className="before-line" style={{background: config.wrap.color}}></span>
               <span className="after-line" style={{background: config.wrap.color}}></span>
               {card.setting.title}
@@ -404,6 +440,7 @@
           dict={dict}
           data={data}
           action={group}
+          unload={config.setting.supModule && !BID}
           inputSubmit={() => this.mkFormSubmit(group.uuid)}
           wrappedComponentRef={(inst) => this.formRef = inst}
         /> : null}

--
Gitblit v1.8.0