cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<title>知识编辑</title>
[#include "/business/pages/include/static.html" /]
</head>
 
<body class="fullscreen">
 
[#include "/business/pages/include/header.html" /]
[#include "/component/webupload.html" /]
[#include "/component/HtmlEditor.html" /]
<!--
<nav class="fs_nav">
    <div class="fsnav_con">
        <h3>我的知识</h3>
        <a href="${base}/business/pages/knowledge/myknowledge/myDshKnowList.html"><span>待审核的知识</span></a>
        <a href="${base}/business/pages/knowledge/myknowledge/myCreateKnowList.html"><span>已审核的知识</span></a>
        <a href="${base}/business/pages/knowledge/myknowledge/myEditKnowList.html"><span>我编辑的知识</span></a>
        <a href="${base}/business/pages/knowledge/myknowledge/myFavKnowList.html"><span>我收藏的知识</span></a>
        <a class="focus" href="${base}/business/pages/knowledge/myknowledge/myKnowList.html"><span>知识管理</span></a>
        <a href="${base}/business/pages/knowledge/knowledgeDeal/addKnowledge.html"><span>创建知识</span></a>
    </div>
</nav> -->
<script src="${common_static}/static/ui/js/jquery.sl.js"></script>
<script type="text/javascript">
$(document).ready(function() {
        $.formValidator.initConfig({formID:"myform",onError:function(msg){popupTips(msg)},onSuccess:function(){
            
                document.getElementById("myform").target = window.top.openDialog("0","操作",
                             {},
                             {"width":40,"height":40,"noclose":true},
                             [{btnId:"tipBtnSure", btnName:"确定", btnStyle:"bluebtn"}]);
                             return true;
            
        }});
        
        $("#title").formValidator({empty: false, onShow:"请输入知识标题!",onFocus: "请输入知识标题"}).inputValidator({min: 1,max:36, onError: "知识标题为1到18个汉字"});
        $("#tag").formValidator({empty: false, onShow:"请输入知识标签,用空格分隔多个标签!",onFocus: "请输入知识标签"}).inputValidator({min: 1,onError: "知识标签不能为空"});
        $("#summary").formValidator({empty: false, onShow:"请输入摘要!",onFocus: "请输入摘要"}).inputValidator({min: 1,onError: "摘要不能为空"});
        $("#content").formValidator({onshow:"",onFocus:"知识内容不能为空"}).functionValidator({
                fun:function(val,elem){
                    var text = content.isEmpty();
                    if(text) {
                        return "请输入知识内容";
                    } 
                    return true;
                }
            });
        //${Constants.CUSTOMER_CONSTANTS}是否可见(下拉框显示隐藏)
        $("input[name='isKj']").click(function(){
            if($(this).val() == 1){
                $("#cusList").formValidator({empty:false,onShow:"请选择${Constants.CUSTOMER_CONSTANTS}",onFocus:"${Constants.CUSTOMER_CONSTANTS}不能为空!"}).inputValidator({min: 1, onError: "${Constants.CUSTOMER_CONSTANTS}不能为空!"});
                $(".ss").show();
                $(".xx").hide();
            }else{
                $("#cusList").formValidator({empty:true,onShow:"",onFocus:""});
                $(".ss").hide();
                $(".xx").show();
            }
        });
        $("input[name='isKj']:checked").trigger("click");
    });
</script>
<!--  
<div class="fs_navpath">
    <h3>当前位置</h3>
    <span></span>
    <a>我的知识 </a>
    <span></span>
    <em>知识编辑</em>
</div>-->
<div class="fs_navtitle" id="fsNavtitle">
    <div class="fs_navtitle_con">
        <h2>知识编辑</h2>
        <div class="fsnt_btn">
            <a class="fb_submit" href="javascript:doSubmit();"><span>提交</span></a>
        </div>
    </div>
</div>
<form id="myform" action="${base}/business/pages/knowledge/myknowledge/saveAgainUpdateNew.html" method="post">
<input type="hidden" id="id" name="id" value="${knowledge.ID}"/>
<input type="hidden" id="flow_id" name="flow_id" value="${knowledge.FLOW_ID}"/>
<input type="hidden" id="ismy" name="ismy" value="${RequestParameters.ismy}"/>
<input type="hidden" id="version" name="version" value="${knowledge.VERSION}"/>
<div class="fs_main fs_edit">
    <div class="edit_title"><h3>基本信息</h3></div>
    <table class="edit_layout">
            <tr>
                <th><label class="required">标题:</label></th>
                <td colspan="3">
                <input class="general maintitle" type="text" id="title" name="title" value="${knowledge.TITLE}"/>
                <div id="titleTip" style="display:inline-block;"></div>
                </td>
            </tr>
           
            <tr>
                <th><label class="required">标签:</label></th>
                <td colspan="3">
                    <input class="general" type="text" name="tag" id="tag" style="width:40%;" value="${knowledge.TAG}" />
                    <div id="tagTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr>
                <th class="postop"><label class="required">摘要:</label></th>
                <td colspan="3"><textarea class="general maintitle" id="summary" name="summary">${knowledge.SUMMARY}</textarea>
                 <div id="summaryTip" style="display:inline-block;"></div>
                </td>
            </tr>
             <tr>
                <th class="postop"><label class="required">内容:</label></th>
                <td colspan="3">
                [@htmleditor simple="true" id="content"  width="625px" value=knowledge.CONTENT /]
                 <div id="contentTip" style="display:inline-block;"></div>
                </td>
            </tr>
            <tr>
                <th width="150px;"><label class="required">是否业务联系人可见:</label></th>
                <td>
                    <input  type="radio" id="isKjDef" name="isKj" value="1" [#if knowledge.ACCESS_TYPE == 1 ] checked [/#if] />是
                    <input  type="radio" name="isKj" value="2" [#if knowledge.ACCESS_TYPE == 2 ] checked [/#if]/>否
                </td>
                <th class="ss" style="display:none;">选择业务联系人:</th>
                <td class="ss" style="display:none;">
                    <span id="showCusNameSpan" style="width:400px;">${knowledge.cusListStr}</span>
                       <a href="javascript:showCus();" id="selector" class="retrievebtn focus" style="margin-left:5px;">选择业务联系人</a>
                       <input type="hidden" id="cusList" name="cusList" value="${knowledge.cusListStr}" >
                       <input type="hidden" id="cusId" name="cusId" value="${knowledge.cusIdStr}">
                    <div id="cusIdTip" style="display:inline-block;"></div>
                </td>
                <th class="xx"></th><td class="xx"></td>
            </tr>
            <tr>
                <th width="100px;"><label class="required">是否允许编辑:</label></th>
                <td>
                    <input  type="radio" name="is_editor" value="1" [#if knowledge.IS_EDITOR == 1 ] checked [/#if] />是
                    <input  type="radio" name="is_editor" value="2" [#if knowledge.IS_EDITOR == 2 ] checked [/#if]/>否
                </td>
                <th><label >服务目录:</label></th>
                <td>
                    <div class="icon_search">
                        <input type="text" id="serivceList" readonly name="serivceList" onclick="showSl();" [#if knowledge.THIRD_CATEGORY_NAME == ""] [#else]value="${knowledge.FIRST_CATEGORY_NAME}-${knowledge.SECOND_CATEGORY_NAME}-${knowledge.THIRD_CATEGORY_NAME}"[/#if] />
                        <input type="hidden" id="serivceListId" name="serivceListId" value="${knowledge.FIRST_CATEGORY_ID}-${knowledge.SECOND_CATEGORY_ID}-${knowledge.THIRD_CATEGORY_ID}">
                        <a></a>
                    </div>
                        <div id="serivceListIdTip" style="display:inline-block;"></div>
                </td>
            </tr>
             <tr>
                
                <th><label class="required">知识分类:</label></th>
                <td>
                    <div class="icon_search">
                        <input type="text" id="categoryList" readonly name="categoryList" onclick="showCl();" value="${knowledge.FIRST_KNOWCATEGORY_NAME}-${knowledge.SECOND_KNOWCATEGORY_NAME}-${knowledge.CATEGORY_NAME}"/>
                        <input type="hidden" id="category_id" name="category_id" value="${knowledge.FIRST_KNOWCATEGORY_ID}-${knowledge.SECOND_KNOWCATEGORY_ID}-${knowledge.CATEGORY_ID}">
                        <a></a>
                    </div>
                        <div id="category_idTip" style="display:inline-block;"></div>
                </td>
                <th width="100px;"><label>配置分类:</label></th>
                <td>
                    <div class="icon_search">
                        <input type="text" id="thirdlevelList" readonly name="thirdlevelList" onclick="showTl();" [#if knowledge.THIRDLEVEL_NAME == ""][#else]value="${knowledge.FIRSTLEVEL_NAME}-${knowledge.SECONDLEVEL_NAME}-${knowledge.THIRDLEVEL_NAME}"[/#if] />
                        <input type="hidden" id="thirdlevel_id" name="thirdlevel_id" value="${knowledge.FIRSTLEVEL_ID}-${knowledge.SECONDLEVEL_ID}-${knowledge.THIRDLEVEL_ID}">
                        <a></a>
                    </div>
                        <div id="thirdlevel_idTip" style="display:inline-block;"></div>
                </td>
            </tr>
            
            <tr>
                <th class="postop"><label>附件:</label></th>
                <td>
                    <div class="upload_file">
                        [@webupload id="files" multiple="true" fileList=knowledge.fileList extensions="*"/]
                    </div>
                </td>
                
            </tr>
        </table>
        <div class="edit_title"><h3>关联知识信息</h3><a class="add_associated" href="javascript:linkKnow('${knowledge.ID}');">添加关联知识</a></div>
        <table class="display_form" id="linkKnowTable" >
            <tr class="title">
                <td>标题</td>
                <td>所属分类</td>
                <td>创建人</td>
                <td>操作</td>
            </tr>
            [#if knowledge.knowList?? && knowledge.knowList?size > 0]
            [#list knowledge.knowList as know]
             <tr>
                 <td><input type='hidden' name='knowId' value="${know.ID}" />${know.TITLE}</td>
                 <td>${know.CATEGORY_NAME}</td>
                 <td>${know.CREATE_USER_NAME}</td>
                 <td><a class='delete'>删除</a></td>
              </tr>
              [/#list]
            [#else]
            <tr>
                <td colspan="4" align="center">暂无关联信息</td>
            </tr>
            [/#if]
        </table>
    </div>
</form>
[#include "/business/pages/include/footer.html" /]
<script type="text/javascript">
var base = '${base}';
var access_type = '${knowledge.ACCESS_TYPE}';
 
 
 
 
function showSl() {
        
        var serivceList = $("#serivceList").val();
        var serivceListId = $("#serivceListId").val();
        var url = "${base}/business/pages/knowledge/knowledgeDeal/serviceListTreeadd.html?type=2&projectId=company";
        if(!$.util.isEmpty(serivceList)&&!$.util.isEmpty(serivceListId)) {
            var names = serivceList.split("-");
            var ids = serivceListId.split("-");
            if(ids.length==3) {
                url += "&sl="+ids[2];
            }
        }
        
        window.top.openDialog("selectSl","操作",
                             {},
                             {"width":80,"height":80},
                             [{btnId:"btnSure", btnName:"确定", btnStyle:"bluebtn"}],url);
    }
    
    function showName(labelId,labelName) {
    $("#serivceList").val(labelName);
    $("#serivceListId").val(labelId);
    
    }
    
    function showCl() {
        var categoryList = $("#categoryList").val();
        var category_id = $("#category_id").val();
        
        var url = "${base}/business/pages/knowledge/knowledgeDeal/categoryListTree.html?type=2";
           url +=  "&company=1";
        if(!$.util.isEmpty(categoryList)&&!$.util.isEmpty(category_id)) {
            var names = categoryList.split("-");
            var ids = category_id.split("-");
            if(ids.length==3) {
                url += "&sl="+ids[2];
            }
        }
        
        window.top.openDialog("selectSl","操作",
                             {},
                             {"width":80,"height":80},
                             [{btnId:"btnSure", btnName:"确定", btnStyle:"bluebtn"}],url);
    }
    
    function showTl() {
        var thirdlevelList = $("#thirdlevelList").val();
        var thirdlevel_id = $("#thirdlevel_id").val();
        var url = "${base}/business/pages/knowledge/knowledgeDeal/thirdlevelListTree.html?type=2";
        if(!$.util.isEmpty(thirdlevelList)&&!$.util.isEmpty(thirdlevel_id)) {
            var names = thirdlevelList.split("-");
            var ids = thirdlevel_id.split("-");
            if(ids.length==3) {
                url += "&sl="+ids[2];
            }
        }
        
        window.top.openDialog("selectSl","操作",
                             {},
                             {"width":80,"height":80},
                             [{btnId:"btnSure", btnName:"确定", btnStyle:"bluebtn"}],url);
    }
    
    
    
    function showCaName(labelId,labelName) {
    $("#categoryList").val(labelName);
    $("#category_id").val(labelId);
    
    }
 
    function showThName(labelId,labelName) {
    $("#thirdlevelList").val(labelName);
    $("#thirdlevel_id").val(labelId);
    
    }
    
//选择用户的弹出界面
function showCus(){
    //得到当前已经选择的用户id
    var ids = $("#cusId").val();
    var url = "${base}/business/pages/knowledge/knowledgeDeal/choosePersonList.html?ids="+ids;
    window.top.openDialog("add","操作",
                         {},
                         {"width":80,"height":80},
                         [{btnId:"btnSure", btnName:"确定", btnStyle:"bluebtn"}],url);
}
 
function showCusName(labelId,labelName) {
    var arrayLength = labelName.split(",").length;
    
    $("#cusList").val(labelName);
    $("#cusId").val(labelId);
    var result = changeParam(labelName);
    $("#showCusNameSpan").html(result);
}
 
//判断参数的${Constants.CUSTOMER_CONSTANTS}数量是否大于3,如果大于3,返回处理字符串,否则返回本身
function changeParam(param){
    var paramArray = param.split(",");
    if(paramArray.length > 3){
        return paramArray[0]+","+paramArray[1]+","+paramArray[2]+"...";
    }else{
        return param;
    }
}
//刷新页面的时候让选中的用户展示
$(function(){
    showCusName('','');
});
    
 
function linkKnow(id) {
    var  project_id = "company";
    var knowIds = new Array();
    var $knowId = $(":hidden[name='knowId']");
    if($knowId.length>0) {
        $knowId.each(function() {
            knowIds.push($(this).val());
        })
    }
    knowIds.push(id);
    var knowId = knowIds.join("-");
    window.top.openDialog("0","添加关联知识",
                         {},
                         {"width":80,"height":80},
                         [{btnId:"btnSure", btnName:"选择", btnStyle:"bluebtn"}],
                         "${base}/business/pages/knowledge/knowledgeDeal/linkKnow.html?knowIds="+knowId+"&projectId="+project_id+"&id="+id);
}
 
function showLinkKnow(knows) {
    var strHtml = "";
    $.each(knows,function(i,item) {
        var knowId = item.get("knowId");
        var title = item.get("title");
        var create_user_name = item.get("create_user_name");
        var category_name = item.get("category_name");
        strHtml += "<tr><td><input type='hidden' name='knowId' value='"+knowId+"'>"+title+"</td><td>"+category_name+"</td><td>"+create_user_name+"</td><td><a class='delete'>删除</a></td></tr>";
    })
    
    
    var firstTd = $("#linkKnowTable tr:eq(1)");
    if(!$.util.isEmpty(firstTd.find("td:eq(0)").attr("colspan"))){
       if(firstTd.find("td:eq(0)").attr("colspan")!=1) {
            firstTd.remove();
       }
    }
    $("#linkKnowTable").append(strHtml).show();
}
 
 
 
function changeMsg() {
    $("#serivceListId,#serivceList").val("");
}
 
$(function() {
    $("a.delete").live("click",function() {
        var $table = $(this).parents("table");
        if($table.find("tr").length==2) {
            var $str = $(this).parents("tr");
            var length = $str.find("td").length;
            $str.find("td:gt(0)").remove();
            $str.find("td:first").attr({"colspan":length,"align":"center"}).html("暂无关联信息");
        } else {
            $(this).parents("tr").remove();
        }
    })
    
    $(".rmsl").live("click",function() {
            $(this).parent().remove();
        });
    
    
})
 
function doSubmit() {
      window.top.confirmInfo('提示', '确定要提交吗?', function(){
        $("#myform").submit();
        });
}
 
 
</script>
</body>
</html>