Blame view

src/main/resources/templates/receipt/receiptContainerHeader/receiptContainerHeader.html 13.6 KB
tangying authored
1
2
3
4
5
<!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">
6
7
8
9
10
11
12
13
14
<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>
            </ul>
            <div id="myTabContent" class="tab-content">
                <div class="tab-pane fade in active" id="tabHeader">
tangying authored
15
16
                    <div class="col-sm-12 select-info">
pengyongcheng authored
17
                        <form id="receiptContainerHeader-form" autocomplete="off">
18
19
                            <div class="select-list">
                                <ul>
pengyongcheng authored
20
21
22
                                    <!--<li>
                                        <label>入库单号:</label><input type="text" name="receiptCode"/>
                                    </li>-->
23
                                    <li>
pengyongcheng authored
24
                                        <label>容器编号:</label><input type="text" name="receiptContainerCode"/>
25
26
                                    </li>
                                    <li>
pengyongcheng authored
27
                                        <label>库位编号:</label><input type="text" name="toLocation"/>
28
29
                                    </li>
                                    <li>
pengyongcheng authored
30
31
32
33
34
                                        <label>任务类型:</label>
                                        <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>
35
36
                                    </li>
                                    <li>
pengyongcheng authored
37
38
39
40
41
                                        <label>组盘状态:</label>
                                        <select name="status" th:with="firstStatus=${@dict.getType('receiptContainerHeaderStatus')}">
                                            <option value="">所有</option>
                                            <option th:each="e : ${firstStatus}" th:text="${e['dictLabel']}" th:value="${e['dictValue']}"></option>
                                        </select>
42
43
                                    </li>
                                    <li>
pengyongcheng authored
44
                                        <label>创 建 人:</label><input type="text" name="createdBy"/>
45
46
                                    </li>
                                    <li class="time">
pengyongcheng authored
47
48
49
                                        <label>创建时间:</label>
                                        <input type="text" style="width: 19.5%" class="time-input" id="startTime" placeholder="开始时间"
                                               name="createdBegin"/>
50
                                        <span>-</span>
pengyongcheng authored
51
52
                                        <input type="text" style="width: 19.5%" class="time-input" id="endTime" placeholder="结束时间"
                                               name="createdEnd"/>
53
54
55
56
57
                                    </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-warning btn-rounded btn-sm" onclick="$.form.reset('receiptContainerHeader-form')"><i
                                                class="fa fa-refresh"></i>&nbsp;重置</a>
58
                                    </li>
59
60
61
62
63
64
65
66
67
68
69
70
71
72
                                </ul>
                            </div>
                        </form>
                    </div>
                    <div class="btn-group hidden-xs" id="toolbar" role="group">
                        <a class="btn btn-outline btn-success btn-rounded" onclick="batchCreateTask()"
                           shiro:hasPermission="receipt:receiptContainer:add">
                            <i class="fa fa-edit"></i> 批量生成任务
                        </a>
                        <a class="btn btn-outline btn-danger btn-rounded" onclick="batchRemoveHead()"
                           shiro:hasPermission="receipt:receiptContainer:remove">
                            <i class="fa fa-remove"></i> 批量撤销组盘
                        </a>
                    </div>
73
74
75
                    <div class="col-sm-12 select-table">
                        <table id="bootstrap-table" data-mobile-responsive="true" class="table table-bordered table-hover"></table>
                    </div>
76
77
78
79
80
81
                </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>
