app/views/educode_sales/assessments/new.html.erb in educode_sales-0.9.57 vs app/views/educode_sales/assessments/new.html.erb in educode_sales-0.9.58
- old
+ new
@@ -45,12 +45,12 @@
<label class="label1 layui-form-label">业务目标(<span class="label_unit"></span>)</label>
<div class="layui-input-inline">
<input type="text" class="layui-input layui-disabled" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" name="annual" autocomplete="off" placeholder="自动计算" id="annual">
</div>
</div>
-
-
+
+
</div>
<div class="layui-form-item" style="padding: 25px">
<!-- 根据考核要求更换单位-->
<div class="layui-row " >
<div class="layui-col-md6" style="margin-bottom: 20px;">
@@ -61,11 +61,11 @@
<div class="layui-input-block " style="width: 200px;margin-left:150px;">
<input type="text" name="first_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input quarter layui-disabled" placeholder="自动计算" id="quarter1" onkeyup="quarterSum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="first_quarter_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="first_quarter_score" placeholder="分值" autocomplete="off" class="layui-input" id="quarter_score_1">
</div>
</div>
</div>
<div class="layui-input-blocks month">
@@ -75,11 +75,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="january" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month1" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="january_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="january_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_1" onkeyup="score_sum(1)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -88,11 +88,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="february" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month2" onkeyup="sum()" >
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="february_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="february_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_2" onkeyup="score_sum(1)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -101,11 +101,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="march" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month3" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="march_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="march_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_3" onkeyup="score_sum(1)">
</div>
</div>
</div>
</div>
<div class="layui-col-md6" style="margin-bottom: 20px;">
@@ -116,11 +116,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="second_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input quarter layui-disabled" placeholder="自动计算" id="quarter2" onkeyup="quarterSum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="second_quarter_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="second_quarter_score" placeholder="分值" autocomplete="off" class="layui-input" id="quarter_score_2">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -129,11 +129,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="april" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month4" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="april_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="april_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_4" onkeyup="score_sum(2)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -142,11 +142,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="may" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month5" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="may_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="may_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_5" onkeyup="score_sum(2)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -155,11 +155,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="june" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month6" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="june_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="june_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_6" onkeyup="score_sum(2)">
</div>
</div>
</div>
</div>
<div class="layui-col-md6" style="margin-bottom: 20px;">
@@ -170,11 +170,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="third_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input quarter layui-disabled" placeholder="自动计算" id="quarter3" onkeyup="quarterSum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="third_quarter_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="third_quarter_score" placeholder="分值" autocomplete="off" class="layui-input" id="quarter_score_3">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -183,11 +183,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="july" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month7" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="july_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="july_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_7" onkeyup="score_sum(3)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -196,11 +196,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="august" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month8" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="august_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="august_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_8" onkeyup="score_sum(3)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -209,11 +209,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="september" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month9" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="september_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="september_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_9" onkeyup="score_sum(3)">
</div>
</div>
</div>
</div>
<div class="layui-col-md6" style="margin-bottom: 20px;">
@@ -224,11 +224,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="fourth_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input quarter layui-disabled" placeholder="自动计算" id="quarter4" onkeyup="quarterSum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="fourth_quarter_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="fourth_quarter_score" placeholder="分值" autocomplete="off" class="layui-input" id="quarter_score_4">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -237,11 +237,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="october" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month10" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="october_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="october_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_10" onkeyup="score_sum(4)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -250,11 +250,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="november" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month11" onkeyup="sum()" >
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="november_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="november_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_11" onkeyup="score_sum(4)">
</div>
</div>
</div>
<div class="layui-input-blocks month">
<div class="layui-inline ">
@@ -263,11 +263,11 @@
<div class="layui-input-block" style="width: 200px;margin-left:150px;">
<input type="text" name="december" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month12" onkeyup="sum()">
</div>
</div>
<div class="layui-input-inline" style="width: 100px;">
- <input type="text" lay-verify="number|data" name="december_score" placeholder="分值" autocomplete="off" class="layui-input">
+ <input type="text" lay-verify="number|data" name="december_score" placeholder="分值" autocomplete="off" class="layui-input" id="score_12" onkeyup="score_sum(4)">
</div>
</div>
</div>
</div>
</div>
@@ -335,11 +335,11 @@
form.val('new_assessment', {
cycle: '按月'
})
showMonth()
}
-
+
if (['7', '1', '2'].includes(data.value)) {
$(".label_unit").text('万元')
} else if (['3'].includes(data.value)) {
$(".label_unit").text('条')
} else if (['4', '5'].includes(data.value)) {
@@ -443,9 +443,21 @@
<!--要写在这下面-->
<script type="application/javascript">
+
+ function score_sum(id) {
+ var s = (id -1) * 3;
+ var value1 = document.getElementById('score_' + (s+1)).value;
+ var value2 = document.getElementById('score_' +(s+2)).value;
+ var value3 = document.getElementById('score_' + (s+3)).value;
+ if ( value1 === ""){ value1 = 0 ;}
+ if ( value2 === ""){ value2 = 0 ;}
+ if ( value3 === ""){ value3 = 0 ;}
+ var score = parseFloat(value1)+parseFloat(value2)+parseFloat(value3);
+ document.getElementById('quarter_score_' + id).value = score.toFixed(2);
+ }
function sum(){
var month1 = document.getElementById('month1').value;
var month2 = document.getElementById('month2').value;
var month3 = document.getElementById('month3').value;
\ No newline at end of file