浏览代码

业务查询

Administrator 1 周之前
父节点
当前提交
ee77f21068

+ 7 - 1
src/main/java/com/zjt/web/ProductionVarietyDetailController.java

@@ -45,6 +45,12 @@ public class ProductionVarietyDetailController {
45 45
 
46 46
     @RequestMapping("productionheader")
47 47
     public String group(@RequestParam("id") String id){
48
-        return productionVarietyDetailService.group(brand);
48
+        if(id!=null||id!=""){
49
+            List<ProductionVarietyDetail> productionVarietyDetails1 = productionVarietyDetailService.selectvarietyDetails(Long.parseLong(id));
50
+            return  JSONArray.toJSON(productionVarietyDetails1).toString();
51
+        }else{
52
+            return  JSONArray.toJSON("").toString();
53
+        }
54
+
49 55
     }
50 56
 }

+ 281 - 205
src/main/resources/templates/mypackage/varietyList.ftl

@@ -12,108 +12,164 @@
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>
15
+    <!-- 保留一个layui脚本引用即可 -->
16 16
     <script src="${basePath!}/static/layui/layui.all.js" charset="utf-8"></script>
17
-    <script src="${basePath!}/static/layui/lay/modules/jquery.js"></script>
18 17
 </head>
19 18
 <body>
20 19
 <hr>
20
+
21
+<!-- 订单信息区域 -->
21 22
 <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
22 23
     <legend>订单信息</legend>
23
-    <div class="layui-form" style="width: 100%; margin-top: 20px;">
24
-        <center>
24
+
25
+    <!-- 物料选择表单 -->
26
+    <div class="layui-form material-selection-form">
27
+        <div class="form-container">
25 28
             <form class="layui-form" action="">
26 29
                 <div class="layui-form-item" id="materialchoose">
27
-                    <div class="layui-form-label">物料信息</div>
28
-                    <div class="layui-input-inline" style="width: 300px;">
29
-                        <select name="materialType" id="materialType" class="province-selector" data-value="品类" lay-filter="materialType" onclick="dele()" lay-search="">
30
-                            <option value="">品类</option>
31
-                        </select>
32
-                    </div>
33
-                    <div class="layui-input-inline" style="width: 300px;">
34
-                        <select name="brand" id ="brand" class="city-selector" data-value="品牌" lay-filter="brand" onclick="selectbrand()" lay-search="">
35
-                            <option value="">品牌</option>
36
-                        </select>
37
-                    </div>
38
-                    <div class="layui-input-inline" style="width: 200px;">
39
-                        <select name="materialGroup" id ="materialGroup" class="county-selector" data-value="物料组" lay-filter="materialGroup"  lay-search="">
40
-                            <option value="">物料组</option>
41
-                        </select>
42
-                    </div>
43
-                    <div class="layui-input-inline" style="width: 400px;">
44
-                        <select name="materialdetil" id ="materialdetil" class="county-selector" data-value="物料描述" lay-filter="materialdetil">
45
-                            <option value="">物料描述</option>
46
-                        </select>
47
-                    </div>
48
-                    <div class="layui-input-inline" style="width: 200px;">
49
-                        <select name="materialCode" id ="materialCode" class="county-selector" data-value="物料编码" lay-filter="materialCode">
50
-                            <option value="">物料编码</option>
51
-                        </select>
52
-                    </div>
53
-                    <div class="layui-input-inline" style="width: 100px;">
54
-                        <a class="layui-btn layui-btn add" onclick="addtable()">添加</a>
30
+                    <label class="layui-form-label">物料信息</label>
31
+
32
+                    <div class="material-selection-group">
33
+                        <div class="layui-input-inline select-item">
34
+                            <select name="materialType"
35
+                                    id="materialType"
36
+                                    class="province-selector"
37
+                                    data-value="品类"
38
+                                    lay-filter="materialType"
39
+                                    lay-search="">
40
+                                <option value="">品类</option>
41
+                            </select>
42
+                        </div>
43
+
44
+                        <div class="layui-input-inline select-item">
45
+                            <select name="brand"
46
+                                    id="brand"
47
+                                    class="city-selector"
48
+                                    data-value="品牌"
49
+                                    lay-filter="brand"
50
+                                    lay-search="">
51
+                                <option value="">品牌</option>
52
+                            </select>
53
+                        </div>
54
+
55
+                        <div class="layui-input-inline select-item">
56
+                            <select name="materialGroup"
57
+                                    id="materialGroup"
58
+                                    class="county-selector"
59
+                                    data-value="物料组"
60
+                                    lay-filter="materialGroup"
61
+                                    lay-search="">
62
+                                <option value="">物料组</option>
63
+                            </select>
64
+                        </div>
65
+
66
+                        <div class="layui-input-inline select-item">
67
+                            <select name="materialdetil"
68
+                                    id="materialdetil"
69
+                                    class="county-selector"
70
+                                    data-value="物料描述"
71
+                                    lay-filter="materialdetil">
72
+                                <option value="">物料描述</option>
73
+                            </select>
74
+                        </div>
75
+
76
+                        <div class="layui-input-inline select-item">
77
+                            <select name="materialCode"
78
+                                    id="materialCode"
79
+                                    class="county-selector"
80
+                                    data-value="物料编码"
81
+                                    lay-filter="materialCode">
82
+                                <option value="">物料编码</option>
83
+                            </select>
84
+                        </div>
85
+
86
+                        <div class="layui-input-inline action-item">
87
+                            <button type="button"
88
+                                    class="layui-btn layui-btn-primary"
89
+                                    onclick="addtable()">
90
+                                <i class="layui-icon layui-icon-add-circle"></i>添加
91
+                            </button>
92
+                        </div>
55 93
                     </div>
