/** * 流程的待办事项挂件,首页里使用的,与选项卡里的区别在于这里的表格的分页数据相对较少 * Created by weidy on 2018/5/2. */ layui.define(['layer','table'],function(exports){ var UndoTask = function(){ this.moduleKey = "vciWebProUndoTaskPortlet"; this.taskCenterUrl='USEJS:/process/vciWebProUndoTask';//待办任务中心的数据 this.url= { task: 'processDefineController/getMyUndoTask' }; this.limit = 10; this.id = ''; }; UndoTask.prototype.getContent = function(){ var that = this; return '
'; }; UndoTask.prototype.getTableColumns = function(){ var that =this; var table = layui.table; var cols = [table.getIndexColumn(),{ field:'name', title:'任务名称', width:450, templet:'
{{d.name}}
' },{ field:'createtime', title:'上一步处理时间', width:150, templet:function(d){ if(d.createtime !=null){ return layui.util.toDateString(d.createtime,'yyyy-MM-dd HH:mm'); }else{ return ""; } } },{ field:'description', title:'描述', width:130 },{ field:'creator_name', title:'上一步操作人', width:100 },{ field: 'executionid', title: '所属流程模板', width: 150, templet: function (d) { if($webUtil.isNotNull(d.executionid) && d.executionid.indexOf(".") > -1){ return d.executionid.substring(0,d.executionid.indexOf(".")); }else{ return d.executionid; } } },{ field:'options', title:'操作', fixed:'right', width:60, toolbar:'#toolbar_vciProcessUndoTask_' + that.id }]; return cols; }; UndoTask.prototype.getToolbarHtml = function(){ var that =this; var html = ""; html += '执行';//去处理 // html += '查看数据';//查看数据 return html; }; UndoTask.prototype.init = function(){ var that = this; $webUtil.copyConfig(that,that.moduleKey); var table = layui.table; //先初始化工具栏的html--之前使用的script标签在IE8上是无效的,所以修改为DIV document.getElementById("toolbar_vciProcessUndoTask_" + that.id).innerHTML = that.getToolbarHtml(); //初始化列表 table.render({ elem:'#table_vciProcessUndoTask_' + that.id , id:'table_vciProcessUndoTask_' + that.id , url:that.url.task, backPath:(configData.compatibility ? path : configData.processServicePath), page:{ limit:that.limit, page:1 }, //height:600, cols:[that.getTableColumns()], done:function(res,curr,count){ //不清楚工具栏的监听是否在表格加载完成之前有影响,因此只能在加载完成后添加监听 table.on('tool(' + that.id + ')',function(obj){ var data = obj.data;//当前选择行的数据 var layEvent = obj.event;//点的是什么按钮 if(layEvent == 'gotodo'){ //直接弹出窗口 that.doProcess(data); }else if(layEvent == 'viewdata'){ that.viewData(data); } }); /*$('a[name="processname"]',$('#table_vciProcessUndoTask_' + that.id).parent()).on('click',function(){ var table = layui.table; var allData = table.getData('table_vciProcessUndoTask_' + that.id); if(allData&& allData.length > 0){ var thisDataRowIndex = $(this).attr("dataIndex"); var thisRowData = null; layui.each(allData,function(_index,_item){ if(_item.LAY_TABLE_INDEX == (thisDataRowIndex*1 - 1)){ thisRowData = _item; return true; } }); if(thisRowData!=null){ that.doProcess(thisRowData); } } });*/ } }); }; UndoTask.prototype.doProcess=function(data){ var that = this; var table = layui.table; if(data&&data.oid){ layui.use('process/vciWebProExecuteTask',function(){ var executeTask = layui['process/vciWebProExecuteTask']; executeTask.init(); var task = data; task.taskOid = data.oid; task.taskName = data.name; task.executionId=data.executionid var taskInfo = [task]; executeTask.showExecuteWindow(taskInfo,{ fullScreen:true },function(finish){ if(finish){ table.reload('table_vciProcessUndoTask_' + that.id); } }); }); } }; UndoTask.prototype.viewData = function(data){ var that = this; }; UndoTask.prototype.getCenterObject = function(){//获取跳转到中心的相关对象 var that = this; return { text:'我的待办任务', id:that.id, bsUrl:that.taskCenterUrl }; }; var task = new UndoTask(); exports('portal/vciWebProUndoTaskPortlet',task); });