模板功能的实现

模板功能总体设计如下:

1.    模板管理:

添加模板管理模块。模板管理实现查询新增删除模板功能,能分配模板使用权限给相应用户和角色

2.页面引用模板:

模版数据注入:在各页面新增“历史”按钮,点击弹出“历史选择注入弹出层”。根据关键字查询所需历史选择注入。

3.数据库设计:

3.1 数据库表设计:新建模版信息表,字段初设模板主键、流程名称、角色、用户、OBJID、编号、模板新建时间。

3.2数据库结构:

3.2.1模板引用与数据库关系

模板管理与数据库关系

模板信息表与各表的对象关系图

注:模板信息表与各流程表主外键通过OBJID关联,确保其唯一性。

       引用模板功能通过javascript方式实现。Js控制弹出层通过业务层对数据库表进行访问操作,将查询出的数据通过js注入到页面各个属性中供用户使用。模板管理功能经过业务层对数据库进行增删查操作,查询使用外键关联各流程表,通过将用户和角色绑定到数据库表中的方式对用户使用模板权限进行控制。

 

       模板功能是为方便用户提高开单效率而开发。其中,模板使用权限由技术支持中心的人来完成。

设计思路

       各新建历史和模板管理功能,模版类型按流程划分,总体页面不做大变化。

  设计清单
    流程说明

       模板功能支持各网省单位以及总部使用。

      

     流程图

   数据库设计

       模板功能数据库需要重新建一张表,因为要与工单关联,需设计OBJID和编号字段,设计用户权限使用问题,需设计角色和用户字段。详细设计如下:

 

名称

字段名称

类型

含义

模板主键

MB_ZJ

VARCHAR(32)

序列唯一

流程名

MB_LCM

VARCHAR(32)

同模板类型

角色

MB_JS

VARCHAR(128)

可使用人角色

用户

MB_YH

VARCHAR(128)

直接指定可使用的用户

工单OBJID

MB_GDID

VARCHAR(28)

工单的唯一性ID

工单编号

MB_GDBH

VARCHAR(28)

工单编号

模板建立时间

MB_JLSJ

DATETIME

模板新建的时间

模板管理主页面

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" extends="nariis.pi3000.portal.framework.BasePage" import="nariis.pi3000.portal.framework.*"%>
<%@ taglib prefix="mw" tagdir="/WEB-INF/tags"%>
<mw:Framework />
<mw:BusinessModelAgent />
<mw:DataAccessAgent />
<oss:ActiveBusinessObject id="actObject" />
<style>
   .select
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(126, 157, 185);
     padding: 2px;
 }

 .text
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(255, 255, 255);
     padding: 2px;
 }
 
</style>
<script>
    mw.Portal.settings["Editor.BorderColor"] = "#FFFFFF";
</script>

<div id="divFrame" onresize="panel2_onresize(this)" style="width:100%; height:100%; overflow:hidden; position:relative; top:0px; background-color:#E5E5D7; padding-top:3px;">
 <div id="noname" style="width:100%">
   <div style="background-color: #006963; align:center;color:#FFFFFF;">
   <table>
    <tr>
     <td>&nbsp; &nbsp;<span style="font-weight: bold; font-size: 16px;color: white">模板管理</span>&nbsp;&nbsp;&nbsp;
                      <span style="color: red"><input id="btnInsert" type="button" value="新增模板+"onClick="" />&nbsp;&nbsp; <input id="btnUpdate" type="button" value="修改模板+"onClick="" /></span></a>
     </td>
    </tr>
    <tr><table id="tableConditionPanel" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh" type="text" readOnly class="text" /><input id="mb_objid" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz" type="button" value="模板选择"onClick="lk_mb()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs" type="text" readOnly class="text" /><input id="mb_yhid" type="text" style="display:none;"></input><input id="mb_jsid" type="text" style="display:none;"></input><input id="btnyhjs" type="button" value="设置角色权限"onClick="lk_role()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs" type="button" value="设置用户权限"onClick="lk_permission()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim" type="button" value="确认新建" onClick="insertMB()"/>&nbsp;<input id="cancelInsert" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
   <tr><table id="tableConditionPanel2" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel2">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh2" type="text" readOnly class="text" /><input id="mb_objid2" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz2" type="button" value="模板选择"onClick="lk_mb2()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs2" type="text" readOnly class="text" /><input id="mb_yhid2" type="text" style="display:none;"></input><input id="mb_jsid2" type="text" style="display:none;"></input><input id="btnyhjs2" type="button" value="设置角色权限"onClick="lk_role2()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs2" type="button" value="设置用户权限"onClick="lk_permission2()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim2" type="button" value="确认修改" onClick="updateMB()"/>&nbsp;<input id="cancelUpdate" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
    </table></div>
  <table width="100%">
   <tr>
    <td style="background-color: #006963; align: center; color: #FFFFFF"">
     &nbsp; &nbsp;
     <span style="font-weight: bold; font-size: 14px">查询条件</span>&nbsp;
     &nbsp; 流程名
      <select  id="seltLCM" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="事件管理">事件管理</option>
      <option value="缺陷管理">缺陷管理</option>
                     <option value="检修计划管理">检修计划管理</option>
      <option value="停复役管理">停复役管理</option>
               <option value="检修任务管理">检修任务管理</option>
      <option value="紧急抢修管理">紧急抢修管理</option>
               <option value="上下线管理">上下线管理</option>
      <option value="值班管理">值班管理</option>
      <option value="巡视管理">巡视管理</option>
      <option value="任务单管理">任务单管理</option>
      <option value="信息系统工作联系">信息系统工作联系</option>
      <option value="工作票">工作票</option>
      <option value="操作票">操作票</option>
      <option value="电子商务模板">电子商务模板</option>
      <option value="IT资源信息申请">IT资源信息申请</option>
     </select>
     &nbsp; &nbsp;模板更新标志
      <select  id="seltGXBZ" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="新增">新建</option>
      <option value="修改">修改</option>
     </select>
     &nbsp; &nbsp;
     <input id="btnQuery" type="button" value="查  询" />
     &nbsp; &nbsp;
     <input id="btnCancel" type="button" value="取  消" />
    </td>
   </tr>
   <tr>
    <td style="width: 100%; background-color: #006963;">
     <table id="cxtb" style="color: #FFFFFF">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 295px" />
      </colgroup>
     
      <tr>
       <td>
        工单编号
       </td>
       <td>
        <input type="text" id="txtBH" class="text"/>
       </td>
       <td>
        模板建立时间
       </td>
       <td>
        <mw:DateTimeEditor id="dtSLTime1" formatString="yyyy-MM-dd"
         height="19" />  至
        <mw:DateTimeEditor id="dtSLTime2" formatString="yyyy-MM-dd"
         height="19" />
       </td>
      </tr>
      
     </table>
    </td>
   </tr>
  </table>
 </div>
      <div style="padding:3px; width:100%;">
  <mw:BDGrid id="bdGrid" clsID="05622215-E531-4C77-BF10-A61480630B11"
   appID="7980224B-C876-48BF-A5ED-6B179BE853A1"
   uiSchemeID="22A65CD1-0EBB-4F61-9ED9-C5D142EA5D4C" width="900"
   height="484" visible="true" allowPaging="true" allowMultiSelect="false"
   autoWrap="false" pageSize="13"  displayCheckBox="true"
   displayToolBar="true" displayLineNumber="true"
   showContextMenu="false" sortOrder="false"
     sortColumn="MB_LCM" filter="1=0" />
   </div>
