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

---
 src/menu/components/form/formaction/formconfig.jsx           |   27 ++++++++
 src/tabviews/custom/components/table/base-table/index.jsx    |   30 ++++-----
 src/tabviews/custom/components/table/base-table/index.scss   |   13 ----
 src/menu/components/form/formaction/index.jsx                |    2 
 src/tabviews/zshare/mutilform/mkInput/index.jsx              |   16 +++++
 src/tabviews/zshare/mutilform/mkNumberInput/index.jsx        |   11 +++
 src/menu/components/form/formaction/actionform/index.jsx     |    2 
 src/tabviews/custom/components/table/normal-table/index.jsx  |   36 +++++------
 src/tabviews/zshare/actionList/normalbutton/index.jsx        |    4 +
 src/tabviews/custom/components/table/normal-table/index.scss |   13 ----
 src/tabviews/custom/components/share/normalTable/index.scss  |    8 ++
 11 files changed, 97 insertions(+), 65 deletions(-)

diff --git a/src/menu/components/form/formaction/actionform/index.jsx b/src/menu/components/form/formaction/actionform/index.jsx
index 41ed2a2..a55b914 100644
--- a/src/menu/components/form/formaction/actionform/index.jsx
+++ b/src/menu/components/form/formaction/actionform/index.jsx
@@ -57,7 +57,7 @@
     } else if (this.record.type === 'close' || this.record.type === 'reset') {
       shows = ['typeName', 'label']
     } else {
-      shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton'] // 閫夐」鍒楄〃
+      shows = ['typeName', 'label', 'intertype', 'Ot', 'execSuccess', 'syncComponent', 'anchors', 'linkmenu', 'output', 'reload', 'preButton', 'resetForm'] // 閫夐」鍒楄〃
       
       if (this.record.intertype === 'custom') {
         shows.pop()
diff --git a/src/menu/components/form/formaction/formconfig.jsx b/src/menu/components/form/formaction/formconfig.jsx
index 978be6e..75d27e3 100644
--- a/src/menu/components/form/formaction/formconfig.jsx
+++ b/src/menu/components/form/formaction/formconfig.jsx
@@ -4,7 +4,7 @@
  * @param {*} type           鎸夐挳绫诲瀷锛岀敤浜庡尯鍒嗗彲閫夌殑鎵撳紑鏂瑰紡
  */
 
-export function getActionForm (card, functip, tableName, usefulFields, modules, anchors, uuid) {
+export function getActionForm (card, functip, tableName, usefulFields, modules, anchors, uuid, fields) {
   const appType = sessionStorage.getItem('appType')
   let viewType = sessionStorage.getItem('editMenuType') // 寮圭獥 popview
   let _type = '鎻愪氦'
@@ -121,6 +121,21 @@
       value: 'popclose',  // 鎵ц寮圭獥鍏抽棴鏃剁殑鍒锋柊
       text: '鍒锋柊婧愮粍浠�'
     })
+  }
+
+  let resets = []
+  fields.forEach(item => {
+    if (item.hidden === 'true') return
+    if (item.type !== 'text' && item.type !== 'number') return
+
+    resets.push({
+      value: item.uuid,
+      text: item.label
+    })
+  })
+
+  if (card.resetForm && resets.findIndex(item => item.value === card.resetForm) === -1) {
+    card.resetForm = ''
   }
 
   return [
@@ -476,6 +491,16 @@
       options: linkButtons
     },
     {
+      type: 'select',
+      key: 'resetForm',
+      label: '閲嶇疆琛ㄥ崟',
+      tooltip: '鎸夐挳鎵ц鎴愬姛鍚庨渶瑕侀噸缃殑琛ㄥ崟锛岃〃鍗曚細鎭㈠榛樿鍊煎苟鑱氱劍銆�',
+      initVal: card.resetForm || '',
+      required: false,
+      allowClear: true,
+      options: resets
+    },
+    {
       type: 'radio',
       key: 'reload',
       label: '涓婁竴椤�',
diff --git a/src/menu/components/form/formaction/index.jsx b/src/menu/components/form/formaction/index.jsx
index f1f8127..dc697e0 100644
--- a/src/menu/components/form/formaction/index.jsx
+++ b/src/menu/components/form/formaction/index.jsx
@@ -110,7 +110,7 @@
     this.setState({
       visible: true,
       card: card,
-      formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors, group.uuid)
+      formlist: getActionForm(card, functip, config.setting.tableName, usefulFields, modules, anchors, group.uuid, group.fields)
     })
   }
 
