frmBdServiceKmList.aspx 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmBdServiceKmList.aspx.cs" Inherits="AppFms_Bd_frmBdServiceKmList" %>
  2. <%@ Register Src="ascxEditKm.ascx" TagPrefix="uc1" TagName="ascxEdit" %>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml">
  5. <head runat="server">
  6. <title>科目维护</title>
  7. <link href="../../Themes/Default/eci.css" rel="stylesheet" />
  8. <!-- #include File="../../App/Common/PageLoad.aspx" -->
  9. <link href="../../EasyUI/themes/default/easyui.css" rel="stylesheet" />
  10. <link href="../../EasyUI/themes/icon.css" rel="stylesheet" />
  11. <script src="../../EasyUI/jquery.easyui.min.js" type="text/javascript"></script>
  12. <style type="text/css">
  13. #mm div {
  14. }
  15. .tree-folder {
  16. background: url('../../Icon/plugin.png') no-repeat;
  17. }
  18. .tree-folder-open {
  19. background: url('../../Icon/plugin.png') no-repeat;
  20. }
  21. .tree-file {
  22. background: url('../../Icon/plugin.png') no-repeat;
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <script type="text/javascript">
  28. var parentNode;
  29. var editNode;
  30. var deleteNode;
  31. var copyId = "";
  32. function myLoadFilter(data, parent) {
  33. var state = $.data(this, 'tree');
  34. function setData() {
  35. var serno = 1;
  36. var todo = [];
  37. for (var i = 0; i < data.length; i++) {
  38. todo.push(data[i]);
  39. }
  40. while (todo.length) {
  41. var node = todo.shift();
  42. if (node.id == undefined) {
  43. node.id = '_node_' + (serno++);
  44. }
  45. if (node.children) {
  46. node.state = 'closed';
  47. node.children1 = node.children;
  48. node.children = undefined;
  49. todo = todo.concat(node.children1);
  50. }
  51. }
  52. state.tdata = data;
  53. }
  54. function find(id) {
  55. var data = state.tdata;
  56. var cc = [data];
  57. while (cc.length) {
  58. var c = cc.shift();
  59. for (var i = 0; i < c.length; i++) {
  60. var node = c[i];
  61. if (node.id == id) {
  62. return node;
  63. } else if (node.children1) {
  64. cc.push(node.children1);
  65. }
  66. }
  67. }
  68. return null;
  69. }
  70. setData();
  71. var t = $(this);
  72. var opts = t.tree('options');
  73. opts.onBeforeExpand = function (node) {
  74. var n = find(node.id);
  75. if (n == null) return;
  76. if (n.children && n.children.length) { return }
  77. if (n.children1) {
  78. var filter = opts.loadFilter;
  79. opts.loadFilter = function (data) { return data; };
  80. t.tree('append', {
  81. parent: node.target,
  82. data: n.children1
  83. });
  84. opts.loadFilter = filter;
  85. n.children = n.children1;
  86. }
  87. };
  88. return data;
  89. }
  90. </script>
  91. <script type="text/javascript">
  92. function append() {
  93. var t = $('#tt');
  94. var node = t.tree('getSelected');
  95. parentNode = node;
  96. $(".function-edit").show();
  97. add(node.id);
  98. //如果没有展开,则展开
  99. var domId = node.domId;
  100. var length = $("#" + domId).parent().find("ul").length;
  101. if (length == 0 && node.state == "closed") {
  102. $('#tt').tree('reload', node.target);
  103. }
  104. else {
  105. $('#tt').tree('expand', node.target);
  106. }
  107. //if (parentNode.children) {
  108. // var seq = parentNode.children.length * 10;
  109. // seq += 10;
  110. // $("#ascxEdit_txtSEQ").val(seq);
  111. //}
  112. //else {
  113. // $("#ascxEdit_txtSEQ").val(10);
  114. //}
  115. if (node.ownerid == "") {
  116. $("#ascxEdit_txtOwnerId").val(node.id);
  117. $("#ascxEdit_txtOWNED_SERVICE").val(node.text);
  118. $("#ascxEdit_txtMemo").val(node.memo);
  119. }
  120. else {
  121. $("#ascxEdit_txtOwnerId").val(node.ownerid);
  122. $("#ascxEdit_txtOWNED_SERVICE").val(node.ownername);
  123. //$("#ascxEdit_txtParentName").val(node.text);
  124. $("#ascxEdit_txtMemo").val(node.memo);
  125. }
  126. //showOpType("NA");
  127. }
  128. function menuRefresh() {
  129. var node = $('#tt').tree('getSelected');
  130. $('#tt').tree('reload', node.target);
  131. }
  132. function resetSEQ() {
  133. var t = $('#tt');
  134. var node = t.tree('getSelected');
  135. var data = { functionId: node.id };
  136. eci.post("../Data/Data.ashx", "FunctionResetSEQ", data, function (res) {
  137. msg.ajax(res);
  138. if (res.success) {
  139. menuRefresh();
  140. }
  141. })
  142. }
  143. function resetParentSEQ() {
  144. var functionId = $("#ascxEdit_txtPARENTID").val();
  145. var data = { functionId: functionId };
  146. eci.post("../Data/Data.ashx", "FunctionResetSEQ", data, function (res) {
  147. msg.ajax(res);
  148. if (res.success) {
  149. menuRefresh();
  150. }
  151. })
  152. }
  153. function deleteIt() {
  154. var editId = $("#ascxEdit_txtGUID").val();
  155. if (editId == "") {
  156. msg.error("删除失败,没有选择要删除的节点");
  157. return;
  158. }
  159. var node = $('#tt').tree('getSelected');
  160. var id = node.id;
  161. deleteNode = node;
  162. if (id != editId) {
  163. msg.error("删除失败,请联系管理员!错误编码-E001");
  164. return;
  165. }
  166. msg.validate("此操作将删除分组下所有的子分组,是否确认删除?", function () {
  167. deleteAction();
  168. })
  169. }
  170. function removeit() {
  171. var node = $('#tt').tree('getSelected');
  172. if (node.attributes && node.attributes.root == "true") {
  173. msg.alert("不能删除根节点");
  174. return;
  175. }
  176. deleteNode = node;
  177. msg.validate("此操作将删除分组下所有的子分组,是否确认删除?", function () {
  178. deleteAction();
  179. })
  180. }
  181. function deleteAction() {
  182. eci.post("frmBdServiceKmData.aspx", "Delete", { id: deleteNode.id, validate: true }, function (res) {
  183. if (res.success) {
  184. $('#tt').tree('remove', deleteNode.target);
  185. msg.alert("删除成功");
  186. eci.closewindow("divDelete");
  187. $(".function-edit").hide();
  188. }
  189. else {
  190. msg.ajax(res);
  191. $("#txtValidateCode").val("").focus();
  192. }
  193. });
  194. }
  195. function collapseAll() {
  196. $('#tt').tree('collapseAll');
  197. }
  198. function expandAll() {
  199. $('#tt').tree('expandAll');
  200. }
  201. function load(id) {
  202. $(".function-edit").show();
  203. $("#ascxEdit_txtFLAG").val("Edit");
  204. eci.post("frmBdServiceKmData.aspx", "LoadRecord", { id: id }, function (res) {
  205. if (res.success) {
  206. $("#ascxEdit_txtGroup").val(res.group_code + "|" + res.group_name);
  207. $("#ascxEdit_txtOWNED_SERVICE").val(res.ownername);
  208. //$("#ascxEdit_txtParentName").val(res.parentname);
  209. $("#ascxEdit_txtMemo").val(res.memo);
  210. $("#ascxEdit_txtCODE").val(res.code);
  211. $("#ascxEdit_txtNAME").val(res.name);
  212. $("#ascxEdit_txtGUID").val(res.guid);
  213. $("#ascxEdit_txtPARENTID").val(res.parentid);
  214. $("#ascxEdit_cboGlms").val(res.GLMS);
  215. $("#ascxEdit_txtFzzsz").val(res.FZZSZ);
  216. $("#ascxEdit_txtStatus").val(res.STATUS);
  217. $("#ascxEdit_txtReamrk").val(res.reamrk);
  218. $("#ascxEdit_txtUpdateUserName").val(res.update_user_name);
  219. $("#ascxEdit_txtUpdateDate").val(res.update_date);
  220. if (res.ownerid == "") {
  221. $("#btnDeleteIt").hide();
  222. $("#btnSave").hide();
  223. $("#divEdit").hide();
  224. }
  225. else {
  226. $("#btnDeleteIt").show();
  227. $("#btnSave").show();
  228. $("#btnAdd").show();
  229. $("#divEdit").show();
  230. }
  231. if (res.status == "Y") {
  232. $("#ascxEdit_txtCODE").attr("readonly", "true");
  233. $("#ascxEdit_txtCODE").addClass("text-disabled");
  234. $("#btnDeleteIt").hide();
  235. }
  236. else {
  237. $("#ascxEdit_txtCODE").removeAttr("readonly");
  238. $("#ascxEdit_txtCODE").removeClass("text-disabled");
  239. }
  240. }
  241. else {
  242. msg.ajax(res);
  243. }
  244. })
  245. }
  246. function save() {
  247. var data = {};
  248. data.GUID = $("#ascxEdit_txtGUID").val();
  249. data.NAME = $("#ascxEdit_txtNAME").val();
  250. data.CODE = $("#ascxEdit_txtCODE").val();
  251. data.PARENTID = $("#ascxEdit_txtPARENTID").val();
  252. data.OWNED_SERVICE = $("#ascxEdit_txtOwnerId").val();
  253. data.FLAG = $("#ascxEdit_txtFLAG").val();
  254. data.OWNERNAME = $("#ascxEdit_txtOWNED_SERVICE").val();
  255. data.MEMO = $("#ascxEdit_txtMemo").val();
  256. data.GLMS = $("#ascxEdit_cboGlms").val();
  257. data.FZZSZ = $("#ascxEdit_txtFzzsz").val();
  258. data.STATUS = $("#ascxEdit_txtStatus").val();
  259. data.REAMRK = $("#ascxEdit_txtReamrk").val();
  260. if (data.ID == "" && !data.PARENTID) {
  261. msg.warning("保存异常,没有选择上级节点");
  262. return;
  263. }
  264. var check = $.eciform.validate();
  265. if (!check) return false;
  266. eci.post("frmBdServiceKmData.aspx", "Save", data, function (res) {
  267. if (res.success) {
  268. if (data.FLAG == "Add") {
  269. var t = $('#tt');
  270. var id = data.GUID;
  271. var text = data.NAME;
  272. var ownerid = data.OWNED_SERVICE;
  273. var ownername = data.OWNERNAME;
  274. t.tree('append', {
  275. parent: (parentNode ? parentNode.target : null),
  276. data: [{
  277. id: id,
  278. text: text,
  279. ownerid: ownerid,
  280. ownername: ownername
  281. }]
  282. });
  283. $("#ascxEdit_txtFLAG").val("Edit");
  284. $("#tt").tree("getChildren", parentNode);
  285. editNode = parentNode.children[parentNode.children.length - 1];
  286. $('#tt').tree('select', editNode.target);
  287. //showOpType(id);
  288. }
  289. else {
  290. editNode.text = data.NAME;
  291. $("#tt").tree("update", editNode);
  292. }
  293. $("#btnDeleteIt").show();
  294. $("#btnAdd").show();
  295. if (data.STATUS == "Y") {
  296. $("#ascxEdit_txtCODE").attr("readonly", "true");
  297. $("#ascxEdit_txtCODE").addClass("text-disabled");
  298. $("#btnDeleteIt").hide();
  299. }
  300. else {
  301. $("#ascxEdit_txtCODE").removeAttr("readonly");
  302. $("#ascxEdit_txtCODE").removeClass("text-disabled");
  303. }
  304. msg.alert("保存成功");
  305. }
  306. else {
  307. msg.ajax(res);
  308. }
  309. })
  310. }
  311. function add(parentId) {
  312. $("#divEdit").show();
  313. var guid = eci.guid();
  314. $("#ascxEdit_txtGUID").val(guid);
  315. $("#ascxEdit_txtFLAG").val("Add");
  316. $("#ascxEdit_txtNAME").val("");
  317. $("#ascxEdit_txtCODE").val("");
  318. //$("#ascxEdit_txtParentName").val("");
  319. $("#ascxEdit_txtMemo").val("");
  320. $("#ascxEdit_txtPARENTID").val(parentId);
  321. //$("#ascxEdit_txtStatus option:first").attr("selected", true);
  322. //$("#ascxEdit_cboSelectType option:first").attr("selected", true);
  323. //$("#ascxEdit_txtSysCode").val("");
  324. $("#ascxEdit_cboGlms option:first").attr("selected", true);
  325. $("#ascxEdit_txtFzzsz option:first").attr("selected", true);
  326. $("#ascxEdit_txtStatus option:first").attr("selected", true);
  327. $("#ascxEdit_txtReamrk").val("");
  328. $("#ascxEdit_txtCODE").focus();
  329. $("#btnDeleteIt").hide();
  330. $("#btnAdd").hide();
  331. $("#btnSave").show();
  332. $("#ascxEdit_txtCODE").removeAttr("readonly");
  333. $("#ascxEdit_txtCODE").removeClass("text-disabled");
  334. }
  335. $(function () {
  336. $(".function-edit").hide();
  337. $('#tt').tree({
  338. url: 'frmBdServiceKmData.aspx?type=load&dps=' + eci.guid(), method: 'get', loadFilter: myLoadFilter, lines: true, dnd: true, onContextMenu: function (e, node) {
  339. e.preventDefault();
  340. var id = node.id;
  341. editNode = node;
  342. load(id);
  343. $(this).tree('select', node.target);
  344. $('#mm').menu('show', {
  345. left: e.pageX,
  346. top: e.pageY
  347. });
  348. },
  349. onClick: function (node) {
  350. var id = node.id;
  351. editNode = node;
  352. //$("#frameServiceItemPages").attr("src", "frmFzgjBdServiceItemPagesPtList.aspx?serviceItemCode=" + id);
  353. load(id);
  354. },
  355. onContextMenu: function (e, node) {
  356. e.preventDefault();
  357. $('#tt').tree('select', node.target);
  358. if (copyId) {
  359. $("#paste").show();
  360. }
  361. else {
  362. $("#paste").hide();
  363. }
  364. e.preventDefault();
  365. $('#mm').menu('show', {
  366. left: e.pageX,
  367. top: e.pageY
  368. });
  369. return true;
  370. },
  371. onBeforeDrop: function (targetNode, source, point) {
  372. var allowDrag = $("#chkDrag")[0].checked;
  373. if (!allowDrag) { return false; }
  374. var targetId = $("#tt").tree('getNode', targetNode).id;
  375. var rootId = $("#hidRootId").val();
  376. if (targetId == rootId) {
  377. return false;
  378. }
  379. }
  380. , onDrop: function (targetNode, source, point) {
  381. var targetId = $("#tt").tree('getNode', targetNode).id;
  382. $.ajax({
  383. url: 'FunctionTreeData.aspx?type=move',
  384. type: 'post',
  385. dataType: 'json',
  386. data: {
  387. id: source.id,
  388. targetId: targetId,
  389. point: point
  390. }
  391. });
  392. }
  393. });
  394. });
  395. function refreshImage() {
  396. validateImage("checkimag");
  397. $("#txtValidateCode").val("").focus();
  398. }
  399. $(function () {
  400. /*$("#divHidden").show();*/
  401. layout();
  402. setTimeout(expandAll, 400);
  403. });
  404. </script>
  405. <form id="form1" runat="server">
  406. <div id="root">
  407. <div class="workarea">
  408. <table style="height: 100%; width: 100%;" cellpadding="0" cellspacing="0">
  409. <tr>
  410. <td>
  411. <div class="toolbar">
  412. <asp:EButton runat="server" Text="全部展开" Width="90" ID="btnExpandAll" Icon="application_put" IsClient="true" OnClientClick="expandAll()" />
  413. <asp:EButton runat="server" Text="全部折叠" Width="90" ID="btnCollapseAll" Icon="application_osx_get" IsClient="true" OnClientClick="collapseAll()" />
  414. <%--<asp:EButton runat="server" Text="同步" Width="90" ID="btnTongBu" Icon="arrow_switch" IsClient="true" OnClientClick="tongBuAction(this)" />--%>
  415. </div>
  416. </td>
  417. <td>
  418. <div class="toolbar function-edit" style="border-left: 1px;">
  419. <input type="hidden" id="hidRootId" runat="server" />
  420. <input type="hidden" id="hidKey" runat="server" />
  421. <asp:EButton runat="server" Text="添加项目" ID="btnAdd" Icon="add" IsClient="true" OnClientClick="append()" />
  422. <asp:EButton runat="server" Text="保存" ID="btnSave" Icon="save" IsClient="true" OnClientClick="save()" />
  423. <asp:EButton runat="server" Text="删除" ID="btnDeleteIt" Icon="delete" IsClient="true" OnClientClick="deleteIt()" />
  424. </div>
  425. </td>
  426. </tr>
  427. <tr style="height: 100%">
  428. <td style="width: 300px; vertical-align: top;">
  429. <div class="easyui-panel fitH" layout="48" style="padding: 5px; border-top: 0px;">
  430. <ul id="tt"></ul>
  431. </div>
  432. </td>
  433. <td class="function-edit" style="height: 100%;">
  434. <div style="margin: 0px; border-bottom: 1px solid #95B8E7; border-right: 1px solid #95B8E7; overflow-y: auto; vertical-align: top;">
  435. <div class="pagetitle">服务类别</div>
  436. <uc1:ascxEdit runat="server" ID="ascxEdit" />
  437. <div style="margin: 2px;"></div>
  438. </div>
  439. <div style="border-right: 1px solid #95B8E7;" class="fitH" layout="148">
  440. <iframe runat="server" id="frameServiceItemPages" width="100%" height="100%"></iframe>
  441. </div>
  442. </td>
  443. </tr>
  444. </table>
  445. </div>
  446. </div>
  447. <div class="hidden" id="divHidden">
  448. <div id="mm" class="easyui-menu" style="width: 120px;">
  449. <div onclick="menuRefresh()" data-options="iconCls:'icon-refresh'">刷新</div>
  450. <div class="menu-sep"></div>
  451. <div onclick="append()" data-options="iconCls:'icon-add'">添加子分类</div>
  452. <div onclick="removeit()" data-options="iconCls:'icon-remove'">删 除</div>
  453. <div class="menu-sep"></div>
  454. <div onclick="resetSEQ()">重置顺序</div>
  455. </div>
  456. </div>
  457. </form>
  458. </body>
  459. </html>