From fb3ec146a9e1444ece749d0bcf232a554e933fb0 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期二, 17 五月 2022 22:56:16 +0800
Subject: [PATCH] Merge branch 'develop'

---
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |   99 ++++++++++++++++++++++++++++++-------------------
 1 files changed, 60 insertions(+), 39 deletions(-)

diff --git a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
index c72e73b..a628ea3 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -395,7 +395,7 @@
           content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
         }
   
-        content = col.prefix + content + col.postfix
+        content = (col.prefix || '') + content + (col.postfix || '')
       }
 
       if (col.marks) {
@@ -435,7 +435,7 @@
       }
 
       if (content) {
-        content = col.prefix + content + col.postfix
+        content = (col.prefix || '') + content + (col.postfix || '')
       }
 
       children = (
@@ -769,7 +769,7 @@
             content = content.replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,')
           }
     
-          content = col.prefix + content + col.postfix
+          content = (col.prefix || '') + content + (col.postfix || '')
         }
 
         if (col.marks) {
@@ -794,7 +794,7 @@
       }
 
       if (content) {
-        content = col.prefix + content + col.postfix
+        content = (col.prefix || '') + content + (col.postfix || '')
       }
 
       children = (
@@ -963,12 +963,12 @@
       })
     }
 
-    if (setting.borderColor) { // 杈规棰滆壊
-      let style = `#${setting.tableId} table, #${setting.tableId} tr, #${setting.tableId} th, #${setting.tableId} td {border-color: ${setting.borderColor}}`
-      let ele = document.createElement('style')
-      ele.innerHTML = style
-      document.getElementsByTagName('head')[0].appendChild(ele)
-    }
+    // if (setting.borderColor) { // 杈规棰滆壊
+    //   let style = `#${setting.tableId} table, #${setting.tableId} tr, #${setting.tableId} th, #${setting.tableId} td {border-color: ${setting.borderColor}}`
+    //   let ele = document.createElement('style')
+    //   ele.innerHTML = style
+    //   document.getElementsByTagName('head')[0].appendChild(ele)
+    // }
 
     let size = (setting.pageSize || 10) + ''
     let pageOptions = ['10', '25', '50', '100', '500', '1000']
@@ -991,6 +991,12 @@
       if (deForms.length > 0) {
         this.improveActionForm(deForms)
       }
+
+      const element = document.getElementById(setting.tableId)
+      element && element.style.setProperty('--mk-table-border-color', setting.borderColor || '#e8e8e8')
+      element && element.style.setProperty('--mk-table-color', setting.color || 'rgba(0, 0, 0, 0.65)')
+      element && element.style.setProperty('--mk-table-font-size', setting.fontSize || '14px')
+      element && element.style.setProperty('--mk-table-font-weight', setting.fontWeight || 'normal')
     })
   }
 
@@ -1238,6 +1244,10 @@
     } else if (setting.addable === 'true') {
       setTimeout(() => {
         this.plusLine()
+      }, 10)
+    } else if (edData[index]) {
+      setTimeout(() => {
+        this.subLine(col, edData[index])
       }, 10)
     }
   }
@@ -1877,7 +1887,11 @@
         if (pickup && setting.tableType === 'checkbox' && keys.length > 0) {
           this.setState({
             data: data,
-            edData: fromJS(data).toJS().filter(item => keys.includes(item.$$uuid))
+            edData: fromJS(data).toJS().filter(item => {
+              item.$origin = false
+              
+              return keys.includes(item.$$uuid)
+            })
           })
         } else {
           this.setState({
@@ -1943,34 +1957,41 @@
     let height = setting.height || false
 
     return (
-      <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${setting.operType || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}>
-        <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" disabled={loading || this.props.loading} checked={pickup} onChange={this.pickupChange} />
-        {pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null}
-        <Table
-          rowKey="$$uuid"
-          components={components}
-          style={setting.style}
-          size={setting.size || 'middle'}
-          bordered={setting.bordered !== 'false'}
-          rowSelection={rowSelection}
-          columns={_columns}
-          dataSource={_data}
-          loading={this.props.loading}
-          scroll={{ x: '100%', y: height }}
-          onRow={(record, index) => {
-            return {
-              lineMarks,
-              data: record,
-              onClick: () => {this.changeRow(record.$$uuid)},
-            }
-          }}
-          onChange={this.changeTable}
-          pagination={_pagination}
-        />
-        {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null}
-        {pickup && setting.addable === 'true' ? <Button className="mk-add-line" onClick={() => this.addLine()} disabled={this.props.loading} type="link"><PlusOutlined /></Button> : null}
-        {pickup && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-footer-table" type="link">鎻愪氦</Button> : null}
-      </div>
+      <>
+        {submit.hasAction && pickup ? <div className="edit-custom-table-leftbtn-wrap">
+          <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button>
+        </div> : null}
+        <div className="edit-custom-table-btn-wrap" style={submit.wrapStyle}>
+          {!submit.hasAction && pickup ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-table" type="link">鎻愪氦</Button> : null}
+          <Switch title="缂栬緫" className="main-pickup" checkedChildren="寮�" unCheckedChildren="鍏�" disabled={loading || this.props.loading} checked={pickup} onChange={this.pickupChange} />
+        </div>
+        <div className={`edit-custom-table ${pickup ? 'editable' : ''} ${setting.tableHeader || ''} ${setting.operType || ''} ${height ? 'fixed-height' : ''} ${setting.mode || ''}`} id={tableId}>
+          <Table
+            rowKey="$$uuid"
+            components={components}
+            // style={setting.style}
+            size={setting.size || 'middle'}
+            bordered={setting.bordered !== 'false'}
+            rowSelection={rowSelection}
+            columns={_columns}
+            dataSource={_data}
+            loading={this.props.loading}
+            scroll={{ x: '100%', y: height }}
+            onRow={(record, index) => {
+              return {
+                lineMarks,
+                data: record,
+                onClick: () => {this.changeRow(record.$$uuid)},
+              }
+            }}
+            onChange={this.changeTable}
+            pagination={_pagination}
+          />
+          {_footer ? <div className={'normal-table-footer ' + (_pagination ? 'pagination' : '')}>{_footer}</div> : null}
+          {pickup && setting.addable === 'true' ? <Button className="mk-add-line" onClick={() => this.addLine()} disabled={this.props.loading} type="link"><PlusOutlined /></Button> : null}
+          {pickup && _data.length > 10 ? <Button style={submit.style} onClick={() => setTimeout(() => {this.checkData()}, 10)} loading={loading} className="submit-footer-table" type="link">鎻愪氦</Button> : null}
+        </div>
+      </>
     )
   }
 }

--
Gitblit v1.8.0