1
duhe
2023-07-10 38b348abb560910433db712d0fe80e38eb3e73dc
WebTM/views/²É¹º¹ÜÀí/ίÍâ¶©µ¥/WW_EntrustOrderBillList.html
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>委外订单列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
@@ -9,7 +9,13 @@
    <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/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>
</head>
<body>
    <div class="layui-fluid">
@@ -25,38 +31,120 @@
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">分配状态</label>
                                    <div class="layui-input-block">
                                        <select name="HStatus" lay-filter="HStatus" style="width:190px;">
                                            <option value="" selected="selected">全部</option>
                                            <option value="未分配">未分配</option>
                                            <option value="已分配">已分配</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">发布状态</label>
                                    <div class="layui-input-block">
                                        <select name="HStatus2" lay-filter="HStatus2" style="width:190px;">
                                            <option value="" selected="selected">全部</option>
                                            <option value="未发布">未发布</option>
                                            <option value="已发布">已发布</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">开始日期</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HDate">
                                        <input type="date" class="layui-input" id="HBeginDate" style="width:190px;">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">结束日期</label>
                                    <div class="layui-input-block">
                                        <input type="date" class="layui-input" id="HDate1">
                                        <input type="date" class="layui-input" id="HEndDate" style="width:190px;">
                                    </div>
                                </div>
                                <!--<div class="layui-inline">
                                    <label class="layui-form-label">订单跟踪号</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="HOrderProcNO" id="HOrderProcNO">
                                    </div>
                                </div>-->
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnSearch" id="btnSearch">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>
                                <button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnReSearch" id="btnReSearch" style="padding:0 5px">重置</button>
                                <div class="layui-colla-content">
                                    <div class="layui-inline">
                                        <div class="layui-inline">
                                            <span>其他条件></span>
                                        </div>
                                    </div>
                                    <!--<div class="layui-inline">
        <div class="layui-inline">
            <span>其他条件></span>
        </div>
    </div>-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">单据号</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="WorkCenter" id="WorkCenter">
                                            <input type="text" class="layui-input" name="HBillNo" id="HBillNo" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">业务员</label>
                                        <div class="layui-input-block" style="width:190px;">
                                            <select name="HEmpName" lay-filter="HEmpName" id="HEmpName">
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">协同状态</label>
                                        <div class="layui-input-block">
                                            <select name="HXTStatus" lay-filter="HXTStatus" style="width:190px;">
                                                <option value="" selected>全部</option>
                                                <option value="未确认">未确认</option>
                                                <option value="已确认">已确认</option>
                                            </select>
                                        </div>
                                    </div>
                                    <!--<div class="layui-inline">
        <label class="layui-form-label">反馈状态</label>
        <div class="layui-input-block">
            <input type="text" class="layui-input" name="HXTFKStatus" id="HXTFKStatus" style="width:190px;">
        </div>
    </div>-->
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料编码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HMaterShortNumber" id="HMaterShortNumber" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料代码</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HMaterNumber" id="HMaterNumber" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">物料名称</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HMaterName" id="HMaterName" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline">
                                        <label class="layui-form-label">供应商</label>
                                        <div class="layui-input-block">
                                            <input type="text" class="layui-input" name="HSupName" id="HSupName" style="width:190px;">
                                        </div>
                                    </div>
                                    <div class="layui-inline" style="margin-left:30px">
                                        <label class="layui-form-label">反馈状态</label>
                                        <div class="layui-input-block" style="width:190px;">
                                            <select name="HFeedback" lay-filter="HFeedback">
                                                <option value="" selected>全部</option>
                                                <option value="接收">接收</option>
                                                <option value="备料">备料</option>
                                                <option value="生产">生产</option>
                                                <option value="发货">发货</option>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="layui-inline" style="margin-left:30px">
                                        <label class="layui-form-label">完成状态</label>
                                        <div class="layui-input-block" style="width:190px;">
                                            <select name="HFinishStatus" lay-filter="HFinishStatus">
                                                <option value="" selected>全部</option>
                                                <option value="未完成" selected>未完成</option>
                                                <option value="已完成">已完成</option>
                                            </select>
                                        </div>
                                    </div>
                                </div>