56 94
                 </div>
57 95
             </form>
58
-        </center>
96
+        </div>
59 97
     </div>
60 98
 
61
-    <form class="layui-form" method="post" >
62
-        <div class="layui-form-item" style="width:5000px;">
63
-            <center>
64
-                <table class="layui-table" style ="width:5000px; overflow:scroll;" id="table" lay-filter="table" border="1">
99
+    <!-- 订单数据表格 -->
100
+    <form class="layui-form order-form" method="post">
101
+        <div class="layui-form-item table-container">
102
+            <div class="table-wrapper">
103
+                <table class="layui-table order-table"
104
+                       id="table"
105
+                       lay-filter="table">
65 106
                     <colgroup>
66 107
                         <col width="150">
67 108
                         <col width="200">
68 109
                         <col>
69 110
                     </colgroup>
70
-                    <thead style="align: center">
71
-                    <tr style="align: center">
72
-                        <th style = "width: 200px"> 操作</th>
73
-                        <th style = "width: 200px"> 镜片位置</th>
74
-                        <th style = "width: 200px"> 采购/退货</th>
75
-                        <th style = "width: 200px"> 用户名</th>
76
-                        <th style = "width: 300px"> 物料编码</th>
77
-                        <th style = "width: 800px"> 物料描述</th>
78
-                        <th style = "width: 300px"> 物料价格</th>
79
-                        <th style = "width: 300px"> 数量</th>
80
-                        <th style = "width: 300px"> 球镜</th>
81
-                        <th style = "width: 300px"> 柱镜</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>
111
+
112
+                    <thead>
113
+                    <tr>
114
+                        <th style="width: 200px">操作</th>
115
+                        <th style="width: 200px">镜片位置</th>
116
+                        <th style="width: 200px">采购/退货</th>
117
+                        <th style="width: 200px">用户名</th>
118
+                        <th style="width: 300px">物料编码</th>
119
+                        <th style="width: 800px">物料描述</th>
120
+                        <th style="width: 300px">物料价格</th>
121
+                        <th style="width: 300px">数量</th>
122
+                        <th style="width: 300px">球镜</th>
123
+                        <th style="width: 300px">柱镜</th>
124
+                        <th style="width: 300px">轴位</th>
125
+                        <th style="width: 300px">瞳距</th>
126
+                        <th style="width: 300px">瞳高</th>
127
+                        <th style="width: 300px">下加光</th>
128
+                        <th style="width: 300px">通道</th>
129
+                        <th style="width: 300px">棱镜</th>
130
+                        <th style="width: 300px">镜片度数</th>
131
+                        <th style="width: 300px">镜片型号/基弧</th>
132
+                        <th style="width: 300px">是否染色</th>
133
+                        <th style="width: 300px">色度</th>
134
+                        <th style="width: 300px">来板染色</th>
135
+                        <th style="width: 300px">厂家色板</th>
136
+                        <th style="width: 300px">标准色号</th>
137
+                        <th style="width: 300px">美薄加工</th>
138
+                        <th style="width: 300px">丽薄加工</th>
139
+                        <th style="width: 300px">镜架框形</th>
140
+                        <th style="width: 300px">镜架高度</th>
141
+                        <th style="width: 300px">鼻梁间距</th>
142
+                        <th style="width: 300px">水平宽度</th>
143
+                        <th style="width: 300px">加工镜架框形</th>
144
+                        <th style="width: 300px">颜色</th>
145
+                        <th style="width: 300px">直径</th>
146
+                        <th style="width: 300px">片型</th>
147
+                        <th style="width: 300px">片色</th>
148
+                        <th style="width: 300px">备注</th>
107 149
                     </tr>
