<!doctype html>
|
<html class="no-js">
|
<head>
|
<meta charset="utf-8">
|
<title>创建知识</title>
|
[#include "/business/pages/include/static.html" /]
|
</head>
|
[#include "/component/webupload.html" /]
|
[#include "/component/HtmlEditor.html" /]
|
[#include "/component/userSelector.html" /]
|
<body class="fullscreen">
|
[#include "/business/pages/include/header.html" /]
|
<script type="text/javascript">
|
$(document).ready(function() {
|
$.formValidator.initConfig({formID:"myform",onError:function(msg){popupTips(msg)},onSuccess:function(){
|
if($.util.isEmpty($("#shName").val())) {
|
defaultSp();
|
return false;
|
} else {
|
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;
|
}
|
});
|
$("#category_id").formValidator({empty: false, onShow:"请选择知识分类!",onFocus: "知识分类不能为空"}).inputValidator({min: 1,onError: "知识分类不能为空"});
|
//${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();
|
}
|
});
|
|
});
|
$(function(){
|
$("#isKjDef").trigger("click");
|
});
|
</script>
|
<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/knowledgeDeal/addKnowledge.html" method="post">
|
<!-- 转知识信息 -->
|
<input type="hidden" id="changeId" name="changeId" value="${RequestParameters.changeId}"/>
|
<input type="hidden" id="bustype" name="bustype" value="${RequestParameters.bustype}"/>
|
<!-- 审核人信息 -->
|
<input type="hidden" id="shId" name="shId" value=""/>
|
<input type="hidden" id="shName" name="shName" value=""/>
|
<input type="hidden" id="applyNote" name="applyNote" value=""/>
|
<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" type="text" id="title" name="title" value="${knowMsg.NAME}" style="width:50%;" />
|
<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:30%;"/>
|
<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" id="summary" name="summary" style="width:615px;"></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="80%" value="${knowMsg.CONTENT}" /]
|
<div id="contentTip" style="display:inline-block;"></div>
|
</td>
|
</tr>
|
<tr>
|
<th width="100px;"><label class="required">是否${Constants.CUSTOMER_CONSTANTS}可见:</label></th>
|
<td>
|
<input type="radio" id="isKjDef" name="isKj" value="1" checked="checked" />是
|
<input type="radio" name="isKj" value="2"/>否
|
</td>
|
<th class="ss" style="display:none;">选择${Constants.CUSTOMER_CONSTANTS}:</th>
|
<td class="ss" style="display:none;">
|
<span id="showCusNameSpan" style="width:400px;"></span>
|
<a href="javascript:showCus();" id="selector" class="retrievebtn focus" style="margin-left:5px;">选择${Constants.CUSTOMER_CONSTANTS}</a>
|
<input type="hidden" id="cusList" name="cusList" >
|
<input type="hidden" id="cusId" name="cusId" >
|
<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" checked="checked" />是
|
<input type="radio" name="is_editor" value="2"/>否
|
</td>
|
<th><label >服务目录:</label></th>
|
<td>
|
${knowMsg.FIRST_CATEGORY_NAME}-${knowMsg.SECOND_CATEGORY_NAME}-${knowMsg.THIRD_CATEGORY_NAME}
|
<input type="hidden" id="serivceList" name="serivceList" value="${knowMsg.FIRST_CATEGORY_NAME}-${knowMsg.SECOND_CATEGORY_NAME}-${knowMsg.THIRD_CATEGORY_NAME}"/>
|
<input type="hidden" id="serivceListId" name="serivceListId" value="${knowMsg.FIRST_CATEGORY_ID}-${knowMsg.SECOND_CATEGORY_ID}-${knowMsg.THIRD_CATEGORY_ID}"/>
|
</td>
|
</tr>
|
<tr>
|
<th><label class="required">知识分类:</label></th>
|
<td>
|
<div class="icon_search">
|
<input type="text" id="categoryList" readonly name="categoryList" onclick="showCl();"/>
|
<input type="hidden" id="category_id" name="category_id">
|
<a></a>
|
</div>
|
<div id="category_idTip" style="display:inline-block;"></div>
|
</td>
|
<th width="100px;">配置分类:</th>
|
<td>
|
<div class="icon_search">
|
<input type="text" id="thirdlevelList" readonly name="thirdlevelList" onclick="showTl();"/>
|
<input type="hidden" id="thirdlevel_id" name="thirdlevel_id">
|
<a></a>
|
</div>
|
<div id="thirdlevel_idTip" style="display:inline-block;"></div>
|
</td>
|
</tr>
|
<tr>
|
<th class="postop"><label>附件:</label></th>
|
<td colspan="3">
|
<div class="upload_file">
|
[@webupload id="files" multiple="true" fileList=customerFiles extensions="*" fileList=knowMsg.fileList /]
|
<a class="file_uploader">附件上传</a>
|
</div>
|
</td>
|
|
</tr>
|
</table>
|
|
<div class="edit_title"><h3>关联知识信息</h3><a class="add_associated" href="javascript:linkKnow();">添加关联知识</a></div>
|
<table class="display_form" id="linkKnowTable" >
|
<tr class="title">
|
<td>标题</td>
|
<td>所属分类</td>
|
<td>创建人</td>
|
<td>操作</td>
|
</tr>
|
<tr>
|
<td colspan="4" align="center">暂无关联信息</td>
|
</tr>
|
</table>
|
</div>
|
</form>
|
[#include "/business/pages/include/footer.html" /]
|
<script type="text/javascript">
|
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/chooseCusList.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() {
|
var project_id = "company";
|
var knowIds = new Array();
|
var $knowId = $(":hidden[name='knowId']");
|
if($knowId.length>0) {
|
$knowId.each(function() {
|
knowIds.push($(this).val());
|
})
|
}
|
|
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);
|
}
|
|
|
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(firstTd.find("td:eq(0)").attr("colspan")!=1) {
|
firstTd.remove();
|
}
|
$("#linkKnowTable").append(strHtml).show();
|
}
|
|
|
$(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() {
|
$("#myform").submit();
|
}
|
|
function defaultSp(){
|
var url = "${base}/business/pages/knowledge/knowledgeDeal/chooseShrCurrencyTwo.html?type=3";
|
window.top.openDialog("choose","选择审核人",
|
{},
|
{"width":60,"height":70},
|
[{btnId:"btnSure", btnName:"确定", btnStyle:"bluebtn"}],url);
|
}
|
function setValues(shId,shName){
|
$("#shId").val(shId)
|
$("#shName").val(shName);
|
$("#myform").submit();
|
}
|
|
</script>
|
</body>
|
</html>
|