From 5046d0d13dc6a8563b8e54e31913bc44cfa1072f Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 26 四月 2022 19:23:18 +0800 Subject: [PATCH] 2022-04-26 --- src/views/menudesign/index.jsx | 130 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 128 insertions(+), 2 deletions(-) diff --git a/src/views/menudesign/index.jsx b/src/views/menudesign/index.jsx index bd830f0..f07b1fe 100644 --- a/src/views/menudesign/index.jsx +++ b/src/views/menudesign/index.jsx @@ -112,8 +112,43 @@ setTimeout(() => { this.updateCustomComponent() this.getAppPictures() + this.getPrintTemp() setGLOBFuncs() }, 1000) + + document.onkeydown = (event) => { + let e = event || window.event + let keyCode = e.keyCode || e.which || e.charCode + let preKey = '' + + if (e.ctrlKey) { + preKey = 'ctrl' + } + if (e.shiftKey) { + preKey = 'shift' + } else if (e.altKey) { + preKey = 'alt' + } + + if (!preKey || !keyCode) return + + let _shortcut = `${preKey}+${keyCode}` + + if (_shortcut === 'ctrl+83') { + let node = document.getElementById('save-modal-config') + if (!node) { + node = document.getElementById('save-pop-config') + } + if (!node) { + node = document.getElementById('save-config') + } + + if (node) { + node.click() + } + return false + } + } } /** @@ -136,6 +171,50 @@ if (this.state.visible) return this.submitConfig() + } + + getPrintTemp = () => { + if (!sessionStorage.getItem('printTemps')) { + let _sql = `select ID,Images,PrintTempNO+PrintTempName as PN from sPrintTemplate + where appkey= @appkey@ and Deleted=0 and typechartwo='web_print' + union select ID,Images,a.PrintTempNO+PrintTempName as PN + from (select * from sPrintTemplate where appkey= '' and Deleted=0 and typechartwo='web_print') a + left join (select PrintTempNO from sPrintTemplate where appkey= @appkey@ and Deleted=0 ) b + on a.PrintTempNO=b.PrintTempNO + left join (select Srcid from sPrintTemplate_Log where appkey='' and apicode= @appkey@ and Deleted=0 ) c + on a.ID=c.Srcid where b.PrintTempNO is null and c.Srcid is null` + + let param = { + func: 'sPC_Get_SelectedList', + LText: Utils.formatOptions(_sql), + obj_name: 'data', + arr_field: 'PN,ID,Images' + } + + param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') + param.secretkey = Utils.encrypt(param.LText, param.timestamp) + + param.open_key = Utils.encryptOpenKey(param.secretkey, param.timestamp) // 浜戠鏁版嵁楠岃瘉 + + Api.getSystemConfig(param).then(res => { + if (res.status) { + let temps = res.data.map(temp => { + return { + value: temp.ID, + text: temp.PN + } + }) + + sessionStorage.setItem('printTemps', JSON.stringify(temps)) + } else { + notification.warning({ + top: 92, + message: res.message, + duration: 5 + }) + } + }) + } } getAppPictures = () => { @@ -838,7 +917,7 @@ } verifyConfig = (show) => { - const { config } = this.state + const { config, MenuType } = this.state let error = '' let check = (components) => { @@ -852,7 +931,12 @@ } else if (item.type === 'group') { check(item.components) return + } else if (item.subtype === 'propcard' && item.subcards.length === 0) { + error = `缁勪欢銆�${item.name}銆嬩腑鍗$墖涓嶅彲涓虹┖锛乣 + return } + + if (['voucher'].includes(item.subtype)) return if (['propcard', 'brafteditor', 'sandbox', 'stepform', 'tabform'].includes(item.subtype) && item.wrap.datatype === 'static') return if (['balcony'].includes(item.type) && item.wrap.datatype === 'static') return @@ -877,6 +961,15 @@ error = `缁勪欢銆�${item.name}銆嬪潗鏍囪酱灏氭湭璁剧疆锛乣 } else if (item.type === 'tree' && (!item.wrap.valueField || !item.wrap.labelField || !item.wrap.parentField)) { error = `缁勪欢銆�${item.name}銆嬪熀鏈俊鎭皻鏈缃紒` + } else if (item.type === 'table' && item.wrap.doubleClick) { + let _actions = [...item.action] + item.cols.forEach(col => { + if (col.type !== 'action') return + _actions.push(...col.elements) + }) + if (_actions.findIndex((m) => m.uuid === item.wrap.doubleClick) === -1) { + error = `缁勪欢銆�${item.name}銆嬬粦瀹氱殑鍙屽嚮鎸夐挳宸插垹闄わ紒` + } } }) } @@ -889,6 +982,39 @@ message: error, duration: 5 }) + } + + if (MenuType === 'billPrint' && !error) { + let forbid = { + tabs: '鏍囩椤�', + search: '鎼滅储鏉′欢', + form: '琛ㄥ崟', + carousel: '杞挱', + tree: '鏍戝舰鍒楄〃', + chart: '鑷畾涔夊浘琛�', + editor: '瀵屾枃鏈�', + group: '鍒嗙粍' + } + let subforbid = { + editable: '鍙紪杈戣〃鏍�', + voucher: '鍑瘉' + } + + config.components.forEach(item => { + if (!error && forbid[item.type]) { + error = '鎵撳嵃妯℃澘涓笉鍙娇鐢�' + forbid[item.type] + } else if (!error && subforbid[item.type]) { + error = '鎵撳嵃妯℃澘涓笉鍙娇鐢�' + subforbid[item.type] + } + }) + + if (show && error) { + notification.warning({ + top: 92, + message: error, + duration: 5 + }) + } } return error @@ -997,7 +1123,7 @@ <StyleCombControlButton menu={config} /> <PasteController insert={this.insert} /> <Switch className="big" checkedChildren={dict['mob.enable']} unCheckedChildren={dict['mob.disable']} checked={config && config.enabled} onChange={this.onEnabledChange} /> - <Button type="primary" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button> + <Button type="primary" id="save-config" onClick={this.submitConfig} loading={menuloading}>{dict['mob.save']}</Button> <Button type="default" onClick={this.closeView}>鍏抽棴</Button> </div> } style={{ width: '100%' }}> -- Gitblit v1.8.0