//部门id
var dpids = top.com.sinosoft.lz.system.user.LoginInfo.getDeptids();
//取得用户真实姓名
var realname = top.com.sinosoft.lz.system.user.LoginInfo.getReal_name();
//登录人ID
var getUser_id = top.com.sinosoft.lz.system.user.LoginInfo.getUser_id()+"";
//登陆用户的单位名称
var corp_name = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_names();
//父部门id
var parentId = top.com.sinosoft.lz.system.user.LoginInfo.getParent_ids();
//用户登录的单位ID
var deptId = top.com.sinosoft.lz.system.user.LoginInfo.getCorp_ids();
$(function(){
//下拉框加载
// $("#FILE_CLASSIFY_231").initCanstSelect('BM_FILE_CLASSIFY');
// $('#CHANGE_TYPE_231').initCanstSelect('BM_CHANGETYPE');
// $("#COLUMN_2_231").initCanstSelect('BM_FILE_SECURITY');
getChildInfo();
/** 绑定更多的按钮点击事件 */
$more = $("#more"); // 更多按钮
$more.bind('click', function() {
more();
});
$searchButt = $("#searchButt");// 更多查询按钮
$searchButt.live('click', function() {
searchHandler();
});
$searchOne = $("#searchOne");//查询图标绑定查询事件
$searchOne.bind('click', function() {
searchHandler();
});
});
var conditionData2="";
function getChildInfo(){
var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/getresourXj/';///ws/PlanHuiZong/ContingencyPlanHuiZong/getChidInfo/
var params = {
id : deptId,
value:"PUBLISH_COMP_ID"
};
$.ajax({
url : url,
type : 'post',
timeout : 60000,
data : params,
dataType : 'json',
success : function(data){
// conditionData2 = JSON.stringify(data);
//
// conditionData2 = conditionData2.replace(/\\\"/g,"\"");
// conditionData2 = conditionData2.replace(/\"{/g,"{");
// conditionData2 = conditionData2.replace(/}\"/g,"}");
// var test = eval("("+conditionData2+")");
// if(conditionData2!='{"list":[{"name":"查询单位","className":"PUBLISH_COMP_ID","list":[]}]}'){
// test.dept.list[0].equalType = "equal";
// conditionData.list.push(test.dept.list[0]);
// }else{
// test.dept.list[0].equalType = "equal";
// conditionData.list.push(test.dept.list[0]);
// }
//
// /* if(parent_id!="1"){
// conditionData.list.push(test1.list[0]);
// }*/
//
//
//
// createConditionsDom(conditionData);
// $(".item").unbind("click").bind("click",bindSelectOne);
var conditionData3 = JSON.stringify(data);
var test = eval("("+conditionData3+")");
if(conditionData3!='{"list":[{"name":"查询单位","className":"PUBLISH_COMP_ID","equalType":"equal","list":[]}]}'){
conditionData.list.push(test.list[0]);
}
createConditionsDom(conditionData);
$(".item").unbind("click").bind("click",bindSelectOne);
},
error : function(e){
$.messager.alert('系统提示信息', '访问服务失败!', 'error');
}
});
}
var g;
//var condition = "IS_DEL='0' and (FABU='1' or SHANGBAO='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and (PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID IN(SELECT A.ID FROM EMC_AM_ORG_DEPARTMENT_TEST A WHERE A.PARENT_ID='"+deptId+"') or PUBLISH_COMP_ID='"+parentId+"')";
// var condition = "IS_DEL='0' and (FABU='1' or SHANGBAO='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and (PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID IN(SELECT A.ID FROM EMC_AM_ORG_DEPARTMENT_TEST A WHERE A.PARENT_ID='"+deptId+"' ) and SHANGBAO='1')";
//var condition = "IS_DEL=0 and ( FABU='1' or PIGEONHOLE_MAN_ID='"+userId+"') ";
var condition = "IS_DEL='0' and (FABU='1' or PIGEONHOLE_MAN_ID='"+ getUser_id +"') and (PUBLISH_COMP_ID='"+deptId+"' or PUBLISH_COMP_ID='"+parentId+"')";
//列表加载参数
var loadParams = {
"listId" : '231',
"condition" : condition,
direction:'DESC',
sort: 'UPDATEDATE'
};
//初始化列表
function initComplete(){
/**
* 工具条
*/
var roleCons = roleButtonArr();
var toolBarOpt1 = {items: [
{ text: '新增' ,click:"onAdd",iconClass: 'add1_tem',id:"bgdxz"},
{ text: '删除' ,click:"onDelete",iconClass: 'delete_tem',id:"bgdsc"},
{ text: '修改' ,click:"onEdit",iconClass: 'update_tem',id:"bgdxg"},
{ text: '查看',click:"onView",iconClass: 'view_tem', id:"bgdck"},
// { text: '历史版本' ,click:"onViewHistory",iconClass: 'history_tem',id:"10201"},
{ text: '导入' , click:"onImport",iconClass: 'import_tem',id:"bgddr" },
{ text: '导出' , click:"exportTotalData",iconClass: 'export_tem',id:"bgddc"},
// { text: '下载' ,click:"onDownLoad",iconClass: 'download_tem',id:"10007"},
{ text: '汇总', click: "sumUnit", iconClass: 'poll_tem' ,id:"bgdhz"},
{ text: '共享', click: "publicShare", iconClass: 'share_tem' ,id:"bgdgx"},
{ text: '撤销',click: "noPublish", iconClass: 'release_tem' ,id:"bgdcx"}
],
roleCons:roleCons};
/**
* 树形列
*/
var grid_option1 = {
columns: [
{display : '文件标题',name : 'FILE_TITLE_231', align : 'center',width : '15%',isPrimaryKey:true,
// render : function(rowdata, value) {
// return ''+ rowdata.FILE_TITLE_231 +'';
// }
render : function(rowdata, rowindex, value, column) {
return "" + value + "";
}
},
{display : '发布单位',name : 'PUBLISH_COMP_ID_231_SHOW', align : 'center',width : '15%'},
{display : '文件分类',name : 'FILE_CLASSIFY_231_SHOW', align : 'center',width : '10%'},
{display : '发文日期',name : 'FILE_ADD_DATE_231', align : 'center',width : '10%'},
{display : '归档人',name : 'PIGEONHOLE_MAN_ID_231_SHOW', align : 'center',width : '10%'},
{display : '归档日期',name : 'PIGEONHOLE_DATE_231', align : 'center',width : '10%'},
// {display : '文件摘要',name : 'FILE_CONTENT_231', align : 'center',width : '10%'},
// {display : '变更说明',name : 'CHANGE_DETAIL_231', align : 'center',width : '10%'},
{display : '保密等级',name : 'COLUMN_2_231_SHOW', align : 'center',width : '10%'},
{display : '状态',name : 'CHANGE_TYPE_231_SHOW', align : 'center',width : '10%'},
// {display : '电子文件',name : 'ELECTRONIC_FILE_231', align : 'center',width : '7%'},
{ display: '操作', isAllowHide: false, align: 'center', width:'10%',
render: function (rowdata, rowindex, value, column){
//判断是否已经发布。取发布的状态,如果已经发布为“1”;未发布为“0”
var fabu='';//fabu
if(rowdata.FABU_231=="1"){
fabu = '
';
}else{
fabu = '
';
}
//判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09
var shangbao='';
if(rowdata.SHANGBAO_231=="1"){
shangbao = '
';
}else{
shangbao = '
';
}
//共享
var gongxiang='';
if(rowdata.IS_SHARE_231=="1"){
gongxiang = '
';
}else{
gongxiang = '
';
}
return fabu
/*+ shangbao*/ + gongxiang;
}
}
],
rownumbers : true,
checkbox : true,
pageSize : 10,
percentWidthMode : true
};
var options1={
url :'/nwyj/ws/crud/CRUDService/queryQui',
params:loadParams,
width:'100%',
sortName : 'UPDATEDATE_231',
gridOptions:grid_option1,
singleRecodeOptions:{a:"aa"},
paperOpration:{showInput:"true"},
toolBarOptions:toolBarOpt1
};
g=gridAndSingleRecode=$("#maingrid").quickgridAndSingleRecode(options1);
/*// showAndHide();
g = $("#maingrid").quiGrid({
columns: [
// {name : 'FD_OBJECTID',hide : true},
{display : '标题',name : 'FILE_TITLE_231', align : 'center',width : '250'},
{display : '分类',name : 'FILE_CLASSIFY_231_SHOW', align : 'center',width : '200'},
// {display : '发布状态',name : 'FILE_STATUS_230_SHOW', align : 'center',width : '10%'},
// {display : '上报状态',name : 'SHANGBAO_230_SHOW', align : 'center',width : '10%'},
{display : '发布日期',name : 'FILE_ADD_DATE_231', align : 'center',width : '200'},
{display : '归档人',name : 'PIGEONHOLE_MAN_ID_231_SHOW', align : 'center',width : '180'},
{display : '归档日期',name : 'PIGEONHOLE_DATE_231', align : 'center',width : '220'},
{display : '变更说明',name : 'CHANGE_DETAIL_231', align : 'center',width : '240'},
{display : '保密等级',name : 'COLUMN_2_231_SHOW', align : 'center',width : '110'},
{display : '状态',name : 'CHANGE_TYPE_231_SHOW', align : 'center',width : '133'},
{display : '电子文件',name : 'ELECTRONIC_FILE_231', align : 'center',width : '110'},
{ display: '操作', isAllowHide: false, align: 'left', width:100,
render: function (rowdata, rowindex, value, column){
//判断是否已经发布。取发布的状态,如果已经发布为“1”;未发布为“0”
var fabu='';//fabu
if(rowdata.FABU_231=="1"){
fabu = '';
}else{
fabu = '';
}
//判断是否已经发布。取发布的状态,如果已经上报为“1”;未上报为“0”fashang_09
var shangbao='';
if(rowdata.SHANGBAO_231=="1"){
shangbao = '';
}else{
shangbao = '';
}
return fabu
+ shangbao;
}
}
],
url :$.pathname() + '/ws/crud/CRUDService/queryQui',
params : loadParams,
sortName : 'UPDATEDATE_231',
sortOrder : 'desc nulls last',
rownumbers:true,
checkbox:true,
height: '99%',
width:"100%",
pageSize: 10,
percentWidthMode:true,
//顶部图标按钮栏
toolbar:
{
items: [
{ text: '新增' ,click:onAdd,iconClass: 'add1_tem', disabled: false },//OK
{ line: true },
{ text: '删除' ,click:onDelete,iconClass: 'delete_tem', disabled: false },
{ line: true },
{ text: '修改' ,click:onEdit,iconClass: 'update_tem', disabled: false },
{ line: true },
{ text: '查看详情',click:onView,iconClass: 'view_tem', disabled: false },
{ line: true },
{ text: '查看历史版本' ,click:onViewHistory,iconClass: 'icon_history', disabled: false },
{ line: true },
{ text: '导入' , click:onImport,iconClass: 'import_tem', disabled: false },
{ line: true },
{ text: '导出' , click:exportTotalData,iconClass: 'icon_export', disabled: false },
{ line: true },
{ text: '下载' ,click:onDownLoad,iconClass: 'download_tem', disabled: false },
{ line: true },
]
}
});*/
}
function onPublish1(){
top.Dialog.alert("该文件已经发布!");
}
function shangbao1(){
top.Dialog.alert("该文件已经上报!");
}
//点击查看
function jumpPage(id){
window.location.href="FileEMInfo.jsp?"+id;
}
function showPrimaryKey(obj,index){
var fd_id = obj.FD_OBJECTID231;
window.location.href="FileEMInfo.jsp?"+fd_id;
}
//导出
function exportTotalData(){
var rows = g.getSelectedRows();
var rowsLength = rows.length;
if (rowsLength == 0) {
excelExport(
231,
loadParams,
"保供电制度文件",
"IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_3,COLUMN_4,PUBLISH_COMP_ID,FILE_STATUS,VERSION_ID,SHANGBAO,FABU,REPORT_COMP_ID"
);
return;
}
var ids = "";
for ( var i = 0; i < rowsLength; i++) {
ids += "'"+rows[i].FD_OBJECTID231+"'" + ",";
}
var temp = ids.substring(0,ids.length-1);
// alert(temp);
var condition = " IS_DEL='0' ";
condition += " AND FD_OBJECTID IN (" + temp + ") " ; //'%" +name+"%';
var sql = {
"listId" :'231' ,
"condition" : condition
};
excelExport(
231,
sql,
"保供电制度文件",
// ['IS_DEL','UPDATEDATE','FD_OBJECTID','COLUMN_1','COLUMN_3','COLUMN_4','PUBLISH_COMP_ID','FILE_STATUS','VERSION_ID','SHANGBAO','FABU','REPORT_COMP_ID']
"IS_DEL,UPDATEDATE,FD_OBJECTID,COLUMN_1,COLUMN_3,COLUMN_4,PUBLISH_COMP_ID,FILE_STATUS,VERSION_ID,SHANGBAO,FABU,REPORT_COMP_ID"
);
}
//查询
//function searchHandler() {
// var title = $('#FILE_TITLE_231').val();//标题
// var classify = $('#FILE_CLASSIFY_231').val();//分类
// var type = $('#CHANGE_TYPE_231').val();//更新类别
// //时间区间
// var date1 = $('#DATE1').val();
// var date2 = $('#DATE2').val();
// //var userId = row.PIGEONHOLE_MAN_ID_231;
// var condition = "IS_DEL=0 and ( FABU='1' or PIGEONHOLE_MAN_ID='"+getUser_id+"') ";
//
// var baomidengji = $("#COLUMN_2_231").val();//保密等级
//
// if(title!=""&&title!="请输入文件名称"){
// condition += " AND FILE_TITLE LIKE '%" +title+"%'";
// }
// if(baomidengji!=""){
// condition += " AND COLUMN_2 LIKE '%" +baomidengji+"%'";
// }
// if(classify!=""){
// condition += " AND FILE_CLASSIFY = '" + classify + "' ";
// }
// if(type!=""){
// condition += " AND CHANGE_TYPE = '" + type + "' ";
// }
// //日期
// if(date1!="" && date2!=""){
// condition += " AND FILE_ADD_DATE BETWEEN '" + date1 +"' AND '" + date2 + "' ";
// }
// if(date1!="" && date2==""){
// condition += " AND FILE_ADD_DATE >= '" + date1 +"' " ;
// }
// if(date1=="" && date2!=""){
// condition += " AND FILE_ADD_DATE <= '" + date2 + "' ";
// }
// g.setOptions({// 重置加载列表的参数
// params : {
// "listId" : '231',
// "condition" : condition,
// direction:'DESC',
// sort: 'UPDATEDATE'
// }
// });
// g.rend();
//}
// function searchHandler(){
// $queryForm = $("#queryForm");
// if($("#FILE_TITLE_231").val()=="请输入文件名称"){
// $("#FILE_TITLE_231").val("");
// }
// $queryForm.serialize();
// //获取选中的值
// var searchCondition = getSelectCon(conditionData);
// var queryParams = getQueryFormParams($queryForm);
// var params=$.extend({},loadParams,queryParams);
//
// var startTime=$("#startTime").val();
// var endTime=$("#endTime").val();
// var startDate=$("#startDate").val();
// var endDate=$("#endDate").val();
// if(startTime != null && startTime != "" && endTime != null && endTime != ""){
// /*startTime = startTime +" 00:00";
// endTime = endTime +" 23:59";*/
// var condition1 = " and FILE_ADD_DATE between '"+startTime+"' and '"+endTime+"'";
// params.condition = params.condition + condition1;
// }else if(startDate != null && startDate != "" && endDate != null && endDate != ""){
// /*startDate = startDate+" 00:00";
// endDate = endDate +" 23:59";*/
// var condition2 = " and PIGEONHOLE_DATE between '"+startDate+"' and '"+endDate+"'";
// params.condition = params.condition + condition2;
// }else{
// var searchCondition = getSelectCon(conditionData);
// params.condition = searchCondition.condition + params.condition;
// }
//
//// alert(params.condition);
//
// //与之前参数条件拼接
// params.condition = searchCondition.condition + params.condition;
// g.setOptions({"params":params});
// //加载数据
// g.rend();
// }
function searchHandler(){
$queryForm = $("#queryForm");
if($("#FILE_TITLE_231").val()=="请输入文件标题"){
$("#FILE_TITLE_231").val("");
}
$queryForm.serialize();
var $comp_id = $("#selectConditions").find(".PUBLISH_COMP_ID");
var loadParams11;
//判断是否有用单位做查询条件
if(!!$comp_id.prop("outerHTML")){
loadParams11 = {
"listId" : '231',
"condition" : " IS_DEL='0' and FABU='1' ",
direction:'DESC',
sort: 'UPDATEDATE'
};
}else{
loadParams11 = $.extend({},loadParams,loadParams);
}
//获取选中的值
var searchCondition = getSelectCon(conditionData);
var queryParams = getQueryFormParams($queryForm);//拼接出来的条件
var params=$.extend({},loadParams11,queryParams);// 默认
//与之前参数条件拼接
params.condition = searchCondition.condition + params.condition;
// alert(JSON.stringify(params));
g.setOptions({"params":params});
//加载数据
g.rend();
}
//新增
function onAdd(){
window.location.href="FileEMAdd.jsp";
}
function onDelete(){
var rows = g.getSelectedRows();
var rowsLength = rows.length;
if (rowsLength == 0) {
top.Dialog.alert("请选中要删除的记录!");
return;
}
var ids = "";
for ( var i = 0; i < rowsLength; i++) {
ids += rows[i].FD_OBJECTID231 + ",";
if(rows[i].FABU_231=="1"||rows[i].SHANGBAO_231=="1"){
if(rows[i].FABU_231=="1"){
top.Dialog.alert("您选中的文件已经发布!");
}else if(rows[i].SHANGBAO_231){
top.Dialog.alert("您选中的文件已经上报!");
}
return;
}
if(rows[i].PIGEONHOLE_MAN_ID_231!=getUser_id){
top.Dialog.alert("只能刪除自己上传的文件!");
return;
}
}
top.Dialog.confirm("确定要删除吗?|删除", function() {
// 删除记录
$.post($.pathname() +"/ws/crud/CRUDService/delete/", {
"objectIDs" : ids,
classid : 231
}, function(result) {
if (result.Msg.sucsess == true) {
$.messager.alert("删除成功",null,null,null,-1);
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("删除失败!");
}
}, "json");
});
}
//修改
function onEdit(){
var rows = g.getSelectedRows();
if (rows.length == 0) {
top.Dialog.alert("请选择一条记录");
return;
}
if (rows.length > 1) {
top.Dialog.alert("只能选择一条记录");
return;
}
//归档人
//只能修改自己上传的文件
var userIds = rows[0].PIGEONHOLE_MAN_ID_231;
if(userIds!=getUser_id){
top.Dialog.alert("只能修改自己上传的文件!");
return;
}
//上报或发布的不能修改
var shangbao = rows[0].SHANGBAO_231;
var fabu = rows[0].FABU_231;
if(shangbao=="1"){
top.Dialog.alert("上报的文件不能修改!");
return;
}else if(fabu=="1"){
top.Dialog.alert("发布的文件不能修改!");
return;
}
// if(PIGEONHOLE_MAN_ID_231!=tianbaorenID){
// top.Dialog.alert("不能修改别人上传的文件!");
// return;
// }
var fd_id = rows[0].FD_OBJECTID231;
window.location.href="FileEMEdit.jsp?"+fd_id;
};
//查看详情
function onView(){
var rows = g.getSelectedRows();
if (rows.length == 0) {
top.Dialog.alert("请选择一个文件");
return;
}
if (rows.length > 1) {
top.Dialog.alert("只能选择一个文件");
return;
}
var fd_id = rows[0].FD_OBJECTID231;
window.location.href="FileEMInfo.jsp?"+fd_id;
// var fd_id = rows[0].FD_OBJECTID231;
// var url = "FileEMInfo.jsp?"+fd_id;
// window.parent.document.setAttribute("src", "/nwyj/page/business/am/file/"+url);
}
this.openDetail = function(rowindex) {
var row = g.getRow(rowindex);
var fd_id = row.FD_OBJECTID231;
window.location.href="FileEMInfo.jsp?"+fd_id;
};
//上报
function onReport(data){
var row = g.getRow(data);
var fd_id = row.FD_OBJECTID231;
//只能上报自己上传的文件
var userId = row.PIGEONHOLE_MAN_ID_231;
if(getUser_id!=userId){
top.Dialog.alert("只能上报自己上传的文件!");
return;
}
top.Dialog.confirm("确定要上报吗?|上报", function() {
// 上报
$.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/bgdfileShangbao/", {
//当前单位id
comp_id : dpids,
fd_id : fd_id,
}, function(result) {
if (result.Msg.sucsess == true) {
$.messager.alert("上报成功",null,null,null,-1);
//消息推送
fillShangbao(data);
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("上报失败!");
}
}, "json");
});
}
//上报前先给上级单位公共消息库里插入一条记录
/**
* 1、取本级单位ID
* 2、上报人ID
* 3、上报消息主键
* 4、服务名称(URL)
**/
function fillShangbao(data){
var row = g.getRow(data);
var fd_id = row.FD_OBJECTID231;
remark=fd_id;
//向后台发送请求调用dwr
var url = $.pathname() + '/ws/PlanHuiZong/ContingencyPlanHuiZong/sendMsgDwr/';
var msg = ""+corp_name+"的保供电制度文件";
//var msg = "应急预案";
var params = {
parentDeptName:parentId,
msg:msg
};
$.ajax({
url : url,
type : 'post',
data : params,
dataType : 'text',
timeout : 60000,
success : function(data){
},
error : function(){
$.messager.alert('操作失败');
}
});
}
//发布
function onPublish(data){
var row = g.getRow(data);
//只能上报自己上传的文件
var userId = row.PIGEONHOLE_MAN_ID_231;
if(getUser_id!=userId){
top.Dialog.alert("只能发布自己上传的文件!");
return;
}
top.Dialog.confirm("确定要发布吗?|发布", function() {
var fd_id = row.FD_OBJECTID231;
// 发布规范文件
$.post($.pathname() +"/ws/EmcPlan/EmgencyPlanService/bgdfileFabu/", {
comp_id : dpids,
fd_id : fd_id,
}, function(result) {
if (result.Msg.sucsess == true) {
top.Dialog.alert("发布成功");
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("发布失败!");
}
}, "json");
}
);
}
//撤回
function onCallBack(rowid){
top.Dialog.confirm("确定要撤回吗?|撤回", function() {
if(status=="0"){
top.Dialog.alert("只能撤回已发布或已上报的文件");
return;
}
// 发布规范文件
$.post($.pathname() +"/ws/SystemFile/SystemFileService/callBack", {
"fd_id" : rowid
}, function(result) {
if (result.Msg.sucsess == true) {
top.Dialog.alert("撤回成功",null,null,null,1);
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("撤回失败!");
}
}, "json");
});
}
//下载
function onDownLoad(){
var rows = g.getSelectedRows();
var rowsLength = rows.length;
if (rowsLength == 0) {
top.Dialog.alert("请选中要下载的文件!");
return;
}
var fd_id = rows[0].FD_OBJECTID231;
showFile(fd_id);
}
function showFile(fd_id){
var diag = new top.Dialog();// 定义一个窗口对象
diag.Title = "下载";// 窗口标题
diag.URL = $.pathname() +"/page/business/am/base/showDownloadFile.html?fd_id="+fd_id;// 窗口对应的页面
diag.Height = 400;
diag.ShowOkButton=false;// 不显示确认按钮
diag.ShowCancelButton=false;// 不显示取消按钮
diag.ButtonAlign="center";// 按钮居中
diag.show();// 显示窗口
}
//共享 单一的
function onShare(data){
var row = g.getRow(data);
var fd_id = row.FD_OBJECTID231+",";
//只能共享以及发布的文件
if(row.FABU_231!="1"){
top.Dialog.alert("只能共享已经发布的文件!");
return;
}
//只能共享自己上传的文件
var REMARK1 = row.PIGEONHOLE_MAN_ID_231;
if(REMARK1!=getUser_id){
top.Dialog.alert("只能共享自己上传的文件!");
return;
}
top.Dialog.confirm("确定要共享吗?|共享", function() {
// 发布规范文件
$.post($.pathname() +"/ws/FILEPOLL/FileAMService/FileEMShare/", {
fd_id : fd_id,
}, function(result) {
if (result.Msg.sucsess == true) {
top.Dialog.alert("共享成功");
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("共享失败!");
}
}, "json");
});
}
//撤销共享
function noShare(data){
var row = g.getRow(data);
var fd_id = row.FD_OBJECTID231+",";
//只能撤销自己上传的文件
var REMARK1 = row.PIGEONHOLE_MAN_ID_231;
if(REMARK1!=getUser_id){
top.Dialog.alert("只能撤销自己上传的文件!");
return;
}
top.Dialog.confirm("确定要撤销共享吗?|撤销", function() {
// 发布规范文件
$.post($.pathname() +"/ws/FILEPOLL/FileAMService/noFileEMShare/", {
fd_id : fd_id,
}, function(result) {
if (result.Msg.sucsess == true) {
top.Dialog.alert("撤销成功");
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("撤销失败!");
}
}, "json");
});
}
//导入
function onImport(){
window.location.href="FileEM-import.jsp";
}
//查看历史版本
function onViewHistory(){
var rows = g.getSelectedRows();
if(rows.length==0){
top.Dialog.alert("请选择一条记录");
return;
}
if(rows.length>1){
top.Dialog.alert("只能选择一条记录");
return;
}
//上一个版本的预案ID
var fd_id = rows[0].COLUMN_1_231;
var fd_id1 = rows[0].FD_OBJECTID231;
window.location.href="FileEMVersion.jsp?"+fd_id+"?" + fd_id1;
}
//更多
function more(){
$('#moreDiv').toggle(400,function(){
$("#emptyCondition").click();
$(parent.document.body).find("#frmright").height($(window.document.body).height()+30);
});
}
//汇总统计
function sumUnit(){
window.location.href="FileEM-poll.jsp";
}
//共享
function publicShare(){
var rows = g.getSelectedRows();
var rowsLength = rows.length;
if (rowsLength == 0) {
top.Dialog.alert("请选中要共享的记录!");
return;
}
var REMARK1 = rows[0].PIGEONHOLE_MAN_ID_231;
if(REMARK1!=getUser_id){
top.Dialog.alert("只能共享自己上传的文件!");
return;
}
var ids = "";
var sturtssb = "";
for ( var i = 0; i < rowsLength; i++) {
ids += rows[i].FD_OBJECTID231 + ",";
sturtssb += rows[i].FABU_231 + ",";
if(rows[i].FABU_231!="1"){
if(rowsLength==1){
top.Dialog.alert("您选中的记录未发布!");
}else{
top.Dialog.alert("您选中的记录有未发布的!");
}
return;
}
if(rows[i].IS_SHARE_231 == "1"){
if(rowsLength==1){
top.Dialog.alert("您选中的记录已共享!");
}else{
top.Dialog.alert("您选中的记录中包含已共享的!");
}
return;
}
}
/* $("#BUSINE_ID_217").val(ids);
var diag = new top.Dialog();
diag.Title = "文件共享";
diag.URL = $.pathname() + '/page/business/am/public/readDept.jsp';
diag.Width = 700;
diag.Height = 500;
diag.Top = "80%";
diag.Left = "50%";
diag.ShowButtonRow=true;
diag.ButtonAlign = 'center';
diag.OkButtonText="确 定";
diag.OKEvent = function(){
Validate(diag);
*//******改变共享字段的值,即改变共享状态***************//*
for(var i=0;itime2){
$.messager.alert('请选择正确的分享起始时间!');
return;
}
if(checkedNodes==""){
$.messager.alert('请选择要申请查看的单位!');
return;
}
var compValue="";
//var compValue2="";
for(var i = 0; i < checkedNodes.length; i++){
//机构名称
compValue += checkedNodes[i].id + ",";
//compValue2 += checkedNodes[i].name+",";
}
var compid = compValue.substring(0,compValue.length-1);
//var compname = compValue2.substring(0,compValue2.length-1);
//给第二个form的字段设置值
$("#SHARE_MAN_217").val(getUser_id); //SHARE_MAN_217 分享人
$("#SHARE_UNITS_217").val(deptId); //SHARE_UNITS_217分享单位
$("#RECEIVE_UNITS_217").val(compid); //RECEIVE_UNITS_217 被分享单位
//SHARE_TYPE_217分享的业务类型 写死3
$("#SHARE_START_TIME_217").val(time1); //SHARE_START_TIME_217开始时间
$("#SHARE_END_TIME_217").val(time2); //SHARE_END_TIME_217结束时间
//BUSINE_ID_217业务ID 点击分享的时候已经赋值给页面了
$("#RECEIVE_MAN_217").val(RECEIVE_MAN); //RECEIVE_MAN_217接收的人
var $form = $('#fillForm1');
var url = $.pathname() + '/ws/crud/CRUDService/create';
$.ajax({
url : url,
type : 'post',
data : $form.serialize(),
dataType : 'text',
timeout : 60000,
success : function(data){
$.messager.alert("共享成功",null,null,null,-1);
},
error : function(){
$.messager.alert('操作失败');
}
});
top.Dialog.close();//关闭新增窗口
}
//撤销
function noPublish(){
var rows = g.getSelectedRows();
var rowsLength = rows.length;
if (rowsLength == 0) {
top.Dialog.alert("请选中要撤销的记录!");
return;
} else if (rowsLength > 1) {
top.Dialog.alert("请选中一条要撤销的记录!");
return;
}
var ids = "";
for ( var i = 0; i < rowsLength; i++) {
ids += rows[i].FD_OBJECTID231 + ",";
var Bcompid = rows[i].PUBLISH_COMP_ID_231;
if(deptId!=Bcompid){
top.Dialog.alert("只能撤销本单位的文件!");
return;
}
if(rows[i].FABU_231!="1"){
top.Dialog.alert("您选中的记录还没有发布!");
return;
}
}
top.Dialog.confirm("确定要撤销发布吗?|撤销", function() {
$.post($.pathname() +"/ws/FILEPOLL/FileAMService/noPublish/", {
fd_id : ids,
}, function(result) {
if (result.Msg.sucsess == true) {
$.messager.alert("撤销成功",null,null,null,-1);
// 刷新表格数据
g.rend();
} else {
top.Dialog.alert("撤销失败!");
}
}, "json");
});
}
$.messager=top.Dialog;
function showPrimaryKey(obj,index){
var fd_id = obj.FD_OBJECTID231;
$('#frmright', window.parent.document).attr('src',$.pathname()+'/page/business/am/PPSFile/FileEMInfo.jsp?'+fd_id);
}