Merge branch 'feature/制造功能优化' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/制造功能优化
This commit is contained in:
@@ -119,12 +119,10 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
|||||||
this.listherHeaderBodyNum()
|
this.listherHeaderBodyNum()
|
||||||
})
|
})
|
||||||
const treeModifiers = this.getFieldModifiers(this.props.archInfo.__rawArch);
|
const treeModifiers = this.getFieldModifiers(this.props.archInfo.__rawArch);
|
||||||
// console.log('treeModifiers', treeModifiers);
|
|
||||||
if(treeModifiers) {
|
if(treeModifiers) {
|
||||||
this.props.merge_key = treeModifiers.merge_key;
|
this.props.merge_key = treeModifiers.merge_key;
|
||||||
this.props.merge_fields = treeModifiers.merge_fields.split(',');
|
this.props.merge_fields = treeModifiers.merge_fields.split(',');
|
||||||
const data = this.setColumns(this.props.merge_key);
|
const data = this.setColumns(this.props.merge_key);
|
||||||
console.log('data', data);
|
|
||||||
owl.onMounted(() => {
|
owl.onMounted(() => {
|
||||||
this.mergeColumns(this.props.merge_fields, data)
|
this.mergeColumns(this.props.merge_fields, data)
|
||||||
})
|
})
|
||||||
@@ -176,19 +174,28 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
setColumns( merge_key) {
|
setColumns( merge_key) {
|
||||||
|
merge_key = merge_key.split(',')
|
||||||
const data = this.props.list.records
|
const data = this.props.list.records
|
||||||
let sourceIndex = 0;
|
let sourceIndex = 0;
|
||||||
let sourceValue = ''
|
let sourceValue = merge_key.reduce((acc, key) => {
|
||||||
|
acc[key] = '';
|
||||||
|
return acc;
|
||||||
|
}, {});
|
||||||
|
|
||||||
data.forEach((item, index) => {
|
data.forEach((item, index) => {
|
||||||
if(!item.colspan) {
|
if(!item.colspan) {
|
||||||
item.colspan = 1;
|
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 ++ ;
|
data[sourceIndex].colspan ++ ;
|
||||||
item.colspan = 0;
|
item.colspan = 0;
|
||||||
} else {
|
} else {
|
||||||
sourceIndex = index;
|
sourceIndex = index;
|
||||||
sourceValue = item.data[merge_key];
|
sourceValue = itemValue;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return data
|
return data
|
||||||
@@ -211,14 +218,25 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
|||||||
const dom = this.tableRef.el
|
const dom = this.tableRef.el
|
||||||
const thead = $(dom).children('thead')
|
const thead = $(dom).children('thead')
|
||||||
const tbody = $(dom).children('tbody')
|
const tbody = $(dom).children('tbody')
|
||||||
|
let row_no = 0
|
||||||
tbody.children('tr.o_data_row').each(function () {
|
tbody.children('tr.o_data_row').each(function () {
|
||||||
const tr = $(this)
|
const tr = $(this)
|
||||||
const td = tr.children('td')
|
const td = tr.children('td')
|
||||||
const index = $(this).index()
|
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 () {
|
td.each(function () {
|
||||||
if(merge_fields.indexOf($(this).attr('name')) >= 0) {
|
if(merge_fields.indexOf($(this).attr('name')) >= 0) {
|
||||||
$(this).attr('rowspan', data[index].colspan)
|
$(this).attr('rowspan', col)
|
||||||
if(data[index].colspan == 0) {
|
if(col == 0) {
|
||||||
$(this).remove()
|
$(this).remove()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,3 +4,11 @@
|
|||||||
min-height: 250px;
|
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="name">quality.check.measure.line.tree</field>
|
||||||
<field name="model">quality.check.measure.line</field>
|
<field name="model">quality.check.measure.line</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree editable="bottom">
|
<tree editable="bottom" class="measureTable">
|
||||||
<field name="sequence"/>
|
<field name="sequence" class="measureTableSequence"/>
|
||||||
<!-- <field name="column_nums"/> -->
|
<!-- <field name="column_nums"/> -->
|
||||||
<field name="measure_item"/>
|
<field name="measure_item"/>
|
||||||
<field name="measure_value1" attrs="{ 'column_invisible': [('parent.column_nums', '<', 1)] }"/>
|
<field name="measure_value1" attrs="{ 'column_invisible': [('parent.column_nums', '<', 1)] }"/>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
<field name="display_message" readonly="1" nolabel="1"/>
|
<field name="display_message" readonly="1" nolabel="1"/>
|
||||||
</div>
|
</div>
|
||||||
<field name="related_docs" >
|
<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="sequence" string="序号"/> -->
|
||||||
<field name="category" string="大类"/>
|
<field name="category" string="大类"/>
|
||||||
<field name="doc_name" string="单据名称"/>
|
<field name="doc_name" string="单据名称"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user