| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <script src="../Script/Common/huayi.load.js"></script>
- <script src="../Script/Common/huayi.config.js"></script>
- <script src="../js/laydate/laydate.js"></script>
- <link rel="stylesheet" href="../css/init.css" />
- <link rel="stylesheet" href="../js/zTree/zTreeStyle.css" />
- <title>详情</title>
- <style>
- .BiaoTi {
- width: 100%;
- border-color: #ccc;
- border: 1px solid #ccc;
- }
- textarea {
- border-color: #ccc;
- border: 1px solid #ccc;
- height: 100px;
- }
- .xl {
- display: inline-block;
- background: url(../img/dropDown.png) no-repeat;
- height: 100%;
- background-position: center center;
- width: 20px;
- position: absolute;
- right: 0;
- top: 0px;
- /* background-color: #f7bc8b; */
- cursor: pointer;
- }
- ul.ztree {
- /*margin-top: 10px;*/
- width: 161px;
- /*overflow-y: scroll;
- overflow-x: auto;*/
- }
- #organizer {
- height: 25px;
- width: 170px;
- display: inline-block;
- position: relative;
- height: 135px;
- overflow: hidden;
- }
- #menuContent {
- background: #fff;
- position: absolute;
- width: 100%;
- border: 1px solid #ccc;
- right: 0;
- top: 0;
- z-index: 10;
- /*display: none;*/
- overflow-y: auto;
- height: 100%;
- }
- .ztree li span {
- line-height: 16px;
- margin-right: 2px;
- padding: 0;
- border: none;
- }
- .Common {
- overflow-y: initial
- }
- .time-box {
- position: relative;
- padding-left: 0;
- }
- i.tub {
- position: absolute;
- right: 26px;
- top: 8px;
- font-size: 18px;
- color: #00a0ca;
- }
- .common {
- width: 100%;
- background: #fff;
- text-align: center;
- padding: 10px 15px;
- height: auto;
- overflow-y: initial;
- }
- .common table {
- width: 100%;
- }
- .common table th {
- padding: 5px 8px 5px 0;
- text-align: right;
- width: 20%;
- }
- .common table td {
- padding: 6px 0 5px 10px;
- text-align: left;
- color: #717171;
- line-height: 200%;
- }
- .common table td textarea {
- width: 100%;
- vertical-align: middle;
- resize: none;
- outline: none;
- }
- </style>
- </head>
- <body>
- <div class="common">
- <table>
- <tr>
- <th>标题:</th>
- <td>
- <input class="BiaoTi" id="title" type="text" style="" />
- </td>
- </tr>
- <tr>
- <th>有效期:</th>
- <td>
- <div class="col-md-6 time-box">
- <i class="tub fa fa-calendar"></i>
- <input class="form-control" type="text" id="greetingTimes">
- </div>
- </td>
- </tr>
- <tr>
- <th>角色:</th>
- <td>
- <div class="inpBox" id="organizer">
- <!--<input id="citySel" class="inps" readonly />-->
- <input type="hidden" id="OPID" />
- <!--<i class="xl xl_one" id="xl_one"></i>-->
- <div id="menuContent" class="menuContent">
- <ul id="treeDemo" class="ztree"></ul>
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <th>内容:</th>
- <td colspan="2">
- <textarea data-adaptheight id="content" name="" rows="" cols=""></textarea>
- </td>
- </tr>
- </table>
- <div class="btn_box">
- <button class="btns">保存</button>
- </div>
- </div>
- <script src="../js/adjustHeight.js"></script>
- <!--<script src="../css/laydate/laydate.js"></script>-->
- <script src="../js/zTree/jquery.ztree.core.js"></script>
- <script src="../js/zTree/jquery.ztree.excheck.min.js"></script>
- <script src="../js/kindeditor/kindeditor-all-min.js"></script>
- <script src="../js/kindeditor/lang/zh-CN.js"></script>
- <script>
- laydate.render({
- elem: '#greetingTimes',
- range: '~',
- // type: 'datetime',
- //max : 31,
- min: 0,
- theme: '#00a1cb',
- });
- // $('.inps').focus(function() {
- // $('#menuContent').css('display', 'block')
- // })
- // $('#menuContent').mouseleave(function() {
- // $(this).css('display', 'none')
- // })
- var wid = helper.request.queryString("wid");
- $(document).ready(function () {
- //编辑器配置
- KindEditor.ready(function (K) {
- window.editor = K.create('#content', {
- //urlType: 'domain',
- imgMaxSize: 10 * 1024 * 1024,
- uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
- fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
- allowFileManager: true
- }); //添加弹出框编辑器
- });
- $(".btns").click(function () {
- if (!$("#title").val()) {
- layer.msg("输入标题");
- }
- else if (!$("#greetingTimes").val()) {
- layer.msg("输入选择日期");
- } else {
- var ztree = $.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true);
- console.log(ztree);
- var app = [];
- var app2 = [];
- var user;
- var role;
- if (ztree.length > 0) {
- var Id = [];
- $.each(ztree, function (i, n) {
- if (n.F_Pid == 0) {
- Id.push(n.F_Id);
- } else {
- app.push(n.F_Id);
- }
- app2 = Id;
- });
- user = app.join(',');
- role = app2.join(',')
- }
- Add(user, role)
- }
- })
- if (wid) {
- $.getJSON(huayi.config.callcenter_url + 'Notice/GetNotice', {
- noticeid: wid,
- "token": $.cookie("token")
- }, function (result) {
- if (result.state.toLowerCase() == "success") {
- $("#title").val(result.data.F_Title);
- //$("#content").val(result.data.F_Content);
- $('#greetingTimes').val(result.data.F_StartDate + ' ~ ' + result.data.F_EndDate);
- $('#role').val(result.data.F_RoleId);
- $("#zx").val(result.data.F_UserId);
- editor.html(result.data.F_Content);
- }
- });
- }
- })
- ////获取下拉框
- // $.getJSON(huayi.config.callcenter_url + "Notice/GetRoleList", {
- // "token": $.cookie("token")
- // }, function(result) {
- // if(result.state.toLowerCase() == "success") {
- // goodslist = result.data;
- // bindseat($("#role"));
- // }
- // });
- function Add(user, role) {
- $.post(huayi.config.callcenter_url + "Notice/EditNotice", {
- title: $("#title").val(),
- //content: $("#content").val(),
- content: encodeURIComponent(editor.html()),
- stime: $('#greetingTimes').val() && $('#greetingTimes').val().split('~')[0],//开始时间
- etime: $('#greetingTimes').val() && $('#greetingTimes').val().split('~')[1],//结束时间
- nid: wid,
- userid: user,
- roleid: role,
- token: $.cookie("token")
- }, function (result) {
- result = JSON.parse(result);
- if (result.state.toLowerCase() == "success") {
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- parent.initTable();
- parent.layer.msg("修改成功");
- }
- })
- }
- var saveArr = []
- tree(saveArr);
- $("#xl_one").click(function () {
- $(this).parent().find(".menuContent").toggle();
- });
- $("#xl_ones").click(function () {
- $(this).parent().find(".menuContent").toggle();
- });
- //树形结构 所有角色
- function tree(saveArr) {
- $.get(huayi.config.callcenter_url + 'Notice/GetRoleUsersList', {
- "token": $.cookie("token"),
- noticeid: wid,
- }, function (result) {
- result = $.parseJSON(result);
- $(result.data).each(function (i, n) {
- if (n.F_ischeck == 1) {
- n.checked = "true";
- }
- })
- $.fn.zTree.init($("#treeDemo"), setting, result.data);
- });
- }
- var setting = {
- check: {
- enable: true,
- // chkboxType: {"Y":"", "N":""},
- },
- data: {
- key: {
- name: "F_Name"
- },
- simpleData: {
- enable: true,
- idKey: "F_Id",
- pIdKey: "F_Pid",
- rootPId: 0
- }
- },
- callback: {
- onCheck: zTreeOnClick
- }
- };
- function zTreeOnClick(event, treeId, treeNode) {
- var name = treeNode.name;
- // var c="";
- // for(var i=0;i<nodes.length;i++){
- // if(nodes[i].isParent!=true){
- // c+=nodes[i].id+",";
- // console.log(c);
- // }
- // }
- };
- function zTreeOnClick(e, treeId, treeNode) {
- var zTree = $.fn.zTree.getZTreeObj("treeDemo"),
- nodes = zTree.getCheckedNodes(true);
- console.log(treeNode)
- var v = "",
- opid = '';
- for (var i = 0, l = nodes.length; i < l; i++) {
- v += nodes[i].F_Name + ",";
- console.log(v);
- opid += nodes[i].F_DeptId + ","
- }
- if (v.length > 0) v = v.substring(0, v.length - 1);
- var cityObj = $("#citySel");
- cityObj.val(v);
- $("#citySel").val(v);
- console.log(opid);
- if (opid.length > 0) opid = opid.substring(0, opid.length - 1);
- $('#OPID').attr("value", opid);
- $('#OPIDs').attr("value", opid);
- }
- </script>
- </body>
- </html>
|