wtt
2024-11-11 6467554bd4fd68cd6c95cd9dd1f8f0265021fc53
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//#region 按钮设置
function get_HideButton(btns,HBillType,HModName,HUserName) {
    var btnIdList = "";          //按钮ID列表
    var btnNameList = "";        //按钮名称列表
    var btnOrderList = "";       //按钮次序列表
    var contentUrl = "";         //按钮设置窗口页面位置
 
    //获取页面按钮元素的信息
    for (var i = 0; i < btns.length; i++) {
        btnIdList += btns[i].id + ",";
        btnNameList += btns[i].innerText + ",";
        btnOrderList += i + ",";
    }
    //对数组进行编码
    btnIdList = encodeURI(btnIdList.substring(0, btnIdList.length - 1));//对 URI 进行编码
    btnNameList = encodeURI(btnNameList.substring(0, btnNameList.length - 1));//对 URI 进行编码
    btnOrderList = encodeURI(btnOrderList.substring(0, btnOrderList.length - 1));//对 URI 进行编码
 
    //获取按钮隐藏设置窗口文件路径
    var urlStr = window.document.location.pathname;//获取文件路径
    var urlLen = urlStr.split('/');
    for (var i = 0; i < urlLen.length - 4; i++) {
        contentUrl += "../";
    }
    contentUrl += '系统管理/按钮设置/Xt_ModuleButtonSet.html?HModName=' + HModName + '&HBillType=' + HBillType + "&btnIdList=" + btnIdList + "&btnNameList=" + btnNameList + "&btnOrderList=" + btnOrderList + "&HUserName=" + HUserName;
 
    //打开按钮隐藏设置子窗口
    layer.open({
        type: 2
        , skin: "layui-layer-rim" //加上边框
        , title: "按钮设置"  //标题
        , closeBtn: 1  //窗体右上角关闭 的 样式
        , shift: 2 //弹出动画
        , area: ["30%", "90%"] //窗体大小
        , maxmin: true //设置最大最小按钮是否显示
        , content: [contentUrl, "yes"]
        , btn: ["确定", "取消"]
        , btn1: function (index, laero) {
            //刷新按钮显示
            Display_HideButton(btns, HBillType, HModName, HUserName);
            //更新表格缓存的数据
            layer.close(index);//关闭弹窗
        }
    })
 
}
 
//#endregion
//#region 显示按钮
function Display_HideButton(btns,HBillType,HModName , HUserName) {
    $.ajax({
        url: GetWEBURL() + '/Xt_ModuleButtonSet_WMES/moduleButtonSetWMESList',
        type: "GET",
        async: false,
        data: { "HModName": HModName, "HBillType": HBillType, "HUserName": HUserName },
        success: function (data1) {
            var btnData = [];
            //获取所有按钮信息
            for (var i = 0; i < btns.length; i++) {
                var bar = 0;
                for (var j = 0; j < data1.count; j++) {
                    if (btns[i].id == data1.data[j]["HButtonID"]) {
                        if (data1.data[j]["HHideFlag"] == true) {
                            btns[i].style = "display:none;";
                        } else {
                            btns[i].style = "display:inline;";
                        }
                        bar = 1;
                        break;
                    }
                }
                if (bar == 0) {
                    btns[i].style = "display:inline;";
                }
            }
        }, error: function () {
            layer.alert("接口请求失败!", { icon: 5 });
        }
    })
}
//#endregion