123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567 |
- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="frmBdServiceKmList.aspx.cs" Inherits="AppFms_Bd_frmBdServiceKmList" %>
- <%@ Register Src="ascxEditKm.ascx" TagPrefix="uc1" TagName="ascxEdit" %>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>科目维护</title>
- <link href="../../Themes/Default/eci.css" rel="stylesheet" />
- <!-- #include File="../../App/Common/PageLoad.aspx" -->
- <link href="../../EasyUI/themes/default/easyui.css" rel="stylesheet" />
- <link href="../../EasyUI/themes/icon.css" rel="stylesheet" />
- <script src="../../EasyUI/jquery.easyui.min.js" type="text/javascript"></script>
- <style type="text/css">
- #mm div {
- }
- .tree-folder {
- background: url('../../Icon/plugin.png') no-repeat;
- }
- .tree-folder-open {
- background: url('../../Icon/plugin.png') no-repeat;
- }
- .tree-file {
- background: url('../../Icon/plugin.png') no-repeat;
- }
- </style>
- </head>
- <body>
- <script type="text/javascript">
- var parentNode;
- var editNode;
- var deleteNode;
- var copyId = "";
- function myLoadFilter(data, parent) {
- var state = $.data(this, 'tree');
- function setData() {
- var serno = 1;
- var todo = [];
- for (var i = 0; i < data.length; i++) {
- todo.push(data[i]);
- }
- while (todo.length) {
- var node = todo.shift();
- if (node.id == undefined) {
- node.id = '_node_' + (serno++);
- }
- if (node.children) {
- node.state = 'closed';
- node.children1 = node.children;
- node.children = undefined;
- todo = todo.concat(node.children1);
- }
- }
- state.tdata = data;
- }
- function find(id) {
- var data = state.tdata;
- var cc = [data];
- while (cc.length) {
- var c = cc.shift();
- for (var i = 0; i < c.length; i++) {
- var node = c[i];
- if (node.id == id) {
- return node;
- } else if (node.children1) {
- cc.push(node.children1);
- }
- }
- }
- return null;
- }
- setData();
- var t = $(this);
- var opts = t.tree('options');
- opts.onBeforeExpand = function (node) {
- var n = find(node.id);
- if (n == null) return;
- if (n.children && n.children.length) { return }
- if (n.children1) {
- var filter = opts.loadFilter;
- opts.loadFilter = function (data) { return data; };
- t.tree('append', {
- parent: node.target,
- data: n.children1
- });
- opts.loadFilter = filter;
- n.children = n.children1;
- }
- };
- return data;
- }
- </script>
- <script type="text/javascript">
- function append() {
- var t = $('#tt');
- var node = t.tree('getSelected');
- parentNode = node;
- $(".function-edit").show();
- add(node.id);
- //如果没有展开,则展开
- var domId = node.domId;
- var length = $("#" + domId).parent().find("ul").length;
- if (length == 0 && node.state == "closed") {
- $('#tt').tree('reload', node.target);
- }
- else {
- $('#tt').tree('expand', node.target);
- }
- //if (parentNode.children) {
- // var seq = parentNode.children.length * 10;
- // seq += 10;
- // $("#ascxEdit_txtSEQ").val(seq);
- //}
- //else {
- // $("#ascxEdit_txtSEQ").val(10);
- //}
- if (node.ownerid == "") {
- $("#ascxEdit_txtOwnerId").val(node.id);
- $("#ascxEdit_txtOWNED_SERVICE").val(node.text);
- $("#ascxEdit_txtMemo").val(node.memo);
- }
- else {
- $("#ascxEdit_txtOwnerId").val(node.ownerid);
- $("#ascxEdit_txtOWNED_SERVICE").val(node.ownername);
- //$("#ascxEdit_txtParentName").val(node.text);
- $("#ascxEdit_txtMemo").val(node.memo);
- }
- //showOpType("NA");
- }
- function menuRefresh() {
- var node = $('#tt').tree('getSelected');
- $('#tt').tree('reload', node.target);
- }
- function resetSEQ() {
- var t = $('#tt');
- var node = t.tree('getSelected');
- var data = { functionId: node.id };
- eci.post("../Data/Data.ashx", "FunctionResetSEQ", data, function (res) {
- msg.ajax(res);
- if (res.success) {
- menuRefresh();
- }
- })
- }
- function resetParentSEQ() {
- var functionId = $("#ascxEdit_txtPARENTID").val();
- var data = { functionId: functionId };
- eci.post("../Data/Data.ashx", "FunctionResetSEQ", data, function (res) {
- msg.ajax(res);
- if (res.success) {
- menuRefresh();
- }
- })
- }
- function deleteIt() {
- var editId = $("#ascxEdit_txtGUID").val();
- if (editId == "") {
- msg.error("删除失败,没有选择要删除的节点");
- return;
- }
- var node = $('#tt').tree('getSelected');
- var id = node.id;
- deleteNode = node;
- if (id != editId) {
- msg.error("删除失败,请联系管理员!错误编码-E001");
- return;
- }
- msg.validate("此操作将删除分组下所有的子分组,是否确认删除?", function () {
- deleteAction();
- })
- }
- function removeit() {
- var node = $('#tt').tree('getSelected');
- if (node.attributes && node.attributes.root == "true") {
- msg.alert("不能删除根节点");
- return;
- }
- deleteNode = node;
- msg.validate("此操作将删除分组下所有的子分组,是否确认删除?", function () {
- deleteAction();
- })
- }
- function deleteAction() {
- eci.post("frmBdServiceKmData.aspx", "Delete", { id: deleteNode.id, validate: true }, function (res) {
- if (res.success) {
- $('#tt').tree('remove', deleteNode.target);
- msg.alert("删除成功");
- eci.closewindow("divDelete");
- $(".function-edit").hide();
- }
- else {
- msg.ajax(res);
- $("#txtValidateCode").val("").focus();
- }
- });
- }
- function collapseAll() {
- $('#tt').tree('collapseAll');
- }
- function expandAll() {
- $('#tt').tree('expandAll');
- }
- function load(id) {
- $(".function-edit").show();
- $("#ascxEdit_txtFLAG").val("Edit");
- eci.post("frmBdServiceKmData.aspx", "LoadRecord", { id: id }, function (res) {
- if (res.success) {
- $("#ascxEdit_txtGroup").val(res.group_code + "|" + res.group_name);
- $("#ascxEdit_txtOWNED_SERVICE").val(res.ownername);
- //$("#ascxEdit_txtParentName").val(res.parentname);
- $("#ascxEdit_txtMemo").val(res.memo);
- $("#ascxEdit_txtCODE").val(res.code);
- $("#ascxEdit_txtNAME").val(res.name);
- $("#ascxEdit_txtGUID").val(res.guid);
- $("#ascxEdit_txtPARENTID").val(res.parentid);
- $("#ascxEdit_cboGlms").val(res.GLMS);
- $("#ascxEdit_txtFzzsz").val(res.FZZSZ);
- $("#ascxEdit_txtStatus").val(res.STATUS);
- $("#ascxEdit_txtReamrk").val(res.reamrk);
- $("#ascxEdit_txtUpdateUserName").val(res.update_user_name);
- $("#ascxEdit_txtUpdateDate").val(res.update_date);
- if (res.ownerid == "") {
- $("#btnDeleteIt").hide();
- $("#btnSave").hide();
- $("#divEdit").hide();
- }
- else {
- $("#btnDeleteIt").show();
- $("#btnSave").show();
- $("#btnAdd").show();
- $("#divEdit").show();
- }
- if (res.status == "Y") {
- $("#ascxEdit_txtCODE").attr("readonly", "true");
- $("#ascxEdit_txtCODE").addClass("text-disabled");
- $("#btnDeleteIt").hide();
- }
- else {
- $("#ascxEdit_txtCODE").removeAttr("readonly");
- $("#ascxEdit_txtCODE").removeClass("text-disabled");
- }
- }
- else {
- msg.ajax(res);
- }
- })
- }
- function save() {
- var data = {};
- data.GUID = $("#ascxEdit_txtGUID").val();
- data.NAME = $("#ascxEdit_txtNAME").val();
- data.CODE = $("#ascxEdit_txtCODE").val();
- data.PARENTID = $("#ascxEdit_txtPARENTID").val();
- data.OWNED_SERVICE = $("#ascxEdit_txtOwnerId").val();
- data.FLAG = $("#ascxEdit_txtFLAG").val();
- data.OWNERNAME = $("#ascxEdit_txtOWNED_SERVICE").val();
- data.MEMO = $("#ascxEdit_txtMemo").val();
- data.GLMS = $("#ascxEdit_cboGlms").val();
- data.FZZSZ = $("#ascxEdit_txtFzzsz").val();
- data.STATUS = $("#ascxEdit_txtStatus").val();
- data.REAMRK = $("#ascxEdit_txtReamrk").val();
- if (data.ID == "" && !data.PARENTID) {
- msg.warning("保存异常,没有选择上级节点");
- return;
- }
- var check = $.eciform.validate();
- if (!check) return false;
- eci.post("frmBdServiceKmData.aspx", "Save", data, function (res) {
- if (res.success) {
- if (data.FLAG == "Add") {
- var t = $('#tt');
- var id = data.GUID;
- var text = data.NAME;
- var ownerid = data.OWNED_SERVICE;
- var ownername = data.OWNERNAME;
- t.tree('append', {
- parent: (parentNode ? parentNode.target : null),
- data: [{
- id: id,
- text: text,
- ownerid: ownerid,
- ownername: ownername
- }]
- });
- $("#ascxEdit_txtFLAG").val("Edit");
- $("#tt").tree("getChildren", parentNode);
- editNode = parentNode.children[parentNode.children.length - 1];
- $('#tt').tree('select', editNode.target);
- //showOpType(id);
- }
- else {
- editNode.text = data.NAME;
- $("#tt").tree("update", editNode);
- }
- $("#btnDeleteIt").show();
- $("#btnAdd").show();
- if (data.STATUS == "Y") {
- $("#ascxEdit_txtCODE").attr("readonly", "true");
- $("#ascxEdit_txtCODE").addClass("text-disabled");
- $("#btnDeleteIt").hide();
- }
- else {
- $("#ascxEdit_txtCODE").removeAttr("readonly");
- $("#ascxEdit_txtCODE").removeClass("text-disabled");
- }
- msg.alert("保存成功");
- }
- else {
- msg.ajax(res);
- }
- })
- }
- function add(parentId) {
- $("#divEdit").show();
- var guid = eci.guid();
- $("#ascxEdit_txtGUID").val(guid);
- $("#ascxEdit_txtFLAG").val("Add");
- $("#ascxEdit_txtNAME").val("");
- $("#ascxEdit_txtCODE").val("");
- //$("#ascxEdit_txtParentName").val("");
- $("#ascxEdit_txtMemo").val("");
- $("#ascxEdit_txtPARENTID").val(parentId);
- //$("#ascxEdit_txtStatus option:first").attr("selected", true);
- //$("#ascxEdit_cboSelectType option:first").attr("selected", true);
- //$("#ascxEdit_txtSysCode").val("");
- $("#ascxEdit_cboGlms option:first").attr("selected", true);
- $("#ascxEdit_txtFzzsz option:first").attr("selected", true);
- $("#ascxEdit_txtStatus option:first").attr("selected", true);
- $("#ascxEdit_txtReamrk").val("");
- $("#ascxEdit_txtCODE").focus();
- $("#btnDeleteIt").hide();
- $("#btnAdd").hide();
- $("#btnSave").show();
- $("#ascxEdit_txtCODE").removeAttr("readonly");
- $("#ascxEdit_txtCODE").removeClass("text-disabled");
- }
- $(function () {
- $(".function-edit").hide();
- $('#tt').tree({
- url: 'frmBdServiceKmData.aspx?type=load&dps=' + eci.guid(), method: 'get', loadFilter: myLoadFilter, lines: true, dnd: true, onContextMenu: function (e, node) {
- e.preventDefault();
- var id = node.id;
- editNode = node;
- load(id);
- $(this).tree('select', node.target);
- $('#mm').menu('show', {
- left: e.pageX,
- top: e.pageY
- });
- },
- onClick: function (node) {
- var id = node.id;
- editNode = node;
- //$("#frameServiceItemPages").attr("src", "frmFzgjBdServiceItemPagesPtList.aspx?serviceItemCode=" + id);
- load(id);
- },
- onContextMenu: function (e, node) {
- e.preventDefault();
- $('#tt').tree('select', node.target);
- if (copyId) {
- $("#paste").show();
- }
- else {
- $("#paste").hide();
- }
- e.preventDefault();
- $('#mm').menu('show', {
- left: e.pageX,
- top: e.pageY
- });
- return true;
- },
- onBeforeDrop: function (targetNode, source, point) {
- var allowDrag = $("#chkDrag")[0].checked;
- if (!allowDrag) { return false; }
- var targetId = $("#tt").tree('getNode', targetNode).id;
- var rootId = $("#hidRootId").val();
- if (targetId == rootId) {
- return false;
- }
- }
- , onDrop: function (targetNode, source, point) {
- var targetId = $("#tt").tree('getNode', targetNode).id;
- $.ajax({
- url: 'FunctionTreeData.aspx?type=move',
- type: 'post',
- dataType: 'json',
- data: {
- id: source.id,
- targetId: targetId,
- point: point
- }
- });
- }
- });
- });
- function refreshImage() {
- validateImage("checkimag");
- $("#txtValidateCode").val("").focus();
- }
- $(function () {
- /*$("#divHidden").show();*/
- layout();
- setTimeout(expandAll, 400);
- });
- </script>
- <form id="form1" runat="server">
- <div id="root">
- <div class="workarea">
- <table style="height: 100%; width: 100%;" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <div class="toolbar">
- <asp:EButton runat="server" Text="全部展开" Width="90" ID="btnExpandAll" Icon="application_put" IsClient="true" OnClientClick="expandAll()" />
- <asp:EButton runat="server" Text="全部折叠" Width="90" ID="btnCollapseAll" Icon="application_osx_get" IsClient="true" OnClientClick="collapseAll()" />
- <%--<asp:EButton runat="server" Text="同步" Width="90" ID="btnTongBu" Icon="arrow_switch" IsClient="true" OnClientClick="tongBuAction(this)" />--%>
- </div>
- </td>
- <td>
- <div class="toolbar function-edit" style="border-left: 1px;">
- <input type="hidden" id="hidRootId" runat="server" />
- <input type="hidden" id="hidKey" runat="server" />
- <asp:EButton runat="server" Text="添加项目" ID="btnAdd" Icon="add" IsClient="true" OnClientClick="append()" />
- <asp:EButton runat="server" Text="保存" ID="btnSave" Icon="save" IsClient="true" OnClientClick="save()" />
- <asp:EButton runat="server" Text="删除" ID="btnDeleteIt" Icon="delete" IsClient="true" OnClientClick="deleteIt()" />
- </div>
- </td>
- </tr>
- <tr style="height: 100%">
- <td style="width: 300px; vertical-align: top;">
- <div class="easyui-panel fitH" layout="48" style="padding: 5px; border-top: 0px;">
- <ul id="tt"></ul>
- </div>
- </td>
- <td class="function-edit" style="height: 100%;">
- <div style="margin: 0px; border-bottom: 1px solid #95B8E7; border-right: 1px solid #95B8E7; overflow-y: auto; vertical-align: top;">
- <div class="pagetitle">服务类别</div>
- <uc1:ascxEdit runat="server" ID="ascxEdit" />
- <div style="margin: 2px;"></div>
- </div>
- <div style="border-right: 1px solid #95B8E7;" class="fitH" layout="148">
- <iframe runat="server" id="frameServiceItemPages" width="100%" height="100%"></iframe>
- </div>
- </td>
- </tr>
- </table>
- </div>
- </div>
- <div class="hidden" id="divHidden">
- <div id="mm" class="easyui-menu" style="width: 120px;">
- <div onclick="menuRefresh()" data-options="iconCls:'icon-refresh'">刷新</div>
- <div class="menu-sep"></div>
- <div onclick="append()" data-options="iconCls:'icon-add'">添加子分类</div>
- <div onclick="removeit()" data-options="iconCls:'icon-remove'">删 除</div>
- <div class="menu-sep"></div>
- <div onclick="resetSEQ()">重置顺序</div>
- </div>
- </div>
- </form>
- </body>
- </html>
|