无关风月
2025-05-08 9486766c806fe1d9e082b2fd02ea1cc558f1b443
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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
/**
 * 车辆类型管理管理初始化
 */
var TCarModel = {
    id: "TUserLargeTable",    //表格id
    seItem: null,        //选中的条目
    table: null,
    layerIndex: -1
};
var language =$("#language").val()
/**
 * 初始化表格的列
 */
TCarModel.initColumn = function () {
    return [
        {field: 'selectItem', radio: true},
        {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'},
        {title: language==1?'添加时间':(language==2?'Add Time':'Tambahkan waktu'), field: 'createTime', visible: true, align: 'center', valign: 'middle',width:'10%',
            formatter: function (value, row) {
                var btn = "";
                return currentTime(value);
            }
        },
        {title: language==1?'活动<br/>名称':(language==2?'Activity name':'Nama aktivitas'), field: 'name', visible: true, align: 'center', valign: 'middle',
            formatter: function (value, row) {
                var btn = "";
                if(row.name != '' && row.name != null) {
                    btn = ['<p class="toolTip" style="overflow:hidden;white-space:nowrap;text-overflow:ellipsis;" title="' + row.name + '" onfocus="TUser.tooltip()">' + row.name + '</p>']
                }
                return btn;
            }
        },
        {title: language==1?'活动时间':(language==2?'Activity time':'waktu aktivitas'), field: 'startTime', visible: true   , align: 'center', valign: 'middle',
            formatter:function (value,row) {
                return currentTime(row.startTime) +" - "+currentTime(row.endTime)
 
            }
        },
        {title:language==1?'参与人次':(language==2?'Number of participants':'Number of participants') , field: 'peopleNumber', visible: true, align: 'center', valign: 'middle',
        },
        {title: language==1?'状态':(language==2?'Status':'status'), field: 'status', visible: true, align: 'center', valign: 'middle',width:'10%',
            formatter: function (value, row) {
                if(value==1){
                    if(language==1){
                        return "未开始"
                    }else if(language==2){
                        return "have not started"
                    }else {
                        return "belum dimulai"
                    }
 
                }else if(value==2){
                    if(language==1){
                        return "进行中"
                    }else if(language==2){
                        return "underway"
                    }else {
                        return "dalam perjalanan"
                    }
 
                }else {
                    if(language==1){
                        return "已结束"
                    }else if(language==2){
                        return "finished"
                    }else {
                        return "selesai"
                    }
 
                }
            }
        },
        {
            title: language == 1 ? '审核状态' : (language == 2 ? 'Audit Status' : 'Audit Status'),
            field: 'state',
            visible: true,
            align: 'center',
            valign: 'middle',
            width: '10%',
            formatter: function (data) {
                if (language == 1) {
                    if (data == 1) {
                        return "待审核"
                    } else if (data == 2) {
                        return "通过"
                    } else {
                        return "拒绝"
                    }
                } else if (language == 2) {
                    if (data == 1) {
                        return "Pending review"
                    } else if (data == 2) {
                        return "Pass"
                    } else {
                        return "Reject"
                    }
                } else {
                    if (data == 1) {
                        return "Revisi tunggu"
                    } else if (data == 2) {
                        return "Pass"
                    } else {
                        return "Ditolak"
                    }
                }
            }
        },
        {
            title: language == 1 ? '备注' : (language == 2 ? 'Remark' : 'Perhatian'),
            field: 'remark',
            visible: true,
            align: 'center',
            valign: 'middle',
            width: '10%'}
    ];
};
function currentTime(timestamp){
    var date = new Date(timestamp);
    var Y = date.getFullYear() + '-';
    var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
    var D = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate()) + ' ';
 
    var h = (date.getHours() < 10 ? '0' + (date.getHours()) : date.getHours()) + ':';
    var m = (date.getMinutes() < 10 ? '0' + (date.getMinutes()) : date.getMinutes()) + ':';
    var s = (date.getSeconds() < 10 ? '0' + (date.getSeconds()) : date.getSeconds());
    var strDate = Y + M + D + h + m + s;
    return strDate
}
/**
 * 检查是否选中
 */
