<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ModelItems_Action.aspx.cs" Inherits="eFrameWork.Manage.ModelItems_Action" %>
<script>
    function insertSimpleScript(id) {


        var _style = 'display:inline-block;padding:2px 8px 2px 8px;min-width:60px;text-align:center;border: 1px dashed #ccc;margin:6px 6px 0px 0px;';
        var html = '<div style="margin:10px;line-height:20px;">';


        html += '<div style="font-size:16px;">变量</div>';


       


        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'var a = ;\');">插入变量</a>';

        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'跳转URL(&quot;url&quot;,&quot;标题&quot;);\');">跳转URL</a>';

        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'取URL参数(&quot;ID&quot;);\');">取URL参数</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'取表单值(&quot;ID&quot;);\');">取表单值</a>';


        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'已选数据行(&quot;过滤条件&quot;);\');">已选数据行</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'所有数据行(&quot;禁选条件&quot;);\');">所有数据行</a>';    
       
       
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'恢复选择状态(数组名);\');">恢复选择状态</a>';

        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'var ids =获取选中行(&quot;act&quot;);\');">获取选中行</a>';

        
        html += '<div style="font-size:16px;margin-top:8px;">逻辑</div>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'停止执行();\');">停止执行</a>';


        html += '<div style="font-size:16px;margin-top:8px;">提示</div>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'询问(&quot;询问内容&quot;);\');">询问</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'弹出消息(消息内容);\');">弹出消息</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'显示完成数据(变量名);\');">显示完成数据</a>';



        html += '<div style="font-size:16px;margin-top:8px;">事件</div>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'文档加载完毕{\\n\\n});\');">文档加载完毕</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'列表选择时{\\n\\n};\');">列表选择时</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'保存前校验(frm){\\n\\nreturn true;\\n};\');">保存前校验</a>';

        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'扫码回调(code,obj){\\n\\n};\');">扫码回调</a>';



        html += '<div style="font-size:16px;margin-top:8px;">数组</div>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'循环数组(数组名){\\n\\n});\');">循环数组</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'数组填充到模块(数组名,&quot;模块ID&quot;);\');">数组填充到模块</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'数组筛选(数组名,&quot;所需字段&quot;);\');">数组筛选</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'数组加入字段(数组名,&quot;字段名&quot;,&quot;字段值&quot;);\');">数组加入字段</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'数组字段重命名(数组名,&quot;字段名&quot;,&quot;新字段名&quot;);\');">数组字段重命名</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'数组删除字段(数组名,&quot;字段名&quot;);\');">数组删除字段</a>';


        html += '<div style="font-size:16px;margin-top:8px;">数据交互</div>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'加载数据集(&quot;ID&quot;);\');">加载数据集</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'写选择状态(&quot;数据源&quot;,&quot;表名&quot;,数组名);\');">写选择状态</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'读选择状态(&quot;数据源&quot;,&quot;表名&quot;,数组名);\');">读选择状态</a>';

        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'读选择数据数量(&quot;数据源&quot;,&quot;表名&quot;,&quot;条件&quot;,&quot;分组&quot;);\');">读选择数据数量</a>';


        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'写表(&quot;数据源&quot;,&quot;表名&quot;,[{a:&quot;a&quot;}]);\');">写表</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'存储过程-返回对象(&quot;数据源&quot;,&quot;存储过程名&quot;,&quot;参数&quot;);\');">存储过程-返回对象</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'存储过程-返回数组(&quot;数据源&quot;,&quot;存储过程名&quot;,&quot;参数&quot;);\');">存储过程-返回数组</a>';

        html += '<div style="font-size:16px;margin-top:8px;">交互</div>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'维护数据(&quot;地址&quot;,&#34;标题&#34;,&#34;600px&#34;,&#34;480px&#34;);\');">维护数据</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'执行动作(&quot;参数&quot;);\');">执行动作</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'重新加载数据();\');">重新加载数据</a>';

        //html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'全屏模式();\');">全屏模式</a>';
        //html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'退出全屏();\');">退出全屏</a>';

        html += '<div style="font-size:16px;margin-top:8px;">子模块</div>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'子模块行数(&quot;子模块ID&quot;);\');">行数</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'子模块最大值(&quot;子模块ID&quot;,&quot;字段ID&quot;);\');">最大值</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'子模块最小值(&quot;子模块ID&quot;,&quot;字段ID&quot;);\');">最小值</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'子模块平均值(&quot;子模块ID&quot;,&quot;字段ID&quot;);\');">平均值</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'子模块汇总(&quot;子模块ID&quot;,&quot;字段ID&quot;);\');">汇总</a>';
        html += '<a href="javascript:;" style="' + _style + '" onclick="addHtmlTag(\'' + id + '\',\'子模块清空(&quot;子模块ID&quot;);\');">清空</a>';
        //执行动作 

        html += '</div>';
        layer.open({
            type: 1, //此处以iframe举例
            title: '插入函数', // + "窗口"
            shadeClose: true, //点击遮罩关闭层
            area: ["60%", "550px"],
            btnAlign: 'l', //lcr
            moveType: 0, //拖拽模式，0或者1
            content: html,
            btn: ['取消'],
            yes: function (index, layero) {
                layer.close(index);
            }
        });
    };
