pendingProcess.js 3.7 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
	    even: true,
	    page: true,
		limits: getLimits(),
		limit: getLimit(),
	    cols: [[
34
	        { 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 39 40 41 42 43 44 45 46
	        { field: 'taskType', title: '类型', width: 150, templet: function (d) {
				return d.processMation.title;
			}},
	        { field: 'createName', title: '申请人', width: 120, templet: function (d) {
				return d.processMation.createName;
			}},
	        { field: 'createTime', title: '申请时间', align: 'center', width: 150, templet: function (d) {
				return d.processMation.createTime;
			}},
W
weizhiqiang 已提交
47
	        { field: 'name', title: '当前节点', width: 130, templet: function (d) {
doc_wei's avatar
doc_wei 已提交
48 49
	        	return '[' + d.name + ']';
	        }},
W
weizhiqiang 已提交
50
	        { 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 已提交
51 52
	        	if(d.suspended){
	        		return "<span class='state-down'>挂起</span>";
doc_wei's avatar
doc_wei 已提交
53
	        	} else {
doc_wei's avatar
doc_wei 已提交
54 55 56
	        		return "<span class='state-up'>正常</span>";
	        	}
	        }},
doc_wei's avatar
doc_wei 已提交
57
	        { title: systemLanguage["com.skyeye.operation"][languageType], fixed: 'right', align: 'center', width: 100, toolbar: '#myNeedDealtTableBar'}
doc_wei's avatar
doc_wei 已提交
58
	    ]],
W
weizhiqiang 已提交
59
	    done: function(json) {
doc_wei's avatar
doc_wei 已提交
60 61 62 63 64 65 66 67 68 69 70
	    	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 已提交
71
        }
doc_wei's avatar
doc_wei 已提交
72
    });
doc_wei's avatar
doc_wei 已提交
73

doc_wei's avatar
doc_wei 已提交
74 75 76 77 78 79
	// 提交任务
	function subTasks(data, obj){
		taskId = data.id;
		taskType = data.taskType;
		processInstanceId = data.processInstanceId;
		_openNewWindows({
doc_wei's avatar
doc_wei 已提交
80
			url: "../../tpl/approvalActiviti/approvalProcessTask.html",
doc_wei's avatar
doc_wei 已提交
81 82 83
			title: "流程审批",
			pageId: "approvalProcess",
			area: ['90vw', '90vh'],
W
weizhiqiang 已提交
84
			callBack: function (refreshCode) {
85 86
				winui.window.msg("提交成功", {icon: 1, time: 2000});
				loadMyNeedDealtTable();
doc_wei's avatar
doc_wei 已提交
87 88 89 90 91 92 93 94 95
			}});
	}
	
    $("body").on("click", "#stateDesc", function() {
		layer.tips('该状态分为挂机和正常,被挂机待办无法进行审批操作', $("#stateDesc"), {
			tips: [1, '#3595CC'],
			time: 4000
		});
	});
doc_wei's avatar
doc_wei 已提交
96 97 98 99

	form.render();
	form.on('submit(formSearch)', function (data) {
		if (winui.verifyForm(data.elem)) {
100
			table.reloadData("messageMyNeedDealtTable", {page: {curr: 1}, where: getTableParams()});
doc_wei's avatar
doc_wei 已提交
101 102 103 104 105
		}
		return false;
	});

	// 刷新我的待办
doc_wei's avatar
doc_wei 已提交
106
	$("body").on("click", "#reloadMyNeedDealtTable", function() {
doc_wei's avatar
doc_wei 已提交
107 108 109 110
		loadMyNeedDealtTable();
	});

	function loadMyNeedDealtTable(){
111
		table.reloadData("messageMyNeedDealtTable", {where: getTableParams()});
doc_wei's avatar
doc_wei 已提交
112 113
	}

W
weizhiqiang 已提交
114
    function getTableParams() {
doc_wei's avatar
doc_wei 已提交
115 116 117 118 119
    	return {
    		taskName: $("#taskName").val(),
			processInstanceId: $("#processInstanceId").val()
    	};
	}
doc_wei's avatar
doc_wei 已提交
120 121 122
    
    exports('pendingProcess', {});
});