xinyb
2022-05-18 c2dc593c9b8948718381f3a2996b6f94a59ad80a
WebRoot/js/hotkey.js
@@ -157,6 +157,12 @@
        if (typeof (panMain) != "undefined")
            excelTitle = new Base64().encode((panMain[panIndex].panelTitle == undefined ? "" : panMain[panIndex].panelTitle) + "~" + "");// 面板+格线的动态标题
        TGData = '{"Cfg":{"Sort":"","SortCols":"","SortTypes":"0","Group":"","GroupCols":"","SearchAction":"","TimeZone":"-480","ScrollLeft":"0","LeftScrollLeft":"0","ScrollTop":"0"},"CutFilter":{"Filter":""},"rowspan":"","Filters":[],"IO":{},"Fields":{"FieldsName":"" },"CutFilter":{"Filter":"" },"Exprs":{"expr":"" },"Cps":{"cp":"" },"rowspan":"","excelTitle":"fg==","Body":[{"Pos":"0"}]}';
        if (panMain[panIndex].panelTitle == null || panMain[panIndex].panelTitle == "") {
            var doccode = $("#doccode").val();
            if (doccode != null && doccode != "") {
                panMain[panIndex].panelTitle = "doccode='" + doccode + "'";
            }
        }
        excelurl = "/gtGrid.do?m=load&where=" + (panMain[panIndex].panelTitle == undefined ? "" : panMain[panIndex].panelTitle) + "&formID=" + formId + "&winType=" + (formType == 16 ? 17 : formType) + "|0&flag=-1&autopaging=3&cp=0&formdatafilters=&pageSize=100&picFild=";
    }
    var obj = toJson(excelurl);
@@ -211,6 +217,11 @@
    input9.attr('name', 'winType');
    input9.attr('value', obj.winType);
    form.append(input9);
    var input10 = $('<input>');
    input10.attr('type', 'hidden');
    input10.attr('name', 'isExportExcel');
    input10.attr('value', obj.isExportExcel);
    form.append(input10);
    var input11 = $('<input>');
    input11.attr('type', 'hidden');
    input11.attr('name', 'TGData');
