1
yxj
2024-01-25 c9d0da28b32debada8d015ab1e2cdc4502cd6708
WebTM/views/ÏúÊÛ¹ÜÀí/ÏúÊÛ¶©µ¥/Add_Edit_Xs_SeOrderBillList.html
@@ -15,25 +15,36 @@
    <script src="../../../layuiadmin/Scripts/webConfig.js"></script>
    <script src="../../../layuiadmin/PubCustom.js"></script>
    <script src="../../../layuiadmin/zgqCustom/zgqCustom.js"></script>
    <style type="text/css">
        /*.layui-form-item .layui-inline {
            margin-right: 0;
    <style>
        .main-btn { /*头部主按钮*/
            padding: 0 2px; /*调整按钮左右空隙大小*/
            height: 30px;
            line-height: 30px;
        }
        html {
            background-color: white;
            color: white;
        .btn-title {
            font-size: 16px;
        }
        /* é˜²æ­¢ä¸‹æ‹‰æ¡†çš„下拉列表被隐藏---必须设置--- */
        .layui-table-cell {
            overflow: visible !important;
        }
        /* ä½¿å¾—下拉框与单元格刚好合适 */
        td .layui-form-select {
            margin-top: -10px;
            margin-left: -15px;
            margin-right: -15px;
        }*/
        }
        .layui-form-item .layui-inline {
            margin-top: 0px;
            margin-bottom: 5px;
            margin-right: 0px;
        }
        .layui-form-label {
            width: 25%;
        }
    </style>
</head>
<body>
@@ -366,7 +377,13 @@
    <script type="text/html" id="barDemo">
        <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
    </script>
    <!--行下拉选择(是否取库存)-->
    <script type="text/html" id="HisStockGoods">
        <select name="HisStockGoods" lay-filter="HisStockGoods" id="HisStockGoods{{d.LAY_TABLE_INDEX+1}}">
            <option value="false">否</option>
            <option value="true">是</option>
        </select>
    </script>
    <script>
        //#region æŠ˜å æ³¨é‡Š
        //#endregion
@@ -562,6 +579,7 @@
                    "HlineTotal": "0",
                    "HlineTotalBB": "0",
                    "HDate": Format(new Date(), 'yyyy-MM-dd'),
                    "HisStockGoods": "false",
                    "HOutStockQty": "0",
                    "HInvoiceQty": "0",
                    "HRemark": "",
@@ -639,6 +657,9 @@
                            });
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            layer.msg("数量请输入大于0的数字!");
                            return;
                        }
@@ -674,6 +695,10 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //刷新表格同时根据option中HisStockGoods值设置下拉列表
                        setSelectHisStockGoodsByTableRender();
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
@@ -686,6 +711,9 @@
                                HPrice: oldText
                            });
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            layer.msg("单价请输入大于0的数字!");
                            return;
@@ -722,6 +750,10 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //刷新表格同时根据option中HisStockGoods值设置下拉列表
                        setSelectHisStockGoodsByTableRender();
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
@@ -734,6 +766,9 @@
                                HTaxRate: oldText
                            });
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            layer.msg("税率请输入不小于0的数字!");
                            return;
@@ -770,6 +805,10 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //刷新表格同时根据option中HisStockGoods值设置下拉列表
                        setSelectHisStockGoodsByTableRender();
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
@@ -782,6 +821,9 @@
                                HTaxPrice: oldText
                            });
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            layer.msg("含税单据请输入不小于0的数字!");
                            return;
@@ -818,6 +860,10 @@
                            , HlineTotal: HlineTotal
                        });
                        table.render(option);
                        //刷新表格同时根据option中HisStockGoods值设置下拉列表
                        setSelectHisStockGoodsByTableRender();
                        //设置表头所需金额
                        set_HBillMoney();
                        break;
