zzr99
2022-01-12 390416c9232bb497108baaf09f496ee6a746808a
组托
1个文件已修改
351 ■■■■ 已修改文件
WebTM/views/生产管理/生产包装单/Sc_PackUnionBill.html 351 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WebTM/views/Éú²ú¹ÜÀí/Éú²ú°ü×°µ¥/Sc_PackUnionBill.html
@@ -9,11 +9,6 @@
    <link rel="stylesheet" href="../../../layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../layuiadmin/style/admin.css" media="all">
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <style type="text/css">
        input.layui-input.layui-unselect {
            padding-right: 0;
@@ -97,7 +92,13 @@
            </div>
        </div>
    </div>
    <script src="../../../layuiadmin/layui/layui.js"></script>
    <script src="../../../layuiadmin/Scripts/json2.js"></script>
    <script src="../../../layuiadmin/Scripts/jquery-1.4.1.js"></script>
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script>
        var cols_arr = []; //存储表格头的数组
        var table = null;
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
@@ -114,16 +115,18 @@
                , util = layui.util
            //查询条件
            var sWhere = "";
            var resultTableHead = []; //获取列表头字段自定义列数组
            var option = [];
            var Name = "Sc_PackUnionBillMain";
            var pageCount = 50;//每页多少行
            var pageIndex = 1;//当前页码值
            //#region è¿›å…¥é¡µé¢æ—¢åŠ è½½
            //初始化表格
            set_InitGrid();
            //加载数据到网格
            get_FastQuery(table, option);
            //初始化界面
            set_ClearBill();
            //#endregion
            //#region ç‚¹å‡»äº‹ä»¶åŒ…括on form事件等
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                switch (obj.event) {
@@ -168,294 +171,90 @@
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery(table, option);
                get_FastQuery();
            });
            //初始化表格
            function set_InitGrid() {
                $("#HDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , height: 'full-50'
                    , page: true
                    , cellMinWidth: 90
                    , limits: [10, 500, 1000, 5000, 10000]
                    , limit: 50
                    , cols: [[
                        { type: 'checkbox', fixed: 'left', totalRowText: '合计' }
                        , { field: 'hmainid', title: '单据ID', hide: true }
                        , { field: '日期', title: '日期', width: 160, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '单据号', title: '单据号', width: 160 }
                        , { field: '箱号条形码', title: '箱号条形码', width: 160 }
                        , { field: '净重', title: '净重', width: 160 }
                        , { field: '毛重', title: '毛重', width: 160 }
                        , { field: '皮重', title: '皮重', width: 160 }
            //初始化界面
            function set_ClearBill() {
                resultTableHead = []; //清空表头列,防止重复渲染
                //初始查询
                get_Display(sWhere);
                        , { field: 'HProdOrgID', title: 'HProdOrgID', width: 200, hide: true }
                        , { field: '生产组织', title: '生产组织', width: 160 }
                        , { field: 'HDeptID', title: 'HDeptID', width: 200, hide: true }
                        , { field: '部门', title: '部门', width: 160 }
                        , { field: 'HEmpID', title: 'HEmpID', width: 200, hide: true }
                        , { field: '操作员', title: '操作员', width: 160 }
                        , { field: '客户标签号', title: '客户标签号', width: 160 }
                        , { field: 'HMaterID', title: 'HMaterID', width: 200, hide: true }
                        , { field: '物料代码', title: '物料代码', width: 200 }
                        , { field: '物料名称', title: '物料名称', width: 200 }
                        , { field: 'hunitid', title: 'hunitid', width: 200, hide: true }
                        , { field: '计量单位代码', title: '计量单位代码', width: 200 }
                        , { field: '计量单位名称', title: '计量单位名称', width: 200 }
                        , { field: '数量', title: '数量', width: 115 }
                        , { field: '制单人', title: '制单人', width: 200 }
                        , { field: '制单日期', title: '制单日期', width: 120, templet: "<div>{{d.制单日期 ==null ?'':layui.util.toDateString(d.制单日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '审核人', title: '审核人', width: 100 }
                        , { field: '审核日期', title: '审核日期', width: 120, templet: "<div>{{d.审核日期 ==null ?'':layui.util.toDateString(d.审核日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '修改人', title: '修改人', width: 100 }
                        , { field: '修改日期', title: '修改日期', width: 120, templet: "<div>{{d.修改日期 ==null ?'':layui.util.toDateString(d.修改日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '关闭人', title: '关闭人', width: 100 }
                        , { field: '关闭日期', title: '关闭日期', width: 120, templet: "<div>{{d.关闭日期 ==null ?'':layui.util.toDateString(d.关闭日期, 'yyyy-MM-dd')}}</div>" }
                        , { field: '作废人', title: '作废人', width: 100 }
                        , { field: '作废日期', title: '作废日期', width: 120, templet: "<div>{{d.作废日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd')}}</div>" }
                    ]]
                    }
            }
            //加载网格
            function get_Display(sWhere) {
                var wait = layer.load();//遮罩
                $.ajax({
                    url: GetWEBURL() + '/Sc_PackUnionBill/Get_PackUnionBillList',
                    type: "GET",
                    data: { "sWhere": sWhere },
                    data: { "sWhere": sWhere, "page": 1, "limit": 10 },
                    datatype: "json",
                    success: function (data1) {
                        if (data1.count == 1) {
                            DataList = data1.data;
                            option.data = data1.data;
                            table.render(option);
                            layer.close(wait);
                        } else {
                            layer.close(wait);
                            layer.alert(data1.Message, { icon: 5 });
                        console.log(data1);
                        for (var key in data1.list) {
                            resultTableHead.push({ "id": data1.list[key].ColmCols, "name": data1.list[key].ColmCols, "Type": data1.list[key].ColmType });
                        }
                    }, error: function () {
                        layer.close(wait);
                        layer.alert("接口请求失败!", { icon: 5 });
                        set_InitGrid(sWhere);
                    }, error: function (err) {
                        layer.alert(err.Message, { icon: 5 });
                    }
                });
            }
            //新增
            function set_AddNew() {
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '新增生产领料单',
                    closeBtn: 1,
                    shift: 2,
                    area: ['100%', '100%'],
                    maxmin: true,
                    content: '../生产包装单/Sc_PackUnionBillEdit.html?OperationType=1&linterid=&HSouceBillType=0&closeType=1',
                    end: function () {
                        //刷新页面,
                        get_FastQuery(table, option);
            //初始化表格
            function set_InitGrid() {
                //填充表格头数组
                var data = resultTableHead;
                cols_arr[0] = [];
                cols_arr[0][0] = { checkbox: true, fixed: true, totalRowText: '合计' };
                for (var i = 0; i < data.length; i++) {
                    if (data[i].name == 'hmainid') {
                        cols_arr[0][i + 1] = { field: data[i].id, title: data[i].name, align: 'center', hide: true }; //隐藏id列
                    }
                    else {
                        switch (data[i].Type) {
                            //int
                            case 'Int32':
                                cols_arr[0][i + 1] = { field: data[i].id, title: data[i].name, align: 'center', totalRow: true, sort: true };
                                break;
                            //Decimal
                            case 'Decimal':
                                cols_arr[0][i + 1] = { field: data[i].id, title: data[i].name, align: 'center', totalRow: true, sort: true };
                                break;
                            default:
                                cols_arr[0][i + 1] = { field: data[i].id, title: data[i].name, align: 'center', sort: true };
                        }
                    }
                }
                //填充表格数据
                table.render({
                    elem: '#mainTable',
                    url: GetWEBURL() + '/Sc_PackUnionBill/Get_PackUnionBillList',
                    title: '组托单列表',
                    cols: cols_arr,    //填充表格头数据,
                    id: 'mainTable', //表格id
                    where: { sWhere: sWhere }, //扩展参数,可以传数据到后台
                    page: true,   //开启分页
                    totalRow: true, //开启合计
                    limit: 10,     //一页能够显示的最大数目
                    limits: [10, 20, 40, 60, 80, 100], //控制多少行一页(默认五条一页)
                    method: 'get',  //提交方式
                    layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'],
                    response: {
                        statusCode: 1 //重新规定成功的状态码为 1,table ç»„件默认为 0
                    },
                    success: function (layero, index) {
                    done: function (res) {   //返回数据执行回调函数
                        layer.close(layer.index);    //返回数据关闭loading
                    }
                });
            }
            //编辑单据
            function set_ShowBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var linterid = data[0].hmainid.toString();
                    //if (AllowLoadData(sSubStr) != false) {//非空验证
                    layer.open({
                        type: 2
                        , area: ['100%', '100%']
                        , title: '编辑生产领料单'
                        , closeBtn: 1
                        , shade: 0.6 //遮罩透明度
                        , maxmin: true //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: '../生产包装单/Sc_PackUnionBillEdit.html?OperationType=3&linterid=' + linterid + '&HSouceBillType=0&closeType=1'
                        , resize: false,
                        end: function () {
                            get_FastQuery(table, option);
                        }
                        , cancel: function () {
                            //$(".layui-btn").removeClass("layui-btn-disabled");
                        }
                    })
                } else {
                    layer.msg('请选择一行数据编辑!');
                }
            }
            //删除
            function set_DeleteBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑删除方法
                    layer.confirm("确认要删除吗,删除后不能恢复", { title: "删除确认" }, function (index) {
                        var wait = layer.load();
                        $.ajax({
                            type: "GET",
                            url: GetWEBURL() + "/Sc_PackUnionBill/set_DeleteBill", //方法所在页面和方法名
                            data: { "HInterID": InterID, "user": 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);
                                        //修改为功后刷新界面
                                        window.location.reload();
                                    });
                                } else {
                                    layer.alert(result.code + result.Message, { icon: 5 });
                                }
                                layer.close(wait);
                            }, error: function () {
                                layer.close(wait);
                                layer.alert("接口请求失败!", { icon: 5 });
                            }
                        });
                    })
                }
                else {
                    layer.msg('请选择一行数据删除!');
                }
            }
            //预览
            function get_ViewReport() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    layer.open({
                        type: 2
                        , area: ['50%', '50%']
                        , title: '打印模版选择'
                        , shade: 0.6 //遮罩透明度
                        , maxmin: false //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + data[0].hmainid.toString() + '&MyMsg=' + data[0].hmainid.toString() + '&Type=HMouldProdInBill', 'yes']
                        , resize: false
                    })
                }
                else {
                    layer.msg('请选择一行数据打印!');
                }
            }
            //打印
            function get_PrintReport() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    layer.open({
                        type: 2
                        , area: ['50%', '50%']
                        , title: '打印模版选择'
                        , shade: 0.6 //遮罩透明度
                        , maxmin: false //允许全屏最小化
                        , anim: 0 //0-6的动画形式,-1不开启
                        , content: ['../../BaseSet/SRM_OpenTmpList.html?linterid=' + data[0].hmainid.toString() + '&MyMsg=' + data[0].hmainid.toString() + '&Type=HMouldProdInBill', 'yes']
                        , resize: false
                    })
                }
                else {
                    layer.msg('请选择一行数据打印!');
                }
            }
            //审核
            function set_CheckBill() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑审核方法
                    var wait = layer.load();
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Sc_MouldProdInBill/set_CheckBill", //方法所在页面和方法名
                        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);
                                    //修改为功后刷新界面
                                    get_FastQuery(table, option);
                                });
                            } else {
                                layer.alert(result.Message, { icon: 5 });
                            }
                            layer.close(wait);
                        }, error: function () {
                            layer.close(wait);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据审核!');
                }
            }
            //反审核
            function set_AbandonCheck() {
                var checkStatus = table.checkStatus('mainTable')
                    , data = checkStatus.data;
                if (checkStatus.data.length === 1) {
                    var InterID = data[0].hmainid.toString();
                    //逻辑审核方法
                    var wait = layer.load();
                    $.ajax({
                        type: "GET",
                        url: GetWEBURL() + "/Sc_MouldProdInBill/set_AbandonCheck", //方法所在页面和方法名
                        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);
                                    //修改为功后刷新界面
                                    get_FastQuery(table, option);
                                });
                            } else {
                                layer.alert(result.code + result.Message, { icon: 5 });
                            }
                            layer.close(wait);
                        }, error: function () {
                            layer.close(wait);
                            layer.alert("接口请求失败!", { icon: 5 });
                        }
                    });
                }
                else {
                    layer.msg('请选择一行数据反审核!');
                }
            }
            //快速过滤
            function get_FastQuery(table, option) {
            function get_FastQuery() {
                var HDate = $("#HDate").val();//开始日期
                var HBillNo = $("#HBillNo").val(); //单据号
                var HDepartName = $("#HDepartName").val();
                var HMaterNumber = $("#HMaterNumber").val();
                var HMaterName = $("#HMaterName").val();
                var HMakerMan = $("#HMakerMan").val();
                if (HDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HDate + "'";
                }
@@ -474,10 +273,8 @@
                if (HMakerMan) {
                    sWhere += " and åˆ¶å•人 like '%" + HMakerMan + "%'";
                }
                var index = layer.load(0);
                get_Display(sWhere);
                //调用接口后清空sWhere缓存
                sWhere = " ";
                set_ClearBill(sWhere);
                sWhere = "";
            }
            //重置过滤条件
            function set_ClearQuery() {
@@ -488,7 +285,7 @@
                $("#HMaterName").val("");
                $("#HMakerMan").val("");
                sWhere = " ";
                get_FastQuery(table, option);
                get_FastQuery();
            }
            //刷新
            function set_Refresh() {