From e0bfea40e1becc58368b1947882a856270e510bb Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 7 Sep 2023 15:16:03 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=87=BB=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=94=BE=E5=A4=A7=E5=9B=BE=E7=89=87=E7=9A=84=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan/__manifest__.py | 1 + sf_plan/static/src/css/img_scale.css | 6 ++++++ sf_plan/static/src/js/custom_many2many.js | 8 +++++++- sf_plan/static/src/xml/custom_many2many.xml | 10 +++++++--- 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 sf_plan/static/src/css/img_scale.css diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py index b39ad8af..3acff39e 100644 --- a/sf_plan/__manifest__.py +++ b/sf_plan/__manifest__.py @@ -26,6 +26,7 @@ 'web.assets_backend': [ 'sf_plan/static/src/js/custom_many2many.js', 'sf_plan/static/src/xml/custom_many2many.xml', + 'sf_plan/static/src/css/img_scale.css', 'sf_plan/static/src/scss/gannt_change.scss', 'sf_plan/static/src/css/button_color.css' ], diff --git a/sf_plan/static/src/css/img_scale.css b/sf_plan/static/src/css/img_scale.css new file mode 100644 index 00000000..de17fabb --- /dev/null +++ b/sf_plan/static/src/css/img_scale.css @@ -0,0 +1,6 @@ +.zoomed { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) scale(20); +} diff --git a/sf_plan/static/src/js/custom_many2many.js b/sf_plan/static/src/js/custom_many2many.js index df3c6e48..99a09309 100644 --- a/sf_plan/static/src/js/custom_many2many.js +++ b/sf_plan/static/src/js/custom_many2many.js @@ -12,8 +12,14 @@ export class MyCustomWidget extends Many2ManyCheckboxesField { // 你自己的代码 } onImageClick(event) { - // 放大图片逻辑 + // 放大图片逻辑 console.log('chongchongchong') + // 获取图片元素 + const img = event.target; + + // 实现放大图片逻辑 + // 比如使用 CSS 放大 + img.classList.add('zoomed'); } } MyCustomWidget.template = "sf_plan.MyCustomWidget" diff --git a/sf_plan/static/src/xml/custom_many2many.xml b/sf_plan/static/src/xml/custom_many2many.xml index 805de6e3..541afc60 100644 --- a/sf_plan/static/src/xml/custom_many2many.xml +++ b/sf_plan/static/src/xml/custom_many2many.xml @@ -11,10 +11,14 @@ onChange="(ev) => this.onChange(item[0], ev)" > - - - + + + +
+ + +