diff --git a/src/tabviews/custom/components/share/normalTable/index.scss b/src/tabviews/custom/components/share/normalTable/index.scss
index 12ad8fd..3bf6756 100644
--- a/src/tabviews/custom/components/share/normalTable/index.scss
+++ b/src/tabviews/custom/components/share/normalTable/index.scss
@@ -1,11 +1,19 @@
 .normal-custom-table {
   position: relative;
   padding: 0px;
+  min-height: 40px;
   --mk-table-border-color: #e8e8e8;
   --mk-table-color: rgba(0, 0, 0, 0.65);
   --mk-table-font-size: 14px;
   --mk-table-font-weight: normal;
 
+  .main-pickup {
+    position: absolute;
+    right: 5px;
+    top: -22px;
+    z-index: 2;
+  }
+  
   .normal-table-footer {
     padding: 10px 0px;
     color: rgba(0, 0, 0, 0.65);
diff --git a/src/tabviews/custom/components/table/base-table/index.jsx b/src/tabviews/custom/components/table/base-table/index.jsx
index 538a792..0693483 100644
--- a/src/tabviews/custom/components/table/base-table/index.jsx
+++ b/src/tabviews/custom/components/table/base-table/index.jsx
@@ -653,22 +653,20 @@
           columns={config.columns}
           selectedData={selectedData}
         /> : <div style={{height: '25px'}}></div>}
-        <div className="main-table-box">
-          <MainTable
-            data={data}
-            setting={setting}
-            columns={columns}
-            MenuID={config.uuid}
-            fields={config.columns}
-            total={this.state.total}
-            autoMatic={config.autoMatic}
-            lineMarks={config.lineMarks}
-            loading={this.state.loading}
-            refreshdata={this.refreshbytable}
-            statFValue={this.state.statFValue}
-            chgSelectData={(selects) => this.setState({selectedData: selects})}
-          />
-        </div>
+        <MainTable
+          data={data}
+          setting={setting}
+          columns={columns}
+          MenuID={config.uuid}
+          fields={config.columns}
+          total={this.state.total}
+          autoMatic={config.autoMatic}
+          lineMarks={config.lineMarks}
+          loading={this.state.loading}
+          refreshdata={this.refreshbytable}
+          statFValue={this.state.statFValue}
+          chgSelectData={(selects) => this.setState({selectedData: selects})}
+        />
       </div>
     )
   }
diff --git a/src/tabviews/custom/components/table/base-table/index.scss b/src/tabviews/custom/components/table/base-table/index.scss
index bc4f7bc..b04c6bc 100644
--- a/src/tabviews/custom/components/table/base-table/index.scss
+++ b/src/tabviews/custom/components/table/base-table/index.scss
@@ -12,17 +12,4 @@
   .button-list.toolbar-button {
     padding-right: 60px;
   }
-  .main-table-box {
-    position: relative;
-    min-height: 40px;
-    .main-pickup {
-      position: absolute;
-      right: 5px;
-      top: -22px;
-      z-index: 2;
-    }
-    >.async-spin {
-      line-height: 150px!important;
-    }
-  }
 }
\ No newline at end of file
diff --git a/src/tabviews/custom/components/table/normal-table/index.jsx b/src/tabviews/custom/components/table/normal-table/index.jsx
index 136a42c..a1492a3 100644
--- a/src/tabviews/custom/components/table/normal-table/index.jsx
+++ b/src/tabviews/custom/components/table/normal-table/index.jsx
@@ -835,7 +835,7 @@
     }
 
     let content = <>
