本地测试优化完序号展示问题,准备线上测试

This commit is contained in:
mgw
2023-11-01 16:52:26 +08:00
parent fc35ef687b
commit 74523c710f
3 changed files with 21 additions and 5 deletions

View File

@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
'depends': ['web'],
'depends': ['web', 'purchase'],
'data': [
],
@@ -33,6 +33,7 @@
'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',
],

View File

@@ -17,6 +17,7 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
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
@@ -28,7 +29,7 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
th.style.maxWidth = null;
});
this.setDefaultColumnWidths();
this.setDefaultColumnWidths(column_num);
// Squeeze the table by applying a max-width on largest columns to
// ensure that it doesn't overflow
@@ -42,11 +43,12 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
});
},
setDefaultColumnWidths() {
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)) + 1;
.reduce((sum, { value }) => sum + value, 0));
// 获取数组的最后一项
const lastItem = widths[widths.length - 1];
@@ -56,6 +58,12 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
// 将新的对象添加到数组的末尾
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;
@@ -68,7 +76,7 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
headerEl.style.minWidth = value;
}
} else if (type === "relative" && this.isEmpty) {
headerEl.style.width = `${((value / sumOfRelativeWidths) * 100).toFixed(2)}%`;
headerEl.style.width = `${((value / column_num) * 100).toFixed(2)}%`;
}
});
},

View File

@@ -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>