| | |
| | | </a> |
| | | </span> |
| | | </script> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="editDialog"> |
| | | <form id="editForm" lay-filter="editForm" class="layui-form model-form"> |
| | | <input name="experimentTypeId" type="hidden"/> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">单据编号:</label> |
| | | <div class="layui-input-block"> |
| | | <input name="experimentTypeName" placeholder="输入单据编号" type="text" class="layui-input" maxlength="20" lay-verType="tips" lay-verify="required"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item" style="position: relative;"> |
| | | <label class="layui-form-label">单据明细:</label> |
| | | <div class="layui-input-block"> |
| | | <table id="formSSXMTable" lay-filter="formSSXMTable"></table> |
| | | </div> |
| | | <button class="layui-btn layui-btn-sm icon-btn" id="demoEDeCourseAddBtnComment" |
| | | style="position: absolute; left: 20px;top: 60px;padding: 0 5px;" type="button"> |
| | | <i class="layui-icon"></i>添加明细 |
| | | </button> |
| | | </div> |
| | | <div class="layui-form-item text-right"> |
| | | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> |
| | | <button class="layui-btn" lay-filter="eCourseEditSubmit" lay-submit>保存</button> |
| | | </div> |
| | | </form> |
| | | </script> |
| | | <!-- 表单弹窗 --> |
| | | <script type="text/html" id="eCourseCouEditDialog"> |
| | | <form id="eCourseCouEditForm" lay-filter="eCourseCouEditForm" class="layui-form model-form"> |
| | | <input name="experimentId" type="hidden"/> |
| | | <div class="layui-form-item"> |
| | | <label class="layui-form-label">物料编码:</label> |
| | | <div class="layui-input-block"> |
| | | <input name="experimentName" placeholder="请输入物料编码" type="text" class="layui-input" maxlength="20" |
| | | lay-verType="tips" lay-verify="required"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-form-item text-right"> |
| | | <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button> |
| | | <button class="layui-btn" lay-filter="eCourseCouEditSubmit" lay-submit>保存</button> |
| | | </div> |
| | | </form> |
| | | </script> |
| | | |
| | | <script type="text/javascript" src="../../static/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/layui/layui.js" charset="utf-8"></script> |
| | |
| | | admin.open({ |
| | | type: 1, |
| | | title: (expTpe ? '修改' : '添加') + '单据', |
| | | content: $('#eCourseEditDialog').html(), |
| | | content: $('#editDialog').html(), |
| | | area: '700px', |
| | | success: function (layero, dIndex) { |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | var url = expTpe ? '../../json/ok.json' : '../../json/ok.json'; |
| | | var isExpAdd = expTpe ? false : true; |
| | | // 回显数据 |
| | | form.val('eCourseEditForm', expTpe); |
| | | form.val('editForm', expTpe); |
| | | // 表单提交事件 |
| | | form.on('submit(eCourseEditSubmit)', function (data) { |
| | | if (isExpAdd) { |
| | |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'experimentName', title: '项目名称', sort: true}, |
| | | { |
| | | field: 'createTime', title: '创建时间', sort: true, templet: function (d) { |
| | | return util.toDateString(d.createTime); |
| | | } |
| | | }, |
| | | {field: 'matNo', title: '物料编码'}, |
| | | {field: 'matName', title: '物料名称', width: 160}, |
| | | {field: 'qty', title: '数量'}, |
| | | {align: 'center', title: '操作', toolbar: '#eCourseCouTbBar', minWidth: 120, width: 120} |
| | | ]], |
| | | done: function () { |
| | |
| | | admin.open({ |
| | | type: 1, |
| | | offset: '150px', |
| | | title: (exp ? '修改' : '添加') + '项目', |
| | | title: (exp ? '修改' : '添加') + '明细', |
| | | content: $('#eCourseCouEditDialog').html(), |
| | | success: function (layero, dIndex) { |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | |
| | | if (isExpAdd) { // 前端处理添加、修改 |
| | | if (exp) { // 前端修改 |
| | | for (var i = 0; i < xxDataList.length; i++) { |
| | | if (xxDataList[i].experimentName == data.field.experimentName && xxDataList[i].experimentId != data.field.experimentId) { |
| | | if (xxDataList[i].experimentName === data.field.experimentName && xxDataList[i].experimentId !== data.field.experimentId) { |
| | | layer.msg('实验项目名称已存在', {icon: 2}); |
| | | return false; |
| | | } |
| | | } |
| | | layer.close(dIndex); |
| | | for (var j = 0; j < xxDataList.length; j++) { |
| | | if (xxDataList[j].experimentId == data.field.experimentId) { |
| | | if (xxDataList[j].experimentId === data.field.experimentId) { |
| | | xxDataList[j].experimentName = data.field.experimentName; |
| | | } |
| | | } |
| | | insTbSSXM.reload({data: xxDataList, page: {curr: 1}}); |
| | | } else { // 前端添加 |
| | | for (var i = 0; i < xxDataList.length; i++) { |
| | | if (xxDataList[i].experimentName == data.field.experimentName) { |
| | | if (xxDataList[i].experimentName === data.field.experimentName) { |
| | | layer.msg('实验项目名称已存在', {icon: 2}); |
| | | return false; |
| | | } |