@@ -66,12 +154,18 @@
                        <script type="text/html" id="toolbarDemo">
                            <div class="layui-btn-container">
                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-getCheckData"><i class="layui-icon layui-icon-tips"></i>预览</button>-->
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-reload"><i class="layui-icon layui-icon-refresh"></i>刷新</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-confirm" id="btn_confirm"><i class="layui-icon layui-icon-ok-circle"></i>确认</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-fp"><i class="layui-icon layui-icon-tips"></i>分配</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-fb"><i class="layui-icon layui-icon-tips"></i>发布</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-back"><i class="layui-icon layui-icon-close-fill"></i>撤销</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-yxj"><i class="layui-icon layui-icon-tips"></i>优先级</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Refresh"><i class="layui-icon layui-icon-refresh"></i>刷新</button>
                                <!--<button type="button" class="layui-btn layui-btn-sm" lay-event="btn-confirm" id="btn_confirm"><i class="layui-icon layui-icon-ok-circle"></i>确认</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-back" id="btn_back"><i class="layui-icon layui-icon-close-fill"></i>驳回</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-details"><i class="layui-icon layui-icon-form"></i>详情</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-generate"><i class="layui-icon layui-icon-file"></i>生成送货单</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-exit"><i class="layui-icon layui-icon-return"></i>退出</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="btn-generate"><i class="layui-icon layui-icon-file"></i>生成送货单</button>-->
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="set_HideColumn"><i class="layui-icon layui-icon-form"></i>列设置</button>
                                <button type="button" class="layui-btn layui-btn-sm" lay-event="get_Exit"><i class="layui-icon layui-icon-return"></i>退出</button>
                                <!--<button class="layui-btn layuiadmin-btn-order" type="button" lay-submit="" lay-filter="btnResCnz" id="btnReSearch" style="padding:0 5px">重新同步</button>-->
                            </div>
                        </script>
