自动化立体仓库 - WMS系统
lty
5 天以前 8e943b7104561c3b14cf223016698709c5ade4b5
src/main/webapp/static/js/cool.js
@@ -33,12 +33,12 @@
    var inputDomVal = document.querySelector("input[data-key="+val+"]").value;
    var selectDom = document.querySelector("select[data-key="+val+"Select]");
    selectDom.length = 0;
    var defaultOption = new Option("取消选择", "");
    var defaultOption = new Option(typeof I18n !== 'undefined' ? I18n.t('cancel_selection') : "取消选择", "");
    defaultOption.title = "";
    selectDom.appendChild(defaultOption);
    selectDom.style.display='none';
    $.ajax({
        url: "/"+getForeignKeyQuery(val)+"/auth",
        url: baseUrl+"/"+getForeignKeyQuery(val)+"/auth",
        headers: {'token': localStorage.getItem('token')},
        data: {condition: inputDomVal},
        method: 'POST',
@@ -47,15 +47,38 @@
            if (res.code === 200){
                var list = res.data;
                for (var i=0;i<list.length;i++){
                    var option = new Option(list[i].value, i);
                    var text = list[i].value;
                    var id = list[i].id;
                    // 尝试翻译
                    if (typeof I18n !== 'undefined' && typeof window.i18nEnumMap !== 'undefined') {
                        var mapper = window.i18nEnumMap[val];
                        if (mapper) {
                            var transKey = null;
                            if (typeof mapper === 'function') {
                                transKey = mapper(id);
                            } else {
                                transKey = mapper[id];
                            }
                            if (transKey) {
                                var trans = I18n.t(transKey);
                                if (trans !== transKey) {
                                    text = trans;
                                }
                            }
                        }
                    }
                    var option = new Option(text, i);
                    option.title = list[i].id;
                    selectDom.options[i+1] = option;
                }
                selectDom.style.display='block';
            } else if (res.code === 403){
                top.location.href = "/";
                top.location.href = baseUrl+"/";
            } else {
                layer.msg(res.msg)
                layer.msg(typeof I18n !== 'undefined' ? I18n.t(res.msg) : res.msg, {icon: 2})
            }
        }
    });
@@ -106,6 +129,14 @@
    return str;
}
// 表单值清空
function clearFormVal(el) {
    $(':input', el)
        .val('')
        .removeAttr('checked')
        .removeAttr('selected');
}
var banMsg;
var tips;
// 主键校验
@@ -115,7 +146,7 @@
        val: $('#'+id).val()
    };
    $.ajax({
        url: "/"+domain+"/check/column/auth",
        url: baseUrl+"/"+domain+"/check/column/auth",
        headers: {'token': localStorage.getItem('token')},
        data: JSON.stringify(param),
        dataType:'json',
@@ -126,7 +157,7 @@
                layer.close(tips);
                banMsg = null;
            } else if (res.code === 403) {
                top.location.href = "/";
                top.location.href = baseUrl+"/";
            } else if (res.code === 407) {
                banMsg = res.data + "不可用";
                tips = layer.tips(