From 78e3a0f24f72c53d4b92ffefe5f5747cbf331a02 Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 7 Sep 2023 12:33:35 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89widget=E6=98=BE?= =?UTF-8?q?=E7=A4=BAmany2many=E5=9B=BE=E6=96=87=E5=9F=BA=E6=9C=AC=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_plan/__manifest__.py | 2 ++ sf_plan/static/src/js/custom_many2many.js | 22 ++++++++++++++++++++ sf_plan/static/src/xml/custom_many2many.xml | 23 +++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 sf_plan/static/src/js/custom_many2many.js create mode 100644 sf_plan/static/src/xml/custom_many2many.xml diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py index ba43169d..b39ad8af 100644 --- a/sf_plan/__manifest__.py +++ b/sf_plan/__manifest__.py @@ -24,6 +24,8 @@ 'web.assets_qweb': [ ], 'web.assets_backend': [ + 'sf_plan/static/src/js/custom_many2many.js', + 'sf_plan/static/src/xml/custom_many2many.xml', 'sf_plan/static/src/scss/gannt_change.scss', 'sf_plan/static/src/css/button_color.css' ], diff --git a/sf_plan/static/src/js/custom_many2many.js b/sf_plan/static/src/js/custom_many2many.js new file mode 100644 index 00000000..df3c6e48 --- /dev/null +++ b/sf_plan/static/src/js/custom_many2many.js @@ -0,0 +1,22 @@ +/** @odoo-module **/ + +import { Many2ManyCheckboxesField } from "@web/views/fields/many2many_checkboxes/many2many_checkboxes_field"; +import { registry } from "@web/core/registry"; + +export class MyCustomWidget extends Many2ManyCheckboxesField { + // 你可以重写或者添加一些方法和属性 + // 例如,你可以重写setup方法来添加一些事件监听器或者初始化一些变量 + setup() { + console.log('111111111222222222222') + super.setup(); // 调用父类的setup方法 + // 你自己的代码 + } + onImageClick(event) { + // 放大图片逻辑 + console.log('chongchongchong') + } +} +MyCustomWidget.template = "sf_plan.MyCustomWidget" +// MyCustomWidget.supportedTypes = ['many2many']; + +registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget); diff --git a/sf_plan/static/src/xml/custom_many2many.xml b/sf_plan/static/src/xml/custom_many2many.xml new file mode 100644 index 00000000..805de6e3 --- /dev/null +++ b/sf_plan/static/src/xml/custom_many2many.xml @@ -0,0 +1,23 @@ + + + + +
+ +
+ + + + + + +
+
+
+
+ +
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 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=94=BE=E5=A4=A7=E5=9B=BE=E7=89=87=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=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)" > - - - + + + +
+ + +
From 797a7207e9880742f8164564db68fade01bb86bf Mon Sep 17 00:00:00 2001 From: mgw <1392924357@qq.com> Date: Thu, 7 Sep 2023 15:32:15 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=B0=83=E6=95=B4=E2=80=9C=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F=E4=B8=8B=E8=BD=BD=E2=80=9D=E6=8C=89=E9=92=AE=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_machine_connect/views/compensation.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sf_machine_connect/views/compensation.xml b/sf_machine_connect/views/compensation.xml index 5ec6f382..f79c539e 100644 --- a/sf_machine_connect/views/compensation.xml +++ b/sf_machine_connect/views/compensation.xml @@ -6,7 +6,8 @@ -