博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
选择框输入内容增加时拼接,修改时判断是否在拼接的字符串内
阅读量:6176 次
发布时间:2019-06-21

本文共 8085 字,大约阅读时间需要 26 分钟。

@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>*@
        } 
       

       

   
    }
}

转载于:https://www.cnblogs.com/howie/p/3727834.html

你可能感兴趣的文章
[题解]UVA11029 Leading and Trailing
查看>>
利用vue-gird-layout 制作可定制桌面 (一)
查看>>
校园社交网站app
查看>>
如何指定某些文件关闭ARC
查看>>
4、跃进表
查看>>
JAVA面向对象的总结(静态函数与static关键字)
查看>>
课堂作业第四周课上作业一
查看>>
使用Java语言开发微信公众平台(七)——音乐消息的回复
查看>>
陶哲轩实分析习题9.1.6
查看>>
常用音频软件:Cool edit pro
查看>>
努力的方向,除了诗和远方,还有一堆技术。
查看>>
SQL CHECK 约束
查看>>
git提交到一半关闭时
查看>>
WMware 10 Ubuntu 12.04 进入Unity模式
查看>>
简单通用的访问CVS的方法
查看>>
kbengine mmo源码(完整服务端源码+资源+完整客户端源码)
查看>>
【操作系统】实验四 主存空间的分配和回收
查看>>
Log4j 配置 的webAppRootKey参数问题
查看>>
VMware ESXi 5.0中时间配置中NTP设置
查看>>
C++中memset()函数笔记
查看>>