shipmentContainerHeader.html 11.1 KB
<!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="white-bg">
    <div class="container-div">
		<div class="row">
			<div class="row">
				<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>
				</ul>
				<div id="myTabContent" class="tab-content">
					<div class="tab-pane fade in active" id="tabHeader">
						<div class="col-sm-12 select-info">
							<div class="col-sm-12 select-info">
								<form id="shipmentContainerHeader-form">
									<div class="select-list">
										<ul>
											<li>
												容 器 号:<input type="text" name="shipmentContainerCode"/>
											</li>
											<li>
												<!--入库类型:<input type="text" name="sourceCode"/>-->
												任务类型:<select name="taskType" th:with="type=${@dict.getType('taskType')}">
												<option value="">所有</option>
												<option th:each="e : ${type}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option></select>
											</li>
											<!--<li>-->
												<!--库位编码:<input type="text" name="locationCode"/>-->
											<!--</li>-->
											<li>
												<!--头 状 态:<input type="text" name="firstStatus"/>-->
												容器状态:<select name="status" th:with="firstStatus=${@dict.getType('shipmentContainerHeaderStatus')}">
												<option value="">所有</option>
												<option th:each="e : ${firstStatus}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option></select>
											</li>

											<li>
												创 建 人:<input type="text" name="createdBy"/>
											</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>&nbsp;搜索</a>
												<!--<a class="btn btn-success btn-rounded btn-sm" onclick="$.table.exportExcel()" shiro:hasPermission="receipt:receiptHeader:export"><i class="fa fa-download"></i>&nbsp;导出</a>-->
											</li>
										</ul>
									</div>
								</form>
							</div>
							<table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
						</div>
					</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>

			</div>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('shipment:container:edit')}]];
        var removeFlag = [[${@permission.hasPermi('shipment:container:remove')}]];
        var prefix = ctx + "shipment/shipmentContainerHeader"
        var prefix1 = ctx + "shipment/shipmentContainerDetail";
        var taskTypes=[[${@dict.getType('taskType')}]];
        var firstStatus=[[${@dict.getType('shipmentContainerHeaderStatus')}]];
        var createTaskFlag = [[${@permission.hasPermi('shipment:container:createTask')}]]


        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                modalName: "出库组盘明细",
                sortName: "created",
                sortOrder: "desc",
                search: false,
                columns: [
                    {
		            checkbox: true
		        },
				{
					field : 'id', 
					title : 'id'
				},
				{
					field : 'shipmentContainerCode', 
					title : '容器编号',
					sortable:true
				},
				{
					field : 'warehouseId', 
					title : '仓库id号' ,
					visible:false
				},
				{
					field : 'warehouseCode', 
					title : '仓库编号' ,
					visible:false
				},
				{
					field : 'taskType', 
					title : '类型' ,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(taskTypes, value);
                    },sortable:true
				},
				{
					field : 'status', 
					title : '容器任务状态' ,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(firstStatus, value);
                    },sortable:true
				},
				{
					field : 'created', 
					title : '创建日期' ,
					sortable:true
				},
				{
					field : 'createdBy', 
					title : '创建人' ,
					sortable:true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-info btn-xs " href="#" onclick="detail(\'' + row.id + '\')"><i class="fa fa-list-ul"></i>列表</a> ');
                        actions.push('<a class="btn btn-primary btn-xs ' + createTaskFlag + '" href="#" onclick="createTask(\'' + row.id + '\')"><i class="fa fa-cab"></i>生成任务</a>');
                        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('');
		            }
		        }]
            };
            $.table.init(options);
        });

        $("#bootstrap-table1").bootstrapTable({
            // url: prefix1 + "/headerId",
            // createUrl: prefix1 + "/add",
            // updateUrl: prefix1 + "/edit/{id}",
            // removeUrl: prefix1 + "/remove",
            // search: true, //搜索
            sortable: true, //排序
            showRefresh: true, //刷新
            showToggle:true, //视图切换
            clickToSelect: false,
            showColumns:true, //列选择
            // detailView:true,
            showExport: true, //导出
            exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
            modalName: "出库明细",
            iconSize: "outline",
            toolbar: "#toolbar1",
            contentType: "application/x-www-form-urlencoded",
            columns: [{
                checkbox: true
            },
                {
                    field : 'id',
                    title : 'id号',
                    sortable:true
                },
                {
                    field : 'headerId',
                    title : '容器标识'
                },
                {
                    field : 'shipmentDetailId',
                    title : '明细标识'
                },
                {
                    field : 'shipmentHeaderId',
                    title : '单头标识'
                },
                {
                    field : 'materialCode',
                    title : '物料编码',
                    sortable:true
                },
                {
                    field : 'materialName',
                    title : '物料名称',
                    sortable:true
                },
                {
                    field : 'inventoryId',
                    title : '库存标识',
                    sortable:true
                },
                {
                    field : 'qty',
                    title : '组盘数量',
                    sortable:true
                },
                {
                    field : 'created',
                    title : '创建时间',
                    sortable:true
                },
                {
                    field : 'createdBy',
                    title : '创建用户',
                    sortable:true
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        // actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        });

        function createtable(url,headerId) {
            // $("#tabDetail").children().remove();
            $("#myTab li").removeClass("active");
            $(".tab-pane").removeClass("in active");
            $("#myTab li:eq(1)").addClass("active");
            $("#tabDetail").addClass("in active");
            $.ajax({
                url:url,
                type: 'post',
                data:{
                    headerId:headerId
                },
                success : function (value) {
                    // console.log(value);
                    $("#bootstrap-table1").bootstrapTable('removeAll');
                    for (var i = value.rows.length-1; i >=0 ; i--) {
                        $("#bootstrap-table1").bootstrapTable('insertRow', {
                            index: 0, row: {
                                id: value.rows[i].id,
                                headerId: value.rows[i].headerId,
                                receiptDetailId: value.rows[i].receiptDetailId,
                                materialCode:value.rows[i].materialCode,
                                batch:value.rows[i].batch,
                                lot:value.rows[i].lot,
                                qty:value.rows[i].qty,
                                created: value.rows[i].created,
                                createdBy: value.rows[i].createdBy
                            }
                        });
                    }
                }
            })
        }

        /*入库单列表-详细*/
        function detail(headerId) {
            var url = prefix1 + '/list/';
            // createMenuItem(url, "入库组盘明细");
            createtable(url,headerId);
        }

        function remove(id) {
            $.modal.confirm("确定删除该条明细信息吗?", function() {
                var url = $.common.isEmpty(id) ? removeUrl1 : removeUrl1.replace("{id}", id);
                var data = { "ids": id };
                submit(url, "post", "json", data);
            });
        }

        function createTask(id) {
            var url = 'shipmentContainerHeader/createTask';
            var data = { "id" : id };
            $.operate.post(url, data);
        }

    </script>
</body>
</html>