开发BOM UI界面

pull/1/head
wangziyangyang 2020-04-08 17:28:55 +08:00
parent 2f27604d86
commit 3b7ae63cf1
5 changed files with 92 additions and 138 deletions

View File

@ -3,11 +3,11 @@ package com.wangziyang.mes.technology.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.wangziyang.mes.common.BaseController;
import com.wangziyang.mes.common.Result;
import com.wangziyang.mes.technology.entity.SpFlow; import com.wangziyang.mes.technology.entity.SpFlow;
import com.wangziyang.mes.technology.request.SpFlowReq; import com.wangziyang.mes.technology.request.SpFlowReq;
import com.wangziyang.mes.technology.service.ISpFlowService; import com.wangziyang.mes.technology.service.ISpFlowService;
import com.wangziyang.mes.common.BaseController;
import com.wangziyang.mes.common.Result;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;

View File

@ -97,6 +97,7 @@ public class SpFlowOperRelationServiceImpl extends ServiceImpl<SpFlowOperRelatio
if (CollectionUtil.isEmpty(spOperVoList)||spOperVoList.size() <= 1) { if (CollectionUtil.isEmpty(spOperVoList)||spOperVoList.size() <= 1) {
throw new Exception("流程下必须存在至少两个工序"); throw new Exception("流程下必须存在至少两个工序");
} }
//TODO 这个逻辑待处理
SpFlow spFlow = new SpFlow(); SpFlow spFlow = new SpFlow();
BeanUtils.copyProperties(spFlowDto, spFlow); BeanUtils.copyProperties(spFlowDto, spFlow);
String flowId = spFlow.getId(); String flowId = spFlow.getId();

View File

