| | |
| | | /** |
| | | * 车辆管理管理初始化 |
| | | */ |
| | | var TCar = { |
| | | id: "TCarTable", //表格id |
| | | var TCompetition = { |
| | | id: "TCompetitionTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1 |
| | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TCar.initColumn = function () { |
| | | TCompetition.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', radio: true}, |
| | | {title: '所在省', field: 'insertTime', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | {title: '所在省', field: 'province', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | }, |
| | | {title: '所在市', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '举办门店', field: 'companyName', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | {title: '所在市', field: 'city', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '举办门店', field: 'storeName', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | }, |
| | | {title: '赛事名称', field: 'brandName', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | {title: '赛事名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | }, |
| | | {title: '开始时间', field: 'modelName', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | {title: '开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | }, |
| | | {title: '结束时间', field: 'carColor', visible: true, align: 'center', valign: 'middle',width:'5%', |
| | | {title: '结束时间', field: 'endTime', visible: true, align: 'center', valign: 'middle',width:'5%', |
| | | }, |
| | | {title: '最大人数-已报名人数', field: 'serverStr', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | {title: '最大人数-已报名人数', field: 'applicantsNumber', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | }, |
| | | {title: '报名条件', field: 'carLicensePlate', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | {title: '报名条件', field: 'registerCondition', visible: true, align: 'center', valign: 'middle',width:'8%', |
| | | formatter:function (data) { |
| | | return {1:"全部用户",2:"仅限年度会员参与",3:"仅限学员参与"}[data] |
| | | } |
| | | }, |
| | | ]; |
| | | }; |
| | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TCar.check = function () { |
| | | TCompetition.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TCar.seItem = selected[0]; |
| | | TCompetition.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | |
| | | /** |
| | | * 点击添加车辆管理 |
| | | */ |
| | | TCar.openAddTCar = function () { |
| | | TCompetition.openAddTCompetition = function () { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tCar/tCar_add' |
| | | content: Feng.ctxPath + '/tCompetition/tCompetition_add' |
| | | }); |
| | | this.layerIndex = index; |
| | | }; |
| | |
| | | /** |
| | | * 打开查看车辆管理详情 |
| | | */ |
| | | TCar.openTCarDetail = function () { |
| | | TCompetition.openTCompetitionDetail = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tCar/tCar_update/' + TCar.seItem.id |
| | | content: Feng.ctxPath + '/TCompetition/TCompetition_update/' + TCompetition.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | |
| | | /** |
| | | * 删除车辆管理 |
| | | */ |
| | | TCar.delete = function () { |
| | | TCompetition.delete = function () { |
| | | if (this.check()) { |
| | | var nickname = TCar.seItem.carLicensePlate; |
| | | var nickname = TCompetition.seItem.carLicensePlate; |
| | | if (nickname == "" || nickname == null || nickname == undefined){ |
| | | nickname = "该车辆"; |
| | | }else{ |
| | |
| | | confirmButtonText: language==1?"删除":(language==2?'Delete':'Hapus'), |
| | | closeOnConfirm: true |
| | | }, function () { |
| | | var ajax = new $ax(Feng.ctxPath + "/tCar/delete", function (data) { |
| | | var ajax = new $ax(Feng.ctxPath + "/TCompetition/delete", function (data) { |
| | | if(language==1){ |
| | | swal("删除成功", "您已经成功删除了" + nickname + "。", "success"); |
| | | }else if(language==2){ |
| | |
| | | }else { |
| | | swal("Hapus berhasil!", "Anda berhasil menghapus" + nickname + "。", "success"); |
| | | } |
| | | TCar.table.refresh(); |
| | | TCompetition.table.refresh(); |
| | | }, function (data) { |
| | | if(language==1){ |
| | | swal("删除失败", data.responseJSON.message + "!", "warning"); |
| | |
| | | } |
| | | |
| | | }); |
| | | ajax.set("tCarId",TCar.seItem.id); |
| | | ajax.set("TCompetitionId",TCompetition.seItem.id); |
| | | ajax.start(); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | |
| | | TCar.carInsurance = function () { |
| | | TCompetition.carInsurance = function () { |
| | | if (this.check()) { |
| | | var index = layer.open({ |
| | | type: 2, |
| | |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/tCar/carInsurance?carId=' + TCar.seItem.id |
| | | content: Feng.ctxPath + '/TCompetition/carInsurance?carId=' + TCompetition.seItem.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | |
| | | /** |
| | | * 查询车辆管理列表 |
| | | */ |
| | | TCar.search = function () { |
| | | TCompetition.search = function () { |
| | | var queryData = {}; |
| | | queryData['createTime'] = $("#createTime").val(); |
| | | queryData['id'] = $("#id").val(); |
| | | queryData['brandName'] = $("#brandName").val(); |
| | | queryData['modelName'] = $("#modelName").val(); |
| | | queryData['carColor'] = $("#carColor").val(); |
| | | queryData['serverStr'] = $("#serverStr").val(); |
| | | queryData['carLicensePlate'] = $("#carLicensePlate").val(); |
| | | queryData['driverName'] = $("#driverName").val(); |
| | | queryData['companyName'] = $("#companyName").val(); |
| | | queryData['franchiseeName'] = $("#franchiseeName").val(); |
| | | TCar.table.refresh({query: queryData}); |
| | | TCompetition.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | TCar.resetSearch = function () { |
| | | $("#createTime").val(""); |
| | | $("#id").val(""); |
| | | $("#brandName").val(""); |
| | | $("#modelName").val(""); |
| | | $("#carColor").val(""); |
| | | $("#serverStr").val(""); |
| | | $("#carLicensePlate").val(""); |
| | | $("#driverName").val(""); |
| | | $("#companyName").val(""); |
| | | $("#franchiseeName").val(""); |
| | | TCar.search(); |
| | | TCompetition.resetSearch = function () { |
| | | TCompetition.search(); |
| | | }; |
| | | |
| | | $(function () { |
| | | var defaultColunms = TCar.initColumn(); |
| | | var table = new BSTable(TCar.id, "/tCompetition/list", defaultColunms); |
| | | var defaultColunms = TCompetition.initColumn(); |
| | | var table = new BSTable(TCompetition.id, "/tCompetition/list", defaultColunms); |
| | | table.setPaginationType("server"); |
| | | TCar.table = table.init(); |
| | | TCompetition.table = table.init(); |
| | | }); |
| | | |
| | | /** |
| | | * 下载模板 |
| | | */ |
| | | TCar.uploadCarModel = function () { |
| | | window.location.href = Feng.ctxPath + "/tCar/uploadCarModel"; |
| | | TCompetition.uploadCarModel = function () { |
| | | window.location.href = Feng.ctxPath + "/TCompetition/uploadCarModel"; |
| | | } |
| | | |
| | | var agreement = function(){ |
| | |
| | | /** |
| | | * 导入合同 |
| | | */ |
| | | TCar.exportCar = function () { |
| | | TCompetition.exporTCompetition = function () { |
| | | var uploadEventFile = $("#uploadEventFile").val(); |
| | | if(uploadEventFile == ''){ |
| | | if(language==1){ |
| | |
| | | Feng.info("Hanya berkas Excel yang dapat diunggah"); |
| | | } |
| | | }else{ |
| | | var url = Feng.ctxPath + '/tCar/exportCar'; |
| | | var url = Feng.ctxPath + '/TCompetition/exporTCompetition'; |
| | | var file = document.querySelector('input[name=file]').files[0]; |
| | | var reader = new FileReader(); |
| | | if (file) { |
| | |
| | | } |
| | | } |
| | | } |
| | | TCar.sendAjaxRequest = function(url,type,data){ |
| | | TCompetition.sendAjaxRequest = function(url,type,data){ |
| | | $.ajax({ |
| | | url : url, |
| | | type : type, |
| | |
| | | Feng.success("Import berhasil!"); |
| | | } |
| | | } |
| | | TCar.table.refresh(); |
| | | TCompetition.table.refresh(); |
| | | }, |
| | | error : function() { |
| | | if(language==1){ |
| | |
| | | /** |
| | | * 导出车辆操作 |
| | | */ |
| | | TCar.outCar = function () { |
| | | TCompetition.ouTCompetition = function () { |
| | | var operation = function() { |
| | | window.location.href = Feng.ctxPath + "/tCar/outCar"; |
| | | window.location.href = Feng.ctxPath + "/TCompetition/ouTCompetition"; |
| | | }; |
| | | if(language==1){ |
| | | Feng.confirm("是否确认导出车辆信息?", operation); |