WorkflowHtml2Json.jsp 12.5 KB
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="weaver.general.Util" %>
<%@ include file="/systeminfo/init_wev8.jsp" %>
<jsp:useBean id="rs" class="weaver.conn.RecordSet" scope="page"/>
<%@ taglib uri="/WEB-INF/weaver.tld" prefix="wea" %>
<HTML>
<HEAD>
    <LINK href="/css/Weaver_wev8.css" type=text/css rel=STYLESHEET>
    <SCRIPT language="javascript" src="/js/weaver_wev8.js"></script>
    <link rel="stylesheet" href="/css/ecology8/request/requestTopMenu_wev8.css" type="text/css"/>
    <link rel="stylesheet" href="/wui/theme/ecology8/jquery/js/zDialog_e8_wev8.css" type="text/css"/>
    <script type="text/javascript" src="/js/dragBox/parentShowcol_wev8.js"></script>
    <link rel="stylesheet" href="/css/ecology8/request/requestView_wev8.css" type="text/css"/>
    <link rel="stylesheet" href="/wui/theme/ecology8/weaveredittable/css/WeaverEditTable_wev8.css">
    <script src="/wui/theme/ecology8/weaveredittable/js/WeaverEditTable_wev8.js"></script>
    <link href="/js/checkbox/jquery.tzCheckbox_wev8.css" type=text/css rel=STYLESHEET>
    <script type="text/javascript" src="/js/ecology8/jNice/jNice/jquery.jNice_wev8.js"></script>
    <%!
        public String replaceStr(String str) {
            if (str != null) {
                str = str.replace("<", "&lt;");
                str = str.replace(">", "&gt;");
            }
            return str;
        }
    %>
    <%
        //判断只有管理员才有权限
        int userid = user.getUID();
        if (userid != 1) {
            response.sendRedirect("/notice/noright.jsp");
            return;
        }
        String workflow_name = Util.null2String(request.getParameter("workflow_name"));
        String isactive = Util.null2String(request.getParameter("isactive"));

    %>
    <script type="text/javascript">
        jQuery(document).ready(function () {
            jQuery("td[_samepair='rulelist']").css("padding", "0px!important");
        });
    </script>
</head>
<%

    String imagefilename = "/images/hdMaintenance_wev8.gif";
    String titlename = "批量转换json";
    String navName = java.net.URLDecoder.decode(Util.null2String(request.getParameter("navName")), "UTF-8");

%>
<BODY>
<%@ include file="/systeminfo/TopTitle_wev8.jsp" %>
<%@ include file="/systeminfo/RightClickMenuConent_wev8.jsp" %>
<%
    RCMenu += "{批量替换,javascript:change2JsonBanth(),_self} ";
    RCMenuHeight += RCMenuHeightStep;

    String PageConstId = "WorkflowHtml2Json";

    String backfields = "tn.id,tn.syspath,workflowname,nodename,isactive,htmlparsescheme";
    String fromSql = "workflow_nodehtmllayout tn,workflow_base wb,workflow_nodebase wn";
    String sqlWhere = "tn.workflowid=wb.id and tn.nodeid=wn.id and( tn.htmlparsescheme is null or tn.htmlparsescheme=0)";
    if (!"".equals(workflow_name)) {
        sqlWhere += " and wb.workflowname like '%" + workflow_name + "%'";
    }
    if (!"".equals(isactive)) {
        sqlWhere += " and isactive=" + isactive;
    }
    String orderby = "tn.id,wb.id,tn.nodeid";
    String tableStringrule = "<table instanceid=\"WorkflowHtml2Json\" tabletype=\"checkbox\" pagesize=\"" + PageIdConst.getPageSize(PageConstId, user.getUID()) + "\" >" +
            "	   <sql backfields=\"" + backfields + "\" sqlform=\"" + fromSql + "\"  sqlorderby=\"" + orderby + "\" sqlwhere=\"" + Util.toHtmlForSplitPage(sqlWhere) + "\"    sqlprimarykey=\"wn.id\" sqlsortway=\"asc\"/>" +
            "			<head>";
    tableStringrule += "<col width=\"10%\"  text=\"标识\" column=\"id\" orderkey=\"id\" display=\"false\"/>" +
            "<col width=\"20%\"  text=\"流程名称\" column=\"workflowname\" orderkey=\"workflowname\" />" +
            "<col width=\"20%\"  text=\"节点名称\" column=\"nodename\" orderkey=\"nodename\" />" +
            "<col width=\"40%\"  text=\"HTML路径\" column=\"syspath\" orderkey=\"syspath\" />" +
            "<col width=\"10%\"  text=\"文件状态\" column=\"isactive\" orderkey=\"isactive\" transmethod=\"weaver.templetecheck.filecheck.FileCheckReport.getHtmlLayoutResult\"/>" +
            "</head>" +
            "<operates>" +
            "		<operate href=\"javascript:change2Json();\" text=\"转换\" index=\"0\" otherpara=\"column:id\"/>" +
            "</operates></table>";
