@using System.Data
@using Adf.App.Interface.Entity@using Adf.App.Service.Service@using Adf.Core.Database@using Adf.Core.Util@using Adf.Core.Web@{ /****************系统定义 开始 **************************/ Layout = "~/Views/Shared/AdminDefaultLayout.cshtml";//相关属性
User sysUserLoginInfo = ViewBag.GlobalUserLoginInfo; Module sysCurrentModuleInfo = ViewBag.GlobalModule; String curShowType = ViewBag.ShowType; String curDoCmd = ViewBag.DoCmd; String curControlName = "/manage/basemodule"; //功能点 String curMainSysFuncId = "PaOAsspExecuteTicketFile"; //curControlName = StringHelper.SubString(curControlName, "?"); RoleModuleParam sysRoleModuleParam = new RoleModuleParam(); //数据源集合//详细页数据集
DataTable curMainDetailEntity = null;//列表页数据集编码
String curListDsCode = "dsPaOATicketFileList"; /**自定义部分 -- 开始 --*/if (curShowType == "detail")
{ String dsCode = curListDsCode; String strWhere = "TicketCode='" + RequestHelper.GetQueryString("TicketCode") + "'"; String strOrderBy = ""; curMainDetailEntity = AppService.Instance().SysDataset().QueryDataTable(dsCode, "", strWhere, strOrderBy, 1);}
/**自定义部分 -- 结束 --*/
DataTable dtHousingType = AppService.Instance().SysDataset().QueryDataTable("dsPaOAParamterList", "", " ClassCode='pjda'", "Order by InfoOrder DESC", 0);}
@section ScriptMain{ @{ if (curShowType == "list") { <script type="text/javascript">//var sysExecuteUrl = "";
$(document).ready(function () {//定义行点击获取记录集数据
$("#myData tbody tr").live('click', function (e) {//得到选中行 //获取点击当前行 var aData = oTable.fnGetData(this); //得到选中行的数据 if (null != aData) { rowDataInfo = aData; } });//定义全选以及反选事件
$("#cbSel").click(function () { if ($("#cbSel").attr("checked") == true) { setFormSelect("", "cblInfo", 1); } else { setFormSelect("", "cblInfo", 2); }});
/****定义表格显示部门**/
//step 定义表格显示列
var columns = [ { "sName": "TicketCode", "sTitle": "<input type='checkbox' name='cbSel' id='cbSel' value='1' />选择", "mDataProp": "TicketCode", "sWidth": "50", "mRender": function (data, type, row) { return "<input type='checkbox' name='cblInfo' value='" + data + "' />"; } } , { "sName": "AddDate", "sTitle": "档案日期", "sWidth": "100", "mDataProp": "AddDate" } , { "sName": "HouseAddress", "sTitle": "房源地址", "sWidth": "100", "mDataProp": "HouseAddress" } , { "sName": "UserName", "sTitle": "提交人", "sWidth": "100", "mDataProp": "UserName" } , { "sName": "OtherFiles", "sTitle": "文件名称", "sWidth": "", "mDataProp": "OtherFiles" }];
//step 显示数据
var strWhere = " where 1=1"; var strOrderby = " InfoId desc"; var strModuleCode = "@sysCurrentModuleInfo.ModuleCode"; var strDs = "@curListDsCode";ShowGridForBaseModule("myData", columns, strModuleCode, strDs, strWhere, strOrderby);
/***定义操作按钮事件**/
//增加
$("#btnAdd").click(function () { var sUrl = "@curControlName/index?showtype=detail&doCmd=add&mc=@sysCurrentModuleInfo.ModuleCode"; goUrl(sUrl); });//修改
$("#btnModify").click(function () { if (getCheckboxLength("cblInfo") != 1) { alert('修改时请选择一条记录.'); return; } var infoCode = getCheckboxFirstValue("cblInfo"); var sUrl = "@curControlName/index?showtype=detail&doCmd=modify&mc=@sysCurrentModuleInfo.ModuleCode&TicketCode=" + infoCode; goUrl(sUrl); }); //删除 $("#btnDelete").click(function () { if (getCheckboxLength("cblInfo") != 1) { alert('请选择一条记录.'); return false; } if (confirm("确认要删除吗?") == false) { return false; } var infoCode = getCheckboxFirstValue("cblInfo"); var sUrl = "@curControlName/ExecutePost"; var sParam = { Action: "delete", TicketCode: infoCode, SysFuncId: "@curMainSysFuncId" }; var retData = sysDoAjaxPost(sUrl, sParam); alert(retData.RetValue); if (retData.RetStatus = 100) { DefaultGridRefresh(); } }); $("#btnRfresh").click(function () { DefaultGridRefresh(); }); }); </script>}
if (curShowType == "detail")
{ <script type="text/javascript"> $(document).ready(function () { //设置表格样式 setTableTrBgColor('myTable', "even", "old");//保存
$("#btnSave").click(function () { //遍历取得勾选的值 var rows = document.getElementsByName("selectJ"); var sInfoId = ""; if (rows.length > 0) { for (var i = 0; i < rows.length; i++) { var curCheck = rows[i]; if (curCheck.checked) { //得到勾选的值,查到对应的值 sInfoId += rows[i].value + ","; } } } if (sInfoId == "") { alert('请选择一条记录'); return false; } else { sInfoId = sInfoId.substring(0, sInfoId.length - 1); } var sOtherFiles = document.getElementById("OtherFiles"); sOtherFiles.value = sInfoId; SetHiddenInputValue("curForm", "Action", "@curDoCmd"); SetHiddenInputValue("curForm", "TicketCode", "@DbService.DtV(curMainDetailEntity, "TicketCode")"); SetHiddenInputValue("curForm", "SysFuncId", "@curMainSysFuncId"); var retInfo = doSubmitForm("curForm", "@curControlName/executepost"); alert(retInfo.RetValue); if (retInfo.RetStatus == 101) { goUrl("@Html.Raw(RequestHelper.GetUrlReferrer())"); } else if (retInfo.RetStatus == 100) {}
});//返回
$("#btnReturn").click(function () { goUrl("@Html.Raw(RequestHelper.GetUrlReferrer())"); });});
function SetChecked() {
var mOtherFiles = , "OtherFiles")'; var rows = document.getElementsByName("selectJ"); if (rows.length > 0) { for (var i = 0; i < rows.length; i++) { var curCheck = rows[i]; if (mOtherFiles.indexOf(curCheck.value)>=0) { //得到勾选的值,查到对应的值 curCheck.checked = true; } } } }</script>
}
}}@section tbMainToolBar{ <div class="buttons"> @{ //列表页功能定义 if (curShowType == "list") { if (PermissionService.HasParamValue(ViewBag.RoleModuleParams, "add", "1", ref sysRoleModuleParam)) { @UIHelper.SetButton(sysRoleModuleParam.ParamCode, sysRoleModuleParam.ParamName); } if (PermissionService.HasParamValue(ViewBag.RoleModuleParams, "modify", "1", ref sysRoleModuleParam)) { @UIHelper.SetButton(sysRoleModuleParam.ParamCode, sysRoleModuleParam.ParamName); } if (PermissionService.HasParamValue(ViewBag.RoleModuleParams, "delete", "1", ref sysRoleModuleParam)) { @UIHelper.SetButton(sysRoleModuleParam.ParamCode, sysRoleModuleParam.ParamName); } @UIHelper.SetButton("Rfresh", "刷 新"); }//详细页功能定义
if (curShowType == "detail") { <button type="button" class="positive" name="btnSave" id="btnSave"> 保 存 </button> <button type="button" class="positive" name="btnReturn" id="btnReturn"> 返 回 </button> } } </div>}@section tbMainCondition{ @{ if (curShowType == "list") {}
}}@section tbMain{ @{ //列表页 if (curShowType == "list") { <table id="myData" class="display"> </table> }//详细页
if (curShowType == "detail") { <form id="curForm" action="" method="post"> <table id="myTable" class="detailTable"> <tr> <td class="fieldCaption"> 房源地址: </td> <td> @StringHelper.ToMvcString(HtmlControlHelper.GetText("HouseAddress", DbService.DtV(curMainDetailEntity, "HouseAddress"), 40, false, false)) </td> </tr> <tr> <td class="fieldCaption"> 提交人: </td> @if (curDoCmd == "add") { <td> @StringHelper.ToMvcString(HtmlControlHelper.GetText("UserName", sysUserLoginInfo.UserName, 40, false, false)) </td> } else { <td> @StringHelper.ToMvcString(HtmlControlHelper.GetText("UserName", DbService.DtV(curMainDetailEntity, "UserName"), 40, false, false)) </td> } </tr> <tr> <td class="fieldCaption"> 文件名称: </td> <td> <div> @if (dtHousingType != null && dtHousingType.Rows.Count > 0) { String mOtherFiles = DbService.DtV(curMainDetailEntity, "OtherFiles"); foreach (DataRow dataRow in dtHousingType.Rows) { String mKeyInfo = dataRow["ParameterValue"].ToString(); String mKeyId = dataRow["ParameterCode"].ToString(); if (mOtherFiles.IndexOf(mKeyInfo) >= 0) { <div style="width: 33%; float: left"> <input type="checkbox" name="selectJ" id="@mKeyId" value="@mKeyInfo" checked="checked"/>@mKeyInfo </div> } else { <div style="width: 33%; float: left"> <input type="checkbox" name="selectJ" id="@mKeyId" value="@mKeyInfo" />@mKeyInfo </div> }}
} </div> </td> </tr> @if (curDoCmd == "add") { @StringHelper.ToMvcString(HtmlControlHelper.GetHidden("AddDate", DateTime.Now.ToString())) } </table> @StringHelper.ToMvcString(HtmlControlHelper.GetHidden("OtherFiles", DbService.DtV(curMainDetailEntity, "OtherFiles"))) </form>}
}}@section tbMemo{ @{ //列表页 if (curShowType == "list") {}
//详细页
if (curShowType == "detail") {JS方法
@*<script type="text/javascript"> SetChecked(); </script>*@ }}}