Browse Source

业务查询

Administrator 2 weeks ago
parent
commit
ddf1497264

+ 2 - 2
src/main/java/com/zjt/web/ProductionVarietyDetailController.java

@@ -20,7 +20,7 @@ import java.util.List;
20 20
  * @author xxu
21 21
  * @since 2025-09-25
22 22
  */
23
-@RestController
23
+@Controller
24 24
 @RequestMapping("/entity")
25 25
 public class ProductionVarietyDetailController {
26 26
     @Autowired
@@ -33,6 +33,6 @@ public class ProductionVarietyDetailController {
33 33
     @RequestMapping("varietyDetailsList")
34 34
     public String selectvarietyDetails() {
35 35
         List<ProductionVarietyDetail> productionVarietyDetails = productionVarietyDetailService.selectvarietyDetails(1L);
36
-        return productionVarietyDetails.toString();
36
+        return "mypackage/varietyList";
37 37
     }
38 38
 }

+ 148 - 69
src/main/resources/templates/mypackage/varietyList.ftl

@@ -12,7 +12,6 @@
12 12
     <link rel="icon" href="${basePath!}/static/logo.png">
13 13
     <link rel="stylesheet" href="${basePath!}/static/layui/css/layui.css" media="all" />
14 14
     <link rel="stylesheet" href="${basePath!}/static/css/public.css" media="all" />
15
-    <script src="${basePath!}/static/layui/layui.js" charset="utf-8"></script>
16 15
     <script src="${basePath!}/static/layui/layui.all.js" charset="utf-8"></script>
17 16
     <script src="${basePath!}/static/layui/lay/modules/jquery.js"></script>
18 17
 </head>
@@ -26,7 +25,7 @@
26 25
                 <div class="layui-form-item" id="materialchoose">
27 26
                     <div class="layui-form-label">物料信息</div>
28 27
                     <div class="layui-input-inline" style="width: 100px;">
29
-                        <select name="materialType" id="materialType" class="province-selector" data-value="品类" lay-filter="materialType" onclick="dele()" lay-search="">
28
+                        <select name="Variety" id="Variety" class="province-selector" data-value="品类" lay-filter="Variety" onclick="dele()" lay-search="">
30 29
                             <option value="">品类</option>
31 30
                         </select>
32 31
                     </div>
@@ -63,13 +62,69 @@
63 62
         </center>
64 63
     </div>
65 64
 
65
+    <form class="layui-form" method="post" >
66
+        <div class="layui-form-item" style="width:5000px;">
67
+            <center>
68
+                <table class="layui-table" style ="width:5000px; overflow:scroll;" id="table" lay-filter="table" border="1">
69
+                    <colgroup>
70
+                        <col width="150">
71
+                        <col width="200">
72
+                        <col>
73
+                    </colgroup>
74
+                    <thead style="align: center">
75
+                    <tr style="align: center">
76
+                        <th style = "width: 200px"> 操作</th>
77
+                        <th style = "width: 200px"> 镜片位置</th>
78
+                        <th style = "width: 200px"> 采购/退货</th>
79
+                        <th style = "width: 200px"> 用户名</th>
80
+                        <th style = "width: 300px"> 物料编码</th>
81
+                        <th style = "width: 800px"> 物料描述</th>
82
+                        <th style = "width: 300px"> 物料价格</th>
83
+                        <th style = "width: 300px"> 数量</th>
84
+                        <th style = "width: 300px"> 球镜</th>
85
+                        <th style = "width: 300px"> 柱镜</th>
86
+                        <th style = "width: 300px"> 轴位</th>
87
+                        <th style = "width: 300px"> 瞳距</th>
88
+                        <th style = "width: 300px"> 瞳高</th>
89
+                        <th style = "width: 300px"> 下加光</th>
90
+                        <th style = "width: 300px"> 通道</th>
91
+                        <th style = "width: 300px"> 棱镜</th>
92
+                        <th style = "width: 300px"> 镜片度数</th>
93
+                        <th style = "width: 300px"> 镜片型号/基弧</th>
94
+                        <th style = "width: 300px"> 是否染色</th>
95
+                        <th style = "width: 300px"> 色度</th>
96
+                        <th style = "width: 300px"> 来板染色</th>
97
+                        <th style = "width: 300px"> 厂家色板</th>
98
+                        <th style = "width: 300px"> 标准色号</th>
99
+                        <th style = "width: 300px"> 美薄加工</th>
100
+                        <th style = "width: 300px"> 丽薄加工</th>
101
+                        <th style = "width: 300px"> 镜架框形</th>
102
+                        <th style = "width: 300px"> 镜架高度</th>
103
+                        <th style = "width: 300px"> 鼻梁间距</th>
104
+                        <th style = "width: 300px"> 水平宽度</th>
105
+                        <th style = "width: 300px"> 加工镜架框形</th>
106
+                        <th style = "width: 300px"> 颜色</th>
107
+                        <th style = "width: 300px"> 直径</th>
108
+                        <th style = "width: 300px"> 片型</th>
109
+                        <th style = "width: 300px"> 片色</th>
110
+                        <th style = "width: 300px">备注</th>
111
+                    </tr>
112
+                    </thead>
113
+                    <tbody style="text-align: center">
114
+                    </tbody>
115
+                </table>
116
+            </center>
117
+            <div class="layui-form-item">
118
+                <div class="layui-input-block">
119
+                    <button class="layui-btn" lay-submit lay-filter="formDemo" onclick="adddata(event)">立即提交</button>
120
+                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
121
+                </div>
122
+            </div>
123
+        </div>
124
+    </form>
66 125
 </fieldset>
67 126
 
68 127
 <script>
69
-    layui.use('form', function(){
70
-        var form = layui.form;
71
-        form.render();
72
-    });
73 128
     layui.use(['form', 'table', "laydate", 'layer','jquery'], function () {
74 129
         var materialdetil=null;
75 130
         var materialRealPrice=null;
@@ -78,18 +133,30 @@
78 133
         var table = layui.table;
79 134
         var $ = layui.$ //重点处
80 135
             ,layer = layui.layer;
136
+
137
+        function handleError(error) {
138
+            layer.alert('请求失败: ' + error);
139
+        }
140
+
81 141
         $.ajax({
82 142
             url: 'type',
83 143
             type: 'get',
84 144
             success: function (data) {
85
-                $("#materialType").empty();
86
-                $.each($.parseJSON(data), function(idx, obj) {
87
-                    $("#materialType").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
88
-                });
145
+                $("#Variety").empty();
146
+                try {
147
+                    $.each($.parseJSON(data), function(idx, obj) {
148
+                        $("#materialType").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
149
+                    });
150
+                } catch (e) {
151
+                    handleError(e.message);
152
+                }
89 153
                 layui.form.render("select");
90
-            },error:function (xhr, status, error) {
91
-                layer.alert('请求失败: ' + error);
92
-            }});
154
+            },
155
+            error: function (xhr, status, error) {
156
+                handleError(error);
157
+            }
158
+        });
159
+
93 160
         form.on('select(materialType)', function(data){
94 161
             $.ajax({
95 162
                 url: 'brand',
@@ -98,15 +165,21 @@
98 165
                 success: function (data) {
99 166
                     $("#brand").empty();
100 167
                     $("#brand").append('<option value="">品牌</option>');
101
-                    $.each($.parseJSON(data), function(idx, obj) {
102
-                        $("#brand").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
103
-                    });
104
-
168
+                    try {
169
+                        $.each($.parseJSON(data), function(idx, obj) {
170
+                            $("#brand").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
171
+                        });
172
+                    } catch (e) {
173
+                        handleError(e.message);
174
+                    }
105 175
                     layui.form.render("select");
106
-                },error:function (xhr, status, error) {
107
-                    layer.alert('请求失败: ' + error);
108
-                }});
176
+                },
177
+                error: function (xhr, status, error) {
178
+                    handleError(error);
179
+                }
180
+            });
109 181
         });