TCarModel.check = function () {
    var selected = $('#' + this.id).bootstrapTable('getSelections');
    if(selected.length == 0){
        Feng.info("请先选中表格中的某一记录!");
        return false;
    }else{
        TCarModel.seItem = selected[0];
        return true;
    }
};
TCarModel.audit = function () {
    if (this.check()) {
        if(TCarModel.seItem.state!=1){
            Feng.info("请在待审核状态下操作")
            return;
        }
        var index = layer.open({
            type: 2,
            title: language == 1 ? '审核' : (language == 2 ? 'Audit' : 'Audit'),
            area: ['50%', '50%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tUserLarge/tUserLarge_audit/'+ TCarModel.seItem.id
        });
        this.layerIndex = index;
    }
};
 
/**
 * 点击添加车辆类型管理
 */
TCarModel.openAddTCarModel = function () {
    var index = layer.open({
        type: 2,
        title: language==1?'添加':(language==2?'Add':'Tambahkan'),
        area: ['100%', '100%'], //宽高
        fix: false, //不固定
        maxmin: true,
        content: Feng.ctxPath + '/tUserLarge/tUserLarge_add'
    });
    this.layerIndex = index;
};
 
/**
 * 打开查看车辆类型管理详情
 */
TCarModel.openTCarModelDetail = function () {
    if (this.check()) {
        var index = layer.open({
            type: 2,
            title: language==1?'详情':(language==2?'Detail':'Perincian'),
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tUserLarge/tUserLarge_update/' + TCarModel.seItem.id
        });
        this.layerIndex = index;
    }
};
TCarModel.all = function () {
        var index = layer.open({
            type: 2,
            title: language==1?'领取统计':(language==2?'Claim statistics':'Statistik klaim'),
            area: ['100%', '100%'], //宽高
            fix: false, //不固定
            maxmin: true,
            content: Feng.ctxPath + '/tUserLarge/tUserLarge_all/'
        });
        this.layerIndex = index;
};
 
/**
 * 删除车辆类型管理
 */
TCarModel.delete = function () {
    if (this.check()) {
        console.log(TCarModel.seItem.id)
        var nickname = TCarModel.seItem.name;
        if (nickname == "" || nickname == null || nickname == undefined){
            if(language==1){
                nickname = "该活动";
            }else if(language==2){
                nickname = "This Activity";
            }else {
                nickname = "Aktivitas ini";
            }
        }else{
            nickname = "【"+nickname+"】";
        }
        var status =TCarModel.seItem.status;
        if(status==1 || status ==3){
            if(language==1){
                status ="开启"
            }else if(language==2){
                status ="Open"
            }else {
                status ="Buka"
            }
        }else {
            if(language==1){
                status ="暂停"
            }else if(language==2){
                status ="Stop"
            }else {
                status ="Hentikan"
            }
        }
        swal({
           title: language==1?"您是否确认"+status + nickname + "?":(language==2?"Are you sure to "+status + nickname + "?":"Apakah Anda yakin untuk" +status+ nickname + "?"),
            text: language==1?"请谨慎操作!":(language==2?' Please operate with caution!':'Harap beroperasi dengan hati -hati!'),
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: language==1?"确认":(language==2?'Yes':'Ya'),
            closeOnConfirm: true,
            cancelButtonText: language==1?"取消":(language==2?'Cancel':'Cancel'),
        }, function () {
            var ajax = new $ax(Feng.ctxPath + "/tUserLarge/updateStatus", function (data) {
                if(language==1){
                    Feng.success("操作成功")
                }else if(language==2){
                    Feng.success("Success")
                }else {
                    Feng.success("Success")
                }
                TCarModel.table.refresh();
            }, function (data) {
                if(language==1){
                    swal("操作失败", data.responseJSON.message + "!", "warning");
                }else if(language==2){
                    swal("Failed to delete", data.responseJSON.message + "!", "warning");
                }else {
                    swal("Hapus Gagal", data.responseJSON.message + "!", "warning");
                }
            });
            ajax.set("tCarModelId", TCarModel.seItem.id);
            ajax.start();
        });
    }
};
 
/**
 * 查询车辆类型管理列表
 */
TCarModel.search = function () {
    var queryData = {};
    queryData['createTime'] = $("#createTime").val();
    queryData['name'] = $("#name").val();
    queryData['status'] = $("#status").val();
    TCarModel.table.refresh({query: queryData});
};
 
TCarModel.resetSearch = function () {
    $("#createTime").val("");
    $("#name").val("");
    $("#status").val("");
    TCarModel.search();
};
 
$(function () {
    var defaultColunms = TCarModel.initColumn();
    var table = new BSTable(TCarModel.id, "/tUserLarge/list", defaultColunms);
    table.setPaginationType("server");
    TCarModel.table = table.init();
});