bug
This commit is contained in:
@ -222,18 +222,50 @@ public class SafetyCertificateController {
|
|||||||
|
|
||||||
@RequestMapping("/deletes.do")
|
@RequestMapping("/deletes.do")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String delete(HttpServletRequest request, Model model, String[] ids) throws IOException {
|
public String delete(HttpServletRequest request, Model model,
|
||||||
|
@RequestParam(value = "ids", required = false) String ids,
|
||||||
|
@RequestParam(value = "staffIds", required = false) String staffIds) throws IOException {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (String id : ids) {
|
|
||||||
|
// 兼容:支持 ids/staffIds 传 CSV,也支持重复参数数组
|
||||||
|
Set<String> idSet = new LinkedHashSet<>(parseRequestIds(request, "ids", ids));
|
||||||
|
idSet.addAll(parseRequestIds(request, "staffIds", staffIds));
|
||||||
|
|
||||||
|
for (String id : idSet) {
|
||||||
result += service.deleteById(id);
|
result += service.deleteById(id);
|
||||||
}
|
|
||||||
for (String id : ids) {
|
|
||||||
safetyFilesService.deleteByBizId(id);
|
safetyFilesService.deleteByBizId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
model.addAttribute("result", result);
|
model.addAttribute("result", result);
|
||||||
return "result";
|
return "result";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> parseRequestIds(HttpServletRequest request, String paramName, String rawIds) {
|
||||||
|
List<String> result = new ArrayList<>(parseIdTokens(rawIds));
|
||||||
|
String[] values = request.getParameterValues(paramName);
|
||||||
|
if (values != null) {
|
||||||
|
for (String value : values) {
|
||||||
|
result.addAll(parseIdTokens(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> parseIdTokens(String rawIds) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
if (org.apache.commons.lang3.StringUtils.isBlank(rawIds) || "null".equals(rawIds)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
String[] split = rawIds.split(",");
|
||||||
|
for (String id : split) {
|
||||||
|
String value = org.apache.commons.lang3.StringUtils.trim(id);
|
||||||
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(value) && value.matches("^[0-9A-Za-z_-]+$")) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转导入页面
|
* 跳转导入页面
|
||||||
*
|
*
|
||||||
|
|||||||
@ -339,16 +339,39 @@ public class SafetyExternalCertificateController {
|
|||||||
|
|
||||||
@RequestMapping("/deletes.do")
|
@RequestMapping("/deletes.do")
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String delete(HttpServletRequest request, Model model, String[] ids) throws IOException {
|
public String delete(HttpServletRequest request, Model model,
|
||||||
|
@RequestParam(value = "ids", required = false) String ids,
|
||||||
|
@RequestParam(value = "staffIds", required = false) String staffIds) throws IOException {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
for (String id : ids) {
|
|
||||||
|
// 兼容:支持 ids/staffIds 传 CSV,也支持重复参数数组
|
||||||
|
Set<String> certificateIdSet = new LinkedHashSet<>(parseRequestIds(request, "ids", ids));
|
||||||
|
Set<String> staffIdSet = new LinkedHashSet<>(parseRequestIds(request, "staffIds", staffIds));
|
||||||
|
|
||||||
|
for (String id : certificateIdSet) {
|
||||||
result += service.deleteById(id);
|
result += service.deleteById(id);
|
||||||
safetyFilesService.deleteByBizId(id);
|
safetyFilesService.deleteByBizId(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (String staffId : staffIdSet) {
|
||||||
|
safetyExternalStaffService.deleteById(staffId);
|
||||||
|
}
|
||||||
|
|
||||||
model.addAttribute("result", result);
|
model.addAttribute("result", result);
|
||||||
return "result";
|
return "result";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> parseRequestIds(HttpServletRequest request, String paramName, String rawIds) {
|
||||||
|
List<String> result = new ArrayList<>(parseExportIds(rawIds));
|
||||||
|
String[] values = request.getParameterValues(paramName);
|
||||||
|
if (values != null) {
|
||||||
|
for (String value : values) {
|
||||||
|
result.addAll(parseExportIds(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 跳转导入页面
|
* 跳转导入页面
|
||||||
*
|
*
|
||||||
@ -536,67 +559,61 @@ public class SafetyExternalCertificateController {
|
|||||||
public void export(HttpServletRequest request, HttpServletResponse response,
|
public void export(HttpServletRequest request, HttpServletResponse response,
|
||||||
@RequestParam(value = "issueDate", required = false) String issueDate,
|
@RequestParam(value = "issueDate", required = false) String issueDate,
|
||||||
@RequestParam(value = "jobType", required = false) String jobType,
|
@RequestParam(value = "jobType", required = false) String jobType,
|
||||||
@RequestParam(value = "companyParam", required = false) String companyParam) throws IOException {
|
@RequestParam(value = "companyParam", required = false) String companyParam,
|
||||||
// 摘自列表查询接口 start
|
@RequestParam(value = "search_name", required = false) String searchName,
|
||||||
User cu = (User) request.getSession().getAttribute("cu");
|
@RequestParam(value = "ids", required = false) String ids,
|
||||||
|
@RequestParam(value = "staffIds", required = false) String staffIds) throws IOException {
|
||||||
|
// 与列表接口保持一致,避免“页面有数据但导出为空”
|
||||||
String sort = " sc.userid, sc.create_time ";
|
String sort = " sc.userid, sc.create_time ";
|
||||||
String order = " desc ";
|
String order = " desc ";
|
||||||
String orderstr = " order by " + sort + " " + order;
|
String orderstr = " order by " + sort + " " + order;
|
||||||
String wherestr = " where flag='2' ";
|
String wherestr = " where 1=1 ";
|
||||||
if (request.getParameter("search_code") != null && !request.getParameter("search_code").isEmpty()) {
|
|
||||||
List<Unit> unitlist = unitService.getUnitChildrenById(request.getParameter("search_code"));
|
|
||||||
String pidstr = "";
|
|
||||||
for (int i = 0; i < unitlist.size(); i++) {
|
|
||||||
pidstr += "'" + unitlist.get(i).getId() + "',";
|
|
||||||
}
|
|
||||||
if (pidstr != "") {
|
|
||||||
pidstr = pidstr.substring(0, pidstr.length() - 1);
|
|
||||||
wherestr += "and u.pid in (" + pidstr + ") ";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Company company = unitService.getCompanyByUserId(cu.getId());
|
|
||||||
String companyId = "-1";
|
|
||||||
if (company != null) {
|
|
||||||
companyId = company.getId();
|
|
||||||
}
|
|
||||||
List<User> users = unitService.getChildrenUsersById(companyId);
|
|
||||||
String userIds = "";
|
|
||||||
for (User user : users) {
|
|
||||||
if (!userIds.isEmpty()) {
|
|
||||||
userIds += "','";
|
|
||||||
}
|
|
||||||
userIds += user.getId();
|
|
||||||
}
|
|
||||||
if (!userIds.isEmpty()) {
|
|
||||||
wherestr += "and u.id in ('" + userIds + "') ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 搜索框筛选
|
// 搜索框筛选
|
||||||
if (request.getParameter("search_name") != null && !request.getParameter("search_name").isEmpty()) {
|
if (StringUtils.isNotBlank(searchName)) {
|
||||||
wherestr += " and (sc.certificate_name like '%" + request.getParameter("search_name") + "%'" +
|
wherestr += " and (sc.certificate_name like '%" + searchName + "%'" +
|
||||||
" or ses.name like '%" + request.getParameter("search_name") + "%')";
|
" or ses.name like '%" + searchName + "%')";
|
||||||
}
|
}
|
||||||
|
|
||||||
// 领证时间筛选
|
// 领证时间筛选
|
||||||
if (StringUtils.isNotBlank(issueDate) && !"null".equals(issueDate)) {
|
if (StringUtils.isNotBlank(issueDate) && !"null".equals(issueDate)) {
|
||||||
String[] split = issueDate.split("~");
|
String[] split = issueDate.split("~");
|
||||||
|
if (split.length == 2) {
|
||||||
String issueDate_param_start_time = split[0].trim();
|
String issueDate_param_start_time = split[0].trim();
|
||||||
String issueDate_param_end_time = split[1].trim();
|
String issueDate_param_end_time = split[1].trim();
|
||||||
wherestr += " and sc.issue_date >= '" + issueDate_param_start_time + "'" +
|
wherestr += " and sc.issue_date >= '" + issueDate_param_start_time + "'" +
|
||||||
" and sc.issue_date <= '" + issueDate_param_end_time + "'";
|
" and sc.issue_date <= '" + issueDate_param_end_time + "'";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//作业类型
|
// 作业类型
|
||||||
if (StringUtils.isNotBlank(jobType) && !"null".equals(jobType)) {
|
if (StringUtils.isNotBlank(jobType) && !"null".equals(jobType)) {
|
||||||
wherestr += " and sc.job_type = '" + jobType + "'";
|
wherestr += " and sc.job_type = '" + jobType + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
//施工单位
|
// 施工单位
|
||||||
if (StringUtils.isNotBlank(companyParam) && !"null".equals(companyParam)) {
|
if (StringUtils.isNotBlank(companyParam) && !"null".equals(companyParam)) {
|
||||||
wherestr += " and ses.company = '" + companyParam + "'";
|
wherestr += " and ses.company = '" + companyParam + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 勾选导出:有勾选则仅导出勾选数据;无勾选则按筛选条件导出全部
|
||||||
|
List<String> certificateIdList = parseExportIds(ids);
|
||||||
|
List<String> staffIdList = parseExportIds(staffIds);
|
||||||
|
if (!CollectionUtils.isEmpty(certificateIdList) || !CollectionUtils.isEmpty(staffIdList)) {
|
||||||
|
StringBuilder selectedWhere = new StringBuilder(" and (");
|
||||||
|
if (!CollectionUtils.isEmpty(certificateIdList)) {
|
||||||
|
selectedWhere.append("sc.id in (").append(joinForSqlIn(certificateIdList)).append(")");
|
||||||
|
}
|
||||||
|
if (!CollectionUtils.isEmpty(staffIdList)) {
|
||||||
|
if (!CollectionUtils.isEmpty(certificateIdList)) {
|
||||||
|
selectedWhere.append(" or ");
|
||||||
|
}
|
||||||
|
selectedWhere.append("ses.id in (").append(joinForSqlIn(staffIdList)).append(")");
|
||||||
|
}
|
||||||
|
selectedWhere.append(")");
|
||||||
|
wherestr += selectedWhere;
|
||||||
|
}
|
||||||
|
|
||||||
List<SafetyExternalCertificateVo> list = this.service.selectListByConditionForExternal(wherestr + orderstr);
|
List<SafetyExternalCertificateVo> list = this.service.selectListByConditionForExternal(wherestr + orderstr);
|
||||||
List<SafetyExternalCertificateExcel> excelList = new ArrayList<>();
|
List<SafetyExternalCertificateExcel> excelList = new ArrayList<>();
|
||||||
SafetyExternalCertificateExcel excelEntity = null;
|
SafetyExternalCertificateExcel excelEntity = null;
|
||||||
@ -605,7 +622,7 @@ public class SafetyExternalCertificateController {
|
|||||||
BeanUtils.copyProperties(vo, excelEntity);
|
BeanUtils.copyProperties(vo, excelEntity);
|
||||||
excelList.add(excelEntity);
|
excelList.add(excelEntity);
|
||||||
}
|
}
|
||||||
// 摘自列表查询接口 end
|
|
||||||
response.setContentType("application/vnd.ms-excel");
|
response.setContentType("application/vnd.ms-excel");
|
||||||
response.setCharacterEncoding("utf8");
|
response.setCharacterEncoding("utf8");
|
||||||
response.setHeader("Content-disposition", "attachment;filename=" + java.net.URLEncoder.encode("外部人员证书信息", "UTF-8") + ".xlsx");
|
response.setHeader("Content-disposition", "attachment;filename=" + java.net.URLEncoder.encode("外部人员证书信息", "UTF-8") + ".xlsx");
|
||||||
@ -616,4 +633,31 @@ public class SafetyExternalCertificateController {
|
|||||||
excelWriter.finish();
|
excelWriter.finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<String> parseExportIds(String rawIds) {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
if (StringUtils.isBlank(rawIds) || "null".equals(rawIds)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
String[] split = rawIds.split(",");
|
||||||
|
for (String id : split) {
|
||||||
|
String value = StringUtils.trim(id);
|
||||||
|
// 仅保留安全字符,避免拼接 SQL 时引入非法字符
|
||||||
|
if (StringUtils.isNotBlank(value) && value.matches("^[0-9A-Za-z_-]+$")) {
|
||||||
|
result.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String joinForSqlIn(List<String> idList) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < idList.size(); i++) {
|
||||||
|
if (i > 0) {
|
||||||
|
sb.append(",");
|
||||||
|
}
|
||||||
|
sb.append("'").append(idList.get(i)).append("'");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
.table-hover > tbody > tr:hover {
|
.table-hover > tbody > tr:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.input-clear-a {
|
.input-clear-a {
|
||||||
|
|
||||||
color: white;
|
color: white;
|
||||||
@ -98,8 +99,8 @@
|
|||||||
let text = "您确定要删除此 证书 信息?";
|
let text = "您确定要删除此 证书 信息?";
|
||||||
let delUrl = ext.contextPath + '/safety/externalCertificate/delete.do';
|
let delUrl = ext.contextPath + '/safety/externalCertificate/delete.do';
|
||||||
|
|
||||||
if(!id){
|
if (!id) {
|
||||||
id =staffId;//外部员工ID
|
id = staffId;//外部员工ID
|
||||||
text = "您确定要删除此 人员 信息?"
|
text = "您确定要删除此 人员 信息?"
|
||||||
delUrl = ext.contextPath + '/safety/externalStaff/delete.do';
|
delUrl = ext.contextPath + '/safety/externalStaff/delete.do';
|
||||||
}
|
}
|
||||||
@ -143,11 +144,15 @@
|
|||||||
}
|
}
|
||||||
var deletesFun = function () {
|
var deletesFun = function () {
|
||||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||||
var datas = "";
|
var ids = [];
|
||||||
|
var staffIds = [];
|
||||||
$.each(checkedItems, function (index, item) {
|
$.each(checkedItems, function (index, item) {
|
||||||
datas += item.id + ",";
|
if (item.id) {
|
||||||
|
ids.push(item.id);
|
||||||
|
staffIds.push(item.staffId || "");
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (datas == "") {
|
if (ids.length === 0 && staffIds.length === 0) {
|
||||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||||
} else {
|
} else {
|
||||||
swal({
|
swal({
|
||||||
@ -171,7 +176,10 @@
|
|||||||
}
|
}
|
||||||
}).then(function (willDelete) {
|
}).then(function (willDelete) {
|
||||||
if (willDelete) {
|
if (willDelete) {
|
||||||
$.post(ext.contextPath + '/safety/externalCertificate/deletes.do', {ids: datas}, function (data) {
|
$.post(ext.contextPath + '/safety/externalCertificate/deletes.do', {
|
||||||
|
ids: ids.join(","),
|
||||||
|
staffIds: staffIds.join(",")
|
||||||
|
}, function (data) {
|
||||||
if (data > 0) {
|
if (data > 0) {
|
||||||
$("#table").bootstrapTable('refresh');
|
$("#table").bootstrapTable('refresh');
|
||||||
// 初始化 作业类型
|
// 初始化 作业类型
|
||||||
@ -204,11 +212,24 @@
|
|||||||
var companyParam = $('#companyParam').val();
|
var companyParam = $('#companyParam').val();
|
||||||
var issueDate = $('#reservationtimeD').val();
|
var issueDate = $('#reservationtimeD').val();
|
||||||
|
|
||||||
window.open(ext.contextPath + "/safety/externalCertificate/exportExcel.do?search_name=" + search_name
|
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||||
+ "&search_code=" + search_code
|
var ids = [];
|
||||||
+ "&jobType=" + jobType
|
var staffIds = [];
|
||||||
+ "&issueDate=" + issueDate
|
$.each(checkedItems, function (index, item) {
|
||||||
+ "&companyParam=" + companyParam
|
if (item.id) {
|
||||||
|
ids.push(item.id);
|
||||||
|
} else if (item.staffId) {
|
||||||
|
staffIds.push(item.staffId);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
window.open(ext.contextPath + "/safety/externalCertificate/exportExcel.do?search_name=" + encodeURIComponent(search_name || "")
|
||||||
|
+ "&search_code=" + encodeURIComponent(search_code || "")
|
||||||
|
+ "&jobType=" + encodeURIComponent(jobType || "")
|
||||||
|
+ "&issueDate=" + encodeURIComponent(issueDate || "")
|
||||||
|
+ "&companyParam=" + encodeURIComponent(companyParam || "")
|
||||||
|
+ "&ids=" + encodeURIComponent(ids.join(","))
|
||||||
|
+ "&staffIds=" + encodeURIComponent(staffIds.join(","))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,6 +255,7 @@
|
|||||||
// 初始化 表格数据
|
// 初始化 表格数据
|
||||||
initFun();
|
initFun();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 时间筛选
|
// 时间筛选
|
||||||
function initDate1() {
|
function initDate1() {
|
||||||
var locale = {
|
var locale = {
|
||||||
@ -288,6 +310,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//作业类型下拉数据
|
//作业类型下拉数据
|
||||||
function jobTypePulldown() {
|
function jobTypePulldown() {
|
||||||
//选择 从事岗位
|
//选择 从事岗位
|
||||||
@ -316,8 +339,9 @@
|
|||||||
});
|
});
|
||||||
}, 'json');
|
}, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
//施工单位下拉数据
|
//施工单位下拉数据
|
||||||
function companyPulldown(){
|
function companyPulldown() {
|
||||||
$.post(ext.contextPath + "/safety/externalStaff/companyPulldown.do", {}, function (data) {
|
$.post(ext.contextPath + "/safety/externalStaff/companyPulldown.do", {}, function (data) {
|
||||||
$("#companyParam").empty();
|
$("#companyParam").empty();
|
||||||
var selelct_ = $("#companyParam").select2({
|
var selelct_ = $("#companyParam").select2({
|
||||||
@ -343,6 +367,7 @@
|
|||||||
});
|
});
|
||||||
}, 'json');
|
}, 'json');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 初始表格
|
// 初始表格
|
||||||
var nowDate = new Date();
|
var nowDate = new Date();
|
||||||
var initFun = function () {
|
var initFun = function () {
|
||||||
@ -391,17 +416,17 @@
|
|||||||
field: 'company', // 返回json数据中的name
|
field: 'company', // 返回json数据中的name
|
||||||
title: '施工单位名称', // 表格表头显示文字
|
title: '施工单位名称', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'certificateName', // 返回json数据中的name
|
field: 'certificateName', // 返回json数据中的name
|
||||||
title: '证书名称', // 表格表头显示文字
|
title: '证书名称', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'certificateNo', // 返回json数据中的name
|
field: 'certificateNo', // 返回json数据中的name
|
||||||
title: '证书编号', // 表格表头显示文字
|
title: '证书编号', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'jobCode', // 返回json数据中的name
|
field: 'jobCode', // 返回json数据中的name
|
||||||
title: '作业项目代码', // 表格表头显示文字
|
title: '作业项目代码', // 表格表头显示文字
|
||||||
@ -411,39 +436,49 @@
|
|||||||
field: 'jobType', // 返回json数据中的name
|
field: 'jobType', // 返回json数据中的name
|
||||||
title: '作业类型', // 表格表头显示文字
|
title: '作业类型', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
},{
|
}, {
|
||||||
field: 'issuingAuthority', // 返回json数据中的name
|
field: 'issuingAuthority', // 返回json数据中的name
|
||||||
title: '发证部门', // 表格表头显示文字
|
title: '发证部门', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'issueDate', // 返回json数据中的name
|
field: 'issueDate', // 返回json数据中的name
|
||||||
title: '领证时间', // 表格表头显示文字
|
title: '领证时间', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'expirationDate', // 返回json数据中的name
|
field: 'expirationDate', // 返回json数据中的name
|
||||||
title: '有效期至', // 表格表头显示文字
|
title: '有效期至', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle', // 上下居中
|
||||||
cellStyle:function(value,row,index){// 修改列(单元格)的颜色
|
cellStyle: function (value, row, index) {// 修改列(单元格)的颜色
|
||||||
if(value){
|
if (value) {
|
||||||
var stime = Date.parse(nowDate);
|
var stime = Date.parse(nowDate);
|
||||||
var etime = Date.parse(new Date(value));
|
var etime = Date.parse(new Date(value));
|
||||||
// 两个时间戳相差的毫秒数
|
// 两个时间戳相差的毫秒数
|
||||||
var usedTime = etime - stime;
|
var usedTime = etime - stime;
|
||||||
if(usedTime > 0){
|
if (usedTime > 0) {
|
||||||
// 计算相差的天数
|
// 计算相差的天数
|
||||||
var days = Math.floor(usedTime / (24 * 3600 * 1000));
|
var days = Math.floor(usedTime / (24 * 3600 * 1000));
|
||||||
if(days <= 30){
|
if (days <= 30) {
|
||||||
return {css:{"background-color":"rgba(220,29,54,1)","color":"rgba(255,255,255,1)"}};
|
return {
|
||||||
|
css: {
|
||||||
|
"background-color": "rgba(220,29,54,1)",
|
||||||
|
"color": "rgba(255,255,255,1)"
|
||||||
}
|
}
|
||||||
}else{
|
};
|
||||||
return {css:{"background-color":"rgba(220,29,54,1)","color":"rgba(255,255,255,1)"}};
|
}
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
css: {
|
||||||
|
"background-color": "rgba(220,29,54,1)",
|
||||||
|
"color": "rgba(255,255,255,1)"
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {css:{}};
|
return {css: {}};
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: "操作",
|
title: "操作",
|
||||||
@ -454,7 +489,7 @@
|
|||||||
var buts = '';
|
var buts = '';
|
||||||
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
buts += '<button class="btn btn-default btn-sm" title="编辑" onclick="editFun(\'' + row.id + '\')"><i class="fa fa-edit"></i><span class="hidden-md hidden-lg"> 编辑</span></button>';
|
||||||
|
|
||||||
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\',\''+row.staffId+'\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
|
buts += '<button class="btn btn-default btn-sm" title="删除" onclick="deleteFun(\'' + row.id + '\',\'' + row.staffId + '\')"><i class="fa fa fa-trash-o"></i><span class="hidden-md hidden-lg">删除</span></button>';
|
||||||
|
|
||||||
buts += '<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.fileId + '\')"><i class="fa fa-paperclip"></i><span class="hidden-md hidden-lg">下载</span></button>';
|
buts += '<button class="btn btn-default btn-sm" title="下载" onclick="fileDownload(\'' + row.fileId + '\')"><i class="fa fa-paperclip"></i><span class="hidden-md hidden-lg">下载</span></button>';
|
||||||
// buts += '<button class="btn btn-default btn-sm" title="查看详情" onclick="viewFun(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg">查看详情</span></button>';
|
// buts += '<button class="btn btn-default btn-sm" title="查看详情" onclick="viewFun(\'' + row.id + '\')"><i class="fa fa-eye"></i><span class="hidden-md hidden-lg">查看详情</span></button>';
|
||||||
@ -500,14 +535,14 @@
|
|||||||
* @param colspan 合并列
|
* @param colspan 合并列
|
||||||
* @param target 目标表格对象
|
* @param target 目标表格对象
|
||||||
*/
|
*/
|
||||||
function mergeCells(data,fieldName,colspan,target){
|
function mergeCells(data, fieldName, colspan, target) {
|
||||||
//声明一个map计算相同属性值在data对象出现的次数和
|
//声明一个map计算相同属性值在data对象出现的次数和
|
||||||
var sortMap = {};
|
var sortMap = {};
|
||||||
for(var i = 0 ; i < data.length ; i++){
|
for (var i = 0; i < data.length; i++) {
|
||||||
for(var prop in data[i]){
|
for (var prop in data[i]) {
|
||||||
if(prop == fieldName){
|
if (prop == fieldName) {
|
||||||
var key = data[i][prop]
|
var key = data[i][prop]
|
||||||
if(sortMap.hasOwnProperty(key)){
|
if (sortMap.hasOwnProperty(key)) {
|
||||||
sortMap[key] = sortMap[key] * 1 + 1;
|
sortMap[key] = sortMap[key] * 1 + 1;
|
||||||
} else {
|
} else {
|
||||||
sortMap[key] = 1;
|
sortMap[key] = 1;
|
||||||
@ -516,17 +551,28 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(var prop in sortMap){
|
for (var prop in sortMap) {
|
||||||
// console.log(prop,sortMap[prop])
|
// console.log(prop,sortMap[prop])
|
||||||
}
|
}
|
||||||
var index = 0;
|
var index = 0;
|
||||||
for(var prop in sortMap){
|
for (var prop in sortMap) {
|
||||||
var count = sortMap[prop] * 1;
|
var count = sortMap[prop] * 1;
|
||||||
$(target).bootstrapTable('mergeCells',{index:index, field:fieldName, colspan: colspan, rowspan: count});
|
$(target).bootstrapTable('mergeCells', {
|
||||||
$(target).bootstrapTable('mergeCells',{index:index, field:'company', colspan: colspan, rowspan: count});
|
index: index,
|
||||||
|
field: fieldName,
|
||||||
|
colspan: colspan,
|
||||||
|
rowspan: count
|
||||||
|
});
|
||||||
|
$(target).bootstrapTable('mergeCells', {
|
||||||
|
index: index,
|
||||||
|
field: 'company',
|
||||||
|
colspan: colspan,
|
||||||
|
rowspan: count
|
||||||
|
});
|
||||||
index += count;
|
index += count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var timedel = function () {
|
var timedel = function () {
|
||||||
$('#reservationtimeD').val('');
|
$('#reservationtimeD').val('');
|
||||||
timeRangeEnd = null;
|
timeRangeEnd = null;
|
||||||
@ -554,10 +600,12 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="form-group" style="padding:0;">
|
<div class="form-group" style="padding:0;">
|
||||||
<div class="btn-group" style="width: 300px;padding-bottom:10px;">
|
<div class="btn-group" style="width: 300px;padding-bottom:10px;">
|
||||||
<button type="button" class="btn btn-default btn-sm" onclick="addFun();" style="margin-right: 15px"><i
|
<button type="button" class="btn btn-default btn-sm" onclick="addFun();"
|
||||||
|
style="margin-right: 15px"><i
|
||||||
class="fa fa-plus"></i> 新增
|
class="fa fa-plus"></i> 新增
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();" style="margin-right: 15px"><i
|
<button type="button" class="btn btn-default btn-sm" onclick="deletesFun();"
|
||||||
|
style="margin-right: 15px"><i
|
||||||
class="fa fa-trash-o"></i> 删除
|
class="fa fa-trash-o"></i> 删除
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-default btn-sm" style="margin-right: 15px"
|
<button type="button" class="btn btn-default btn-sm" style="margin-right: 15px"
|
||||||
@ -575,12 +623,14 @@
|
|||||||
<div class="form-group pull-right form-inline">
|
<div class="form-group pull-right form-inline">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">施工单位名称:</label>
|
<label class="form-label">施工单位名称:</label>
|
||||||
<select class="form-control select2" id="companyParam" name="companyParam" style="width: 180px;">
|
<select class="form-control select2" id="companyParam" name="companyParam"
|
||||||
|
style="width: 180px;">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label">作业类型:</label>
|
<label class="form-label">作业类型:</label>
|
||||||
<select class="form-control select2" id="jobTypeParam" name="jobTypeParam" style="width: 180px;">
|
<select class="form-control select2" id="jobTypeParam" name="jobTypeParam"
|
||||||
|
style="width: 180px;">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="input-group input-group-sm" style="width: 200px;">
|
<div class="input-group input-group-sm" style="width: 200px;">
|
||||||
|
|||||||
@ -129,11 +129,17 @@
|
|||||||
};
|
};
|
||||||
var deletesFun = function () {
|
var deletesFun = function () {
|
||||||
var checkedItems = $("#table").bootstrapTable('getSelections');
|
var checkedItems = $("#table").bootstrapTable('getSelections');
|
||||||
var datas = "";
|
var ids = [];
|
||||||
|
var staffIds = [];
|
||||||
$.each(checkedItems, function (index, item) {
|
$.each(checkedItems, function (index, item) {
|
||||||
datas += item.id + ",";
|
if (item.id) {
|
||||||
|
ids.push(item.id);
|
||||||
|
} else if (item.staffId) {
|
||||||
|
// 兼容模式:若后续行模型提供备用ID,批删也可工作
|
||||||
|
staffIds.push(item.staffId);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
if (datas == "") {
|
if (ids.length === 0 && staffIds.length === 0) {
|
||||||
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
showAlert('d', '请先选择记录', 'mainAlertdiv');
|
||||||
} else {
|
} else {
|
||||||
swal({
|
swal({
|
||||||
@ -157,7 +163,10 @@
|
|||||||
}
|
}
|
||||||
}).then(function (willDelete) {
|
}).then(function (willDelete) {
|
||||||
if (willDelete) {
|
if (willDelete) {
|
||||||
$.post(ext.contextPath + '/safety/internalCertificate/deletes.do', {ids: datas}, function (data) {
|
$.post(ext.contextPath + '/safety/internalCertificate/deletes.do', {
|
||||||
|
ids: ids.join(","),
|
||||||
|
staffIds: staffIds.join(",")
|
||||||
|
}, function (data) {
|
||||||
if (data > 0) {
|
if (data > 0) {
|
||||||
$("#table").bootstrapTable('refresh');
|
$("#table").bootstrapTable('refresh');
|
||||||
// 初始化 作业类型
|
// 初始化 作业类型
|
||||||
@ -313,17 +322,17 @@
|
|||||||
field: 'jobType', // 返回json数据中的name
|
field: 'jobType', // 返回json数据中的name
|
||||||
title: '作业类型', // 表格表头显示文字
|
title: '作业类型', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'issuingAuthority', // 返回json数据中的name
|
field: 'issuingAuthority', // 返回json数据中的name
|
||||||
title: '发证机构', // 表格表头显示文字
|
title: '发证机构', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'issueDate', // 返回json数据中的name
|
field: 'issueDate', // 返回json数据中的name
|
||||||
title: '领证时间', // 表格表头显示文字
|
title: '领证时间', // 表格表头显示文字
|
||||||
align: 'center', // 左右居中
|
align: 'center', // 左右居中
|
||||||
valign: 'middle', // 上下居中
|
valign: 'middle' // 上下居中
|
||||||
}, {
|
}, {
|
||||||
field: 'expirationDate', // 返回json数据中的name
|
field: 'expirationDate', // 返回json数据中的name
|
||||||
title: '有效期至', // 表格表头显示文字
|
title: '有效期至', // 表格表头显示文字
|
||||||
|
|||||||
Reference in New Issue
Block a user