xuhy
2023-03-02 3b4e776dfa939ae6f3206ab68fe038aabb14a5b3
management/guns-admin/src/main/webapp/static/modular/system/tComplaint/tComplaint.js
@@ -1,5 +1,5 @@
/**
 * 投诉列表管理初始化
 * 管理初始化
 */
var TComplaint = {
    id: "TComplaintTable",   //表格id
@@ -14,135 +14,28 @@
TComplaint.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '主键ID', field: 'id', visible: false, align: 'center', valign: 'middle'},
        {title: '投诉时间', field: 'insert_time', visible: true, align: 'center', valign: 'middle',width:'10%',
            {title: '主键', field: 'id', visible: false, align: 'center', valign: 'middle'},
            {title: '用户id', field: 'userId', visible: false, align: 'center', valign: 'middle'},
            {title: '投诉司机id', field: 'driverId', visible: false, align: 'center', valign: 'middle'},
        {title: '投诉时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
        {title: '投诉人昵称', field: 'userName', visible: true, align: 'center', valign: 'middle'},
        {title: '投诉人电话', field: 'userPhone', visible: true, align: 'center', valign: 'middle'},
        {title: '投诉原因', field: 'reason', visible: true, align: 'center', valign: 'middle'},
        {title: '备注', field: 'notes', visible: true, align: 'center', valign: 'middle'},
        {title: '处理状态', field: 'state', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.insert_time != '' && row.insert_time != null) {
                    var time = row.insert_time.replace(" ",'<br>');
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.insert_time + '" onfocus="TUser.tooltip()">' + time + '</p>']
                if (row.state === 1){
                    return '<span>待处理</span>'
                }else if (row.state === 2){
                    return '<span>已处理</span>'
                }
                return btn;
            }
        },
        {title: '投诉人昵称', field: 'userName', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.userName != '' && row.userName != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.userName + '" onfocus="TUser.tooltip()">' + row.userName + '</p>']
                }
                return btn;
            }
        },
        {title: '投诉人<br/>电话', field: 'userPhone', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.userPhone != '' && row.userPhone != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.userPhone + '" onfocus="TUser.tooltip()">' + row.userPhone + '</p>']
                }
                return btn;
            }
        },
        {title: '投诉司机<br/>电话', field: 'driverPhone', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.driverPhone != '' && row.driverPhone != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.driverPhone + '" onfocus="TUser.tooltip()">' + row.driverPhone + '</p>']
                }
                return btn;
            }
        },
        {title: '投诉<br/>原因', field: 'reason', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.reason != '' && row.reason != null) {
                    var str = row.reason;
                    if (str.length > 20){
                        str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 1+ ')">查看更多</button>';
                    }
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.reason + '" onfocus="TUser.tooltip()">' + str + '</p>']
                }
                return btn;
            }
        },
        {title: '描述', field: 'description', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.description != '' && row.description != null) {
                    var str = row.description;
                    if (str.length > 20){
                        str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 2+ ')">查看更多</button>';
                    }
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.description + '" onfocus="TUser.tooltip()">' + str + '</p>']
                }
                return btn;
            }
        },
        {title: '备注', field: 'handleResult', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.handleResult != '' && row.handleResult != null) {
                    var str = row.handleResult;
                    if (str.length > 20){
                        str = str.substring(0,20)+'...<br><button class="btn btn-outline btn-primary" onclick="TComplaint.buttonClick(' +  row.id+','+ 3+ ')">查看更多</button>';
                    }
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.handleResult + '" onfocus="TUser.tooltip()">' + str + '</p>']
                }
                return btn;
            }
        },
        {title: '状态', field: 'isHandle', visible: true, align: 'center', valign: 'middle',width:'10%',
            formatter: function (value, row) {
                var btn = "";
                if(row.isHandle != '' && row.isHandle != null) {
                    if (row.isHandle == 1){
                        btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="已处理" onfocus="TUser.tooltip()">已处理</p>']
                    }
                }else{
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color: red;" title="未处理" onfocus="TUser.tooltip()">未处理</p>']
                }
                return btn;
            }
        },
        {title: '处理时间', field: 'handleTime', visible: true, align: 'center', valign: 'middle',width:'10%',
            formatter: function (value, row) {
                var btn = "";
                if(row.handleTime != '' && row.handleTime != null) {
                    var time = row.handleTime.replace(" ",'<br>');
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.handleTime + '" onfocus="TUser.tooltip()">' + time + '</p>']
                }
                return btn;
            }
        },
        {title: '处理人', field: 'handleUserName', visible: true, align: 'center', valign: 'middle',width:'10%',
            formatter: function (value, row) {
                var btn = "";
                if(row.handleUserName != '' && row.handleUserName != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.handleUserName + '" onfocus="TUser.tooltip()">' + row.handleUserName + '</p>']
                }
                return btn;
            }
        }
        {title: '处理时间', field: 'auditTime', visible: true, align: 'center', valign: 'middle'},
        {title: '处理人', field: 'auditPersonName', visible: true, align: 'center', valign: 'middle'},
        {title: '状态(1=正常,2=冻结,3=删除)', field: 'status', visible: false, align: 'center', valign: 'middle'}
    ];
};
/**
 * 查看更多按钮
 * @param con
 */
