87,910
社区成员
发帖
与我相关
我的任务
分享
<table id = "table_perform" runat ="server" class="table" width ="100%" visible ="false" >
<tr>
<td class ="td0">
<textarea id = "performArea_0" name = "performArea_0" runat ="server" cols ="40" rows ="2"></textarea>
</td>
<td class ="td1">
<input type ="text" id ="performWeight_0" name = "performWeight_0" runat ="server" onchange ="countWeight('table')" style="width :30px" />
</td>
<td class ="td2">
<textarea id = "performAction_0" name ="performAction_0" runat ="server" cols ="48" rows ="2"></textarea>
</td>
<td class ="td3">
<select id = "GradesSelfA_0" name="GradesSelfA_0" runat = "server" style ="width:65px"></select>
</td>
<td class ="td4">
<select id = "Supvr_0" name ="Supvr_0" runat = "server" style ="width:85px"></select>
</td>
</tr>
</table>
<input type = "button" runat ="server" id ="addTR" onclick ="Add_tr()" value="添加一行"/>
<input type = "button" runat ="server" id ="delTR" onclick ="Del_tr()" value="删除最后一行"/>
<asp:Label ID="lb_WeightTotal" runat="server" Text="" ></asp:Label>
function countWeight(obj)
{
var WeightT = 0;
if (document.getElementById("<%=gv_perform.ClientID%>"))
{
var weightArr;
weightArr = document.getElementById("<%=gv_perform.ClientID%>").getElementsByTagName("input");
if(weightArr.length>0){
for(var i = 0; i < weightArr.length; i++)
{
if(weightArr[i].id.indexOf("tb_weight"))
{
var weight = parseInt(weightArr[i].value);
if(weight<=100 && weight >0)
{
WeightT += parseInt(weightArr[i].value);
}
else
{
alert ("权重必须是0到100之间的数字!");
}
}
}
}
}
if (document .getElementById ("table_perform"))
{
var rowCount = table_perform .rows .length;
for (var i=0 ;i< rowCount ;i++)
{
if (document .all["performWeight_"+i].value == "" || document .all["performWeight_"+i].value ==null)
{
}
else
{
var weight = parseInt(document .all["performWeight_"+i].value);
if(weight<=100 && weight >0)
{
WeightT += parseInt(document .all["performWeight_"+i].value);
}
else
{
alert ("权重必须是0到100之间的数字!");
}
}
}
}
document .all["lb_WeightTotal"].innerHTML = WeightT ;
if(WeightT >100) alert ("权重和必须等于100!");
};
function Add_tr()
{
if (linenum ==0)
{
getoption ();
}
linenum =linenum +1;
var tableobj = document .getElementById ("table_perform");
var trobj = document .createElement ("tr");
//trobj .setAttribute ("id","tr"+linenum);
// 添加td0
var tdobj0 = document .createElement ("td");
tdobj0 .setAttribute ("className","td0");
var Areaobj = document .createElement ("textarea");
Areaobj.setAttribute ("id","performArea_"+linenum );
Areaobj.setAttribute ("name","performArea_"+linenum );
Areaobj .setAttribute ("runat","server");
Areaobj .setAttribute ("cols","40");
Areaobj .setAttribute ("rows","2");
tdobj0 .appendChild(Areaobj );
trobj .appendChild (tdobj0 );
// 添加td1
var tdobj1 = document .createElement ("td");
tdobj1 .setAttribute ("className","td1");
var Weightobj = document .createElement ("input");
Weightobj.setAttribute ("id","performWeight_"+linenum );
Weightobj.setAttribute ("name","performWeight_"+linenum );
Weightobj.setAttribute ("runat","server");
Weightobj.setAttribute ("type","text");
//Weightobj.style.width = "30px";
tdobj1 .appendChild(Weightobj );
trobj .appendChild (tdobj1 );
// 添加td2
var tdobj2 = document .createElement ("td");
tdobj2 .setAttribute ("className","td2");
var Actionobj = document .createElement ("textarea");
Actionobj.setAttribute ("id","performAction_"+linenum );
Actionobj.setAttribute ("name","performAction_"+linenum );
Actionobj .setAttribute ("runat","server");
Actionobj .setAttribute ("cols","48");
Actionobj .setAttribute ("rows","2");
tdobj2 .appendChild(Actionobj );
trobj .appendChild (tdobj2 );
// 添加td3
var tdobj3 = document .createElement ("td");
tdobj3 .setAttribute ("className","td3");
var Gradeobj = document .createElement ("select");
Gradeobj.setAttribute ("id","GradesSelfA_"+linenum );
Gradeobj.setAttribute ("name","GradesSelfA_"+linenum );
Gradeobj.setAttribute ("runat","server");
//Gradeobj.style.width = "70px";
tdobj3 .appendChild(Gradeobj );
trobj .appendChild (tdobj3 );
// 添加td4
var tdobj4 = document .createElement ("td");
tdobj4 .setAttribute ("className","td4");
var Supvrobj = document .createElement ("select");
Supvrobj.setAttribute ("id","Supvr_"+linenum );
Supvrobj.setAttribute ("name","Supvr_"+linenum );
Supvrobj.setAttribute ("runat","server");
//Supvrobj.style.width = "90px";
tdobj4 .appendChild(Supvrobj );
trobj .appendChild (tdobj4 );
tableobj .firstChild .appendChild (trobj);
setoption1 ("GradesSelfA_"+linenum );
setoption2 ("Supvr_"+linenum );
document .getElementById ("performWeight_"+linenum ).style.width = "30px";
document .getElementById ("GradesSelfA_"+linenum ).style.width = "65px";
document .getElementById ("Supvr_"+linenum ).style.width = "85px";
document .getElementById ("performWeight_"+linenum ).onchange = function(){countWeight ('table')};
};
Protected Sub submitt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles submitt.Click
Dim PerformTotal As String = lb_WeightTotal.Text.ToString.Trim
If PerformTotal = "" Or PerformTotal <> "100" Then
Dim type As Type = Me.GetType
Page.ClientScript.RegisterStartupScript(type, "wrong", "alert('业绩指标的权重小计应为100,请修改权重!');", True)
Else
'判断是否已经提交过工作内容及自评
Dim EKID As String = Request.QueryString("EKID")
Dim sqlcommon1 As sqlCommon = New sqlCommon()
Dim pams1 As SqlParameter() = {New SqlParameter("@EKID", EKID)}
Dim dsIsExit As DataSet = New DataSet()
sqlcommon1.RunProc("Proc_MyWork_IsExit", pams1, dsIsExit)
If dsIsExit.Tables.Count > 1 Then
If dsIsExit.Tables(0).Rows.Count > 0 And dsIsExit.Tables(0).Rows(0).Item(0) > 0 Then
IsExit1 = True
End If
If dsIsExit.Tables(1).Rows.Count > 0 And dsIsExit.Tables(1).Rows(0).Item(0) > 0 Then
IsExit2 = True
End If
End If
Dim sqlcommon As sqlCommon = New sqlCommon()
Dim sqlText As String = ""
sqlText += " BEGIN TRANSACTION "
If gv_perform.Visible = True Then
For i As Integer = 0 To gv_perform.Rows.Count - 1
Dim ACID As String = gv_perform.Rows(i).Cells(0).Text.ToString
Dim tb_area As TextBox = gv_perform.Rows(i).FindControl("tb_area")
Dim tb_weight As TextBox = gv_perform.Rows(i).FindControl("tb_weight")
Dim tb_action As TextBox = gv_perform.Rows(i).FindControl("tb_action")
Dim ddl_GradesSelf_A As DropDownList = gv_perform.Rows(i).FindControl("ddl_GradesSelf_A")
Dim ddl_Supvr As DropDownList = gv_perform.Rows(i).FindControl("ddl_Supvr")
sqlText += "update T_AssessContent set Key_Performance_Area ='" + tb_area.Text.ToString.Replace("'", "''").Replace(System.Environment.NewLine, "<br>") + "',weight=" + tb_weight.Text.ToString.Trim + ",Action = '" + tb_action.Text.ToString.Replace("'", "''").Replace(System.Environment.NewLine, "<br>") + "',Self_Appraisal='" + ddl_GradesSelf_A.SelectedValue.ToString.Trim + "',SupvrWid=" + ddl_Supvr.SelectedValue.ToString.Trim + " where ACID =" + ACID.ToString.Trim
Next
End If
If table_perform.Visible = True Then
For i As Integer = 0 To table_perform.Rows.Count - 1
Dim performArea As HtmlTextArea = table_perform.Rows(i).FindControl("performArea_" + i.ToString)
Dim performWeight As HtmlInputText = table_perform.Rows(i).FindControl("performWeight_" + i.ToString)
Dim performAction As HtmlTextArea = table_perform.Rows(i).FindControl("performAction_" + i.ToString)
Dim GradesSelfA As HtmlSelect = table_perform.Rows(i).FindControl("GradesSelfA_" + i.ToString)
Dim Supvr As HtmlSelect = table_perform.Rows(i).FindControl("Supvr_" + i.ToString)
sqlText += "insert into T_AssessContent(EKID,ParentQid,Key_Performance_Area,weight,Action,Self_Appraisal,SupvrWid)values(" + EKID + ",1,'" + performArea.InnerText.ToString.Replace("'", "''").Replace(System.Environment.NewLine, "<br>") + "'," + performWeight.Value.ToString + ",'" + performAction.InnerText.ToString.Replace("'", "''").Replace(System.Environment.NewLine, "<br>") + "','" + GradesSelfA.Value.ToString.Trim + "'," + Supvr.Value.ToString + ")"
Next
End If
sqlText += " COMMIT "
If sqlcommon.RunSqltext(sqlText) = 1 Then
Dim type As Type = Me.GetType
Page.ClientScript.RegisterStartupScript(type, "wrong", "alert('提交成功!')", True)
Response.Write("<script > window.open('','_self');top.opener=null;top.close();</script>")
Else
Dim type As Type = Me.GetType
Page.ClientScript.RegisterStartupScript(type, "wrong", "alert('提交失败,请重新检查数据!');", True)
End If
End If
End Sub