</script>
<asp:Repeater id="Rep" runat="server" >
<headertemplate>
<%#
"<table id=\"eDataTable\" class=\"eDataTable\" border=\"0\" cellpadding=\"0\" cellspacing=\"1\" width=\"99%\" style=\"margin-bottom:8px;\">" +
"<thead>" +
"<tr>" +
"<td height=\"25\" width=\"35\" align=\"center\"><a title=\"添加动作\" href=\"javascript:;\" onclick=\"addAction(this);\"><img width=\"16\" height=\"16\" src=\"images/add.png\" border=\"0\"></a></td>" +
"<td width=\"50\">启用</td>" +
"<td width=\"105\">名称" + (eConfig.showHelp() ? "<img src=\"images/help.gif\" align=\"absmiddle\" border=\"0\" onclick=\"showHelp(124);\" title=\"查看帮助\" alt=\"查看帮助\" style=\"cursor:pointer;margin-bottom:4px;\">" : "") + "</td>" +
"<td width=\"105\">编码" + (eConfig.showHelp() ? "<img src=\"images/help.gif\" align=\"absmiddle\" border=\"0\" onclick=\"showHelp(125);\" title=\"查看帮助\" alt=\"查看帮助\" style=\"cursor:pointer;margin-bottom:4px;\">" : "") + "</td>" +
"<td width=\"105\">步骤</td>" +
"<td width=\"105\">数据源</td>" +
"<td>执行SQL" + (eConfig.showHelp() ? "<img src=\"images/help.gif\" align=\"absmiddle\" border=\"0\" onclick=\"showHelp(126);\" title=\"查看帮助\" alt=\"查看帮助\" style=\"cursor:pointer;margin-bottom:4px;\">" : "") + "</td>" +
"</tr>" +
"</thead>"
%>
</headertemplate>
<itemtemplate>
<%#
"<tr>" +
"<td height=\"26\" align=\"center\" style=\"padding-right:0;\"><a title=\"删除动作\" href=\"javascript:;\" onclick=\"delAction(this,'" + Eval("ActionID") + "');\"><img width=\"16\" height=\"16\" src=\"images/del.png\" border=\"0\"></a></td>" +
"<td  class=\"tdshowexport\"><input reloadbak=\"true\" type=\"checkbox\" onclick=\"setAction(this,'" + Eval("ActionID") + "','isOpen');\"" + (eBase.parseBool(Eval("isOpen")) ? " checked" : "") + " /></td>" +
"<td><input class=\"text\" type=\"text\" value=\"" + Eval("MC").ToString() + "\" oldvalue=\"" + Eval("MC").ToString() + "\" onBlur=\"setAction(this,'" + Eval("ActionID") + "','mc');\"></td>" +
"<td><input class=\"text\" type=\"text\" value=\"" + Eval("Action").ToString() + "\" oldvalue=\"" + Eval("Action").ToString() + "\" onBlur=\"setAction(this,'" + Eval("ActionID") + "','action');\"></td>" +
"<td>" +
"<select onChange=\"setAction(this,'" + Eval("ActionID") + "','stepmodelid');\" style=\"width:90px;\">"+
"<option value=\"NULL\">无</option>" +
 eBase.DataBase.getOptions("select MC,ModelID from a_eke_sysModels where delTag=0 and Type=8 and ParentID='" + modelid + "'", "MC", "ModelID", Eval("StepModelID").ToString()) + 
