| | |
| | | <div class="layui-form toolbar"> |
| | | <div class="layui-form-item"> |
| | | <div class="layui-inline"> |
| | | <label class="layui-form-label w-auto">课程名称:</label> |
| | | <label class="layui-form-label w-auto">单据编号:</label> |
| | | <div class="layui-input-inline mr0"> |
| | | <input name="experimentTypeName" class="layui-input" type="text" placeholder="输入课程名称"/> |
| | | <input name="experimentTypeName" class="layui-input" type="text" placeholder="输入单据编号"/> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <table id="eCourseTable" lay-filter="eCourseTable"></table> |
| | | <table id="waitMatin" lay-filter="waitMatin"></table> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <!-- 搜索栏 --> |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="bill_no" placeholder="单据编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <!-- 日期范围 --> |
| | | <div class="layui-inline" style="width: 300px"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input layui-laydate-range" id="modi_time" name="modi_time" type="text" placeholder="起始时间 - 终止时间" autocomplete="off" style="width: 300px"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="condition" placeholder="请输入" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <!-- 待添加 --> |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> |
| | | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="waitMatin" lay-filter="waitMatin"></table> |
| | | </div> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-sm" id="btn-add" lay-event="addData">新增</button> |
| | | <button class="layui-btn layui-btn-sm" id="btn-delete" lay-event="deleteData">删除</button> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData">导出</button> |
| | | </div> |
| | | </script> |
| | | |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs btn-edit" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs btn-edit" lay-event="del">删除</a> |
| | | <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="edit">修改</a> |
| | | <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a> |
| | | </script> |
| | | <!-- 表格操作列 --> |
| | | <script type="text/html" id="tbLook"> |
| | | <span class="layui-text"> |
| | | <a href="javascript:;" lay-event="look"> |
| | | <i class="layui-icon" style="font-size: 12px;"></i> 查看单据明细 |
| | | </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"> |
| | | <label class="layui-form-label">物料</label> |
| | | <div class="layui-input-block"> |
| | | <div id="mat" name="mat"> |
| | | </div> |
| | | </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> |
| | | <script type="text/javascript" src="../../static/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/js/waitMatin/waitMatin.js" charset="utf-8"></script> |
| | | <!--<script type="text/javascript" src="../../static/js/waitMatin/waitMatin.js" charset="utf-8"></script>--> |
| | | <script> |
| | | layui.use(['layer', 'form', 'table', 'util', 'admin'], function () { |
| | | var pageCurr; |
| | | layui.config({ |
| | | base: baseUrl + "/static/layui/lay/modules/" |
| | | }).use(['layer', 'form', 'table', 'util', 'admin', 'xmSelect'], function () { |
| | | var $ = layui.jquery; |
| | | var layer = layui.layer; |
| | | var form = layui.form; |
| | | var table = layui.table; |
| | | var util = layui.util; |
| | | var admin = layui.admin; |
| | | var xmSelect = layui.xmSelect; |
| | | |
| | | // 渲染表格 |
| | | var insTb = table.render({ |
| | | elem: '#waitMatin', |
| | | url: baseUrl+'/waitMatin/head/page/auth', |
| | | headers: {token: localStorage.getItem('token')}, |
| | | page: true, |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'billNo', title: '单据编号', sort: true}, |
| | | {field: 'billType$', align: 'center', title: '类型'}, |
| | | {field: 'billType$', align: 'center', title: '类型', minWidth: 140, width: 140}, |
| | | // {align: 'center', title: '星期', templet: '#eCourseTbWeek', minWidth: 350, width: 350}, |
| | | {align: 'center', title: '明细', toolbar: '#eCourseTbLook', minWidth: 140, width: 140}, |
| | | {align: 'center', title: '明细', toolbar: '#tbLook', minWidth: 140, width: 140}, |
| | | { |
| | | field: 'createTime', title: '创建时间', sort: true, templet: function (d) { |
| | | field: 'appeTime$', title: '创建时间', sort: true, templet: function (d) { |
| | | return util.toDateString(d.createTime); |
| | | }, width: 180 |
| | | }, |
| | | {align: 'center', title: '操作', toolbar: '#eCourseTbBar', minWidth: 130, width: 130} |
| | | ]] |
| | | {align: 'center', title: '操作', toolbar: '#operate', minWidth: 130, width: 130} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function (res) { |
| | | if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } |
| | | pageCurr=curr; |
| | | } |
| | | }); |
| | | |
| | | // 搜索 |
| | |
| | | }); |
| | | |
| | | // 工具条点击事件 |
| | | table.on('tool(eCourseTable)', function (obj) { |
| | | table.on('tool(waitMatin)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent == 'edit') { |
| | | if (layEvent === 'edit') { |
| | | showEditModel(data); |
| | | } else if (layEvent == 'del') { |
| | | } else if (layEvent === 'del') { |
| | | doDel(data.experimentTypeId); |
| | | } else if (layEvent == 'look') { |
| | | } else if (layEvent === 'look') { |
| | | var $a = $(obj.tr).find('a[lay-event="look"]'); |
| | | var offset = $a.offset(); |
| | | var top = offset.top; |
| | |
| | | layer.open({ |
| | | type: 1, |
| | | title: false, |
| | | area: '530px', |
| | | area: '630px', |
| | | offset: [top + 'px', (left - 530 + $a.outerWidth()) + 'px'], |
| | | shade: .01, |
| | | shadeClose: true, |
| | |
| | | success: function (layero) { |
| | | table.render({ |
| | | elem: '#lookSSXMTable', |
| | | url: '../../json/e-course-tb2.json?experimentTypeId=' + data.experimentTypeId, |
| | | headers: {token: localStorage.getItem('token')}, |
| | | url: baseUrl+'/waitMatin/list/auth', |
| | | where: { |
| | | bill_no: data.billNo |
| | | }, |
| | | page: true, |
| | | cellMinWidth: 100, |
| | | cols: [[ |
| | | {type: 'numbers'}, |
| | | {field: 'experimentName', title: '项目名称', sort: true}, |
| | | {field: 'matNo', title: '物料编码'}, |
| | | {field: 'matName', title: '物料名称', width: 160}, |
| | | {field: 'qty', title: '数量'}, |
| | | { |
| | | field: 'createTime', title: '创建时间', sort: true, templet: function (d) { |
| | | field: 'createTime$', title: '创建时间', sort: true, templet: function (d) { |
| | | return util.toDateString(d.createTime); |
| | | } |
| | | }, width: 180 |
| | | } |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | | pageSize: 'limit' |
| | | }, |
| | | parseData: function (res) { |
| | | return { |
| | | 'code': res.code, |
| | | 'msg': res.msg, |
| | | 'count': res.data.total, |
| | | 'data': res.data.records |
| | | } |
| | | }, |
| | | response: { |
| | | statusCode: 200 |
| | | }, |
| | | done: function () { |
| | | $(layero).find('.layui-table-view').css('margin', '0'); |
| | | }, |
| | |
| | | function showEditModel(expTpe) { |
| | | admin.open({ |
| | | type: 1, |
| | | title: (expTpe ? '修改' : '添加') + '实验课程', |
| | | content: $('#eCourseEditDialog').html(), |
| | | title: (expTpe ? '修改' : '添加') + '单据', |
| | | 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) { |
| | |
| | | layer.load(2); |
| | | $.get(url, data.field, function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code == 200) { |
| | | if (res.code === 200) { |
| | | layer.close(dIndex); |
| | | insTb.reload({page: {curr: 1}}); |
| | | layer.msg(res.msg, {icon: 1}); |
| | |
| | | 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 () { |
| | |
| | | table.on('tool(formSSXMTable)', function (obj) { |
| | | var data = obj.data; |
| | | var layEvent = obj.event; |
| | | if (layEvent == 'edit') { |
| | | if (layEvent === 'edit') { |
| | | showEditModel2(data); |
| | | } else if (layEvent == 'del') { |
| | | } else if (layEvent === 'del') { |
| | | layer.confirm('确定要删除吗?', { |
| | | shade: .1, |
| | | skin: 'layui-layer-admin' |
| | |
| | | layer.close(i); |
| | | if (isExpAdd) { // 前端处理删除 |
| | | for (var j = 0; j < xxDataList.length; j++) { |
| | | if (xxDataList[j].experimentId = data.experimentId) { |
| | | if (xxDataList[j].experimentId === data.experimentId) { |
| | | xxDataList.splice(j, 1); |
| | | } |
| | | } |
| | |
| | | experimentId: data.experimentId |
| | | }, function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code == 200) { |
| | | if (res.code === 200) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb.reload({page: {curr: 1}}); |
| | | insTbSSXM.reload({page: {curr: 1}}); |
| | |
| | | showEditModel2(); |
| | | }); |
| | | |
| | | // 显示表单弹窗 |
| | | // 显示添加明细表单弹窗 |
| | | function showEditModel2(exp) { |
| | | 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; |
| | | } |
| | |
| | | } |
| | | $.get(url, {json: JSON.stringify(data.field)}, function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code == 200) { |
| | | if (res.code === 200) { |
| | | layer.close(dIndex); |
| | | insTbSSXM.reload({page: {curr: 1}}); |
| | | layer.msg(res.msg, {icon: 1}); |
| | |
| | | } |
| | | return false; |
| | | }); |
| | | // 渲染物料选择 |
| | | var matXmSelect = xmSelect.render({ |
| | | el: '#mat', |
| | | radio: true, |
| | | autoRow: true, |
| | | toolbar: { show: true }, |
| | | filterable: true, |
| | | remoteSearch: true, |
| | | remoteMethod: function(val, cb, show){ |
| | | //这里如果val为空, 则不触发搜索 |
| | | // if(!val){ |
| | | // return cb([]); |
| | | // } |
| | | $.ajax({ |
| | | url: baseUrl+"/mat/all/get/kv", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | condition: val |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | | if (res.code === 200){ |
| | | cb(res.data) |
| | | } else { |
| | | cb([]); |
| | | layer.msg(res.msg, {icon: 2}); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }) |
| | | // 弹窗不出现滚动条 |
| | | $(layero).children('.layui-layer-content').css('overflow', 'visible'); |
| | | layui.form.render('select'); |
| | | } |
| | | }); |
| | | } |
| | |
| | | experimentTypeId: experimentTypeId |
| | | }, function (res) { |
| | | layer.closeAll('loading'); |
| | | if (res.code == 200) { |
| | | if (res.code === 200) { |
| | | layer.msg(res.msg, {icon: 1}); |
| | | insTb.reload({page: {curr: 1}}); |
| | | } else { |