From bfbd5a28cacbde2c5d69df79c817c1218da41dde Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期三, 11 九月 2024 18:21:54 +0800
Subject: [PATCH] 2024-09-11

---
 src/tabviews/zshare/actionList/normalbutton/index.jsx                 |    4 +-
 src/utils/utils-custom.js                                             |   40 +++++++++++++------
 src/tabviews/custom/components/table/edit-table/normalTable/index.jsx |   48 ++++++++++++++++-------
 3 files changed, 62 insertions(+), 30 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 34edff4..d5c4720 100644
--- a/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
+++ b/src/tabviews/custom/components/table/edit-table/normalTable/index.jsx
@@ -586,19 +586,34 @@
     const { config } = this.props
     const { value, err } = this.state
 
-    return (
-      <InputNumber
-        title={err}
-        className={err ? 'has-error' : ''}
-        ref={ref => this.node = ref}
-        precision={config.decimal || 0}
-        value={value}
-        onChange={(value) => this.onChange(value)}
-        onPressEnter={this.enterPress}
-        onFocus={this.onFocus}
-        onBlur={this.onBlur}
-      />
-    )
+    if (!config.decimal && config.decimal !== 0) {
+      return (
+        <InputNumber
+          title={err}
+          className={err ? 'has-error' : ''}
+          ref={ref => this.node = ref}
+          value={value}
+          onChange={(value) => this.onChange(value)}
+          onPressEnter={this.enterPress}
+          onFocus={this.onFocus}
+          onBlur={this.onBlur}
+        />
+      )
+    } else {
+      return (
+        <InputNumber
+          title={err}
+          className={err ? 'has-error' : ''}
+          ref={ref => this.node = ref}
+          precision={config.decimal}
+          value={value}
+          onChange={(value) => this.onChange(value)}
+          onPressEnter={this.enterPress}
+          onFocus={this.onFocus}
+          onBlur={this.onBlur}
+        />
+      )
+    }
   }
 }
 
@@ -1469,6 +1484,9 @@
           _item.datatype = _item.declareType || 'datetime'
         } else {
           _item.datatype = item.datatype
+        }
+        if (_item.type === 'number' && item.type === 'number') {
+          _item.decimal = item.decimal || 0
         }
 
         forms.push(_item)
@@ -2481,8 +2499,8 @@
       loading: true
     })
 
-    if (submit.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_' + submit.$menuId)) {
-      let ex = window.GLOB.CacheData.get('sql_' + submit.$menuId)
+    if (submit.intertype === 'system' && window.backend && window.GLOB.CacheData.has('sql_submit_' + submit.$menuId)) {
+      let ex = window.GLOB.CacheData.get('sql_submit_' + submit.$menuId)
       let param = this.getExps(ex, submit, data, forms)
 
       Api.genericInterface(param).then((res) => {
diff --git a/src/tabviews/zshare/actionList/normalbutton/index.jsx b/src/tabviews/zshare/actionList/normalbutton/index.jsx
index 913ab6b..158e42d 100644
--- a/src/tabviews/zshare/actionList/normalbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/normalbutton/index.jsx
@@ -2776,8 +2776,8 @@
           message: res.message || '缂撳瓨娓呯┖澶辫触锛�',
           duration: 5
         })
-      } else if (window.GLOB.mainSystemApi) {
-        Api.cacheInterface({rduri: window.GLOB.mainSystemApi.replace('dostars', 'excache')}).then(result => {
+      } else if (window.GLOB.localSystemApi) {
+        Api.cacheInterface({rduri: window.GLOB.localSystemApi.replace('dostars', 'excache')}).then(result => {
           if (!result.status) {
             notification.warning({
               top: 92,
diff --git a/src/utils/utils-custom.js b/src/utils/utils-custom.js
index 893d8aa..501e159 100644
--- a/src/utils/utils-custom.js
+++ b/src/utils/utils-custom.js
@@ -3129,7 +3129,7 @@
   
           if (item.subtype === 'editable' && item.submit.intertype === 'system') {
             item.submit.logLabel = item.$menuname + '-鎻愪氦'
-            let msg = getEditTableSql(item.submit, item.cols, item.columns)
+            let msg = getEditTableSql(item.submit, item.cols, item.columns, item.setting)
 
             sqls.push({uuid: 'submit_' + item.uuid, type: 'editable', ...msg})
           }
@@ -5149,7 +5149,7 @@
     return {LText: sql, md5: md5(sql), reps}
   }
 
-  let getEditTableSql = (btn, cols, columns) => {
+  let getEditTableSql = (btn, cols, columns, setting) => {
     let sheet = btn.sheet.replace(/@db@/ig, '')
     let database = ''
     if (/@db@/ig.test(btn.sheet)) {
@@ -5157,28 +5157,42 @@
     }
   
     let forms = []
-    let _fields = {}
-
-    columns.forEach(col => {
-      _fields[col.field] = col.datatype
-    })
+    let _forms = {}
+    let index = 0
 
     let getColumns = (cols) => {
       cols.forEach(item => {
         if (item.type === 'colspan') {
           getColumns(item.subcols)
         } else if (item.editable === 'true') {
-          forms.push({
-            field: item.field,
-            type: item.type,
-            datatype: _fields[item.field] || 'nvarchar(50)'
-          })
+          item.$sort = index
+          _forms[item.field] = item
+          index++
         }
       })
     }
 
     getColumns(cols)
-  
+
+    columns.forEach(item => {
+      if (item.field === setting.primaryKey) return
+
+      if (_forms[item.field]) {
+        let _item = {..._forms[item.field]}
+        if (_item.editType === 'date') {
+          _item.datatype = _item.declareType || 'datetime'
+        } else {
+          _item.datatype = item.datatype
+        }
+
+        forms.push(_item)
+      } else {
+        forms.push({...item, $sort: 999})
+      }
+    })
+
+    forms.sort((a, b) => a.$sort - b.$sort)
+
     let sql = ''
   
     let _initCustomScript = '' // 鍒濆鍖栬剼鏈�

--
Gitblit v1.8.0