</div>
<script>
<%@include file="../../base/scripts/utils/utils_cx.js" %>
$import("mw.editors.InplaceEditor");
</script>
<script>
 var clsID="", appID="", atvdID="", filterStr="", pageSize=15, uiSchemeID="", userID="", stateID="", prcdID="", detailPage="";
 //详细条件设置区域是否显示 false : 隐藏   true : 显示
    var detailDisplayFlg = false;//新增标示
 var detailDisplayFlg2 = false;//修改标示
 function panel2_onresize(p_sender)
 {
  bdGrid.resizeTo(p_sender.offsetWidth - 9, p_sender.offsetHeight - $("noname").offsetHeight - 8 );
 } 
  window.attachEvent("onload", function()
 {
   
  userID = mw.Portal.currentUser.id;
  
  mw.Portal.settings["BDGrid.ShowDetailViewOnDoubleClick"] = true;
  mw.Portal.settings["Editor.FontColor"] = "#000000";
  $("divFrame").fireEvent("onresize");
      
 });
 $("btnQuery").onclick = function()
 {

  var filterStr = "1=1";
        if(document.getElementById("seltLCM").value != "--请选择--")  //流程名
        {
            filterStr += " And MB_LCM = '" + document.getElementById("seltLCM").value + "'";
        }
     
        if(document.getElementById("txtBH").value != "")    //工单编号
        {
            filterStr += " And MB_GDBH Like '%" + document.getElementById("txtBH").value + "%'";
        }
   if(document.getElementById("seltGXBZ").value != "--请选择--")  //更新标志
        {
            filterStr += " And MB_BZ = '" + document.getElementById("seltGXBZ").value + "'";
        }
       
        //拼装建立时间
        if(dtSLTime1.getValue() != null && dtSLTime1.getValue() != "")  //建立--开始时间
        {
            filterStr += " And MB_JLSJ >= to_date('"+dtSLTime1.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
        if(dtSLTime2.getValue() != null && dtSLTime2.getValue() != "")
        {
            filterStr += " And MB_JLSJ <= to_date('"+dtSLTime2.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
       
        /* var flag = true;
         alert(isHeadquartersDownShow());
         alert(isSystemManagerRole());
        if(isHeadquartersDownShow() || isSystemManagerRole())
        {
         flag = false;
        }
        alert(flag);
        if (flag){*/
       // filterStr +=" And mw_app.mwt_ud_dzswpt.OBJ_ID in (select ydlp.obj_id  from dictdba.dt_corporation t,mw_sys.mwt_pd_deps n,mw_sys.mwt_om_link r,mw_sys.mwt_pd_emps m,(select g.OBJ_ID,o.CUSER_ID from mw_app.mwt_ud_dzswpt g left join mw_sys.MWT_OM_OBJ o on g.OBJ_ID = o.OBJ_ID) ydlp where to_char(t.corp_code) = n.areacode and n.obj_id = r.src_obj_id and r.tgt_obj_id = m.obj_id and m.SYSUSERID = ydlp.CUSER_ID and  t.CORP_CODE in  (select n.areacode from mw_sys.mwt_pd_deps n where n.obj_id =(select t.src_obj_id from mw_sys.mwt_om_link t where t.tgt_obj_id = (select m.obj_id from mw_sys.mwt_pd_emps m where m.sysuserid ='" + userID + "'))))";
       // }
       
        //alert(filterStr);
        bdGrid.filter = filterStr;
        bdGrid.query();
        //alert(filterStr);
        if(bdGrid.rows.length == 0)
        {
          alert("对不起,未查询到合适的结果");
        }
 }
 
 
 $("btnCancel").onclick = function()
 {
    document.getElementById("seltLCM").options[0].selected = true;
    document.getElementById("selectGXBZ").options[0].selected = true;
    document.getElementById("txtBH").value = "";
    dtSLTime1.setValue(null);
    dtSLTime2.setValue(null);
 }
 
 //新增时选择权限用户按钮
    function lk_permission()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
  //修改时选择权限用户按钮
    function lk_permission2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
 //选择权限角色按钮
    function lk_role()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
 //修改时选择权限角色按钮
    function lk_role2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
  //选择权限用户按钮
    function lk_mb()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh", resultConfig.GDBH);
    $$("mb_lcm", resultConfig.LCLB);
    $$("mb_objid", resultConfig.GDID);
         }
    }
 //修改时选择权限用户按钮
    function lk_mb2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh2", resultConfig.GDBH);
    $$("mb_lcm2", resultConfig.LCLB);
    $$("mb_objid2", resultConfig.GDID);
         }
    }
 // *******************************
// 新加模板按钮事件
// *******************************
$("btnInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
$("cancelInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
// ***************************************************
//函数名称:detailConDis
//函数功能:显示/隐藏新建模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis ()
{
 if (!detailDisplayFlg){
  $("tableConditionPanel").style.display = "none";
 } else {
  $("tableConditionPanel").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
/**
  * 新建模板
  */
    function insertMB()
    {
     clsID = "05622215-E531-4C77-BF10-A61480630B11";
     appID = "7980224B-C876-48BF-A5ED-6B179BE853A1";
        //var rjfl = document.getElementById("");
  var lcm = document.getElementById("mb_lcm").value;
  var js = document.getElementById("mb_jsid").value;
  var yh = document.getElementById("mb_yhid").value;
  var gdid = document.getElementById("mb_objid").value;
  var gdbh = document.getElementById("mb_gdbh").value;
  //var bz = document.getElementById("mb_gdbh").value;
  //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
  if(gdbh==""){ alert("请选择工单编号!"); return false;}
  if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认新建模板?")){

  var objID = mw.businesslogic.BusinessDataManager.createBusinessData(clsID, true, userID, appID, null).id;
  //alert(objID);
        if (objID != "")
        {
   var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objID, clsID, userID, null, null);
   bdGroup.setAttribute("MB_LCM",lcm);
   bdGroup.setAttribute("MB_JS",js);
   bdGroup.setAttribute("MB_YH",yh);
   bdGroup.setAttribute("MB_GDID",gdid);
   bdGroup.setAttribute("MB_GDBH",gdbh);
   bdGroup.setAttribute("MB_BZ","新增");
   mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
   alert("新建模板成功");
        }
  else{
  alert("新建模板发生异常,请稍后再试!");
  }
  }
    
    }
 /**
  * 修改模板
  */
    function updateMB()
    {
    clsID = "05622215-E531-4C77-BF10-A61480630B11";
    var lcm = document.getElementById("mb_lcm2").value;
    var js = document.getElementById("mb_jsid2").value;
    var yh = document.getElementById("mb_yhid2").value;
    var gdid = document.getElementById("mb_objid2").value;
    var gdbh = document.getElementById("mb_gdbh2").value;
    //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
    if(gdbh==""){ alert("请选择工单编号!"); return false;}
    if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认修改模板?")){
    var bgselect = bdGrid.selections;
    if(bgselect.length != 0)
    {
    var objid = bdGrid.selections[0].getAttribute("OBJ_ID");  //OBJID
     if (objid != "")
   {
    var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objid, clsID, userID, null, null);
    bdGroup.setAttribute("MB_LCM",lcm);
    bdGroup.setAttribute("MB_JS",js);
    bdGroup.setAttribute("MB_YH",yh);
    bdGroup.setAttribute("MB_GDID",gdid);
    bdGroup.setAttribute("MB_GDBH",gdbh);
    bdGroup.setAttribute("MB_BZ","修改");
    mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
    alert("修改模板成功");
   }
   else{
   alert("修改模板发生异常,请稍后再试!");
   }  
   
  }
  else
  {
   alert("请选择需要修改的模板信息!");
  }
     }
    }
 
 // 修改模板按钮事件
