/**
* 功能:
*
*
* @author HXB
* @date 2015/09/18
*/
/** 定义变量* */
var _this = this;
var g = null;// 数据列表
var g1 = null;
_this.loadParams = null;// 列表加载参数
/** 私有方法* */
/** 上传附件 **/
_this.save = function($form){
showProgressBar("正在提交中...");
/*var formValue = $form.serialize();
var url = $.pathname() +"/ws/uploadForm/FileUpDownService/fileUpLoad";
fileToSave($form,null,null,url);*/
var formValue = $form.serialize();
var url = $.pathname() +"/ws/uploadForm/FileUpDownService/asyncFileUpLoad";
$.request.add(url,formValue,function(data){
closeProgress();
top.Dialog.alert(data.Msg.info);
});
};
function fileToSave($form,listGrid,msg,url){
showProgressBar("正在提交中...");
//表单异步提交处理
$form.ajaxSubmit({
type: 'post',
url:url,
//表单提交成功后的回调
success: function(responseText, statusText, xhr, $form){
responseText = eval('('+responseText+')');
closeProgress();
readLoad();
if(msg!=undefined){
if(responseText.info == 'success')
top.Dialog.alert(msg+'成功!');//弹出提示
else
top.Dialog.alert(msg+'失败!');//弹出提示
}else{
if(responseText.info == 'success')
top.Dialog.alert('保存成功!');//弹出提示
else
top.Dialog.alert('保存失败!');//弹出提示
}
}
});
}
/**初始化表格**/
function initgrid(taskJson){
/** grid载入数据* */
g = $("#dataGrid").quiGrid({
columns : [{
display : '填报部门',
name : 'INPUT_DEPT_614',
align : 'center',
width : "15%",
showTitle:true
}, {
display : "保供电风险评估指标",
name : 'FILE_SUOSHU_614',
align : 'center',
width : "35%",
showTitle:true,
render:function(rowdata,rowindex,value){
return ""+value+"";
}
}, {
display : '填报时间',
name : 'INPUT_TIME_614',
align : 'center',
width : "15%",
isSort : true
}, {
display : '填报人',
name : 'INPUT_NAME_614',
align : 'center',
width : "10%",
showTitle:true
}, {
display : '操作',
align : 'center',
width : "10%",
showTitle:true,
render:function(rowdata,rowindex,value){
return "";
}
}],
/*url : $.pathname() + '/ws/crud/CRUDService/queryQui',
params :_this.loadParams,*/
data:taskJson,
rownumbers : true,
checkbox : true,
width : '100%',
height:"485px",
pageSize : 10,
percentWidthMode : true
});
};
/**初始化表格**/
function initgrid1(taskJson){
/** grid载入数据* */
g1 = $("#dataGrid1").quiGrid({
columns : [{
display : '单位',
name : 'INPUT_DEPT_614',
align : 'center',
width : "15%",
showTitle:true
}, {
display : "保供电风险评估报告",
name : 'FILE_SUOSHU_614',
align : 'center',
width : "35%",
showTitle:true,
render:function(rowdata,rowindex,value){
return ""+value+"";
}
}, {
display : '填报时间',
name : 'INPUT_TIME_614',
align : 'center',
width : "15%",
isSort : true
}, {
display : '填报人',
name : 'INPUT_NAME_614',
align : 'center',
width : "10%",
showTitle:true
}, {
display : '操作',
align : 'center',
width : "10%",
showTitle:true,
render:function(rowdata,rowindex,value){
return "";
}
}],
data:taskJson,
rownumbers : true,
checkbox : true,
width : '100%',
height:"485px",
pageSize : 10,
percentWidthMode : true
});
};
//批量删除
function _deleteRow(rowidx) {
var rows = g.getSelectedRows(rowidx);
var rowsLength = rows.length;
if (rowsLength == 0) {//请选中要删除的记录!
top.Dialog.alert("请选中要删除的记录!");
return;
}
var ids = "";
for ( var i = 0; i < rowsLength; i++) {
ids += rows[i].FD_OBJECTID614+ ",";
}
var url = $.pathname() +"/ws/crud/CRUDService/delete/";
var params = {
objectIDs : ids,
classid : 614
};
top.Dialog.confirm("确定要删除吗?|删除", function() {
$.request.del(url,params,function(result){
if (result.Msg.sucsess == true) {
top.Dialog.alert("删除成功!");
// 刷新表格数据
//loadData();
readLoad();
//g.rend();
} else {
top.Dialog.alert("删除失败!");
}
});
});
}
/*****删除********/
/*function _deleteRow(rowindex){
var row = g.getRow(rowindex);
var fd_iddd = row.file_id;
var url = $.pathname() + "/ws/crud/CRUDService/delete/";
var params = {
objectIDs : fd_iddd,
classid : 110
};
top.Dialog.confirm("确定要删除吗?|删除", function() {
$.request.del(url, params, function(result) {
if (result.Msg.sucsess == true) {
top.Dialog.alert("删除成功!");
// 刷新表格数据
readLoad();
//g.render();
} else {
top.Dialog.alert("删除失败!");
}
});
});
}*/
/*****删除********/
function _deleteRow1(rowindex){
var row = g1.getRow(rowindex);
var fd_iddd = row.file_id;
var url = $.pathname() + "/ws/crud/CRUDService/delete/";
var params = {
objectIDs : fd_iddd,
classid : 110
};
top.Dialog.confirm("确定要删除吗?|删除", function() {
$.request.del(url, params, function(result) {
if (result.Msg.sucsess == true) {
top.Dialog.alert("删除成功!");
// 刷新表格数据
readLoad();
//g.render();
} else {
top.Dialog.alert("删除失败!");
}
});
});
}
//判断是否上传附件,需要传递组件id
function hasFile(divId){
var o = $("#"+divId).find("[name='fileData']").val();
if(o){
return true;
}
return false;
}
_this.daoru = function(){
/*var fileaaa = $(".textinput").eq(0).val();
alert(fileaaa);
return;*/
/*var isFile = hasFile("fileDiv");
if(!isFile){
top.Dialog.alert("附件不能为空!");
return;
}*/
$form = $('#editForm');
//保存附件
save($form);
var fengxian_type = "1";
loadGridData(fengxian_type);
var taskJson33 = loadGridData(fengxian_type);
initgrid(taskJson33);
};
_this.daoru1 = function(){
/*var isFile = hasFile("fileDiv1");
if(!isFile){
top.Dialog.alert("附件不能为空!");
return;
}*/
$form = $('#editForm1');
//保存附件
save($form);
var fengxian_type2 = "2";
loadGridData(fengxian_type2);
var taskJson44 = loadGridData(fengxian_type2);
initgrid1(taskJson44);
};
//点击文件下载
function _loadFile(fileUrl){
window.open(fileUrl);
}
/***通过判断页面类型(方案,风险,工作简报...)和任务id,获取该任务下所属类型的数据***/
function gettaskJson(fileSuoShu,taskId,fengxian_type){
var taskJson;
var dataparams = {
listId : '614',
condition : "is_del=0 and FILE_SUOSHU='"+fileSuoShu+"' and FD_TASK='"+taskId+"' " +
"and FENGXIAN_TYPE='"+fengxian_type+"' ORDER BY UPDATEDATE DESC"
};
$.ajax({
url : $.pathname() + '/ws/crud/CRUDService/queryQui',
type : 'post',
async : false,
data : dataparams,
success : function(data) {
taskJson = data;
},error : function(e) {
$.messager.alert('保存失败!', '访问服务失败!', 'error');
}
});
return taskJson;
}
/***通过业务id获取附件数据,返回附件名称和url的json**/
function getFileJson(mainid){
var dataparams = {
listId : '110',
condition : "IS_DEL=0 AND MAINID='"+mainid+"'"
};
var filename = "";
var jsondds = [];
$.ajax({
url : $.pathname() + '/ws/crud/CRUDService/queryQui',
type : 'post',
async : false,
data : dataparams,
success : function(data) {
for(var i=0;i0){
for(var i=0;i