@ -2,25 +2,27 @@
< html lang = "zh" xmlns:th = "http://www.thymeleaf.org" >
< html lang = "zh" xmlns:th = "http://www.thymeleaf.org" >
< head >
< head >
< th:block th:include = "include :: header('新增开发修改单')" / >
< th:block th:include = "include :: header('新增开发修改单')" / >
< th:block th:include = "include :: select2-css" / >
< th:block th:include = "include :: bootstrap-editable-css" / >
< / head >
< / head >
< body class = "white-bg" >
< body class = "white-bg" >
< div class = "wrapper wrapper-content animated fadeInRight ibox-content" >
< div class = "wrapper wrapper-content animated fadeInRight ibox-content" >
< form class = "form-horizontal m" id = "form-developModifyOrder-add" >
< form class = "form-horizontal m" id = "form-developModifyOrder-add" >
< div class = "form-group" >
< div class = "form-group" hidden = "hidden" >
< label class = "col-sm-3 control-label" > 开发修改单号:< / label >
< label class = "col-sm-3 control-label" > 开发修改单号:< / label >
< div class = "col-sm-8" >
< div class = "col-sm-8" >
< input name = "developOderCode" class = "form-control" type = "text" >
< input name = "developOderCode" class = "form-control" type = "text" >
< / div >
< / div >
< / div >
< / div >
< div class = "container" >
< div class = "container" >
< div class = "form-row " >
< div class = "header " >
< div class = "btn-group-sm" role = "group" >
< div class = "btn-group-sm" role = "group" >
< header > 修改开发修改单:< / header >
< header > 修改开发修改单:< / header >
< / div >
< / div >
< / div >
< / div >
< div class = "row" >
< div class = "row" >
< div class = "form-group is-required " >
< div class = "form-group" >
< label class = "col-sm-3 control-label" > 生产单号:< / label >
< label class = "col-sm-3 control-label is-required " > 生产单号:< / label >
< div class = "col-sm-8" >
< div class = "col-sm-8" >
< select id = "add_developOderCode" name = "developOderCode" class = "form-control" type = "text" required >
< select id = "add_developOderCode" name = "developOderCode" class = "form-control" type = "text" required >
< option value = "" > 请选择< / option >
< option value = "" > 请选择< / option >
@ -52,32 +54,60 @@
< / div >
< / div >
< / div >
< / div >
< / div >
< / div >
< div class = "container" >
< div class = "form-row" >
< div class = "btn-group-sm" id = "toolbar1" role = "group" >
< span > 选择采购物料< / span >
< a class = "btn btn-success" onclick = "insertRow2()" >
< i class = "fa fa-plus" > < / i > 添加修改物料
< / a >
< / div >
< / div >
< div class = "row" >
< div class = "col-sm-12 select-table table-striped" >
< table id = "bootstrap-sub-table-material" > < / table >
< / div >
< / div >
< / div >
< div class = "container" >
< div class = "form-row" >
< div class = "btn-group-sm" id = "toolbar2" role = "group" >
< span > 选择通知人< / span >
< a class = "btn btn-success" onclick = "insertRow3()" >
< i class = "fa fa-plus" > < / i > 添加修改物料
< / a >
< / div >
< / div >
< div class = "row" >
< div class = "col-sm-12 select-table table-striped" >
< table id = "bootstrap-sub-table-biztoitem" > < / table >
< / div >
< / div >
< / div >
< / form >
< / form >
< / div >
< / div >
< th:block th:include = "include :: footer" / >
< th:block th:include = "include :: footer" / >
< th:block th:include = "include :: bootstrap-table-editable-js" / >
< th:block th:include = "include :: select2-js" / >
< script th:inline = "javascript" >
< script th:inline = "javascript" >
var prefix = ctx + "erp/developModifyOrder"
var prefix = ctx + "erp/developModifyOrder"
var userName = [[${@permission.getPrincipalProperty('userName')}]];
var userName = [[${@permission.getPrincipalProperty('userName')}]];
$("#form-developModifyOrder-add").validate({ focusCleanup: true});
$("#form-developModifyOrder-add").validate({ focusCleanup: true});
$(function () {
$("#add_developOderCode").select2({
$.ajax({
ajax: {
url: ctx + 'erp/developModifyOrder/getEngineerList',
url: ctx + "system/makeorder" + "/selectAllMakeNos",
type: 'post',
dataType: 'json',
data: { roleKey: 'gcwyRole' },
type: "POST",
success: function (res) {
delay: 250,
if (res.data.length > 0) {
processResults: function (data, params) {
var userData = res.data;
params.page = params.page || 1;
for (let i in userData) {
return {
$("#userId_add").append(
results: data.data,
"< option value = '" + userData[i].userId + "' > " + userData[i].userName + "< / option > " // 显示用户姓名
);
}
}
$("#userId_add").val(userData[i].userId).trigger("change");
} else {
$.modal.msgError(res.msg);
}
}
}
}
});
});
$(function () {
var options = {
var options = {
id: "bootstrap-sub-table-developModify",
id: "bootstrap-sub-table-developModify",
url: prefix + "/getDevelopModifyOrderList",
url: prefix + "/getDevelopModifyOrderList",
@ -145,21 +175,295 @@
return form; // 返回生成的表单HTML
return form; // 返回生成的表单HTML
}},
}},
]
]
};
$.table.init(options);
var option1 = {
url: prefix + "/list",
modalName: "bom",
detailView: true,
height: $(window).height() - 100,
//指定父id列
onExpandRow : function(index, row, $detail) {
$detail.html('< table class = "table-container" id = "all_level_table_'+row.id+'" > < / table > ').find('table');
// 多阶
initAllLevelTable(index,row,$detail);
// $.table.bootstrapTable('resetView');
},
columns: [
{checkbox: false},
{title: 'bom号',field: 'bomNo', },
{title: '关联料号',field: 'materialNo', },
{field: 'photoUrl',title: '图片',formatter: function(value, row, index) {return $.table.imageView(value);}},
{title: '物料名称',field: 'materialName', },
{field: 'materialType',title: '物料类型',formatter: function(value, row, index) { return $.table.selectCategoryLabel(materialTypeDatas, value);}},
{field: 'processMethod', title: '半成品类型',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}},
{field: 'unit',title: '单位',},
{ title: '品牌',field: 'brand', },
{title: '描述',field: 'describe'},
{field: 'num',title: '订单数量',},
{field: 'parentId',title: '父级id',visible:false},
{title: '操作',align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('< a class = "btn btn-danger btn-xs" href = "javascript:void(0)" onclick = "remove(\'' + row.id + '\')" > < i class = "fa fa-eye" > < / i > 删除< / a > ');
return actions.join('');
}
}]
};
$.table.init(option1);
});
initAllLevelTable = function(index, row, $detail) {
$("#"+"all_level_table_"+row.id).bootstrapTable({
url: prefix + "/allLevelList",
method: 'post',
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {
parentId: row.id
},
columns: [{
field: 'id',
title: '主键id'
},
{
field: 'level',
title: '层级',
formatter: function(value, row, index) {
return $.table.selectDictLabel(levelDatas, value);
}
},
{
field: 'bomNo',
title: 'bom号',
formatter:function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'photoUrl',
title: '图片',
formatter: function(value, row, index) {
return $.table.imageView(value);
}
},
{
field: 'materialNo',
title: '料号',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
$("bootstrap-sub-table-developModify").init(options);
})
function insertRow() {
var table = $("#bootstrap-sub-table-quoteChild").bootstrapTable('getData');
var row = table.length + 1;
$("#bootstrap-sub-table-developModify").bootstrapTable('insertRow', {
index: row,
row: {
id: row,
developOderCode: $("#add_developOderCode").val(),
}
}
},
{
field: 'materialName',
title: '物料名称',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'materialType',
title: '物料类型',
formatter: function(value, row, index) {
return $.table.selectCategoryLabel(materialTypeDatas, value);
}
},
{
field: 'describe',
title: '描述',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'brand',
title: '品牌',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'unit',
title: '单位',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'useNum',
title: '用量',
formatter: function (value,row,index){
if (value == null || value == ''){
return '/';
}else{
return value
}
}
},
{
field: 'lossRate',
title: '损耗率',
formatter: function (value,row,index){
if (value == null || value == ''){
return "/";
}
return value + "%";
}
},
{
field: 'processMethod',
title: '半成品类型',
formatter: function(value, row, index) {
return $.table.selectDictLabel(processMethodDatas, value);
}
},
{
field: 'parentId',
title: '父级id',
visible: false,
},
{
field: 'sortNo',
title: '排序',
visible: false
}]
});
};
initChildSonTable = function(index, row, $detail) {
var childSonTable = $detail.html('< table style = "table-layout:fixed" > < / table > ').find('table');
$(childSonTable).bootstrapTable({
url: prefix + "/subList",
method: 'post',
detailView: true,
sidePagination: "server",
contentType: "application/x-www-form-urlencoded",
queryParams : {parentId: row.id},
onExpandRow : function(index, row, $detail) {initChildSonTable(index, row, $detail);},
columns: [
{field: 'id',title: '主键id'},
{field: 'level',title: '层级',formatter: function(value, row, index) {return $.table.selectDictLabel(levelDatas, value);}},
{field: 'bomNo',title: 'bom号',formatter:function (value,row,index){if (value == null || value == ''){return '/'; }else{ return value;}}},
{field: 'photoUrl',title: '图片',formatter:function (value,row,index){if (value == null || value == ''){ return '/';}else{return $.table.imageView(value);}}},
{field: 'materialNo',title: '料号',},
{field: 'materialName',title: '物料名称',},
{field: 'materialType',title: '物料类型',formatter: function(value, row, index) {return $.table.selectCategoryLabel(materialTypeDatas, value);}},
{field: 'describe',title: '描述',},
{field: 'brand',title: '品牌',},
{field: 'unit',title: '单位',},
{field: 'lossRate',title: '损耗率(%)',formatter:function (value,row,index){return value + '%';}},
{field: 'processMethod',title: '半成品类型',formatter: function(value, row, index) {return $.table.selectDictLabel(processMethodDatas, value);}},
{field: 'useNum',title: '订单用量',},
{field: 'parentId',title: '父级id',visible: false,},
]
});
});
}
}
function insertRow() {
var url = ctx + "system/makeorder/selectMakeorder";
var options = {
title: '选择生产物料',
url: url,
callBack: doSubmit
};
$.modal.openOptions(options);
}
function insertRow2() {
var url = ctx + "erp/material/select";
var options = {
title: '选择料号',
url: url,
callBack: doSubmit2
};
$.modal.openOptions(options);
}
function doSubmit(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
var totalNum = $("#bootstrap-sub-table-developModify").bootstrapTable('getData').length;
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-developModify").bootstrapTable('insertRow',{
index: 1,
row: {
id:rowData.id,
bomNo:rowData.bomNo,
materialNo: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
processMethod: rowData.processMethod,
unit: rowData.unit,
brand: rowData.brand,
level: "1",
lossRate:'',
useNum:''
}
})
layer.close(index);
}
function doSubmit2(index, layero,uniqueId){
console.log(uniqueId);
var iframeWin = window[layero.find('iframe')[0]['name']];
var rowData = iframeWin.$('#bootstrap-select-table').bootstrapTable('getSelections')[0];
var totalNum = $("#bootstrap-sub-table-material").bootstrapTable('getData').length;
console.log("rowData: "+rowData);
$("#bootstrap-sub-table-material").bootstrapTable('insertRow',{
index: 1,
row: {
id:rowData.id,
bomNo:rowData.bomNo,
materialNo: rowData.materialNo,
materialName: rowData.materialName,
materialType: rowData.materialType,
describe: rowData.describe,
processMethod: rowData.processMethod,
unit: rowData.unit,
brand: rowData.brand,
level: "1",
lossRate:'',
useNum:''
}
})
layer.close(index);
}
function remove(id){
$("#bootstrap-sub-table-developModify").bootstrapTable('remove', {
field: 'id',
values: id
})
}
function removeRow(id){
$("#bootstrap-sub-table-material").bootstrapTable('remove', {
field: 'id',
values: id
})
}
function submitHandler() {
function submitHandler() {
if ($.validate.form()) {
if ($.validate.form()) {