Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/kpi/IndicatorLibWeight.jsp
2026-01-16 14:13:44 +08:00

156 lines
6.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" pageEncoding="utf-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<style type="text/css">
.select2-container .select2-selection--single {
height: 34px;
line-height: 34px;
}
.select2-selection__arrow {
margin-top: 3px;
}
</style>
<script type="text/javascript">
$(function () {
});
function saveFun() {
$("#addForm").bootstrapValidator('validate');//提交验证
let str = '{"' + $("#addForm").serialize().replaceAll("%EF%BC%8C", "%2C").replaceAll("%2C", ",").replaceAll("=", '":"').replaceAll("&", '","') + '"}'
let kpiIndicatorLib = JSON.parse(str)
if (parseInt(kpiIndicatorLib.resultWeight) + parseInt(kpiIndicatorLib.processWeight) !== 100) {
showAlert("d", "完成结果权重与过程表现权重占比之和应为100");
}
let temp = 0;
let weights = kpiIndicatorLib.auditLevelWeight.split(",")
for (let index = 0; index < weights.length; index++) {
temp += parseInt(weights[index]);
}
if (temp !== 100) {
showAlert("d", "评分层级权重占比之和应为100");
}
if ($("#addForm").data('bootstrapValidator').isValid()) {//获取验证结果,如果成功,执行下面代码
$.post(ext.contextPath + "/kpi/KpiIndicatorLib/addOrUpdate.do", $("#addForm").serialize(), function (data) {
if (data.res == 0) {
showAlert('d', '保存失败');
} else {
$("#table").bootstrapTable('refresh');
closeModal('subModal');
}
}, 'json');
}
}
$("#addForm").bootstrapValidator({
live: 'disabled',//验证时机enabled是内容有变化就验证默认disabled和submitted是提交再验证
fields: {
auditLevelWeight: {
validators: {
notEmpty: {
message: '不能为空'
},
regexp: {
regexp: /^[1-9]+(,\d+)*$/,
message: '评分层级权重输入有误,逗号应为英文状态,数字应为正整数'
}
}
},
resultWeight: {
validators: {
notEmpty: {
message: '不能为空'
},
regexp: {
regexp: /^[1-9]+(\d+)*$/,
message: '评分层级权重输入有误'
},
stringLength: {
min: 1,
max: 2,
message: '长度必须在1到2位之间'
}
}
},
processWeight: {
validators: {
notEmpty: {
message: '不能为空'
},
regexp: {
regexp: /^[1-9]+(\d+)*$/,
message: '评分层级权重输入有误'
},
stringLength: {
min: 1,
max: 2,
message: '长度必须在1到2位之间'
},
}
}
}
});
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">权重界面</h4>
</div>
<div class="modal-body">
<!-- 新增界面formid强制为addForm -->
<form class="form-horizontal" id="addForm">
<div id="alertDiv"></div>
<%-- <input type="hidden" name="id" value="${user.id }" />--%>
<!-- 界面提醒div强制id为alertdiv -->
<div class="col-md-12">
<input type="hidden" name="id" value="${KpiIndicatorLib.id}"/>
<input type="hidden" name="dimensionId" value="${KpiIndicatorLib.dimensionId}"/>
<input type="hidden" name="jobId" value="${KpiIndicatorLib.jobId}"/>
<input type="hidden" name="periodType" value="${KpiIndicatorLib.periodType}"/>
<div class="form-group">
<label class="col-sm-3 control-label">*评分层级权重:</label>
<div class="col-sm-9">
<input type="text" name="auditLevelWeight" class="form-control"
placeholder="多层级以英文半角逗号(,)隔开"
value="${KpiIndicatorLib.auditLevelWeight}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">* 完成结果权重:</label>
<div class="col-sm-9">
<input type="number" name="resultWeight" class="form-control" placeholder=""
value="${KpiIndicatorLib.resultWeight}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">* 过程表现权重:</label>
<div class="col-sm-9">
<input type="number" name="processWeight" class="form-control" placeholder=""
value="${KpiIndicatorLib.processWeight}">
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default pull-left" data-dismiss="modal">关闭</button>
<security:authorize buttonUrl="kpi/KpiIndicatorLib/addOrUpdate.do">
<button type="button" class="btn btn-primary" onclick="saveFun()">保存</button>
</security:authorize>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>