/// jQuery.ajaxSetup({ complete: function (data) { //对返回的数据data做判断, //session过期的话,就location到一个页面 if (data.responseText == 'TimeOut') { //alert("登录超时,请重新登录!"); top.location.href = '../Default.aspx'; } } }); function initAddTb() { $("#hid_UserType").val("add"); $('#TextTableId').val(""); $('#TextColumnId').val(""); $("#CheckBoxIsVisable").attr("checked", true); $('#ChkBoxPrimaryKey').attr("checked",false); $('#TextDataType').val(""); $("#CheckBoxAutoGen").attr("checked", false); $("#TextColDesc").val(""); $("#CheckBoxAllowNull").attr("checked", false); $("#TextColumnName").val(""); $("#TextWidth").val(""); $("#TextCharNum").val(""); $("#TextDefValue").val(""); $("#TextSequence").val(""); $("#TextDisplayValue").val(""); $("#TextRelationColumns").val(''); //$("#ExpirationDate").datebox('setValue', myformatter(new Date(rows[0].Expiration))); $('#winSetTbInfo').window('open'); } function myformatter(date) { var y = date.getFullYear(); var m = date.getMonth() + 1; var d = date.getDate(); return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d); } function initEditTb(row) { $("#hid_UserType").val("modify"); $('#TextTableId').val(row.TableId); $('#TextColumnId').val(row.ColumnId); $("#CheckBoxIsVisable").attr("checked", row.IsVisable=='Y'?true:false); $('#ChkBoxPrimaryKey').attr("checked", row.PrimaryKey == 'Y' ? true : false); $('#TextDataType').val(row.DataType); $("#CheckBoxAutoGen").attr("checked", row.AutoGen=='Y'?true:false); $("#TextColDesc").val(row.ColDesc); $("#CheckBoxAllowNull").attr("checked", row.AllowNull=="Y"?true:false); $("#TextColumnName").val(row.ColumnName); $("#TextWidth").val(row.Width); $("#TextCharNum").val(row.CharNum); $("#TextDefValue").val(row.DefValue); $("#TextSequence").val(row.Sequence); $("#TextDisplayValue").val(row.DisplayValue); $("#TextRelationColumns").val(row.RelationColumns); $('#winSetTbInfo').window('open'); } function submit() { if (!$('#TextTableId').val().trim()) { $.messager.alert('提醒', '表名称不能为空', 'error'); return; } if (!$('#TextColumnId').val().trim()) { $.messager.alert('提醒', '列不能为空', 'error'); return; } // var TableId; // var ColumnId; // if($("#hid_UserType").val() == "modify") { // var rows = $('#dg').datagrid('getSelections'); // var row = rows[0]; // TableId = row.TableId; // ColumnId = row.ColumnId; // } $.post("../SystemModuleAjax/TbEditAjax.aspx", { TableId: $('#TextTableId').val().trim(), type: $('#hid_UserType').val(), ColumnId: $('#TextColumnId').val(), IsVisable: $('#CheckBoxIsVisable').is(':checked') ? "Y" : "N", isPrimaryKey: $('#ChkBoxPrimaryKey').is(':checked') ? "Y" : "N", isAutoGen: $('#CheckBoxAutoGen').is(':checked') ? "Y" : "N", isAllowNull: $('#CheckBoxAllowNull').is(':checked') ? "Y" : "N", DataType: $('#TextDataType').val(), ColDesc: $('#TextColDesc').val(), ColumnName: $("#TextColumnName").val(),Width:$("#TextWidth").val(), CharNum:$("#TextCharNum").val(), DefValue: $('#TextDefValue').val(), Sequence: $("#TextSequence").val(), DisplayValue: $("#TextDisplayValue").val(), RelationColumns: $("#TextRelationColumns").val() }, function (msg) { if (msg == "true") { $.messager.alert('提示', '操作成功!'); //flashTable(); f_submit(); $('#winSetTbInfo').window('close'); } else { $.messager.alert('提示', msg, 'error'); } }) }