• 审核流


    1.       新建一个存储过程

     

    -- =============================================

    -- Author:    <howie>

    -- Create date: <2015-03-30>

    -- Description:  <待审批>

    -- =============================================

    Create PROCEDURE [dbo].[TrainErp_spContractOtherExamineQuery]

       @pi_DoAction  varchar(100),

       @pi_ExamineCode varchar(50),

        @pi_FlowCode varchar(50),

       @pi_Audit varchar(50),

       @pi_PageIndex bigint,

       @pi_PageSize int,

       @po_RecordCount bigint output

    AS

    BEGIN

     

       DECLARE @pt_StartRowIndex INT

       DECLARE @pt_EndRowIndex INT

      

       SET @pt_StartRowIndex = (@pi_pageIndex - 1) * @pi_pageSize + 1

       SET @pt_EndRowIndex = @pi_pageIndex * @pi_PageSize

      

        --查询一条

       if @pi_DoAction='getone'

       begin

          SELECT *,@pi_FlowCode as FlowCode FROM TrainErp_Daliy_ContractOther  where ContractCode=@pi_ExamineCode

       end

     

       --查询多条

       if @pi_DoAction='getlist'

         

       begin

         

               SELECT * FROM

               (

                  SELECT

                  pt.*,

                  ROW_NUMBER() OVER (ORDER BY pt.ContractId desc) AS RowIndex

                  FROM TrainErp_Daliy_ContractOther  as pt

      

                  inner join TrainErp_CheckFlow_FlowStep as fs on pt.Step=fs.Step

                  where (@pi_FlowCode='' or fs.FlowCode=@pi_FlowCode) and (charindex(@pi_Audit,fs.Audit)>0)

              

                 

               ) tba

               WHERE RowIndex BETWEEN @pt_StartRowIndex AND @pt_EndRowIndex

              

               --得到总数

                  SELECT @po_recordCount = COUNT(*)

                  FROM TrainErp_Daliy_ContractOther  as pt

      

                  inner join TrainErp_CheckFlow_FlowStep as fs on pt.Step=fs.Step

                  where (@pi_FlowCode='' or fs.FlowCode=@pi_FlowCode) and (charindex(@pi_Audit,fs.Audit)>0)

                 

       end

     

      

    END

     

    注:只需要改个表名和存储过程名,将TrainErp_Daliy_ContractOther替换掉就行。

     

    2.运行程序,在后台审核流管理中添加:

    接着在审核流步骤中添加总共有几个步骤:

     

    3.       除了做好的模块页面之外,新建两个与模块对应的审核页面,也是listdetail

     

    4.       打开路径Areas/manage/Utilities

    在文件中增加一行代码:

    这行代码请通知耗子统一添加,做到了就告诉耗子,不允许个人添加

    5.       模块的页面就不阐述了,完成基本的增删改就好,接下来详细阐述一下审核页面的列表页和详细页:

    列表页:

     

    @using System.Data

    @using Adf.App.Interface.Entity

    @using Adf.App.Service.Service

    @using Adf.App.Service.UI

    @using Adf.Core.Database

    @using Adf.Core.Util

    @using Adf.Core.Web

    @using Adf.Web.Areas.Utilities

     

     

    @{

     

        /*-----------------------------------------------------------------------

         * @模块编码:ContractOtherExamine

         * @模块名称:合同审批待审批

         * @作者:howie

         * @创建时间:2015-03-25

         * @修改时间:

         -----------------------------------------------------------------------*/

     

        /* --系统变量-------------------------------------------------------- */

        Layout = "~/views/shared/SystemLoginLayout.cshtml";

        Module curModuleEntity = ViewBag.MainModuleEntity;

        LoginInfo sysLoginInfo = ViewBag.GlobalLoginInfo;

        List<UserModuleParam> sysModuleParamList = newList<UserModuleParam>();

        List<RoleModuleParam> sysRoleModuleParamList = ViewBag.RoleModuleParamList ?? newList<RoleModuleParam>();

        RoleModuleParam sysRoleModuleParam = newRoleModuleParam();

        /* --自定义变量-------------------------------------------------------- */

     

        DataTable dtFlow = DbService.Instance().QueryDataTable("TrainErp_CheckFlow_ExamineFlow", "", "");

     

    }

     

    @section MainHeader

    {

        <linkrel="stylesheet"type="text/css"href="/Plugs/combinationtext/combinationtext.css"/>

        <scripttype="text/javascript"src="/Plugs/combinationtext/jquery.combinationtext.js"></script>

        <scripttype="text/javascript">

     

            // List

            var curTableId = "myTable";

            var curListWhere = "@Html.Raw(curModuleEntity.ListDefaultWhere)";

            var curListOrderBy = "@Html.Raw(curModuleEntity.ListOrderBy)";

            var curListFields = "@Html.Raw(curModuleEntity.ListFields)";

            var curListQueryType = 3;

     

            //save

            var curSaveFields = "@Html.Raw(curModuleEntity.DetailSaveFields)";

            var curPrimaryFields = "@Html.Raw(curModuleEntity.PrimaryFields)";

     

     

            var queryParams = {

                pageIndex: 1,

                pageSize: @curModuleEntity.PageSize,

                recordCount: 0,

                pageCount: 1,

                MainDsCode: "@curModuleEntity.MainDsCode",

                detailDsCode: "@curModuleEntity.DetailDsCode",

                where: curListWhere,

                orderBy: curListOrderBy,

                fields: curListFields,

                queryType: curListQueryType,

                dataParam: {

    //页面注意点1:审核流类型替换

                    "DoAction": "getlist",

                    "FlowCode": "@EnumHelper.GetDescription(EAuditTypeCode.ContractOther)",

                    "Audit": "@sysLoginInfo.User.UserCode"

     

                }

            }

     

            var gConfig = {

                mc: "@curModuleEntity.ModuleCode",

                id: curTableId,

                tplColumnId: "tplColumnInfo",

                tplGridDataId: "tplGridData",

                tplFilterId: "tplFilterInfo",

                tplToolId: "tplToolInfo",

                queryParams: queryParams

            };

     

     

            $(function() {

     

     

                //初始化信息

                $("#" + curTableId).asDataGridV1(gConfig);

                gConfig = $("#" + curTableId).asDataGridV1("getConfig");

                //初始化

                doAjustGridScroll(curTableId, $(window).height() - 50);

                $(window).resize(function() {

                    doAjustGridScroll("myTable", $(window).height() - 50);;

                });

                $.asSetLayOut(); //设置表单控件样式

                /**---------列表部分--------------------------------------------------------------------------*/

                //定义当前的操作按钮控制信息

                $.asButtonEvent("add", "click", function() {

     

                    var sp = {};

                    sp.moduleCode = "@curModuleEntity.ModuleCode";

     

                    sp.detailDsCode = "@curModuleEntity.DetailDsCode";

     

                    sp.showType = "detail";

                    sp.doCmd = "add";

                    sp.d = new Date();

                    $.asAppGetForm(sp, function(retData) {

                        $("#" + gConfig.detailId).html(retData);

                        $("#" + gConfig.gridId).hide();

                        $("#" + gConfig.detailId + "").show();

     

                    }, function() {

                        alert("数据获取错误");

                    });

                    returnfalse;

                });

                

    //页面注意点2:审核执行存储过程为我们一开始建的存储过程

     

    //审核事件

                $.asButtonEvent("examine", "click", function() {

                    var cblInfo = $.asGetValuesOfCtrlName("gridform_myTable", "gridSel", "|");

                    if (cblInfo.length < 1) {

                        alert("请选择一条记录");

                        returnfalse;

                    }

                    var arrInfo = $.asSplitToArray(cblInfo, "|");

                    if (arrInfo.length > 1) {

                        alert("你选择多条记录了,只能选择一条记录");

                        returnfalse;

                    };

                    var sp = {};

                    sp.ProcName = "TrainErp_spContractOtherExamineQuery";

                    sp.DoAction = "getone";

                    sp.DoCmd = "examine";

                    sp.ExamineCode = cblInfo;

                    sp.moduleCode = "@curModuleEntity.ModuleCode";

     

                    $.asAppGetForm(

                        sp, function(retData) {

                            $("#" + gConfig.detailId).html(retData);

                            $("#" + gConfig.gridId).hide();

                            $("#" + gConfig.detailId + "").show();

     

                        }, function() {

                            alert("数据获取错误");

                        });

                    returnfalse;

                });

     

                //刷新当前列表页

                $.asButtonEvent("ListRfresh", "click", function() {

                    $.asTableReloadData(gConfig.id, queryParams);

                });

                //查询功能

                $.asButtonEvent("QueryFilter", "click", function() {

                    //构造查询参数

     

                    var s_FlowCode = $("#s_FlowCode").val();

                    queryParams.dataParam.FlowCode = s_FlowCode;

                    queryParams.dataParam.Audit = "@sysLoginInfo.User.UserCode";

                    //重新加载

                    $.asTableReloadData(gConfig.id, queryParams);

                });

                //返回至列表页

                $.asButtonEvent("btnReturnList", "click", function() {

                    $("#" + gConfig.detailId).hide();

                    $("#" + gConfig.gridId).show();

                    returnfalse;

                });

     

                /**---------详细页部分--------------------------------------------------------------------------*/

                $("body").on("click", ".save", function() {

                    if ($("#gridform_myTable").valid()) {

                        $.asFormSetHidden(gConfig.gridFormId, "mc", gConfig.mc);

                        $.asFormSetHidden(gConfig.gridFormId, "procName", "TrainErp_spWaitExamineExecute");

                        var param = {};

     

                        $.asAppSubmitFormProc(

                            gConfig.gridFormId, param, function(retData) {

                                //返回正确的数据

                                if (retData.RetStatus == 100 || retData.RetStatus == 101) {

                                    //刷新数据

                                    alert(retData.RetValue);

                                } else {

                                    alert(retData.RetValue);

                                }

                            }, function() {

                                //表单提交前进行验证

                                //return true 继续进行

                                //return false 阻止提交

                                //alert("进行验证字段是否合法");

     

                                returntrue;

                            }, function() {

                                alert("发生错误,请重新提交");

                            });

                    }

                    returnfalse;

                });

     

                //详细页,返回列表

                $("body").on("click", "#btnReturnList", function() {

                    $("#" + gConfig.detailId).hide();

                    $("#" + gConfig.gridId).show();

                    returnfalse;

                });

                $("#btnGetVal").click(function() {

     

                    alert($("#subBox").combinationtext('getValue'));

                });

     

     

            });

        </script>

    }

     

    @section MainBody

    {

     

        <divid="myTable"></div>

     

        <!--工具条信息-->

        <scripttype="text/html"id="tplToolInfo">

          

    //页面注意点3:数据集-模块-角色权限要增加一个操作:审核

     

     @{

          

                if (AppService.CheckRoleModuleParam(sysRoleModuleParamList, "examine", "1", ref sysRoleModuleParam))

                {

                <buttontype="button"id="btn@(sysRoleModuleParam.ParamCode)"class="@sysRoleModuleParam.ParamCode">@sysRoleModuleParam.ModuleParam.ParamName</button>

                }

              

            }

     

     

            <divstyle="clear: both"></div>

        </script>

     

        <!--过滤条件-->

        <scripttype="text/html"id="tplFilterInfo"class="dn">

            <tableclass="filter-Table">

                <tr>

     

                    <tdclass="w80px tar">审核流:@sysLoginInfo.User.UserCode</td>

                    <tdclass="w80px">

               <divclass="rule-single-select">

       @StringHelper.ToMvcString(HtmlControlHelper.GetDropDownList("s_FlowCode","", "",dtFlow, "FlowName", "FlowCode"))

                    </div>

                    </td>

                    <tdclass="w80px">

                        <inputtype="button"class="QueryFilter"id="btnQuery"value="查询"/>

     

                    </td>

                    <td></td>

                </tr>

            </table>

     

     

        </script>

       

    //页面注意点4:审核列表页显示内容,可以与搭建的模块页面的列表页一致

     

         <!--表头信息-->

        <scripttype="text/html"id="tplColumnInfo"class="dn">

            <tr>

                <thclass="w40px">选择</th>

                <thclass="w150px">合同编号</th>

                <thclass="w150px">合同名称</th>

                <thclass="w150px">客户名称</th>

                <thclass="w150px">电子资料</th>

               

            </tr>

        </script>

     

        <!--表体信息-->

        <textareaid="tplGridData"style="display: none;">

           {#foreach $T.rows as record}

            <tr>

             <td><inputtype="checkbox"name="gridSel"value="{$T.record.ContractCode}"/></td>

              <td>{$T.record.ContractCode}</td>

              <td>{$T.record.ContractName}</td>

              <td>{$T.record.ContractCustomer}</td>

              <td><ahref="/uploadfiles/{$T.record.ContractFile}">{$T.record.ContractFile}</a></td> 

            </tr>

          {#/for}

        </textarea>

     

    }

     

    详细页:

    @using System.Data

    @using Adf.App.Interface.Entity

    @using Adf.App.Service.Service

    @using Adf.App.Service.UI

    @using Adf.App.Service.UI.Form

    @using Adf.Core.Util

    @using Adf.Core.Database

    @using Adf.Core.UI.Form

    @using Adf.Core.Web

    @using Adf.Web.Areas.Utilities

    @{

        Layout = "~/views/shared/sysmdetail.cshtml";

        Module sysModuleEntity = ViewBag.MainModuleEntity;

        LoginInfo sysLoginInfo = ViewBag.GlobalLoginInfo;

        //数据

        DataTable curMainDataTable = ViewBag.MainDataTable;

        //当前页面变量

        String sysDoCmd = RequestHelper.GetFormString("DoCmd");

        //临时变量

        //参照数据源

        //审核历史记录,这个DataTable必须要,注意改一下主键

        DataTable dtHistory = DbService.Instance().QueryDataTable("select eh.*,u.UserName as AuditName from TrainErp_CheckFlow_ExamineHistory as eh inner join AdfV2_User as u on eh.Audit=u.UserCode where eh.ExamineCode='" + DbService.DtV(curMainDataTable, "ContractCode") + "' order by eh.AddTime");

        //页面用到的其他datatable,可有可无

        DataTable curDtSysConfigItems = AppService.QueryDataTable("ds-SysConfigItemsEdit", "where SysConfigItemsCode like '020%'", "SysConfigItemsCode,SysConfigItemsName,ParentCode", "Order by SortBy desc", false) ?? newDataTable();

        }

    @section MainTool

    {

        <linkhref="/Style/Manage/Default/css/timeaxis.css"rel="stylesheet"type="text/css"/>

           <scripttype="text/javascript"src="/Style/common/timeaxis.js"></script>

        <divclass="asDataGridTool">

            <buttontype="button"id="btnsave"class="save">保存</button>

            <buttonid="btnReturnList">返回列表</button>

            <divstyle="clear: both"></div>

        </div>

    }

    @section MainForm

    {

        <scripttype="text/javascript">

            $(function() {

                $.asSetLayOut();//设置表单控件样式

                /*Start表单验证*/

                $("#gridform_myTable").validate({

                    rules: {

                        ExamineStatus: {

                            required: true

                        }

                    },

                    //ignore:忽略某些元素不验证 

                    ignore: "",

                    //errorPlacementCallback Default: 把错误信息放在验证的元素后面 

                    //指明错误放置的位置,默认情况是:error.appendTo(element.parent());即把错误信息放在验证的元素后面 

                    errorPlacement: function (error, element) {

                        error.appendTo(element.parent());

                    },

                    success: function (label) {

                        label.html("&nbsp;").addClass("right");

                    }

                });

                /*End表单验证*/

            });

        </script>

        @*页面整体化,上半部分为我们所做的模块信息,直接显示出来,在我们做的查询存储过程中已经有数据了,然后注意一下<fieldset><legend>标签,注意页面美化*@

        <fieldset>

            <legend>基本信息</legend>

            <tableclass="asFormTable">

                <tr>

                    <tdstyle="width: 100px; text-align: right;">合同编号:</td>

                    <td>

                        @Html.Raw(HtmlControlHelper.GetText("ContractCode", DbService.DtV(curMainDataTable, "ContractCode"), 40, false, false))

                    </td>

                </tr>

                <tr>

                    <tdstyle="width: 100px; text-align: right;">合同名称:</td>

                    <td>

                        @Html.Raw(HtmlControlHelper.GetText("ContractName", DbService.DtV(curMainDataTable, "ContractName"), 40, false, false))

                    </td>

                </tr>

                <tr>

                    <tdstyle="width: 100px; text-align: right;">客户名称:</td>

                    <td>

                        @Html.Raw(HtmlControlHelper.GetText("ContractCustomer", DbService.DtV(curMainDataTable, "ContractCustomer"), 40, false, false))

                    </td>

                    <tdstyle="width: 100px; text-align: right;">合同分类:</td>

                    <td>

                        <divclass="rule-single-select">

                            @Html.Raw(HtmlControlHelper.GetDropDownList("ContractTypeCode", DbService.DtV(curMainDataTable, "ContractTypeCode"), "", curDtSysConfigItems, "SysConfigItemsName", "SysConfigItemsCode", ""))

                        </div>

                    </td>

                </tr>

                <tr>

                    <tdstyle="width: 100px; text-align: right;">合同状态:</td>

                    <td>

                        <divclass="rule-single-checkbox">

                            @Html.Raw(HtmlControlHelper.GetCheckBox("ContractStatus", "ContractStatus", "1", ((DbService.DtV(curMainDataTable, "ContractStatus")).ToLower().Equals("true")) ? "1" : "0"))

                        </div>

                    </td>

              

                    <tdstyle="width: 100px; text-align: right;">合同附件:</td>

                    <td>

                        @Html.Raw(HtmlControlHelper.GetText("ContractFile", DbService.DtV(curMainDataTable, "ContractFile"), 40, false, false))

                        @StringHelper.ToMvcString(HtmlControlHelper.GetButton("btnContractFile", "btnContractFile", "", "上传"))

                    </td>

                </tr>

            </table>

        </fieldset>

        @*第二部分:审核信息部分*@

        <fieldset>

            <legend>审核信息</legend>

            <table  class="asFormTable">

                <tr>

                    <tdstyle="width: 100px; text-align: right;">审核项:

                    </td>

                    <td>

                         <divclass="rule-single-select">

                        @StringHelper.ToMvcString(HtmlControlHelper.GetDropDownList("ExamineStatus", "", "", EnumHelper.GetAllOutPutToDt(typeof (EAuditItems)), "Description", "Val"))

                    </div>

                             </td>

                </tr>

                <tr>

                    <tdstyle="width: 100px; text-align: right;">审核说明:

                    </td>

                    <td>

                        @StringHelper.ToMvcString(HtmlControlHelper.GetTextArea("Remarks", "Remarks", "", "400px", 20, 3))

                    </td>

                </tr>

            </table>

        </fieldset>

        @*第三部分:审核历史部分,这部分无需改动,直接显示的页面。*@

        <fieldset>

            <legend>审核历史</legend>

         <divclass="container">

                  <divclass="main">

                      <ulclass="cbp_tmtimeline">

                          @{

                              int index = 1;

                              foreach (DataRow dr in dtHistory.Rows)

                              {

                                  <li>

                                      <timeclass="cbp_tmtime"><span>

                                            @dr["AddTime"].ToString()</span><span>@dr["AuditName"].ToString()</span></time>

                                      <divclass="cbp_tmicon ">@index</div>

                                      <divclass="cbp_tmlabel ">

                                          <h2>@EnumHelper.GetDescription(typeof (EAuditItems), dr["ExamineStatus"].ToString())</h2>

                                          <p>@dr["Remarks"].ToString()</p>

                                      </div>

                                  </li>

                                index++;

                              }

                         

                          }

                      </ul>

                  </div>

             </div>

        </fieldset>

        @*操作参数*@

        @Html.Raw(HtmlControlHelper.GetHidden("CreateUserCode", sysLoginInfo.User.UserCode))

        @Html.Raw(HtmlControlHelper.GetHidden("ModifyUserCode", sysLoginInfo.User.UserCode))

        @Html.Raw(HtmlControlHelper.GetHidden("DoCmd", sysDoCmd))

        @*审核流所需参数,注意主键要改掉*@

        @Html.Raw(HtmlControlHelper.GetHidden("ExamineCode", DbService.DtV(curMainDataTable, "ContractCode")))

        @Html.Raw(HtmlControlHelper.GetHidden("Step", DbService.DtV(curMainDataTable, "Step")))

        @Html.Raw(HtmlControlHelper.GetHidden("Audit", sysLoginInfo.User.UserCode))

        @*审核操作状态部分*@

        @Html.Raw(HtmlControlHelper.GetHidden("NotPass",Convert.ToString((int)EAuditItems.NotPass)))

        @Html.Raw(HtmlControlHelper.GetHidden("AsNotPass", Convert.ToString((int)EAuditStatus.NotPass)))

        @Html.Raw(HtmlControlHelper.GetHidden("AsPass", Convert.ToString((int)EAuditStatus.Pass)))

        @Html.Raw(HtmlControlHelper.GetHidden("AsAudit",Convert.ToString((int)EAuditStatus.Audit)))

        @*审核流部分*@

        @*第一个参数是耗子添加的部分,可以直接将方法点出来*@

        @Html.Raw(HtmlControlHelper.GetHidden("FlowCode", EnumHelper.GetDescription(EAuditTypeCode.ContractOther)))

        @*第二部分,替换表名称*@

        @Html.Raw(HtmlControlHelper.GetHidden("TableName", "TrainErp_Daliy_ContractOther"))

        @*第三部分,传一个主键Code*@

        @Html.Raw(HtmlControlHelper.GetHidden("PkCode", "ContractCode"))

       

    }

    @section MainHelper

    {

    }

     

    6.  其他注意点:

    a.  设计到审核流的表字段中添加两个字段:审核步骤:Step,审核状态:AuditStatus

    b.  新建一个数据集,用我们第一步建立的存储过程名称

    c.  新增一个模块,用来显示:

    d.角色权限中添加一个审核操作:examine 赋值为1

  • 相关阅读:
    Linux架构
    Python标准库09 当前进程信息 (os包)
    Linux从程序到进程
    Python标准库04 文件管理 (部分os包,shutil包)
    Python标准库10 多进程初步 (multiprocessing包)
    Python标准库06 子进程 (subprocess包)
    绘图: matplotlib Basemap简介
    树莓派与Linux
    绘图: Python matplotlib简介
    Linux进程间通信
  • 原文地址:https://www.cnblogs.com/howie/p/4999682.html
Copyright © 2020-2023  润新知