// *******************************
$("btnUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
$("cancelUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
// ***************************************************
//函数名称:detailConDis2
//函数功能:显示/隐藏修改模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis2 ()
{
 if (!detailDisplayFlg2){
  $("tableConditionPanel2").style.display = "none";
 } else {
  $("tableConditionPanel2").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
</script>

 

模板选择页面

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" extends="nariis.pi3000.portal.framework.BasePage" import="nariis.pi3000.portal.framework.*"%>
<%@ taglib prefix="mw" tagdir="/WEB-INF/tags"%>
<mw:Framework />
<mw:BusinessModelAgent />
<mw:DataAccessAgent />
<oss:ActiveBusinessObject id="actObject" />
<style>
   .select
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(126, 157, 185);
     padding: 2px;
 }

 .text
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(255, 255, 255);
     padding: 2px;
 }
 
</style>
<script>
    mw.Portal.settings["Editor.BorderColor"] = "#FFFFFF";
</script>

<div id="divFrame" onresize="panel2_onresize(this)" style="width:100%; height:100%; overflow:hidden; position:relative; top:0px; background-color:#E5E5D7; padding-top:3px;">
 <div id="noname" style="width:100%">
   <div style="background-color: #006963; align:center;color:#FFFFFF;">
   <table>
    <tr>
     <td>&nbsp; &nbsp;<span style="font-weight: bold; font-size: 16px;color: white">模板管理</span>&nbsp;&nbsp;&nbsp;
                      <span style="color: red"><input id="btnInsert" type="button" value="新增模板+"onClick="" />&nbsp;&nbsp; <input id="btnUpdate" type="button" value="修改模板+"onClick="" /></span></a>
     </td>
    </tr>
    <tr><table id="tableConditionPanel" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh" type="text" readOnly class="text" /><input id="mb_objid" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz" type="button" value="模板选择"onClick="lk_mb()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs" type="text" readOnly class="text" /><input id="mb_yhid" type="text" style="display:none;"></input><input id="mb_jsid" type="text" style="display:none;"></input><input id="btnyhjs" type="button" value="设置角色权限"onClick="lk_role()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs" type="button" value="设置用户权限"onClick="lk_permission()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim" type="button" value="确认新建" onClick="insertMB()"/>&nbsp;<input id="cancelInsert" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
   <tr><table id="tableConditionPanel2" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel2">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh2" type="text" readOnly class="text" /><input id="mb_objid2" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz2" type="button" value="模板选择"onClick="lk_mb2()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs2" type="text" readOnly class="text" /><input id="mb_yhid2" type="text" style="display:none;"></input><input id="mb_jsid2" type="text" style="display:none;"></input><input id="btnyhjs2" type="button" value="设置角色权限"onClick="lk_role2()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs2" type="button" value="设置用户权限"onClick="lk_permission2()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim2" type="button" value="确认修改" onClick="updateMB()"/>&nbsp;<input id="cancelUpdate" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
    </table></div>
  <table width="100%">
   <tr>
    <td style="background-color: #006963; align: center; color: #FFFFFF"">
     &nbsp; &nbsp;
     <span style="font-weight: bold; font-size: 14px">查询条件</span>&nbsp;
     &nbsp; 流程名
      <select  id="seltLCM" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="事件管理">事件管理</option>
      <option value="缺陷管理">缺陷管理</option>
                     <option value="检修计划管理">检修计划管理</option>
      <option value="停复役管理">停复役管理</option>
               <option value="检修任务管理">检修任务管理</option>
      <option value="紧急抢修管理">紧急抢修管理</option>
               <option value="上下线管理">上下线管理</option>
      <option value="值班管理">值班管理</option>
      <option value="巡视管理">巡视管理</option>
      <option value="任务单管理">任务单管理</option>
      <option value="信息系统工作联系">信息系统工作联系</option>
      <option value="工作票">工作票</option>
      <option value="操作票">操作票</option>
      <option value="电子商务模板">电子商务模板</option>
      <option value="IT资源信息申请">IT资源信息申请</option>
     </select>
     &nbsp; &nbsp;模板更新标志
      <select  id="seltGXBZ" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="新增">新建</option>
      <option value="修改">修改</option>
     </select>
     &nbsp; &nbsp;
     <input id="btnQuery" type="button" value="查  询" />
     &nbsp; &nbsp;
     <input id="btnCancel" type="button" value="取  消" />
    </td>
   </tr>
   <tr>
    <td style="width: 100%; background-color: #006963;">
     <table id="cxtb" style="color: #FFFFFF">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 295px" />
      </colgroup>
     
      <tr>
       <td>
        工单编号
       </td>
       <td>
        <input type="text" id="txtBH" class="text"/>
       </td>
       <td>
        模板建立时间
       </td>
       <td>
        <mw:DateTimeEditor id="dtSLTime1" formatString="yyyy-MM-dd"
         height="19" />  至
        <mw:DateTimeEditor id="dtSLTime2" formatString="yyyy-MM-dd"
         height="19" />
       </td>
      </tr>
      
     </table>
    </td>
   </tr>
  </table>
 </div>
      <div style="padding:3px; width:100%;">
  <mw:BDGrid id="bdGrid" clsID="05622215-E531-4C77-BF10-A61480630B11"
   appID="7980224B-C876-48BF-A5ED-6B179BE853A1"
   uiSchemeID="22A65CD1-0EBB-4F61-9ED9-C5D142EA5D4C" width="900"
   height="484" visible="true" allowPaging="true" allowMultiSelect="false"
   autoWrap="false" pageSize="13"  displayCheckBox="true"
   displayToolBar="true" displayLineNumber="true"
   showContextMenu="false" sortOrder="false"
     sortColumn="MB_LCM" filter="1=0" />
   </div>
</div>
<script>
<%@include file="../../base/scripts/utils/utils_cx.js" %>
$import("mw.editors.InplaceEditor");
</script>
<script>
 var clsID="", appID="", atvdID="", filterStr="", pageSize=15, uiSchemeID="", userID="", stateID="", prcdID="", detailPage="";
 //详细条件设置区域是否显示 false : 隐藏   true : 显示
    var detailDisplayFlg = false;//新增标示
 var detailDisplayFlg2 = false;//修改标示
 function panel2_onresize(p_sender)
 {
  bdGrid.resizeTo(p_sender.offsetWidth - 9, p_sender.offsetHeight - $("noname").offsetHeight - 8 );
 } 
  window.attachEvent("onload", function()
 {
   
  userID = mw.Portal.currentUser.id;
  
  mw.Portal.settings["BDGrid.ShowDetailViewOnDoubleClick"] = true;
  mw.Portal.settings["Editor.FontColor"] = "#000000";
  $("divFrame").fireEvent("onresize");
      
 });
 $("btnQuery").onclick = function()
 {

  var filterStr = "1=1";
        if(document.getElementById("seltLCM").value != "--请选择--")  //流程名
        {
            filterStr += " And MB_LCM = '" + document.getElementById("seltLCM").value + "'";
        }
     
        if(document.getElementById("txtBH").value != "")    //工单编号
        {
            filterStr += " And MB_GDBH Like '%" + document.getElementById("txtBH").value + "%'";
        }
   if(document.getElementById("seltGXBZ").value != "--请选择--")  //更新标志
        {
            filterStr += " And MB_BZ = '" + document.getElementById("seltGXBZ").value + "'";
        }
       
        //拼装建立时间
        if(dtSLTime1.getValue() != null && dtSLTime1.getValue() != "")  //建立--开始时间
        {
            filterStr += " And MB_JLSJ >= to_date('"+dtSLTime1.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
        if(dtSLTime2.getValue() != null && dtSLTime2.getValue() != "")
        {
            filterStr += " And MB_JLSJ <= to_date('"+dtSLTime2.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
       
        /* var flag = true;
         alert(isHeadquartersDownShow());
         alert(isSystemManagerRole());
        if(isHeadquartersDownShow() || isSystemManagerRole())
        {
         flag = false;
        }
        alert(flag);
        if (flag){*/
       // filterStr +=" And mw_app.mwt_ud_dzswpt.OBJ_ID in (select ydlp.obj_id  from dictdba.dt_corporation t,mw_sys.mwt_pd_deps n,mw_sys.mwt_om_link r,mw_sys.mwt_pd_emps m,(select g.OBJ_ID,o.CUSER_ID from mw_app.mwt_ud_dzswpt g left join mw_sys.MWT_OM_OBJ o on g.OBJ_ID = o.OBJ_ID) ydlp where to_char(t.corp_code) = n.areacode and n.obj_id = r.src_obj_id and r.tgt_obj_id = m.obj_id and m.SYSUSERID = ydlp.CUSER_ID and  t.CORP_CODE in  (select n.areacode from mw_sys.mwt_pd_deps n where n.obj_id =(select t.src_obj_id from mw_sys.mwt_om_link t where t.tgt_obj_id = (select m.obj_id from mw_sys.mwt_pd_emps m where m.sysuserid ='" + userID + "'))))";
       // }
       
        //alert(filterStr);
        bdGrid.filter = filterStr;
        bdGrid.query();
        //alert(filterStr);
        if(bdGrid.rows.length == 0)
        {
          alert("对不起,未查询到合适的结果");
        }
 }
 
 
 $("btnCancel").onclick = function()
 {
    document.getElementById("seltLCM").options[0].selected = true;
    document.getElementById("selectGXBZ").options[0].selected = true;
    document.getElementById("txtBH").value = "";
    dtSLTime1.setValue(null);
    dtSLTime2.setValue(null);
 }
 
 //新增时选择权限用户按钮
    function lk_permission()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
  //修改时选择权限用户按钮
    function lk_permission2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
 //选择权限角色按钮
    function lk_role()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
 //修改时选择权限角色按钮
    function lk_role2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
  //选择权限用户按钮
    function lk_mb()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh", resultConfig.GDBH);
    $$("mb_lcm", resultConfig.LCLB);
    $$("mb_objid", resultConfig.GDID);
         }
    }
 //修改时选择权限用户按钮
    function lk_mb2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh2", resultConfig.GDBH);
    $$("mb_lcm2", resultConfig.LCLB);
    $$("mb_objid2", resultConfig.GDID);
         }
    }
 // *******************************