@@ -966,15 +1012,12 @@
                    , cols: [[ //子表
                        { type: 'checkbox', totalRowText: '合计行', style: 'background-color:#efefef4d;' }
                        , { type: 'numbers', title: '序号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HOrderLevID', title: 'HOrderLevID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '订单等级代码', title: '订单等级代码', width: 150, hide: true, edit: 'text', event: "HOrderLevID" }//f7
                        , { field: '订单等级名称', title: '订单等级名称', width: 150, style: 'background-color:#efefef4d;' }
                        , { field: 'HMaterID', title: 'HMaterID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '物料代码', title: '物料代码', width: 150, edit: 'text', event: "HMaterID" }//f7
                        , { field: '物料名称', title: '物料名称', width: 150, style: 'background-color:#efefef4d;' }
                        , { field: 'HOrderLevID', title: 'HOrderLevID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '订单等级代码', title: '订单等级代码', width: 150, edit: 'text', event: "HOrderLevID" }//f7
                        , { field: '订单等级名称', title: '订单等级名称', width: 150, style: 'background-color:#efefef4d;' }
                        , { field: 'HCusMaterNumber', title: '客户物料编码', width: 100, edit: 'text' }
                        , { field: 'HCusModel', title: '客户规格型号', width: 100, edit: 'text' }
                        , { field: 'HCusMaterName', title: '客户物料名称', width: 100, edit: 'text' }
                        , { field: '规格型号', title: '规格型号', width: 100, style: 'background-color:#efefef4d;' }
                        , { field: 'HUnitID', title: 'HUnitID', width: 100, hide: true, style: 'background-color:#efefef4d;' }
                        , { field: '计量单位', title: '计量单位', width: 100, style: 'background-color:#efefef4d;' }//f7
@@ -984,7 +1027,11 @@
                        , { field: 'HTaxPrice', title: '含税单价', width: 100, edit: 'text' }
                        , { field: 'HMoney', title: '金额', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HlineTotal', title: '价税合计', width: 100, totalRow: true, style: 'background-color:#efefef4d;' }
                        , { field: 'HCusMaterNumber', title: '客户物料编码', width: 100, edit: 'text' }
                        , { field: 'HCusModel', title: '客户规格型号', width: 100, edit: 'text' }
                        , { field: 'HCusMaterName', title: '客户物料名称', width: 100, edit: 'text' }
                        , { field: 'HDate', title: '交货日期', event: "HDate", width: 120 }
                        , { field: 'HisStockGoods', title: '是否取库存', width: 120, templet: '#HisStockGoods' }
                        , { field: 'HRemark', title: '备注', width: 100, edit: 'text' }
                        , { field: 'HDiscountRate', title: '折扣率', width: 100, edit: 'text', hide: true }
                        , { field: 'HRelTaxPrice', title: '实际含税单价', width: 110, hide: true }
@@ -994,6 +1041,21 @@
                        , { field: 'HInvoiceQty', title: '开票数量', width: 100, edit: 'text', hide: true }
                        , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 70 }
                    ]]
                    , done: function (res, curr, count) {
                        option.data = res.data;
                        //去掉下拉框失焦事件否则在下拉框里输入值
                        $('.layui-form-select').find('input').unbind("blur");
                        //表格重载回显下拉框里的数据
                        $('tr').each(function (e) {
                            var $cr = $(this);
                            var dataIndex = $cr.attr("data-index");
                            $.each(option.data, function (index, value) {
                                if (value.LAY_TNDEX == dataIndex) {
                                    $cr.find('input').val(value.HisStockGoods);
                                }
                            });
                        });
                    }
                }
                var rowdata = [{
@@ -1017,6 +1079,7 @@
                    "HlineTotal": "0",
                    "HlineTotalBB": "0",
                    "HDate": Format(new Date(),'yyyy-MM-dd'),
                    "HisStockGoods": "false",
                    "HOutStockQty": "0",
                    "HInvoiceQty": "0",
                    "HRemark": "",
@@ -1027,6 +1090,9 @@
                option.data = rowdata;
                table.render(option);
                //刷新表格同时根据option中HisStockGoods值设置下拉列表
                setSelectHisStockGoodsByTableRender();
                //设置表头所需金额
                set_HBillMoney();
@@ -1142,6 +1208,7 @@
                                        "HTaxMoney": result.data[i]["税额"],
                                        "HlineTotal": dealDoubleToFixed(result.data[i]["价税合计"], 2),
                                        "HlineTotalBB": result.data[i]["本位币价税合计"],
                                        "HisStockGoods": result.data[i]["是否取库存"]=="Y"?true:false,
                                        "HDate": formatDate(result.data[i]["交货日期"]),
                                        "HOutStockQty": result.data[i]["出库数量"],
                                        "HInvoiceQty": result.data[i]["开票数量"],
@@ -1160,6 +1227,9 @@
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            //设置表头所需金额
                            set_HBillMoney();
                            layer.close(ajaxLoad);
@@ -1175,6 +1245,7 @@
            }
            //#endregion
            //#region è¡¨å¤´é€‰æ‹©æ–¹æ³•
            //#region é”€å”®å‘˜é€‰æ‹©é¡µé¢
            function get_checkEmp() {
                layer.open({
@@ -1376,6 +1447,7 @@
                    , btn2: function (index, layero) { }
                })
            }
            //#endregion
            //#endregion
            //#region ä¿å­˜æ–¹æ³•
@@ -1666,6 +1738,10 @@
                table.cache["mainTable"].push(NewRow);
                option.data = table.cache["mainTable"];
                table.render(option);
                //刷新表格同时根据option中HisStockGoods值设置下拉列表
                setSelectHisStockGoodsByTableRender();
                //设置表头所需金额
                set_HBillMoney();
                //rows++;
@@ -1689,6 +1765,10 @@
                    }
                    option.data = tables;
                    table.render(option);
                    //刷新表格同时根据option中HisStockGoods值设置下拉列表
                    setSelectHisStockGoodsByTableRender();
                    //设置表头所需金额
                    set_HBillMoney();
                } else {
@@ -1715,6 +1795,10 @@
                    option.data[option.data.length - 1].HWeight = "0";
                    table.render(option);//将数据渲染到表格上
                    //刷新表格同时根据option中HisStockGoods值设置下拉列表
                    setSelectHisStockGoodsByTableRender();
                    //设置表头所需金额
                    set_HBillMoney();
                }
@@ -1741,6 +1825,10 @@
                            option.data[i - 1] = data[0];
                            option.data[i] = tables[0];
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            //设置表头所需金额
                            set_HBillMoney();
                            break;
@@ -1774,6 +1862,10 @@
                            option.data[i + 1] = data[0];
                            option.data[i] = tables[0];
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            //设置表头所需金额
                            set_HBillMoney();
                            break;
@@ -1801,6 +1893,10 @@
                            oldData.splice(obj.tr.data('index'), 1);
                            option.data = oldData;
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                            //设置表头所需金额
                            set_HBillMoney();
                            layer.close(index);
@@ -1808,6 +1904,19 @@
                    });
                }
            }
            //#endregion
            //#region è¡¨æ ¼è¡Œé€‰æ‹©å¤„理(是否取库存)
            form.on('select(HisStockGoods)', function (data) {
                //获取下拉框选中的值
                var elem = data.othis.parents('tr');
                var dataindex = elem.attr("data-index");
                $.each(option.data, function (index, value) {
                    if (value.LAY_TABLE_INDEX == dataindex) {
                        value.HisStockGoods = data.value;//把选中下拉框id值赋值给表格缓存
                    }
                });
            });
            //#endregion
            //#region è¡Œå†…快捷键筛选
