/**
* 评论组件
*/
$(function () {
//初始化获取评论组件的信息
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt_OneWork");
handler.AddUrlData();
var data = handler.DoMethodReturnString("FlowBBSList");
if (data.indexOf('err@') == 0) {
alert(data);
console.log(data);
}
ShowFlowBBS(JSON.parse(data));
});
/**
* 加载评论组件的信息
* @param {any} data 评论信息列表
*/
function ShowFlowBBS(data) {
var isHaveMySelf = false;
var _Html = "";
var str = "";
var strT = "";
for (var i = 0; i < data.length; i++) {
var webUser = new WebUser();
if (data[i].Rec == webUser.No)
isHaveMySelf = true;
if (str.indexOf('@' + data[i].DeptNo + '@') == -1) {
str += '@' + data[i].DeptNo + '@';
strT += '@' + data[i].DeptName + '@';
}
}
_Html += "
";
var strs = str.split("@"); //生成数组.
var strTs = strT.split("@");
for (var idx = 0; idx < strs.length; idx++) {
var dept = strs[idx];
if (dept == "" || dept == null)
continue;
_Html += "
";
_Html += "
";
for (var i = 0; i < data.length; i++) {
var bbs = data[i];
if (bbs.DeptNo != dept)
continue;
_Html += "
";
_Html += "
" + bbs.Msg + "";
_Html += "
";
_Html += "
" + bbs.RecName + " " + bbs.RDT;
_Html += "
";
_Html += "
";
}
_Html += "
";
}
_Html += "
";
//只读状态并且当前登陆人的的抄送列表还未发生评论
if (pageData.IsReadonly == "1" && isHaveMySelf == false && GetQueryString("CCSta") == "1") {
_Html += "";
_Html += "";
_Html += "";
_Html += "
";
_Html += "
";
_Html += "
常用短语 ";
_Html += "
";
_Html += "
";
}
$("#FlowBBS").html(_Html);
}
function SetFlowBBSVal() {
var objS = document.getElementById("DuanYu");
var val = objS.options[objS.selectedIndex].value;
if (val == "")
return;
if ($("#FlowBBS_Doc").length == 1) {
$("#FlowBBS_Doc").val(val);
}
}
/**
* 评论组件的提交
*/
function BBSSubmit() {
if ($("#FlowBBS_Doc").val() == null || $("#FlowBBS_Doc").val() == "" || $("#FlowBBS_Doc").val().trim().length == 0) {
alert("未填写意见!");
return;
}
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt_OneWork");
handler.AddUrlData();
handler.AddFormData();
var data = handler.DoMethodReturnString("FlowBBS_Save");
if (data.indexOf('err@') == 0) {
alert(data);
return;
}
alert("发送成功");
//获取所有的评论内容
var handler = new HttpHandler("BP.WF.HttpHandler.WF_WorkOpt_OneWork");
handler.AddUrlData();
var data = handler.DoMethodReturnString("FlowBBSList");
if (data.indexOf('err@') == 0) {
alert(data);
console.log(data);
return;
}
if ( typeof ReadAndClose === "function") {
ReadAndClose();
}
}