Accept Merge Request #369: (feature/生产排程 -> develop)
Merge Request: 实现Many2many的图文展示,并增加图片方法功能 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/369?initial=true
This commit is contained in:
@@ -24,6 +24,9 @@
|
||||
'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/css/img_scale.css',
|
||||
'sf_plan/static/src/scss/gannt_change.scss',
|
||||
'sf_plan/static/src/css/button_color.css'
|
||||
],
|
||||
|
||||
6
sf_plan/static/src/css/img_scale.css
Normal file
6
sf_plan/static/src/css/img_scale.css
Normal file
@@ -0,0 +1,6 @@
|
||||
.zoomed {
|
||||
position: fixed;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%) scale(20);
|
||||
}
|
||||
28
sf_plan/static/src/js/custom_many2many.js
Normal file
28
sf_plan/static/src/js/custom_many2many.js
Normal file
@@ -0,0 +1,28 @@
|
||||
/** @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')
|
||||
// 获取图片元素
|
||||
const img = event.target;
|
||||
|
||||
// 实现放大图片逻辑
|
||||
// 比如使用 CSS 放大
|
||||
img.classList.add('zoomed');
|
||||
}
|
||||
}
|
||||
MyCustomWidget.template = "sf_plan.MyCustomWidget"
|
||||
// MyCustomWidget.supportedTypes = ['many2many'];
|
||||
|
||||
registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget);
|
||||
27
sf_plan/static/src/xml/custom_many2many.xml
Normal file
27
sf_plan/static/src/xml/custom_many2many.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates xml:space="preserve">
|
||||
|
||||
<t t-name="sf_plan.MyCustomWidget" owl="1">
|
||||
<div aria-atomic="true">
|
||||
<t t-foreach="items" t-as="item" t-key="item[0]">
|
||||
<div>
|
||||
<CheckBox
|
||||
value="isSelected(item)"
|
||||
disabled="props.readonly"
|
||||
onChange="(ev) => this.onChange(item[0], ev)"
|
||||
>
|
||||
<t t-esc="item[1]"/>
|
||||
|
||||
</CheckBox>
|
||||
|
||||
</div>
|
||||
<div t-on-click="onImageClick">
|
||||
<t>
|
||||
<img t-att-src="item[3]" width="20" height="20"/>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
</templates>
|
||||
Reference in New Issue
Block a user