SysFunctionMG.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /// <reference path="../../easyui/jquery.easyui.min.js" />
  2. function initAddFun() {
  3. $("#hid_UserType").val("add");
  4. $("#cFunctionID").textbox("readonly",false);
  5. $('#cNames').textbox("setValue", "");
  6. $("#cURL").textbox("setValue", "");
  7. //$("#labCreateUser2").html("");
  8. //$("#labCreateDate2").html("");
  9. $("#txtPageName").val("");
  10. $("#lsIsFront").switchbutton('uncheck');
  11. $("#lsIsBack").switchbutton('uncheck');
  12. $("#lsIsBrower").switchbutton('uncheck');
  13. $("#lsIsAdd").switchbutton('uncheck');
  14. $("#lsIsDelete").switchbutton('uncheck');
  15. $("#lsIsUpdate").switchbutton('uncheck');
  16. $("#lsIsPrint").switchbutton('uncheck');
  17. $("#lsIsOwner").switchbutton('uncheck');
  18. $('#winSetFunInfo').window('open');
  19. }
  20. function myformatter(date) {
  21. var y = date.getFullYear();
  22. var m = date.getMonth() + 1;
  23. var d = date.getDate();
  24. return y + '-' + (m < 10 ? ('0' + m) : m) + '-' + (d < 10 ? ('0' + d) : d);
  25. }
  26. function initEditFun(row) {
  27. $("#hid_UserType").val("modify");
  28. $("#cFunctionID").textbox("readonly", true);
  29. $("#cNames").textbox("setValue", row.FunctionName);
  30. $("#cFunctionID").textbox("setValue", row.FunctionID);
  31. $.ajax({
  32. url: "/SystemModule/GetFunctionByID?ran=" + Math.random(),
  33. type: "POST",
  34. dataType: "json",
  35. data: { FunctionID: row.FunctionID },
  36. success: function (msg) {
  37. if (CheckAajxData(msg) === false) return;
  38. $("#cURL").textbox("setValue", msg[0].URL);
  39. $("#txtPageName").val(msg[0].PageName);
  40. //$("#labCreateDate2").html(msg[0].TimeLastMod);
  41. //$("#labCreateUser2").html(msg[0].UserIDLastMod);
  42. $("#lsIsFront").switchbutton(msg[0].IsFront == 'Y' ? 'check' : 'uncheck');
  43. $("#lsIsBack").switchbutton(msg[0].IsBack == 'Y' ? 'check' : 'uncheck');
  44. $("#lsIsBrower").switchbutton(msg[0].IsBrowse == 'Y' ? 'check' : 'uncheck');
  45. $("#lsIsAdd").switchbutton(msg[0].IsAdd == 'Y' ? 'check' : 'uncheck');
  46. $("#lsIsDelete").switchbutton(msg[0].IsDelete == 'Y' ? 'check' : 'uncheck');
  47. $("#lsIsUpdate").switchbutton(msg[0].IsUpdate == 'Y' ? 'check' : 'uncheck');
  48. $("#lsIsPrint").switchbutton(msg[0].IsPrint == 'Y' ? 'check' : 'uncheck');
  49. $("#lsIsOwner").switchbutton(msg[0].IsAudit == 'Y' ? 'check' : 'uncheck');
  50. }
  51. })
  52. $('#winSetFunInfo').window('open');
  53. }
  54. function submit() {
  55. if (!$('#cFunctionID').val().trim()) {
  56. $.messager.alert('提醒', '功能菜单编号不能为空', 'error');
  57. return;
  58. }
  59. if (!$('#cNames').val().trim()) {
  60. $.messager.alert('提醒', '功能菜单名称不能为空', 'error');
  61. return;
  62. }
  63. var PFunctionID;
  64. if ($('#hid_UserType').val() == "add") {
  65. var node = $('#tg').treegrid('getSelected');
  66. if (node) {
  67. //f_add(node.FunctionID);
  68. PFunctionID = node.FunctionID;
  69. }
  70. }
  71. $.post("/SystemModule/SysFunctionEditAjax", { PFunctionID: PFunctionID, FunctionID: $('#cFunctionID').val().trim(), Type: $('#hid_UserType').val(), cNames: $('#cNames').val(),
  72. cURL: $('#cURL').val(), PageName: $('#txtPageName').val(), IsFront: $("#lsIsFront").prop('checked') ? 'Y' : 'N',
  73. IsBack: $("#lsIsBack").prop('checked') ? 'Y' : 'N',
  74. IsBrowse: $("#lsIsBrower").prop('checked') ? 'Y' : 'N',
  75. IsAdd: $("#lsIsAdd").prop('checked') ?'Y': 'N',
  76. IsDelete: $("#lsIsDelete").prop('checked') ?'Y': 'N',
  77. IsUpdate: $("#lsIsUpdate").prop('checked') ? 'Y' : 'N',
  78. IsPrint: $("#lsIsPrint").prop('checked') ?'Y': 'N',
  79. IsAudit: $("#lsIsOwner").prop('checked') ? 'Y' : 'N'
  80. }, function (data) {
  81. if (CheckAajxData(data) === false) return;
  82. var msg = JSON.parse(data);
  83. if (msg != null && msg.Success === true) {
  84. f_Sumbit();
  85. $('#winSetFunInfo').window('close');
  86. layer.alert("操作成功!", { title: '提示信息' });
  87. } else {
  88. layer.alert(msg.ErrorInfo, { title: '提示信息' });
  89. }
  90. })
  91. }