Compare commits

3 Commits

11 changed files with 361 additions and 147 deletions

View File

@ -104,7 +104,7 @@ public class KpiPlanController {
if (StringUtils.isNotBlank(positonTypeList)) {
wherestr += " and j.level_type = " + positonTypeList;
}
wherestr += "and p.create_user_id ='" + id + "'";
wherestr += " and p.create_user_id ='" + id + "'";
PageHelper.startPage(page, rows);
List<KpiPlan> list = kpiPlanService.selectListByWhere(wherestr + orderstr);
@ -387,7 +387,8 @@ public class KpiPlanController {
@RequestMapping("/export.do")
public void export(HttpServletRequest request, HttpServletResponse response,
@RequestParam(value = "periodTypeName", required = false) String periodTypeList,
@RequestParam(value = "positionType", required = false) String positonTypeList) throws IOException {
@RequestParam(value = "positionType", required = false) String positonTypeList,
@RequestParam(value = "ids", required = false) String ids) throws IOException {
// 摘自列表查询接口 start
User cu = (User) request.getSession().getAttribute("cu");
String id = cu.getId();
@ -399,6 +400,10 @@ public class KpiPlanController {
if (StringUtils.isNotBlank(positonTypeList) && !"null".equals(positonTypeList)) {
wherestr += " and j.level_type = " + positonTypeList;
}
if (StringUtils.isNotBlank(ids)) {
String idstr = ids.replace("'", "").replace(",", "','");
wherestr += " and p.id in ('" + idstr + "')";
}
wherestr += "and p.create_user_id ='" + id + "'";
List<KpiPlan> list = kpiPlanService.selectListByWhere(wherestr + orderstr);

View File

@ -134,6 +134,12 @@ public class SewageController {
public String dosave(HttpServletRequest request,Model model,
@ModelAttribute Sewage sewage) {
User cu = (User) request.getSession().getAttribute("cu");
String contractNumber = sewage.getContractNumber() == null ? null : sewage.getContractNumber().trim();
sewage.setContractNumber(contractNumber);
if (this.sewageService.existsByContractNumber(contractNumber)) {
model.addAttribute("result", "{\"res\":\"合同编号已存在,不可重复\"}");
return "result";
}
sewage.setId(CommUtil.getUUID());
int result = this.sewageService.save(sewage);
String resultstr = "{\"res\":\""+result+"\",\"id\":\""+sewage.getId()+"\"}";
@ -193,6 +199,12 @@ public class SewageController {
public String doupdate(HttpServletRequest request,Model model,
@ModelAttribute Sewage sewage) {
User cu = (User) request.getSession().getAttribute("cu");
String contractNumber = sewage.getContractNumber() == null ? null : sewage.getContractNumber().trim();
sewage.setContractNumber(contractNumber);
if (this.sewageService.existsByContractNumberExcludeId(contractNumber, sewage.getId())) {
model.addAttribute("result", "{\"res\":\"合同编号已存在,不可重复\"}");
return "result";
}
int result = this.sewageService.update(sewage);
String resstr="{\"res\":\""+result+"\",\"id\":\""+sewage.getId()+"\"}";
model.addAttribute("result", resstr);
@ -348,7 +360,8 @@ public class SewageController {
@RequestMapping(value = "downloadExcelFun.do")
public ModelAndView downloadExcelFun(HttpServletRequest request,
HttpServletResponse response, Model model) throws IOException {
this.sewageService.outExcelFun(response);
String ids = request.getParameter("ids");
this.sewageService.outExcelFun(response, ids);
return null;
}

View File

@ -1252,21 +1252,14 @@ public class WorkorderDetailController {
@RequestMapping("/doExportRepair.do")
public ModelAndView doExportRepair(HttpServletRequest request,
HttpServletResponse response, Model model,
@RequestParam(value = "ids") String ids,
@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "type") String type) throws IOException {
if (ids != null && !ids.equals("")) {
String[] id = ids.split(",");
String workorderDetailsIds = "";
for (String s : id) {
workorderDetailsIds += "'" + s + "',";
}
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepair(response, workorderDetails, type);
} catch (Exception e) {
e.printStackTrace();
}
String whereStr = buildExportWhereByIdsAndType(ids, type);
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepair(response, workorderDetails, type);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@ -1292,21 +1285,14 @@ public class WorkorderDetailController {
@RequestMapping("/doExportRepairJS.do")
public ModelAndView doExportRepairJS(HttpServletRequest request,
HttpServletResponse response, Model model,
@RequestParam(value = "ids") String ids,
@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "type") String type) throws IOException {
if (ids != null && !ids.equals("")) {
String[] id = ids.split(",");
String workorderDetailsIds = "";
for (String s : id) {
workorderDetailsIds += "'" + s + "',";
}
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepairJS(response, workorderDetails, type);
} catch (Exception e) {
e.printStackTrace();
}
String whereStr = buildExportWhereByIdsAndType(ids, type);
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportRepairJS(response, workorderDetails, type);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
@ -1332,26 +1318,47 @@ public class WorkorderDetailController {
@RequestMapping("/doExportMain.do")
public ModelAndView doExportMain(HttpServletRequest request,
HttpServletResponse response, Model model,
@RequestParam(value = "ids") String ids,
@RequestParam(value = "ids", required = false) String ids,
@RequestParam(value = "type") String type) throws IOException {
if (ids != null && !ids.equals("")) {
String[] id = ids.split(",");
String workorderDetailsIds = "";
for (String s : id) {
workorderDetailsIds += "'" + s + "',";
}
String whereStr = "where id in (" + workorderDetailsIds.substring(0, workorderDetailsIds.length() - 1) + ")";
// System.out.println(whereStr);
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportMain(response, workorderDetails, type);
} catch (Exception e) {
e.printStackTrace();
}
String whereStr = buildExportWhereByIdsAndType(ids, type);
try {
List<WorkorderDetail> workorderDetails = workorderDetailService.selectListByWhere(whereStr);
this.workorderDetailService.doExportMain(response, workorderDetails, type);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
private String buildExportWhereByIdsAndType(String ids, String type) {
String normalizedIds = normalizeIds(ids);
if (!normalizedIds.isEmpty()) {
String[] idArr = normalizedIds.split(",");
StringBuilder idBuilder = new StringBuilder();
for (String item : idArr) {
String id = item.trim();
if (id.isEmpty()) {
continue;
}
if (idBuilder.length() > 0) {
idBuilder.append(",");
}
idBuilder.append("'").append(id).append("'");
}
if (idBuilder.length() > 0) {
return "where id in (" + idBuilder + ")";
}
}
return "where type = '" + type + "'";
}
private String normalizeIds(String ids) {
if (ids == null || ids.trim().isEmpty()) {
return "";
}
return ids.replace("'", "").replace(" ", "").replaceAll(",+$", "");
}
/**
* 日历中弹出指定日期的 维修单
*

View File

@ -5,6 +5,7 @@ import com.sipai.entity.sparepart.Sewage;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
public class SewageDao extends CommDaoImpl<Sewage> {
@ -16,5 +17,13 @@ public class SewageDao extends CommDaoImpl<Sewage> {
List<Sewage> list = getSqlSession().selectList(this.getMappernamespace()+"."+Thread.currentThread().getStackTrace()[1].getMethodName(), sewage);
return list;
}
public Integer selectCountByContractNumber(String contractNumber) {
return getSqlSession().selectOne(this.getMappernamespace() + "." + Thread.currentThread().getStackTrace()[1].getMethodName(), contractNumber);
}
public Integer selectCountByContractNumberExcludeId(Map<String, String> params) {
return getSqlSession().selectOne(this.getMappernamespace() + "." + Thread.currentThread().getStackTrace()[1].getMethodName(), params);
}
}

View File

@ -312,6 +312,17 @@
delete from TB_Sewage_Source
${where}
</delete>
<select id="selectCountByContractNumber" resultType="java.lang.Integer" parameterType="java.lang.String" >
select count(1)
from TB_Sewage_Source
where contract_number = #{contractNumber,jdbcType=VARCHAR}
</select>
<select id="selectCountByContractNumberExcludeId" resultType="java.lang.Integer" parameterType="java.util.Map" >
select count(1)
from TB_Sewage_Source
where contract_number = #{contractNumber,jdbcType=VARCHAR}
and id != #{id,jdbcType=VARCHAR}
</select>
<select id="selectDistinctCityByWhere" resultMap="BaseResultMap" parameterType="java.lang.String" >
select Distinct [city] as [city]
from TB_Sewage_Source

View File

@ -26,8 +26,11 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.apache.poi.ss.usermodel.CellType.STRING;
@ -142,6 +145,28 @@ public class SewageService implements CommService<Sewage> {
return list;
}
public boolean existsByContractNumber(String contractNumber) {
if (contractNumber == null || contractNumber.trim().isEmpty()) {
return false;
}
Integer count = SewageDao.selectCountByContractNumber(contractNumber.trim());
return count != null && count > 0;
}
public boolean existsByContractNumberExcludeId(String contractNumber, String id) {
if (contractNumber == null || contractNumber.trim().isEmpty()) {
return false;
}
if (id == null || id.trim().isEmpty()) {
return existsByContractNumber(contractNumber);
}
Map<String, String> params = new HashMap<String, String>();
params.put("contractNumber", contractNumber.trim());
params.put("id", id.trim());
Integer count = SewageDao.selectCountByContractNumberExcludeId(params);
return count != null && count > 0;
}
/**
* xls文件数据转换
*
@ -298,6 +323,10 @@ public class SewageService implements CommService<Sewage> {
}
public void outExcelFun(HttpServletResponse response) throws IOException {
outExcelFun(response, null);
}
public void outExcelFun(HttpServletResponse response, String ids) throws IOException {
String fileName = "金山卫污水厂纳管企业表.xls";
String title = "纳管企业";
// 声明一个工作薄
@ -428,7 +457,7 @@ public class SewageService implements CommService<Sewage> {
// smcell.setCellStyle(tipStyle);
// smcell.setCellValue("注:日期格式(xxxx-xx-xx或xxxx/xx/xx), 班组类型,班组, 班次(根据系统配置名称填写),模式(填写巡检菜单里面的巡检模式) 排版日期,班组类型,班组,班次,模式都为必填项(集控班组可不填模式)。");
List<Sewage> list = this.selectListByWhere("where 1=1 order by contract_order asc");
List<Sewage> list = this.selectListByWhere(buildExportWhere(ids));
int n = 1;
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
@ -577,6 +606,29 @@ public class SewageService implements CommService<Sewage> {
}
}
private String buildExportWhere(String ids) {
String orderBy = " order by contract_order asc";
if (ids == null || ids.trim().isEmpty()) {
return "where 1=1" + orderBy;
}
String[] arr = ids.split(",");
List<String> idList = new ArrayList<String>();
for (String item : arr) {
if (item == null) {
continue;
}
String id = item.trim();
if (!id.isEmpty() && id.matches("[A-Za-z0-9-]+")) {
idList.add("'" + id + "'");
}
}
if (idList.isEmpty()) {
return "where 1=1" + orderBy;
}
String idstr = String.join(",", idList);
return "where id in (" + idstr + ")" + orderBy;
}
/**
* 获取树三层结构processSection为根节点sewage为子节点
*

View File

@ -296,7 +296,17 @@
function exportExcel() {
var periodTypeName = $('#periodTypeList').val();
var positionType = $('#positionTypeList').val();
window.open(ext.contextPath + "/kpi/kpiPlan/export.do?periodTypeName=" + periodTypeName + "&positionType=" + positionType);
let checkedItems = $("#table").bootstrapTable('getSelections');
let ids = "";
$.each(checkedItems, function (index, item) {
ids += item.id + ",";
});
if (ids !== "") {
ids = ids.substring(0, ids.length - 1);
window.open(ext.contextPath + "/kpi/kpiPlan/export.do?periodTypeName=" + periodTypeName + "&positionType=" + positionType + "&ids=" + encodeURIComponent(ids));
} else {
window.open(ext.contextPath + "/kpi/kpiPlan/export.do?periodTypeName=" + periodTypeName + "&positionType=" + positionType);
}
}
</script>

View File

@ -636,45 +636,77 @@
var enterpriseTotal = 0;
var enterpriseOnline = 0;
var enterpriseList = [];
var enterprisePageSize = 20; // 每页20条
var enterpriseCurrentPage = 1; // 当前页码
// 加载企业数据
// 加载企业数据(分页)
function loadEnterpriseData() {
loadEnterpriseList(enterpriseCurrentPage);
}
// 加载企业列表(分页)
function loadEnterpriseList(page) {
enterpriseCurrentPage = page;
$.ajax({
type: 'POST',
url: ext.contextPath + '/sparepart/sewage/getList.do',
data: {
page: 1,
rows: 1000,
page: page,
rows: enterprisePageSize,
sort: "displacement",
order: "asc",
unitId: defaultUnitId,
},
// async: true,
// dataType: 'json',
// globle: false,
async: true,
globle: false,
error: function () {
// loadEnterpriseDataMock();
return false;
},
success: function (data) {
if (typeof data === "string") {
var dataList = JSON.parse(data);
if (dataList && dataList.rows) {
var list = dataList.rows || [];
enterpriseTotal = dataList.total;
enterpriseOnline = list.filter(function(item) {
return item._input;
}).length;
enterpriseList = list;
renderEnterpriseStats();
renderEnterpriseList(list);
} else {
loadEnterpriseDataMock();
if (typeof data === "string") {
var dataList = JSON.parse(data);
if (dataList && dataList.rows) {
var list = dataList.rows || [];
enterpriseTotal = dataList.total;
// 统计在线数量(全部数据,不仅仅是当前页)
enterpriseOnline = list.filter(function(item) {
return item._input;
}).length;
enterpriseList = list;
// 为每个企业查询瞬时流量
var promises = [];
list.forEach(function(item) {
if (item.ventNum) {
var mpointCode = item.ventNum + '_SSLL';
promises.push(
getMpointValueAsync(mpointCode).then(function(value) {
item.flow = value.parmvalue || '0';
})
);
} else {
item.flow = '--';
}
});
// 等待所有瞬时流量查询完成后渲染
Promise.all(promises).then(function() {
renderEnterpriseStats();
renderEnterpriseList(list);
renderEnterprisePagination();
}).catch(function() {
renderEnterpriseStats();
renderEnterpriseList(list);
renderEnterprisePagination();
});
} else {
loadEnterpriseDataMock();
}
}
}
}
});
}
});
}
// Mock企业数据
function loadEnterpriseDataMock() {
@ -700,9 +732,10 @@
$('#enterprise_total').text(enterpriseTotal);
$('#enterprise_online').text(enterpriseOnline);
$('#enterprise_offline').text(enterpriseTotal - enterpriseOnline);
// 计算总流量
// 计算总流量(当前页)
var totalFlow = enterpriseList.reduce(function(sum, item) {
return sum + (item.attributes && item.attributes.flow ? item.attributes.flow : 0);
var flow = item.flow || 0;
return sum + (typeof flow === 'number' ? flow : 0);
}, 0);
$('#enterprise_total_flow').text(formatNumber(totalFlow));
}
@ -713,7 +746,7 @@
list.forEach(function(item) {
var name = item.name || item.text || '--';
var status = item._input ? 'online' : 'offline';
var flow = item.attributes && item.attributes.flow ? item.attributes.flow : 0;
var flow = item.flow || '--';
var statusClass = status === 'online' ? 'online' : 'offline';
var statusText = status === 'online' ? '已接入' : '未接入';
@ -734,9 +767,34 @@
$('#enterprise_list').html(html);
}
// 渲染企业分页控件
function renderEnterprisePagination() {
var totalPages = Math.ceil(enterpriseTotal / enterprisePageSize);
// 更新分页信息
var pageInfo = '第 ' + enterpriseCurrentPage + '/' + totalPages + ' 页,共 ' + enterpriseTotal + ' 条';
$('#enterprise_page_info').text(pageInfo);
// 更新分页按钮
var btnHtml = '';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(1)" ' + (enterpriseCurrentPage === 1 ? 'disabled' : '') + '>首页</button>';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(' + (enterpriseCurrentPage - 1) + ')" ' + (enterpriseCurrentPage === 1 ? 'disabled' : '') + '>上一页</button>';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(' + (enterpriseCurrentPage + 1) + ')" ' + (enterpriseCurrentPage >= totalPages ? 'disabled' : '') + '>下一页</button>';
btnHtml += '<button class="pagination-btn" onclick="enterpriseGoToPage(' + totalPages + ')" ' + (enterpriseCurrentPage >= totalPages ? 'disabled' : '') + '>末页</button>';
$('#enterprise_page_btns').html(btnHtml);
}
// 企业列表分页跳转
function enterpriseGoToPage(page) {
var totalPages = Math.ceil(enterpriseTotal / enterprisePageSize);
if (page < 1) page = 1;
if (page > totalPages) page = totalPages;
loadEnterpriseList(page);
}
// 格式化数字
function formatNumber(num) {
if (num === null || num === undefined) return '--';
if (num === null || num === undefined || num === '--') return '--';
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
}
@ -857,11 +915,12 @@
// }
initProcessListByConfig(code, divid);
// 如果没有告警配置,使用默认数据
var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; });
if (!hasAlarmConfig) {
initAlarmList();
}
// // 如果没有告警配置,使用默认数据
// var hasAlarmConfig = mpcode.some(function(item) { return item.type === 'alarm'; });
// if (!hasAlarmConfig) {
// initAlarmList();
// }
initAlarmListByConfig(code, divid)
}
function initData() {
@ -1110,16 +1169,24 @@
return data;
}
// 根据配置初始化工艺列表 - 调用工艺段接口
// 根据配置初始化工艺列表 - 调用工艺段接口(支持分页)
// /TGLW/user/processSection/getlist.do?rows=50&page=1&order=asc&search_code=0533JS&unitId=0533JS&search_name=&_=1775558221772
var processTotal = 0; // 工艺段总数
function initProcessListByConfig(mpointCode, containerId) {
loadProcessList(processCurrentPage);
}
// 加载工艺列表(分页)
function loadProcessList(page) {
processCurrentPage = page;
$.ajax({
type: 'GET',
url: ext.contextPath + '/user/processSection/getlist.do',
data: {
unitId: defaultUnitId,
rows: 50,
page: 1,
rows: processPageSize,
page: page,
},
async: true,
dataType: 'json',
@ -1131,6 +1198,9 @@
},
success: function (data) {
if (data && data.rows) {
// 更新总数
processTotal = data.total || data.rows.length;
// 将接口返回的工艺段数据转换为表格格式
processData = [];
var rows = data.rows || [];
@ -1153,9 +1223,10 @@
var mpointCodeParam = item.id + '_' + suffix;
promises.push(
getMpointValueAsync(mpointCodeParam).then(function(value) {
if (suffix === '1') processItem.param1 = value;
else if (suffix === '2') processItem.param2 = value;
else if (suffix === '3') processItem.param3 = value;
let values = (value.parmname || '--') + ':' + (value.parmvalue || '--') + (value.unit || '')
if (suffix === '1') processItem.param1 = values;
else if (suffix === '2') processItem.param2 = values;
else if (suffix === '3') processItem.param3 = values;
})
);
});
@ -1164,8 +1235,10 @@
// 等待所有测点值获取完成后渲染表格
Promise.all(promises).then(function() {
renderProcessTable();
renderProcessPagination();
}).catch(function() {
renderProcessTable();
renderProcessPagination();
});
} else {
// processData = generateProcessData();
@ -1190,7 +1263,8 @@
globle: false,
success: function(data) {
if (data && data.parmvalue !== undefined && data.parmvalue !== null) {
resolve(data.parmname + ':' + data.parmvalue + data.unit);
resolve(data);
// resolve(data.parmname + ':' + data.parmvalue + data.unit);
} else {
resolve('--');
}
@ -1226,36 +1300,65 @@
return data;
}
// 根据配置初始化告警列表
// 根据配置初始化告警列表 - 调用告警接口
// 参考 proAlarmList.jsp 的接口调用
function initAlarmListByConfig(mpointCode, containerId) {
// 获取当前时间和7天前时间
var endTime = new Date();
var startTime = new Date(endTime.getTime() - 7 * 24 * 60 * 60 * 1000);
var formatDate = function(date) {
return date.getFullYear() + '-' +
String(date.getMonth() + 1).padStart(2, '0') + '-' +
String(date.getDate()).padStart(2, '0') + ' ' +
String(date.getHours()).padStart(2, '0') + ':' +
String(date.getMinutes()).padStart(2, '0');
};
$.ajax({
type: 'GET',
url: ext.contextPath + '/work/mpoint/getAlarmList.do?unitId=' + unitId + '&mpointCode=' + mpointCode,
type: 'POST',
url: ext.contextPath + '/alarm/proAlarm/getlist.do',
data: {
companyId: defaultUnitId,
search_name: '',
pSectionCode: '',
alarmType: '',
alarmlevel: '',
status: '',
sdt: formatDate(startTime),
edt: formatDate(endTime)
},
async: true,
dataType: 'json',
globle: false,
error: function () {
alarmData = generateAlarmData();
renderAlarmTable();
// alarmData = generateAlarmData();
// renderAlarmTable();
return false;
},
success: function (data) {
if (data != null && data !== '') {
try {
var result = eval('(' + data + ')');
if (result.status === 'pass' && result.alarmList) {
alarmData = result.alarmList;
renderAlarmTable();
} else {
alarmData = generateAlarmData();
renderAlarmTable();
}
} catch (e) {
alarmData = generateAlarmData();
renderAlarmTable();
}
} else {
alarmData = generateAlarmData();
if (data && data.rows && data.rows.length > 0) {
// 将接口返回的告警数据转换为表格格式
alarmData = [];
data.rows.forEach(function(item) {
alarmData.push({
id: item.id,
process: item.pointName || item.processSectionName || '--',
pointCode: item.pointCode || '',
status: item.status || '',
alarmLevel: item.alarmLevel || '',
alarmTime: item.alarmTime || '',
describe: item.describe || '',
alarmTypeName: item.alarmTypeName || '',
confirmerName: item.confirmerName || '',
confirmTime: item.confirmTime || '',
time: item.alarmTime ? item.alarmTime.substring(0, 16) : '--',
bizId: item.bizId || ''
});
});
renderAlarmTable();
} else {
// alarmData = generateAlarmData();
// renderAlarmTable();
}
}
});
@ -1267,14 +1370,11 @@
}
function renderProcessTable() {
var start = (processCurrentPage - 1) * processPageSize;
var end = Math.min(start + processPageSize, processData.length);
var pageData = processData.slice(start, end);
// 服务端分页processData 已经是当前页数据
var html = '';
pageData.forEach(function(process) {
processData.forEach(function(process) {
html += '<tr>';
html += '<td>' + process.name + '</td>';
html += '<td>' + (process.processName || process.name || '--') + '</td>';
html += '<td>' + process.param1 + '</td>';
html += '<td>' + process.param2 + '</td>';
html += '<td>' + process.param3 + '</td>';
@ -1282,26 +1382,30 @@
html += '</tr>';
});
$('#process_table tbody').html(html);
}
// 渲染工艺列表分页控件
function renderProcessPagination() {
var totalPages = Math.ceil(processTotal / processPageSize);
// 更新分页信息
var totalPages = Math.ceil(processData.length / processPageSize);
$('#process_page_info').text('第 ' + processCurrentPage + '/' + totalPages + ' 页,共 ' + processData.length + ' 条');
$('#process_page_info').text('第 ' + processCurrentPage + '/' + totalPages + ' 页,共 ' + processTotal + ' 条');
// 更新分页按钮
var btnHtml = '';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(1)" ' + (processCurrentPage === 1 ? 'disabled' : '') + '>首页</button>';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + (processCurrentPage - 1) + ')" ' + (processCurrentPage === 1 ? 'disabled' : '') + '>上一页</button>';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + (processCurrentPage + 1) + ')" ' + (processCurrentPage === totalPages ? 'disabled' : '') + '>下一页</button>';
// btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + totalPages + ')" ' + (processCurrentPage === totalPages ? 'disabled' : '') + '>末页</button>';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + (processCurrentPage + 1) + ')" ' + (processCurrentPage >= totalPages ? 'disabled' : '') + '>下一页</button>';
btnHtml += '<button class="pagination-btn" onclick="processGoToPage(' + totalPages + ')" ' + (processCurrentPage >= totalPages ? 'disabled' : '') + '>末页</button>';
$('#process_page_btns').html(btnHtml);
}
// 工艺列表分页跳转
function processGoToPage(page) {
var totalPages = Math.ceil(processData.length / processPageSize);
var totalPages = Math.ceil(processTotal / processPageSize);
if (page < 1) page = 1;
if (page > totalPages) page = totalPages;
processCurrentPage = page;
renderProcessTable();
loadProcessList(page);
}
function initAlarmList() {
@ -1653,6 +1757,12 @@
<div class="enterprise-list-wrapper" id="enterprise_list">
<!-- 企业卡片将通过JS动态生成 -->
</div>
<!-- 企业分页 -->
<div class="pagination">
<span class="pagination-info" id="enterprise_page_info"></span>
<div class="pagination-btns" id="enterprise_page_btns"></div>
</div>
</div>
</div>
</div>

View File

@ -400,7 +400,17 @@
//导出
function downloadExcelFun() {
window.open(ext.contextPath + "/sparepart/sewage/downloadExcelFun.do");
var checkedItems = $("#table").bootstrapTable('getSelections');
var ids = "";
$.each(checkedItems, function(index, item){
ids += item.id + ",";
});
if(ids !== ""){
ids = ids.substring(0, ids.length - 1);
window.open(ext.contextPath + "/sparepart/sewage/downloadExcelFun.do?ids=" + encodeURIComponent(ids));
}else{
window.open(ext.contextPath + "/sparepart/sewage/downloadExcelFun.do");
}
}
</script>
</head>

View File

@ -418,17 +418,12 @@
var getExs = function () {
var datas = selectionIds.toString();
if (datas === "") {
showAlert('d', '请选中之后导出', 'mainAlertdiv');
} else {
// window.open(ext.contextPath + "/workorder/workorderDetail/doExportMain.do?ids=" + datas + "&type=maintain");
var params = {
responseType: 'blob',
ids: datas,
type: 'maintain'
};
postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportMain.do');
}
var params = {
responseType: 'blob',
ids: datas,
type: 'maintain'
};
postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportMain.do');
}
function postExcelFile(params, url) { //params是post请求需要的参数url是请求url地址

View File

@ -117,11 +117,7 @@
//金山项目导出(暂时不用)
var getExs_JS = function () {
var datas = selectionIds;
if (datas == 0) {
showAlert('d', '请选中之后导出', 'mainAlertdiv');
} else {
window.open(ext.contextPath + "/workorder/workorderDetail/doExportRepairJS.do?ids=" + datas + "&type=repair");
}
window.open(ext.contextPath + "/workorder/workorderDetail/doExportRepairJS.do?ids=" + datas + "&type=repair");
}
/**
@ -129,16 +125,12 @@
*/
var getExs = function () {
var datas = selectionIds;
if (datas == 0) {
showAlert('d', '请选中之后导出', 'mainAlertdiv');
} else {
var params = {
responseType: 'blob',
ids: datas,
type: 'repair'
};
postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportRepair.do');
}
var params = {
responseType: 'blob',
ids: datas,
type: 'repair'
};
postExcelFile(params, ext.contextPath + '/workorder/workorderDetail/doExportRepair.do');
}
function postExcelFile(params, url) { //params是post请求需要的参数url是请求url地址