/**
* 积分申报审核
*/
var IntegralVerify = {
id: "IntegralVerifyTable", //表格id
seItem: null, //选中的条目
table: null,
layerIndex: -1
};
IntegralVerify.formParams = function () {
var queryData = {};
queryData['name'] = $("#name").val();
queryData['card_number'] = $("#card_number").val();
queryData['phone'] = $("#phone").val();
queryData['email'] = $("#email").val();
queryData['checkState'] = $("#checkState").val();
queryData['apply_year'] = $("#apply_year").val();
queryData['shareholder'] = $("#shareholder").val();
return queryData;
}
/**
* 初始化表格的列
*/
IntegralVerify.initColumn = function () {
var type = $("#type").val();
return [
{field: 'selectItem', radio: true},
{title: '申报年度', field: 'apply_year', visible: true, align: 'center', valign: 'middle', width: '80px'},
{title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle', width: "100px",
formatter: function (value, row, index) {
if (row.sex == 1) {
return value + '【男】';
} else if (row.sex == 2) {
return value + '【女】';
} else {
return value;
}
}
},
{title: '人才类别', field: 'type', visible: true, align: 'center', valign: 'middle', width: "100px",
formatter: function (value, row, index) {
if (value == 1) {
return '晋江市现代产业体系人才';
}
if (value == 2) {
return '集成电路优秀人才';
}
}
},
{title: '是否股东', field: 'shareholder', visible: true, align: 'center', valign: 'middle', width: "100px",
formatter: function (value, row, index) {
if (value == 1) {
return '是';
}
if (value == 2) {
return '否';
}
}
},
{title: '证件号码', field: 'card_number', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
{title: '申报标准', field: 'details', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "120px"},
{title: '首次提交时间', field: 'first_submit_time', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
{title: '最新提交时间', field: 'new_submit_time', visible: true, align: 'center', valign: 'middle', 'class': 'uitd_showTip', width: "100px"},
{title: '审核状态', field: 'checkState', visible: true, align: 'center', valign: 'middle', width: "100px",
formatter: function (value, row, index) {
if (row.real_state != row.checkState) {
switch (row.real_state) {
case 4:
return "初审驳回";
case 7:
//复审驳回
return "待重新初审";
}
} else {
switch (value) {
case 2:
if (row.last_state == 4) {
return "待初审(重新提交)";
}
return "待初审";
case 3:
return "待复审";
case 5:
return "初审不通过";
case 6:
return "复审通过待核查征信";
case 8:
return "复审不通过";
}
}
}
},
{title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', width: "80px",
formatter: function (value, row, index) {
return "" +
"日志" +
"";
}
}
];
};
/**
* 检查是否选中
*/
IntegralVerify.check = function () {
var selected = $('#' + this.id).bootstrapTable('getSelections');
if (selected.length != 1) {
Feng.info("请先选中表格中的某一记录!");
return false;
} else {
IntegralVerify.seItem = selected[0];
return true;
}
};
/**
* 查询人才认定申报列表
*/
IntegralVerify.search = function () {
IntegralVerify.table.refresh({query: IntegralVerify.formParams()});
};
/**
* 重置
*/
IntegralVerify.reset = function () {
$("#name").val("");
$("#card_number").val("");
$("#phone").val("");
$("#email").val("");
$("#checkState").val("");
$("#apply_year").val("");
$("#shareholder").val("");
}
/**
* 显示导出模态框
*/
IntegralVerify.showExportModal = function () {
$("#exportForm")[0].reset();
$("#commonExportModal").modal("show");
}
/**
* 导出提交
*/
IntegralVerify.export = function (process) {
var names = '';
var values = '';
var commonExport = "";
$("#field_info li input").each(function (index) {
if ($(this).is(":checked")) {
values = values + $(this).val() + ",";
names = names + $(this).next().text() + ",";
}
});
var queryData = IntegralVerify.formParams();
var process = parseInt($("#process").val());
switch (process) {
case 1:
commonExport = "fstVerifyListExport";
break;
case 2:
commonExport = "reVerifyListExport";
break;
case 3:
commonExport = "preListExport";
break;
}
$("#commonExportModal").modal('hide');
var params = $("#exportForm").serialize();
var url = "/admin/integralVerify/" + commonExport + "?" + params;
window.location.href = url;
}
/**
* 下载
*/
IntegralVerify.download = function () {
if (this.check()) {
window.location.href = encodeURI(encodeURI(Feng.ctxPath + "/common/api/downloadZip?type=20&id=" + IntegralVerify.seItem.id));
}
}
IntegralVerify.openCheckIntegralVerify = function () {
var process = $("#process").val();
var title = "";
switch (process) {
case "1":
title = "初审";
break;
case "2":
title = "复审";
break;
default:
break;
}
if (this.check()) {
var index = layer.open({
type: 2,
title: '积分申报' + " - " + title,
area: ['800px', '420px'], //宽高
fix: false, //不固定
maxmin: true,
content: '/admin/integralVerify/detail/id/' + IntegralVerify.seItem.id + '/1',
btn: [' 保存未提交', ' 提交审核', ' 关闭'],
btnAlign: 'c',
btn1: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.IntegralVerifyInfoDlg.showFirstCheckModal();
}, btn2: function (index, layero) {
var obj = layero.find("iframe")[0].contentWindow;
obj.IntegralVerifyInfoDlg.submitCheck();
return false;
}
});
layer.full(index);
IntegralVerify.layerIndex = index;
}
}
/**
* 显示审核日志
*/
IntegralVerify.showLog = function (id) {
layer.open({
type: 1,
title: "日志",
fixed: false,
content: '
',
area: ['80%', '80%'],
maxmin: true,
success: function (layero, index) {
Feng.getCheckLog(id, {"type": CONFIG.project_integral_apply, "mainId": id, "typeFileId": "", "active": 1})
}
});
}
/**
* 修改驳回的字段及附件
*/
IntegralVerify.updateFieldsAndFiles = function () {
if (this.check()) {
var ajax = new $ax("/admin/integralVerify/findFieldsAndFiles?id=" + IntegralVerify.seItem.id, function (data) {
var obj = data.obj.obj;
if (data.code == 200) {
layer.open({
type: 1,
id: "neewFieldFormModel",
title: '修改',
area: ['800px', '450px'], //宽高
fix: false, //不固定
shade: 0,
maxmin: true,
content: IntegralVerify.creatFieldCheckModal(),
btn: [' 提交', ' 关闭'],
btnAlign: 'c',
zIndex: layer.zIndex,
success: function (layero, index) {
var fileList = data.obj.fileList;
var html = '';
for (var key in fileList) {
html = html + '';
}
$("#field_file").empty().append(html);
if (obj.fields != null && obj.fields != '') {
$("#field_info input").each(function () {
var arr = obj.fields.split(",");
for (var key in arr) {
if ($(this).val() == arr[key]) {
this.checked = true;
}
}
});
}
if (obj.files != null && obj.files != '') {
$("#field_file input").each(function () {
if (obj.files.indexOf($(this).val()) != -1) {
this.checked = true;
}
});
}
},
yes: function (index, layero) {
IntegralVerify.submitFieldsAndFiles(index, obj.id);
}
});
} else {
Feng.error(data.msg);
}
}, function (data) {
Feng.error("查询失败!" + data.responseJSON.message + "!");
});
ajax.start();
}
}
/**
* 修改提交
* @param index
* @param id
*/
IntegralVerify.submitFieldsAndFiles = function (index, id) {
var fields = '';
var files = '';
$("#field_info li input").each(function (index) {
if ($(this).is(":checked")) {
fields = fields + $(this).val() + ",";
}
});
$("#field_file li input").each(function (index) {
if ($(this).is(":checked")) {
files = files + $(this).val() + ",";
}
});
if (fields == '' && files == '') {
Feng.info("请选择可修改的字段或附件!");
return;
}
var ajax = new $ax("/admin/integralVerify/updateFieldsAndFiles", function (data) {
if (data.code == 200) {
layer.close(index);
Feng.success(data.msg);
} else {
Feng.error(data.msg);
}
}, function (data) {
Feng.error("修改失败!" + data.responseJSON.message + "!");
});
ajax.setData({"id": id, "fields": fields, "files": files})
ajax.start();
}
/**
* 审核不通过
*/
IntegralVerify.setNotPass = function () {
var selecteds = $('#' + this.id).bootstrapTable('getSelections');
if (selecteds.length == 0) {
Feng.info("请选择需要设置审核不通过的行");
return;
}
var ids = "";
for (var key in selecteds) {
ids = ids + selecteds[key].id + ",";
}
ids = ids.substring(0, ids.length - 1);
layer.open({
type: 1,
id: "notPassModal",
title: '修改',
area: ['800px', '450px'], //宽高
fix: false, //不固定
shade: 0,
maxmin: true,
content: '',
btn: [' 提交', ' 关闭'],
btnAlign: 'c',
zIndex: layer.zIndex,
yes: function (index, layero) {
var checkMsg = $("#checkMsgNotPass").val();
if (Feng.isEmptyStr(checkMsg)) {
Feng.info("请填写审核不通过原因");
return;
}
var operation = function () {
var ajax = new $ax("/admin/integralVerify/cancel_verify", function (data) {
if (data.code == 200) {
Feng.success(data.msg);
IntegralVerify.table.refresh();
layer.close(index);
} else {
Feng.error(data.msg);
}
}, function (data) {
Feng.error("设置审核不通过失败!" + data.responseJSON.message + "!");
});
ajax.set("ids", ids);
ajax.set("msg", checkMsg);
ajax.start();
}
Feng.confirm("一旦提交无法修改,确定设置所选数据为审核不通过?", operation);
}
});
}
IntegralVerify.creatFieldCheckModal = function () {
return '';
}
IntegralVerify.fieldCheckd = function (context) {
if ($(context).get(0).checked) {
$(context).parent().next().children()[0].checked = true;
$(context).parent().next().children().eq(0).trigger("change");
}
}
IntegralVerify.sourceCheckd = function (context) {
if ($(context).get(0).checked) {
$("#talentArrangeCheckBox").attr("checked", true);
$("#talentArrangeCheckBox").trigger("change");
}
}
IntegralVerify.getPhones = function () {
var process = $("#process").val();
var ajax = new $ax("/admin/integralVerify/getPhones/process/" + process, function (data) {
if (data.code == 200) {
layer.open({
type: 1,
title: "手机号码",
area: ['830px', '300px'], //宽高
fix: false, //不固定
maxmin: true,
content: "" + data.obj + ""
});
} else {
Feng.info(data.msg);
}
}, function (data) {
Feng.error("操作失败!");
});
ajax.setData(IntegralVerify.formParams());
ajax.start();
}
IntegralVerify.getEnterprisePhones = function () {
var process = $("#process").val();
var ajax = new $ax("/admin/integralVerify/getEnterprisePhones/process/" + process, function (data) {
if (data.code == 200) {
layer.open({
type: 1,
title: "手机号码",
area: ['830px', '300px'], //宽高
fix: false, //不固定
maxmin: true,
content: "" + data.obj + ""
});
} else {
Feng.info(data.msg);
}
}, function (data) {
Feng.error("操作失败!");
});
ajax.setData(IntegralVerify.formParams());
ajax.start();
}
/**
* 全选
*/
IntegralVerify.checkAll = function () {
$("#field_info input").each(function () {
this.checked = true;
})
}
/**
* 反选
*/
IntegralVerify.unCheckAll = function () {
$("#field_info input").each(function () {
if (this.checked) {
this.checked = false;
} else {
this.checked = true;
}
})
}
$(function () {
var defaultColunms = IntegralVerify.initColumn();
var process = $("#process").val();
var table = new BSTable(IntegralVerify.id, "/admin/integralVerify/list/process/" + process, defaultColunms);
table.setPaginationType("server");
table.setSingleSelect(false);
table.setOnDblClickRow(function () {
IntegralVerify.openCheckIntegralVerify();
});
IntegralVerify.table = table.init();
});