| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- /**
- *
- * @param modelId
- * 流程模版id
- * @param flowInsId
- * 数据流程实例id
- * @param modelName
- * 流程模版名称
- * @param userName
- * 当前用户
- */
- function startFlow(modelId, flowInsId, modelName, userName) {
- // var defaultName = '流程:'+ modelName + "(" + getDate() + "
- // ${session.name})";
- var flag = false;
- $.ajax({
- url : "bpmDataCenterAction.do?task=preToStart&flowInsId=" + flowInsId
- + "&time=" + new Date().getTime(),
- async : false,
- type : "post",
- dataType : 'json',
- success : function(data) {
- if (data) {
- var state = data.state; //数据状态(0:未报销/付款,1:已报销/付款,2:报销/付款中)
- var remain_amount =data.remain_amount; //未付款
- var dateType = data.dateType; //数据类型(1加班;2:申购;3:出差,4:付款,5:报销)
- if (state == "" || state == "0") {
- flag = true;
- } else if (state == "1") {
- if(dateType == "2" || dateType == "1"){ //如果是申购流程,判断是否已经全额付款
- if(remain_amount <= 0){
- flag = false;
- alert("该记录已完成全部报销,不能重复发起");
- }else{
- flag = true;
- }
- }else{
- flag = false;
- alert("该记录已发起过流程,不能重复发起");
- }
-
- return;
- }
- } else {
- alert("发起流程失败!");
- return;
- }
- },
- error : function() {
- alert("数据处理失败,请检查网络重新登录或联系管理员!");
- return;
- }
- });
- if (!flag) {
- return;
- }
- var defaultName = userName + getCurentDate() + modelName;
- $("input[type='text']:first").focus();
- $.ligerDialog.prompt('流程标题', defaultName, function(yes, value) {
- if (yes) {
- if ($.trim(value) == '') {
- addError("流程标题不能为空!");
- return;
- }
- if ($.trim(value).length > 100) {
- addError("流程标题不能超过100个字!");
- return;
- }
- value = value.replace("#", "%23");
- var dialogId = modelId + new Date().getTime();
- openODialog(
- '${pageContext.request.contextPath }/FlowAction.do?task=toStart&modelId='
- + modelId + '&tabid=' + getCurrentTabId()
- + '&modelName=' + value + '&dialogId=' + dialogId
- + '&flowInsId=' + flowInsId, '流程发起', dialogId);
- }
- });
- }
- function getCurentDate() {
- var now = new Date();
- var year = now.getFullYear(); // 年
- var month = now.getMonth() + 1; // 月
- var day = now.getDate(); // 日
- // var hh = now.getHours(); //时
- // var mm = now.getMinutes(); //分
- var clock = year + "-";
- if (month < 10)
- clock += "0";
- clock += month + "-";
- if (day < 10)
- clock += "0";
- clock += day;
- // if(hh < 10)
- // clock += "0";
- // clock += hh + ":";
- // if (mm < 10) clock += '0';
- // clock += mm;
- return (clock);
- }
|