@@ -1896,6 +2005,10 @@
                                    }
                                    table.render(option);
                                    //刷新表格同时根据option中HisStockGoods值设置下拉列表
                                    setSelectHisStockGoodsByTableRender();
                                    //设置表头所需金额
                                    set_HBillMoney();
@@ -2015,7 +2128,7 @@
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["HMaterID", "HUnitID", "折扣率", "实际含税单价", "税额","本位币价税合计","出库数量","开票数量"];//不需要显示的字段 å¯æ‰©å±•
                            var titleData = ["HMaterID", "HUnitID", "折扣率", "实际含税单价", "税额", "本位币价税合计", "出库数量", "开票数量", "HOrderLevID","订单等级代码"];//不需要显示的字段 å¯æ‰©å±•
                            //titleData = [];
                            dataCol = data1.data[0].HGridString.split(',');
@@ -2079,8 +2192,15 @@
                                }
                            }
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                        } else {
                            table.render(option);
                            //刷新表格同时根据option中HisStockGoods值设置下拉列表
                            setSelectHisStockGoodsByTableRender();
                        }
                    }, error: function () {
                        layer.alert("接口请求失败!", { icon: 5 });
@@ -2204,6 +2324,15 @@
                return HSourceBillData;
            }
            //#endregion
            //#region åˆ·æ–°è¡¨æ ¼åŒæ—¶æ ¹æ®option中HisStockGoods值设置下拉列表
            function setSelectHisStockGoodsByTableRender() {
                for (var i = 1; i <= option.data.length; i++) {
                    $('#HisStockGoods' + i + '').find("option[value='" + option.data[i - 1].HisStockGoods + "']").attr("selected", true);
                }
                form.render('select');
            }
            //#endregion
            //#endregion