app/views/educode_sales/assessments/new.html.erb in educode_sales-0.9.55 vs app/views/educode_sales/assessments/new.html.erb in educode_sales-0.9.56

- old
+ new

@@ -22,166 +22,253 @@ <div class="layui-input-inline"> <div id="staffs" class="xm-select-demo"></div> </div> </div> </div> + <div class="layui-inline"> + <label class="label1 layui-form-label">考核周期</label> + <div class="layui-input-inline"> + <select name="cycle" lay-verify="required" lay-filter="cycle" > + <option value="按季">按季</option> + <option value="按月">按月</option> + </select> + </div> + </div> </div> <div class="layui-form-item" style="padding: 25px"> <div class="layui-inline" > <label class="layui-form-label required ">年度</label> <div class="layui-input-inline"> <input type="text" class="layui-input" id="add_assessments_year" name="assessment_year" autocomplete="off" lay-verify="required"> </div> </div> <div class="layui-inline"> -<!-- <div class="label1 layui-input-inline" >(万)</div>--> -<!-- <div class="label2 layui-input-inline layui-hide">(个)</div>--> - <label class="label1 layui-form-label">业务目标(万)</label> - <label class="label2 layui-form-label layui-hide ">业务目标(次)</label> - <label class="label3 layui-form-label layui-hide ">业务目标(个)</label> + <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-md3"> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">第一季度(万)</label> - <label class="label2 layui-form-label layui-hide">第一季度(次)</label> - <label class="label3 layui-form-label layui-hide">第一季度(个)</label> - <div class="layui-input-block " style="width: 200px;"> - <input type="text" name="first_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input layui-disabled" placeholder="自动计算" disabled id="quarter1" > + <div class="layui-col-md6" style="margin-bottom: 20px;"> + <div class="layui-input-blocks"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">第一季度(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline "> - <label class="label1 layui-form-label ">1月(万)</label> - <label class="label2 layui-form-label layui-hide">1月(次)</label> - <label class="label3 layui-form-label layui-hide">1月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="january" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month1" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">1月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">2月(万)</label> - <label class="label2 layui-form-label layui-hide">2月(次)</label> - <label class="label3 layui-form-label layui-hide">2月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="february" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month2" onkeyup="sum()" > + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">2月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">3月(万)</label> - <label class="label2 layui-form-label layui-hide">3月(次)</label> - <label class="label3 layui-form-label layui-hide">3月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="march" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month3" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">3月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> </div> - <div class="layui-col-md3"> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">第二季度(万)</label> - <label class="label2 layui-form-label layui-hide">第二季度(次)</label> - <label class="label3 layui-form-label layui-hide">第二季度(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="second_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input layui-disabled" placeholder="自动计算" disabled id="quarter2" onkeyup="sum()" > + <div class="layui-col-md6" style="margin-bottom: 20px;"> + <div class="layui-input-blocks"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">第二季度(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">4月(万)</label> - <label class="label2 layui-form-label layui-hide">4月(次)</label> - <label class="label3 layui-form-label layui-hide">4月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="april" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month4" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">4月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">5月(万)</label> - <label class="label2 layui-form-label layui-hide">5月(次)</label> - <label class="label3 layui-form-label layui-hide">5月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="may" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month5" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">5月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">6月(万)</label> - <label class="label2 layui-form-label layui-hide">6月(次)</label> - <label class="label3 layui-form-label layui-hide">6月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="june" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month6" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">6月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> </div> - <div class="layui-col-md3"> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">第三季度(万)</label> - <label class="label2 layui-form-label layui-hide">第三季度(次)</label> - <label class="label3 layui-form-label layui-hide">第三季度(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="third_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input layui-disabled" placeholder="自动计算" disabled id="quarter3" onkeyup="sum()"> + <div class="layui-col-md6" style="margin-bottom: 20px;"> + <div class="layui-input-blocks"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">第三季度(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">7月(万)</label> - <label class="label2 layui-form-label layui-hide">7月(次)</label> - <label class="label3 layui-form-label layui-hide">7月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="july" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month7" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">7月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">8月(万)</label> - <label class="label2 layui-form-label layui-hide">8月(次)</label> - <label class="label3 layui-form-label layui-hide">8月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="august" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month8" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">8月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">9月(万)</label> - <label class="label2 layui-form-label layui-hide">9月(次)</label> - <label class="label3 layui-form-label layui-hide">9月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="september" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month9" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">9月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> </div> - <div class="layui-col-md3"> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">第四季度(万)</label> - <label class="label2 layui-form-label layui-hide">第四季度(次)</label> - <label class="label3 layui-form-label layui-hide">第四季度(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="fourth_quarter" style="color: #0C0C0C;border:1px solid #a6aebf;" value="" autocomplete="off" class="layui-input layui-disabled" placeholder="自动计算" disabled id="quarter4" onkeyup="sum()"> + <div class="layui-col-md6" style="margin-bottom: 20px;"> + <div class="layui-input-blocks"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">第四季度(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">10月(万)</label> - <label class="label2 layui-form-label layui-hide">10月(次)</label> - <label class="label3 layui-form-label layui-hide">10月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="october" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month10" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">10月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">11月(万)</label> - <label class="label2 layui-form-label layui-hide">11月(次)</label> - <label class="label3 layui-form-label layui-hide">11月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="november" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month11" onkeyup="sum()" > + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">11月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> - <div class="layui-input-inline"> - <label class="label1 layui-form-label ">12月(万)</label> - <label class="label2 layui-form-label layui-hide">12月(次)</label> - <label class="label3 layui-form-label layui-hide">12月(个)</label> - <div class="layui-input-block" style="width: 200px;"> - <input type="text" name="december" value="" autocomplete="off" class="layui-input" lay-verify="number|data" id="month12" onkeyup="sum()"> + <div class="layui-input-blocks month"> + <div class="layui-inline "> + <div class="layui-input-inline" style="width: 350px;"> + <label class="label1 layui-form-label " style="width:120px">12月(<span class="label_unit"></span>)</label> + <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"> + </div> </div> </div> </div> </div> </div> @@ -224,12 +311,71 @@ table = layui.table, request = layui.request, laydate = layui.laydate, $ = layui.$; + $(".label_unit").text('万元'); + showQuarter(); + form.on("select(cycle)", function(data) { + $("#annual").val(''); + if (data.value == '按月') { + showMonth(); + } else { + showQuarter(); + } + }) + form.on('select(new_assessment_id)', function (data){ + // 默认 签单金额 回款金额 + if (['7', '2'].includes(data.value)) { + form.val('new_assessment', { + cycle: '按季' + }) + showQuarter(); + } else { + 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)) { + $(".label_unit").text('项') + } else if (['6', '8', '11', '12'].includes(data.value)) { + $(".label_unit").text('次') + } else if (['9', '10','15'].includes(data.value)) { + $(".label_unit").text('人') + } else if (['16', '17'].includes(data.value)) { + $(".label_unit").text('件') + } else if (['13', '14'].includes(data.value)) { + $(".label_unit").text('个') + } + }) + function showMonth() { + $(".month").show(); + $(".quarter").addClass('layui-disabled'); + $(".quarter").val(''); + $(".quarter").attr('placeholder', '自动计算'); + $(".month input").attr("lay-verify", "number|data"); + } + + function showQuarter() { + $(".month").hide(); + $(".quarter").attr('placeholder', ''); + $(".quarter").removeClass('layui-disabled'); + $(".quarter").attr("lay-verify", "number|data"); + $(".quarter").val(''); + $(".month input").val(''); + $(".month input").removeAttr("lay-verify") + } + + // 自定义校验数据 // form.verify({ // data: function (value,item){ // if (parseFloat(value) < 0 ){ // console.log(value); @@ -334,9 +480,17 @@ document.getElementById('quarter1').value = quarter1.toFixed(2) document.getElementById('quarter2').value = quarter2.toFixed(2) document.getElementById('quarter3').value = quarter3.toFixed(2) document.getElementById('quarter4').value = quarter4.toFixed(2) document.getElementById('annual').value = annual.toFixed(2) + } + + function quarterSum() { + var quarter1 = parseFloat(document.getElementById('quarter1').value) || 0; + var quarter2 = parseFloat(document.getElementById('quarter2').value) || 0; + var quarter3 = parseFloat(document.getElementById('quarter3').value) || 0; + var quarter4 = parseFloat(document.getElementById('quarter4').value) || 0; + document.getElementById('annual').value = (quarter1 + quarter2 + quarter3 + quarter4).toFixed(2) } \ No newline at end of file