| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <%@ WebHandler Language="C#" Class="tree" %>
- using System;
- using System.Web;
- using System.Web.SessionState;
- using System.Data;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using Curtain.DataAccess;
- using DK.XuWei.WebMes;
- /// <summary>
- /// 导航菜单
- /// xuwei create 2019-12-28
- /// </summary>
- public class tree : IHttpHandler, IReadOnlySessionState
- {
- public void ProcessRequest(HttpContext context)
- {
- context.Response.ContentType = "text/plain";
- using(IDataAccess conn = DataAccess.Create())
- {
- //按功能权限过滤显示树菜单(有子节点权限,不具备父节点权限,也要加进来)
- DataTable dt = conn.ExecuteDatatable(@"
- SELECT 0 AS id
- ,f.functionlevel AS code
- ,f.functionname AS text
- ,f.url AS url
- ,f.functioncode AS functioncode
- FROM tp_sys_function f
- WHERE f.is_web = '1'
- AND f.valueflag = '1'
- AND EXISTS
- (SELECT 1
- FROM (SELECT uf.functionlevel
- ,uf.functioncode
- FROM tp_mst_userright ur
- INNER JOIN tp_sys_function uf
- ON uf.functioncode = ur.functioncode
- WHERE uf.is_web = '1'
- AND uf.valueflag = '1'
- AND ur.userid = @USERID@) uu
- WHERE ((uu.functionlevel = f.functionlevel AND uu.functioncode = f.functioncode) OR
- (uu.functionlevel <> f.functionlevel AND
- uu.functionlevel LIKE f.functionlevel || '%'))
- )
- ORDER BY f.functionlevel
- ,f.functioncode
- ",
- new CDAParameter("USERID",context.Session["userId"])
- );
- //添加动态报表菜单=================================
- //使用try容错,避免没有动态报表的出错
- //try
- //{
- // DataTable dtReport = conn.ExecuteDatatable(@"
- // SELECT
- // REPORTID AS id,
- // REPORTCODE AS code,
- // REPORTNAME AS text,
- // '/mes/dr/drmain/drmain_index.html?id='||REPORTID AS url
- // FROM
- // T_MST_DR_REPORT
- // WHERE
- // VALUEFLAG = '1'
- // ORDER BY
- // REPORTCODE
- // ",
- // new CDAParameter("USERID",context.Session["userId"])
- // );
- // dt.Merge(dtReport);
- //}
- //catch
- //{
- //}
- //================================================
- string rootId = dt.Rows[0]["id"].ToString();
- string rootCode = dt.Rows[0]["code"].ToString();
- string rootText = dt.Rows[0]["text"].ToString();
- string children = Easyui.TableToEasyUITree(dt, rootCode);
- string jsonStr = "[{\"id\":\"" + rootId + "\",\"text\":\"" + rootText + "\"" + children + "}]";
- context.Response.Write(jsonStr);
- }
- }
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
|