108 150
                     </thead>
151
+
109 152
                     <tbody style="text-align: center">
153
+                    <!-- 动态数据行将在此处添加 -->
110 154
                     </tbody>
111 155
                 </table>
112
-            </center>
113
-            <div class="layui-form-item">
156
+            </div>
157
+
158
+            <!-- 表单操作按钮 -->
159
+            <div class="layui-form-item form-actions">
114 160
                 <div class="layui-input-block">
115
-                    <button class="layui-btn" lay-submit lay-filter="formDemo" onclick="adddata(); return false;">立即提交</button>
116
-                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
161
+                    <button type="button"
162
+                            class="layui-btn"
163
+                            lay-submit
164
+                            lay-filter="formDemo"
165
+                            onclick="adddata(); return false;">
166
+                        <i class="layui-icon layui-icon-ok"></i>立即提交
167
+                    </button>
168
+
169
+                    <button type="reset"
170
+                            class="layui-btn layui-btn-primary">
171
+                        <i class="layui-icon layui-icon-refresh"></i>重置
172
+                    </button>
117 173
                 </div>
118 174
             </div>
119 175
         </div>
@@ -121,206 +177,226 @@
121 177
 </fieldset>
122 178
 
123 179
 <script>
124
-    layui.use('form', function(){
125
-        var form = layui.form;
126
-        form.render();
127
-    });
128
-    layui.use(['form', 'table', "laydate", 'layer','jquery'], function () {
129
-        var materialdetil=null;
130
-        var material=null;
180
+    layui.use(['form', 'table', 'layer', 'jquery'], function () {
131 181
         var form = layui.form;
132 182
         var table = layui.table;
133
-        var $ = layui.$ //重点处
134
-            ,layer = layui.layer;
183
+        var $ = layui.$;
184
+        var layer = layui.layer;
185
+
186
+        // 初始化表单
187
+        form.render();
188
+
189
+        // 加载物料品类数据
135 190
         $.ajax({
136 191
             url: 'varietyLists',
137 192
             type: 'get',
138 193
             success: function (data) {
139 194
                 $("#materialType").empty();
140 195
                 $.each($.parseJSON(data), function(idx, obj) {
141
-                    $("#materialType").append("<option value=\""+obj.varietyId+"\">"+obj.variety+"</option>");
196
+                    $("#materialType").append("<option value=\"" + obj.varietyId + "\">" + obj.variety + "</option>");
142 197
                 });
143
-                layui.form.render("select");
144
-            },error:function (xhr, status, error) {
198
+                form.render("select");
199
+            },
200
+            error: function (xhr, status, error) {
145 201
                 layer.alert('请求失败: ' + error);
146
-            }});
147
-        form.on('select(materialType)', function(data){
202
+            }
203
+        });
204
+
205
+        // 物料品类选择事件
206
+        form.on('select(materialType)', function(data) {
148 207
             $.ajax({
149 208
                 url: 'varietyDetailsLists',
150 209
                 type: 'post',
151
-                data:{'id':data.value},
210
+                data: {'id': data.value},
152 211
                 success: function (data) {
153 212
                     $("#brand").empty();
154 213
                     $("#brand").append('<option value="">品牌</option>');
155 214
                     $.each($.parseJSON(data), function(idx, obj) {
156
-                        $("#brand").append("<option value=\""+obj.id+"\">"+obj.varietyDetails+"</option>");
215
+                        $("#brand").append("<option value=\"" + obj.id + "\">" + obj.varietyDetails + "</option>");
157 216
                     });
158
-
159
-                    layui.form.render("select");
160
-                },error:function (xhr, status, error) {
217
+                    form.render("select");
218
+                },
219
+                error: function (xhr, status, error) {
161 220
                     layer.alert('请求失败: ' + error);
162
-                }});
221
+                }
222
+            });
163 223
         });
