pendingProcess.js 3.5 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'},
W
weizhiqiang 已提交
35
	        { field: 'processInstanceId', title: '流程ID', width: 280, templet: function (d) {
doc_wei's avatar
doc_wei 已提交
36 37
				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
	        { field: 'createName', title: '申请人', width: 120},
	        { field: 'createTime', title: '申请时间', align: 'center', width: 150 },
W
weizhiqiang 已提交
41
	        { field: 'name', title: '当前节点', width: 130, templet: function (d) {
doc_wei's avatar
doc_wei 已提交
42 43
	        	return '[' + d.name + ']';
	        }},
W
weizhiqiang 已提交
44
	        { field: 'suspended', title: '状态<i id="stateDesc" class="fa fa-question-circle" style="margin-left: 5px"></i>', align: 'center', width: 130, templet: function (d) {
doc_wei's avatar
doc_wei 已提交
45 46
	        	if(d.suspended){
	        		return "<span class='state-down'>挂起</span>";
doc_wei's avatar
doc_wei 已提交
47
	        	} else {
doc_wei's avatar
doc_wei 已提交
48 49 50
	        		return "<span class='state-up'>正常</span>";
	        	}
	        }},
doc_wei's avatar
doc_wei 已提交
51
	        { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 100, toolbar: '#myNeedDealtTableBar'}
doc_wei's avatar
doc_wei 已提交
52 53 54 55 56 57 58 59 60 61 62 63 64
	    ]],
	    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 已提交
65
        }
doc_wei's avatar
doc_wei 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78
    });
	
	// 提交任务
	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){
79 80
				winui.window.msg("提交成功", {icon: 1, time: 2000});
				loadMyNeedDealtTable();
doc_wei's avatar
doc_wei 已提交
81 82 83 84 85 86 87 88 89
			}});
	}
	
    $("body").on("click", "#stateDesc", function() {
		layer.tips('该状态分为挂机和正常,被挂机待办无法进行审批操作', $("#stateDesc"), {
			tips: [1, '#3595CC'],
			time: 4000
		});
	});
doc_wei's avatar
doc_wei 已提交
90 91 92 93 94 95 96 97 98 99

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

	// 刷新我的待办
doc_wei's avatar
doc_wei 已提交
100
	$("body").on("click", "#reloadMyNeedDealtTable", function() {
doc_wei's avatar
doc_wei 已提交
101 102 103 104 105 106 107 108 109 110 111 112 113
		loadMyNeedDealtTable();
	});

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

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