SysStatusMG.js 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /// <reference path="../../easyui/jquery.easyui.min.js" />
  2. function initAddStatus() {
  3. $("#hid_UserType").val("add");
  4. $('#txtTableName').textbox("setValue","");
  5. $('#txtColName').textbox("setValue","");
  6. $("#txtCodeValue").textbox("setValue","");
  7. $("#txtDisplayValue").textbox("setValue","");
  8. $('#winSetSysStatusInfo').window('open');
  9. }
  10. function myformatter(date) {
  11. var y = date.getFullYear();
  12. var m = date.getMonth() + 1;
  13. var d = date.getDate();
  14. return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
  15. }
  16. function initEditStatus(row) {
  17. $("#hid_UserType").val("modify");
  18. $("#txtTableName").val(row.TableName);
  19. $("#txtColName").val(row.ColName);
  20. $("#txtCodeValue").val(row.CodeValue);
  21. $("#txtDisplayValue").val(row.DisplayValue);
  22. $('#winSetSysStatusInfo').window('open');
  23. }
  24. function submit() {
  25. if (!$('#txtTableName').val().trim()) {
  26. $.messager.alert('提醒', '表名不能为空', 'error');
  27. return;
  28. }
  29. if (!$('#txtColName').val().trim()) {
  30. $.messager.alert('提醒', '列名不能为空', 'error');
  31. return;
  32. }
  33. if (!$('#txtCodeValue').val().trim()) {
  34. $.messager.alert('提醒', '码值不能为空', 'error');
  35. return;
  36. }
  37. if (!$('#txtDisplayValue').val().trim()) {
  38. $.messager.alert('提醒', '显示值不能为空', 'error');
  39. return;
  40. }
  41. var SysStatusID;
  42. if($("#hid_UserType").val()=="modify"){
  43. var rows = $('#dg').datagrid('getSelections');
  44. if (rows.length == 1) {
  45. var row = rows[0];
  46. SysStatusID = row.SysStatusID;
  47. }
  48. }
  49. $.post("../SystemModuleAjax/SysStatusEditAjax.aspx", { SysStatusID:SysStatusID,TableName:$('#txtTableName').val().trim(), type: $('#hid_UserType').val(), ColName: $('#txtColName').val(),
  50. CodeValue: $('#txtCodeValue').val(), DisplayValue: $('#txtDisplayValue').val()
  51. }, function (msg) {
  52. if (msg == "true") {
  53. $.messager.alert('提示', '操作成功!');
  54. f_submit();
  55. $('#winSetSysStatusInfo').window('close');
  56. } else {
  57. $.messager.alert('提示', msg, 'error');
  58. }
  59. })
  60. }