pendingProcess.js 4.0 KB
Newer Older
doc_wei's avatar
doc_wei 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26

var taskId = "";//任务id

var taskType = "";//流程类型

var processInstanceId = "";//流程id

var sequenceId = "";//动态表单类型的流程

// 待我审批
layui.config({
	base: basePath, 
	version: skyeyeVersion
}).extend({
    window: 'js/winui.window'
}).define(['window', 'table', 'jquery', 'winui', 'form'], function (exports) {
	winui.renderColor();
	var $ = layui.$,
		table = layui.table,
		form = layui.form;

	// 待我审批
	table.render({
	    id: 'messageMyNeedDealtTable',
	    elem: '#messageMyNeedDealtTable',
	    method: 'post',
doc_wei's avatar
doc_wei 已提交
27 28
	    url: flowableBasePath + 'activitimode008',
	    where: getTableParams(),
doc_wei's avatar
doc_wei 已提交
29 30 31 32 33 34
	    even: true,
	    page: true,
		limits: getLimits(),
		limit: getLimit(),
	    cols: [[
	        { title: systemLanguage["com.skyeye.serialNumber"][languageType], type: 'numbers'},
doc_wei's avatar
doc_wei 已提交
35 36 37
	        { field: 'processInstanceId', title: '流程ID', width: 280, templet: function(d){
				return '<a lay-event="details" class="notice-title-click">' + d.processInstanceId + '</a>';
			}},
doc_wei's avatar
doc_wei 已提交
38
	        { field: 'taskType', title: '类型', width: 150 },
doc_wei's avatar
doc_wei 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
	        { field: 'createName', title: '申请人', width: 140},
	        { field: 'createTime', title: '申请时间', align: 'center', width: 140, templet: function(d){
	        	if(!isNull(d.createTime)){
		        	var str = d.createTime.toString();
		        	str = str.substring(0, str.length - 3);
		        	return date('Y-m-d H:i', str);
	        	}else{
	        		return "";
	        	}
	        }},
	        { field: 'name', title: '当前节点', width: 130, templet: function(d){
	        	return '[' + d.name + ']';
	        }},
	        { field: 'suspended', title: '状态<i id="stateDesc" class="fa fa-question-circle" style="margin-left: 5px"></i>', align: 'center', width: 130, templet: function(d){
	        	if(d.suspended){
	        		return "<span class='state-down'>挂起</span>";
	        	}else{
	        		return "<span class='state-up'>正常</span>";
	        	}
	        }},
doc_wei's avatar
doc_wei 已提交
59
	        { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 100, toolbar: '#myNeedDealtTableBar'}
doc_wei's avatar
doc_wei 已提交
60 61 62 63 64 65 66 67 68 69 70 71 72
	    ]],
	    done: function(){
	    	matchingLanguage();
	    }
	});
	
	table.on('tool(messageMyNeedDealtTable)', function (obj) {
        var data = obj.data;
        var layEvent = obj.event;
        if (layEvent === 'subTasks') { //提交任务
        	subTasks(data, obj);
        } else if (layEvent === 'details') { //详情
			activitiUtil.activitiDetails(data);
doc_wei's avatar
doc_wei 已提交
73
        }
doc_wei's avatar
doc_wei 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101
    });
	
	// 提交任务
	function subTasks(data, obj){
		taskId = data.id;
		taskType = data.taskType;
		processInstanceId = data.processInstanceId;
		_openNewWindows({
			url: "../../tpl/approvalActiviti/approvalProcess.html",
			title: "流程审批",
			pageId: "approvalProcess",
			area: ['90vw', '90vh'],
			callBack: function(refreshCode){
                if (refreshCode == '0') {
                	winui.window.msg("提交成功", {icon: 1,time: 2000});
                	loadMyNeedDealtTable();
                } else if (refreshCode == '-9999') {
                	winui.window.msg(systemLanguage["com.skyeye.operationFailed"][languageType], {icon: 2,time: 2000});
                }
			}});
	}
	
    $("body").on("click", "#stateDesc", function() {
		layer.tips('该状态分为挂机和正常,被挂机待办无法进行审批操作', $("#stateDesc"), {
			tips: [1, '#3595CC'],
			time: 4000
		});
	});
doc_wei's avatar
doc_wei 已提交
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125

	form.render();
	form.on('submit(formSearch)', function (data) {
		if (winui.verifyForm(data.elem)) {
			table.reload("messageMyNeedDealtTable", {page: {curr: 1}, where: getTableParams()});
		}
		return false;
	});

	// 刷新我的待办
	$("body").on("click", "#reloadMyNeedDealtTable", function(){
		loadMyNeedDealtTable();
	});

	function loadMyNeedDealtTable(){
		table.reload("messageMyNeedDealtTable", {where: getTableParams()});
	}

    function getTableParams(){
    	return {
    		taskName: $("#taskName").val(),
			processInstanceId: $("#processInstanceId").val()
    	};
	}
doc_wei's avatar
doc_wei 已提交
126 127 128
    
    exports('pendingProcess', {});
});