@ -67,7 +67,9 @@ layui.define(['layer', 'carousel'], function (exports) {
param.autoplay = false; // 关闭自动播放 param.autoplay = false; // 关闭自动播放
if (!param.stepWidth) { if (!param.stepWidth) {
param.stepWidth = '400px'; param.stepWidth = '400px';
} }
param.position='relative'
// 渲染轮播图 // 渲染轮播图
carousel.render(param); carousel.render(param);
@ -76,7 +78,7 @@ layui.define(['layer', 'carousel'], function (exports) {
var stepItems = param.stepItems; var stepItems = param.stepItems;
renderDom(param.elem, stepItems, 0); renderDom(param.elem, stepItems, 0);
$('.lay-step').css('width', param.stepWidth); $('.lay-step').css('width', param.stepWidth);
$('.lay-step').css('position', param.stepWidth);
//监听轮播切换事件 //监听轮播切换事件
carousel.on('change(' + param.filter + ')', function (obj) { carousel.on('change(' + param.filter + ')', function (obj) {
$(param.elem).find('.lay-step').remove(); $(param.elem).find('.lay-step').remove();

View File

@ -34,7 +34,8 @@
<button type="button" id="js-test-btn" class="layui-btn" style="height:37px "><i <button type="button" id="js-test-btn" class="layui-btn" style="height:37px "><i
class="layui-icon layui-icon-search "></i> class="layui-icon layui-icon-search "></i>
</button> </button>
<input id="js-test-input" name="materielCode" readonly="true" lay-verify="required" placeholder="搜索物料" autocomplete="off" <input id="js-test-input" name="materielCode" readonly="true" lay-verify="required"
placeholder="搜索物料" autocomplete="off"
value="${result.materielCode}" value="${result.materielCode}"
class="layui-input" style="width: 133PX"> class="layui-input" style="width: 133PX">
</div> </div>
@ -44,7 +45,8 @@
<label for="js-version-number" class="layui-form-label sp-required">版本号 <label for="js-version-number" class="layui-form-label sp-required">版本号
</label> </label>
<div style="display: flex; flex-direction: row;"> <div style="display: flex; flex-direction: row;">
<input type="text" id="js-versionNumber" readonly="true" name="versionNumber" lay-verify="required" <input type="text" id="js-versionNumber" readonly="true" name="versionNumber"
lay-verify="required"
autocomplete="off" autocomplete="off"
class="layui-input" class="layui-input"
{value="${result.versionNumber}" | value='1' style=" width: 163PX;" }> {value="${result.versionNumber}" | value='1' style=" width: 163PX;" }>
@ -86,7 +88,7 @@
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-input-block"> <div class="layui-input-block">
<button class="layui-btn" lay-submit lay-filter="formStep"> <button type="button" class="layui-btn" lay-submit lay-filter="formStep">
&emsp;下一步&emsp; &emsp;下一步&emsp;
</button> </button>
</div> </div>
@ -96,25 +98,23 @@
<div> <div>
<form class="layui-form"> <form class="layui-form">
<div class="layui-form-item"> <div class="layui-form-item">
<button class="layui-btn layui-bg-green layui-btn-primary pre" lay-submit <input id="js-id" name="id" class="layui-hide" value="${result.id}"/>
<button type="button" class="layui-btn layui-bg-green pre" lay-submit
lay-filter="formStep"> lay-filter="formStep">
&emsp;上一步&emsp; &emsp;上一步&emsp;
</button> </button>
<button id="js-submit" class="layui-btn pre" lay-demotransferactive="getData" lay-submit
lay-filter="js-submit-filter">&emsp;保存&emsp;
</button>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<!--表格--> <!--表格-->
<table class="layui-hide"style="height: 350px" id="js-record-table" lay-filter="js-record-table-filter"></table> <table class="layui-hide" id="layTableId" lay-filter="js-record-table-filter"></table>
</div> </div>
</form> </form>
</div> </div>
<div class="layui-form-item layui-hide">
<div class="layui-input-block">
<input id="js-id" name="id" value="${result.id}"/>
<button id="js-submit" class="layui-btn" lay-demotransferactive="getData" lay-submit
lay-filter="js-submit-filter">确定
</button>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -122,17 +122,17 @@
<!--表格头操作模板--> <!--表格头操作模板-->
<script type="text/html" id="js-record-table-toolbar-top"> <script type="text/html" id="js-record-table-toolbar-top">
<div class="layui-btn-container"> <div class="layui-btn-container">
<button class="layui-btn layui-btn-danger layui-btn-sm" lay-event="deleteBatch"><i
class="layui-icon">&#xe640;</i>批量删除
</button>
<@shiro.hasPermission name="user:add"> <@shiro.hasPermission name="user:add">
<button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon">&#xe61f;</i>添加</button> <div>
<button type="button" class="layui-btn layui-btn-sm" lay-event="add" title="添加一行">
<i class="layui-icon layui-icon-add-1"></i> 添加一行
</button>
</div>
</@shiro.hasPermission> </@shiro.hasPermission>
</div> </div>
</script> </script>
<!--行操作模板--> <!--行操作模板-->
<script type="text/html" id="js-record-table-toolbar-right"> <script type="text/html" id="js-record-table-toolbar-right">
<a class="layui-btn layui-btn-xs" lay-event="edit"><i class="layui-icon layui-icon-edit"></i>编辑</a>
<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i class="layui-icon layui-icon-delete"></i>删除</a> <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i class="layui-icon layui-icon-delete"></i>删除</a>
</script> </script>
@ -144,38 +144,14 @@
spTable = layui.spTable, spTable = layui.spTable,
table = layui.table, table = layui.table,
step = layui.step; step = layui.step;
//分步表单绘制
// 表格及数据初始化
var tableIns = spTable.render({
url: '${request.contextPath}/basedata/flow/page',
cols: [
[{
type: 'checkbox'
}, {
field: 'flow', title: '流程'
}, {
field: 'flowDesc', title: '流程描述'
}, {
field: 'process', title: '流程时序过程'
}, {
fixed: 'right',
field: 'operate',
title: '操作',
toolbar: '#js-record-table-toolbar-right',
unresize: true,
width: 150
}]
],
done: function (res, curr, count) {
}
});
step.render({ step.render({
elem: '#stepForm', elem: '#stepForm',
filter: 'stepForm', filter: 'stepForm',
width: '100%', //设置容器宽度 width: '100%', //设置容器宽度
stepWidth: '700px', stepWidth: '700px',
height: '500px', height: '500px',
scrollbar:true,
stepItems: [{ stepItems: [{
title: 'BOM主信息' title: 'BOM主信息'
}, { }, {
@ -200,7 +176,6 @@
$('.next').click(function () { $('.next').click(function () {
step.next('#stepForm'); step.next('#stepForm');
}); });
//监听提交 //监听提交
form.on('submit(js-submit-filter)', function (data) { form.on('submit(js-submit-filter)', function (data) {
spUtil.submitForm({ spUtil.submitForm({
@ -210,58 +185,42 @@
}); });
return false; return false;
}); });
var layTableId = "layTableId";
/**
// 物料主数据搜索弹框 * 表格绘制
$('#js-test-btn').click(function () { */
var index = spLayer.open({ var tableIns = spTable.render({
type: 2, page: true,
area: ['680px', '500px'], even: false, //不开启隔行背景
reload: false, height: 'full-200',
content: '${request.contextPath}/admin/common/ui/searchPanelMaterile', elem: "#layTableId",
// 如果是搜索弹窗,需要添加回调函数来获取选中数据 page: false,
spCallback: function (result) { cols: [[ //标题栏
console.log(result) {title: '序号', type: 'numbers'}
if (result.code === 0 && result.data.length > 0) { , {field: 'LocationID', title: '仓位编码', width: 158, edit: 'text', align: "center"}
$('#js-test-input').val(result.data[0].materiel); , {field: 'InventoryQuantity', title: '拆分数量', edit: 'text', width: 158, align: "center"}
} ,{field: 'site', title: '位置', edit: 'text', width: 158, align: "center"}
, {
field: 'operate',
title: '操作',
toolbar: '#js-record-table-toolbar-right',
unresize: true,
width: 150
} }
]],
data: [{"LocationID": "123", "InventoryQuantity": "0",site:"001"}]
}); });
});
/** /**
* 头工具栏事件 * 头工具栏事件
*/ */
table.on('toolbar(js-record-table-filter)', function (obj) { table.on('toolbar(js-record-table-filter)', function (obj) {
var checkStatus = table.checkStatus(obj.config.id); // 添加一行可编辑数据
// 批量删除
if (obj.event === 'deleteBatch') {
var checkStatus = table.checkStatus('js-record-table'),
data = checkStatus.data;
if (data.length > 0) {
layer.confirm('确认要删除吗?', function (index) {
});
} else {
layer.msg("请先选择需要删除的数据!");
}
}
// 添加
if (obj.event === 'add') { if (obj.event === 'add') {
var index = spLayer.open({ var Data = table.cache[layTableId];
title: '添加', var datas = {}
area: ['60%', '90%'], Data.push(datas);
reload: false, tableIns.reload({
spWhere: {}, data: Data
content: '${request.contextPath}/basedata/flow/process/add-or-update-ui',
spCallback: function (result) {
if (result.code === 0) {
}
}
}); });
} }
}); });
@ -270,51 +229,42 @@
* 监听行工具事件 * 监听行工具事件
*/ */
table.on('tool(js-record-table-filter)', function (obj) { table.on('tool(js-record-table-filter)', function (obj) {
var data = obj.data;
// 编辑 // 编辑
if (obj.event === 'edit') {
spLayer.open({
title: '编辑',
area: ['60%', '90%'],
reload: false,
// 请求url参数
spWhere: {},
content: '${request.contextPath}/basedata/common/add-or-update-ui',
spCallback: function (result) {
if (result.code === 0) {
}
}
});
}
// 删除
if (obj.event === 'delete') { if (obj.event === 'delete') {
layer.confirm('确认要删除吗?', function (index) { layer.confirm('确认要删除吗?', function (index) {
spUtil.ajax({ obj.del();
url: '${request.contextPath}/basedata/common/delete',
async: false,
type: 'POST',
// 是否显示 loading
showLoading: true,
// 是否序列化参数
serializable: false,
// 参数
data: {
id: data.id,
tableName: tableName
},
success: function (data) {
tableIns.reload();
layer.close(index); layer.close(index);
}, })
error: function () { }
})
// 物料主数据搜索弹框
$('#js-test-btn').click(function () {
searchMaterile();
});
/**
* 物料搜索功能
* @param obj
*/
window.searchMaterile = function (obj) {
spLayer.open({
type: 2,
area: ['680px', '500px'],
reload: false,
content: '${request.contextPath}/admin/common/ui/searchPanelMaterile',
// 如果是搜索弹窗,需要添加回调函数来获取选中数据
spCallback: function (result) {
if (result.code === 0 && result.data.length > 0) {
$('#js-test-input').val(result.data[0].materiel);
}
} }
}); });
});
} }
});
}); });
//版本号 //版本号
function FN(btnType) { function FN(btnType) {
var versionNumber = $('#js-versionNumber') var versionNumber = $('#js-versionNumber')

View File

@ -138,6 +138,7 @@
} }
// 添加 // 添加
if (obj.event === 'add') { if (obj.event === 'add') {
//新开一个TAB标签 url 标题名称 图标
spLayui.createTableItem('/technology/bom/add-or-update-ui?mpi=bom-1','BOM信息','fa fa-dropbox'); spLayui.createTableItem('/technology/bom/add-or-update-ui?mpi=bom-1','BOM信息','fa fa-dropbox');
} }
}); });