182
+
110 183
         form.on('select(brand)', function(data){
111 184
             $.ajax({
112 185
                 url: 'group',
@@ -115,15 +188,21 @@
115 188
                 success: function (data) {
116 189
                     $("#materialGroup").empty();
117 190
                     $("#materialGroup").append('<option value="">物料组</option>');
118
-                    $.each($.parseJSON(data), function(idx, obj) {
119
-                        $("#materialGroup").append("<option value=\""+obj.materialGroupCode+"\">"+obj.materialGroupName+"</option>");
120
-                    });
121
-
191
+                    try {
192
+                        $.each($.parseJSON(data), function(idx, obj) {
193
+                            $("#materialGroup").append("<option value=\""+obj.materialGroupCode+"\">"+obj.materialGroupName+"</option>");
194
+                        });
195
+                    } catch (e) {
196
+                        handleError(e.message);
197
+                    }
122 198
                     layui.form.render("select");
123
-                },error:function (xhr, status, error) {
124
-                    layer.alert('请求失败: ' + error);
125
-                }});
199
+                },
200
+                error: function (xhr, status, error) {
201
+                    handleError(error);
202
+                }
203
+            });
126 204
         });
205
+
127 206
         form.on('select(materialGroup)', function(data){
128 207
             $.ajax({
129 208
                 url: 'price',
@@ -132,13 +211,19 @@
132 211
                 success: function (data) {
133 212
                     $("#materialdetil").empty();
134 213
                     $("#materialdetil").append('<option value="">物料描述</option>');
135
-                    $.each($.parseJSON(data), function(idx, obj) {
136
-                        $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
137
-                    });
214
+                    try {
215
+                        $.each($.parseJSON(data), function(idx, obj) {
216
+                            $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
217
+                        });
218
+                    } catch (e) {
219
+                        handleError(e.message);
220
+                    }
138 221
                     layui.form.render("select");
139
-                },error:function (xhr, status, error) {
140
-                    layer.alert('请求失败: ' + error);
141
-                }});
222
+                },
223
+                error: function (xhr, status, error) {
224
+                    handleError(error);
225
+                }
226
+            });
142 227
         });
