From ee2f7a97abc91d3dbafe3b6612719a4aa3e5bdc8 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 03 七月 2020 12:03:49 +0800 Subject: [PATCH] 2020-07-03 --- src/templates/sharecomponent/settingcomponent/index.jsx | 4 ++-- src/views/printTemplate/index.jsx | 10 +++++----- src/views/printTemplate/print.js | 24 +++++++++++++++++++----- src/templates/sharecomponent/settingcomponent/settingform/index.jsx | 3 +++ src/tabviews/zshare/actionList/printbutton/index.jsx | 10 +++++++++- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/src/tabviews/zshare/actionList/printbutton/index.jsx b/src/tabviews/zshare/actionList/printbutton/index.jsx index 4b898f7..e96cfd5 100644 --- a/src/tabviews/zshare/actionList/printbutton/index.jsx +++ b/src/tabviews/zshare/actionList/printbutton/index.jsx @@ -593,6 +593,14 @@ item.FontStyle = (!element.fontWeight || element.fontWeight === 'normal') ? 'regular' : element.fontWeight item.Padding = 0 item.Trimming = '' + if (!item.Width) { + item.Width = item.BorderSize + item.Left = item.Left - item.Width + } else if (!item.Height) { + item.Height = item.BorderSize + item.Top = item.Top - item.Height + } + item.BorderSize = 0 } else if (item.Type === 'image') { item.ImageWidth = element.imgWidth item.ImageHeight = element.imgHeight @@ -627,7 +635,7 @@ return item }) - + _configparam = { Version: '', Title: configParam.name, diff --git a/src/templates/sharecomponent/settingcomponent/index.jsx b/src/templates/sharecomponent/settingcomponent/index.jsx index bda117b..4e0ac05 100644 --- a/src/templates/sharecomponent/settingcomponent/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/index.jsx @@ -188,11 +188,11 @@ visible={visible} width={900} maskClosable={false} - onCancel={() => { this.setState({ visible: false })}} + onCancel={() => { this.setState({ visible: false, loading: false })}} footer={[ <CreateInterface key="interface" dict={dict} ref="tableCreatInterface" trigger={this.tableCreatInterface}/>, <CreateFunc key="create" dict={dict} ref="funcCreatComponent" trigger={this.tableCreatFunc}/>, - <Button key="cancel" onClick={() => { this.setState({ visible: false }) }}>{this.state.dict['model.cancel']}</Button>, + <Button key="cancel" onClick={() => { this.setState({ visible: false, loading: false }) }}>{this.state.dict['model.cancel']}</Button>, <Button key="confirm" type="primary" loading={this.state.loading} onClick={this.settingSave}>{this.state.dict['model.confirm']}</Button> ]} destroyOnClose diff --git a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx index 55ac79d..5bcbb10 100644 --- a/src/templates/sharecomponent/settingcomponent/settingform/index.jsx +++ b/src/templates/sharecomponent/settingcomponent/settingform/index.jsx @@ -226,6 +226,7 @@ message: '鏁版嵁婧愪腑\'蹇呴』鎴愬鍑虹幇', duration: 5 }) + reject() return } else if (_lparen !== _rparen) { notification.warning({ @@ -233,6 +234,7 @@ message: '鏁版嵁婧愪腑()蹇呴』鎴愬鍑虹幇', duration: 5 }) + reject() return } else if (/--/ig.test(values.dataresource)) { notification.warning({ @@ -240,6 +242,7 @@ message: '鏁版嵁婧愪腑锛屼笉鍙嚭鐜板瓧绗� -- 锛屾敞閲婅鐢� /*鍐呭*/', duration: 5 }) + reject() return } diff --git a/src/views/printTemplate/index.jsx b/src/views/printTemplate/index.jsx index 3fd7cd4..b84707d 100644 --- a/src/views/printTemplate/index.jsx +++ b/src/views/printTemplate/index.jsx @@ -49,7 +49,7 @@ let screenY = e.clientY + scrollTop let offsetT = screenY - 75 let _width = parseInt(document.getElementById('darea').style.width) - let offsetL = screenX - (document.body.offsetWidth - _width - 30) / 2 + let offsetL = screenX - (document.body.offsetWidth - _width - 40) / 2 let cx = Math.floor(offsetL / _width * config.width) let cy = Math.floor(offsetT / parseInt(document.getElementById('darea').style.height) * config.height) @@ -98,12 +98,12 @@ height = _c } if (width === 0) { - x -= 4 - width = 8 + x -= 2 + width = 4 } if (height === 0) { - y -= 4 - height = 8 + y -= 2 + height = 4 } if (cx >= x && cx <= x + width && cy >= y && cy <= y + height) { _selectItem = element diff --git a/src/views/printTemplate/print.js b/src/views/printTemplate/print.js index 5a8acfa..b2cbe6f 100644 --- a/src/views/printTemplate/print.js +++ b/src/views/printTemplate/print.js @@ -22,6 +22,8 @@ elements.forEach(element => { element.left = element.left * ratio element.top = element.top * ratio + element.oriwidth = element.width + element.oriheight = element.height element.width = element.width * ratio element.height = element.height * ratio @@ -39,6 +41,7 @@ element.imgHeight = element.imgHeight * ratio } }) + return new Promise(resolve => { this.sketchothers(context, elements, selectId, ratio, resolve) }) @@ -68,10 +71,10 @@ } if (selectId === element.uuid) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰� - context.shadowBlur = 10 - context.shadowColor = '#757575' + context.shadowBlur = 5 + context.shadowColor = '#1890ff' context.fillStyle = 'white' - context.fillRect(element.left, element.top, element.width, element.height) + context.fillRect(element.left, element.top, element.width || 1, element.height || 1) context.shadowBlur = 0 } @@ -85,13 +88,24 @@ } // 璁剧疆鑳屾櫙鑹� - if (element.background && element.background !== 'white') { + if (!element.borderSize && (element.oriwidth === 1 || element.oriheight === 1)) { // 绾� + context.strokeStyle = element.background + context.beginPath() + if (element.oriwidth === 1) { + context.moveTo(element.left, element.top) + context.lineTo(element.left, element.top + element.height) + } else { + context.moveTo(element.left, element.top + element.height) + context.lineTo(element.left + element.width, element.top + element.height) + } + context.stroke() + } else if (element.background && element.background !== 'white') { context.fillStyle = element.background context.fillRect(element.left, element.top, element.width, element.height) } if (selectId === element.uuid && element.width > 3 * ratio && element.height > 3 * ratio) { // 閫変腑鍏冪礌锛岃缃閮ㄩ槾褰� - context.strokeStyle = 'black' + context.strokeStyle = '#1890ff' context.beginPath() context.moveTo(element.left + element.width - 7, element.top + element.height - 2) context.lineTo(element.left + element.width - 2, element.top + element.height - 7) -- Gitblit v1.8.0