zrg
2024-01-16 7de00c5824ecfd39fec748386298ba0cedd4504e
WebTM/views/Éú²ú¹ÜÀí/ÒªÁϼƻ®/JIT_NeedMaterPlanBillEdit.html
@@ -55,6 +55,7 @@
                    <div style="padding: 10px; ">
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="Cancel" id="Cancel">退出</button>
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="btnSave" id="btnSave">保存</button>
                        <button class="layui-btn layui-btn-normal" style="margin-left: 0px" type="button" lay-submit="" lay-filter="HideColumn" id="HideColumn">列设置</button>
                    </div>
                    <div class="layui-tab" lay-filter="tab-POStockInBill">
                        <div class="layui-tab-content">
@@ -199,9 +200,9 @@
            <option value="1">蓝海实业集团</option>
            <option value="100035">蓝海通讯公司</option>
            <option value="100037">通讯公司本部</option>
            <option value="100038">手机事业部</option>
            <option value="100038">杭州工厂</option>
            <option value="100039">平板事业部</option>
            <option value="100040">蓝海电子公司</option>
            <option value="100040">江山工厂</option>
            <option value="100041">蓝海销售公司</option>
            <option value="100042">香港销售公司</option>
            <option value="100043">蓝海电子商务有限公司</option>
@@ -272,31 +273,8 @@
            //    }, function () { window.location.href = "../../user/login.html"; });
            //}
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 æ•°æ®ç±»åž‹  æ·»åŠ  ä¿å­˜
            var linterid = params[params[1]]; //从参数中获取 å•据内码
            var lSourceBillType = params[params[2]];  //从单据获取 æºå•类型
            //判断是否新增
            if (linterid == null || linterid == -1) {
                OperationType = 1;
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    data: { "HBillType": '4609' },
                    success: function (d) {
                        //console.log(d.data);
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                    }
                });
            }
            else {//如果修改则走下面 new
                RoadBillMain(linterid);
                //RoadBillSub(linterid);
            }
            var HModName = "JIT_NeedMaterPlanBill";
            var option = {
                elem: '#mainTable'
                , toolbar: '#toolbarDemo'
@@ -345,11 +323,36 @@
                    , { fixed: 'right', title: '操作', toolbar: '#barDemo' }
                ]]
            }
            //初始加载表格
            option.data = rowdata;
            table.render(option);
            DisPlay_HideColumn();
            var params = getUrlVars();
            var OperationType = params[params[0]]; //从参数中获取 æ•°æ®ç±»åž‹  æ·»åŠ  ä¿å­˜
            var linterid = params[params[1]]; //从参数中获取 å•据内码
            var lSourceBillType = params[params[2]];  //从单据获取 æºå•类型
            //判断是否新增
            if (linterid == null || linterid == -1) {
                OperationType = 1;
                $.ajax({
                    url: GetWEBURL() + "/Web/GetMAXNum",
                    type: "GET",
                    data: { "HBillType": '4609' },
                    success: function (d) {
                        //console.log(d.data);
                        $("#HInterID").val(d.data[0].HInterID);
                        $("#HBillNo").val(d.data[0].HBillNo);
                        $("#HDate").val(Format(new Date(), "yyyy-MM-dd"));
                    }
                });
            }
            else {//如果修改则走下面 new
                //$("#HProdORGID").attr("disabled", true);
                RoadBillMain(linterid);
                //RoadBillSub(linterid);
            }
            //#endregion
            //#region è§¦å‘事件:包括form.on(){}格式的所有点击事件、选择事件等
@@ -506,6 +509,11 @@
                }
            });
            //隐藏列设置
            form.on('submit(HideColumn)', function (data) {
                get_HideColumn();
            });
            //监听提交
            form.verify({
                numberOrEmpty: function (value, item) {
@@ -600,6 +608,7 @@
                $.ajax({
                    type: "get",
                    url: GetWEBURL() + "/Web/GetOrganizations",
                    async:false,
                    success: function (result) {
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data;
@@ -607,6 +616,7 @@
                                Organization += '<option  style="color:blue;" value="' + data[i].ID + '">' + data[i].Name + '</option>';
                            }
                            $("#HProdORGID").append(Organization);
                            $("#HProdORGID").val(sessionStorage["OrganizationID"]);
                            form.render('select');
                        }
                        layer.closeAll("loading");
@@ -828,9 +838,122 @@
                                }
                            })
                        }
                        obj.event = "";
                        return false;
                    }
                })
            }
            //隐藏列设置
            function get_HideColumn() {
                var colName = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: ['../../基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //显示列数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    async: false,
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["HMaterID", "HUnitID", "HICMOEmpID"];//不需要显示的字段 å¯æ‰©å±•
                            dataCol = data1.data[0].HGridString.split(',');
                            for (var i = 0; i < option.cols[0].length - 2; 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 (data1.data[0].HColumnWidth != 0) {
                                //    option.cols[0][i + 1]["width"] = data1.data[0].HColumnWidth + "px;";
                                //} else {
                                //    option.cols[0][i + 1]["width"] = "";
                                //}
                                //显示列
                                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);
                        } else {
                            table.render(option);
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                })
            }
@@ -841,6 +964,7 @@
                $.ajax({
                    url: GetWEBURL() + "/Sc_WorkDemandPlanBill/Sc_WorkDemandPlanBillList",
                    type: "GET",
                    async: false,
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"] },
                    success: function (d) {
@@ -849,7 +973,7 @@
                            "HBillNo": d.data[0].单据号
                            , "HInterID": d.data[0].hmainid
                            , "HAddress": d.data[0].交货地点
                            , "HProdORGID": d.data[0].主生产组织
                            , "HProdORGID": d.data[0].HProdORGID
                            , "HDeptID": d.data[0].HDeptID
                            , "HDeptIDName": d.data[0].车间名称
                            , "HSettleCurrId": d.data[0].HSettleCurrId
@@ -902,9 +1026,9 @@
                        }
                        form.render('select');
                        form.render('checkbox');
                    }
                })
            }
@@ -929,7 +1053,7 @@
                var sMainStr = JSON.stringify(data.field);
                var sSubStr = JSON.stringify(num);
                var sMainSub = sMainStr + ';' + sSubStr + ';' + OperationType + ";" + sessionStorage["HUserName"];
                var index = layer.load();
                $.ajax({
                    type: "POST",