万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1263 lines
54 KiB

2 years ago
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('BOM列表')"/>
<script type="text/javascript" th:src="@{/js/axios.min.js}"></script>
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>清单编号:</label>
<input type="text" name="bomCode"/>
</li>
<li>
<label>清单名称:</label>
<input type="text" name="bomName"/>
</li>
<li>
<label>客户代码:</label>
<input type="text" name="enterpriseCode"/>
</li>
<li>
<label>客户料号:</label>
<input type="text" name="customerNumber"/>
</li>
<li>
<label>成品代码:</label>
<!-- <select name="finishProductCode">-->
<!-- <option value="">所有</option>-->
<!-- <option value="-1">代码生成请选择字典属性</option>-->
<!-- </select>-->
<input type="text" name="finishProductCode"/>
</li>
<li>
<label>确认否:</label>
<select name="confirmNo" th:with="type=${@dict.getType('sys_whether')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:bom:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:bom:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="removeBom()"
shiro:hasPermission="system:bom:remove">
<i class="fa fa-remove"></i> 删除
</a>
<!-- <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:bom:export">-->
<!-- <i class="fa fa-download"></i> 导出-->
<!-- </a>-->
2 years ago
<a class="btn btn-warning" onclick="exportBomDetail()" shiro:hasPermission="system:bom:export">
<i class="fa fa-download"></i> 导出
2 years ago
</a>
<a class="btn btn-success" onclick="bomConfirm()" shiro:hasPermission="system:bom:confirm">
2 years ago
<i class="fa fa-hand-grab-o"></i> 确认
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" style="white-space: nowrap"></table>
</div>
</div>
</div>
<!--确认-->
<div class="modal fade" id="confirmModel">
<div class="modal-dialog">
<div class="modal-content message_align">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">×</span></button>
<h4 class="modal-title">确认信息</h4>
</div>
<div class="modal-body" style="height: 180px">
<form id="form-confirm-edit">
<div class="form-group" style="display: none">
<label class="col-sm-3 control-label is-required">Bomid:</label>
<div class="col-sm-8">
<input id="bomId" name="bomId" class="form-control" type="text" required
readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">确认否:</label>
<div class="col-sm-8">
<select id="confirmNo" name="confirmNo" class="form-control" th:with="type=${@dict.getType('sys_whether')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">确认日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input id="confirmTime" name="confirmTime" class="form-control" placeholder="yyyy-mm-dd hh:ii:ss" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">确认人:</label>
<div class="col-sm-8">
<input id="confirmName" name="confirmName" class="form-control" type="text">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" onclick="ConfirmSubmit()" class="btn btn-success" data-dismiss="modal">确定</button>
</div>
</div>
</div>
</div>
<div class="alert alert-success hide">bom清单已确认</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: datetimepicker-js"/>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('system:bom:edit')}]];
var removeFlag = [[${@permission.hasPermi('system:bom:remove')}]];
var currentVersionDatas = [[${@dict.getType('sys_whether')}]];
var confirmNoDatas = [[${@dict.getType('sys_whether')}]];
var prefix = ctx + "system/bom";
$(function () {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
clickToSelect: true,
detailView: true,
modalName: "BOM",
columns: [{
checkbox: true
},
{
field: 'bomId',
title: 'BOMid',
visible: false
},
{
field: 'confirmNo',
title: '确认否',
formatter: function (value, row, index) {
// return $.table.selectDictLabel(confirmNoDatas, value);
var actions = [];
if ($.table.selectDictLabel(confirmNoDatas, value) == "<span class=''></span>") {
actions.push('<a class="btn btn-primary btn-xs disabled">已确认</a> ');
} else {
actions.push('<a class="btn btn-danger btn-xs disabled">未确认</a> ');
}
return actions.join('');
}
},
{
field: 'bomCode',
title: '清单编号'
},
{
field: 'bomName',
title: '清单名称'
},
{
field: 'bomProductionCost',
title: '生产费用'
},
{
field: 'versionNumber',
title: '版本号'
},
{
field: 'bomRemarks',
title: '备注'
},
{
field: 'bomCreator',
title: '创建人'
},
{
field: 'enterpriseName',
title: '客户名称'
},
{
field: 'bomTime',
title: '创建时间'
},
{
field: 'enterpriseCode',
title: '客户代码'
},
{
field: 'customerNumber',
title: '客户料号'
},
{
field: 'finishProductCode',
title: '成品代码'
},
{
field: 'finishProductName',
title: '成品名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'currentVersion',
title: '当前版本',
formatter: function (value, row, index) {
return $.table.selectDictLabel(currentVersionDatas, value);
}
},
{
field: 'confirmName',
title: '确认人'
},
{
field: 'confirmTime',
title: '确认时间'
},
{
field: 'firstAddTime',
title: '录入时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
return value;
}
}
},
{
field: 'updateInfoTime',
title: '上次修改时间',
formatter: function (value, row, index) {
if (value == null) {
return " ";
} else {
var vArr = value.split(',')
return vArr[0];
}
}
}
// {
// title: '操作',
// align: 'center',
// formatter: function (value, row, index) {
// var actions = [];
// actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.bomId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
// actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.bomId + '\')"><i class="fa fa-remove"></i>删除</a>');
// return actions.join('');
// }
// }
],
onExpandRow:function (index,row,$detail) {
// console.log(index)
// console.log(row.finishProductCode)
// console.log($detail)
$detail.html('<table class="table-container" id="raw_table"></table>' +
'<table class="table-container" id="subsidiary_table"></table>'+
'<table class="table-container" id="bcp_table"></table>'
).find('table');
2 years ago
initRawDetail(index,row,$detail);
initSubsidiaryDetail(index,row,$detail);
initBcpDetail(index,row,$detail);
2 years ago
}
};
$.table.init(options);
});
//初始化子表格(循环) 一阶--原料
2 years ago
initRawDetail = function (index, row, $detail) {
var finishProductCode = row.finishProductCode;
var versionNumber = row.versionNumber;
// var raw_table = $detail.html('<table class="table-container" id="raw_table"></table>').find('table');
$("#raw_table").bootstrapTable({
2 years ago
url: ctx + 'system/bomrawmaterial/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: finishProductCode,
versionNumber: versionNumber
2 years ago
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
columns: [
{
field: 'rawMaterialId',
title: '原料id',
visible: false
},
{
field: 'finishProductCode',
title: '成品代码',
visible: false
},
{
field: 'rawMaterialCode',
title: '原料代码'
},
{
field: 'rawMaterialName',
title: '原料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'rawMaterialConsumption',
title: '用量'
},
{
field: 'rawMaterialLoss',
title: '损耗%'
},
{
field: 'supplierNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $detail) {
initRawDetail(index, row, $detail);
2 years ago
}
})
}
//初始化子表格(循环) 一阶--辅料
2 years ago
initSubsidiaryDetail = function (index, row, $detail) {
var finishProductCode = row.finishProductCode;
var versionNumber = row.versionNumber;
// var subsidiary_table = $detail.html('<table class="table-container" id="subsidiary_table"></table>').find('table');
$("#subsidiary_table").bootstrapTable({
2 years ago
url: ctx + 'system/bomsubsidiarymaterial/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: finishProductCode,
versionNumber: versionNumber
2 years ago
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
columns: [
{
field: 'subsidiaryMaterialId',
title: 'bom辅料id',
visible: false
},
{
field: 'finishProductCode',
title: '成品代码',
visible: false
},
{
field: 'subsidiaryMaterialCode',
title: '辅料代码'
},
{
field: 'subsidiaryMaterialName',
title: '辅料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'subsidiaryMaterialConsumption',
title: '用量'
},
{
field: 'subsidiaryMaterialLoss',
title: '损耗%'
},
{
field: 'supplierNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $detail) {
initSubsidiaryDetail(index, row, $detail);
2 years ago
}
})
}
//初始化子表格(循环) 一阶--半成品
initBcpDetail = function (index, row, $detail) {
var finishProductCode = row.finishProductCode;
var versionNumber = row.versionNumber;
// var bcp_table = $detail.html('<table class="table-container" id="bcp_table"></table>').find('table');
$("#bcp_table").bootstrapTable({
url: ctx + 'system/bomBcp/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: finishProductCode,
versionNumber: versionNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
detailView: true,
columns: [
{
field: 'bcpCode',
title: '半成品代码(二阶)'
},
{
field: 'bcpName',
title: '半成品名称'
},
{
field: 'bcpVersionNumber',
title: '版本号'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'bcpConsumption',
title: '用量'
},
{
field: 'bcpLoss',
title: '损耗%'
},
{
field: 'customerNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $bcpdetail) {
$bcpdetail.html('<table class="table-container" id="bcp_raw_table"></table>' +
'<table class="table-container" id="bcp_subsidiary_table"></table>' +
'<table class="table-container" id="bcp_bcp_table"></table>'
).find('table');
initBcpDetail(index, row, $bcpdetail);
initBcpRawDetail(index, row, $bcpdetail);
initBcpSubsidiaryDetail(index, row, $bcpdetail);
initBcpBcpDetail(index, row, $bcpdetail);
}
})
}
//初始化子表格(循环) 二阶--原料
initBcpRawDetail = function (index, row, $detail) {
var bcpCode = row.bcpCode;
var bcpVersionNumber = row.bcpVersionNumber;
// var raw_table = $detail.html('<table class="table-container" id="raw_table"></table>').find('table');
$("#bcp_raw_table").bootstrapTable({
url: ctx + 'system/bomrawmaterial/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: bcpCode,
versionNumber: bcpVersionNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
columns: [
{
field: 'rawMaterialId',
title: '原料id',
visible: false
},
{
field: 'finishProductCode',
title: '成品代码',
visible: false
},
{
field: 'rawMaterialCode',
title: '原料代码'
},
{
field: 'rawMaterialName',
title: '原料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'rawMaterialConsumption',
title: '用量'
},
{
field: 'rawMaterialLoss',
title: '损耗%'
},
{
field: 'supplierNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $detail) {
initBcpRawDetail(index, row, $detail);
}
})
}
//初始化子表格(循环) 二阶--辅料
initBcpSubsidiaryDetail = function (index, row, $detail) {
var bcpCode = row.bcpCode;
var bcpVersionNumber = row.bcpVersionNumber;
// var subsidiary_table = $detail.html('<table class="table-container" id="subsidiary_table"></table>').find('table');
$("#bcp_subsidiary_table").bootstrapTable({
url: ctx + 'system/bomsubsidiarymaterial/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: bcpCode,
versionNumber: bcpVersionNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
columns: [
{
field: 'subsidiaryMaterialId',
title: 'bom辅料id',
visible: false
},
{
field: 'finishProductCode',
title: '成品代码',
visible: false
},
{
field: 'subsidiaryMaterialCode',
title: '辅料代码'
},
{
field: 'subsidiaryMaterialName',
title: '辅料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'subsidiaryMaterialConsumption',
title: '用量'
},
{
field: 'subsidiaryMaterialLoss',
title: '损耗%'
},
{
field: 'supplierNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $detail) {
initBcpSubsidiaryDetail(index, row, $detail);
}
})
}
//初始化子表格(循环) 二阶--半成品
initBcpBcpDetail = function (index, row, $detail) {
var bcpCode = row.bcpCode;
var bcpVersionNumber = row.bcpVersionNumber;
// var bcp_table = $detail.html('<table class="table-container" id="bcp_table"></table>').find('table');
$("#bcp_bcp_table").bootstrapTable({
url: ctx + 'system/bomBcp/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: bcpCode,
versionNumber: bcpVersionNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
detailView: true,
columns: [
{
field: 'bcpCode',
title: '半成品代码(三阶)'
},
{
field: 'bcpName',
title: '半成品名称'
},
{
field: 'bcpVersionNumber',
title: '版本号'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'bcpConsumption',
title: '用量'
},
{
field: 'bcpLoss',
title: '损耗%'
},
{
field: 'customerNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $bcpdetail) {
$bcpdetail.html('<table class="table-container" id="bcp_bcp_raw_table"></table>' +
'<table class="table-container" id="bcp_bcp_subsidiary_table"></table>'
).find('table');
initBcpBcpDetail(index, row, $bcpdetail);
initBcpBcpRawDetail(index, row, $bcpdetail);
initBcpBcpSubsidiaryDetail(index, row, $bcpdetail);
}
})
}
//初始化子表格(循环) 三阶--原料
initBcpBcpRawDetail = function (index, row, $detail) {
var bcpCode = row.bcpCode;
var bcpVersionNumber = row.bcpVersionNumber;
// var raw_table = $detail.html('<table class="table-container" id="raw_table"></table>').find('table');
$("#bcp_bcp_raw_table").bootstrapTable({
url: ctx + 'system/bomrawmaterial/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: bcpCode,
versionNumber: bcpVersionNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
columns: [
{
field: 'rawMaterialId',
title: '原料id',
visible: false
},
{
field: 'finishProductCode',
title: '成品代码',
visible: false
},
{
field: 'rawMaterialCode',
title: '原料代码'
},
{
field: 'rawMaterialName',
title: '原料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'rawMaterialConsumption',
title: '用量'
},
{
field: 'rawMaterialLoss',
title: '损耗%'
},
{
field: 'supplierNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $detail) {
initBcpRawDetail(index, row, $detail);
}
})
}
//初始化子表格(循环) 三阶--辅料
initBcpBcpSubsidiaryDetail = function (index, row, $detail) {
var bcpCode = row.bcpCode;
var bcpVersionNumber = row.bcpVersionNumber;
// var subsidiary_table = $detail.html('<table class="table-container" id="subsidiary_table"></table>').find('table');
$("#bcp_bcp_subsidiary_table").bootstrapTable({
url: ctx + 'system/bomsubsidiarymaterial/list',
contentType: "application/x-www-form-urlencoded",
method: 'post',
queryParams: function (params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
finishProductCode: bcpCode,
versionNumber: bcpVersionNumber
};
// console.log(data[0].enterpriseCode)
return curParams
},
toolbar: false, //工具按钮用哪个容器
striped: true, //是否显示行间隔色
cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination: false, //是否显示分页(*)
sortable: false, //是否启用排序
pageNumber: 1, //初始化加载第一页,默认第一页
pageSize: 10, //每页的记录行数(*)
pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
strictSearch: true,
showColumns: false, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
clickToSelect: true, //是否启用点击选中行
showToggle: false, //是否显示详细视图和列表视图的切换按钮
cardView: false, //是否显示详细视图
columns: [
{
field: 'subsidiaryMaterialId',
title: 'bom辅料id',
visible: false
},
{
field: 'finishProductCode',
title: '成品代码',
visible: false
},
{
field: 'subsidiaryMaterialCode',
title: '辅料代码'
},
{
field: 'subsidiaryMaterialName',
title: '辅料名称'
},
{
field: 'specificationModel',
title: '规格型号'
},
{
field: 'inventoryUnit',
title: '单位'
},
{
field: 'subsidiaryMaterialConsumption',
title: '用量'
},
{
field: 'subsidiaryMaterialLoss',
title: '损耗%'
},
{
field: 'supplierNumber',
title: '厂商料号'
},
{
field: 'finishedProductQuantity',
title: '成品数量'
},
{
field: 'remarks',
title: '备注说明'
},
{
field: 'processingCategory',
title: '加工类别'
}],
//无线循环取子表,直到子表里面没有记录
onExpandRow: function (index, row, $detail) {
initBcpSubsidiaryDetail(index, row, $detail);
}
})
}
2 years ago
//删除bom
function removeBom() {
var data = $("#bootstrap-table").bootstrapTable("getSelections");
var rawNum = 0;
var subsidiaryNum = 0;
var bcpNum = 0;
2 years ago
if (data.length === 1) {
// console.log(data[0])
$.ajax({
url: ctx + 'system/bomrawmaterial/list',
type: 'post',
data: {
finishProductCode: data[0].finishProductCode,
versionNumber: data[0].versionNumber
2 years ago
},
async: false,
success: function (res) {
rawNum = res.rows.length;
}
})
$.ajax({
url: ctx + 'system/bomsubsidiarymaterial/list',
type: 'post',
data: {
finishProductCode: data[0].finishProductCode,
versionNumber: data[0].versionNumber
2 years ago
},
async: false,
success: function (res) {
subsidiaryNum = res.rows.length;
}
})
$.ajax({
url: ctx + 'system/bomBcp/list',
type: 'post',
data: {
finishProductCode: data[0].finishProductCode,
versionNumber: data[0].versionNumber
},
async: false,
success: function (res) {
bcpNum = res.rows.length;
}
})
2 years ago
// console.log(rawNum)
// console.log(subsidiaryNum)
if (rawNum>0 || subsidiaryNum>0 || bcpNum>0) {
$.modal.confirm("该bom含有"+rawNum+"条原料数据和"+subsidiaryNum+"条辅料数据和"+bcpNum+"条半成品数据,是否确认删除?",function() {
2 years ago
$.ajax({
url: ctx + 'system/bom/removeBom',
type: 'post',
data: {
bomData: JSON.stringify(data)
},
success: function (res) {
console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
}
})
})
} else if (rawNum === 0 && subsidiaryNum === 0 && bcpNum === 0) {
2 years ago
$.modal.confirm("确认删除本条BOM信息吗?",function () {
$.ajax({
url: ctx + 'system/bom/remove',
type: 'post',
data: {
ids: data[0].bomId.toString()
},
success: function (res) {
console.log(res)
$("#bootstrap-table").bootstrapTable("refresh");
$.modal.msgSuccess("删除成功!")
}
})
})
} else {
$.modal.msgError("服务器出错,请联系管理员");
}
} else {
$.modal.msgWarning("请选择一条数据");
}
}
// 确认
function bomConfirm() {
let data = $("#bootstrap-table").bootstrapTable("getSelections");
let userName = [[${@permission.getPrincipalProperty('userName')}]];
if (data.length === 1) {
$("#bomId").val(data[0].bomId)
$("#confirmNo").val(1).trigger("change")
$("#confirmName").val(userName)
$("#confirmTime").datetimepicker("setDate", new Date());
$("#confirmModel").modal("show");
} else {
$.modal.alert("请选择一条数据");
}
}
// 确认
function ConfirmSubmit() {
var data = $("#bootstrap-table").bootstrapTable("getSelections");
$.ajax({
url: prefix + "/edit",
type: "post",
resultType: "json",
data: $('#form-confirm-edit').serialize(),
success: function (resp) {
$("#bootstrap-table").bootstrapTable('refresh');
// $(".alert-success").addClass("show");
// window.setTimeout(function () {
// $(".alert-success").removeClass("show");
// }, 1000);//显示的时间
$.modal.msgSuccess("操作成功!")
},
error: function () {
$.modal.msgError("出错了!");
}
});
}
//单个导出
function exportBomDetail() {
var bomData = $("#bootstrap-table").bootstrapTable("getSelections");
var rawData;
var subsidiaryData;
var bcpData;
2 years ago
console.log(bomData)
if (bomData.length === 1) {
// console.log(data[0])
$.ajax({
url: ctx + 'system/bomrawmaterial/list',
type: 'post',
data: {
finishProductCode: bomData[0].finishProductCode,
versionNumber: bomData[0].versionNumber
2 years ago
},
async: false,
success: function (res) {
rawData = res.rows;
}
})
$.ajax({
url: ctx + 'system/bomsubsidiarymaterial/list',
type: 'post',
data: {
finishProductCode: bomData[0].finishProductCode,
versionNumber: bomData[0].versionNumber
2 years ago
},
async: false,
success: function (res) {
subsidiaryData = res.rows;
}
})
$.ajax({
url: ctx + 'system/bomBcp/list',
type: 'post',
data: {
finishProductCode: bomData[0].finishProductCode,
versionNumber: bomData[0].versionNumber
},
async: false,
success: function (res) {
bcpData = res.rows;
}
})
2 years ago
console.log(rawData)
console.log(subsidiaryData)
console.log(bcpData)
2 years ago
$.modal.confirm("确认导出该条bom数据吗?", function() {
axios({
url: prefix + '/exportBomDetail',
method: 'POST',
data: {
exData: {
// "selectData": JSON.stringify(selectData),
"bomData": JSON.stringify(bomData),
"rawData": JSON.stringify(rawData),
"subsidiaryData": JSON.stringify(subsidiaryData),
"bcpData": JSON.stringify(bcpData)
2 years ago
}
},
responseType: 'blob'
}).then(response => {
// console.log(response)
// console.log(response.data)
const URL = window.URL.createObjectURL(response.data)
// 创建隐藏<a>标签进行下载
const tempLink = document.createElement('a')
tempLink.style.display = 'none'
tempLink.href = URL
let time = new Date().toLocaleString()
tempLink.setAttribute('download', time + '_' + bomData[0].finishProductName + "_bom.xlsx")
if (typeof tempLink.download === 'undefined') {
tempLink.setAttribute('target', '_blank')
}
document.body.appendChild(tempLink)
tempLink.click()
document.body.removeChild(tempLink)// 移除dom元素
window.URL.revokeObjectURL(URL)//释放内存
})
})
} else {
$.modal.msgWarning("请选择一条数据")
}
}
</script>
</body>
</html>