<div style="text-align: left;">
注:部门基准分:<label style="color:Red">80</label>分
部门考评分:<label style="color:Red">100</label>分
</div>
<div style="text-align: left;">
<label> 部门名称:</label>
<input />
</div>
<br />
<table ></td></tr>
</tfoot>
</table>
<script type="text/javascript">
$(document).ready(function () {
http.get('@Url.Action("GetAllRelation")', {assessInfoId: @(ViewBag.AssessInfoId), PersonId: @(ViewBag.PersonId)})
.next(function (data) {
if (data.success) {
var viewModel = {
people:ko.mapping.fromJS(data.result) // ko.observable()
,addPerson : function(current) {
if($("#leaderName").next("input").val()==""||$("#deptOrgName").next("input").val()==""){
alert("部门名称或主管姓名不能为空!");
return;
}
var obj = {
PersonName: ko.observable($("#leaderName").val())
,OrgName: ko.observable($("#deptOrgName").val())
,Position: ko.observable("")
,IsMain: ko.observable(false)
,Weight: ko.observable(50)
,HeightWeight: ko.observable(0)
};
viewModel.people.push(obj);
//ko.mapping.updateFromJS(viewModel);
}
,removePerson : function(current) {
if(confirm("确认删除吗?")){
viewModel.people.remove(current);
}
}
,InputA : function(current){
var _self = parseInt(current.Weight());
current.HeightWeight(_self*150/100);
var total=0;
$(".count").each(function(index, element){
total+=parseInt($(element).val());
});
$("#totalWeight").val(total);
}
};
ko.applyBindings(viewModel);
var totalWeight=0;
for (var i = 0; i < data.result.length; i++) {
totalWeight += data.result[i].Weight;
}
$("#totalWeight").val(totalWeight);
}
else{
return;
}
});
$("#deptOrgName").myAutoComplete({
width: 250,
ajaxUrl: '@Url.Action("GetOrg", new { layer = 1 })',
returnCodeType: "string",
errorMsg: "不存在该部门",
callback: function (event, data) {
$("#leaderName").myAutoComplete({
width: 220,
isExtra: true,
extraLabel: ["工号:"],
ajaxUrl: '@Url.Action("GetPerson")?orgCode=' + data,
errorMsg: "不存在该员工"
});
$("#leaderName").focus();
}
});
$("#leaderName").bind("click", function () {
var orgCode = $("#deptOrgName").next("input").val();
if (orgCode == "") {
alert("请先选择主管所在的部门!");
$("#deptOrgName").focus();
return;
}
});
$("[count='weightCount']").change(function () {
alert($(this).val());
var count=0;
$("input.weightCount").each(function(){
//count+=$(this).val();
alert($(this).val());
});
});
});
//是否刷新父页面
function refreshOpener() {
var winOpener = window.opener ? window.opener : window.dialogOpener;
if(winOpener) {
winOpener.location.href = winOpener.location.href;
}
}
</script>