%>
<%@ include file="/systeminfo/RightClickMenu_wev8.jsp" %>

<form action="WorkflowHtml2Json.jsp" method="post" name="form1" id="form1">
    <jsp:include page="/systeminfo/commonTabHead.jsp">
        <jsp:param name="mouldID" value="check"/>
        <jsp:param name="navName" value="<%=titlename %>"/>
    </jsp:include>
    <table id="topTitle" cellpadding="0" cellspacing="0">
        <tr>
            <td></td>
            <td class="rightSearchSpan" style="text-align:right; width:500px!important">
                <input type="button" value="批量转换" style="width:100%;max-width:120px!important;" class="e8_btn_top"
                       onclick="change2JsonBanth()"/>
                <span id="advancedSearch" class="advancedSearch">高级搜索</span>&nbsp;&nbsp;
                <span title="菜单" class="cornerMenu"></span>

            </td>
        </tr>
    </table>
    <div id="tabDiv">
        <span style="font-size:14px;font-weight:bold;"><%=titlename %></span>
    </div>

    <div class="cornerMenuDiv"></div>
    <div class="advancedSearchDiv" id="advancedSearchDiv">
        <wea:layout type="4col">
            <wea:group context="高级搜索">
                <wea:item>流程名称</wea:item>
                <wea:item><input type="text" name="workflow_name" value="<%=workflow_name%>"></wea:item>
                <wea:item>文件状态</wea:item>
                <wea:item>
                    <select value="0" name="isactive">
                        <option value="" selected></option>
                        <option value="0" <%if ("0".equals(isactive)) {%> selected<%}%>>未使用</option>
                        <option value="1" <%if ("1".equals(isactive)) {%> selected<%}%>>使用中</option>
                    </select>
                </wea:item>
            </wea:group>
            <wea:group context="" attributes="{'groupDisplay':'none'}">
                <wea:item type="toolbar">
                    <input type="submit" onclick="doRefresh()" value="搜索" class="zd_btn_submit"/>
                    <input type="button" value="重置" class="e8_btn_cancel" onclick="resetCondtion();"/>
                    <input type="button" value="取消" class="e8_btn_cancel" id="cancel"/>
                </wea:item>
            </wea:group>
        </wea:layout>
    </div>

    <TABLE width="100%">
        <tr>
            <td valign="top">
                <input type="hidden" name="pageId" id="pageId" value="WorkflowHtml2Json"/>
                <wea:SplitPageTag tableString="<%=tableStringrule %>" isShowTopInfo="true" mode="run"/>
            </td>
        </tr>
    </TABLE>
    <input name="workflow_name" value="<%=workflow_name%>" type="hidden"/>
    <input name="isactive" value="<%=isactive%>" type="hidden"/>
    <input type="hidden" name="navName" value="<%=navName%>"/>
</form>
<div id="message_table_Div2" class="xTable_message"
     style="display: none; position: absolute; top: 203px; left: 787.5px;">正在加载数据,请稍候...
