Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/刀具产品调取Cloud刀具标准库(10.11)
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['web'],
|
||||
'depends': ['web', 'purchase'],
|
||||
'data': [
|
||||
|
||||
],
|
||||
@@ -28,6 +28,13 @@
|
||||
'jikimo_frontend/static/src/views/list_nums/list_nums2.xml',
|
||||
'jikimo_frontend/static/src/views/list_nums/list_nums3.xml',
|
||||
'jikimo_frontend/static/src/js/custom_form_status_indicator.js',
|
||||
'jikimo_frontend/static/src/scss/rowno_in_tree.scss',
|
||||
# 'jikimo_frontend/static/src/views/list_nums/list_render.xml',
|
||||
'jikimo_frontend/static/src/list/list_up_down_button.xml',
|
||||
'jikimo_frontend/static/src/list/custom_import.js',
|
||||
'jikimo_frontend/static/src/list/custom_width.js',
|
||||
'jikimo_frontend/static/src/views/list_nums/extent_purchase.xml',
|
||||
|
||||
],
|
||||
|
||||
},
|
||||
|
||||
84
jikimo_frontend/static/src/list/custom_width.js
Normal file
84
jikimo_frontend/static/src/list/custom_width.js
Normal file
@@ -0,0 +1,84 @@
|
||||
/** @odoo-module */
|
||||
|
||||
import {patch} from '@web/core/utils/patch';
|
||||
import {ListRenderer} from "@web/views/list/list_renderer"
|
||||
|
||||
// var {patch} = require("web.utils") 这句话也行
|
||||
|
||||
patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
// 你可以重写或者添加一些方法和属性
|
||||
// The following code manipulates the DOM directly to avoid having to wait for a
|
||||
// render + patch which would occur on the next frame and cause flickering.
|
||||
freezeColumnWidths() {
|
||||
console.log('ccccccccccccccccccccccccccc')
|
||||
if (!this.keepColumnWidths) {
|
||||
this.columnWidths = null;
|
||||
}
|
||||
|
||||
const table = this.tableRef.el;
|
||||
const headers = [...table.querySelectorAll("thead th:not(.o_list_actions_header)")];
|
||||
const column_num = headers.length
|
||||
|
||||
if (!this.columnWidths || !this.columnWidths.length) {
|
||||
// no column widths to restore
|
||||
// Set table layout auto and remove inline style to make sure that css
|
||||
// rules apply (e.g. fixed width of record selector)
|
||||
table.style.tableLayout = "auto";
|
||||
headers.forEach((th) => {
|
||||
th.style.width = null;
|
||||
th.style.maxWidth = null;
|
||||
});
|
||||
|
||||
this.setDefaultColumnWidths(column_num);
|
||||
|
||||
// Squeeze the table by applying a max-width on largest columns to
|
||||
// ensure that it doesn't overflow
|
||||
this.columnWidths = this.computeColumnWidthsFromContent();
|
||||
table.style.tableLayout = "fixed";
|
||||
}
|
||||
headers.forEach((th, index) => {
|
||||
if (!th.style.width) {
|
||||
th.style.width = `${Math.floor(this.columnWidths[index])}px`;
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
setDefaultColumnWidths(column_num) {
|
||||
const bbb = this.state.columns[0].name
|
||||
const widths = this.state.columns.map((col) => this.calculateColumnWidth(col));
|
||||
const sumOfRelativeWidths = (widths
|
||||
.filter(({ type }) => type === "relative")
|
||||
.reduce((sum, { value }) => sum + value, 0));
|
||||
|
||||
// 获取数组的最后一项
|
||||
const lastItem = widths[widths.length - 1];
|
||||
|
||||
// 复制最后一项
|
||||
const newItem = { ...lastItem };
|
||||
|
||||
// 将新的对象添加到数组的末尾
|
||||
widths.push(newItem);
|
||||
|
||||
// 判断销售的sequence
|
||||
if (this.state.columns[0].name === "sequence") {
|
||||
widths[1] = { type: "relative", value: 0.1 };
|
||||
}
|
||||
|
||||
// 1 because nth-child selectors are 1-indexed, 2 when the first column contains
|
||||
// the checkboxes to select records.
|
||||
const columnOffset = this.hasSelectors ? 2 : 1;
|
||||
widths.forEach(({ type, value }, i) => {
|
||||
const headerEl = this.tableRef.el.querySelector(`th:nth-child(${i + columnOffset})`);
|
||||
if (type === "absolute") {
|
||||
if (this.isEmpty) {
|
||||
headerEl.style.width = value;
|
||||
} else {
|
||||
headerEl.style.minWidth = value;
|
||||
}
|
||||
} else if (type === "relative" && this.isEmpty) {
|
||||
headerEl.style.width = `${((value / column_num) * 100).toFixed(2)}%`;
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
);
|
||||
20
jikimo_frontend/static/src/list/list_up_down_button.xml
Normal file
20
jikimo_frontend/static/src/list/list_up_down_button.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-name="list_up_down_button" t-inherit="web.ListView.Buttons" t-inherit-mode="extension" owl="1">
|
||||
<xpath expr="//t[@t-if='nbTotal and !nbSelected and activeActions.exportXlsx and isExportEnable and !env.isSmall']" position="before">
|
||||
<!-- 新增的导入文件按钮 -->
|
||||
<!-- <button type="button" class="btn btn-secondary fa fa-upload o_list_import_file" data-tooltip="导入文件" aria-label="Import File" title="" t-on-click="onDirectImportData"/> -->
|
||||
<!-- <button type="button" class="btn btn-secondary fa fa-upload o_list_import_file" data-tooltip="导入文件" aria-label="Import File" title="" t-on-click="onDirectImportData"/> -->
|
||||
<!-- <button type="button" class="btn btn-secondary fa fa-download o_list_export_xlsx" data-tooltip="导出全部" aria-label="导出全部" t-on-click="onDirectExportData"/> -->
|
||||
<button type="button" class="btn btn-secondary o_list_export_xlsx" data-tooltip="导出全部" aria-label="导出全部" t-on-click="onDirectExportData">导出全部</button>
|
||||
<!-- <button type="button" t-component="base_import.ImportRecords" class="btn btn-secondary o_list_export_xlsx" data-tooltip="导入数据" aria-label="导入数据" t-on-click="importRecords">导入数据</button> -->
|
||||
<!-- <button type="button" class="btn btn-secondary o_list_export_xlsx" data-tooltip="导入数据" aria-label="导入数据" t-on-click="importRecords">导入数据</button> -->
|
||||
<!-- <t t-component="base_import.ImportRecords"> -->
|
||||
<!-- <button t-on-click="importRecords" type="button" class="btn btn-secondary o_list_export_xlsx" data-tooltip="导入数据" aria-label="导入数据">导入数据</button> -->
|
||||
<!-- </t> -->
|
||||
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-if='nbTotal and !nbSelected and activeActions.exportXlsx and isExportEnable and !env.isSmall']" position="replace">
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -17,6 +17,7 @@ div:has(.o_required_modifier) > label::before {
|
||||
}
|
||||
|
||||
.my-image div {
|
||||
|
||||
width: 110px !important;
|
||||
height: 110px !important;
|
||||
}
|
||||
@@ -341,3 +342,15 @@ div:has(.o_required_modifier) > label::before {
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.o_form_view {
|
||||
.o_form_sheet_bg .o_form_sheet {
|
||||
//max-width: none !important;
|
||||
width: auto !important;
|
||||
max-width: 98% !important;
|
||||
}
|
||||
.o_FormRenderer_chatterContainer {
|
||||
max-width: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
4
jikimo_frontend/static/src/scss/rowno_in_tree.scss
Normal file
4
jikimo_frontend/static/src/scss/rowno_in_tree.scss
Normal file
@@ -0,0 +1,4 @@
|
||||
.row_no {
|
||||
width: 3.2% !important;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<templates>
|
||||
<t t-name="purchase.PurchaseListView" t-inherit="web.ListRenderer" t-inherit-mode="primary" owl="1">
|
||||
<xpath expr="//div[hasclass('o_list_renderer')]" position="before">
|
||||
<PurchaseDashBoard />
|
||||
</xpath>
|
||||
</t>
|
||||
</templates>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
<t t-name="og.web.ListRenderer" t-inherit="web.ListRenderer" t-inherit-mode="extension">
|
||||
<xpath expr="//table/thead/tr/th[@t-if='hasSelectors']" position="before">
|
||||
<th><i class="fa fa-list-ol"/></th>
|
||||
<th class="row_no"><i class="fa fa-list-ol"/></th>
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
|
||||
47
jikimo_frontend/static/src/views/list_nums/list_render.xml
Normal file
47
jikimo_frontend/static/src/views/list_nums/list_render.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<template>
|
||||
<t
|
||||
t-name="rowno_in_tree.ListRenderer"
|
||||
t-inherit="web.ListRenderer"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
|
||||
>
|
||||
<xpath expr="//table/thead/tr/th[@t-if='hasSelectors']" position="before">
|
||||
<th class="row_no"><i class="fa fa-list-ol"/></th>
|
||||
</xpath>
|
||||
<xpath expr="//div/table/tfoot/tr/td" position="before">
|
||||
<td />
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t
|
||||
t-name="rowno_in_tree.add_number"
|
||||
t-inherit="web.ListRenderer.Rows"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<xpath expr="//t[@t-foreach='list.records']" position="before">
|
||||
<t t-set="RowNumber" t-value="1" />
|
||||
</xpath>
|
||||
<xpath
|
||||
expr="//t[@t-call='{{ constructor.recordRowTemplate }}']"
|
||||
position="after"
|
||||
>
|
||||
<t t-set="RowNumber" t-value="RowNumber+1" />
|
||||
</xpath>
|
||||
</t>
|
||||
|
||||
<t
|
||||
t-name="rowno_in_tree.ListRenderer.RecordRowNumber"
|
||||
t-inherit="web.ListRenderer.RecordRow"
|
||||
t-inherit-mode="extension"
|
||||
owl="1"
|
||||
>
|
||||
<xpath expr="//td[@class='o_list_record_selector']" position="before">
|
||||
<td tabindex="-1">
|
||||
<span t-esc="RowNumber" />
|
||||
</td>
|
||||
</xpath>
|
||||
</t>
|
||||
</template>
|
||||
Reference in New Issue
Block a user