<!DOCTYPE HTML> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <meta charset="utf-8"> <head th:include="include :: header"></head> <body class="gray-bg"> <div class="container-div"> <div class="row"> <div class="col-sm-12 select-info"> <ul id="myTab" class="nav nav-tabs"> <li class="active"><a href="#tabHeader" data-toggle="tab">主表</a></li> <li><a href="#tabDetail" data-toggle="tab">明细</a></li> <li><a href="#registration" data-toggle="tab">质检登记</a></li> </ul> <div id="myTabContent" class="tab-content"> <div class="tab-pane fade in active" id="tabHeader"> <div class="col-sm-12 select-info"> <form id="receiptHeader-form"> <div class="select-list"> <ul> <li> 编码:<input type="text" name="code"/> </li> <li> 入库单编码:<input type="text" name="referCode"> </li> <li>状态: <select name="lastStatus"> <option value="">所有</option> <option value="0">新建</option> </select> </li> <li class="time"> <label>创建时间: </label> <input type="text" class="time-input" id="startCreatedTime" placeholder="开始时间" name="createdBegin"/> <span>-</span> <input type="text" class="time-input" id="endCreatedTime" placeholder="结束时间" name="createdEnd"/> </li> <li> <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> </li> </ul> </div> </form> </div> <!--<div class="btn-group hidden-xs" id="toolbar" role="group"> <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="receipt:receiptHeader:remove"> <i class="fa fa-trash-o"></i> 删除 </a> </div>--> <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table> </div> <div class="tab-pane fade" id="tabDetail"> <table id="bootstrap-table1" data-mobile-responsive="true" class="table table-bordered table-hover"></table> </div> <div class="tab-pane fade" id="registration"> <div class="col-sm-12 select-info"> <form id="registration-form"> <div class="select-list"> <ul> <li> 质检单号:<input type="text" name="checkCode"/> </li> <li> 入库单号:<input type="text" name="receiptCode"/> </li> <li> 关联单号:<input type="text" name="referCode"/> </li> <li> 关联行号:<input type="text" name="referLineId"/> </li> <li> 物料编码:<input type="text" name="materialCode"/> </li> <li> 物料名称:<input type="text" name="materialName"/> </li> <li> 质检人:<input type="text" name="checkBy"/> </li> <li class="time"> <label>创建时间: </label> <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[createdBegin]"/> <span>-</span> <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[createdEnd]"/> </li> <li> <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a> <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset('registration-form')"><i class="fa fa-refresh"></i> 重置</a> </li> </ul> </div> </form> </div> <div class="btn-group hidden-xs" id="toolbarReg" role="group"> <a class="btn btn-outline btn-success btn-rounded" onclick="complete()" shiro:hasPermission="check:checkingRegister:remove"> <i class="fa fa-check-circle-o"></i> 质检完成 </a> <a class="btn btn-outline btn-danger btn-rounded" onclick="$.operate.batRemove()" shiro:hasPermission="check:checkingRegister:remove"> <i class="fa fa-trash-o"></i> 删除 </a> </div> <div class="col-sm-12 select-info"> <table id="bootstrap-table2" data-mobile-responsive="true" class="table table-bordered table-hover"></table> </div> </div> </div> </div> </div> </div> <div th:include="include :: footer"></div> <script th:inline="javascript"> var prefix = ctx + "check/checkHeader"; var prefix1 = ctx + "check/checkDetail"; var prefix2 = ctx + "check/checkingRegister"; var editFlag = [[${@permission.hasPermi('check:checkHeader:edit')}]]; var removeFlag = [[${@permission.hasPermi('check:checkHeader:remove')}]]; var receiptTypes = [[${@receiptTypeService.getType()}]]; var checkHeaderStatus = [[${@dict.getType('checkHeaderStatus')}]]; var checkDetailStatus = [[${@dict.getType('checkDetailStatus')}]]; var inventorySts = [[${@dict.getType('inventorySts')}]]; var printFlag = [[${@permission.hasPermi('check:checkHeader:report')}]]; var addFlag= [[${@permission.hasPermi('check:checkHeader:add')}]]; var datas = [[${@dict.getType('sys_normal_disable')}]]; var type = [[${@dict.getType('checkType')}]]; var checkId = 0; var checkHeaderCode = 0; var checkDetailId = 0; $(function() { var options = { url: prefix + "/list", createUrl: prefix + "/add", updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", queryParams: queryParams, modalName: "流程", search: false, sortName: "id", sortOrder: "desc", columns: [{ checkbox: true }, { field : 'id', title : '入库单id' }, { field : 'code', title : '编码' }, { field : 'type', title : '质检类型', align: 'center', formatter: function(value, row, index) { var actions = []; $.each(type, function(index, dict) { if (dict.remark == value) { actions.push("<span class='badge badge-" + dict.listClass + "'>" + dict.dictLabel + "</span>"); return false; } }); return actions.join(''); } }, { field : 'referCode', title : '关联单号' }, { field : 'referPlatform', title : '关联平台' }, { field : 'enable', title : '是否有效', align: 'center', formatter: function(value, row, index) { return $.table.selectDictLabel(datas, value); } }, { field : 'status', title : '状态', align: 'center', formatter: function (value, row, index) { return $.table.selectDictLabel(checkHeaderStatus, value); } }, { field : 'closedBy', title : '关闭人' }, { field : 'closedAt', title : '关闭日期' }, { field : 'created', title : '创建时间', sortable:true, visible:false }, { field : 'createdBy', title : '创建用户', visible:false }, { field : 'lastUpdated', title : '最后修改时间', sortable:true, visible:false }, { field : 'lastUpdatedBy', title : '更新用户', visible:false }, { field : 'userDef1', title : '自定义字段1', visible: false }, { field : 'userDef2', title : '自定义字段2', visible: false }, { field : 'userDef3', title : '自定义字段3' , visible: false }, { title: '操作', align: 'center', formatter: function(value, row, index) { var actions = []; actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-trash-o"></i>删除</a>'); return actions.join(''); } }] }; $.table.init(options); }); //质检明细表格初始化 $("#bootstrap-table1").bootstrapTable({ createUrl: prefix1 + "/add", updateUrl: prefix1 + "/edit/{id}", removeUrl: prefix1 + "/remove", queryParams: queryParams, modalName: "质检明细", sortName: "lastUpdated", sortOrder: "desc", iconSize: "outline", toolbar: "#toolbar1", pagination: true, // 是否显示分页(*) pageNumber: 1, // 初始化加载第一页,默认第一页 pageSize: 50, // 每页的记录行数(*) pageList: [10, 25, 50, 100], // 可供选择的每页的行数(*) onRefresh: function(){ loadDetail(); }, columns: [{ checkbox: true }, { field : 'id', title : 'id', visible: false }, { field : 'checkHeaderId', title : '质检头id', visible : false }, { field : 'warehouseCode', title : '仓库编码', visible : false }, { field : 'checkCode', title : '质检单编码' }, { field : 'inventoryDetailId', title : '库存明细标识', visible : false }, { field : 'locationCode', title : '库位编码' }, { field : 'containerCode', title : '容器编码' }, { field : 'receiptDetailId', title : '入库单明细标识', visible : false }, { field : 'receiptCode', title : '入库单号' }, { field : 'referCode', title : '关联单号' }, { field : 'referLineId', title : '关联行号' }, { field : 'referPlatform', title : '关联平台' }, { field : 'materialCode', title : '物料编码' }, { field : 'materialName', title : '物料名称' }, { field : 'materialSpec', title : '物料规格' }, { field : 'materialUnit', title : '物料单位' }, { field : 'companyCode', title : '货主代码' }, { field : 'inventorySts', title : '库存状态', align: 'center', formatter: function (value, row, index) { return $.table.selectDictLabel(inventorySts, value); } }, { field : 'status', title : '状态', align: 'center', formatter: function (value, row, index) { return $.table.selectDictLabel(checkDetailStatus, value); } }, { field : 'qty', title : '系统数量' }, { field : 'checkBy', title : '质检人' }, { field : 'checkAt', title : '质检时间' }, { field : 'created', title : '创建时间' }, { field : 'createdBy', title : '创建用户' }, { title: '操作', align: 'center', formatter: function(value, row, index) { var actions = []; actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); return actions.join(''); } }], onDblClickRow: function (row) { if (typeof detail != 'undefined') { detailReg(row.id) } } }); //质检登记表格初始化 $("#bootstrap-table2").bootstrapTable({ editable: true, clickEdit: true, clickToSelect: true, cache: false, showToggle:true, //显示切换按钮来切换表/卡片视图。 showPaginationSwitch:false, //显示分页切换按钮 pagination: true, idePagination: "server", queryParamsType: "params", pageList: [10,25,50], pageNumber: 1, uniqueId: "id", toolbar: "#toolbarReg", iconSize: 'outline', showRefresh: true, showColumns: true, showExport: true, smartDisplay:true, url: prefix2 + "/list", modalName: "质检报告", method: "post", search: false, sortName: "id", sortOrder: "desc", sortable: true, onRefresh: function(){ loadReg(); }, columns: [{ checkbox: true }, { field : 'id', title : 'id' }, { field : 'checkDetailId', title : '质检明细标识', visible : false }, { field : 'checkHeaderId', title : '头表标识', visible : false }, { field : 'warehouseCode', title : '仓库代码', visible : false }, { field : 'checkCode', title : '质检单号', align:"center", order:"asc", sortable:"true" }, { field : 'receiptDetailId', title : '入库单明细标识' , visible:false }, { field : 'receiptCode', title : '入库单号' }, { field : 'referCode', title : '关联单号' }, { field : 'referLineId', title : '关联行号' , visible:false }, { field : 'referPlatform', title : '关联平台' , visible:false }, { field : 'materialCode', title : '物料编码' }, { field : 'materialName', title : '物料名称' }, { field : 'materialSpec', title : '物料规格' }, { field : 'materialUnit', title : '物料单位' }, { field : 'companyCode', title : '货主编码' , visible:false }, { field : 'inventorySts', title : '库存状态', align: 'center', formatter: function (value, row, index) { return $.table.selectDictLabel(inventorySts, value); } }, { field : 'qty', title : '数量', editable: { type: 'text', title: '数量', validate: function (v) { if (isNaN(v)) return '数量必须是数字'; var age = parseInt(v); if (age < 0) return '数量必须是正整数'; } } }, { field : 'checkBy', title : '质检人' }, { field : 'checkAt', title : '质检时间' }, { field : 'created', title : '创建时间' }, { field : 'createdBy', title : '创建用户' }, { field : 'lastUpdated', title : '更新时间' }, { field : 'lastUpdatedBy', title : '更新用户' }, { field : 'userDef1', title : '自定义字段1' , visible:false }, { field : 'userDef2', title : '自定义字段2' , visible:false }, { field : 'userDef3', title : '自定义字段3' , visible:false }], onClickRow: function (row, $element) { curRow = row; }, onEditableSave: function (field, row, oldValue, $el) { $.ajax({ type: "post", url: prefix2+"/edit", data: row, dataType: 'JSON', success: function (data, status) { if (status != "success") { alert('提交数据失败'); } }, error: function () { alert('编辑失败'); }, complete: function () { } }); } }); /* 质检单列表-详细 */ function detail(id, code) { checkId = id; checkHeaderCode = code; $("#myTab li").removeClass("active"); $("#tabHeader").removeClass("in active"); $("#myTab li:eq(1)").addClass("active"); $("#tabDetail").addClass("in active"); loadDetail(); } function detailReg(id) { checkDetailId = id; $("#myTab li:eq(1)").removeClass("active"); $("#tabDetail").removeClass("in active"); $("#myTab li:eq(2)").addClass("active"); $("#registration").addClass("in active"); loadReg(); } /* 质检单列表-详细 */ function loadDetail() { $.ajax({ url:prefix1+'/list', type:"post", data:{ checkHeaderId: checkId, }, success:function (value) { $("#bootstrap-table1").bootstrapTable('load',value.data); } }); } /* 质检登记*/ function loadReg(params) { $.ajax({ url:prefix2+'/list', type:"post", data:{ checkDetailId: checkDetailId }, success:function (value) { $("#bootstrap-table2").bootstrapTable('load',value.data); } }); } function queryParams(params) { return { type:[[${type}]], pageSize: params.limit, pageNum: params.offset / params.limit + 1, searchValue: params.search, orderByColumn: params.sort, isAsc: params.order }; }; function complete() { var url = prefix1+"/complete"; var data = {id: checkDetailId}; $.operate.submit(url, "post", "json", data); } layui.use('laydate', function(){ var laydate = layui.laydate; var day1 = new Date(); day1.setTime(day1.getTime()-24*60*60*1000*7); //执行一个laydate实例 laydate.render({ elem: '#startCreatedTime' //指定元素 ,theme: 'molv',value: new Date(day1), isInitValue: true }); laydate.render({ elem: '#endCreatedTime', theme: 'molv',value: new Date(), isInitValue: true }) }); </script> </body> </html>