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 | 85 ++++++++++++++++++++---------------------- 1 files changed, 41 insertions(+), 44 deletions(-) diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 08898cd..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 () { @@ -132,7 +133,7 @@ */ actionTrigger = (triggerId, record, type, lid) => { const { BID, btn, selectedData, setting, LID } = this.props - const { loading, disabled } = this.state + const { loading, disabled, dict } = this.state if (loading || disabled) return if (triggerId && btn.uuid !== triggerId) return @@ -141,7 +142,7 @@ if (setting.supModule && !BID) { notification.warning({ top: 92, - message: '闇�瑕佷笂绾т富閿�硷紒', + message: dict['sup_key_req'] || '闇�瑕佷笂绾т富閿�硷紒', duration: 5 }) return @@ -156,7 +157,7 @@ // 闇�瑕侀�夋嫨琛屾椂锛屾牎楠屾暟鎹� notification.warning({ top: 92, - message: '璇烽�夋嫨琛岋紒', + message: dict['select_row'] || '璇烽�夋嫨琛岋紒', duration: 5 }) return @@ -164,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 @@ -203,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) }, @@ -507,7 +496,7 @@ if (list.length === 0) { notification.warning({ top: 92, - message: '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�', + message: window.GLOB.dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�', duration: 5 }) return false @@ -534,7 +523,7 @@ if (!result.ConfigParam) { notification.warning({ top: 92, - message: '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�', + message: window.GLOB.dict['no_print_temp'] || '鏈幏鍙栧埌鎵撳嵃妯℃澘淇℃伅锛�', duration: 5 }) this.setState({ loading: false }) @@ -785,7 +774,7 @@ notification.warning({ top: 92, - message: '鑷畾涔夊嚱鏁版墽琛岄敊璇紒', + message: window.GLOB.dict['func_error'] || '鑷畾涔夊嚱鏁版墽琛岄敊璇紒', duration: 5 }) } @@ -1345,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))) @@ -1502,7 +1491,7 @@ if (list.length === 0) { notification.warning({ top: 92, - message: '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�', + message: window.GLOB.dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃鏁版嵁锛�', duration: 5 }) this.setState({ loading: false }) @@ -1621,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) @@ -1639,6 +1628,8 @@ execPrint = (list, template) => { const { btn } = this.props + const { dict } = this.state + let _errors = [] let defaultPrinter = btn.verify.defaultPrinter || 'lackprinter' @@ -1739,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 }) } @@ -1759,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('銆�')} 瀛楁涓嶅彲涓虹┖`) } }) @@ -1783,7 +1774,7 @@ if (printerList.length === 0) { this.execSuccess({ ErrCode: '-1', - message: '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�', + message: dict['no_data'] || '鏈幏鍙栧埌鎵撳嵃淇℃伅锛�', status: true }) return @@ -1795,7 +1786,7 @@ this.syncMessageSend(printerList, () => { this.execSuccess({ ErrCode: 'S', - message: '鎵撳嵃璇锋眰宸插彂鍑恒��', + message: dict['print_out'] || '鎵撳嵃璇锋眰宸插彂鍑恒��', status: true }) }) @@ -1806,7 +1797,7 @@ this.syncMessageSend(printerList, () => { this.execSuccess({ ErrCode: 'S', - message: '鎵撳嵃璇锋眰宸插彂鍑恒��', + message: dict['print_out'] || '鎵撳嵃璇锋眰宸插彂鍑恒��', status: true }) }) @@ -1857,7 +1848,7 @@ socket.onerror = () => { this.execError({ ErrCode: 'N', - message: '鏃犳硶杩炴帴鍒�:' + btn.verify.linkUrl, + message: (dict['un_connect'] || '鏃犳硶杩炴帴鍒�') + ':' + btn.verify.linkUrl, status: false }) } @@ -1893,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') { // 瀹屾垚鍚庝笉鎻愮ず @@ -1942,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' @@ -1950,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({ @@ -2114,7 +2107,7 @@ } modelconfirm = () => { - const { btnconfig, selines } = this.state + const { btnconfig, selines, dict } = this.state let _this = this let result = [] let _data = {} @@ -2257,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) }, @@ -2273,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 @@ -2307,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} -- Gitblit v1.8.0