| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321 |
- <!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: #00a1cb;
- 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;
- }
- .select {
- width: 190px;
- background-color: #FFF;
- background-image: none;
- border: 1px solid #ccc;
- border-radius: 1px;
- color: inherit;
- padding: 6px 12px;
- }
- </style>
- </head>
- <body class="gray-bg">
- <div style="padding: 10px;">
- <div style="padding: 10px;" class="clearFix">
- <div>
- <span>【单位信息】</span>
- <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>
- <tr>
- <th>单位电话:</th>
- <td>
- <input type="text" class="tel" />
- </td>
- </tr>
- <tr>
- <!-- <th>关键字:</th>
- <td>
- <select id="keyid" name="" class="select"></select>
- </td> -->
- </tr>
- <tr>
- <th>单位类型:</th>
- <td style="line-height: 0.5;">
- <label class="radio-inline">
- <input type="radio" name="isdept" value="0" />
- 分类
- </label>
- <label class="radio-inline">
- <input type="radio" name="isdept" value="1" />
- 二级单位
- </label>
- <label class="radio-inline">
- <input type="radio" name="isdept" value="2" />
- 三级单位
- </label>
- </td>
- </tr>
- <tr>
- <th>承办单位:</th>
- <td style="line-height: 0.5;">
- <label class="radio-inline">
- <input type="radio" name="isdealdept" value="1" checked="checked" />
- 是
- </label>
- <label class="radio-inline">
- <input type="radio" name="isdealdept" value="0" />
- 否
- </label>
- </td>
- </tr>
- <tr>
- <th>排列序号:</th>
- <td>
- <input type="text" class="sort" />
- </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");
- var iscbdw = "";
- var roleCode = $.cookie("code");
- $(document).ready(function () {
- if (roleCode === "WLDW") {
- iscbdw = 2;
- } else {
- iscbdw = "";
- }
- bind();
- ZT($("#keyid"));
- $(".pname").click(function () {
- if ($(".seldept").is(":hidden")) {
- $(".seldept").show();
- } else {
- $(".seldept").hide();
- }
- })
- $(".seldept").mouseleave(function () {
- $(".seldept").hide();
- })
- if (id) {
- $.getJSON(huayi.config.callcenter_url + 'Department/GetDept', {
- 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_DeptId);
- $(".name").val(content.F_DeptName);
- $(".tel").val(content.F_DeptPhone);
- $(".sort").val(content.F_Sort);
- $('#keyid').val(content.F_Valueid)
- $("input[name='isdept'][value='" + content.F_IsDept + "']").prop("checked",
- true);
- $("input[name='isdealdept'][value='" + content.F_IsDealDept + "']").prop(
- "checked", true);
- }
- })
- }
- });
- function getpname(strpid) {
- $.getJSON(huayi.config.callcenter_url + 'Department/GetDept', {
- id: strpid,
- "token": $.cookie("token")
- }, function (result) {
- if (result.state.toLowerCase() == "success") {
- var content = result.data;
- $(".pid").val(content.F_DeptId);
- $(".pname").val(content.F_DeptName);
- }
- })
- }
- var setting = {
- data: {
- key: {
- name: "F_DeptName"
- },
- simpleData: {
- enable: true,
- idKey: "F_DeptId",
- pIdKey: "F_PartentId",
- rootPId: -1
- }
- },
- callback: {
- onClick: zTreeOnClick
- }
- };
- function zTreeOnClick(event, treeId, treeNode) {
- $(".pid").val(treeNode.F_DeptId);
- $(".pname").val(treeNode.F_DeptName);
- $(".seldept").hide();
- };
- function bind() {
- $.getJSON(huayi.config.callcenter_url + "Department/GetDeptList", {
- "token": $.cookie("token"),
- iscbdw: iscbdw,
- }, function (result) {
- if (result.state.toLowerCase() == "success") {
- tree = $.fn.zTree.init($("#treeDemo"), setting, result.data);
- } // tree.addNodes(null, 0, {
- // "F_DeptId": 0,
- // "F_DeptName": "无父级单位"
- // });
- })
- }
- //关键字
- function ZT(obj) {
- obj.empty();
- obj.append('<option selected="selected" value="">请选择</option>');
- $.getJSON(huayi.config.callcenter_url + "Dictionary/GetDicValueListById", {
- "token": $.cookie("token"),
- id: 3
- }, function (data) {
- if (data.state.toLowerCase() == "success") {
- var content = data.data;
- $(content).each(function (i, n) {
- $("<option value='" + n.F_ValueId + "'>" + n.F_Value + "</option>").appendTo(
- obj);
- })
- }
- })
- }
- //修改工单
- $(".addts").click(function () {
- var pid = $(".pid").val();
- var id = $(".id").val();
- var name = $(".name").val();
- var tel = $(".tel").val();
- var sort = $(".sort").val();
- var isdept = $('input[name="isdept"]:checked ').val();
- var isdealdept = $('input[name="isdealdept"]:checked ').val();
- console.log($('#keyid').val())
- if (!name) {
- layer.confirm('请输入单位名称!', {
- btn: ['确定']
- });
- return;
- }
- if (!isdept) {
- layer.confirm('请选择单位类型!', {
- btn: ['确定']
- });
- return;
- }
- // if (!pid) {
- // layer.confirm('请选择父级单位!', {
- // btn: ['确定']
- // });
- // return;
- // }
- $.post(huayi.config.callcenter_url + 'Department/AddDept', {
- id: id,
- did: pid,
- name: name,
- phone: tel,
- sort: sort,
- isdept: isdept,
- isdealdept: isdealdept,
- valueid: $('#keyid').val(),
- "token": $.cookie("token")
- }, function (result) {
- result = $.parseJSON(result);
- if (result.state.toLowerCase() == "success") {
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.layer.msg("操作成功");
- parent.bind();
- }
- })
- });
- </script>
- </body>
- </html>
|