开发订单新增功能

pull/1/head
wangziyangyang 2021-03-09 17:18:59 +08:00
parent f0f41d74fc
commit 298338d59a
2 changed files with 133 additions and 334 deletions

View File

@ -1,226 +1,139 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html xmlns="http://www.w3.org/1999/html">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>添加用户</title> <title>派工单编辑</title>
<meta name="renderer" content="webkit"> <meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" <meta name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<#include "${request.contextPath}/common/common.ftl"> <#include "${request.contextPath}/common/common.ftl">
<link href="${request.contextPath}/css/effect.css" rel="stylesheet" type="text/css"/>
<style>
.flowProcss {
font-size: 25px;
margin-left: 310PX;
display: flex;
justify-content: flex-start;
flex-direction: row;
}
</style>
</head> </head>
<body> <body>
<div class="splayui-container"> <div class="splayui-container">
<div class="splayui-main"> <div class="splayui-main">
<form class="layui-form splayui-form" lay-filter="formTest"> <form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;">
<div class="layui-row">
<div class="layui-col-xs6 layui-col-sm6 layui-col-md10">
<div class="layui-form-item"> <div class="layui-form-item">
<label for="js-materiel" class="layui-form-label sp-required">物料编号 <div class="layui-inline">
<label for="js-bomCode" class="layui-form-label sp-required">订单编号
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="js-materiel" name="materiel" lay-verify="required" autocomplete="off" <input type="text" id="js-bomCode" name="bomCode" lay-verify="required"
class="layui-input" value="${result.materiel}">
</div>
</div>
<div class="layui-form-item">
<label for="js-materielDesc" class="layui-form-label sp-required">物料描述
</label>
<div class="layui-input-inline">
<input type="text" id="js-materielDesc" name="materielDesc" lay-verify="required"
autocomplete="off" class="layui-input" value="${result.materielDesc}">
</div>
</div>
<div class="layui-form-item">
<label for="js-unit" class="layui-form-label sp-required">单位
</label>
<div class="layui-input-inline">
<input type="text" id="js-unit" name="unit" lay-verify="required" autocomplete="off"
class="layui-input" value="${result.unit}">
</div>
</div>
<div class="layui-form-item">
<label for="js-productGroup" class="layui-form-label sp-required">产品组
</label>
<div class="layui-input-inline">
<input type="text" id="js-productGroup" name="productGroup" lay-verify="required"
autocomplete="off" autocomplete="off"
class="layui-input" value="${result.productGroup}"> class="layui-input" value="${result.bomCode}">
</div>
</div> </div>
</div> </div>
<div class="layui-form-item"> <div class="layui-form-item">
<label for="js-model" class="layui-form-label sp-required">规格型号 <label for="js-materielCode" class="layui-form-label sp-required">物料编码
</label>
<div style="display: flex; flex-direction: row;">
<button type="button" id="js-test-btn" class="layui-btn" style="height:37px "><i
class="layui-icon layui-icon-search "></i>
</button>
<input id="js-materiel-code" name="materielCode" readonly="true" lay-verify="required"
placeholder="搜索物料" autocomplete="off"
value="${result.materielCode}"
class="layui-input" style="width: 133PX">
</div>
</div>
<div class="layui-form-item">
<div class="layui-inline">
<label for="js-materielName" class="layui-form-label sp-required">物料名称
</label> </label>
<div class="layui-input-inline"> <div class="layui-input-inline">
<input type="text" id="js-model" name="model" lay-verify="required" <input id="js-materiel-name" readonly="true" name="materielDesc" lay-verify="required"
autocomplete="off" autocomplete="off"
class="layui-input" value="${result.model}"> class="layui-input" value="${result.materielDesc}">
</div> </div>
</div> </div>
<div class="layui-form-item">
<label for="js-matType" class="layui-form-label sp-required">物料类型
</label>
<div class="layui-input-inline">
<select id="js-matType" name="matType" lay-filter="matType-filter" lay-verify="required">
</select>
</div> </div>
</div>
<div class="layui-form-item">
<label for="js-size" class="layui-form-label ">尺寸
</label>
<div class="layui-input-inline">
<input type="text" id="js-size" name="size" autocomplete="off"
class="layui-input" value="${result.size}">
</div>
</div>
<div class="layui-form-item">
<label for="js-flowId" class="layui-form-label ">工艺流程
</label>
<div class="layui-input-inline">
<select id="js-flowId" name="flowId" lay-filter="flow-filter">
</select>
</div>
<div class=" text-effect flowProcss " id="js-flowProcess" name="flowProcss">
</div>
</div>
<div class="layui-form-item"> <div class="layui-form-item">
<label for="js-is-deleted" class="layui-form-label sp-required">状态 <label for="js-is-deleted" class="layui-form-label sp-required">状态
</label> </label>
<div class="layui-input-block" id="js-is-deleted" style="width: 310px;"> <div class="layui-input-block" id="js-is-deleted" style="width: 310px;">
<input type="radio" name="deleted" value="0" title="正常" <input type="radio" name="deleted" value="0" title="正常"
<#if result.deleted == "0" || !(result??)>checked</#if>> <#if result.deleted == "0" || !(result??)>checked</#if>>
<input type="radio" name="deleted" value="1" title="已删除" <input type="radio" name="deleted" value="1" title="锁定"
<#if result.deleted == "1">checked</#if>> <#if result.deleted == "1">checked</#if>>
<input type="radio" name="deleted" value="2" title="已禁用" <input type="radio" name="deleted" value="2" title="关闭"
<#if result.deleted == "2">checked</#if>> <#if result.deleted == "2">checked</#if>>
</div> </div>
</div> </div>
<div class="layui-form-item">
<label class="layui-form-label">生产说明:</label>
<div class="layui-input-block">
<textarea placeholder="备注.." name="remark" value="${result.remark}"
class="layui-textarea"></textarea>
</div>
</div> </div>
<div class="layui-form-item layui-hide"> <div class="layui-form-item layui-hide">
<div class="layui-input-block"> <div class="layui-input-block">
<input id="js-id" name="id" value="${result.id}"/> <input id="js-id" name="id" value="${result.id}"/>
<button id="js-submit" class="layui-btn" lay-submit lay-filter="js-submit-filter">确定 <button id="js-submit" class="layui-btn" lay-demotransferactive="getData" lay-submit
lay-filter="js-submit-filter">确定
</button> </button>
</div> </div>
</div> </div>
</div>
</form> </form>
</div> </div>
</div> </div>
<script> <script>
layui.use(['form', 'util'], function () { layui.use(['form', 'util', 'layer', 'step', 'spLayer', 'spTable', 'table'], function () {
var form = layui.form, var form = layui.form,
util = layui.util; spLayer = layui.spLayer,
var flowRows = []; layer = layui.layer,
//流程添加下拉框 table = layui.table;
getFlowData();
//物料类型
getMatTypeData();
/**
* 初始化物料类型数据
*/
function getMatTypeData() {
spUtil.ajax({
url: '${request.contextPath}/basedata/dict/list/material_type',
async: false,
type: 'GET',
// 是否显示 loading
// showLoading: true,
// 是否序列化参数
serializable: false,
// 参数
data: {},
success: function (data) {
$.each(data.data, function (index, item) {
$('#js-matType').append(new Option(item.name, item.value));
});
}
});
}
/**
* 初始化流程数据
*/
function getFlowData() {
spUtil.ajax({
url: '${request.contextPath}/basedata/flow/list',
async: false,
type: 'GET',
// 是否显示 loading
showLoading: true,
// 是否序列化参数
serializable: false,
// 参数
data: {},
success: function (data) {
flowRows = data.data;
}
});
$.each(flowRows, function (index, item) {
$('#js-flowId').append(new Option(item.flowDesc, item.id));
});
//编辑时候根据回显的ID 绘制流程
flowProssbyId("${result.flowId}")
}
//下拉框选择 绘制流程时序图
form.on('select(flow-filter)', function (data) {
flowProssbyId(data.value)
});
//通过ID 获取流程时序 绘制
function flowProssbyId(flowId) {
var newArr = flowRows.filter(function (obj) {
return obj.id == flowId;
});
if (newArr.length > 0) {
procssArr = newArr[0].process.split("->")
$("#js-flowProcess").empty();
$.each(procssArr, function (i, val) {
if (i == procssArr.length - 1) {
$("#js-flowProcess").append("<span style='display: inline-flex;' >" + val + "</span>");
} else {
$("#js-flowProcess").append("<span style='display: inline-flex;' >" + val + '->' + "</span>");
}
});
}
}
//给表单赋值
form.val("formTest", { //formTest 即 class="layui-form" 所在元素属性 lay-filter="" 对应的值
"flowId": "${result.flowId}",
"matType": "${result.matType}"
});
//监听提交 //监听提交
form.on('submit(js-submit-filter)', function (data) { form.on('submit(js-submit-filter)', function (data) {
spUtil.submitForm({ spUtil.submitForm({
url: "${request.contextPath}/basedata/materile/add-or-update", url: "${request.contextPath}/technology/bom/add-or-update",
data: data.field data: data.field
}); });
return false; return false;
}); });
/**
* 监听行工具事件
*/
table.on('tool(js-record-table-filter)', function (obj) {
// 编辑
if (obj.event === 'delete') {
layer.confirm('确认要删除吗?', function (index) {
obj.del();
layer.close(index);
})
}
})
// 物料主数据搜索弹框
$('#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) {
console.log(result);
$('#js-materiel-code').val(result.data[0].materiel);
$('#js-materiel-name').val(result.data[0].materielDesc);
}
}
});
}
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -28,6 +28,10 @@
<!--查询参数--> <!--查询参数-->
<form id="js-search-form" class="layui-form" lay-filter="js-q-form-filter"> <form id="js-search-form" class="layui-form" lay-filter="js-q-form-filter">
<div class="layui-form-item"> <div class="layui-form-item">
<div class="layui-inline">
<a class="layui-btn " lay-submit lay-filter="js-add-order"><i
class="layui-icon ">&#xe608</i>新建生产订单</a>
</div>
<div class="layui-inline"> <div class="layui-inline">
<label class="layui-form-label">订单编号</label> <label class="layui-form-label">订单编号</label>
<div class="layui-input-inline"> <div class="layui-input-inline">
@ -53,26 +57,12 @@
</div> </div>
</div> </div>
<!--表格头操作模板-->
<script type="text/html" id="js-record-table-toolbar-top">
<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>
<button class="layui-btn layui-btn-sm" lay-event="add"><i class="layui-icon">&#xe61f;</i>添加</button>
</div>
</script>
<!--行操作模板-->
<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>
</script>
<!--js逻辑--> <!--js逻辑-->
<script src="${request.contextPath}/lib/gantt/js/jquery.fn.gantt.js" charset="utf-8"></script> <script src="${request.contextPath}/lib/gantt/js/jquery.fn.gantt.js" charset="utf-8"></script>
<script> <script>
layui.use(['form', 'table', 'spLayer', 'spTable'], function () {
var ganttData = []; var ganttData = [];
// 获取数据 // 获取数据
spUtil.ajax({ spUtil.ajax({
@ -82,8 +72,7 @@
// 是否序列化参数 // 是否序列化参数
serializable: false, serializable: false,
// 参数 // 参数
data: { data: {},
},
success: function (data) { success: function (data) {
ganttData = data.data; ganttData = data.data;
}, },
@ -103,7 +92,7 @@
tnTitle1: '物料编码', tnTitle1: '物料编码',
tnTitle2: '计划/实际', tnTitle2: '计划/实际',
onItemClick: function (data) { onItemClick: function (data) {
modifyPlan(); modifyPlan(data);
}, },
onAddClick: function (dt, rowId) { onAddClick: function (dt, rowId) {
console.log(dt) console.log(dt)
@ -115,62 +104,24 @@
} }
}); });
/**
* 修改
* @param
*/
function modifyPlan(id) {
alert(id)
}
layui.use(['form', 'table', 'spLayer', 'spTable'], function () {
var form = layui.form, var form = layui.form,
table = layui.table, table = layui.table,
spLayer = layui.spLayer, spLayer = layui.spLayer,
spTable = layui.spTable; spTable = layui.spTable;
// 表格及数据初始化
var tableIns = spTable.render({
url: '${request.contextPath}/basedata/materile/page',
cols: [
[{
type: 'checkbox'
}, {
field: 'materiel', title: '物料编码'
}, {
field: 'materielDesc', title: '物料描述'
}, {
field: 'productGroup', title: '产品组'
}, {
field: 'size', title: '尺寸'
}, {
field: 'flowDesc', title: '流程描述'
}, {
field: 'model', title: '型号'
}, {
field: 'deleted', title: '状态', templet: function (d) {
return spConfig.isDeletedDict[d.deleted];
}
}, {
fixed: 'right',
field: 'operate',
title: '操作',
toolbar: '#js-record-table-toolbar-right',
unresize: true,
width: 150
}]
],
done: function (res, curr, count) {
}
});
/* /**
* 数据表格中form表单元素是动态插入,所以需要更新渲染下 * 修改
* http://www.layui.com/doc/modules/form.html#render * @param
*/ */
$(function () { function modifyPlan(id) {
form.render(); var index = spLayer.open({
title: '添加',
area: ['90%', '90%'],
content: '${request.contextPath}/order/release/add-or-update-ui'
}); });
}
/** /**
* 搜索按钮事件 * 搜索按钮事件
@ -187,77 +138,12 @@
// 阻止表单跳转。如果需要表单跳转,去掉这段即可。 // 阻止表单跳转。如果需要表单跳转,去掉这段即可。
return false; return false;
}); });
/*
/** * 数据表格中form表单元素是动态插入,所以需要更新渲染下
* 头工具栏事件 * http://www.layui.com/doc/modules/form.html#render
*/ */
table.on('toolbar(js-record-table-filter)', function (obj) { $(function () {
var checkStatus = table.checkStatus(obj.config.id); form.render();
// 批量删除
if (obj.event === 'deleteBatch') {
var checkStatus = table.checkStatus('record-table'),
data = checkStatus.data;
if (data.length > 0) {
layer.confirm('确认要删除吗?', function (index) {
});
} else {
layer.msg("请先选择需要删除的数据!");
}
}
// 添加
if (obj.event === 'add') {
var index = spLayer.open({
title: '添加',
area: ['90%', '90%'],
content: '${request.contextPath}/basedata/materile/add-or-update-ui'
});
}
});
/**
* 监听行工具事件
*/
table.on('tool(js-record-table-filter)', function (obj) {
var data = obj.data;
// 编辑
if (obj.event === 'edit') {
spLayer.open({
title: '编辑',
area: ['90%', '90%'],
// 请求url参数
spWhere: {id: data.id},
content: '${request.contextPath}/basedata/materile/add-or-update-ui'
});
}
// 删除
if (obj.event === 'delete') {
layer.confirm('确认要删除吗?', function (index) {
spUtil.ajax({
url: '${request.contextPath}/basedata/materile/delete',
async: false,
type: 'POST',
// 是否显示 loading
showLoading: true,
// 是否序列化参数
serializable: false,
// 参数
data: {
id: data.id
},
success: function (data) {
tableIns.reload();
layer.close(index);
},
error: function () {
}
});
});
}
}); });
}); });
</script> </script>