tangying authored
82
    </div>
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    let createTaskFlag = [[${@permission.hasPermi('receipt:receiptContainer:add')}]];
    let removeFlag = [[${@permission.hasPermi('receipt:receiptContainer:remove')}]];
    let prefix = ctx + "receipt/receiptContainerHeader";
    let detailPrefix = ctx + "receipt/receiptContainerDetail";
    let taskType = [[${@dict.getType('taskType')}]];
    let receiptContainerHeaderStatus = [[${@dict.getType('receiptContainerHeaderStatus')}]]  //容器状态
    let shipmentHeaderId;
    $(function () {
        let options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            sortName: "created",
            sortOrder: "desc",
            modalName: "入库组盘头",
            search: false,
            columns: [{
                checkbox: true,
                formatter: function (value, row, index) {
                    if (row.status < 10) {
                        return {
                            checked: true,
                            disabled: false
                        }
                    } else {
                        return {
                            checked: false,
                            disabled: true
                        }
                    }
                }
            },
                {
                    field: 'containerCode',
                    title: '容器编号'
                },
                {
                    field: 'toLocation',
                    title: '库位编号'
                },
                {
                    field: 'taskType',
                    title: '任务类型',
tangying authored
130
                    align: 'center',
131
                    formatter: function (value, row, index) {
132
                        return $.table.selectDictLabel(taskType, value);
133
134
135
136
137
138
                    }
                },
                {
                    field: 'status',
                    title: '组盘状态',
                    formatter: function (value, row, index) {
tangying authored
139
                        return $.table.selectDictLabel(receiptContainerHeaderStatus, value);
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
                    },
                    sortable: true
                },
                {
                    field: 'created',
                    title: '创建时间'
                },
                {
                    field: 'createdBy',
                    title: '创建人'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        let actions = [];
tangying authored
156
                        actions.push('<a class="btn btn-info btn-xs " href="#" onclick="detail(\'' + row.id + '\')"><i class="fa fa-list-ul"></i>明细</a> ');
157
158
159
160
161
162
163
164
                        if (row.status < 10) {
                            if (row.taskType === 200) {
                                actions.push('<a class="btn btn-success btn-xs ' + createTaskFlag + '" href="#" onclick="chooseStation(\'' + row.id + '\')"><i class="fa fa-edit"></i>生成任务</a> ');
                            } else {
                                actions.push('<a class="btn btn-success btn-xs ' + createTaskFlag + '" href="#" onclick="createTask(\'' + row.id + '\')"><i class="fa fa-edit"></i>生成任务</a> ');
                            }
                        }
                        if (row.status === 0) {
165
                            actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>取消组盘</a>');
166
167
168
169
170
171
172
                        }
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
tangying authored
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
    $("#bootstrap-table1").bootstrapTable({
        // url: detailPrefix + "/headerId",
        // createUrl: detailPrefix + "/add",
        // updateUrl: detailPrefix + "/edit/{id}",
        // removeUrl: detailPrefix + "/remove",
        // search: true, //搜索
        sortable: true, //排序
        showRefresh: true, //刷新
        showToggle: true, //视图切换
        clickToSelect: true,
        showColumns: true, //列选择
        // detailView:true,
        showExport: true, //导出
        exportDataType: "all",  //导出类型basic', 'all', 'selected'.当前页、所有数据、选中数据
        modalName: "入库明细",
        iconSize: "outline",
        toolbar: "#toolbar1",
        contentType: "application/x-www-form-urlencoded",
        columns: [
tangying authored
193
            {
194
195
                field: 'receiptCode',
                title: '入库单号'
tangying authored
196
197
            },
            {
198
199
                field: 'materialCode',
                title: '物料编码'
tangying authored
200
201
            },
            {
202
203
                field: 'materialName',
                title: '物料名称'
tangying authored
204
205
            },
            {
206
207
                field: 'materialSpec',
                title: '物料规格'
tangying authored
208
            },
209
            {
210
211
212
213
214
215
                field: 'materialUnit',
                title: '物料单位'
            },
            {
                field: 'batch',
                title: '批次',
tangying authored
216
            },
217
            /*{
tangying authored
218
219
220
                field : 'lot',
                title : '批号',
                sortable:true
221
222
223
224
            },
           /* {
                field: 'project',
                title: '项目号'
tangying authored
225
226
            },*/
            {
227
228
                field: 'qty',
                title: '组盘数量'
tangying authored
229
230
            },
            {
231
232
233
                field: 'created',
                title: '创建时间',
                sortable: true
tangying authored
234
235
            },
            {
236
237
                field: 'createdBy',
                title: '创建用户'
tangying authored
238
            },
239
240
        ]
    });
tangying authored
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
    function createtable(url, headerId) {
        $("#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) {
                $("#bootstrap-table1").bootstrapTable('load', value.data);
            }
        })
    }
tangying authored
258
259
260
261
262
263
264
    /*入库单列表-详细*/
    function detail(headerId) {
        let url = detailPrefix + "/list/" + headerId;
        shipmentHeaderId = headerId;
        createtable(url, shipmentHeaderId);
    }
tangying authored
265
266
267
268
269
270
271
272
273
274
    /* 单个删除组盘明细 */
    function remove(id) {
        $.modal.confirm("确定删除该条明细信息吗?", function () {
            let url = detailPrefix + "/remove";
            let data = {"id": id};
            $.operate.post(url, data);
            createtable(url, shipmentHeaderId);
        });
    }
tangying authored
275
276
277
278
279
280
281
282
283
284
285
286
287
    /* 批量删除组盘 */
    function batchRemoveHead() {
        let rows = $("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length === 0) {
            $.modal.msgWarning("请至少选择一条记录");
            return;
        }
        $.modal.confirm("确认要撤销选中的" + rows.length + "条组盘吗?", function () {
            let url = prefix + "/remove";
            let ids = "";
            for (let i = 0; i < rows.length; i++) {
                ids = ids + rows[i].id + ","
tangying authored
288
            }
289
290
291
292
            let data = {"ids": ids.substring(0, ids.length - 1)};
            $.operate.post(url, data);
        });
    }
293
294
295
296
297
    function chooseStation(id) {
        let url = ctx + "receipt/receiptContainerHeader/chooseStation" + "/" + id;
        $.modal.open("选择站台", url);
    }
tangying authored
298
299
300
301
302
303
304
    /* 单个生成任务 */
    function createTask(id) {
        let url = prefix + "/createTask";
        let data = {"ids": id};
        $.operate.post(url, data);
    }
305
306
307
308
309
310
311
    /* 批量生成任务 */
    function batchCreateTask() {
        let rows = $("#bootstrap-table").bootstrapTable('getSelections');
        if (rows.length === 0) {
            $.modal.msgWarning("请至少选择一条记录");
            return;
tangying authored
312
        }
313
314
315
        let ids = "";
        for (let i = 0; i < rows.length; i++) {
            ids = ids + rows[i].id + ","
tangying authored
316
        }
317
318
        chooseStation(ids);
    }
319
320
321
322
323
    function chooseStation(id) {
        let url = ctx + "receipt/receiptContainerHeader/chooseStation" + "/" + id;
        $.modal.open("选择站台", url);
    }
324
325
326
327
328
329
330
    function position(id) {
        let url = prefix + "/position/";
        let data = {"ids": id};
        $.operate.post(url, data);
    }
</script>
tangying authored
331
332
</body>
</html>