材料管理修改

This commit is contained in:
2024-10-10 10:06:11 +08:00
parent c3f49e7180
commit cbae78058c
14 changed files with 124 additions and 51 deletions
+30 -2
View File
@@ -192,8 +192,8 @@
<Items>
<f:Grid ID="Grid3" ShowBorder="False" ShowHeader="False" Title="管线材料明细" EnableCollapse="true" ForceFit="true"
runat="server" BoxFlex="1" DataKeyNames="Id"
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="MaterialCode" EnableSummary="true" SummaryPosition="Bottom"
SortDirection="DESC" EnableRowGroup="true" DataRowGroupField="PipelineCode" AllowPaging="true" IsDatabasePaging="true" PageSize="10000">
ClicksToEdit="2" DataIDField="Id" AllowSorting="true" SortField="MaterialCode" ExpandAllRowGroups="false"
SortDirection="DESC" EnableRowGroup="true" DataRowGroupField="PipelineCode" AllowPaging="true" IsDatabasePaging="true" PageSize="10000" RowGroupRendererFunction="onGrid3RowGroupRenderer">
<Columns>
<f:RenderField Width="100px" ColumnID="PipelineCode" DataField="PipelineCode" SortField="PipelineCode"
FieldType="String" HeaderText="管线号" HeaderTextAlign="Center"
@@ -227,6 +227,10 @@
FieldType="String" HeaderText="匹配量" HeaderTextAlign="Center"
TextAlign="Left">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="MatchRate" DataField="MatchRate" SortField="MatchRate"
FieldType="String" HeaderText="匹配率" HeaderTextAlign="Center"
TextAlign="Left" Hidden="true">
</f:RenderField>
<f:RenderField Width="100px" ColumnID="MatchRateString" DataField="MatchRateString" SortField="MatchRateString"
FieldType="String" HeaderText="匹配率" HeaderTextAlign="Center"
TextAlign="Left">
@@ -275,6 +279,30 @@
function reloadGrid() {
__doPostBack(null, 'reloadGrid');
}
function onGrid3RowGroupRenderer(groupValue, rowData) {
var Total = 0,
Len = rowData.children.length;
for (var i = 0; i < Len; i++) {
var childData = rowData.children[i];
var genderValue = childData.values['MatchRate'];
console.log(genderValue);
// 确保值存在再进行累加
if (genderValue !== undefined) {
genderValue = parseFloat(genderValue); // 确保是数字
genderValue = genderValue > 0 ? genderValue : 0;
Total += genderValue;
}
}
// 检查 Len 是否大于零,以防止除以零
var TotalRate = Len > 0 ? ((Total * 100) / Len).toFixed(2) + "%" : "0%";
return F.formatString('{0},匹配率:{1}', groupValue, TotalRate);
}
</script>
</body>
</html>