</div>

<iframe id="excels" src="" style="display:none"></iframe>
</BODY>
</HTML>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDialog_wev8.js"></script>
<script language="javascript" src="/wui/theme/ecology8/jquery/js/zDrag_wev8.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(parent.document.getElementById("objName")).html("<%=navName %>");
        $("#tableitem").removeClass("fieldName");

        $("#topTitle").topMenuTitle({searchFn: doRefresh});
        $(".topMenuTitle td:eq(0)").html($("#tabDiv").html());
        $("#tabDiv").remove();

    });


    function change2JsonBanth() {
        var nodehtmllayoutids= _xtable_CheckedCheckboxId();
        var replacetype = "0";
        if(nodehtmllayoutids=="") {
            replacetype = "0";
        } else {
            replacetype = "1";
        }
        try {
            if(replacetype == "0"){
                top.Dialog.alert("提示:请选择需要转换的流程?");
            }else{
                top.Dialog.confirm("提示:确认转换?",function(){
                        $.ajax({
                            url: 'WorkflowReportOperation.jsp',
                            dataType: 'json',
                            type: 'post',
                            ayc:false,//同步加载
                            data: {
                                'operation': 'convert2json',
                                'nodehtmllayoutid': nodehtmllayoutids
                            },
                            success: function (data) {
                                if (data) {
                                    var res = data.status;
                                    if (res == "true") {
                                        top.Dialog.alert("转换成功");
                                        _table.reLoad();
                                        return;
                                    } else {
                                        top.Dialog.alert(data.msg);
                                        return;
                                    }
                                }
                            }
                        });
                    }
                );
            }
        } catch (e) {
           alert(e);
        }
    }

    function change2Json(nodehtmllayoutid) {
        try {
            top.Dialog.confirm("提示:确认转换?",
                function () {
                    $.ajax({
                        url: 'WorkflowReportOperation.jsp',
                        dataType: 'json',
                        type: 'post',
                        data: {
                            'operation': 'convert2json',
                            'nodehtmllayoutid': nodehtmllayoutid
                        },
                        success: function (data) {
                            if (data) {
                                var res = data.status;
                                if (res == "true") {
                                    _table.reLoad();
                                    return;
                                } else {
                                    top.Dialog.alert("转换失败");
                                    return;
                                }
                            }
                        }
                    });
                }, function () {
                }
            );
        } catch (e) {

        }
    }

    var dialog = null;

    function closeDialog() {
        if (dialog)
            dialog.close();
    }

    var dWidth = 600;
    var dHeight = 500;

    function doOpen(url, title) {
        if (typeof dialog == 'undefined' || dialog == null) {
            dialog = new window.top.Dialog();
        }
        dialog.currentWindow = window;
        dialog.Title = title;
        dialog.Width = dWidth || 500;
        dialog.Height = dWidth || 300;
        dialog.Drag = true;
        dialog.maxiumnable = true;
        dialog.URL = url;
        try {
            dialog.show();
        } catch (e) {

        }

    }

    function dodelete(flageids) {
        if (flageids == undefined || "" == flageids) {
            top.Dialog.alert("请选择记录!");
            return;
        }
        //flageids = ","+flageids+",";
        try {
            top.Dialog.confirm("提示:是否确认删除?",
                function () {
                    $.ajax({
                        url: 'RuleOperation.jsp?method=delete',
                        dataType: 'json',
                        type: 'post',
                        data: {
                            'flageid': "" + flageids,
                            'rulefrom': "workflow"
                        },
                        success: function (data) {
                            if (data) {
                                var res = data.status;
                                if (res == "ok") {
                                    _table.reLoad();
                                    return;
                                } else {
                                    top.Dialog.alert("删除失败");
                                    return;
                                }
                            }
                        }
                    });
                }, function () {
                }
            );
        } catch (e) {

        }
    }

    function doRefresh() {
        $("#form1").attr("action", "WorkflowHtml2Json.jsp");
        $("#form1").submit();
    }
</script>