@@ -80,176 +174,1062 @@
            </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>
    <script type="text/javascript">
        layui.config({
            base: '../../../layuiadmin/' //静态资源所在路径
        }).extend({
            index: 'lib/index', //主入口模块
        }).use(['index', 'form', 'table', 'element', 'laypage','laydate'], function () {
        }).use(['index', 'form', 'table', 'element', 'laypage', 'laydate'], function () {
            //#region å…¬å…±å˜é‡
            var $ = layui.$
            , admin = layui.admin
            , layer = layui.layer
            , table = layui.table
            , form = layui.form
            , element = layui.element
            , laypage = layui.laypage
            , laydate = layui.laydate
            //var sWhere = " äº§å“ä»£ç  = 'BX0002'";
                , admin = layui.admin
                , layer = layui.layer
                , table = layui.table
                , form = layui.form
                , element = layui.element
                , laypage = layui.laypage
                , laydate = layui.laydate
                , util = layui.util
            //查询条件
            var sWhere = "";
            var option = [];
            var Name = "MouldProdInHouseCellWidth";
            var HModName = "WW_EntrustOrderBillList";
            //#endregion
            var option = {
                elem: '#mainTable'
                //, toolbar: '#toolbarDemo'
                ,height: 'full-50'
                , page: true
                ,cellMinWidth: 90
                , cols: [[
                    { field: 'hmainid', title: 'hmainid', sort: true, hide: true }
                    , { field: '日期', title: '日期' }
                    , { field: '单据号', title: '单据号' }
                    , { field: 'HBillType', title: 'HBillType', hide: true }
                    , { field: 'HSupID', title: 'HSupID', hide: true }
                    , { field: '供应商代码', title: '供应商代码' }
                    , { field: '供应商', title: '供应商' }
                    , { field: '地址', title: '地址' }
                    , { field: 'HSSID', title: 'HSSID', hide: true }
                    , { field: '结算方式代码', title: '结算方式代码' }
                    , { field: '结算方式', title: '结算方式' }
                    , { field: '结算日期', title: '结算日期' }
                    , { field: 'HCurID', title: 'HCurID', hide: true }
                    , { field: '币别代码', title: '币别代码' }
                    , { field: '币别', title: '币别' }
                    , { field: '汇率', title: '汇率' }
                    , { field: 'HDeptID', title: 'HDeptID', hide: true }
                    , { field: '部门代码', title: '部门代码' }
                    , { field: '部门', title: '部门' }
                    , { field: 'HManagerID', title: 'HManagerID', hide: true }
                    , { field: '主管代码', title: '主管代码' }
                    , { field: '主管', title: '主管' }
                    , { field: 'HEmpID', title: 'HEmpID', hide: true }
                    , { field: '业务员代码', title: '业务员代码' }
                    , { field: '业务员', title: '业务员' }
                    , { field: '摘要', title: '摘要' }
                    , { field: '表头备注', title: '表头备注' }
                    , { field: 'hsubid', title: 'hsubid', hide: true }
                    , { field: 'HMaterID', title: 'HMaterID', hide: true }
                    , { field: '物料代码', title: '物料代码' }
                    , { field: '物料名称', title: '物料名称' }
                    , { field: '规格型号', title: '规格型号' }
                    , { field: '批号', title: '批号' }
                    , { field: 'HUnitID', title: 'HUnitID', hide: true }
                    , { field: '计量单位代码', title: '计量单位代码' }
                    , { field: '计量单位', title: '计量单位' }
                    , { field: '数量', title: '数量' }
                    , { field: '单价', title: '单价' }
                    , { field: '金额', title: '金额' }
                    , { field: '税率', title: '税率' }
                    , { field: '税额', title: '税额' }
                    , { field: '价税合计', title: '价税合计' }
                    , { field: '到货日期', title: '到货日期' }
                    , { field: '源单单号', title: '源单单号' }
                    , { field: '计划跟踪号', title: '计划跟踪号' }
                    , { field: '表体备注', title: '表体备注' }
                    , { field: '制单人', title: '制单人' }
                    , { field: '制单日期', title: '制单日期' }
                    , { field: '审核人', title: '审核人' }
                    , { field: '审核日期', title: '审核日期' }
                    , { field: '修改人', title: '修改人' }
                    , { field: '修改日期', title: '修改日期' }
                    , { field: '关闭人', title: '关闭人' }
                    , { field: '关闭日期', title: '关闭日期' }
                    , { field: '作废人', title: '作废人' }
                    , { field: '作废日期', title: '作废日期' }
                ]]
            };
            //#region è¿›å…¥é¡µé¢æ—¢åŠ è½½
            set_ClearBill();
            //#endregion
            //进入页面显示的缓存列表
            var index0 = layer.load(0, { shade: false });
            $.ajax({
                //url: "http://61.130.49.162:9090/WMSAPI///Web/GetMAXNum",
                url: GetWEBURL() + '/WW_EntrustOrderBill/list',
                type: "GET",
                data: { "sWhere": sWhere },
                success: function (data1) {
                    if (data1.count == 1) {
                        option.data = data1.data;
                        table.render(option);
                        layer.close(index0);
                    } else {
                        layer.close(index0);
                        layer.alert(data1.code + data1.Message, { icon: 5 });
                    }
                }, error: function () {
                    layer.close(index0);
                    layer.alert("接口请求失败!", { icon: 5 });
                }
            });
            //#region ç‚¹å‡»äº‹ä»¶åŒ…括on form事件等
            //头工具栏事件
            table.on('toolbar(mainTable)', function (obj) {
                switch (obj.event) {
                    //新增按钮
                    case 'btn-Add': set_AddNew();
                        break;
                    //编辑按钮
                    case 'btn-Edit': set_ShowBill();
                        break;
                    //删除按钮
                    case 'btn-Delete': set_DeleteBill();
                        break;
                    //浏览
                    case 'btn-view': get_ViewReport();
                        break;
                    //打印
                    case 'btn-print': get_PrintReport();
                        break;
                    //刷新
                    case 'get_Refresh': set_Refresh();
                        break;
                    //退出
                    case 'get_Exit': Pub_Close(2);
                        break;
                    //分配
                    case 'btn-fp': set_Distribut();
                        break;
                    //发布
                    case 'btn-fb': set_Release();
                        break;
                    //优先级
                    case 'btn-yxj': set_Yxj();
                        break;
                    case 'btn-back': set_Back();
                        break;
                    //列设置
                    case 'set_HideColumn': get_HideColumn();
                        break;
                };
            });
            //重置按钮
            form.on('submit(btnReSearch)', function (data) {
                $("#HDate").val("");//开始日期
                $("#HDate1").val("");//结束日期
                $("#WorkCenter").val("");//单据号
                $("#btnSearch").click();
                set_ClearQuery();
            });
            //查询按钮
            form.on('submit(btnSearch)', function (data) {//选择仓位
                var HDate = $("#HDate").val();//开始日期
                var HDate1 = $("#HDate1").val();//结束日期
                var HOrderProcNO = $("#HOrderProcNO").val();//订单跟踪号
                var WorkCenter = $("#WorkCenter").val();//单据号
                if (HDate) {
                    sWhere += " and æ—¥æœŸ >= '" + HDate + "'";
            form.on('submit(btnSearch)', function (data) {
                get_FastQuery(table, option);
            });
            //表头信息部门弹窗
            form.on('submit(Department)', function () {
                //页面层-自定义
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '供应商列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../PublicPage/SupplierInformation.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        $("#HSupName").val(checkStatus.data[0].HName);
                        $("#HSupID").val(checkStatus.data[0].HItemID);
                        layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            });
            //#endregion
            //#region æ­¤é¡µé¢æ‰€æœ‰æ–¹æ³•
            function set_ClearBill() {
                //初始化表格
                set_InitGrid();
                //直接执行列表筛选 åŠ è½½æ•°æ®åˆ°ç½‘æ ¼
                get_FastQuery(table, option)
                //加载业务员
                get_HEmpName();
                //隐藏勾选字段
                DisPlay_HideColumn();
            }
            //初始化表格
            function set_InitGrid() {
                $("#HBeginDate").val("2022-03-14");
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                var columns = [
                    { type: 'checkbox', fixed: 'left', totalRowText: '合计' }
                    , { field: 'hmainid', title: 'hmainid', sort: true, hide: true }
                    , { field: '日期', title: '日期', width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.日期, 'yyyy-MM-dd')}}</div>" }
                    , { field: '单据号', title: '单据号', width: 150 }
                    , { field: '供应商', title: '供应商', width: 150 }
                    , { field: '业务员', title: '业务员', width: 100 }
                    , { field: 'HBillType', title: 'HBillType', hide: true }
                    , { field: 'HSupID', title: 'HSupID', hide: true }
                    , { field: '业务状态', title: '业务状态', width: 100 , hide: true }
                    , { field: '分配状态', title: '分配状态', width: 100  }
                    , { field: '发布状态', title: '发布状态', width: 100 }
                    , { field: '供应商协同状态', title: '供应商协同状态', width: 135 }/*物料代码,物料名称,规格型号,批号,数量,单位,源单单号*/
                    , { field: '反馈状态', title: '供应商反馈状态', width: 135 }
                    , { field: '物料编码', title: '物料编码', width: 130 }
                    , { field: '物料代码', title: '物料代码', width: 130 }
                    , { field: '物料名称', title: '物料名称', width: 120 }
                    , { field: '数量', title: '订单数量', width: 100}
                    , { field: '打印条码数量', title: '打印条码数量', width: 120}
                    , { field: '关联数量', title: '已发货数量', width: 120 }
                    , { field: '未关联数量', title: '未已发货数量', width: 120 }
                    , { field: '完成状态', title: '完成状态', width: 100 }
                    , { field: 'HUnitID', title: 'HUnitID', hide: true }
                    , { field: '计量单位代码', title: '计量单位代码', width: 120 }
                    , { field: '计量单位', title: '计量单位', width: 100 }
                    , { field: '规格型号', title: '规格型号', width: 100 }
                    , { field: '批号', title: '批号', width: 100 }
                    , { field: '源单单号', title: '源单单号', width: 100 }
                    //, { field: '供应商代码', title: '供应商代码', width: 120, hide: true}
                    //, { field: '业务员代码', title: '业务员代码', width: 100, hide: true }
                    //, { field: 'HPriority', title: 'HPriority', width: 100, hide: true }
                    , { field: '优先级', title: '优先级', width: 100 }
                    , { field: '交货地点', title: '交货地点', width: 100 }
                    //, { field: 'HPSStyleID', title: 'HPSStyleID', hide: true }
                    , { field: '采购方式代码', title: '采购方式代码', width: 120 }
                    , { field: '采购方式', title: '采购方式', width: 100 }
                    //, { field: 'HSSID', title: 'HSSID', hide: true }
                    , { field: '结算方式代码', title: '结算方式代码', width: 120 }
                    , { field: '结算方式', title: '结算方式', width: 100 }
                    , { field: '结算日期', title: '结算日期', width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.结算日期, 'yyyy-MM-dd')}}</div>" }
                    //, { field: 'HCurID', title: 'HCurID', hide: true }
                    , { field: '币别代码', title: '币别代码', width: 100 }
                    , { field: '币别', title: '币别', width: 100 }
                    , { field: '汇率', title: '汇率', width: 100 }
                    //, { field: 'HDeptID', title: 'HDeptID', hide: true }
                    , { field: '部门代码', title: '部门代码', width: 100 }
                    , { field: '部门', title: '部门', width: 100 }
                    //, { field: 'HManagerID', title: 'HManagerID', hide: true }
                    , { field: '主管代码', title: '主管代码', width: 100 }
                    , { field: '主管', title: '主管', width: 100 }
                    //, { field: 'HEmpID', title: 'HEmpID', hide: true }
                    , { field: '摘要', title: '摘要', width: 100 }
                    , { field: '表头备注', title: '表头备注', width: 100 }
                    //, { field: 'hsubid', title: 'hsubid', hide: true }
                    //, { field: 'HMaterID', title: 'HMaterID', hide: true }
                    , { field: '单价', title: '单价', width: 100 }
                    , { field: '金额', title: '金额', width: 100 }
                    , { field: '税率', title: '税率', width: 100 }
                    , { field: '税额', title: '税额', width: 100 }
                    , { 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: 100 }
                    , { 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>" }
                    , { field: '作废人', title: '作废人', width: 100 }
                    , { field: '作废日期', title: '作废日期', width: 120, templet: "<div>{{d.日期 ==null ?'':layui.util.toDateString(d.作废日期, 'yyyy-MM-dd')}}</div>" }
                ];
                option = {
                    elem: '#mainTable'
                    , toolbar: '#toolbarDemo'
                    , page: true
                    , cellMinWidth: 120
                    , totalRow: true
                    , limit: 500
                    , height: 'full-50'
                    , cols: [columns]
                    , limits: [500, 5000, 20000]
                    , done: function (res, curr, count) {
                    }
                };
                ////设置列宽
                //var colWidth = getColumnsWidth();
                //if (colWidth == "" || colWidth == []) {
                //}
                //else {
                //    $.each(columns, function (x, m) {
                //        m["width"] = colWidth[x];
                //    });
                //}
            }
            //加载网格
            function get_Display(sWhere) {
                var wait = layer.load();//遮罩
                if (sWhere == "")
                {
                    var HBeginDate = $("#HBeginDate").val();//开始日期
                    var HEndDate = $("#HEndDate").val();//结束日期
                    if (HBeginDate) {
                        sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HBeginDate + "'";
                    }
                    if (HEndDate) {
                        sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HEndDate + "'";
                    }
                    sWhere +=  " and ä¸šåŠ¡çŠ¶æ€ = '未分配' and ä¾›åº”商协同状态 ='未确认' ";
                }
                if (HDate1) {
                    sWhere += " and æ—¥æœŸ <= '" + HDate1 + "'";
                }
                if (WorkCenter) {
                    sWhere += " and å•据号 like '%" + WorkCenter + "%'";
                }
                var index = layer.load(0, { shade: false });
                $.ajax({
                    url: GetWEBURL() + '/WW_EntrustOrderBill/list',
                    type: "GET",
                    data: { "sWhere": sWhere },
                    data: { "sWhere": sWhere, "user": sessionStorage["HUserName"],},
                    success: function (data1) {
                        if (data1.count == 1) {
                            DataList = data1.data;
                            option.data = data1.data;
                            table.render(option);
                            layer.close(index);
                            layer.alert("查询成功", { icon: 1 });
                            layer.close(wait);
                        } else {
                            layer.close(index);
                            layer.alert(data1.code + data1.Message, { icon: 5 });
                            layer.close(wait);
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function () {
                        layer.close(index);
                        layer.close(wait);
                        layer.alert("接口请求失败!", { icon: 5 });
                    }
                });
                sWhere = "";//调用接口后清空sWhere缓存
            });
            }
            //新增
            function set_AddNew() {
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '新增器具采购入库单',
                    closeBtn: 1,
                    shift: 2,
                    area: ['100%', '100%'],
                    maxmin: true,
                    content: '../模治具仓库管理/Sc_MouldProdInBillEdit.html?OperationType=1&linterid=&HSouceBillType=0&closeType=1',
                    end: function () {
                        //刷新页面,
                        get_FastQuery(table, option);
                    },
                    success: function (layero, index) {
                    }
                });
            }
            //编辑单据
            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_MouldProdInBillEdit.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_MouldProdInBill/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('请选择一行数据反审核!');
                }
            }
            //laydate.render({
            //    elem: '#HDate'
            //    , type: 'datetime'
            //    , trigger: 'click'
            //    , format:'yyyy-MM-dd HH:mm'
            //});
            //获取列宽
            function getColumnsWidth() {
                var result = [];
                var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
                //获取列宽
                $.ajax({
                    url: GetWEBURL() + '/WW_EntrustOrderBill/list',
                    async: false,
                    type: "Get",
                    dataType: "json",
                    data: { "colNum": colNum, "Name": Name },
                    success: function (data1) {
                        if (data1.code == 1) {
                            result = data1.data;
                        }
                        else if (data1.code == -1) {
                        }
                        else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(e.Message, { icon: 5 });
                    }
                });
                return result;
            }
            //保存列宽
            function set_SaveGridColWidth() {
                var arr = [];
                // åˆ—æ•°
                var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
                for (var i = 0; i <= colNum; i++) {
                    var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text();
                    var colWidth = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).width();
                    if (colName != "" && colName != null) {
                        arr.push(colWidth == -1 ? 200 : colWidth);
                    }
                }
                arr.unshift(40); //首位追加
                $.ajax({
                    url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth',
                    async: false,
                    type: "POST",
                    dataType: "json",
                    data: { "myMap": JSON.stringify(arr), "Name": Name },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                        } else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(e.Message, { icon: 5 });
                    }
                });
                //设置赋值列宽
                var colWidth = getColumnsWidth();
                if (colWidth == "" || colWidth == []) {
                }
                else {
                    $.each(columns, function (x, m) {
                        m["width"] = colWidth[x];
                    });
                }
                get_FastQuery(table, option);
            }
            //默认列宽
            function set_DefaultGridColWidth() {
                var arr = [];
                // åˆ—æ•°
                var colNum = $(".layui-table-header").find("tr").eq(0).find("th").length;
                for (var i = 0; i <= colNum; i++) {
                    var colName = $(".layui-table-header").find("tr").eq(0).find("th").eq(i).text();
                    if (colName != "" && colName != null) {
                        arr.push(200);   //默认宽度200
                    }
                }
                arr.unshift(40); //首位追加
                $.ajax({
                    url: GetWEBURL() + '/tb_CellWidth/GetMouldScrapInHouseCellWidth',
                    async: false,
                    type: "POST",
                    dataType: "json",
                    data: { "myMap": JSON.stringify(arr), "Name": Name },
                    success: function (data1) {
                        if (data1.count == 1) {
                            layer.alert(data1.Message, { icon: 1 });
                        } else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(e.Message, { icon: 5 });
                    }
                });
                //设置赋值列宽
                var colWidth = getColumnsWidth();
                if (colWidth == "" || colWidth == []) {
                }
                else {
                    $.each(columns, function (x, m) {
                        m["width"] = colWidth[x];
                    });
                }
                get_FastQuery(table, option);
            }
            //复制单据
            function set_CopyBill() {
            }
            //关闭单据
            function set_CloseBill() {
            }
            //反关闭单据
            function set_CancelCloseBill() {
            }
            //作废单据
            function set_CancelltionBill() {
            }
            //反作废
            function set_AbandonCancelltion() {
            }
            //分配
            function set_Distribut() {
                var hmainid='';
                var checkStatus = table.checkStatus('mainTable'),
                     data = checkStatus.data;
                if (checkStatus.data.length == 0) {
                    //var InterID = data[0].hmainid.toString();
                    return layer.msg('请选择数据');
                }
                for (var i = 0; i < data.length; i++) {
                    hmainid += data[i]["hmainid"] + ',';
                    if (data[i]["业务状态"] == "已发布") {
                        return layer.msg('单据号:' + data[i]["单据号"]+'已发布');
                    }
                }
                hmainid = hmainid.substring(0, hmainid.length-1)
                var HSupplierId='';
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '采购员列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../PublicPage/UserInformation.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        HSupplierId = checkStatus.data[0].HItemID.toString();
                        $.ajax({
                            url: GetWEBURL() + '/WW_EntrustOrderBill/distribut',
                            async: false,
                            type: "GET",
                            dataType: "json",
                            data: { "Hmainid": hmainid, "HSupplierId": HSupplierId },
                            success: function (data1) {
                                if (data1.Message.indexOf("成功") > 0) {
                                    layer.msg("分配成功", { time: 3 * 1000, icon: 1 }, function () {
                                        var index = layer.getFrameIndex(window.name);
                                        //关闭当前frame
                                        layer.close(index);
                                        //修改为功后刷新界面
                                        window.location.reload();
                                    });
                                } else {
                                    layer.alert(data1.Message, { icon: 5 });
                                }
                            }, error: function (e) {
                                layer.alert(data1.Message, { icon: 5 });
                            }
                        });
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            }
            //发布
            function set_Release() {
                var hmainid = '';
                var checkStatus = table.checkStatus('mainTable'),
                    data = checkStatus.data;
                if (checkStatus.data.length == 0) {
                    //var InterID = data[0].hmainid.toString();
                    return layer.msg('请选择数据');
                }
                for (var i = 0; i < data.length; i++) {
                    hmainid += data[i]["hmainid"] + ',';
                    if (data[i]["业务状态"] == "未分配" || data[i]["业务状态"] == "" ) {
                        return layer.msg('单据号:' + data[i]["单据号"] + '未分配');
                    }
                }
                hmainid = hmainid.substring(0, hmainid.length - 1)
                $.ajax({
                    url: GetWEBURL() + '/WW_EntrustOrderBill/release',
                    async: false,
                    type: "GET",
                    dataType: "json",
                    data: { "Hmainid": hmainid},
                    success: function (data1) {
                        if (data1.Message.indexOf("成功") > 0) {
                            layer.msg("发布成功", { time: 1 * 1000, icon: 1 }, function () {
                                //修改为功后刷新界面
                                window.location.reload();
                            });
                        } else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(data1.Message, { icon: 5 });
                    }
                });
            }
            //撤销
            function set_Back() {
                var hmainid = '';
                var checkStatus = table.checkStatus('mainTable'),
                    data = checkStatus.data;
                if (checkStatus.data.length == 0) {
                    return layer.msg('请选择数据');
                }
                for (var i = 0; i < data.length; i++) {
                    hmainid += data[i]["hmainid"] + ',';
                    if (data[i]["业务状态"] != "已发布") {
                        return layer.msg('单据号:' + data[i]["单据号"] + '未发布');
                    }
                    if (data[i]["供应商协同状态"] != "未确认") {
                        return layer.msg('单据号:' + data[i]["单据号"] + ',供应商已确认');
                    }
                }
                hmainid = hmainid.substring(0, hmainid.length - 1)
                $.ajax({
                    url: GetWEBURL() + '/WW_EntrustOrderBill/Back',
                    async: false,
                    type: "GET",
                    dataType: "json",
                    data: { "Hmainid": hmainid },
                    success: function (data1) {
                        if (data1.Message.indexOf("成功") > 0) {
                            layer.msg("操作成功", { time: 1 * 1000, icon: 1 }, function () {
                                //修改为功后刷新界面
                                window.location.reload();
                            });
                        } else {
                            layer.alert(data1.Message, { icon: 5 });
                        }
                    }, error: function (e) {
                        layer.alert(data1.Message, { icon: 5 });
                    }
                });
            }
            //优先级
            function set_Yxj() {
                var hmainid = '';
                var checkStatus = table.checkStatus('mainTable'),
                    data = checkStatus.data;
                if (checkStatus.data.length == 0) {
                    //var InterID = data[0].hmainid.toString();
                    return layer.msg('请选择数据');
                }
                for (var i = 0; i < data.length; i++) {
                    hmainid += data[i]["hmainid"] + ',';
                }
                hmainid = hmainid.substring(0, hmainid.length - 1)
                var HyxjId = '';
                layer.open({
                    type: 2,
                    skin: 'layui-layer-rim', //加上边框
                    title: '优先级列表',
                    closeBtn: 1,
                    shift: 2,
                    area: ['80%', '80%'],
                    maxmin: true,
                    content: ['../../PublicPage/OrderLevInformation.html', 'yes'],
                    btn: ['确定', '取消']
                    , btn1: function (index, layero) {
                        //按钮【按钮一】的回调
                        var iframeWindow = window['layui-layer-iframe' + index]  //获取弹框页面
                        var checkStatus = iframeWindow.layui.table.checkStatus('mainTable');//获取table的elem:"#test"
                        if (checkStatus.data.length === 0) {
                            return layer.msg('请选择数据');
                        }
                        HyxjId = checkStatus.data[0].HItemID.toString();
                        $.ajax({
                            url: GetWEBURL() + '/WW_EntrustOrderBill/yxj',
                            async: false,
                            type: "GET",
                            dataType: "json",
                            data: { "Hmainid": hmainid, "HyxjId": HyxjId },
                            success: function (data1) {
                                if (data1.Message.indexOf("成功") > 0) {
                                    layer.msg("操作成功", { time: 3 * 1000, icon: 1 }, function () {
                                        var index = layer.getFrameIndex(window.name);
                                        //关闭当前frame
                                        layer.close(index);
                                        //修改为功后刷新界面
                                        window.location.reload();
                                    });
                                } else {
                                    layer.alert(data1.Message, { icon: 5 });
                                }
                            }, error: function (e) {
                                layer.alert(data1.Message, { icon: 5 });
                            }
                        });
                       // layer.close(layer.index); //它获取的始终是最新弹出的某个层,值是由layer内部动态递增计算的
                    }
                    , btn2: function (index, layero) {
                        //按钮【按钮二】的回调
                        //return false å¼€å¯è¯¥ä»£ç å¯ç¦æ­¢ç‚¹å‡»è¯¥æŒ‰é’®å…³é—­
                    },
                    end: function () {
                    },
                    success: function (layero, index) {
                    }
                });
            }
            //快速过滤
            function get_FastQuery(table, option) {
                var HStatus = $("select[name='HStatus']").val();//
                var HStatus2 = $("select[name='HStatus2']").val();//
                var HBeginDate = $("#HBeginDate").val();//开始日期
                var HEndDate = $("#HEndDate").val();//结束日期
                var HBillNo = $("#HBillNo").val(); //单据号
                var HEmpName = $("#HEmpName").val();
                var HMaterNumber = $("#HMaterNumber").val();
                var HMaterName = $("#HMaterName").val();
                var HXTStatus = $("select[name='HXTStatus']").val();
                //var HXTFKStatus = $("#HXTFKStatus").val();
                var HMaterShortNumber = $("#HMaterShortNumber").val();
                var HSupName = $("#HSupName").val();//供应商
                var HFeedback = $("select[name='HFeedback']").val(); //供应商反馈状态
                var HFinishStatus = $("select[name='HFinishStatus']").val(); //完成状态
                if (HStatus) {
                    sWhere += " and åˆ†é…çŠ¶æ€ like '%" + HStatus + "%'";
                }
                if (HStatus2) {
                    sWhere += " and å‘布状态 like '%" + HStatus2 + "%'";
                }
                if (HBeginDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) >= '" + HBeginDate + "'";
                }
                if (HEndDate) {
                    sWhere += " and CONVERT(varchar(100),日期, 23) <= '" + HEndDate + "'";
                }
                if (HBillNo) {
                    sWhere += " and å•据号 like '%" + HBillNo + "%'";
                }
                if (HMaterShortNumber) {
                    sWhere += " and ç‰©æ–™ç¼–码 like '%" + HMaterShortNumber + "%'";
                }
                if (HMaterNumber) {
                    sWhere += " and ç‰©æ–™ä»£ç  like '%" + HMaterNumber + "%'";
                }
                if (HMaterName) {
                    sWhere += " and ç‰©æ–™åç§° like '%" + HMaterName + "%'";
                }
                if (HEmpName) {
                    sWhere += " and ä¸šåŠ¡å‘˜ like '%" + HEmpName + "%'";
                }
                if (HXTStatus) {
                    sWhere += " and ä¾›åº”商协同状态 like '%" + HXTStatus + "%'";
                }
                //if (HXTFKStatus) {
                //    sWhere += " and åé¦ˆçŠ¶æ€ like '%" + HXTFKStatus + "%'";
                //}
                if (HSupName) {
                    sWhere += " and ä¾›åº”商 like '%" + HSupName + "%'";
                }
                if (HFeedback) {
                    sWhere += " and åé¦ˆçŠ¶æ€ like '%" + HFeedback + "%'";
                }
                if (HFinishStatus) {
                    sWhere += " and å®ŒæˆçŠ¶æ€ like '%" + HFinishStatus + "%'";
                }
                var index = layer.load(0);
                get_Display(sWhere);
                //调用接口后清空sWhere缓存
                sWhere = "";
            }
            //重置过滤条件
            function set_ClearQuery() {
                $('#HStatus').find("option[value='-1']").attr("selected", true);
                $("#HBeginDate").val(Format(new Date(new Date() - 1000 * 60 * 60 * 24 * 30), "yyyy-MM-dd"));
                $("#HEndDate").val(Format(new Date(), "yyyy-MM-dd"));
                $("#HBillNo").val("");
                $("#HEmpName").val("");
                $("#HMaterNumber").val("");
                $("#HMaterName").val("");
                $("#HSupName").val("");//供应商
                $("select[name='HFeedback']").val(""); //供应商反馈状态
                sWhere = "";
                get_Display(sWhere);
            }
            //#endregion
            //刷新
            function set_Refresh() {
                $("#btnSearch").click();
            }
            //获取业务员数据
            function get_HEmpName() {
                var HEmpName = '<option value="">全部</option>';
                $.ajax({
                    type: "get",
                    url: GetWEBURL() + "/Web/GetEmployeeList_Json",
                    data: { "Employee": '', "HGroupID": 0 },
                    success: function (result) {
                        if (result.count == 1) { // è¯´æ˜ŽéªŒè¯æˆåŠŸäº†ï¼Œ
                            var data = result.data;
                            for (var i = 0; i < data.length; i++) {
                                HEmpName += '<option  value="' + data[i].HName + '">' + data[i].HName + '</option>';
                            }
                            $("#HEmpName").append(HEmpName);
                            form.render('select');
                        }
                        layer.closeAll("loading");
                    }
                })
            }
            //隐藏列设置
            function get_HideColumn() {
                var colName = "";
                var contentUrl = "";
                for (var i = 1; i < option.cols[0].length - 1; i++) {
                    colName += option.cols[0][i]["title"] + ",";
                }
                var urlStr = window.document.location.pathname;//获取文件路径
                var urlLen = urlStr.split('/');
                for (var i = 0; i < urlLen.length - 4; i++) {
                    contentUrl += "../";
                }
                colName = encodeURI(colName.substring(0, colName.length - 1));//对 URI è¿›è¡Œç¼–码
                contentUrl += '基础资料/隐藏列设置/Gy_GridView_Hide.html?HModName=' + HModName + '&colName=' + colName;
                layer.open({
                    type: 2
                    , skin: "layui-layer-rim" //加上边框
                    , title: "隐藏列设置"  //标题
                    , closeBtn: 1  //窗体右上角关闭 çš„ æ ·å¼
                    , shift: 2 //弹出动画
                    , area: ["50%", "90%"] //窗体大小
                    , maxmin: true //设置最大最小按钮是否显示
                    , content: [contentUrl, "yes"]
                    , btn: ["确定", "取消"]
                    , btn1: function (index, laero) {
                        //刷新表格数据
                        DisPlay_HideColumn();
                        //更新表格缓存的数据
                        layer.close(index);//关闭弹窗
                    }
                })
            }
            //显示列数据
            function DisPlay_HideColumn() {
                $.ajax({
                    url: GetWEBURL() + '/Xt_grdAlignment_WMES/grdAlignmentWMESList',
                    type: "GET",
                    data: { "HModName": HModName, "user": sessionStorage["HUserName"] },
                    success: function (data1) {
                        if (data1.data.length != 0) {
                            var dataCol = [];//数据库查询出的列数据
                            var titleData = ["hmainid", "HBillType", "HSupID", "业务状态", "HUnitID", "供应商代码", "业务员代码", "HPriority", "HPSStyleID", "HSSID", "HCurID", "HDeptID", "HManagerID", "HEmpID", "hsubid","HMaterID"];//不需要显示的字段 å¯æ‰©å±•
                            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 });
                    }
                })
            }
            //以上是layui模块
        });
    </script>
</body>