164
-        form.on('select(brand)', function(data){
224
+
225
+        // 品牌选择事件
226
+        form.on('select(brand)', function(data) {
165 227
             $.ajax({
166
-                url: 'group',
228
+                url: 'productionheader',
167 229
                 type: 'post',
168
-                data:{'brand':data.value},
230
+                data: {'id': data.value},
169 231
                 success: function (data) {
170 232
                     $("#materialGroup").empty();
171 233
                     $("#materialGroup").append('<option value="">物料组</option>');
172 234
                     $.each($.parseJSON(data), function(idx, obj) {
173
-                        $("#materialGroup").append("<option value=\""+obj.materialGroupCode+"\">"+obj.materialGroupName+"</option>");
235
+                        $("#materialGroup").append("<option value=\"" + obj.materialGroupCode + "\">" + obj.materialGroupName + "</option>");
174 236
                     });
175
-
176
-                    layui.form.render("select");
177
-                },error:function (xhr, status, error) {
237
+                    form.render("select");
238
+                },
239
+                error: function (xhr, status, error) {
178 240
                     layer.alert('请求失败: ' + error);
179
-                }});
241
+                }
242
+            });
180 243
         });
181
-        form.on('select(materialGroup)', function(data){
244
+
245
+        // 物料组选择事件
246
+        form.on('select(materialGroup)', function(data) {
182 247
             $.ajax({
183 248
                 url: 'price',
184 249
                 type: 'post',
185
-                data:{'group':data.value},
250
+                data: {'group': data.value},
186 251
                 success: function (data) {
187 252
                     $("#materialdetil").empty();
188 253
                     $("#materialdetil").append('<option value="">物料描述</option>');
189 254
                     $.each($.parseJSON(data), function(idx, obj) {
190
-                        $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
255
+                        $("#materialdetil").append("<option value=\"" + obj.materialCode + "\">" + obj.materialName + "</option>");
191 256
                     });
192
-                    layui.form.render("select");
193
-                },error:function (xhr, status, error) {
257
+                    form.render("select");
258
+                },
259
+                error: function (xhr, status, error) {
194 260
                     layer.alert('请求失败: ' + error);
195
-                }});
261
+                }
262
+            });
196 263
         });
197 264
 