143 228
 
144 229
         form.on('select(materialdetil)', function(data){
@@ -149,18 +234,27 @@
149 234
                 success: function (data) {
150 235
                     $("#materialCode").empty();
151 236
                     $("#materialRealPrice").empty();
152
-                    $.each($.parseJSON(data), function(idx, obj) {
153
-                        $("#materialCode").append("<option value=\""+obj.materialCode+"\">"+obj.materialCode+"</option>");
154
-                        $("#materialRealPrice").append("<option value=\""+obj.retailPrice+"\">"+obj.retailPrice+"</option>");
155
-                    });
237
+                    try {
238
+                        $.each($.parseJSON(data), function(idx, obj) {
239
+                            $("#materialCode").append("<option value=\""+obj.materialCode+"\">"+obj.materialCode+"</option>");
240
+                            $("#materialRealPrice").append("<option value=\""+obj.retailPrice+"\">"+obj.retailPrice+"</option>");
241
+                        });
242
+                    } catch (e) {
243
+                        handleError(e.message);
244
+                    }
156 245
                     layui.form.render("select");
157
-                },error:function (xhr, status, error) {
158
-                    layer.alert('请求失败: ' + error);
159
-                }});
246
+                },
247
+                error: function (xhr, status, error) {
248
+                    handleError(error);
249
+                }
250
+            });
160 251
         });
161 252
 
