design.html 5.3 KB
Newer Older
lakernote's avatar
lakernote 已提交
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 138 139 140 141 142
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>流程设计</title>
    <link rel="stylesheet" href="../../component/snaker/snaker.css" type="text/css" media="all"/>
</head>
<body class="pear-container">
<div id="toolbox">
    <div id="toolbox_handle">工具集</div>
    <div class="node" id="save"><img src="../../component/snaker/images/save.gif"/>&nbsp;&nbsp;保存</div>
    <div>
        <hr/>
    </div>
    <div class="node selectable" id="pointer">
        <img src="../../component/snaker/images/select16.gif"/>&nbsp;&nbsp;Select
    </div>
    <div class="node selectable" id="path">
        <img src="../../component/snaker/images/16/flow_sequence.png"/>&nbsp;&nbsp;transition
    </div>
    <div>
        <hr/>
    </div>
    <div class="node state" id="start" type="start"><img
            src="../../component/snaker/images/16/start_event_empty.png"/>&nbsp;&nbsp;start
    </div>
    <div class="node state" id="end" type="end"><img
            src="../../component/snaker/images/16/end_event_terminate.png"/>&nbsp;&nbsp;end
    </div>
    <div class="node state" id="task" type="task"><img
            src="../../component/snaker/images/16/task_empty.png"/>&nbsp;&nbsp;task
    </div>
    <div class="node state" id="task" type="custom"><img
            src="../../component/snaker/images/16/task_empty.png"/>&nbsp;&nbsp;custom
    </div>
    <div class="node state" id="task" type="subprocess"><img
            src="../../component/snaker/images/16/task_empty.png"/>&nbsp;&nbsp;subprocess
    </div>
    <div class="node state" id="fork" type="decision"><img
            src="../../component/snaker/images/16/gateway_exclusive.png"/>&nbsp;&nbsp;decision
    </div>
    <div class="node state" id="fork" type="fork"><img
            src="../../component/snaker/images/16/gateway_parallel.png"/>&nbsp;&nbsp;fork
    </div>
    <div class="node state" id="join" type="join"><img
            src="../../component/snaker/images/16/gateway_parallel.png"/>&nbsp;&nbsp;join
    </div>
</div>

<div id="properties">
    <div id="properties_handle">属性</div>
    <table class="properties_all" cellpadding="0" cellspacing="0">
    </table>
    <div>&nbsp;</div>
</div>

<div id="snakerflow"></div>


<script src="../../component/layui/layui.js"></script>
<script src="../../component/pear/pear.js"></script>


<script src="../../component/snaker/raphael-min.js" type="text/javascript"></script>
<script src="../../component/snaker/jquery-ui-1.8.4.custom/js/jquery.min.js" type="text/javascript"></script>
<script src="../../component/snaker/jquery-ui-1.8.4.custom/js/jquery-ui.min.js" type="text/javascript"></script>
<script src="../../component/snaker/dialog.js" type="text/javascript"></script>
<script src="../../component/snaker/snaker.designer.js" type="text/javascript"></script>
<script src="../../component/snaker/snaker.model.js" charset="utf-8" type="text/javascript"></script>
<script src="../../component/snaker/snaker.editors.js" type="text/javascript"></script>
<script>
    layui.use(['table', 'form', 'jquery', 'common', 'easyAdmin'], function () {
        let easyAdmin = layui.easyAdmin;
        id = getQueryString("processId");
        easyAdmin.httpGet("/flow/process/modelJson?processId=" + id, function (data) {
            var model = "";
            if (data) {
                model = eval("(" + data + ")");
            }
            var userJson = {};
            easyAdmin.httpGet("/sys/user/getAll", function (result) {
                if (result.success) {
                    userJson = result.data;
                }
            }, true, false);
            $('#snakerflow').snakerflow({
                basePath: "../../component/snaker/",
                ctxPath: "/",
                restore: model,
                userJson: userJson,
                formPath: "forms/",
                tools: {
                    save: {
                        onclick: function (data) {
                            // alert(data);
                            saveModel(data);
                        }
                    }
                }
            });
        });


        function getQueryString(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
            var r = window.location.search.substr(1).match(reg);
            if (r !== null)
                return unescape(r[2]);
            return "";
        }


        window.saveModel = function (data) {
            easyAdmin.http({
                type: 'POST',
                url: "/flow/process/deployXml",
                data: "model=" + data + "&id=" + id,
                async: false,
                globle: false,
                error: function () {
                    alert('数据处理错误!');
                    return false;
                },
                success: function (data) {
                    if (data == true) {
                        parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                        parent.layui.table.reload("user-table");
                    } else {
                        layer.msg("没有修改权限哦!flow.update", {
                            icon: 2,
                            time: 1000,
                            area: ['300px', '65px']
                        });
                    }
                }
            });

        }
    })
</script>
</body>
</html>