// 新加模板按钮事件
// *******************************
$("btnInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
$("cancelInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
// ***************************************************
//函数名称:detailConDis
//函数功能:显示/隐藏新建模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis ()
{
 if (!detailDisplayFlg){
  $("tableConditionPanel").style.display = "none";
 } else {
  $("tableConditionPanel").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
/**
  * 新建模板
  */
    function insertMB()
    {
     clsID = "05622215-E531-4C77-BF10-A61480630B11";
     appID = "7980224B-C876-48BF-A5ED-6B179BE853A1";
        //var rjfl = document.getElementById("");
  var lcm = document.getElementById("mb_lcm").value;
  var js = document.getElementById("mb_jsid").value;
  var yh = document.getElementById("mb_yhid").value;
  var gdid = document.getElementById("mb_objid").value;
  var gdbh = document.getElementById("mb_gdbh").value;
  //var bz = document.getElementById("mb_gdbh").value;
  //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
  if(gdbh==""){ alert("请选择工单编号!"); return false;}
  if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认新建模板?")){

  var objID = mw.businesslogic.BusinessDataManager.createBusinessData(clsID, true, userID, appID, null).id;
  //alert(objID);
        if (objID != "")
        {
   var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objID, clsID, userID, null, null);
   bdGroup.setAttribute("MB_LCM",lcm);
   bdGroup.setAttribute("MB_JS",js);
   bdGroup.setAttribute("MB_YH",yh);
   bdGroup.setAttribute("MB_GDID",gdid);
   bdGroup.setAttribute("MB_GDBH",gdbh);
   bdGroup.setAttribute("MB_BZ","新增");
   mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
   alert("新建模板成功");
        }
  else{
  alert("新建模板发生异常,请稍后再试!");
  }
  }
    
    }
 /**
  * 修改模板
  */
    function updateMB()
    {
    clsID = "05622215-E531-4C77-BF10-A61480630B11";
    var lcm = document.getElementById("mb_lcm2").value;
    var js = document.getElementById("mb_jsid2").value;
    var yh = document.getElementById("mb_yhid2").value;
    var gdid = document.getElementById("mb_objid2").value;
    var gdbh = document.getElementById("mb_gdbh2").value;
    //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
    if(gdbh==""){ alert("请选择工单编号!"); return false;}
    if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认修改模板?")){
    var bgselect = bdGrid.selections;
    if(bgselect.length != 0)
    {
    var objid = bdGrid.selections[0].getAttribute("OBJ_ID");  //OBJID
     if (objid != "")
   {
    var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objid, clsID, userID, null, null);
    bdGroup.setAttribute("MB_LCM",lcm);
    bdGroup.setAttribute("MB_JS",js);
    bdGroup.setAttribute("MB_YH",yh);
    bdGroup.setAttribute("MB_GDID",gdid);
    bdGroup.setAttribute("MB_GDBH",gdbh);
    bdGroup.setAttribute("MB_BZ","修改");
    mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
    alert("修改模板成功");
   }
   else{
   alert("修改模板发生异常,请稍后再试!");
   }  
   
  }
  else
  {
   alert("请选择需要修改的模板信息!");
  }
     }
    }
 
 // 修改模板按钮事件
