Ldc
2024-04-07 0652600959e5e3b5796fb6e8da129704ca95347a
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/**
 * 流程按钮处理
 * @author wangting
 * @date 2021-4-19
 */
layui.define(['layer','element','BaseAction'],function(exports){
    var webUtil = $webUtil;
    var Class = function() {
        this.MODELNAME = "BaseStartWorkflowAction";
        this.moduleKey = "BaseStartWorkflowAction";
 
        this.getContent = function (id) {
            var that = this;
            that.id = id;
            var html = [
                '<div class="Workflow" id="Workflow_', id, ' lay-filter="addOrEdit_', id, '" style="display:block; text-align: center"></div>'
            ].join("");
            return html;
        };
 
        this.doAction = function (options) {
            var that = this;
            webUtil.copyConfig(that, that.moduleKey);
            that.id = options.id;
 
            var paramVOS = $webUtil.paramLow(options.paramVOS);
            options.oldParamVOS=$.extend({},options.paramVOS);
            options.paramVOS=paramVOS;
            that.id=options.id;
            var selectData=options.dataStore;
            if(selectData.length<1){
                $webUtil.showErrorMsg("请选择一条需要发起流程的数据");
                return false;
            }
            if(!paramVOS.multiprocess && selectData.length > 1){
                $webUtil.showErrorMsg("仅能选择一条数据发起流程");
                return false;
            }
            if(paramVOS.checknotprocess) {
                var notprocess = paramVOS.checknotprocess.split('&');
                var checknotprocess=false;
                var msgStore={};
                layui.each(notprocess, function (i, item) {
                    for (var j=0;j<options.dataStore.lenght;j++){
                        if (options.dataStore[j][item.split('=')[0]] == item.split('=')[1]) {
                            checknotprocess=true;
                            msgStore=options.dataStore[j]
                            return false;
                        }
                    }
 
                })
                if (checknotprocess) {
                    $webUtil.showErrorMsg($webUtil.replaceFreeMarker(paramVOS.checknotprocessmsg,msgStore,{}) || '当前数据不允许发起流程');
                    return false;
                }
            }
 
            var baseAction = layui['BaseAction'];
            baseAction.callPreEvent(options, that, function (options) {
                that.doAdd(options, function () {
                    baseAction.callPostEvent(options, that, options.callback);
                });
            });
        };
 
 
        this.doAdd = function (options,callback) {
            var that = this;
            var paramVOS = options.paramVOS;
            var selectData=options.dataStore;
 
            var otherparamVOS=$.extend({},options.oldParamVOS);
            delete otherparamVOS.title;
            delete otherparamVOS.content;
            delete otherparamVOS.table;
            delete otherparamVOS.detailurl;
            delete otherparamVOS.detailUrl;
            //$webUtil.showConfirmMsg("是否发起流程?",function (r) {
                //if (r) {
                    layui.use(["process/vciWebStartProcess"], function () {
                        var startProcess = layui['process/vciWebStartProcess'];
                        startProcess.init();
                        startProcess.showStartWindow(paramVOS.processclassify, selectData, {
                            title: paramVOS.title,
                            width:paramVOS.width,
                            height:paramVOS.height,
                            checkAllowAttributeValues:'Editing',
                            allowAttributesMsg:'只有状态是【编辑中】的计划才可以发起流程',
                            startStatus: paramVOS.startstatus||'Auditing',
                            resetStatus: paramVOS.resetstatus||'Editing',
                            canUseTemplate:paramVOS.canusetemplate,
                            isMutiProcess:paramVOS.multiprocess,
                            autoProcessName:$webUtil.replaceFreeMarker(paramVOS.autoprocessname,options.dataStore,{}),
                            variablesInfo:paramVOS.variablesinfo,
                            tableDefineCode:paramVOS.table,
                            detailUrl:paramVOS.detailurl,
                            content:paramVOS.content,
                            alwaysDisplayNext:paramVOS.alwaysdisplaynext,
                            UIType:paramVOS.uitype,
                            otherParam:otherparamVOS
                        }, function (result) {
                            if (paramVOS.afterevent) {
                                var urlobj=$webUtil.getUrlParams(paramVOS.afterevent);
                                layui.use(urlobj.jsPath, function () {
                                    var pathAction = layui[urlobj.jsPath];
                                    var id = 'saveBeforeEvent_' + id;
                                    pathAction[urlobj.methodName](paramVOS, id, selectData);
                                })
                            }
                            if (callback) {
                                callback()
                            }
                            if (options.callback) {
                                options.callback()
                            }
                        });
                    });
               // }
            //});
 
        }
 
        this.refresh = function () {
            var that = this;
 
        };
 
        this.destory = function () {
            var that = this;
            var filter = "Workflow_" + that.id;
            $('#' + filter).remove()
        };
    };
    var cs = new Class();
    exports(cs.MODELNAME,cs);
});