| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title>部门编辑</title>
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
- <link rel="stylesheet" href="../css/init.css" />
- <style>
- th {
- padding: 5px 8px 5px 0;
- text-align: right;
- }
- input {
- background-color: #FFF;
- background-image: none;
- border: 1px solid #ccc;
- border-radius: 1px;
- color: inherit;
- padding: 6px 12px;
- }
- td {
- padding: 6px 0 5px 10px;
- }
- .addts {
- background: #00a0cd;
- color: #fff;
- padding: 6px 10px;
- outline: none;
- font-size: 12px;
- margin-left: 15px;
- border: 0;
- border-radius: 3px;
- box-sizing: border-box;
- }
- .seldept {
- position: absolute;
- z-index: 100;
- display: none;
- }
- ul.ztree {
- border: 1px solid #617775;
- background: #f0f6e4;
- overflow-y: scroll;
- overflow-x: auto;
- height:150px;
- }
- </style>
- </head>
- <body class="gray-bg">
- <div style="padding: 10px;">
- <div style="padding: 10px;" class="clearFix">
- <div>
- <div class="box_content">
- <table id="sqzx" style="width: 100%;" border="0" cellspacing="0" cellpadding="0">
- <tr>
- <th>所属分类:</th>
- <td>
- <input type="text" class="pname" readonly="readonly" /><input type="hidden" class="pid" />
- <div class="seldept">
- <ul id="treeDemo" class="ztree">
- <!--类名为ztree是必须的-->
- </ul>
- </div>
- </td>
- </tr>
-
- <tr>
- <th>字典标志:</th>
- <td>
- <input type="text" class="name" /><input type="hidden" class="id" />
- </td>
- </tr>
- </table>
- </div>
- </div>
- <div class="bton" style="text-align: center;">
- <input class="addts" type="button" value="保存" />
- </div>
- </div>
- </div>
- <script src="../js/zTree/jquery.ztree.core.js"></script>
- <script>
- var id = helper.request.queryString("id");
- $(document).ready(function () {
- bind();
- $(".pname").click(function () {
- if ($(".seldept").is(":hidden")) {
- $(".seldept").show();
- } else {
- $(".seldept").hide();
- }
- })
- $(".seldept").mouseleave(function () {
- $(".seldept").hide();
- })
-
- if (id) {
- $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValue', {
- id: id,
- "token": $.cookie("token")
- }, function (result) {
- if (result.state.toLowerCase() == "success") {
- var content = result.data;
- if (content.F_PartentId && content.F_PartentId != '0') {
- getpname(content.F_PartentId);
- }
- else {
- $(".pid").val(0);
- $(".pname").val("顶级字典");
- }
- $(".id").val(content.F_ValueId);
- $(".name").val(content.F_Value);
- }
- })
- }
- });
- function getpname(strpid) {
- $.getJSON(huayi.config.callcenter_url + 'Dictionary/GetDicValue', {
- id: strpid,
- "token": $.cookie("token")
- }, function (result) {
- if (result.state.toLowerCase() == "success") {
- var content = result.data;
- $(".pid").val(content.id);
- $(".pname").val(content.text);
- }
- })
- }
- var setting = {
- data: {
- key: {
- name: "text"
- },
- // simpleData: {
- // enable: true,
- // idKey: "F_DeptId",
- // pIdKey: "F_PartentId",
- // rootPId: -1
- // }
- },
- callback: {
- onClick: zTreeOnClick
- }
- };
- function zTreeOnClick(event, treeId, treeNode) {
- $(".pid").val(treeNode.id);
- $(".pname").val(treeNode.text);
- $(".seldept").hide();
- };
- function bind() {
- $.getJSON(huayi.config.callcenter_url + "Dictionary/GetZTreeList", { "token": $.cookie("token") }, function (result) {
- if (result.state.toLowerCase() == "success") {
- tree = $.fn.zTree.init($("#treeDemo"), setting, result.data);
- // tree.addNodes(null, 0, { "id": 0, "text": "顶级字典"});
- }
- })
- }
- //修改工单
- $(".addts").click(function () {
- var pid = $(".pid").val();
- var id = $(".id").val();
- var name = $(".name").val();
- var tel = $(".tel").val();
- var sort = $(".sort").val();
- if (!name) {
- layer.confirm('请输入字典标志!', {
- btn: ['确定']
- });
- return;
- }
- $.post(huayi.config.callcenter_url + 'Department/AddDept', {
- id: id, pid: pid, name: name,"token": $.cookie("token")
- }, function (result) {
- result = $.parseJSON(result);
- if (result.state.toLowerCase() == "success") {
- layer.msg("操作成功");
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.bind()();
- }
- })
- });
- </script>
- </body>
- </html>
|