puzhibing
2023-08-16 d5b3e5a413bcfccba294793ee093722f31b2448a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/**
 * 管理初始化
 */
var TDriverException = {
    id: "TDriverExceptionTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
 
/**
 * 初始化表格的列
 */
TDriverException.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
            {title: '主键', field: 'id', visible: true, align: 'center', valign: 'middle'},
            {title: '编号', field: 'code', visible: true, align: 'center', valign: 'middle'},
            {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle'},
            {title: '手机号', field: 'phone', visible: true, align: 'center', valign: 'middle'},
            {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle',
                formatter: function (value, row) {
                    if (row.sex === 1){
                        return '<span>男</span>'
                    }else if (row.sex === 2){
                        return '<span>女</span>'
                    }else {
                        return '<span>未知</span>'
                    }
                }},
        {title: '驾驶证号码', field: 'driverLicenseNumber', visible: true, align: 'center', valign: 'middle'},
        {title: '身份证号码', field: 'idcard', visible: true, align: 'center', valign: 'middle'},
        {title: '身份证', field: 'source', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                if (null != row.idcardFront){
                    return '<span>已上传</span>'
                }else{
                    return '<span>未上传</span>'
                }
            }},
            {title: '累计订单量', field: 'cumulativeOrderCount', visible: true, align: 'center', valign: 'middle'},
            {title: '当月订单量', field: 'monthOrderCount', visible: true, align: 'center', valign: 'middle'},
            {title: '积分', field: 'integral', visible: true, align: 'center', valign: 'middle'},
        {title: '连续未上线(天)', field: 'refusalCount', visible: true, align: 'center', valign: 'middle'},
        {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                    return '<span>异常</span>'
            }},
            {title: '添加时间', field: 'createTime', visible: true, align: 'center', valign: 'middle'},
        {title: '操作', visible: true, align: 'center', valign: 'middle',width:150,
            formatter: function (value, row) {
                if (row.status === 1){
                    return '<a href="#" onclick="TDriverException.stop('+row.id+','+row.status+')" style="color:red">冻结</a>'
                }else if (row.status === 2){
                    return '<a href="#" onclick="TDriverException.start('+row.id+','+row.status+')" style="color:green">解冻</a>'
                }
            }
        }
    ];
};
 
/**
 * 检查是否选中
 */
TDriverException.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        TDriverException.seItem = selected[0];
        return true;
    }
};
 
/**
 * 点击添加
 */
TDriverException.openAddTDriver = function () {
    var index = layer.open({
        type: 2,
        title: '添加',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/tDriver_add'
    });
    this.layerIndex = index;
};
 
/**
 * 打开查看详情
 */
TDriverException.openTDriverDetail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: '详情',
            area: ['800px', '420px'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tDriver/tDriver_update/' + TDriver.seItem.id
        });
        this.layerIndex = index;
    }
};
 
/**
 * 删除
 */
TDriverException.delete = function () {
    if (this.check()) {
        var ajax = new $ax(Feng.ctxPath + "/tDriver/delete", function (data) {
            Feng.success("删除成功!");
            TDriver.table.refresh();
        }, function (data) {
            Feng.error("删除失败!" + data.responseJSON.message + "!");
        });
        ajax.set("tDriverId",this.seItem.id);
        ajax.start();
    }
};
 
/**
 * 停用页面
 */
TDriverException.stop = function (id) {
    var index = layer.open({
        type: 2,
        title: '停用',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/tDriverException_start_and_stop?id='+id
    });
    this.layerIndex = index;
};
 
/**
 * 启动页面
 */
TDriverException.start = function (id) {
    var index = layer.open({
        type: 2,
        title: '启用',
        area: ['800px', '420px'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/tDriverException_start_and_stop?id='+id
    });
    this.layerIndex = index;
};
 
/**
 * 提交启用冻结
 */
TDriverException.updateStatus = function () {
 
    var status = $("#status").val();
    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.closeException();
        parent.TDriverException.table.refresh();
    }, function (data) {
        Feng.error("修改失败!" + data.responseJSON.message + "!");
    });
    ajax.set("id",$("#id").val());
    ajax.set("status",$("#status").val());
    if($("#status").val() == 1){
        ajax.set("remark",$("#stopRemark").val());
    }
    if($("#status").val() == 2){
        ajax.set("remark",$("#startRemark").val());
    }
    ajax.start();
};
 
/**
 * 司机异常信息导出
 */
TDriverException.export=function(){
    var createTime=$("#createTime").val()
    var phone=$("#phone").val()
    var status=$("#status").val()
    window.location.href=Feng.ctxPath + "/tDriver/export-exception?createTime="+createTime
        +"&status="+status
        +"&phone="+phone
    ;
}
 
/**
 * 司机异常列表
 */
TDriverException.tDriverException = function () {
    var index = layer.open({
        type: 2,
        title: '司机异常列表',
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tDriver/tDriver_exception'
    });
    this.layerIndex = index;
};
 
/**
 * 查询列表
 */
TDriverException.search = function () {
    var queryData = {};
    queryData['createTime'] = $("#createTime").val();
    queryData['phone'] = $("#phone").val();
    queryData['status'] = $("#status").val();
    TDriverException.table.refresh({query: queryData});
};
 
/**
 * 重置
 */
TDriverException.resetSearch = function (){
    $("#createTime").val('');
    $("#phone").val('');
    $("#status").val('');
    TDriverException.search();
}
 
$(function () {
    var defaultColunms = TDriverException.initColumn();
    var table = new BSTable(TDriverException.id, "/tDriver/exceptionList", defaultColunms);
    table.setPaginationType("client");
    TDriverException.table = table.init();
});