"<select>"+
"</td>"+
"<td>"+
"<select onChange=\"setAction(this,'" + Eval("ActionID") + "','DataSourceID');\" style=\"width:90px;\">"+
"<option value=\"\">无</option>"+
"<option value=\"maindb\"" + (Eval("DataSourceID").ToString()=="maindb" ? " selected=\"true\"" : "") + ">主库</option>"+
eBase.DataBase.getOptions("SELECT DataSourceID as value,MC as text FROM a_eke_sysDataSources where delTag=0 order by addTime", "text", "value", Eval("DataSourceID").ToString())+
"<select>"+
"</td>"+
"<td><textarea oldvalue=\""+ Eval("SQL").ToString().HtmlEncode() + "\" style=\"width:90%;\" rows=\"2\" onBlur=\"setAction(this,'" + Eval("ActionID") + "','sql');\">" + Eval("SQL").ToString().HtmlEncode() + "</textarea></td>" +
"</tr>"
%>
</itemtemplate>
<footertemplate><%#"</table>"%></footertemplate>
</asp:Repeater>


<h3>按钮</h3>

<asp:Repeater id="Repbtns" runat="server" >
<headertemplate>
<table id="eDataTable" class="eDataTable" border="0" cellpadding="0" cellspacing="1" width="99%" style="margin-bottom:8px;">
<thead>
<tr>
<td height="25" width="35" align="center"><a title="添加按钮" href="javascript:;" onclick="addButton(this);"><img width="16" height="16" src="images/add.png" border="0"></a></td>
<td width="30" align="center">编号</td>
<td width="100">文字</td>
<td width="100">权限 </td>
<td width="130">启用动作</td>
<td width="130">禁用动作</td>
<td width="160">连接</td>
<td>执行方法</td>
</tr>
</thead>
<tbody>
</headertemplate>
<itemtemplate><tr>
<td height="25" align="center" style="padding-right:0;"><a title="删除按钮" href="javascript:;" onclick="delButton(this,'<%#  Eval("buttonID")%>');"><img width="16" height="16" src="images/del.png" border="0"></a></td>
<td align="center"><%# Eval("num").ToString() %></td>
<td><input class="text" type="text" value="<%# Eval("Text").ToString() %>" oldvalue="<%# Eval("Text").ToString() %>" onBlur="setButton(this,'<%# Eval("ButtonID").ToString() %>','text');"></td>
<td><select onChange="setButton(this,'<%#  Eval("buttonID")%>','Power');" style="width:90px;">
<option value="NULL">不限</option>
<%#getPowerOption(Eval("Power").ToString()) %>
<select>
</td>
<td><input class="text" type="text" value="<%# Eval("Action").ToString() %>" oldvalue="<%# Eval("Action").ToString() %>" onBlur="setButton(this,'<%# Eval("ButtonID").ToString() %>','Action');"></td>
<td><input class="text" type="text" value="<%# Eval("DisabledAction").ToString() %>" oldvalue="<%# Eval("DisabledAction").ToString() %>" onBlur="setButton(this,'<%# Eval("ButtonID").ToString() %>','DisabledAction');"></td>
<td><input class="text" type="text" value="<%# Eval("Link").ToString() %>" oldvalue="<%# Eval("Link").ToString() %>" onBlur="setButton(this,'<%# Eval("ButtonID").ToString() %>','Link');"></td>
<td><textarea id="jsarea<%# Eval("ButtonID").ToString().Substring(0,2) %>" oldvalue="<%# Eval("SimpleJS").ToString().HtmlEncode()%>" style="width:90%;" rows="4" onBlur="setButton(this,'<%# Eval("ButtonID") %>','SimpleJS');"><%# Eval("SimpleJS").ToString().HtmlEncode()%></textarea><a href="javascript:;" onclick="insertSimpleScript('jsarea<%# Eval("ButtonID").ToString().Substring(0,2) %>');">插入脚本</a></td>
</tr></itemtemplate>
<footertemplate></tbody>
</table></footertemplate>
</asp:Repeater>

<h3>初始方法</h3>
<textarea id="readySimpleJS" oldvalue="<%=ModelInfo["readySimpleJS"].ToString().HtmlEncode()%>" style="width:90%;" rows="20" onBlur="setModel(this,'readySimpleJS');"><%=ModelInfo["readySimpleJS"].ToString().HtmlEncode()%></textarea><a href="javascript:;" onclick="insertSimpleScript('readySimpleJS');">插入脚本</a>