| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523 |
- <!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"/>
- </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 class="files-wrappper">
- <th class="Importent">附件:</th>
- <td colspan="5">
- <div class="fileBox"></div>
- <!--<span class="fjnr"></span>-->
- <input class="input" type="file" name="upFile" id="upFile" multiple="multiple"
- style="display: none" />
- <input class="input" type="button" value="上传" id="scwj" />
- <!--<input class="input" type="button" value="删除附件" id="scfj" style="display:none;" />-->
- <input type="hidden" id="file" />
- <span style="color: #ff0000; border: none">
- (文件格式为png,jpg,mp4,mp3,pdf,doc,docx,xls,xlsx)
- </span>
- </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 ($.fn.zTree.getZTreeObj("treeDemo").getCheckedNodes(true).length <= 0) {
- 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)
- }
- })
- setTimeout(function () {
- Detail()
- }, 1000)
- })
- function Detail() {
- if (wid) {
- // debugger
- $.ajax({
- type: "get",
- url: huayi.config.callcenter_url + 'Notice/GetNotice',
- dataType: 'json',
- async: false,
- data: {
- noticeid: wid,
- "token": $.cookie("token")
- },
- success: function (result) {
- debugger
- 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);
- var a = result.data.F_FilePath;
- $(a).each(function (i, n) {
- var strs =
- '<span class="files" fiel-num="' +
- n.F_FileId +
- '">' +
- n.F_FileName.substring(19) +
- '<i class="fa fa-remove del_file"></i></span>';
- $(strs)
- .appendTo($(".fileBox"))
- .find(".del_file")
- .click(function (event) {
- event.stopPropagation();
- $(this).parent().remove();
- file_num();
- });
- });
- file_num();
- }
- }
- })
- }
- }
- ////获取下拉框
- // $.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,
- file: $("#file").val(),
- 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);
- }
- $("#scwj").click(function () {
- $("#upFile").trigger("click");
- });
- $("#upFile").change(function () {
- upload();
- });
- //上传文件
- function upload() {
- var Files = document.getElementById("upFile").files;
- if (Files.length > 0) {
- var formData = new FormData();
- for (var i = 0; i < Files.length; i++) {
- formData.append("file" + i, Files[i]);
- }
- formData.append("token", $.cookie("token"));
- var typeName = Files[0].name.split(".")[1];
- if (
- typeName == "png" ||
- typeName == "jpg" ||
- typeName == "mp4" ||
- typeName == "mp3" ||
- typeName == "pdf" ||
- typeName == "doc" ||
- typeName == "docx" ||
- typeName == "xls" ||
- typeName == "xlsx"
- ) {
- $.ajax({
- url: huayi.config.callcenter_url +
- "/WorkOrder/UploadFile",
- type: "POST",
- data: formData,
- /**
- *必须false才会自动加上正确的Content-Type
- */
- contentType: false,
- /**
- * 必须false才会避开jQuery对 formdata 的默认处理
- * XMLHttpRequest会对 formdata 进行正确的处理
- */
- processData: false,
- success: function (result) {
- document.getElementById(
- "upFile"
- ).outerHTML = document.getElementById(
- "upFile"
- ).outerHTML;
- $("#upFile").change(function () {
- upload();
- });
- var r = $.parseJSON(result);
- if (r.state.toLowerCase() == "success") {
- $(".fjnr").text(r.data[0].F_FileName);
- var a = r.data;
- $(a).each(function (i, n) {
- var strs =
- '<span class="files" fiel-num="' +
- n.F_FileId +
- '">' +
- n.F_FileName.substring(19) +
- '<i class="fa fa-remove del_file"></i></span>';
- $(strs)
- .appendTo($(".fileBox"))
- .find(".del_file")
- .click(function (event) {
- event.stopPropagation();
- $(this).parent().remove();
- file_num();
- });
- });
- file_num();
- }
- },
- });
- } else {
- layer.msg("格式不正确");
- }
- } else {
- layer.confirm("请上传文件!", {
- btn: ["确定"],
- });
- }
- }
- //上传文件隐藏域值
- function file_num() {
- var str = "";
- var Str;
- $(".fileBox .files").each(function (j, m) {
- var aa = $(m).attr("fiel-num");
- console.log(aa);
- str += aa + ",";
- Str =
- str.substring(str.length - 1) == "," ?
- str.substring(0, str.length - 1) :
- str;
- });
- $("#file").val(Str);
- }
- </script>
- </body>
- </html>
|