Files
SIPAIIS_WMS_JSSW/WebRoot/jsp/equipment/placeClassComPanyEquipmentCardImport.jsp
2026-01-16 14:13:44 +08:00

649 lines
28 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.sipai.tools.CommUtil"%>
<%request.setAttribute("nowDate", CommUtil.nowDate().replaceAll("[[\\s-:punct:]]","")); %>
<style type="text/css">
.select2-container .select2-selection--single{
height:34px;
line-height: 34px;
}
.select2-selection__arrow{
margin-top:3px;
}
</style>
<script type="text/javascript">
var control;
var control2;
function initUpload(ctrlName, uploadUrl) {
control = $('#' + ctrlName);
control.fileinput({
language: 'zh', //设置语言
uploadUrl: uploadUrl, //上传的地址
uploadAsync: true, //默认异步上传
showCaption: true,//是否显示标题
showUpload: false, //是否显示上传按钮
browseClass: "btn btn-primary", //按钮样式
allowedFileExtensions: ["xls", "xlsx"], //接收的文件后缀
maxFileCount: 1,//最大上传文件数限制
previewFileIcon: '<i class="glyphicon glyphicon-file"></i>',
showPreview: false, //是否显示预览
previewFileIconSettings: {
'docx': '<i ass="fa fa-file-word-o text-primary"></i>',
'xlsx': '<i class="fa fa-file-excel-o text-success"></i>',
'xls': '<i class="fa fa-file-excel-o text-success"></i>',
'pptx': '<i class="fa fa-file-powerpoint-o text-danger"></i>',
'jpg': '<i class="fa fa-file-photo-o text-warning"></i>',
'pdf': '<i class="fa fa-file-archive-o text-muted"></i>',
'zip': '<i class="fa fa-file-archive-o text-muted"></i>',
},
//参数
uploadExtraData: function () {
var data = {
//"companyId": '${param.companyId}', //此处自定义传参
'equipmentBelongId' :$("#equipmentBelongId").val(),
};
return data;
}
});
control.on("fileuploaded", function (event, data, previewId, index) {
// console.log(data);
if(data.response.status == true){
closeModal('subModal');
$("#table").bootstrapTable('refresh');
showAlert('s',data.response.msg,'mainAlertdiv');
}else{
showAlert('d',data.response.msg);
}
});
}
$(function(){
$("#btn_save1").hide();
var oTableInit = new Object();
var oInit = new Object();
var jsliat;
importdata();
initUpload("filelist", ext.contextPath+ "/finance/placeClass/saveComPanyExcelData.do");
});
function importdata(){
control2 = $('#' + "filelistcheck");
control2.fileinput({
language: 'zh', //设置语言
uploadUrl: ext.contextPath+ "/finance/placeClass/checkComPanyExcelData.do", //上传的地址
uploadAsync: true, //默认异步上传
showCaption: true,//是否显示标题
showUpload: false, //是否显示上传按钮
browseClass: "btn btn-primary", //按钮样式
allowedFileExtensions: ["xls", "xlsx"], //接收的文件后缀
maxFileCount: 1,//最大上传文件数限制
previewFileIcon: '<i class="glyphicon glyphicon-file"></i>',
showPreview: false, //是否显示预览
previewFileIconSettings: {
'docx': '<i ass="fa fa-file-word-o text-primary"></i>',
'xlsx': '<i class="fa fa-file-excel-o text-success"></i>',
'xls': '<i class="fa fa-file-excel-o text-success"></i>',
'pptx': '<i class="fa fa-file-powerpoint-o text-danger"></i>',
'jpg': '<i class="fa fa-file-photo-o text-warning"></i>',
'pdf': '<i class="fa fa-file-archive-o text-muted"></i>',
'zip': '<i class="fa fa-file-archive-o text-muted"></i>',
},
//参数
uploadExtraData: function () {
var data = {
//"companyId": '${param.companyId}', //此处自定义传参
'equipmentBelongId' :$("#equipmentBelongId").val(),
};
return data;
}
});
control2.on("fileuploaded", function (event, data, previewId, index) {
// console.log(data);
//$("#jsonList").val(data.response.jsonList);
jsliat = JSON.stringify(data.response.jsonList);
//console.log(jsliat);
$table = $("#tableinput").bootstrapTable({ // 对应table标签的id
// url: ext.contextPath + '/equipment/getList.do', // 获取表格数据的url
height:430,
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
clickToSelect:true,
// responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 50, 200], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
showColumns:true,
data:data.response.rows,
sidePagination: 'server', // 设置为服务器端分页
queryParams: queryParamsFun,
sortName: 'equipmentCardID', // 要排序的字段
sortOrder: 'asc', // 排序规则
//导出配置使用需要单独引用js
//是否显示导出按钮
showExport: true,
//导出表格方式默认basic只导出当前页的表格数据all导出所有数据selected导出选中的数据
exportDataType: "all",
//导出文件类型
exportTypes: ['excel'],
exportOptions:{
worksheetName: '设备信息', //表格工作区名称
fileName: '导出设备信息'
},
onClickRow: function (row) {//单击行事件,执行查看功能
viewFun(row.id);
},
//rowStyle: function (row, index) {
// if(row.equipmentCard==null){
// return {css:{"display":"none"}}
// }else{
// return {css:{}}
// }
// } ,
columns: [
{
field: 'equipmentCard', // 返回json数据中的name
title: '标识', // 表格表头显示文字,
align: 'center', // 左右居中
width:'80px',
valign: 'middle',
formatter: function (value, row, index) {
if (value == null) {
return "更新前";
} else {
return "更新后";
}
},
},
{
field: 'equipmentcardid', // 返回json数据中的name
title: '设备编号', // 表格表头显示文字
align: 'center', // 左右居中
width:'150px',
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentcardid + "'>" + row.equipmentcardid + "</span>";
},
class: 'colStyle'
}, {
field: 'equipmentname', // 返回json数据中的name
title: '设备名称', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentname + "'>" + row.equipmentname + "</span>";
},
class: 'colStyle'
},
{
field: 'code', // 返回json数据中的name
title: '部门代码', // 表格表头显示文字
align: 'center', // 左右居中
width:'150px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.code){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
},
{
field: 'areaid', // 返回json数据中的name
title: '存放地点', // 表格表头显示文字
align: 'center', // 左右居中
width:'150px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.areaid){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
},{
field: 'addWay', // 返回json数据中的name
title: '增加方式', // 表格表头显示文字
align: 'center', // 左右居中
width:'150px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.addWay){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
}, {
field: 'assetnumber', // 返回json数据中的name
title: '资产编号', // 表格表头显示文字
width:'100px',
align: 'center', // 左右居中
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.assetnumber){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
}, {
field: 'inStockTime', // 返回json数据中的name
title: '入库时间', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle'
}, {
field: 'equipmentvalue', // 返回json数据中的name
title: '账面原值/元', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle' ,
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.equipmentvalue){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
}, {
field: 'equipWorth', // 返回json数据中的name
title: '账面净值/元', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle'
}, {
field: 'depreciationLife', // 返回json数据中的name
title: '折旧年限/年', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle' // 上下居中
}, {
field: 'equipmentCardProp.residualValueRate', // 返回json数据中的name
title: '残值率', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.equipmentCardProp.residualValueRate){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
}, {
field: 'equipmentCardProp.netSalvageValue', // 返回json数据中的name
title: '净残值', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.equipmentCardProp.netSalvageValue){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
}, {
field: 'equipmentCardProp.totalDepreciation', // 返回json数据中的name
title: '累计折旧', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.equipmentCardProp.totalDepreciation){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
},{
field: 'equipmentCardProp.serviceLife', // 返回json数据中的name
title: '使用年限/年', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle' // 上下居中
}, {
field: 'equipmentCardProp.installDate', // 返回json数据中的name
title: '安装日期', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle'
},{
field: 'equipmentmanufacturer', // 返回json数据中的name
title: '制造厂商', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.equipmentmanufacturer){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
},{
field: 'buytime', // 返回json数据中的name
title: '采购日期', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.buytime){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
},{
field: 'equipmentCardProp.BookkeepVoucher', // 返回json数据中的name
title: '原始凭证号', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.equipmentCardProp.BookkeepVoucher){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
},{
field: 'equipmentCardProp.instantFlow', // 返回json数据中的name
title: '效率值', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle' // 上下居中
},{
field: 'equipmentCardProp.estimatedLife', // 返回json数据中的name
title: '预计使用时间/年', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle',
cellStyle:function(value,row,index){
if (row.equipmentCard!=null&&value!=row.equipmentCard.equipmentCardProp.estimatedLife){
return {css:{"background-color":"yellow"}}
}else{
return {css:{}}
}
}
}, {
field: 'equipmentCardProp.cardTypeId', // 返回json数据中的name
title: '项目类别编号', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
valign: 'middle'
}
],
// onExpandRow: function(index, row, $detail) {
// oTableInit.InitSubTable(index, row, $detail);
// },
onLoadSuccess: function () { //加载成功时执行
adjustBootstrapTableView("tableinput");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
console.log(data.response.rows);
console.log(data.response.jsonList2);
$table2 = $("#tableinput2").bootstrapTable({
height:430,
// 对应table标签的id
// url: ext.contextPath + '/equipment/getList.do', // 获取表格数据的url
//cache: false, // 设置为 false 禁用 AJAX 数据缓存, 默认为true
clickToSelect:true,
// responseHandler:responseHandler, //在渲染页面数据之前执行的方法,此配置很重要!!!!!!!
striped: true, //表格显示条纹默认为false
pagination: true, // 在表格底部显示分页组件默认false
pageList: [10, 50, 200], // 设置页面可以显示的数据条数
pageSize: 10, // 页面数据条数
pageNumber: 1, // 首页页码
data:data.response.jsonList2,
//导出配置使用需要单独引用js
//是否显示导出按钮
showExport: true,
//导出表格方式默认basic只导出当前页的表格数据all导出所有数据selected导出选中的数据
exportDataType: "all",
//导出文件类型
exportTypes: ['excel'],
exportOptions:{
worksheetName: '设备对比信息', //表格工作区名称
fileName: '导出设备对比信息'
},
onClickRow: function (row) {//单击行事件,执行查看功能
viewFun(row.id);
},
columns: [
[
{
field: 'equipmentcardid', // 返回json数据中的name
title: '设备编号', // 表格表头显示文字
align: 'center', // 左右居中
width:'150px',
rowspan: 2,
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentcardid + "'>" + row.equipmentcardid + "</span>";
},
class: 'colStyle'
}, {
field: 'equipmentname', // 返回json数据中的name
title: '设备名称', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
rowspan: 2,
valign: 'middle', // 上下居中
formatter: function (value, row, index) {
return "<span style='display: block;overflow: hidden;text-overflow: ellipsis;white-space: nowrap;' title='" + row.equipmentname + "'>" + row.equipmentname + "</span>";
},
class: 'colStyle'
},{
title: '账面结存',
field: '',
align: 'center',
valign: 'middle',
width:'100px',
colspan: 2,
rowspan: 1
}, {
title: '设备系统结存',
field: '',
align: 'center',
valign: 'middle',
width:'100px',
colspan: 3,
rowsapn: 1
},{
field: 'equipmentCardProp.cardTypeId', // 返回json数据中的name
title: '其他差异', // 表格表头显示文字
align: 'center', // 左右居中
width:'100px',
rowspan: 2,
valign: 'middle'
}],
[{
title: '数额',
field: '_equipmentnumber1',
align: 'center',
valign: 'middle',
rowspan: 1,
}, {
title: '金额',
field: 'equipmentvalue',
align: 'center',
valign: 'middle',
rowsapn: 1
},{
title: '数额',
field: '_useEquipmentAge',
align: 'center',
valign: 'middle',
rowspan: 1,
}, {
title: '金额',
field: '_purchaseValue1',
align: 'center',
valign: 'middle',
rowsapn: 1
}, {
title: '盈亏(+、-)',
field: '',
align: 'center',
valign: 'middle',
rowsapn: 1,
formatter: function (value, row, index) {
// var nub = row.equipmentvalue-row.equipmentCard;
if(row.equipmentvalue!=''&&row.equipmentvalue!=null){
if(row._purchaseValue1!=''&&row._purchaseValue1!=null){
return (row.equipmentvalue*row._equipmentnumber1)-(row._purchaseValue1*row._useEquipmentAge);
}else{
return row.equipmentvalue*row._equipmentnumber1;
}
}else if(row._purchaseValue1!=''&&row._purchaseValue1!=null){
return '-'+row._purchaseValue1*row._useEquipmentAge;
}else{
return 0;
}
},
}]
],
onLoadSuccess: function () { //加载成功时执行
console.info('is323***');
var rowsnub=$table2.bootstrapTable("getOptions").totalRows;
console.info("is323***"+rowsnub);
for(var is =0;is<rowsnub;is=is+2){
console.info("is***"+is);
$table2.bootstrapTable('hideRow', {index:is});
}
adjustBootstrapTableView("tableinput2");
},
onLoadError: function () { //加载失败时执行
console.info("加载数据失败");
}
});
});
}
//导入上传文件的数据
function importExcelFun(){
//console.log($("#filelistcheck")[0].files);
//console.log($("#filelist")[0].files);
if($("#filelist").val() == null || $("#filelist").val()==""){
showAlert('d','上传的文件不能为空!');
}else{
console.log($("#jsonList").val());
console.log($("#filelist")[0].files);
//control.fileinput("upload");
var file = $("#filelistcheck")[0].files;
//var jsonList = $("#jsonList").val();
$.post(ext.contextPath + "/finance/placeClass/updateEquipmentCard.do",{jsonList:jsliat} , function(data) {
if (data.res == 1){
closeModal('subModal');
$("#table").bootstrapTable('refresh');
showAlert('s',data.msg,'mainAlertdiv');
showAlert('s','修改成功');
// initTreeView();
}else if(data.res == 0){
showAlert('d','修改失败');
}else{
showAlert('d',data.msg);
}
},'json');
};
}
function importExcelFun1(){
//console.log($("#filelistcheck").val());
if($("#filelistcheck").val() == null || $("#filelistcheck").val()==""){
showAlert('d','上传的文件不能为空!');
}else{
var filelistcheck = $("#filelistcheck").val();
console.log(filelistcheck);
$("#filelist").val(filelistcheck);
control2.fileinput("upload");
$("#btn_save1").show();
}
}
</script>
<div class="modal fade" id="subModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<input type="hidden" id="jsonList" value="${jsonList}" >
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">导入设备列表</h4>
</div>
<div class="modal-body">
<form id="importFile" name="importFile" class="form-horizontal" method="post"
enctype="multipart/form-data">
<div id="alertDiv"></div>
<div class="box-body">
<div>
<input id="filelist" type="hidden" name="filelist" class="file-loading" type="file" multiple accept=".xls,.xlsx">
</div>
<div>
<input id="filelistcheck" name="filelist" class="file-loading" type="file" multiple accept=".xls,.xlsx">
</div>
</div>
</form>
</div>
<div class="modal-body">
<table id="tableinput"></table>
<table id="tableinput2"></table>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" onclick="importExcelFun1()" id="btn_save">查看导入数据</button>
<button type="button" class="btn btn-primary" type="hidden" onclick="importExcelFun()" id="btn_save1">导入</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>