// *******************************
$("btnUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
$("cancelUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
// ***************************************************
//函数名称:detailConDis2
//函数功能:显示/隐藏修改模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis2 ()
{
 if (!detailDisplayFlg2){
  $("tableConditionPanel2").style.display = "none";
 } else {
  $("tableConditionPanel2").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
</script>

模板角色选择页面

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" extends="nariis.pi3000.portal.framework.BasePage" import="nariis.pi3000.portal.framework.*"%>
<%@ taglib prefix="mw" tagdir="/WEB-INF/tags"%>
<mw:Framework />
<mw:BusinessModelAgent />
<mw:DataAccessAgent />
<oss:ActiveBusinessObject id="actObject" />
<style>
   .select
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(126, 157, 185);
     padding: 2px;
 }

 .text
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(255, 255, 255);
     padding: 2px;
 }
 
</style>
<script>
    mw.Portal.settings["Editor.BorderColor"] = "#FFFFFF";
</script>

<div id="divFrame" onresize="panel2_onresize(this)" style="width:100%; height:100%; overflow:hidden; position:relative; top:0px; background-color:#E5E5D7; padding-top:3px;">
 <div id="noname" style="width:100%">
   <div style="background-color: #006963; align:center;color:#FFFFFF;">
   <table>
    <tr>
     <td>&nbsp; &nbsp;<span style="font-weight: bold; font-size: 16px;color: white">模板管理</span>&nbsp;&nbsp;&nbsp;
                      <span style="color: red"><input id="btnInsert" type="button" value="新增模板+"onClick="" />&nbsp;&nbsp; <input id="btnUpdate" type="button" value="修改模板+"onClick="" /></span></a>
     </td>
    </tr>
    <tr><table id="tableConditionPanel" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh" type="text" readOnly class="text" /><input id="mb_objid" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz" type="button" value="模板选择"onClick="lk_mb()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs" type="text" readOnly class="text" /><input id="mb_yhid" type="text" style="display:none;"></input><input id="mb_jsid" type="text" style="display:none;"></input><input id="btnyhjs" type="button" value="设置角色权限"onClick="lk_role()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs" type="button" value="设置用户权限"onClick="lk_permission()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim" type="button" value="确认新建" onClick="insertMB()"/>&nbsp;<input id="cancelInsert" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
   <tr><table id="tableConditionPanel2" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel2">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh2" type="text" readOnly class="text" /><input id="mb_objid2" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz2" type="button" value="模板选择"onClick="lk_mb2()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs2" type="text" readOnly class="text" /><input id="mb_yhid2" type="text" style="display:none;"></input><input id="mb_jsid2" type="text" style="display:none;"></input><input id="btnyhjs2" type="button" value="设置角色权限"onClick="lk_role2()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs2" type="button" value="设置用户权限"onClick="lk_permission2()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim2" type="button" value="确认修改" onClick="updateMB()"/>&nbsp;<input id="cancelUpdate" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
    </table></div>
  <table width="100%">
   <tr>
    <td style="background-color: #006963; align: center; color: #FFFFFF"">
     &nbsp; &nbsp;
     <span style="font-weight: bold; font-size: 14px">查询条件</span>&nbsp;
     &nbsp; 流程名
      <select  id="seltLCM" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="事件管理">事件管理</option>
      <option value="缺陷管理">缺陷管理</option>
                     <option value="检修计划管理">检修计划管理</option>
      <option value="停复役管理">停复役管理</option>
               <option value="检修任务管理">检修任务管理</option>
      <option value="紧急抢修管理">紧急抢修管理</option>
               <option value="上下线管理">上下线管理</option>
      <option value="值班管理">值班管理</option>
      <option value="巡视管理">巡视管理</option>
      <option value="任务单管理">任务单管理</option>
      <option value="信息系统工作联系">信息系统工作联系</option>
      <option value="工作票">工作票</option>
      <option value="操作票">操作票</option>
      <option value="电子商务模板">电子商务模板</option>
      <option value="IT资源信息申请">IT资源信息申请</option>
     </select>
     &nbsp; &nbsp;模板更新标志
      <select  id="seltGXBZ" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="新增">新建</option>
      <option value="修改">修改</option>
     </select>
     &nbsp; &nbsp;
     <input id="btnQuery" type="button" value="查  询" />
     &nbsp; &nbsp;
     <input id="btnCancel" type="button" value="取  消" />
    </td>
   </tr>
   <tr>
    <td style="width: 100%; background-color: #006963;">
     <table id="cxtb" style="color: #FFFFFF">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 295px" />
      </colgroup>
     
      <tr>
       <td>
        工单编号
       </td>
       <td>
        <input type="text" id="txtBH" class="text"/>
       </td>
       <td>
        模板建立时间
       </td>
       <td>
        <mw:DateTimeEditor id="dtSLTime1" formatString="yyyy-MM-dd"
         height="19" />  至
        <mw:DateTimeEditor id="dtSLTime2" formatString="yyyy-MM-dd"
         height="19" />
       </td>
      </tr>
      
     </table>
    </td>
   </tr>
  </table>
 </div>
      <div style="padding:3px; width:100%;">
  <mw:BDGrid id="bdGrid" clsID="05622215-E531-4C77-BF10-A61480630B11"
   appID="7980224B-C876-48BF-A5ED-6B179BE853A1"
   uiSchemeID="22A65CD1-0EBB-4F61-9ED9-C5D142EA5D4C" width="900"
   height="484" visible="true" allowPaging="true" allowMultiSelect="false"
   autoWrap="false" pageSize="13"  displayCheckBox="true"
   displayToolBar="true" displayLineNumber="true"
   showContextMenu="false" sortOrder="false"
     sortColumn="MB_LCM" filter="1=0" />
   </div>
</div>
<script>
<%@include file="../../base/scripts/utils/utils_cx.js" %>
$import("mw.editors.InplaceEditor");
</script>
<script>
 var clsID="", appID="", atvdID="", filterStr="", pageSize=15, uiSchemeID="", userID="", stateID="", prcdID="", detailPage="";
 //详细条件设置区域是否显示 false : 隐藏   true : 显示
    var detailDisplayFlg = false;//新增标示
 var detailDisplayFlg2 = false;//修改标示
 function panel2_onresize(p_sender)
 {
  bdGrid.resizeTo(p_sender.offsetWidth - 9, p_sender.offsetHeight - $("noname").offsetHeight - 8 );
 } 
  window.attachEvent("onload", function()
 {
   
  userID = mw.Portal.currentUser.id;
  
  mw.Portal.settings["BDGrid.ShowDetailViewOnDoubleClick"] = true;
  mw.Portal.settings["Editor.FontColor"] = "#000000";
  $("divFrame").fireEvent("onresize");
      
 });
 $("btnQuery").onclick = function()
 {

  var filterStr = "1=1";
        if(document.getElementById("seltLCM").value != "--请选择--")  //流程名
        {
            filterStr += " And MB_LCM = '" + document.getElementById("seltLCM").value + "'";
        }
     
        if(document.getElementById("txtBH").value != "")    //工单编号
        {
            filterStr += " And MB_GDBH Like '%" + document.getElementById("txtBH").value + "%'";
        }
   if(document.getElementById("seltGXBZ").value != "--请选择--")  //更新标志
        {
            filterStr += " And MB_BZ = '" + document.getElementById("seltGXBZ").value + "'";
        }
       
        //拼装建立时间
        if(dtSLTime1.getValue() != null && dtSLTime1.getValue() != "")  //建立--开始时间
        {
            filterStr += " And MB_JLSJ >= to_date('"+dtSLTime1.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
        if(dtSLTime2.getValue() != null && dtSLTime2.getValue() != "")
        {
            filterStr += " And MB_JLSJ <= to_date('"+dtSLTime2.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
       
        /* var flag = true;
         alert(isHeadquartersDownShow());
         alert(isSystemManagerRole());
        if(isHeadquartersDownShow() || isSystemManagerRole())
        {
         flag = false;
        }
        alert(flag);
        if (flag){*/
       // filterStr +=" And mw_app.mwt_ud_dzswpt.OBJ_ID in (select ydlp.obj_id  from dictdba.dt_corporation t,mw_sys.mwt_pd_deps n,mw_sys.mwt_om_link r,mw_sys.mwt_pd_emps m,(select g.OBJ_ID,o.CUSER_ID from mw_app.mwt_ud_dzswpt g left join mw_sys.MWT_OM_OBJ o on g.OBJ_ID = o.OBJ_ID) ydlp where to_char(t.corp_code) = n.areacode and n.obj_id = r.src_obj_id and r.tgt_obj_id = m.obj_id and m.SYSUSERID = ydlp.CUSER_ID and  t.CORP_CODE in  (select n.areacode from mw_sys.mwt_pd_deps n where n.obj_id =(select t.src_obj_id from mw_sys.mwt_om_link t where t.tgt_obj_id = (select m.obj_id from mw_sys.mwt_pd_emps m where m.sysuserid ='" + userID + "'))))";
       // }
       
        //alert(filterStr);
        bdGrid.filter = filterStr;
        bdGrid.query();
        //alert(filterStr);
        if(bdGrid.rows.length == 0)
        {
          alert("对不起,未查询到合适的结果");
        }
 }
 
 
 $("btnCancel").onclick = function()
 {
    document.getElementById("seltLCM").options[0].selected = true;
    document.getElementById("selectGXBZ").options[0].selected = true;
    document.getElementById("txtBH").value = "";
    dtSLTime1.setValue(null);
    dtSLTime2.setValue(null);
 }
 
 //新增时选择权限用户按钮
    function lk_permission()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
  //修改时选择权限用户按钮
    function lk_permission2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
 //选择权限角色按钮
    function lk_role()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
 //修改时选择权限角色按钮
    function lk_role2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
  //选择权限用户按钮
    function lk_mb()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh", resultConfig.GDBH);
    $$("mb_lcm", resultConfig.LCLB);
    $$("mb_objid", resultConfig.GDID);
         }
    }
 //修改时选择权限用户按钮
    function lk_mb2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh2", resultConfig.GDBH);
    $$("mb_lcm2", resultConfig.LCLB);
    $$("mb_objid2", resultConfig.GDID);
         }
    }
 // *******************************
