yangle
2024-10-27 f6d6a3c0c65103cb4a58e4f929ed7a1c8da21b9a
WebTM/views/¹¤×ʹÜÀí/¶¨¶îÉêÇë/Pay_ProcPriceRequestBillList.html
@@ -150,6 +150,7 @@
                            </div>
                        </div>
                        <table class="" id="mainTable" lay-filter="mainTable"></table>
                        <div id="page" style="position: relative; bottom: 0;"></div>
                        <script type="text/html" id="toolbarDemo">
                            <div class="layui-btn-container">
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_Export" id="btn_Export"><i class="layui-icon layui-icon-export"></i>导出</button>
@@ -160,6 +161,11 @@
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_Refresh" id="btn_Refresh"><i class="layui-icon layui-icon-refresh-3"></i>刷新</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_Audit" id="btn_Audit"><i class="layui-icon layui-icon-radio"></i>审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_DeAudit" id="btn_DeAudit"><i class="layui-icon layui-icon-circle"></i>反审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_startCheckBill" id="set_startCheckBill"><i class="layui-icon layui-icon-form"></i>发起审批</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_CheckFlowInfo" id="get_CheckFlowInfo"><i class="layui-icon layui-icon-form"></i>查看审批进度</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_CheckBill_Flow" id="CheckBill_Flow"><i class="layui-icon layui-icon-form"></i>多级审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_AbandonCheck_Flow" id="AbandonCheck_Flow"><i class="layui-icon layui-icon-form"></i>多级反审核</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_RejectCheck_Flow" id="RejectCheck_Flow"><i class="layui-icon layui-icon-form"></i>驳回</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_Close" id="btn_Close"><i class="layui-icon layui-icon-radio"></i>关闭</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_DeClose" id="btn_DeClose"><i class="layui-icon layui-icon-circle"></i>反关闭</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn_Drop" id="btn_Drop"><i class="layui-icon layui-icon-radio"></i>作废</button>
@@ -199,6 +205,8 @@
            var sWhere = "";
            var ins;                //用于导出excel
            var option = [];
            var page = 1;//分页数据
            var size = 50;
            var columns = "";
            var titleData = [];     //不需要显示的字段
            //#endregion
@@ -243,7 +251,7 @@
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , page: true
                    , page: false
                    , totalRow: true
                    , height: 'full-50'
                    , cellMinWidth: 90
@@ -253,6 +261,28 @@
                        soulTable.render(this);
                    }
                };
                optionPage = {
                    elem: 'page', //注意,这里的 page æ˜¯ ID,不用加 # å·
                    count: 10000, //数据总数,从服务端得到
                    limit: 50,
                    limits: [50, 500, 5000, 50000],
                    layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
                    jump: function (obj, first) {
                        //console.log(obj)
                        //obj包含了当前分页的所有参数,比如:
                        //console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
                        //console.log(obj.limit); //得到每页显示的条数
                        //首次不执行
                        if (!first) {
                            //do something
                            page = obj.curr;
                            size = obj.limit;
                            get_FastQuery();
                        }
                    }
                }
                laypage.render(optionPage);
            }
            //#endregion