198
-        form.on('select(materialdetil)', function(data){
265
+        // 物料描述选择事件
266
+        form.on('select(materialdetil)', function(data) {
199 267
             $.ajax({
200 268
                 url: 'code',
201 269
                 type: 'post',
202
-                data:{'code':data.value},
270
+                data: {'code': data.value},
203 271
                 success: function (data) {
204 272
                     $("#materialCode").empty();
205
-                    $("#materialRealPrice").empty();
273
+                    // 注意:原代码中引用了不存在的 materialRealPrice 元素
206 274
                     $.each($.parseJSON(data), function(idx, obj) {
207
-                        $("#materialCode").append("<option value=\""+obj.materialCode+"\">"+obj.materialCode+"</option>");
208
-                        $("#materialRealPrice").append("<option value=\""+obj.retailPrice+"\">"+obj.retailPrice+"</option>");
275
+                        $("#materialCode").append("<option value=\"" + obj.materialCode + "\">" + obj.materialCode + "</option>");
209 276
                     });
210
-                    layui.form.render("select");
211
-                },error:function (xhr, status, error) {
277
+                    form.render("select");
278
+                },
279
+                error: function (xhr, status, error) {
212 280
                     layer.alert('请求失败: ' + error);
213
-                }});
281
+                }
282
+            });
214 283
         });
215 284
 