-      {config.search && config.search.length ?
+      {config.search.length ?
         <MainSearch BID={BID} config={config} refreshdata={this.refreshbysearch}/> : null
       }
       {actions.length > 0 ? <MainAction
@@ -845,24 +845,22 @@
         BData={BData}
         columns={config.columns}
         selectedData={selectedData}
-      /> : <div className="mk-action-space" style={{height: '25px'}}></div>}
-      <div className={'main-table-box ' + (!actions || actions.length === 0 ? 'no-action' : '')}>
-        <MainTable
-          setting={setting}
-          columns={columns}
-          MenuID={config.uuid}
-          allSearch={allSearch}
-          data={this.state.data}
-          fields={config.columns}
-          total={this.state.total}
-          colsCtrls={config.colsCtrls}
-          lineMarks={config.lineMarks}
-          loading={this.state.loading}
-          refreshdata={this.refreshbytable}
-          statFValue={this.state.statFValue}
-          chgSelectData={(selects) => this.setState({selectedData: selects})}
-        />
-      </div>
+      /> : (setting.tableType || config.search.length > 0 ? <div className="mk-action-space" style={{height: '25px'}}></div> : null)}
+      <MainTable
+        setting={setting}
+        columns={columns}
+        MenuID={config.uuid}
+        allSearch={allSearch}
+        data={this.state.data}
+        fields={config.columns}
+        total={this.state.total}
+        colsCtrls={config.colsCtrls}
+        lineMarks={config.lineMarks}
+        loading={this.state.loading}
+        refreshdata={this.refreshbytable}
+        statFValue={this.state.statFValue}
+        chgSelectData={(selects) => this.setState({selectedData: selects})}
+      />
     </>
 
     return (
diff --git a/src/tabviews/custom/components/table/normal-table/index.scss b/src/tabviews/custom/components/table/normal-table/index.scss
index 5f5f0da..30ecedf 100644
--- a/src/tabviews/custom/components/table/normal-table/index.scss
+++ b/src/tabviews/custom/components/table/normal-table/index.scss
@@ -12,19 +12,6 @@
   .button-list.toolbar-button {
     padding-right: 60px;
   }
-  .main-table-box {
-    position: relative;
-    min-height: 40px;
-    .main-pickup {
-      position: absolute;
-      right: 5px;
-      top: -22px;
-      z-index: 2;
-    }
-    >.async-spin {
-      line-height: 150px!important;
-    }
-  }
   .ant-collapse {
     background-color: transparent;
     border-radius: 0px;
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 9de05d4..0c5ae33 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -2176,6 +2176,10 @@
     const { btn } = this.props
     const { autoMatic } = this.state
 
+    if (btn.resetForm) {
+      MKEmitter.emit('mkFC', 'reset', btn.resetForm)
+    }
+
     if (this.preCallback) {
       this.setState({
         loading: false,
diff --git a/src/tabviews/zshare/mutilform/mkInput/index.jsx b/src/tabviews/zshare/mutilform/mkInput/index.jsx
index 2092679..b85134d 100644
--- a/src/tabviews/zshare/mutilform/mkInput/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkInput/index.jsx
@@ -78,6 +78,22 @@
       } else {
         this.props.onChange(_val, true)
       }
+    } else if (type === 'reset') {
+      let _val = this.props.config.initval
+
+      if (this.state.encryption === 'true' && _val) {
+        try {
+          _val = window.decodeURIComponent(window.atob(_val))
+        } catch (e) {
+          _val = this.props.config.initval
+        }
+      }
+
+      this.setState({value: _val}, () => {
+        this.inputRef.current.select()
+      })
+
+      this.props.onChange(this.props.config.initval)
     }
   }
 
diff --git a/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx b/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx
index 47a1840..c517566 100644
--- a/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx
+++ b/src/tabviews/zshare/mutilform/mkNumberInput/index.jsx
@@ -40,10 +40,19 @@
 
     if (type === 'focus') {
       let node = document.getElementById(uuid)
-      node.select()
+      node && node.select()
     } else if (type === 'input') {
       this.setState({value})
       this.props.onChange(value, true)
+    } else if (type === 'reset') {
+      let _val = this.props.config.initval
+
+      this.setState({value: _val}, () => {
+        let node = document.getElementById(this.props.config.uuid)
+        node && node.select()
+      })
+
+      this.props.onChange(_val)
     }
   }
 

--
Gitblit v1.8.0