@@ -278,86 +308,193 @@
            //#endregion
            //#region æ˜¾ç¤ºåˆ—数据
            //function DisPlay_HideColumn() {
            //    $.ajax({
            //        type: "GET",
            //        url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
            //        async: false,
            //        data: { "HModName": HModName, "user": HMaker },
            //        success: function (data1) {
            //            if (data1.data.length != 0) {
            //                var dataCol = [];//数据库查询出的列数据
            //                dataCol = data1.data[0].HGridString.split(',');
            //                for (var i = 0; i < option.cols[0].length - 2; i++) {
            //                    if (dataCol[i]) {
            //                        var dataCols = dataCol[i].split('|');
            //                    }
            //                    //隐藏列
            //                    if (dataCols[1] == 1) {
            //                        option.cols[0][i + 1]["hide"] = true;
            //                    }
            //                    //设置列宽
            //                    if (dataCols[3] > 0) {
            //                        option.cols[0][i + 1]["width"] = dataCols[3];
            //                    }
            //                    //设置内容字体大小
            //                    if (data1.data[0].HFontSize != 0) {
            //                        option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
            //                    } else {
            //                        option.cols[0][i + 1]["style"] = "font-size:100%";
            //                    }
            //                    //显示列
            //                    if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
            //                        option.cols[0][i + 1]["hide"] = false;
            //                    }
            //                    //字体所在位置(å·¦ å±…中 å³)
            //                    switch (dataCols[2]) {
            //                        case "L":
            //                            option.cols[0][i + 1]["align"] = "left";
            //                            break;
            //                        case "M":
            //                            option.cols[0][i + 1]["align"] = "center";
            //                            break;
            //                        case "R":
            //                            option.cols[0][i + 1]["align"] = "right";
            //                            break;
            //                    }
            //                }
            //                //取消冻结列
            //                for (var i = 1; i < option.cols[0].length - 1; i++) {
            //                    if (option.cols[0][i]["fixed"] != null) {
            //                        option.cols[0][i]["fixed"] = null;
            //                    }
            //                    else {
            //                        break;
            //                    }
            //                }
            //                //冻结列
            //                if (data1.data[0].HFixCols != 0) {
            //                    for (var i = 0; i < data1.data[0].HFixCols; i++) {
            //                        if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
            //                            data1.data[0].HFixCols += 1;
            //                        }
            //                        option.cols[0][i + 1]["fixed"] = "left";
            //                    }
            //                }
            //                table.render(option);
            //                ins = table.render(option);
            //            } else {
            //                table.render(option);
            //                ins = table.render(option);
            //            }
            //            //刷新按钮显示
            //            var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
            //            Display_HideButton(btns, HBillType, HModName, HMaker);
            //        }, error: function () {
            //            layer.alert("接口请求失败!", { icon: 5 });
            //        }
            //    })
            //}
            //#endregion
            //#region æ˜¾ç¤ºåˆ—数据
            function DisPlay_HideColumn() {
                $.ajax({
                    type: "GET",
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    async: false,
                    data: { "HModName": HModName, "user": HMaker },
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var newCols = [[]];//对应数据库列顺序col
                            newCols[0].push(option.cols[0][0]);//放入第一个checkbox
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option.cols[0].length - 2; i++) {
                                if (dataCol[i]) {
                                    var dataCols = dataCol[i].split('|');
                                }
                                //隐藏列
                                if (dataCols[1] == 1) {
                                    option.cols[0][i + 1]["hide"] = true;
                                }
                                //设置列宽
                                if (dataCols[3] > 0) {
                                    option.cols[0][i + 1]["width"] = dataCols[3];
                                }
                                //设置内容字体大小
                                if (data1.data[0].HFontSize != 0) {
                                    option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                } else {
                                    option.cols[0][i + 1]["style"] = "font-size:100%";
                                }
                                //显示列
                                if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                    option.cols[0][i + 1]["hide"] = false;
                                }
                                //字体所在位置(å·¦ å±…中 å³)
                                switch (dataCols[2]) {
                                    case "L":
                                        option.cols[0][i + 1]["align"] = "left";
                                        break;
                                    case "M":
                                        option.cols[0][i + 1]["align"] = "center";
                                        break;
                                    case "R":
                                        option.cols[0][i + 1]["align"] = "right";
                                        break;
                                }
                            }
                            //取消冻结列
                            for (var i = 1; i < option.cols[0].length - 1; i++) {
                                if (option.cols[0][i]["fixed"] != null) {
                                    option.cols[0][i]["fixed"] = null;
                                }
                                else {
                                    break;
                                }
                            }
                            //冻结列
                            if (data1.data[0].HFixCols != 0) {
                                for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                    if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                        data1.data[0].HFixCols += 1;
                            //列设置列数与页面列数是否一致
                            if (dataCol.length == option.cols[0].length - 1) {
                                //遍历寻找列设置对应列按顺序插入
                                for (var j = 0; j < option.cols[0].length - 1; j++) {
                                    for (var i = 0; i < option.cols[0].length - 1; i++) {
                                        var dataCols = dataCol[j].split('|');
                                        //选择与datacols相应列进行修改
                                        if (option.cols[0][i + 1]["field"] == dataCols[5]) {
                                            //隐藏列
                                            if (dataCols[1] == 1) {
                                                option.cols[0][i + 1]["hide"] = true;
                                            }
                                            //设置列宽
                                            if (dataCols[3] > 0) {
                                                option.cols[0][i + 1]["width"] = dataCols[3];
                                            }
                                            //设置内容字体大小
                                            if (data1.data[0].HFontSize != 0) {
                                                option.cols[0][i + 1]["style"] = "font-size:" + data1.data[0].HFontSize + "px;";
                                            } else {
                                                option.cols[0][i + 1]["style"] = "font-size:100%";
                                            }
                                            //显示列
                                            if (dataCols[1] == 0 && $.inArray(option.cols[0][i + 1]["title"], titleData) == -1) {
                                                option.cols[0][i + 1]["hide"] = false;
                                            }
                                            //统计列
                                            if (dataCols[6] == 1) {
                                                option.cols[0][i + 1]["totalRow"] = true;
                                            }
                                            //字体所在位置(å·¦ å±…中 å³)
                                            switch (dataCols[2]) {
                                                case "L":
                                                    option.cols[0][i + 1]["align"] = "left";
                                                    break;
                                                case "M":
                                                    option.cols[0][i + 1]["align"] = "center";
                                                    break;
                                                case "R":
                                                    option.cols[0][i + 1]["align"] = "right";
                                                    break;
                                            }
                                            //设置表格title属性显示别名
                                            if (dataCols[4] != null && dataCols[4] != "") {
                                                option.cols[0][i + 1]["title"] = dataCols[4];
                                            }
                                            newCols[0].push(option.cols[0][i + 1]);
                                        }
                                    }
                                    option.cols[0][i + 1]["fixed"] = "left";
                                }
                                //遍历循环后判断对应列数是否一致
                                if (dataCol.length == newCols[0].length - 1) {
                                    option.cols = newCols;
                                    //取消冻结列
                                    for (var i = 1; i < option.cols[0].length - 1; i++) {
                                        if (option.cols[0][i]["fixed"] != null) {
                                            option.cols[0][i]["fixed"] = null;
                                        }
                                        else {
                                            break;
                                        }
                                    }
                                    //冻结列
                                    if (data1.data[0].HFixCols != 0) {
                                        for (var i = 0; i < data1.data[0].HFixCols; i++) {
                                            if ($.inArray(option.cols[0][i + 1]["title"], titleData) != -1) {
                                                data1.data[0].HFixCols += 1;
                                            }
                                            option.cols[0][i + 1]["fixed"] = "left";
                                        }
                                    }
                                }
                            }
                            table.render(option);
                        } else {
                            table.render(option);
                        }
                        //刷新按钮显示
                        var btns = document.getElementsByTagName("button");     //获取本页所有按钮对象
                        Display_HideButton(btns, HBillType, HModName, HMaker);
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
            //#endregion
            //#endregion
@@ -390,6 +527,21 @@
                        break;
                    //反审核按钮
                    case 'btn_DeAudit': set_CheckBill(2);
                        break;
                    //发起审批
                    case 'set_startCheckBill': set_startCheckBill();
                        break;
                    //查看审批进度
                    case 'get_CheckFlowInfo': get_CheckFlowInfo();
                        break;
                    //多级审核
                    case 'set_CheckBill_Flow': set_CheckBill_Flow(0);
                        break;
                    //多级反审核
                    case 'set_AbandonCheck_Flow': set_CheckBill_Flow(1);
                        break;
                    //驳回
                    case 'set_RejectCheck_Flow': set_RejectCheck_Flow();
                        break;
                    //关闭按钮        ï¼ˆ1:关闭、2:反关闭)
                    case 'btn_Close': set_CloseBill(1);
@@ -668,12 +820,157 @@
            }
            //#endregion
            //#region å‘起审批
            function set_startCheckBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑审核方法
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Pay_ProcPriceRequestBill/StartCheckFlow", //方法所在页面和方法名
                        data: { "HInterID": InterID, "CurUserName": sessionStorage["HUserName"] },
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                    // å¾—到frame索引
                                    var index = layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    layer.close(index);
                                    $("#btnSearch").trigger('click');
                                });
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                    //修改为功后刷新界面
                    $("#btnSearch").trigger('click');
                }
                else {
                    layer.msg('请选择一行数据审核!');
                }
            }
            //#endregion
            //#region æŸ¥çœ‹å®¡æ‰¹è¿›åº¦
            function get_CheckFlowInfo() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var hID = data[0].hmainid.toString();
                    layer.open({
                        type: 2
                        , area: ['70%', '70%']
                        , title: '单据审批进度'
                        , closeBtn: 1
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: '../../系统管理/多级审批/审批进度/Xt_CheckFlowProgressList.html?linterid=' + hID + '&HSouceBillType=' + HBillType
                        , resize: false,
                        end: function () {
                            ////修改为功后刷新界面
                            //if (get_needClose_Bar == 0) {
                            //    $("#btnSearch").trigger('click');
                            //} else if (get_needClose_Bar == 1) {
                            //    $("#get_needClose").trigger('click');
                            //}
                        }
                        , cancel: function () {
                        }
                    })
                } else {
                    layer.msg('请选择一行数据查看!');
                }
            }
            //#endregion
            //#region å¤šçº§ åå®¡æ ¸/审核数据
            function set_CheckBill_Flow(num) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑审核方法
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Pay_ProcPriceRequestBill/AuditFlow", //方法所在页面和方法名
                        data: { "HInterID": InterID, "IsAudit": num, "CurUserName": sessionStorage["HUserName"], "CurUserID": sessionStorage["Czybm"] },
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                    // å¾—到frame索引
                                    var index = layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    layer.close(index);
                                    //修改为功后刷新界面
                                    $("#btnSearch").trigger('click');
                                });
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据审核!');
                }
            }
            //#endregion
            //#region é©³å›ž
            function set_RejectCheck_Flow(num) {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑审核方法
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Pay_ProcPriceRequestBill/RejectCheckFlow", //方法所在页面和方法名
                        data: { "HInterID": InterID, "CurUserID": sessionStorage["Czybm"] },
                        success: function (result) {
                            if (result.count == 1) {
                                layer.msg(result.Message, { time: 1 * 1000, icon: 1 }, function () {
                                    // å¾—到frame索引
                                    var index = layer.getFrameIndex(window.name);
                                    //关闭当前frame
                                    layer.close(index);
                                });
                                //修改为功后刷新界面
                                $("#btnSearch").trigger('click');
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                        }, error: function () {
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据审核!');
                }
            }
            //#endregion
            //#region åˆ—设置
            function get_HideColumn() {
                var colName = "";
                var contentUrl = "";
                for (var i = 1; i < option.cols[0].length; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                    colName += option.cols[0][i]["field"] + ",";
                }
                var urlStr = window.document.location.pathname;//获取文件路径
                var urlLen = urlStr.split('/');
@@ -682,7 +979,7 @@
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
                contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide_New.html?HModName=' + HModName + '&colName=' + colName;
                layer.open({
                    type: 2
@@ -733,7 +1030,11 @@
            //#region æŸ¥è¯¢æŒ‰é’®
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery();
                if (page != 1) {
                    $("#page a:eq(1)").get(0).click();//点击分页栏第一页
                } else {
                    get_FastQuery();
                }
            });
            //快速查询
@@ -824,7 +1125,7 @@
                if (HBillNo) {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                }
                get_Display(sWhere);
                get_DisplayPage(sWhere);
                sWhere = "";//调用接口后清空sWhere缓存
            }
@@ -900,12 +1201,89 @@
                });
            }
            //#endregion
            //#region åˆ†é¡µæŸ¥è¯¢
            function get_DisplayPage(sWhere) {
                var wait = layer.load();//遮罩
                var ajaxLoad = layer.load();
                $.ajax({
                    url: GetWEBURL() + '/Pay_ProcPriceRequestBillController/page',
                    type: "GET",
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"], "page": page, "size": size },
                    success: function (data1) {
                        option.limit = size;//改变表格页大小
                        if (data1.code == 1) {
                            optionPage.count = data1.count;//改变列表数据总数
                            var data = [];
                            var col = [];
                            //给空的数组赋值
                            for (var key in data1.list) {
                                //动态获取列表所有列名
                                data.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                                //获取不需要显示的列(H开头的列不显示)
                                var patrn = new RegExp(/^h/i);
                                if (patrn.test(data1.list[key].ColmCols)) {
                                    titleData[key] = data1.list[key].ColmCols;
                                }
                            }
                            //在列表左边添加勾选框
                            col.push({ type: 'checkbox', fixed: 'left', totalRowText: '合计' });
                            for (var i = 0; i < data.length; i++) {
                                // if (data[i].name == 'HInterID' || data[i].name == 'HBillType' || data[i].name == 'hmainid') {
                                if ($.inArray(data[i].name, titleData) > -1) {
                                    col.push({ field: data[i].id, title: data[i].name, align: 'center', hide: true }); //隐藏id列
                                }
                                else {
                                    switch (data[i].Type) {
                                        //int
                                        case 'DateTime':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, templet: "<div>{{d." + data[i].name + " ==null ?'':layui.util.toDateString(d." + data[i].name + ", 'yyyy-MM-dd HH:mm:ss')}}</div>", width: 160 });
                                            break;
                                        case 'Decimal':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140, totalRow: true });
                                            break;
                                        case 'Int32':
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140, totalRow: true });
                                            break;
                                        default:
                                            col.push({ field: data[i].id, title: data[i].name, align: 'center', sort: false, width: 140 });
                                    }
                                }
                            }
                            columns = col;
                            option.cols = [col];
                            option.data = data1.data;
                            option.totalRow = true;
                            laypage.render(optionPage);
                            //刷新表格数据
                            DisPlay_HideColumn();
                            layer.close(ajaxLoad);
                            if ($("#ColName option").length < 1) {
                                ColFilter();
                            }
                            //layer.alert("查询成功", { icon: 1 });
                        } else {
                            //option.data = [[]]
                            //table.render(option);
                            layer.close(ajaxLoad);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(ajaxLoad);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
            }
            //#endregion
            //#region åˆ—明显示下拉框
            function ColFilter() {
                var Organization = '<option  value="0" selected="selected" ></option>';
                for (var i = 1; i < option.cols[0].length; i++) {
                    if (option.cols[0][i].hide != true) {
                        Organization += '<option  style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].field + '</option>';
                        Organization += '<option  style="color:blue;" value="' + option.cols[0][i].field + '">' + option.cols[0][i].title + '</option>';
                    }
                }
                $("#ColName").empty();