From 85269739dfeb05ddb9038dcb950f389df4dc9439 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 02 五月 2025 11:53:49 +0800
Subject: [PATCH] 2025-05-02

---
 src/menu/replaceField/index.jsx |   90 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 90 insertions(+), 0 deletions(-)

diff --git a/src/menu/replaceField/index.jsx b/src/menu/replaceField/index.jsx
index 1250ac4..fbca31e 100644
--- a/src/menu/replaceField/index.jsx
+++ b/src/menu/replaceField/index.jsx
@@ -6,6 +6,7 @@
 
 import Api from '@/api'
 import Utils from '@/utils/utils.js'
+import { setLangSingleTrans } from '@/utils/utils-custom.js'
 import SettingForm from './settingform'
 import { queryTableSql } from '@/utils/option.js'
 import './index.scss'
@@ -104,6 +105,8 @@
   
           this.execLabel(map)
         }
+      } else if (res.resource === 'langs') {
+        this.getDicts()
       } else {
         let param = {func: 'sPC_Get_FieldName', TBName: res.table}
         if (window.GLOB.cloudServiceApi) { // 涓斿瓨鍦ㄤ簯绔湴鍧�
@@ -152,6 +155,93 @@
     })
   }
 
+  getDicts = () => {
+    let sql = `select mother_tongue as reg,translation as value,use_type as type,case when use_type='menu' then '鑿滃崟' when  use_type='button' then '鎸夐挳'  when  use_type='title' then '鏍囬'   when  use_type='list' then '閫夐」' else '鏂囨湰' end as use_type_text from s_app_lang_translation where appkey=@appkey@ and deleted=0 and translation != '' and lang='${sessionStorage.getItem('lang') || ''}'`
+
+    let param = {
+      func: 'sPC_Get_SelectedList',
+      LText: Utils.formatOptions(sql, 'x'),
+      obj_name: 'data',
+      arr_field: 'reg,value,type',
+      exec_type: 'x'
+    }
+
+    param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
+    param.secretkey = Utils.encrypt('', param.timestamp)
+    param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp)
+
+    this.$Api.getCloudConfig(param).then(result => {
+      if (!result.status) {
+        notification.warning({
+          top: 92,
+          message: result.message,
+          duration: 5
+        })
+        this.setState({
+          confirming: false
+        })
+        return
+      } else if (!result.data || result.data.length === 0) {
+        notification.warning({
+          top: 92,
+          message: '鏇挎崲鏁版嵁涓虹┖锛岃妫�鏌ュ綋鍓嶈瑷�涓嬫槸鍚﹀瓨鍦ㄨ瑷�鍖咃紒',
+          duration: 5
+        })
+        this.setState({
+          confirming: false
+        })
+        return
+      }
+
+      let btnDict = {}
+      let titDict = {}
+      let lisDict = {}
+      let menuDict = {}
+      let regs = []
+
+      result.data.forEach(item => {
+        if (item.type === 'button') {
+          btnDict[item.reg] = item.value
+        } else if (item.type === 'title') {
+          titDict[item.reg] = item.value
+        } else if (item.type === 'list') {
+          lisDict[item.reg] = item.value
+        } else if (item.type === 'text') {
+          regs.push({reg: new RegExp(item.reg, 'g'), value: item.value, sort: item.reg.length})
+        } else if (item.type === 'menu') {
+          menuDict[item.reg] = item.value
+        }
+      })
+
+      regs.sort((a, b) => b.sort - a.sort)
+
+      let config = fromJS(this.props.config).toJS()
+
+      setLangSingleTrans(config, btnDict, titDict, lisDict, menuDict, regs)
+
+      this.setState({
+        confirming: false,
+        visible: false
+      })
+  
+      if (is(fromJS(this.props.config), fromJS(config))) {
+        notification.success({
+          top: 92,
+          message: '鏈彂鐜伴渶瑕佹浛鎹㈢殑淇℃伅銆�',
+          duration: 3
+        })
+        return
+      }
+  
+      notification.success({
+        top: 92,
+        message: '鏇挎崲宸插畬鎴愩��',
+        duration: 3
+      })
+      this.props.updateConfig(config)
+    })
+  }
+
   // 渚濇嵁鍘熷瓧娈垫浛鎹负鏂板瓧娈�
   exec = (map) => {
     let config = fromJS(this.props.config).toJS()

--
Gitblit v1.8.0