From 2bccb9ec7bdefe23292a22bc153463cfa1479a49 Mon Sep 17 00:00:00 2001
From: king <18310653075@163.com>
Date: 星期五, 21 六月 2024 16:25:42 +0800
Subject: [PATCH] 2024-06-21

---
 src/tabviews/zshare/actionList/printbutton/index.jsx |  125 ++++++++++++++++++-----------------------
 1 files changed, 55 insertions(+), 70 deletions(-)

diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx
index e16a32c..6d2e96c 100644
--- a/src/tabviews/zshare/actionList/printbutton/index.jsx
+++ b/src/tabviews/zshare/actionList/printbutton/index.jsx
@@ -37,7 +37,8 @@
     loading: false,
     disabled: false,
     hidden: false,
-    autoMatic: false
+    autoMatic: false,
+    dict: window.GLOB.dict
   }
 
   UNSAFE_componentWillMount () {
@@ -130,21 +131,20 @@
   /**
    * @description 瑙﹀彂鎸夐挳鎿嶄綔
    */
-  actionTrigger = (triggerId, record, type) => {
-    const { BID, btn, selectedData, setting } = this.props
-    const { loading, disabled } = this.state
+  actionTrigger = (triggerId, record, type, lid) => {
+    const { BID, btn, selectedData, setting, LID } = this.props
+    const { loading, disabled, dict } = this.state
 
     if (loading || disabled) return
     if (triggerId && btn.uuid !== triggerId) return
+    if (type === 'linkbtn' && !btn.$toolbtn && LID !== lid) return
 
     if (setting.supModule && !BID) {
       notification.warning({
         top: 92,
-        message: '闇�瑕佷笂绾т富閿�硷紒',
+        message: dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒',
         duration: 5
       })
-      return
-    } else if (type === 'linkbtn' && !btn.$toolbtn && !is(fromJS(selectedData || []), fromJS(record))) {
       return
     }
 
@@ -157,7 +157,7 @@
       // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹�
       notification.warning({
         top: 92,
-        message: '璇烽�夋嫨琛岋紒',
+        message: dict['select_row'] || '璇烽�夋嫨琛岋紒',
         duration: 5
       })
       return
@@ -165,21 +165,7 @@
       // 闇�瑕侀�夋嫨鍗曡鏃讹紝鏍¢獙鏁版嵁
       notification.warning({
         top: 92,
-        message: '璇烽�夋嫨鍗曡鏁版嵁锛�',
-        duration: 5
-      })
-      return
-    } else if (!btn.verify || !btn.verify.printMode) {
-      notification.warning({
-        top: 92,
-        message: '璇峰畬鍠勬墦鍗伴獙璇佷俊鎭紒',
-        duration: 5
-      })
-      return
-    } else if (btn.intertype === 'system' && btn.verify.dataType === 'custom' && (!btn.verify.setting || btn.verify.columns.length === 0)) {
-      notification.warning({
-        top: 92,
-        message: '鑷畾涔夋墦鍗版暟鎹璁剧疆鏁版嵁婧愶紒',
+        message: dict['select_single_row'] || '璇烽�夋嫨鍗曡鏁版嵁锛�',
         duration: 5
       })
       return
@@ -204,7 +190,9 @@
     } else if (btn.execMode === 'prompt') {
       this.setState({ loading: true })
       confirm({
-        title: '纭畾瑕佹墽琛屽悧?',
+        title: dict['exec_sure'] || '纭畾瑕佹墽琛屽悧?',
+        okText: dict['ok'] || '纭畾',
+        cancelText: dict['cancel'] || '鍙栨秷',
         onOk() {
           _this.triggerPrint(data)
         },
@@ -508,7 +496,7 @@
       if (list.length === 0) {
         notification.warning({
           top: 92,
-          message: '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�',
+          message: window.GLOB.dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�',
           duration: 5
         })
         return false
@@ -535,7 +523,7 @@
       if (!result.ConfigParam) {
         notification.warning({
           top: 92,
-          message: '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�',
+          message: window.GLOB.dict['no_print_temp'] || '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�',
           duration: 5
         })
         this.setState({ loading: false })
@@ -786,7 +774,7 @@
 
       notification.warning({
         top: 92,
-        message: '鑷畾涔夊嚱鏁版墽琛岄敊璇紒',
+        message: window.GLOB.dict['func_error'] || '鑷畾涔夊嚱鏁版墽琛岄敊璇紒',
         duration: 5
       })
     }
@@ -915,6 +903,9 @@
               _param.username = sessionStorage.getItem('User_Name') || ''
               _param.fullname = sessionStorage.getItem('Full_Name') || ''
             }
+            if (btn.dataM === 'true') {
+              _param.dataM = sessionStorage.getItem('dataM') === 'true' ? 'Y' : ''
+            }
   
             return _param
           })
@@ -1007,7 +998,7 @@
     }
 
     let isDataM = sessionStorage.getItem('dataM') === 'true'
-    let custompage = /@pageSize@|@orderBy@/i.test(_dataresource + _customScript + _tailScript)
+    let custompage = /@pageSize@|@orderBy@|@mk_total/i.test(_dataresource + _customScript + _tailScript)
     let regoptions = [
       { reg: /@orderBy@/ig, value: btn.verify.setting.order },
       { reg: /@pageSize@/ig, value: '9999' },
@@ -1018,6 +1009,7 @@
       { reg: /@SessionUid@/ig, value: `'${localStorage.getItem('SessionUid') || ''}'`},
       { reg: /@UserID@/ig, value: `'${sessionStorage.getItem('UserID') || ''}'`},
       { reg: /@Appkey@/ig, value: `'${window.GLOB.appkey || ''}'`},
+      { reg: /@lang@/ig, value: `'${sessionStorage.getItem('lang')}'`},
       { reg: /@typename@/ig, value: `'admin'`},
       { reg: /\$@/ig, value: isDataM ? '/*' : ''},
       { reg: /@\$/ig, value: isDataM ? '*/' : ''},
@@ -1342,7 +1334,7 @@
     let imgs = []
 
     if (!res.ConfigParam) {
-      error = '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�'
+      error = window.GLOB.dict['no_print_temp'] || '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�'
     } else {
       try {
         configParam = JSON.parse(window.decodeURIComponent(window.atob(res.ConfigParam)))
@@ -1499,7 +1491,7 @@
     if (list.length === 0) {
       notification.warning({
         top: 92,
-        message: '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�',
+        message: window.GLOB.dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�',
         duration: 5
       })
       this.setState({ loading: false })
@@ -1618,7 +1610,7 @@
     Api.postekPrint(param).then(res => {
       if (res.retval === '0') {
         if (params.length === 0) {
-          this.execSuccess({ ErrCode: 'S', message: '鎵撳嵃璇锋眰宸插彂鍑恒��', status: true })
+          this.execSuccess({ ErrCode: 'S', message: window.GLOB.dict['print_out'] || '鎵撳嵃璇锋眰宸插彂鍑恒��', status: true })
         } else {
           setTimeout(() => {
             this.loopRFIDPrint(params)
@@ -1636,6 +1628,8 @@
 
   execPrint = (list, template) => {
     const { btn } = this.props
+    const { dict } = this.state
+
     let _errors = []
 
     let defaultPrinter = btn.verify.defaultPrinter || 'lackprinter'
@@ -1736,13 +1730,13 @@
       if (btn.verify.emptyTip === 'false') {
         this.execSuccess({
           ErrCode: '-1',
-          message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
+          message: dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
           status: true
         })
       } else {
         this.execError({
           ErrCode: 'N',
-          message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
+          message: dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
           status: false
         })
       }
@@ -1756,7 +1750,7 @@
           lackerror.push(`鏁版嵁涓湭鑾峰彇鍒版ā鏉匡紙${err.title}锛�${err.lacks.join('銆�')} 瀛楁`)
         }
         if (err.emptys.length > 0) {
-          emptyerror.push(`鏁版嵁涓ā鏉匡紙${err.title}锛� ${err.emptys.join('銆�')} 瀛楁涓嶅彲涓虹┖`)
+          emptyerror.push(dict['not_empty'] ? `${err.title}: ${err.emptys.join('銆�')} ${dict['not_empty']}` : `鏁版嵁涓ā鏉匡紙${err.title}锛� ${err.emptys.join('銆�')} 瀛楁涓嶅彲涓虹┖`)
         }
       })
 
@@ -1780,7 +1774,7 @@
     if (printerList.length === 0) {
       this.execSuccess({
         ErrCode: '-1',
-        message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
+        message: dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�',
         status: true
       })
       return
@@ -1792,7 +1786,7 @@
       this.syncMessageSend(printerList, () => {
         this.execSuccess({
           ErrCode: 'S',
-          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          message: dict['print_out'] || '鎵撳嵃璇锋眰宸插彂鍑恒��',
           status: true
         })
       })
@@ -1803,7 +1797,7 @@
       this.syncMessageSend(printerList, () => {
         this.execSuccess({
           ErrCode: 'S',
-          message: '鎵撳嵃璇锋眰宸插彂鍑恒��',
+          message: dict['print_out'] || '鎵撳嵃璇锋眰宸插彂鍑恒��',
           status: true
         })
       })
@@ -1854,7 +1848,7 @@
     socket.onerror = () => {
       this.execError({
         ErrCode: 'N',
-        message: '鏃犳硶杩炴帴鍒�:' + btn.verify.linkUrl,
+        message: (dict['un_connect'] || '鏃犳硶杩炴帴鍒�') + ':' + btn.verify.linkUrl,
         status: false
       })
     }
@@ -1890,17 +1884,18 @@
    */
   execSuccess = (res = {}) => {
     const { btn } = this.props
-    const { autoMatic, btnconfig } = this.state
+    const { autoMatic, btnconfig, dict } = this.state
 
     if ((res.ErrCode === 'S' || !res.ErrCode) || autoMatic) { // 鎵ц鎴愬姛
       notification.success({
         top: 92,
-        message: res.message || '鎵ц鎴愬姛锛�',
+        message: res.message || dict['exc_success'] || '鎵ц鎴愬姛锛�',
         duration: btn.verify && btn.verify.stime ? btn.verify.stime : 2
       })
     } else if (res.ErrCode === 'Y') { // 鎵ц鎴愬姛
       Modal.success({
-        title: res.message || '鎵ц鎴愬姛锛�'
+        title: res.message || dict['exc_success'] || '鎵ц鎴愬姛锛�',
+        okText: dict['got_it'] || '鐭ラ亾浜�'
       })
     } else if (res.ErrCode === '-1') { // 瀹屾垚鍚庝笉鎻愮ず
 
@@ -1939,7 +1934,7 @@
    */
   execError = (res) => {
     const { btn } = this.props
-    const { btnconfig, autoMatic } = this.state
+    const { btnconfig, autoMatic, dict } = this.state
 
     if (!['LoginError', 'C', '-2', 'E', 'N', 'F', 'NM'].includes(res.ErrCode)) {
       res.ErrCode = 'E'
@@ -1947,23 +1942,24 @@
 
     if (res.ErrCode === 'E' && !autoMatic) {
       Modal.error({
-        title: res.message || '鎵ц澶辫触锛�',
+        title: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
+        okText: dict['got_it'] || '鐭ラ亾浜�'
       })
     } else if (res.ErrCode === 'N' || autoMatic) {
       notification.error({
         top: 92,
-        message: res.message || '鎵ц澶辫触锛�',
+        message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
         duration: btn.verify && btn.verify.ntime ? btn.verify.ntime : 10
       })
     } else if (res.ErrCode === 'F') {
       notification.error({
         className: 'notification-custom-error',
         top: 92,
-        message: res.message || '鎵ц澶辫触锛�',
+        message: res.message || dict['exc_fail'] || '鎵ц澶辫触锛�',
         duration: btn.verify && btn.verify.ftime ? btn.verify.ftime : 10
       })
     } else if (res.ErrCode === 'NM') {
-      message.error(res.message || '鎵ц澶辫触锛�')
+      message.error(res.message || dict['exc_fail'] || '鎵ц澶辫触锛�')
     }
     
     this.setState({
@@ -2111,7 +2107,7 @@
   }
 
   modelconfirm = () => {
-    const { btnconfig, selines } = this.state
+    const { btnconfig, selines, dict } = this.state
     let _this = this
     let result = []
     let _data = {}
@@ -2254,7 +2250,9 @@
       this.execSubmit(selines, () => {}, result)
     } else {
       confirm({
-        title: '纭畾瑕佹墽琛屽悧?',
+        title: dict['exec_sure'] || '纭畾瑕佹墽琛屽悧?',
+        okText: dict['ok'] || '纭畾',
+        cancelText: dict['cancel'] || '鍙栨秷',
         onOk() {
           _this.triggerPrint(selines, result)
         },
@@ -2270,7 +2268,7 @@
    */
   getModels = () => {
     const { BID, btn } = this.props
-    const { btnconfig } = this.state
+    const { btnconfig, dict } = this.state
 
     if (!this.state.visible || !btnconfig || !btnconfig.setting) return null
 
@@ -2304,6 +2302,8 @@
         visible={this.state.visible}
         confirmLoading={this.state.confirmLoading}
         width={width}
+        okText={dict['ok'] || '纭畾'}
+        cancelText={dict['cancel'] || '鍙栨秷'}
         maskStyle={btnconfig.setting.moveable === 'true' ?  {backgroundColor: 'rgba(0, 0, 0, 0.15)'} : null}
         onOk={this.handleOk}
         onCancel={this.handleCancel}
@@ -2365,39 +2365,24 @@
     if (hidden) return null
 
     let label = ''
-    let icon = ''
-    let type = 'link'
-    let className = ''
 
-    if (btn.show === 'button') {
-      label = btn.label
-      icon = btn.icon || ''
-    } else if (btn.show === 'link') {
-      label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon}/> : ''}</span>
-      icon = ''
+    if (btn.show === 'link') {
+      label = <span>{btn.label}{btn.icon ? <MkIcon style={{marginLeft: '8px'}} type={btn.icon} /> : ''}</span>
     } else if (btn.show === 'icon') {
-      icon = btn.icon || ''
-    } else if (!btn.$toolbtn) {
-      icon = btn.icon || ''
-      label = btn.label
-      className = 'mk-btn mk-' + btn.class
+      label = !loading ? <MkIcon type={btn.icon} /> : null
     } else {
-      type = ''
-      icon = btn.icon || ''
-      label = btn.label
-      className = 'mk-btn mk-' + btn.class
+      label = <span>{!loading && btn.icon ? <MkIcon style={{marginRight: '8px'}} type={btn.icon} /> : ''}{btn.label}</span>
     }
 
     return <>
       <Button
-        type={type}
+        type="link"
         id={'button' + btn.uuid}
         title={disabled ? (btn.reason || '') : (btn.show === 'icon' ? btn.label : '')}
         loading={loading}
         disabled={disabled}
         style={btn.style || null}
-        icon={icon}
-        className={className}
+        className={btn.hover || ''}
         onClick={(e) => {e.stopPropagation(); this.actionTrigger()}}
       >{label}</Button>
       <span onClick={(e) => {e.stopPropagation()}}>{this.getModels()}</span>

--
Gitblit v1.8.0