@@ -519,6 +530,7 @@
        }
        return string;
    }
    return this;
}
function closeOther() {
@@ -1157,6 +1169,10 @@
//弹出层
        showLayer: function (str, flg, width, height) {
            this._flg_ = flg;
            if(flg==-1 && str.indexOf("warehousing")!=-1){//是序列号扫码界面 xin 2021-8-3 10:17:22
                openNewLayui.openWin(str);
                return;
            }
            this.layIndex = layer.open({
                type: 2,
                title: false,
@@ -1180,6 +1196,8 @@
                if(this._flg_ == 2) {
                    if (mygrid)
                        mygrid.ReloadBody();
                }else if(this._flg_ == -1){
                    //表示是序列号扫码入库调用,不需要刷新页面
                }else {
                    if (location)
                        location.reload();
@@ -1191,6 +1209,71 @@
    return lay;
}
function codeScanning(state,formid,formtype,type){
    var url = "/general/SerialNumber/" + (type == "out" ? "deliveryPage.jsp?" : "warehousing.jsp?");
    var parm = "formid=" + formid + "&formtype=" + formtype + "&doccode=" + getDoc("doccode", ".value");
    var isEdit = false;
    if (state != null) {
        var docstatePan = getDoc("docstatus", ".value");
        if (state.indexOf(";") != -1) {
            isEdit = ($.inArray(docstatePan, state.split(";")) != -1 ? true : isEdit);
        }
        if (state == "" || docstatePan == state) {
            isEdit = true;
        }
        if (docstatePan == '100') {//确定单不可编辑
            isEdit = false;
        }
    }
    url += encodeText(parm + "&isEdit=" + isEdit);
    openNewLayui.openWin(url);
}
var openNewLayui={
    layer: (typeof (layui) != 'undefined' ? layui.layer : null),
    openWin: function (url) {
        var that=this;
        this.layer.open({
            type: 2,
            area: ['800px', '550px'],
            title: false,
            content: url,
            cancel: function (index,layero) {
                var envt = $(layero).find("iframe")[0].contentWindow;
                if (envt != null) {
                    if(envt.isChang){
                        if(confirm("界面有修改,是否执行扫完了再关闭?")){
                            that.setGrid(envt.vm.okSubmit(),true);
                        }else{
                            layer.close(index);
                        }
                    }else{
                        layer.close(index);
                    }
                }
            }
        });
    },
    setGrid:function(value,isSave){
        // var envt = $(layero).find("iframe")[0].contentWindow;
        if (value != null) {
            // var value = envt.vm.okSubmit();
            if (Grids != null && value != null) {
                var gr = Grids[value.T_id];
                gr.EndEdit(true);
                var rowids = value.rowids;
                for (var r in rowids) {
                    gr.setSerialNumber("serialnumbers", (rowids[r] != "" ? rowids[r].join(";") : ""), r);
                }
                if(isSave){//有改动过是需要保存
                    //处理保存自动执行事件
                    $("#tpSave").trigger("click");
                    // save(2);//执行保存
                }
            }
        }
        layer.closeAll();
    }
}
//38类型用到的弹出窗体
var LayerObjs = null;
@@ -1285,7 +1368,7 @@
            var panelWidth = document.documentElement.clientWidth;
            var treeWidth = $('#wrappers').outerWidth(true);// 树形的宽度
            var treeHeight = $('#tplt-panels').outerHeight(true);// 树形的高度
            $('#' + gridId[0]).css('height', (treeHeight - 30) + 'px');// 减去30是因为margin和padding的值
            $('#' + gridId[0]).css('height', (treeHeight - 30 - 20) + 'px');// 减去30是因为margin和padding的值
            $('#' + gridId[0]).css('width', (panelWidth - treeWidth - 30) + 'px');
            return;
        }
@@ -1294,6 +1377,7 @@
            if (topPanelHeight == null) {// 没有标题的高度
                topPanelHeight = $('#tplt-top').outerHeight(true)+10;
            }
            panelHeight = panelHeight - 20;//文字颜色说明占了20高
            if (panelType == 1) {
                $('#' + gridId[0]).css('height', (panelHeight - topPanelHeight - 50) + 'px');// 减去50是因为margin和padding的值
                return;
@@ -1304,6 +1388,9 @@
                return;
            }
            var panelFormIdHeight = $('#panel_' + formId).outerHeight(true);
            if(panelFormIdHeight==null){
                panelFormIdHeight = $('.main_talbe').outerHeight(true);
            }
            $('#' + gridId[0]).css('height', (panelHeight - topPanelHeight - panelFormIdHeight - 50) + 'px');// 减去50是因为margin和padding的值
            return;
        }
@@ -1315,7 +1402,7 @@
function isTopFixed() {
    var bol = false;
    if (";5;8;16;496;".indexOf(";" + top.myFresh.panel[top.tabindex] + ";") != -1) {
    if (top.myFresh!=null && ";5;8;16;496;".indexOf(";" + top.myFresh.panel[top.tabindex] + ";") != -1) {
        bol = true;
    }
    return bol;
@@ -1436,7 +1523,7 @@
                array = eval('(' + array + ')');
                list.array=array;
            } else {
                $.messager.alert("提示", "获取不到显示标题列!请检查是否设置了表号", "warning");
                $.messager.alert("提示", "获取不到显示标题列!请检查有没有设置了表号或有没有设置了显示字段名", "warning");
                return;
            }
        }
@@ -1534,8 +1621,8 @@
                , where: list.wheres //条件
                , title: '数据信息'
                , height: 320 //高度
                , width: (cols.length>5?930:0) //列数超过7列时给一个固定值。
                ,cellMinWidth:150 //全局定义所有常规单元格的最小宽度(默认:60),一般用于列宽自动分配的情况。其优先级低于表头参数中的 minWidth
                , width: (cols.length>5?900:((160*(cols.length))<590?590:(160*(cols.length)))) //列数超过7列时给一个固定值。
                , cellMinWidth:150 //全局定义所有常规单元格的最小宽度(默认:60),一般用于列宽自动分配的情况。其优先级低于表头参数中的 minWidth
                , size: 'sm'
                , cols: [cols]//标题数组
                , page: true
@@ -1639,11 +1726,16 @@
    ,SetValueData: function (list, data) {//赋值
        if (list.type == 0) {//面板
            var fk = list.fk;
            var p=panMain[panIndex];
            for (var i = 0; i < fk.length; i++) {//赋值给页面
                if (typeof data[fk[i]] != 'undefined') {
                    setDoc(list.seekgroupid[i], ".value='" + (data[fk[i]] == null ? "" : data[fk[i]]) + "'");
                    if (panMain[panIndex].select[list.seekgroupid[i]]!=null){//有级联到31控件的字段需要加载 xin 2021-5-10 14:55:33
                    var v = (data[fk[i]] == null ? "" : data[fk[i]]);
                    setDoc(list.seekgroupid[i], ".value='" + v + "'");
                    if (p.select[list.seekgroupid[i]] != null) {//有级联到31控件的字段需要加载 xin 2021-5-10 14:55:33
                        getSelect31(list.seekgroupid[i]);
                    }
                    if (p.panInfo[list.seekgroupid[i]] != null && p.panInfo[list.seekgroupid[i]].controltype == 43) {//是43控件
                        $("#" + list.seekgroupid[i]).val(v).trigger('change');
                    }
                }
            }
@@ -1707,6 +1799,9 @@
        var get = this;
        //页面42控件的keyup事件(面板调用)
        $('.isControl42').on('keyup', function () {
            if (this.readOnly || this.disabled){//只读
                return;
            }
            clearTimeout(get.timer);
            var elem = this;
            var rod = $(elem).data('rod');
@@ -1720,6 +1815,10 @@
                var empty = panInfo[elem.id].emptyrefdata.toLowerCase();//清空关联字段
                empty = empty.split(';');
                for (var e = 0; e < empty.length; e++) {
                    if (panInfo[empty[e]].controltype == 43) {//43控件清空
                        $("#" + empty[e]).val('').trigger('change');
                        continue;
                    }
                    setDoc(empty[e], ".value=''");//清空
                }
                $('#T_' + panInfo[elem.id].ft + '_' +rod + 'div').hide();//隐藏
@@ -1727,10 +1826,93 @@
            }
            get.timer = setTimeout(function () {
                get.ShowDivForPanel(elem, panInfo[elem.id], rod);
            }, 2000);
            }, 1000);
        });
    }
};
//执行收款显示二维码或退款
function OpenPayAndRefund(doccode,type,formid){
        if(type=="pay"){//显示二维码
            let doc=doccode;
            var url = "/general/onlinePayment/payment.jsp?orderNo=" + doc+"&formId="+formid;
            layui.layer.open({
                type: 2,
                area: ['700px', '500px'],
                title: false,
                content: url,
                cancel: function (index, layero) {
                    var envt = $(layero).find("iframe")[0].contentWindow;
                    if (envt != null) {
                        if (!envt.isChang) {
                            if (!confirm("还没有支付,确定关闭吗?")) {
                                return false;
                            }
                        }
                        if (envt.ws != null) {
                            envt.ws.close();
                        }
                    }
                    layer.closeAll();
                    getReductionURL(doc);
                }
            });
        }else{//确定
            $.ajax({
                url: "/gtGrid.do?m=newTran&formid="+formid+"&docCode="+doccode,
                type: "get",
                async: false,
                success: function (res) {
                    if(res.state==-1) {
                        layer.alert(res.msg,function (){location.reload();});
                    }
                }, error: function (e, h, a) {
                    layer.alert(e.responseText,function (){location.reload();} );
                }
            });
    }
}
//针对收款二维码界面关闭的处理 xin 2021-9-8 10:09:33
function getReductionURL(doc){
    var url = location.search;
    var parm = Base64().decode(url.substring(1, url.length));
    if (parm.indexOf("&onlinePay=1") != -1) {
        parm = parm.replace("&onlinePay=1", "");
        parm = "?" + encodeText(parm);
        location.replace(location.href.split("?")[0] + parm);
    } else {
        if (doc != null) {
            let docUrl = '?' + encodeText('doccode=' + doc);
            location.replace(location.href.split("?")[0]  + docUrl);
        } else {
            location.reload();
        }
    }
    layer.closeAll();
}
//批量上传物料主数据主图片 xin 2021-9-17 09:51:37
function Batchupload(){
    var url="/general/batchUpload/uploadIndex.jsp";
    layui.layer.open({
        type: 2,
        area: ['850px', '500px'],
        title: false,
        content: url,
        cancel: function (index, layero) {
            layer.closeAll();
        }
    });
}
function progressBar(e,value){
    top.$(e).jQMeter({
        goal: '100',
        raised: value+'',
        height: '24px',
        barColor:'#6699cc',
        bgColor: '#CCC'
    });
}
$(function () {
    //单据窗体头部固定 xin 2020-10-26 17:23:58
    if (isTopFixed()) {
@@ -1746,4 +1928,22 @@
    //------下面的是关于42控件的处理------
    control42DivData.loading();
    //---end---关于42控件的处理结束------
    //---------47控件类型加载---------- xin 2022-4-27 10:58:12
    $(".progressBar47").each(function () {
        let id = $(this).data("id");
        let value = $("#" + id).val();//获取控件Id的value值
        value = value != null ? value : 0;
        if (isNaN(value) || value == "") {//不全是数字
            value = 0;
        }
        if (value >= 1) {
            value = 100;
        }
        if (value > 0 && value < 1) {//这种情况是1表示100%的值,那么0.1*100=10
            value = value * 100;
        }
        progressBar(this, value);
    })
})