162
-        //因为动态添加的元素class属性是无效的,所以不能用$('.add').click(function(){});
163 253
         window.addtable= function(){
254
+            var selectedCode = $('#materialCode option:selected').text();
255
+            var selectedDetail = $('#materialdetil option:selected').text();
256
+            var selectedPrice = $('#materialRealPrice option:selected').text();
257
+
164 258
             var html = '<tr>'+
165 259
                 '<td style = "width: 100px"><input type="button" class="layui-btn layui-btn-radius" onclick="dele(this)" value="删除" /></td>'+
166 260
                 '<td style="width:200px">'+
@@ -175,10 +269,10 @@
175 269
                 '<option value="C">采购</option>'+
176 270
                 '<option value="T">退货</option>'+
177 271
                 '</select></td>'+
178
-                '<td style = "width: 200px"> <input type="text" name="username" required lay-verify="required"   placeholder="用户名字" autocomplete="off" class="layui-input" readonly="true" value="${currentUser.userName!}"+"/></td>'+
179
-                '<td style = "width: 200px"> <input type="text" name="materialCode" required lay-verify="required"   placeholder="物料编码" autocomplete="off" class="layui-input"  readonly="true" value="'+ $('#materialCode option:selected').text()+'"/></td>'+
180
-                '<td style = "width: 800px"> <input type="text" name="materialDetile"  required lay-verify="required"  placeholder="物料描述" autocomplete="off" class="layui-input"  readonly="true" value="'+$('#materialdetil option:selected').text()+'"/></td>'+
181
-                '<td style = "width: 200px"> <input type="text" name="price" required lay-verify="required"   placeholder="价格" autocomplete="off" class="layui-input"  readonly="true" value="'+$('#materialRealPrice option:selected').text()+'"/></td>'+
272
+                '<td style = "width: 200px"> <input type="text" name="username" required lay-verify="required"   placeholder="用户名字" autocomplete="off" class="layui-input" readonly="true" value="${currentUser.userName!}"/></td>'+
273
+                '<td style = "width: 200px"> <input type="text" name="materialCode" required lay-verify="required"   placeholder="物料编码" autocomplete="off" class="layui-input"  readonly="true" value="'+ selectedCode +'"/></td>'+
274
+                '<td style = "width: 800px"> <input type="text" name="materialDetile"  required lay-verify="required"  placeholder="物料描述" autocomplete="off" class="layui-input"  readonly="true" value="'+ selectedDetail +'"/></td>'+
275
+                '<td style = "width: 200px"> <input type="text" name="price" required lay-verify="required"   placeholder="价格" autocomplete="off" class="layui-input"  readonly="true" value="'+ selectedPrice +'"/></td>'+
182 276
                 '<td style = "width: 100px"> <input type="text" name="NUM" required lay-verify="required"   placeholder="数量" autocomplete="off" class="layui-input" value ="1"/></td>'+
183 277
                 '<td style = "width: 300px"> <input type="text" name="SPH"    placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
184 278
                 '<td style = "width: 300px"> <input type="text" name="CYL"    placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
@@ -208,29 +302,18 @@
208 302
                 '<td style = "width: 300px"> <input type="text" name="PS"    placeholder="片色" autocomplete="off" class="layui-input"></td>'+
209 303
                 '<td style = "width: 300px"> <input type="text" name="MARK"    placeholder="备注" autocomplete="off" class="layui-input"></td>'+
210 304
                 '</tr>';
211
-            //添加到表格最后
212 305
             $(html).appendTo($('#table tbody:last'));
213
-            form.render();
214
-        }
306
+            form.render('select');
307
+        };
308
+
215 309
         window.dele= function (obj){
216
-            debugger;
217 310
             var otr = obj.parentNode.parentNode;
218
-//			var tab = document.getElementById("tab");
219
-//			tab.deleteRow(otr.rowIndex)
220
-            var tab =  otr.parentNode; //自己的父节点 就是table
311
+            var tab =  otr.parentNode;
221 312
             tab.removeChild(otr);
222
-        }
223
-        window.deltable= function() {
224
-            if ($('#table tbody tr').length === 1) {
225
-                layer.msg('只有一条不允许删除。', {
226
-                    time : 2000
227
-                });
228
-            } else {
229
-                //删除当前按钮所在的tr
230
-                $(this).closest('tr').remove();
231
-            }
232 313
         };
233
-        window.adddata= function() {
314
+
315
+        window.adddata= function(event) {
316
+            event.preventDefault();
234 317
             table=document.getElementById("table");
235 318
             let tr=table.getElementsByTagName("tr");
236 319
             var arrayObj = new Array();
@@ -258,15 +341,11 @@
258 341
                         time : 5000
259 342
                     });
260 343
                 }, error: function (xhr, status, error) {
261
-                    layer.alert('请求失败: ' + error);
344
+                    handleError(error);
262 345
                 }
263 346
             });
264
-        }
265
-        form.on('submit(login)', function (data) {
266
-            //alert(data.value);
267
-        });
347
+        };
268 348
     });
269
-
270 349
 </script>
271 350
 
272 351
 </body>