xinyb
2022-05-13 5b18c27a3a4fda518dc43ba88c6f79df7d38527e
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() {
@@ -878,9 +890,10 @@
                return;
            }
            var str = "";
            if (obj.length > 0) {
                for (var o = 0; o < obj.length; o++) {
                    var ob = obj[o];
            var datas=(obj.data!=null?obj.data:obj);//新版本的返回格式 xin 2021-4-24 14:22:47
            if (datas.length > 0) {
                for (var o = 0; o < datas.length; o++) {
                    var ob = datas[o];
                    if (ob["hasNexPage"] != undefined)
                        this.addRow_withInsert2(cdiv);
                    else
@@ -1156,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,
@@ -1175,19 +1192,88 @@
        },
        close: function () {
            layer.close(this.layIndex);
            if (this._flg_ == 1||this._flg_ == 2) {
                //by danaus 2021/4/8 14:45
                if(mygrid)
                    mygrid.ReloadBody();
                else
                    location.reload();
            }
                if(this._flg_ == 2) {
                    if (mygrid)
                        mygrid.ReloadBody();
                }else if(this._flg_ == -1){
                    //表示是序列号扫码入库调用,不需要刷新页面
                }else {
                    if (location)
                        location.reload();
                }
        }
    };
    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;
@@ -1220,9 +1306,9 @@
        close: function () {
            layer.close(this.layIndex);
            if (this._flg_ == 2)
                mygrid.ReloadBody();
                mygrid.ReloadBody();//刷新表休
            else
                location.reload();
                location.reload();//刷新整个页面
        }
    };
@@ -1301,6 +1387,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;
        }
@@ -1312,7 +1401,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;
@@ -1429,11 +1518,11 @@
             list.isOld=true;
             callback(false);
        }else{
            if (array != null) {
            if (array != null && array.length>0) {
                array = eval('(' + array + ')');
                list.array=array;
            } else {
                $.messager.alert("提示", "获取42控件标题列出错!尝试重新生成。", "warning");
                $.messager.alert("提示", "获取不到显示标题列!请检查有没有设置了表号或有没有设置了显示字段名", "warning");
                return;
            }
        }
@@ -1531,8 +1620,8 @@
                , where: list.wheres //条件
                , title: '数据信息'
                , height: 320 //高度
                , width: (cols.length>7?940:0) //列数超过7列时给一个固定值。
                ,cellMinWidth:130 //全局定义所有常规单元格的最小宽度(默认: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
@@ -1543,6 +1632,7 @@
                , parseData: function (res) { //res 即为原始返回的数据
                    if (res == null || res.msg != null) {
                        console.log("获取数据失败!" + (res.msg != null ? res.msg : ''));
                        layer.msg(res.msg);
                        return {
                            "code": 0,//res.status, //解析接口状态
                            "msg": '',//res.message, //解析提示文本
@@ -1581,6 +1671,9 @@
                            that.SetValueData(list, obj);
                        })
                    }
                },error:function (r) {
                    console.log(r);
                    // layer.msg(r);
                }
            });
            this.table42.on('rowDouble(' + list.id + ')', function (obj) {//行双击事件。(手机或平板模式下失效)
@@ -1632,9 +1725,17 @@
    ,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]]) + "'");
                    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');
                    }
                }
            }
        } else if (list.type == 1) {//格线
@@ -1697,6 +1798,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');
@@ -1710,6 +1814,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();//隐藏
@@ -1717,10 +1825,99 @@
            }
            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 colorisLoading(e) {
    Coloris({
        el: e
    });
}
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()) {
@@ -1736,4 +1933,28 @@
    //------下面的是关于42控件的处理------
    control42DivData.loading();
    //---end---关于42控件的处理结束------
    //--------46控件类型加载----------- xin 2022-4-26 15:51:38
    $(".coloris46").each(function () {
        colorisLoading('.coloris46');
    })
    //---------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);
    })
})