TComplaint.buttonClick = function (id,type) {
    var index = layer.open({
        type: 2,
        title: '查看详情',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tComplaint/lookDetail/'+id+"/"+type
    });
    this.layerIndex = index;
}
/**
 * 检查是否选中
@@ -159,81 +52,119 @@
};
/**
 * 立即处理
 * 点击添加
 */
TComplaint.immediately = function(){
TComplaint.openAddTComplaint = function () {
    var index = layer.open({
        type: 2,
        title: '添加',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tComplaint/tComplaint_add'
    });
    this.layerIndex = index;
};
/**
 * 打开查看详情
 */
TComplaint.openTComplaintDetail = function () {
    if (this.check()) {
        if (TComplaint.seItem.isHandle == 1) {
            swal("处理失败", "【未处理】状态下才能执行此操作", "warning");
            return;
        }
        var index = layer.open({
            type: 2,
            title: '立即处理',
            title: '详情',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tComplaint/tComplaint_immediately/' + TComplaint.seItem.id
            content: Feng.ctxPath + '/tComplaint/tComplaint_update/' + TComplaint.seItem.id
        });
        this.layerIndex = index;
    }
}
};
/**
 * 删除投诉列表
 * 删除
 */
TComplaint.delete = function () {
    if (this.check()) {
        if (TComplaint.seItem.isHandle != 1) {
            swal("删除失败", "【已处理】状态下才能执行此操作", "warning");
            return;
        }
        swal({
            title: "您是否确认删除该投诉记录?",
            text: "请谨慎操作,删除后数据无法恢复!",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "删除",
            closeOnConfirm: false
        }, function () {
            var ajax = new $ax(Feng.ctxPath + "/tComplaint/delete", function (data) {
                swal("删除成功", "您已经删除了该投诉记录。", "success");
                TComplaint.table.refresh();
            }, function (data) {
                swal("删除失败", data.responseJSON.message + "!", "warning");
            });
            ajax.set("tComplaintId", TComplaint.seItem.id);
            ajax.start();
        var ajax = new $ax(Feng.ctxPath + "/tComplaint/delete", function (data) {
            Feng.success("删除成功!");
            TComplaint.table.refresh();
        }, function (data) {
            Feng.error("删除失败!" + data.responseJSON.message + "!");
        });
        ajax.set("tComplaintId",this.seItem.id);
        ajax.start();
    }
};
/**
 * 查询投诉列表列表
 * 立即处理页面跳转
 */
TComplaint.immediatelyAudit = function () {
    if (this.check()) {
        if(2 == TComplaint.seItem.state){
            Feng.error("该数据已处理!");
            return;
        }
        var index = layer.open({
            type: 2,
            title: '投诉处理',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tComplaint/immediatelyAudit?tComplaintId=' + TComplaint.seItem.id
        });
        this.layerIndex = index;
    }
};
/**
 * 提交审核
 */
TComplaint.audit = function () {
    var ajax = new $ax(Feng.ctxPath + "/tComplaint/audit", function (data) {
        Feng.success("修改成功!");
        TComplaintInfoDlg.close();
        parent.TComplaint.table.refresh();
    }, function (data) {
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set("tComplaintId",$("#tComplaintId").val());
    ajax.set("notes",$("#notes").val());
    ajax.start();
};
/**
 * 查询列表
 */
TComplaint.search = function () {
    var queryData = {};
    queryData['insertTime'] = $("#insertTime").val();
    queryData['createTime'] = $("#createTime").val();
    queryData['userName'] = $("#userName").val();
    queryData['userPhone'] = $("#userPhone").val();
    queryData['driverPhone'] = $("#driverPhone").val();
    queryData['isHandle'] = $("#isHandle").val();
    queryData['state'] = $("#state").val();
    TComplaint.table.refresh({query: queryData});
};
TComplaint.resetSearch = function () {
    $("#insertTime").val("");
    $("#userName").val("");
    $("#userPhone").val("");
    $("#driverPhone").val("");
    $("#isHandle").val("");
/**
 * 重置
 */
TComplaint.resetSearch = function (){
    $("#createTime").val('');
    $("#userName").val('');
    $("#userPhone").val('');
    $("#driverPhone").val('');
    $("#state").val('');
    TComplaint.search();
};
}
$(function () {
    var defaultColunms = TComplaint.initColumn();
    var table = new BSTable(TComplaint.id, "/tComplaint/list", defaultColunms);
    table.setPaginationType("server");
    table.setPaginationType("client");
    TComplaint.table = table.init();
});