216
-        //因为动态添加的元素class属性是无效的,所以不能用$('.add').click(function(){});
217
-        window.addtable= function(){
218
-            var html = '<tr>'+
219
-                '<td style = "width: 100px"><input type="button" class="layui-btn layui-btn-radius" onclick="dele(this)" value="删除" /></td>'+
220
-                '<td style="width:200px">'+
221
-                '<select name="WZ" lay-verify="required">'+
222
-                '<option value="">--请选择--</option>'+
223
-                '<option value="L">L</option>'+
224
-                '<option value="R">R</option>'+
225
-                '</select></td>'+
226
-                '<td style="width:300px">'+
227
-                '<select name="LY" lay-verify="required">'+
228
-                '<option value="">--请选择--</option>'+
229
-                '<option value="C">采购</option>'+
230
-                '<option value="T">退货</option>'+
231
-                '</select></td>'+
232
-                '<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>'+
233
-                '<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>'+
234
-                '<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>'+
235
-                '<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>'+
236
-                '<td style = "width: 100px"> <input type="text" name="NUM" required lay-verify="required"   placeholder="数量" autocomplete="off" class="layui-input" value ="1"/></td>'+
237
-                '<td style = "width: 300px"> <input type="text" name="SPH"    placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
238
-                '<td style = "width: 300px"> <input type="text" name="CYL"    placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
239
-                '<td style = "width: 300px"> <input type="text" name="AXIS"    placeholder="轴位" autocomplete="off" class="layui-input"></td>'+
240
-                '<td style = "width: 300px"> <input type="text" name="PDFOD"    placeholder="瞳距" autocomplete="off" class="layui-input"></td>'+
241
-                '<td style = "width: 300px"> <input type="text" name="PH"    placeholder="瞳高" autocomplete="off" class="layui-input"></td>'+
242
-                '<td style = "width: 300px"> <input type="text" name="XADD"    placeholder="下加光" autocomplete="off" class="layui-input"></td>'+
243
-                '<td style = "width: 300px"> <input type="text" name="YULIU1"    placeholder="通道" autocomplete="off" class="layui-input"></td>'+
244
-                '<td style = "width: 300px"> <input type="text" name="PRISM"    placeholder="棱镜" autocomplete="off" class="layui-input"></td>'+
245
-                '<td style = "width: 300px"> <input type="text" name="CVA"    placeholder="镜片度数" autocomplete="off" class="layui-input"></td>'+
246
-                '<td style = "width: 300px"> <input type="text" name="OPTICBC"    placeholder="镜片型号/基弧" autocomplete="off" class="layui-input"></td>'+
247
-                '<td style = "width: 300px"> <input type="text" name="RS"    placeholder="是否染色" autocomplete="off" class="layui-input"></td>'+
248
-                '<td style = "width: 300px"> <input type="text" name="SD"    placeholder="色度" autocomplete="off" class="layui-input"></td>'+
249
-                '<td style = "width: 300px"> <input type="text" name="LRS"    placeholder="来板染色" autocomplete="off" class="layui-input"></td>'+
250
-                '<td style = "width: 300px"> <input type="text" name="CRS"    placeholder="厂家色板" autocomplete="off" class="layui-input"></td>'+
251
-                '<td style = "width: 300px"> <input type="text" name="BRS"    placeholder="标准色号" autocomplete="off" class="layui-input"></td>'+
252
-                '<td style = "width: 300px"> <input type="text" name="MPRO"    placeholder="美薄加工" autocomplete="off" class="layui-input"></td>'+
253
-                '<td style = "width: 300px"> <input type="text" name="LBPO"    placeholder="丽薄加工" autocomplete="off" class="layui-input"></td>'+
254
-                '<td style = "width: 300px"> <input type="text" name="FRAMESHAPE"    placeholder="镜架框形" autocomplete="off" class="layui-input"></td>'+
255
-                '<td style = "width: 300px"> <input type="text" name="FRAMEHEIGHT"    placeholder="镜架高度" autocomplete="off" class="layui-input"></td>'+
256
-                '<td style = "width: 300px"> <input type="text" name="FRAMEBRIDGEWIDTH"    placeholder="鼻梁间距" autocomplete="off" class="layui-input"></td>'+
257
-                '<td style = "width: 300px"> <input type="text" name="SPK"    placeholder="水平宽度" autocomplete="off" class="layui-input"></td>'+
258
-                '<td style = "width: 300px"> <input type="text" name="JFRAMESHAPE"    placeholder="加工镜架框形" autocomplete="off" class="layui-input"></td>'+
259
-                '<td style = "width: 300px"> <input type="text" name="COLOR"    placeholder="颜色" autocomplete="off" class="layui-input"></td>'+
260
-                '<td style = "width: 300px"> <input type="text" name="lEN_DIAMETER"    placeholder="直径" autocomplete="off" class="layui-input"></td>'+
261
-                '<td style = "width: 300px"> <input type="text" name="PX"    placeholder="片型" autocomplete="off" class="layui-input"></td>'+
262
-                '<td style = "width: 300px"> <input type="text" name="PS"    placeholder="片色" autocomplete="off" class="layui-input"></td>'+
263
-                '<td style = "width: 300px"> <input type="text" name="MARK"    placeholder="备注" autocomplete="off" class="layui-input"></td>'+
285
+        // 添加表格行
286
+        window.addtable = function() {
287
+            var selectedMaterialCode = $('#materialCode option:selected').text();
288
+            var selectedMaterialDetail = $('#materialdetil option:selected').text();
289
+
290
+            var html = '<tr>' +
291
+                '<td style="width: 100px"><button type="button" class="layui-btn layui-btn-danger layui-btn-xs" onclick="dele(this)">删除</button></td>' +
292
+                '<td style="width:200px">' +
293
+                '<select name="WZ" lay-verify="required">' +
294
+                '<option value="">--请选择--</option>' +
295
+                '<option value="L">L</option>' +
296
+                '<option value="R">R</option>' +
297
+                '</select>' +
298
+                '</td>' +
299
+                '<td style="width:300px">' +
300
+                '<select name="LY" lay-verify="required">' +
301
+                '<option value="">--请选择--</option>' +
302
+                '<option value="C">采购</option>' +
303
+                '<option value="T">退货</option>' +
304
+                '</select>' +
305
+                '</td>' +
306
+                '<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>' +
307
+                '<td style="width: 200px"><input type="text" name="materialCode" required lay-verify="required" placeholder="物料编码" autocomplete="off" class="layui-input" readonly="true" value="' + selectedMaterialCode + '"/></td>' +
308
+                '<td style="width: 800px"><input type="text" name="materialDetile" required lay-verify="required" placeholder="物料描述" autocomplete="off" class="layui-input" readonly="true" value="' + selectedMaterialDetail + '"/></td>' +
309
+                '<td style="width: 200px"><input type="text" name="price" required lay-verify="required" placeholder="价格" autocomplete="off" class="layui-input" readonly="true"/></td>' +
310
+                '<td style="width: 100px"><input type="text" name="NUM" required lay-verify="required" placeholder="数量" autocomplete="off" class="layui-input" value="1"/></td>' +
311
+                '<td style="width: 300px"><input type="text" name="SPH" placeholder="球镜" autocomplete="off" class="layui-input"></td>' +
312
+                '<td style="width: 300px"><input type="text" name="CYL" placeholder="柱镜" autocomplete="off" class="layui-input"></td>' +
313
+                '<td style="width: 300px"><input type="text" name="AXIS" placeholder="轴位" autocomplete="off" class="layui-input"></td>' +
314
+                '<td style="width: 300px"><input type="text" name="PDFOD" placeholder="瞳距" autocomplete="off" class="layui-input"></td>' +
315
+                '<td style="width: 300px"><input type="text" name="PH" placeholder="瞳高" autocomplete="off" class="layui-input"></td>' +
316
+                '<td style="width: 300px"><input type="text" name="XADD" placeholder="下加光" autocomplete="off" class="layui-input"></td>' +
317
+                '<td style="width: 300px"><input type="text" name="YULIU1" placeholder="通道" autocomplete="off" class="layui-input"></td>' +
318
+                '<td style="width: 300px"><input type="text" name="PRISM" placeholder="棱镜" autocomplete="off" class="layui-input"></td>' +
319
+                '<td style="width: 300px"><input type="text" name="CVA" placeholder="镜片度数" autocomplete="off" class="layui-input"></td>' +
320
+                '<td style="width: 300px"><input type="text" name="OPTICBC" placeholder="镜片型号/基弧" autocomplete="off" class="layui-input"></td>' +
321
+                '<td style="width: 300px"><input type="text" name="RS" placeholder="是否染色" autocomplete="off" class="layui-input"></td>' +
322
+                '<td style="width: 300px"><input type="text" name="SD" placeholder="色度" autocomplete="off" class="layui-input"></td>' +
323
+                '<td style="width: 300px"><input type="text" name="LRS" placeholder="来板染色" autocomplete="off" class="layui-input"></td>' +
324
+                '<td style="width: 300px"><input type="text" name="CRS" placeholder="厂家色板" autocomplete="off" class="layui-input"></td>' +
325
+                '<td style="width: 300px"><input type="text" name="BRS" placeholder="标准色号" autocomplete="off" class="layui-input"></td>' +
326
+                '<td style="width: 300px"><input type="text" name="MPRO" placeholder="美薄加工" autocomplete="off" class="layui-input"></td>' +
327
+                '<td style="width: 300px"><input type="text" name="LBPO" placeholder="丽薄加工" autocomplete="off" class="layui-input"></td>' +
328
+                '<td style="width: 300px"><input type="text" name="FRAMESHAPE" placeholder="镜架框形" autocomplete="off" class="layui-input"></td>' +
329
+                '<td style="width: 300px"><input type="text" name="FRAMEHEIGHT" placeholder="镜架高度" autocomplete="off" class="layui-input"></td>' +
330
+                '<td style="width: 300px"><input type="text" name="FRAMEBRIDGEWIDTH" placeholder="鼻梁间距" autocomplete="off" class="layui-input"></td>' +
331
+                '<td style="width: 300px"><input type="text" name="SPK" placeholder="水平宽度" autocomplete="off" class="layui-input"></td>' +
332
+                '<td style="width: 300px"><input type="text" name="JFRAMESHAPE" placeholder="加工镜架框形" autocomplete="off" class="layui-input"></td>' +
333
+                '<td style="width: 300px"><input type="text" name="COLOR" placeholder="颜色" autocomplete="off" class="layui-input"></td>' +
334
+                '<td style="width: 300px"><input type="text" name="lEN_DIAMETER" placeholder="直径" autocomplete="off" class="layui-input"></td>' +
335
+                '<td style="width: 300px"><input type="text" name="PX" placeholder="片型" autocomplete="off" class="layui-input"></td>' +
336
+                '<td style="width: 300px"><input type="text" name="PS" placeholder="片色" autocomplete="off" class="layui-input"></td>' +
337
+                '<td style="width: 300px"><input type="text" name="MARK" placeholder="备注" autocomplete="off" class="layui-input"></td>' +
264 338
                 '</tr>';
265
-            //添加到表格最后
339
+
266 340
             $(html).appendTo($('#table tbody:last'));
267 341
             form.render();
268
-        }
269
-        window.dele= function (obj){
270
-            debugger;
342
+        };
343
+
344
+        // 删除表格行
345
+        window.dele = function (obj) {
271 346
             var otr = obj.parentNode.parentNode;
272
-//			var tab = document.getElementById("tab");
273
-//			tab.deleteRow(otr.rowIndex)
274
-            var tab =  otr.parentNode; //自己的父节点 就是table
347
+            var tab = otr.parentNode;
275 348
             tab.removeChild(otr);
276
-        }
277
-        window.deltable= function() {
278
-            if ($('#table tbody tr').length === 1) {
279
-                layer.msg('只有一条不允许删除。', {
280
-                    time : 2000
281
-                });
282
-            } else {
283
-                //删除当前按钮所在的tr
284
-                $(this).closest('tr').remove();
285
-            }
286 349
         };
287
-        window.adddata= function() {
288
-            table=document.getElementById("table");
289
-            let tr=table.getElementsByTagName("tr");
290
-            var arrayObj = new Array();
291
-            for (var i=0; i<tr.length; i++){
292
-                let target=tr[i].querySelectorAll("[name]"),obj={};
293
-                for (var j=0; j<target.length; j++){
294
-                    if(target[j].value){
295
-                        obj[target[j].getAttribute("name")]=target[j].value;
296
-                    }else{
297
-                        obj[target[j].getAttribute("name")]=target[j].getAttribute("value");
350
+
351
+        // 提交数据
352
+        window.adddata = function() {
353
+            var tableElement = document.getElementById("table");
354
+            var trElements = tableElement.getElementsByTagName("tr");
355
+            var dataArray = [];
356
+
357
+            for (var i = 0; i < trElements.length; i++) {
358
+                var targetElements = trElements[i].querySelectorAll("[name]");
359
+                var dataObject = {};
360
+
361
+                for (var j = 0; j < targetElements.length; j++) {
362
+                    if (targetElements[j].value) {
363
+                        dataObject[targetElements[j].getAttribute("name")] = targetElements[j].value;
364
+                    } else {
365
+                        dataObject[targetElements[j].getAttribute("name")] = targetElements[j].getAttribute("value");
298 366
                     }
299 367
                 }
300
-                arrayObj.push(obj);
368
+
369
+                // 只有包含数据的对象才添加到数组中
370
+                if (Object.keys(dataObject).length > 0) {
371
+                    dataArray.push(dataObject);
372
+                }
301 373
             }
302
-            var json=JSON.stringify(arrayObj);
303
-            json = json.replace(/[+]/g, '+');
374
+
375
+            var jsonData = JSON.stringify(dataArray);
376
+            jsonData = jsonData.replace(/[+]/g, '+');
377
+
304 378
             $.ajax({
305 379
                 url: 'insert',
306 380
                 type: 'post',
307
-                data: "list="+json,
381
+                data: "list=" + jsonData,
308 382
                 async: false,
309 383
                 dataType: "json",
310 384
                 success: function (data) {
311 385
                     layer.msg('提交成功!', {
312
-                        time : 5000
386
+                        time: 3000
313 387
                     });
314
-                }, error: function (xhr, status, error) {
388
+                },
389
+                error: function (xhr, status, error) {
315 390
                     layer.alert('请求失败: ' + error);
316 391
                 }
317 392
             });
318
-        }
393
+        };
394
+
395
+        // 表单提交事件
319 396
         form.on('submit(login)', function (data) {
320
-            //alert(data.value);
397
+            // 可以在这里处理表单提交逻辑
321 398
         });
322 399
     });
323
-
324 400
 </script>
325 401
 
326 402
 </body>