// 新加模板按钮事件
// *******************************
$("btnInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
$("cancelInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
// ***************************************************
//函数名称:detailConDis
//函数功能:显示/隐藏新建模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis ()
{
 if (!detailDisplayFlg){
  $("tableConditionPanel").style.display = "none";
 } else {
  $("tableConditionPanel").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
/**
  * 新建模板
  */
    function insertMB()
    {
     clsID = "05622215-E531-4C77-BF10-A61480630B11";
     appID = "7980224B-C876-48BF-A5ED-6B179BE853A1";
        //var rjfl = document.getElementById("");
  var lcm = document.getElementById("mb_lcm").value;
  var js = document.getElementById("mb_jsid").value;
  var yh = document.getElementById("mb_yhid").value;
  var gdid = document.getElementById("mb_objid").value;
  var gdbh = document.getElementById("mb_gdbh").value;
  //var bz = document.getElementById("mb_gdbh").value;
  //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
  if(gdbh==""){ alert("请选择工单编号!"); return false;}
  if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认新建模板?")){

  var objID = mw.businesslogic.BusinessDataManager.createBusinessData(clsID, true, userID, appID, null).id;
  //alert(objID);
        if (objID != "")
        {
   var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objID, clsID, userID, null, null);
   bdGroup.setAttribute("MB_LCM",lcm);
   bdGroup.setAttribute("MB_JS",js);
   bdGroup.setAttribute("MB_YH",yh);
   bdGroup.setAttribute("MB_GDID",gdid);
   bdGroup.setAttribute("MB_GDBH",gdbh);
   bdGroup.setAttribute("MB_BZ","新增");
   mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
   alert("新建模板成功");
        }
  else{
  alert("新建模板发生异常,请稍后再试!");
  }
  }
    
    }
 /**
  * 修改模板
  */
    function updateMB()
    {
    clsID = "05622215-E531-4C77-BF10-A61480630B11";
    var lcm = document.getElementById("mb_lcm2").value;
    var js = document.getElementById("mb_jsid2").value;
    var yh = document.getElementById("mb_yhid2").value;
    var gdid = document.getElementById("mb_objid2").value;
    var gdbh = document.getElementById("mb_gdbh2").value;
    //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
    if(gdbh==""){ alert("请选择工单编号!"); return false;}
    if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认修改模板?")){
    var bgselect = bdGrid.selections;
    if(bgselect.length != 0)
    {
    var objid = bdGrid.selections[0].getAttribute("OBJ_ID");  //OBJID
     if (objid != "")
   {
    var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objid, clsID, userID, null, null);
    bdGroup.setAttribute("MB_LCM",lcm);
    bdGroup.setAttribute("MB_JS",js);
    bdGroup.setAttribute("MB_YH",yh);
    bdGroup.setAttribute("MB_GDID",gdid);
    bdGroup.setAttribute("MB_GDBH",gdbh);
    bdGroup.setAttribute("MB_BZ","修改");
    mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
    alert("修改模板成功");
   }
   else{
   alert("修改模板发生异常,请稍后再试!");
   }  
   
  }
  else
  {
   alert("请选择需要修改的模板信息!");
  }
     }
    }
 
 // 修改模板按钮事件
