/**
|
* 车辆管理管理初始化
|
*/
|
var Recruit = {
|
id: "RecruitTable", //表格id
|
seItem: null, //选中的条目
|
table: null,
|
layerIndex: -1
|
};
|
|
/**
|
* 初始化表格的列
|
*/
|
Recruit.initColumn = function () {
|
return [
|
{field: 'selectItem', radio: true},
|
{title: '发布时间', field: 'createTime', visible: true, align: 'center', valign: 'middle',width:'150px'},
|
{title: '发布者', field: 'insertUser', visible: true, align: 'center', valign: 'middle',width:'100px'},
|
{title: '职位标题', field: 'title', visible: true, align: 'center', valign: 'middle',width:'150px'},
|
{title: '职位描述', field: 'describe', visible: true, align: 'center', valign: 'middle',width:'200px',
|
formatter: function (value, row) {
|
value = (typeof value == "undefined" ? '-':value);
|
return '<span title="' + value + '">' + value + '</span>';
|
}
|
},
|
{title: '招聘人数', field: 'recruitsNumber', visible: true, align: 'center', valign: 'middle',width:'100px'},
|
{title: '经验要求', field: 'experienceRequirements', visible: true, align: 'center', valign: 'middle',width:'100px'},
|
{title: '学历要求', field: 'educationalRequirements', visible: true, align: 'center', valign: 'middle',width:'100px'},
|
{title: '福利', field: 'welfare', visible: true, align: 'center', valign: 'middle',width:'200px',
|
formatter: function (value, row) {
|
return '<span title="' + value + '">' + value + '</span>';
|
}
|
},
|
{title: '薪资', field: 'salary', visible: true, align: 'center', valign: 'middle',width:'150px',
|
formatter: function (value, row) {
|
if(row.interviewOrNot == 1){
|
return '面谈';
|
}
|
return value;
|
}
|
},
|
{title: '是否为首页推荐', field: 'firstPageShow', visible: true, align: 'center', valign: 'middle',width:'100px',
|
formatter: function (value, row) {
|
switch (value) {
|
case 1:
|
return '是';
|
case 2:
|
return '否';
|
}
|
}
|
},
|
{title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle',width:'100px',
|
formatter: function (value, row) {
|
switch (value) {
|
case 1:
|
return '待发布';
|
case 2:
|
return '发布中';
|
case 3:
|
return '已关闭';
|
}
|
}
|
}
|
];
|
};
|
|
/**
|
* 检查是否选中
|
*/
|
Recruit.check = function () {
|
var selected = $('#' + this.id).bootstrapTable('getSelections');
|
if(selected.length == 0){
|
Feng.info("请先选中表格中的某一记录!");
|
return false;
|
}else{
|
Recruit.seItem = selected[0];
|
return true;
|
}
|
};
|
|
/**
|
* 点击添加车辆管理
|
*/
|
Recruit.openAddRecruit = function () {
|
var index = layer.open({
|
type: 2,
|
title: '添加招聘信息',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/recruit/recruit_add'
|
});
|
this.layerIndex = index;
|
};
|
|
/**
|
* 打开查看车辆管理详情
|
*/
|
Recruit.openRecruitDetail = function () {
|
if (this.check()) {
|
if(Recruit.seItem.status == 6){
|
Feng.info("不能编辑");
|
return
|
}
|
var index = layer.open({
|
type: 2,
|
title: '编辑招聘',
|
area: ['100%', '100%'], //宽高
|
fix: false, //不固定
|
maxmin: true,
|
content: Feng.ctxPath + '/recruit/recruit_update?id=' + Recruit.seItem.id
|
});
|
this.layerIndex = index;
|
}
|
};
|
|
/**
|
* 删除车辆管理
|
*/
|
Recruit.deleteRecruit = function () {
|
if (this.check()) {
|
if(Recruit.seItem.status == 2) {
|
Feng.info("信息发布中!");
|
return
|
}
|
swal({
|
title: "您是否确认删除该招聘信息?",
|
text: "请谨慎操作,删除后数据无法恢复!",
|
type: "warning",
|
showCancelButton: true,
|
confirmButtonColor: "#DD6B55",
|
confirmButtonText: "删除",
|
closeOnConfirm: true
|
}, function () {
|
var ajax = new $ax(Feng.ctxPath + "/recruit/deleteRecruit", function (res) {
|
if(res.code == 200){
|
swal("删除成功", "您已经成功删除了该招聘信息。", "success");
|
Recruit.table.refresh();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
swal("删除失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",Recruit.seItem.id);
|
ajax.start();
|
});
|
}
|
};
|
|
/**
|
* 发布
|
*/
|
Recruit.releaseRecruit = function () {
|
if (this.check()) {
|
if(Recruit.seItem.status != 1){
|
Feng.info("不允许发布");
|
return
|
}
|
var ajax = new $ax(Feng.ctxPath + "/recruit/releaseRecruit", function (res) {
|
if(res.code == 200){
|
Feng.success("发布成功");
|
Recruit.table.refresh();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
swal("发布失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",Recruit.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 关闭
|
*/
|
Recruit.closeRecruit = function () {
|
if (this.check()) {
|
if(Recruit.seItem.status == 3){
|
Feng.info("不允许重复操作");
|
return
|
}
|
var ajax = new $ax(Feng.ctxPath + "/recruit/closeRecruit", function (res) {
|
if(res.code == 200){
|
Feng.success("关闭成功");
|
Recruit.table.refresh();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
swal("关闭失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",Recruit.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 设为首页推荐
|
*/
|
Recruit.homeRecommend = function () {
|
if (this.check()) {
|
if(Recruit.seItem.firstPageShow == 1){
|
Feng.info("不允许重复操作");
|
return
|
}
|
if(Recruit.seItem.status != 2){
|
Feng.info("不允许设置");
|
return
|
}
|
var ajax = new $ax(Feng.ctxPath + "/recruit/homeRecommend", function (res) {
|
if(res.code == 200){
|
Feng.success("设置成功");
|
Recruit.table.refresh();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
swal("设置失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",Recruit.seItem.id);
|
ajax.start();
|
}
|
};
|
|
/**
|
* 取消推荐
|
*/
|
Recruit.cancelHomeRecommend = function () {
|
if (this.check()) {
|
if(Recruit.seItem.firstPageShow == 2){
|
Feng.info("不允许重复操作");
|
return
|
}
|
var ajax = new $ax(Feng.ctxPath + "/recruit/cancelHomeRecommend", function (res) {
|
if(res.code == 200){
|
Feng.success("设置成功");
|
Recruit.table.refresh();
|
}else{
|
Feng.error(res.msg);
|
}
|
}, function (data) {
|
swal("设置失败", data.responseJSON.message+"!", "warning");
|
});
|
ajax.set("id",Recruit.seItem.id);
|
ajax.start();
|
}
|
};
|
|
|
/**
|
* 查询车辆管理列表
|
*/
|
Recruit.search = function () {
|
var queryData = {};
|
queryData['createTime'] = $("#createTime").val();
|
queryData['title'] = $("#title").val();
|
queryData['experienceRequirements'] = $("#experienceRequirements").val();
|
queryData['insertUser'] = $("#insertUser").val();
|
queryData['driverType'] = $("#driverType").val();
|
Recruit.table.setQueryParams({});
|
Recruit.table.refresh({query: queryData});
|
};
|
|
Recruit.resetSearch = function () {
|
$("#createTime").val("");
|
$("#title").val("");
|
$("#experienceRequirements").val("");
|
$("#insertUser").val("");
|
$("#driverType").val("");
|
Recruit.search();
|
};
|
|
$(function () {
|
var defaultColunms = Recruit.initColumn();
|
var table = new BSTable(Recruit.id, "/recruit/list", defaultColunms);
|
table.setPaginationType("server");
|
Recruit.table = table.init();
|
});
|