修改取消列表,修改出厂检验报告
This commit is contained in:
@@ -119,12 +119,10 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
this.listherHeaderBodyNum()
|
||||
})
|
||||
const treeModifiers = this.getFieldModifiers(this.props.archInfo.__rawArch);
|
||||
// console.log('treeModifiers', treeModifiers);
|
||||
if(treeModifiers) {
|
||||
this.props.merge_key = treeModifiers.merge_key;
|
||||
this.props.merge_fields = treeModifiers.merge_fields.split(',');
|
||||
const data = this.setColumns(this.props.merge_key);
|
||||
console.log('data', data);
|
||||
owl.onMounted(() => {
|
||||
this.mergeColumns(this.props.merge_fields, data)
|
||||
})
|
||||
@@ -176,19 +174,28 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
}
|
||||
},
|
||||
setColumns( merge_key) {
|
||||
merge_key = merge_key.split(',')
|
||||
const data = this.props.list.records
|
||||
let sourceIndex = 0;
|
||||
let sourceValue = ''
|
||||
let sourceValue = merge_key.reduce((acc, key) => {
|
||||
acc[key] = '';
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
data.forEach((item, index) => {
|
||||
if(!item.colspan) {
|
||||
item.colspan = 1;
|
||||
}
|
||||
if(item.data[merge_key] === sourceValue) {
|
||||
const itemValue = merge_key.reduce((acc, key) => {
|
||||
acc[key] = item.data[key];
|
||||
return acc;
|
||||
}, {});
|
||||
if(JSON.stringify(itemValue) == JSON.stringify(sourceValue)) {
|
||||
data[sourceIndex].colspan ++ ;
|
||||
item.colspan = 0;
|
||||
} else {
|
||||
sourceIndex = index;
|
||||
sourceValue = item.data[merge_key];
|
||||
sourceValue = itemValue;
|
||||
}
|
||||
})
|
||||
return data
|
||||
@@ -211,14 +218,25 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
const dom = this.tableRef.el
|
||||
const thead = $(dom).children('thead')
|
||||
const tbody = $(dom).children('tbody')
|
||||
let row_no = 0
|
||||
tbody.children('tr.o_data_row').each(function () {
|
||||
const tr = $(this)
|
||||
const td = tr.children('td')
|
||||
const index = $(this).index()
|
||||
const col = data[index].colspan
|
||||
row_no ++
|
||||
if(col == 0) {
|
||||
row_no --
|
||||
}
|
||||
td.eq(0).text(row_no).attr('rowspan', col)
|
||||
|
||||
if(col == 0) {
|
||||
td.eq(0).remove()
|
||||
}
|
||||
td.each(function () {
|
||||
if(merge_fields.indexOf($(this).attr('name')) >= 0) {
|
||||
$(this).attr('rowspan', data[index].colspan)
|
||||
if(data[index].colspan == 0) {
|
||||
$(this).attr('rowspan', col)
|
||||
if(col == 0) {
|
||||
$(this).remove()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,3 +4,11 @@
|
||||
min-height: 250px;
|
||||
}
|
||||
}
|
||||
|
||||
.measureTableSequence {
|
||||
width: 58px;
|
||||
}
|
||||
|
||||
.measureTable .o_list_table_ungrouped {
|
||||
min-width: auto;
|
||||
}
|
||||
@@ -4,8 +4,8 @@
|
||||
<field name="name">quality.check.measure.line.tree</field>
|
||||
<field name="model">quality.check.measure.line</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree editable="bottom">
|
||||
<field name="sequence"/>
|
||||
<tree editable="bottom" class="measureTable">
|
||||
<field name="sequence" class="measureTableSequence"/>
|
||||
<!-- <field name="column_nums"/> -->
|
||||
<field name="measure_item"/>
|
||||
<field name="measure_value1" attrs="{ 'column_invisible': [('parent.column_nums', '<', 1)] }"/>
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<field name="display_message" readonly="1" nolabel="1"/>
|
||||
</div>
|
||||
<field name="related_docs" >
|
||||
<tree string="下游单据" create="false" edit="false" delete="false" attrs="{'merge_fields': 'category,doc_name,operation_type,doc_number,doc_state, cancel_reason', 'merge_key': 'doc_number'}">
|
||||
<tree string="下游单据" create="false" edit="false" delete="false" attrs="{'merge_fields': 'category,doc_name,operation_type,doc_number,doc_state,cancel_reason','merge_key': 'doc_number,category'}">
|
||||
<!-- <field name="sequence" string="序号"/> -->
|
||||
<field name="category" string="大类"/>
|
||||
<field name="doc_name" string="单据名称"/>
|
||||
|
||||
Reference in New Issue
Block a user