// *******************************
$("btnUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
$("cancelUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
// ***************************************************
//函数名称:detailConDis2
//函数功能:显示/隐藏修改模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis2 ()
{
 if (!detailDisplayFlg2){
  $("tableConditionPanel2").style.display = "none";
 } else {
  $("tableConditionPanel2").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
</script>

模板用户选择页面

<%@page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" extends="nariis.pi3000.portal.framework.BasePage" import="nariis.pi3000.portal.framework.*"%>
<%@ taglib prefix="mw" tagdir="/WEB-INF/tags"%>
<mw:Framework />
<mw:BusinessModelAgent />
<mw:DataAccessAgent />
<oss:ActiveBusinessObject id="actObject" />
<style>
   .select
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(126, 157, 185);
     padding: 2px;
 }

 .text
 {
  border-clor:#FFFFFF;
  background-color:#006963;
  color:#FFFFFF;
  border: 1px solid rgb(255, 255, 255);
     padding: 2px;
 }
 
</style>
<script>
    mw.Portal.settings["Editor.BorderColor"] = "#FFFFFF";
</script>

<div id="divFrame" onresize="panel2_onresize(this)" style="width:100%; height:100%; overflow:hidden; position:relative; top:0px; background-color:#E5E5D7; padding-top:3px;">
 <div id="noname" style="width:100%">
   <div style="background-color: #006963; align:center;color:#FFFFFF;">
   <table>
    <tr>
     <td>&nbsp; &nbsp;<span style="font-weight: bold; font-size: 16px;color: white">模板管理</span>&nbsp;&nbsp;&nbsp;
                      <span style="color: red"><input id="btnInsert" type="button" value="新增模板+"onClick="" />&nbsp;&nbsp; <input id="btnUpdate" type="button" value="修改模板+"onClick="" /></span></a>
     </td>
    </tr>
    <tr><table id="tableConditionPanel" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh" type="text" readOnly class="text" /><input id="mb_objid" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz" type="button" value="模板选择"onClick="lk_mb()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs" type="text" readOnly class="text" /><input id="mb_yhid" type="text" style="display:none;"></input><input id="mb_jsid" type="text" style="display:none;"></input><input id="btnyhjs" type="button" value="设置角色权限"onClick="lk_role()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs" type="button" value="设置用户权限"onClick="lk_permission()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim" type="button" value="确认新建" onClick="insertMB()"/>&nbsp;<input id="cancelInsert" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
   <tr><table id="tableConditionPanel2" style="color:#FFFFFF;display:none">
     <tbody id="tbody_sel2">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 400px" />
       <tr>
           <td>工单编号:</td>
        <td><input id="mb_gdbh2" type="text" readOnly class="text" /><input id="mb_objid2" type="text" style="display:none;"></input></td>
         <td>流程类别:</td>
        <td><input id="mb_lcm2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnmbxz2" type="button" value="模板选择"onClick="lk_mb2()" /> [→导入工单编号和流程类别]</span></td>
       </tr>
       <tr>
           <td>适用角色:</td>
        <td><input id="mb_syjs2" type="text" readOnly class="text" /><input id="mb_yhid2" type="text" style="display:none;"></input><input id="mb_jsid2" type="text" style="display:none;"></input><input id="btnyhjs2" type="button" value="设置角色权限"onClick="lk_role2()" /></td>
         <td>适用用户:</td>
        <td><input id="mb_syyh2" type="text" readOnly class="text" />&nbsp;&nbsp;<span style="color: red"><input id="btnyhjs2" type="button" value="设置用户权限"onClick="lk_permission2()" /> [→选择适用角色和用户]</span>
           </td>
       </tr>
       <tr>
         
        <td colspan="4"><input id="btnConfrim2" type="button" value="确认修改" onClick="updateMB()"/>&nbsp;<input id="cancelUpdate" type="button" value="取 消"/></td>
       
       </tr>
      </colgroup>
     </tbody>
     </table>
   </tr>
    </table></div>
  <table width="100%">
   <tr>
    <td style="background-color: #006963; align: center; color: #FFFFFF"">
     &nbsp; &nbsp;
     <span style="font-weight: bold; font-size: 14px">查询条件</span>&nbsp;
     &nbsp; 流程名
      <select  id="seltLCM" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="事件管理">事件管理</option>
      <option value="缺陷管理">缺陷管理</option>
                     <option value="检修计划管理">检修计划管理</option>
      <option value="停复役管理">停复役管理</option>
               <option value="检修任务管理">检修任务管理</option>
      <option value="紧急抢修管理">紧急抢修管理</option>
               <option value="上下线管理">上下线管理</option>
      <option value="值班管理">值班管理</option>
      <option value="巡视管理">巡视管理</option>
      <option value="任务单管理">任务单管理</option>
      <option value="信息系统工作联系">信息系统工作联系</option>
      <option value="工作票">工作票</option>
      <option value="操作票">操作票</option>
      <option value="电子商务模板">电子商务模板</option>
      <option value="IT资源信息申请">IT资源信息申请</option>
     </select>
     &nbsp; &nbsp;模板更新标志
      <select  id="seltGXBZ" class="select">
               <option value="--请选择--">--请选择--</option>
               <option value="新增">新建</option>
      <option value="修改">修改</option>
     </select>
     &nbsp; &nbsp;
     <input id="btnQuery" type="button" value="查  询" />
     &nbsp; &nbsp;
     <input id="btnCancel" type="button" value="取  消" />
    </td>
   </tr>
   <tr>
    <td style="width: 100%; background-color: #006963;">
     <table id="cxtb" style="color: #FFFFFF">
      <colgroup>
       <col style="width: 90px; text-align: center;" />
       <col style="width: 400px" />
       <col style="width: 100px; text-align: center;" />
       <col style="width: 295px" />
      </colgroup>
     
      <tr>
       <td>
        工单编号
       </td>
       <td>
        <input type="text" id="txtBH" class="text"/>
       </td>
       <td>
        模板建立时间
       </td>
       <td>
        <mw:DateTimeEditor id="dtSLTime1" formatString="yyyy-MM-dd"
         height="19" />  至
        <mw:DateTimeEditor id="dtSLTime2" formatString="yyyy-MM-dd"
         height="19" />
       </td>
      </tr>
      
     </table>
    </td>
   </tr>
  </table>
 </div>
      <div style="padding:3px; width:100%;">
  <mw:BDGrid id="bdGrid" clsID="05622215-E531-4C77-BF10-A61480630B11"
   appID="7980224B-C876-48BF-A5ED-6B179BE853A1"
   uiSchemeID="22A65CD1-0EBB-4F61-9ED9-C5D142EA5D4C" width="900"
   height="484" visible="true" allowPaging="true" allowMultiSelect="false"
   autoWrap="false" pageSize="13"  displayCheckBox="true"
   displayToolBar="true" displayLineNumber="true"
   showContextMenu="false" sortOrder="false"
     sortColumn="MB_LCM" filter="1=0" />
   </div>
</div>
<script>
<%@include file="../../base/scripts/utils/utils_cx.js" %>
$import("mw.editors.InplaceEditor");
</script>
<script>
 var clsID="", appID="", atvdID="", filterStr="", pageSize=15, uiSchemeID="", userID="", stateID="", prcdID="", detailPage="";
 //详细条件设置区域是否显示 false : 隐藏   true : 显示
    var detailDisplayFlg = false;//新增标示
 var detailDisplayFlg2 = false;//修改标示
 function panel2_onresize(p_sender)
 {
  bdGrid.resizeTo(p_sender.offsetWidth - 9, p_sender.offsetHeight - $("noname").offsetHeight - 8 );
 } 
  window.attachEvent("onload", function()
 {
   
  userID = mw.Portal.currentUser.id;
  
  mw.Portal.settings["BDGrid.ShowDetailViewOnDoubleClick"] = true;
  mw.Portal.settings["Editor.FontColor"] = "#000000";
  $("divFrame").fireEvent("onresize");
      
 });
 $("btnQuery").onclick = function()
 {

  var filterStr = "1=1";
        if(document.getElementById("seltLCM").value != "--请选择--")  //流程名
        {
            filterStr += " And MB_LCM = '" + document.getElementById("seltLCM").value + "'";
        }
     
        if(document.getElementById("txtBH").value != "")    //工单编号
        {
            filterStr += " And MB_GDBH Like '%" + document.getElementById("txtBH").value + "%'";
        }
   if(document.getElementById("seltGXBZ").value != "--请选择--")  //更新标志
        {
            filterStr += " And MB_BZ = '" + document.getElementById("seltGXBZ").value + "'";
        }
       
        //拼装建立时间
        if(dtSLTime1.getValue() != null && dtSLTime1.getValue() != "")  //建立--开始时间
        {
            filterStr += " And MB_JLSJ >= to_date('"+dtSLTime1.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
        if(dtSLTime2.getValue() != null && dtSLTime2.getValue() != "")
        {
            filterStr += " And MB_JLSJ <= to_date('"+dtSLTime2.getValue()+"','yyyy-mm-dd hh24:mi:ss')";
        }
       
        /* var flag = true;
         alert(isHeadquartersDownShow());
         alert(isSystemManagerRole());
        if(isHeadquartersDownShow() || isSystemManagerRole())
        {
         flag = false;
        }
        alert(flag);
        if (flag){*/
       // filterStr +=" And mw_app.mwt_ud_dzswpt.OBJ_ID in (select ydlp.obj_id  from dictdba.dt_corporation t,mw_sys.mwt_pd_deps n,mw_sys.mwt_om_link r,mw_sys.mwt_pd_emps m,(select g.OBJ_ID,o.CUSER_ID from mw_app.mwt_ud_dzswpt g left join mw_sys.MWT_OM_OBJ o on g.OBJ_ID = o.OBJ_ID) ydlp where to_char(t.corp_code) = n.areacode and n.obj_id = r.src_obj_id and r.tgt_obj_id = m.obj_id and m.SYSUSERID = ydlp.CUSER_ID and  t.CORP_CODE in  (select n.areacode from mw_sys.mwt_pd_deps n where n.obj_id =(select t.src_obj_id from mw_sys.mwt_om_link t where t.tgt_obj_id = (select m.obj_id from mw_sys.mwt_pd_emps m where m.sysuserid ='" + userID + "'))))";
       // }
       
        //alert(filterStr);
        bdGrid.filter = filterStr;
        bdGrid.query();
        //alert(filterStr);
        if(bdGrid.rows.length == 0)
        {
          alert("对不起,未查询到合适的结果");
        }
 }
 
 
 $("btnCancel").onclick = function()
 {
    document.getElementById("seltLCM").options[0].selected = true;
    document.getElementById("selectGXBZ").options[0].selected = true;
    document.getElementById("txtBH").value = "";
    dtSLTime1.setValue(null);
    dtSLTime2.setValue(null);
 }
 
 //新增时选择权限用户按钮
    function lk_permission()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
  //修改时选择权限用户按钮
    function lk_permission2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/roleuser.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
 //选择权限角色按钮
    function lk_role()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs", resultConfig.MB_JSNAME);
    $$("mb_syyh", resultConfig.MB_YHNAME);
    $$("mb_jsid", resultConfig.MB_JS);
    $$("mb_yhid", resultConfig.MB_YH);
           }
      
    }
 //修改时选择权限角色按钮
    function lk_role2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/permission/mbrole.jsp","","dialogWidth=490px;dialogHeight=500px;scroll=no");
       //alert();
    if(resultConfig != null)
       {
          $$("mb_syjs2", resultConfig.MB_JSNAME);
    $$("mb_syyh2", resultConfig.MB_YHNAME);
    $$("mb_jsid2", resultConfig.MB_JS);
    $$("mb_yhid2", resultConfig.MB_YH);
           }
      
    }
  //选择权限用户按钮
    function lk_mb()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh", resultConfig.GDBH);
    $$("mb_lcm", resultConfig.LCLB);
    $$("mb_objid", resultConfig.GDID);
         }
    }
 //修改时选择权限用户按钮
    function lk_mb2()
    {
       var resultConfig = window.showModalDialog("../MWWebSite/PROJECT-HOME/webviews/MBGL/mbglxx.jsp","","dialogWidth=950px;dialogHeight=600px;scroll=no");
         if(resultConfig != null)
         {
       $$("mb_gdbh2", resultConfig.GDBH);
    $$("mb_lcm2", resultConfig.LCLB);
    $$("mb_objid2", resultConfig.GDID);
         }
    }
 // *******************************
