| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <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" />
- <title>知识条目添加</title>
- <style>
- .m-kuang {
- width: 50%;
- background-color: #FFF;
- background-image: none;
- border: 1px solid #ccc;
- border-radius: 1px;
- color: inherit;
- padding: 6px 12px;
- outline: none;
- vertical-align: middle;
- }
-
- table th {
- width: 20%;
- text-align: right;
- border-top: 0!important;
- }
-
- table td {
- border-top: 0!important;
- }
-
- .daoHang {
- border-bottom: 1px solid #ccc;
- }
-
- .content {
- margin-top: 15px;
- }
- .inps{
- width: 95%;
- height: 30px;
- outline: none;
- border: 0;
- border-image-width: 0;
- padding: 0;
- padding-left: 3px;
- }
- .inpBox{
- border: 1px solid #ccc;
- height: 32px;
- width: 50%;
- display: inline-block;
- position: relative;
- vertical-align: middle;
- }
- .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;
- }
- .addTree {
- background: #fff;
- position: absolute;
- width: 100%;
- border: 1px solid darkgrey;
- right: 0;
- top: 32px;
- display: none;
- z-index: 9999;
- }
-
- </style>
- </head>
- <body class="gray-bg">
- <div class="container-fluid wrapper-content animated fadeInRight">
- <div class="content">
- <table class="table">
- <tr>
- <th>
- <b>标题:</b>
- </th>
- <td>
- <input type="text " class="m-kuang zs_t" />
- </td>
- </tr>
- <tr>
- <th>
- <b>所属分类:</b>
- </th>
- <td>
- <div class="inpBox">
- <input type="text" class="inps" />
- <i class="xl xl_one"></i>
- <div class="addTree xlAdd">
- <ul id="addTreeDemo" class="ztree">
- </ul>
- </div>
- </div>
- </td>
- </tr>
- <tr>
- <th>
- <b>内容:</b>
- </th>
- <td>
- <textarea data-adaptheight id="addEditor" name="content" style="width: 80%;height: 200px;"></textarea>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="text-center">
- <div class="checkbox">
- <label>
- <input type="checkbox" style="margin-top: 2px;" class="isCheck"> 是否提交审核
- </label>
- </div>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="text-center">
- <!--<button class="btns">添加</button>-->
- <button class="btns tiJiao">提交</button>
- </td>
- </tr>
- </table>
- </div>
- </div>
- <script src="../css/layer/layer.js"></script>
- <script src="../js/zTree/jquery.ztree.core.js"></script>
- <script src="../js/kindeditor/kindeditor-all-min.js"></script>
- <script src="../js/kindeditor/lang/zh-CN.js"></script>
- <script src="../js/adjustHeight.js"></script>
- <script>
- var id = ''; //当前节点id
- var cname; //当前节点name
- var pid; //当前节点父ID
- var pidName; //当前节点父name
- var xlName; //添加弹出框内下拉框内节点name
- var token = $.cookie("token");
- //编辑器配置
- KindEditor.ready(function(K) {
- window.editor = K.create('#addEditor', {
- uploadJson: '../../js/kindeditor/asp.net/upload_json.ashx',
- fileManagerJson: '../../js/kindeditor/asp.net/file_manager_json.ashx',
- allowFileManager: true
- }); //添加弹出框编辑器
- });
- tree();
- function tree() {
- $.get(huayi.config.callcenter_url + 'KnowledgeClass/GetList', {
- "token": $.cookie("token"),
- // "pid": pid
- }, function(result) {
- result = $.parseJSON(result);
- var zTreeObj=$.fn.zTree.init($("#addTreeDemo"), setting1, result.data); //实例化树形图
- var nodes = zTreeObj.getNodes();
- for (var i = 0; i < nodes.length; i++) { //设置节点展开
- zTreeObj.expandNode(nodes[i], true, false, true);
- }
- });
- }
- var setting1 = {
- data: {
- key: {
- name: "text"
- },
- simpleData: {
- enable: true,
- idKey: "id",
- rootPId: 0
- }
- },
- callback: {
- onClick: zTreeOnClick
- }
- };
- function zTreeOnClick(event, treeId, treeNode) {
- // pid = treeNode.pId;
- id = treeNode.id;
- cname = treeNode.text;
- $('.inps').val(cname);
- };
- //所属分类下拉
- $('.inps').focus(function() {
- $('.xlAdd').css('display', 'block')
- })
- $('.xl').click(function() {
- if($('.xlAdd').css('display') == 'block') {
- $('.xlAdd').css('display', 'none')
- } else {
- $('.xlAdd').css('display', 'block')
- }
- })
- $('.addTree').mouseleave(function() {
- $(this).css('display', 'none')
- })
- var title;//知识库标题
- var con;//知识库内容
- var issub;//是否提交审核
- $('.tiJiao').click(function(){
-
- if($('.isCheck').is(':checked')==true){
- issub=1;
- }else{
- issub=0;
- }
- title=$('.zs_t').val();
- con=encodeURIComponent(editor.html());
- //console.log(issub)
- add(title,con,id, issub)
- });
-
- function add(title,con,id, issub){
- $.ajax({
- type:"post",
- url:huayi.config.callcenter_url+"Knowledge/AddInfo",
- async:true,
- dataType:'json',
- data:{
- token:$.cookie("token"),
- title:title,//知识库标题
- con:con,//知识库内容
- pid:id,//分类ID
- issub:issub//是否提交审核
- },
- success:function(data){
- if(data.state.toLowerCase()=="success"){
- var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
- parent.layer.close(index); //再执行关闭
- //debugger;
- parent.initTable(id);
- parent.layer.msg("添加成功");
- }
- }
- });
- }
-
-
-
- </script>
- </body>
- </html>
|