概算毛利自动计算

dev_2.0.1
rdpnr_hemingxia 2025-03-21 10:40:36 +08:00
parent 22a482dd69
commit c45897bb68
2 changed files with 22 additions and 6 deletions

View File

@ -108,19 +108,19 @@
<td class="table-title" colspan="1" > <td class="table-title" colspan="1" >
<input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入合同金额" <input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入合同金额"
name="contractAmount" id="contractAmount" placeholder="单位(元)" maxlength="16" name="contractAmount" id="contractAmount" placeholder="单位(元)" maxlength="16"
value="" /> value="" oninput="changeGross()" />
</td> </td>
<th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利:</span></th> <th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利:</span></th>
<td class="table-title" colspan="1" > <td class="table-title" colspan="1" >
<input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利" <input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利"
name="grossProfit" id="grossProfit" placeholder="单位(元)" maxlength="16" name="grossProfit" id="grossProfit" placeholder="单位(元)" maxlength="16"
value="" /> value="" disabled />
</td> </td>
<th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利率:</span></th> <th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利率:</span></th>
<td class="table-title" colspan="1" > <td class="table-title" colspan="1" >
<input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利率" <input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利率"
name="grossProfitMargin" id="grossProfitMargin" placeholder="单位(%" maxlength="16" name="grossProfitMargin" id="grossProfitMargin" placeholder="单位(%" maxlength="16"
value="" /> value="" oninput="changeGross()" />
</td> </td>
</tr> </tr>
<tr class="am-text-nowrap"> <tr class="am-text-nowrap">
@ -1073,6 +1073,13 @@
} }
}); });
}; };
changeGross=function (){
let contractAmount= inputVal('contractAmount');
let grossProfitMargin=inputVal('grossProfitMargin');
if(contractAmount&&grossProfitMargin){
$("#grossProfit").val(f2Fixed(f2(contractAmount)*f2(grossProfitMargin)/100))
}
}
</script> </script>
</@defaultLayout.layout> </@defaultLayout.layout>

View File

@ -111,19 +111,19 @@
<td class="table-title" colspan="1" > <td class="table-title" colspan="1" >
<input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入合同金额" <input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入合同金额"
name="contractAmount" id="contractAmount" placeholder="单位(元)" maxlength="16" name="contractAmount" id="contractAmount" placeholder="单位(元)" maxlength="16"
value="${Utils.format(project.contractAmount)}" /> value="${Utils.format(project.contractAmount)}" oninput="changeGross()" />
</td> </td>
<th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利:</span></th> <th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利:</span></th>
<td class="table-title" colspan="1" > <td class="table-title" colspan="1" >
<input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利" <input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利"
name="grossProfit" id="grossProfit" placeholder="单位(元)" maxlength="16" name="grossProfit" id="grossProfit" placeholder="单位(元)" maxlength="16"
value="${Utils.format(project.grossProfit)}" /> value="${Utils.format(project.grossProfit)}" disabled />
</td> </td>
<th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利率:</span></th> <th class="table-title" colspan="1" ><span style="color: red;">*</span><span style="font-size: 15px">项目毛利率:</span></th>
<td class="table-title" colspan="1" > <td class="table-title" colspan="1" >
<input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利率" <input type="text" class="number am-input" style="border-style:none;" data-validate-async data-validation-message="请输入项目毛利率"
name="grossProfitMargin" id="grossProfitMargin" placeholder="单位(%" maxlength="16" name="grossProfitMargin" id="grossProfitMargin" placeholder="单位(%" maxlength="16"
value="${Utils.format(project.grossProfitMargin)}" /> value="${Utils.format(project.grossProfitMargin)}" oninput="changeGross()" />
</td> </td>
</tr> </tr>
<tr class="am-text-nowrap"> <tr class="am-text-nowrap">
@ -1130,6 +1130,15 @@
} }
}); });
}; };
// 自动计算项目毛利
changeGross=function (){
let contractAmount= inputVal('contractAmount');
let grossProfitMargin=inputVal('grossProfitMargin');
if(contractAmount&&grossProfitMargin){
$("#grossProfit").val(f2Fixed(f2(contractAmount)*f2(grossProfitMargin)/100))
}
}
</script> </script>
</@defaultLayout.layout> </@defaultLayout.layout>