// 新加模板按钮事件
// *******************************
$("btnInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
$("cancelInsert").onclick = function()
{
 detailDisplayFlg = !detailDisplayFlg;
 detailConDis();
}
// ***************************************************
//函数名称:detailConDis
//函数功能:显示/隐藏新建模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis ()
{
 if (!detailDisplayFlg){
  $("tableConditionPanel").style.display = "none";
 } else {
  $("tableConditionPanel").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
/**
  * 新建模板
  */
    function insertMB()
    {
     clsID = "05622215-E531-4C77-BF10-A61480630B11";
     appID = "7980224B-C876-48BF-A5ED-6B179BE853A1";
        //var rjfl = document.getElementById("");
  var lcm = document.getElementById("mb_lcm").value;
  var js = document.getElementById("mb_jsid").value;
  var yh = document.getElementById("mb_yhid").value;
  var gdid = document.getElementById("mb_objid").value;
  var gdbh = document.getElementById("mb_gdbh").value;
  //var bz = document.getElementById("mb_gdbh").value;
  //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
  if(gdbh==""){ alert("请选择工单编号!"); return false;}
  if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认新建模板?")){

  var objID = mw.businesslogic.BusinessDataManager.createBusinessData(clsID, true, userID, appID, null).id;
  //alert(objID);
        if (objID != "")
        {
   var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objID, clsID, userID, null, null);
   bdGroup.setAttribute("MB_LCM",lcm);
   bdGroup.setAttribute("MB_JS",js);
   bdGroup.setAttribute("MB_YH",yh);
   bdGroup.setAttribute("MB_GDID",gdid);
   bdGroup.setAttribute("MB_GDBH",gdbh);
   bdGroup.setAttribute("MB_BZ","新增");
   mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
   alert("新建模板成功");
        }
  else{
  alert("新建模板发生异常,请稍后再试!");
  }
  }
    
    }
 /**
  * 修改模板
  */
    function updateMB()
    {
    clsID = "05622215-E531-4C77-BF10-A61480630B11";
    var lcm = document.getElementById("mb_lcm2").value;
    var js = document.getElementById("mb_jsid2").value;
    var yh = document.getElementById("mb_yhid2").value;
    var gdid = document.getElementById("mb_objid2").value;
    var gdbh = document.getElementById("mb_gdbh2").value;
    //alert(lcm+"objid:"+gdid+"bh:"+gdbh);
    if(gdbh==""){ alert("请选择工单编号!"); return false;}
    if(lcm==""){ alert("请选择流程类别!"); return false;}
  //if(yh==""){ alert("请选择适用用户!"); return false;}
  //if(js==""){ alert("请选择适用角色!"); return false;}
          if(confirm("确认修改模板?")){
    var bgselect = bdGrid.selections;
    if(bgselect.length != 0)
    {
    var objid = bdGrid.selections[0].getAttribute("OBJ_ID");  //OBJID
     if (objid != "")
   {
    var bdGroup = mw.businesslogic.BusinessDataManager.loadBusinessData(objid, clsID, userID, null, null);
    bdGroup.setAttribute("MB_LCM",lcm);
    bdGroup.setAttribute("MB_JS",js);
    bdGroup.setAttribute("MB_YH",yh);
    bdGroup.setAttribute("MB_GDID",gdid);
    bdGroup.setAttribute("MB_GDBH",gdbh);
    bdGroup.setAttribute("MB_BZ","修改");
    mw.businesslogic.BusinessDataManager.saveBusinessData(bdGroup);
    alert("修改模板成功");
   }
   else{
   alert("修改模板发生异常,请稍后再试!");
   }  
   
  }
  else
  {
   alert("请选择需要修改的模板信息!");
  }
     }
    }
 
 // 修改模板按钮事件
// *******************************
$("btnUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
$("cancelUpdate").onclick = function()
{
 detailDisplayFlg2 = !detailDisplayFlg2;
 detailConDis2();
}
// ***************************************************
//函数名称:detailConDis2
//函数功能:显示/隐藏修改模板区域
//输入参数:
//返回值: 
// ***************************************************
function detailConDis2 ()
{
 if (!detailDisplayFlg2){
  $("tableConditionPanel2").style.display = "none";
 } else {
  $("tableConditionPanel2").style.display = "block";
 }
 $("divFrame").fireEvent("onresize");
}
</script>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值