puzhibing
2023-06-01 c4a098e3f88bc5071e36b92b9e5dcceb51129957
management/guns-admin/src/main/webapp/static/modular/system/tDriver/tDriver.js
@@ -66,13 +66,13 @@
                }
            }},
            {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
        {title: '操作', visible: true, align: 'center', valign: 'middle',width:150,
        {title: '操作', visible: true, align: 'center', valign: 'middle',width:'160px',fixed:'true',
            formatter: function (value, row) {
                if (row.status === 1){
                    return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.stop('+row.id+','+row.status+')" style="color:red">冻结</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.updateInfo('+row.id+')" style="color:green">编辑</a>'
                }else if (row.status === 2){
                }else if (row.status === 2 || row.approvalStatus === 2){
                    return '<a href="#" onclick="TDriver.searchTDriverDetail('+row.id+')" style="color:green">详情</a>' +'&nbsp;' +
                        '<a href="#" onclick="TDriver.start('+row.id+','+row.status+')" style="color:green">解冻</a>'
                }
@@ -164,8 +164,8 @@
TDriver.stop = function (id) {
    var index = layer.open({
        type: 2,
        title: '停用',
        area: ['45%', '50%'], //宽高
        title: '冻结',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/tDriver_start_and_stop?id='+id
@@ -180,7 +180,7 @@
    var index = layer.open({
        type: 2,
        title: '启用',
        area: ['45%', '50%'], //宽高
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/tDriver_start_and_stop?id='+id
@@ -192,6 +192,18 @@
 * 提交启用冻结
 */
TDriver.updateStatus = function () {
    var status = $("#status").val();
    console.log(status)
    if(status == 1 && ($("#stopRemark").val() == '' || $("#stopRemark").val() == null)){
        Feng.info("请输入冻结理由!")
        return;
    }
    if(status == 2 && ($("#startRemark").val() == '' || $("#startRemark").val() == null)){
        Feng.info("请输入解冻理由!")
        return;
    }
    var ajax = new $ax(Feng.ctxPath + "/tDriver/update-status", function (data) {
        Feng.success("修改成功!");
        TDriverInfoDlg.close();
@@ -221,7 +233,7 @@
        var index = layer.open({
            type: 2,
            title: '充值余额',
            area: ['45%', '20%'], //宽高
            area: ['800px', '220px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tDriver/rechargeBalancePage?id=' + id
@@ -234,6 +246,18 @@
 * 提交充值
 */
TDriver.rechargeBalance = function () {
    var balance = $('#backgroundBalance').val().trim();
    var reg=/^[1-9]\d*$/;//由 1-9开头 的正则表达式
    //先判断是否为整数 在判断 是否在 1-总页  整数范围之内
    if(reg.test(balance)){
        if(parseInt(balance) <= 0){
            Feng.error("请输入大于0的正整数");
            return;
        }
    }else{
        Feng.error("请输入大于0的正整数");
        return;
    }
    var ajax = new $ax(Feng.ctxPath + "/tDriver/recharge-balance", function (data) {
        Feng.success("修改成功!");
        TDriverInfoDlg.close();
@@ -288,6 +312,12 @@
 * 提交审核
 */
TDriver.auditSubmit = function () {
    if($("#approvalStatus").val() == 3 && ($("#approvalNotes").val() == '' || $("#approvalNotes").val() == null)){
        Feng.info("请输入驳回原因!");
        return;
    }
    var ajax = new $ax(Feng.ctxPath + "/tDriver/auditSubmit", function (data) {
        Feng.success("修改成功!");
        TDriverInfoDlg.close();
@@ -302,16 +332,37 @@
};
/**
 * 打开区域选择页面
 * 打开区域选择页面编辑
 */
TDriver.area = function () {
TDriver.areaUpdate = function () {
    var area = $("#area").val();
    var areaId = $("#areaId").val();
    var index = layer.open({
        type: 2,
        title: '区域选择',
        area: ['1000px', '270px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/areaPage'
        content: Feng.ctxPath + '/tDriver/areaPageUpdate?area='+area+'&areaId='+areaId
    });
    this.layerIndex = index;
}
/**
 * 打开区域选择页面新增
 */
TDriver.areaAdd = function () {
    var area = $("#area").val();
    var areaId = $("#areaId").val();
    var index = layer.open({
        type: 2,
        title: '区域选择',
        area: ['1000px', '270px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/areaPageAdd?area='+area+'&areaId='+areaId
    });
    this.layerIndex = index;
}
@@ -320,7 +371,36 @@
 * 查询市
 */
TDriver.areaCity = function () {
    var province = document.getElementById('province');
    //监听第一个下拉菜单的变动操作
    $("#province").change(function(){
        //当第一级下拉列表没选择值时,将二级下拉列表和三级同时设置为空
        if(this.value==""){
            $("#city").empty();//二级联动设为空设为空
            $("#city").append('<option value="">请选择</option>');
            //region
            $("#district").empty();//三级联动设为空设为空
            $("#district").append('<option value="">请选择</option>');
        }
        if(this.value!=""){//第一级下拉菜单选择了值
            $("#city").empty();//先行置空,防止上次选择留下的元素影响效果
            $("#city").append('<option value="">请选择</option>')//设置初始选项
            $("#district").empty();//三级联动设为空设为空
            $("#district").append('<option value="">请选择</option>');
            var province = document.getElementById('province');
            var index= province.selectedIndex ;
            var id = province.options[index].id;
            var ajax = new $ax(Feng.ctxPath + "/tDriver/areaCity?parentId="+id, function (data) {
                for(var i=0,n=data.length;i<n;i++){//遍历
                    $("#city").append('<option value="'+data[i].id+'">'+data[i].name+'</option>');//创造元素
                }
            }, function (data) {
                Feng.error("查询失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        }
    });
    /*var province = document.getElementById('province');
    var index= province.selectedIndex ;
    var id = province.options[index].id;
    var ajax = new $ax(Feng.ctxPath + "/tDriver/areaCity?parentId="+id, function (data) {
@@ -334,14 +414,42 @@
    }, function (data) {
        Feng.error("查询失败!" + data.responseJSON.message + "!");
    });
    ajax.start();
    ajax.start();*/
}
/**
 * 查询区
 */
TDriver.areaDistrict = function () {
    var city = document.getElementById('city');
    //监听第二个下拉菜单的变动操作
    $("#city").change(function(){
        if(this.value==""){//第二级菜单为空,则将第三级菜单也置为空
            $("#district").empty();
            $("#district").append('<option value="">请选择</option>');
        }
        if(this.value!=""){//第二级菜单不为空,则将第三级菜单动态生成
            $("#district").empty();
            $("#district").append('<option value="">请选择</option>');
            var city = document.getElementById('city');
            var cityIndex= city.selectedIndex ;
            var id = city.options[cityIndex].id;
            if(id == ""){
                id = city.options[cityIndex].value;
            }
            var ajax = new $ax(Feng.ctxPath + "/tDriver/areaCity?parentId="+id, function (data) {
                for(var i=0,n=data.length;i<n;i++){//对区数据进行遍历,动态生成
                    $("#district").append('<option value="'+data[i].id+'">'+data[i].name+'</option>');
                }
            }, function (data) {
                Feng.error("查询失败!" + data.responseJSON.message + "!");
            });
            ajax.start();
        }
    })
    /*var city = document.getElementById('city');
    var cityIndex= city.selectedIndex ;
    var id = city.options[cityIndex].value;
    var ajax = new $ax(Feng.ctxPath + "/tDriver/areaCity?parentId="+id, function (data) {
@@ -355,7 +463,7 @@
    }, function (data) {
        Feng.error("查询失败!" + data.responseJSON.message + "!");
    });
    ajax.start();
    ajax.start();*/
}
/**
@@ -364,25 +472,60 @@
TDriver.submitArea = function () {
    var province = document.getElementById('province');
    var provinceIndex= province.selectedIndex ;
    var provinceName = province.options[provinceIndex].value;
    var provinceId = province.options[provinceIndex].id;
    var provinceId = province.options[provinceIndex].value;
    var provinceName = province.options[provinceIndex].innerText;
    console.log(provinceId)
    console.log(provinceName)
    if(provinceName == null || provinceName == ''){
        Feng.error("请选择省份!")
        return;
    }
    var city = document.getElementById('city');
    var cityIndex= city.selectedIndex ;
    var cityId = city.options[cityIndex].value;
    var cityName = city.options[cityIndex].innerText;
    console.log(cityId)
    console.log(cityName)
    if(cityName == null || cityName == '' || cityName =='请选择'){
        Feng.error("请选择市区!")
        return;
    }
    var district = document.getElementById('district');
    var districtIndex= district.selectedIndex ;
    var districtId = district.options[districtIndex].value;
    var districtName = district.options[districtIndex].innerText;
    parent.$("#area").val(provinceName+'/'+cityName+'/'+districtName)
    parent.$("#areaId").val(provinceId+'/'+cityId+'/'+districtId)
    console.log(districtId)
    console.log(districtName)
    if(districtName == '' || districtName == null || districtName == '请选择'){
        parent.$("#area").val(provinceName+'/'+cityName)
        parent.$("#areaId").val(provinceId+'/'+cityId)
    }else {
        parent.$("#area").val(provinceName+'/'+cityName+'/'+districtName)
        parent.$("#areaId").val(provinceId+'/'+cityId+'/'+districtId)
    }
    TDriverInfoDlg.close();
}
/**
 * 重置市区
 */
TDriver.resetArea = function () {
    var city = document.getElementById('city');
    var cityIndex= city.selectedIndex ;
    console.log(city.options[cityIndex].innerText)
    city.options[cityIndex].innerText = "请选择市";
    var district = document.getElementById('district');
    var districtIndex= district.selectedIndex ;
    console.log(district.options[districtIndex].innerText)
    district.options[districtIndex].innerText = "请选择区";
}
/**
 * 打开编辑页面
 */
TDriver.updateInfo = function (id) {