|
@@ -0,0 +1,273 @@
|
|
1
|
+<!DOCTYPE html>
|
|
2
|
+<html>
|
|
3
|
+<head>
|
|
4
|
+ <meta charset="utf-8">
|
|
5
|
+ <title>采购页面</title>
|
|
6
|
+ <meta name="renderer" content="webkit">
|
|
7
|
+ <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
|
8
|
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
|
9
|
+ <meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
10
|
+ <meta name="apple-mobile-web-app-capable" content="yes">
|
|
11
|
+ <meta name="format-detection" content="telephone=no">
|
|
12
|
+ <link rel="icon" href="${basePath!}/static/logo.png">
|
|
13
|
+ <link rel="stylesheet" href="${basePath!}/static/layui/css/layui.css" media="all" />
|
|
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
|
+ <script src="${basePath!}/static/layui/layui.all.js" charset="utf-8"></script>
|
|
17
|
+ <script src="${basePath!}/static/layui/lay/modules/jquery.js"></script>
|
|
18
|
+</head>
|
|
19
|
+<body>
|
|
20
|
+<hr>
|
|
21
|
+<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
|
|
22
|
+ <legend>订单信息</legend>
|
|
23
|
+ <div class="layui-form" style="width: 100%; margin-top: 20px;">
|
|
24
|
+ <center>
|
|
25
|
+ <form class="layui-form" action="">
|
|
26
|
+ <div class="layui-form-item" id="materialchoose">
|
|
27
|
+ <div class="layui-form-label">物料信息</div>
|
|
28
|
+ <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="">
|
|
30
|
+ <option value="">品类</option>
|
|
31
|
+ </select>
|
|
32
|
+ </div>
|
|
33
|
+ <div class="layui-input-inline" style="width: 100px;">
|
|
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
|
+ <select name="materialRealPrice" id ="materialRealPrice" class="county-selector" data-value="物料价格" lay-filter="materialRealPrice">
|
|
55
|
+ <option value="">物料价格</option>
|
|
56
|
+ </select>
|
|
57
|
+ </div>
|
|
58
|
+ <div class="layui-input-inline" style="width: 100px;">
|
|
59
|
+ <a class="layui-btn layui-btn add" onclick="addtable()">添加</a>
|
|
60
|
+ </div>
|
|
61
|
+ </div>
|
|
62
|
+ </form>
|
|
63
|
+ </center>
|
|
64
|
+ </div>
|
|
65
|
+
|
|
66
|
+</fieldset>
|
|
67
|
+
|
|
68
|
+<script>
|
|
69
|
+ layui.use('form', function(){
|
|
70
|
+ var form = layui.form;
|
|
71
|
+ form.render();
|
|
72
|
+ });
|
|
73
|
+ layui.use(['form', 'table', "laydate", 'layer','jquery'], function () {
|
|
74
|
+ var materialdetil=null;
|
|
75
|
+ var materialRealPrice=null;
|
|
76
|
+ var material=null;
|
|
77
|
+ var form = layui.form;
|
|
78
|
+ var table = layui.table;
|
|
79
|
+ var $ = layui.$ //重点处
|
|
80
|
+ ,layer = layui.layer;
|
|
81
|
+ $.ajax({
|
|
82
|
+ url: 'type',
|
|
83
|
+ type: 'get',
|
|
84
|
+ success: function (data) {
|
|
85
|
+ $("#materialType").empty();
|
|
86
|
+ $.each($.parseJSON(data), function(idx, obj) {
|
|
87
|
+ $("#materialType").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
|
|
88
|
+ });
|
|
89
|
+ layui.form.render("select");
|
|
90
|
+ },error:function (xhr, status, error) {
|
|
91
|
+ layer.alert('请求失败: ' + error);
|
|
92
|
+ }});
|
|
93
|
+ form.on('select(materialType)', function(data){
|
|
94
|
+ $.ajax({
|
|
95
|
+ url: 'brand',
|
|
96
|
+ type: 'post',
|
|
97
|
+ data:{'materialTypeCode':data.value},
|
|
98
|
+ success: function (data) {
|
|
99
|
+ $("#brand").empty();
|
|
100
|
+ $("#brand").append('<option value="">品牌</option>');
|
|
101
|
+ $.each($.parseJSON(data), function(idx, obj) {
|
|
102
|
+ $("#brand").append("<option value=\""+obj.brandCode+"\">"+obj.brandName+"</option>");
|
|
103
|
+ });
|
|
104
|
+
|
|
105
|
+ layui.form.render("select");
|
|
106
|
+ },error:function (xhr, status, error) {
|
|
107
|
+ layer.alert('请求失败: ' + error);
|
|
108
|
+ }});
|
|
109
|
+ });
|
|
110
|
+ form.on('select(brand)', function(data){
|
|
111
|
+ $.ajax({
|
|
112
|
+ url: 'group',
|
|
113
|
+ type: 'post',
|
|
114
|
+ data:{'brand':data.value},
|
|
115
|
+ success: function (data) {
|
|
116
|
+ $("#materialGroup").empty();
|
|
117
|
+ $("#materialGroup").append('<option value="">物料组</option>');
|
|
118
|
+ $.each($.parseJSON(data), function(idx, obj) {
|
|
119
|
+ $("#materialGroup").append("<option value=\""+obj.materialGroupCode+"\">"+obj.materialGroupName+"</option>");
|
|
120
|
+ });
|
|
121
|
+
|
|
122
|
+ layui.form.render("select");
|
|
123
|
+ },error:function (xhr, status, error) {
|
|
124
|
+ layer.alert('请求失败: ' + error);
|
|
125
|
+ }});
|
|
126
|
+ });
|
|
127
|
+ form.on('select(materialGroup)', function(data){
|
|
128
|
+ $.ajax({
|
|
129
|
+ url: 'price',
|
|
130
|
+ type: 'post',
|
|
131
|
+ data:{'group':data.value},
|
|
132
|
+ success: function (data) {
|
|
133
|
+ $("#materialdetil").empty();
|
|
134
|
+ $("#materialdetil").append('<option value="">物料描述</option>');
|
|
135
|
+ $.each($.parseJSON(data), function(idx, obj) {
|
|
136
|
+ $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
|
|
137
|
+ });
|
|
138
|
+ layui.form.render("select");
|
|
139
|
+ },error:function (xhr, status, error) {
|
|
140
|
+ layer.alert('请求失败: ' + error);
|
|
141
|
+ }});
|
|
142
|
+ });
|
|
143
|
+
|
|
144
|
+ form.on('select(materialdetil)', function(data){
|
|
145
|
+ $.ajax({
|
|
146
|
+ url: 'code',
|
|
147
|
+ type: 'post',
|
|
148
|
+ data:{'code':data.value},
|
|
149
|
+ success: function (data) {
|
|
150
|
+ $("#materialCode").empty();
|
|
151
|
+ $("#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
|
+ });
|
|
156
|
+ layui.form.render("select");
|
|
157
|
+ },error:function (xhr, status, error) {
|
|
158
|
+ layer.alert('请求失败: ' + error);
|
|
159
|
+ }});
|
|
160
|
+ });
|
|
161
|
+
|
|
162
|
+ //因为动态添加的元素class属性是无效的,所以不能用$('.add').click(function(){});
|
|
163
|
+ window.addtable= function(){
|
|
164
|
+ var html = '<tr>'+
|
|
165
|
+ '<td style = "width: 100px"><input type="button" class="layui-btn layui-btn-radius" onclick="dele(this)" value="删除" /></td>'+
|
|
166
|
+ '<td style="width:200px">'+
|
|
167
|
+ '<select name="WZ" lay-verify="required">'+
|
|
168
|
+ '<option value="">--请选择--</option>'+
|
|
169
|
+ '<option value="L">L</option>'+
|
|
170
|
+ '<option value="R">R</option>'+
|
|
171
|
+ '</select></td>'+
|
|
172
|
+ '<td style="width:300px">'+
|
|
173
|
+ '<select name="LY" lay-verify="required">'+
|
|
174
|
+ '<option value="">--请选择--</option>'+
|
|
175
|
+ '<option value="C">采购</option>'+
|
|
176
|
+ '<option value="T">退货</option>'+
|
|
177
|
+ '</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>'+
|
|
182
|
+ '<td style = "width: 100px"> <input type="text" name="NUM" required lay-verify="required" placeholder="数量" autocomplete="off" class="layui-input" value ="1"/></td>'+
|
|
183
|
+ '<td style = "width: 300px"> <input type="text" name="SPH" placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
|
|
184
|
+ '<td style = "width: 300px"> <input type="text" name="CYL" placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
|
|
185
|
+ '<td style = "width: 300px"> <input type="text" name="AXIS" placeholder="轴位" autocomplete="off" class="layui-input"></td>'+
|
|
186
|
+ '<td style = "width: 300px"> <input type="text" name="PDFOD" placeholder="瞳距" autocomplete="off" class="layui-input"></td>'+
|
|
187
|
+ '<td style = "width: 300px"> <input type="text" name="PH" placeholder="瞳高" autocomplete="off" class="layui-input"></td>'+
|
|
188
|
+ '<td style = "width: 300px"> <input type="text" name="XADD" placeholder="下加光" autocomplete="off" class="layui-input"></td>'+
|
|
189
|
+ '<td style = "width: 300px"> <input type="text" name="YULIU1" placeholder="通道" autocomplete="off" class="layui-input"></td>'+
|
|
190
|
+ '<td style = "width: 300px"> <input type="text" name="PRISM" placeholder="棱镜" autocomplete="off" class="layui-input"></td>'+
|
|
191
|
+ '<td style = "width: 300px"> <input type="text" name="CVA" placeholder="镜片度数" autocomplete="off" class="layui-input"></td>'+
|
|
192
|
+ '<td style = "width: 300px"> <input type="text" name="OPTICBC" placeholder="镜片型号/基弧" autocomplete="off" class="layui-input"></td>'+
|
|
193
|
+ '<td style = "width: 300px"> <input type="text" name="RS" placeholder="是否染色" autocomplete="off" class="layui-input"></td>'+
|
|
194
|
+ '<td style = "width: 300px"> <input type="text" name="SD" placeholder="色度" autocomplete="off" class="layui-input"></td>'+
|
|
195
|
+ '<td style = "width: 300px"> <input type="text" name="LRS" placeholder="来板染色" autocomplete="off" class="layui-input"></td>'+
|
|
196
|
+ '<td style = "width: 300px"> <input type="text" name="CRS" placeholder="厂家色板" autocomplete="off" class="layui-input"></td>'+
|
|
197
|
+ '<td style = "width: 300px"> <input type="text" name="BRS" placeholder="标准色号" autocomplete="off" class="layui-input"></td>'+
|
|
198
|
+ '<td style = "width: 300px"> <input type="text" name="MPRO" placeholder="美薄加工" autocomplete="off" class="layui-input"></td>'+
|
|
199
|
+ '<td style = "width: 300px"> <input type="text" name="LBPO" placeholder="丽薄加工" autocomplete="off" class="layui-input"></td>'+
|
|
200
|
+ '<td style = "width: 300px"> <input type="text" name="FRAMESHAPE" placeholder="镜架框形" autocomplete="off" class="layui-input"></td>'+
|
|
201
|
+ '<td style = "width: 300px"> <input type="text" name="FRAMEHEIGHT" placeholder="镜架高度" autocomplete="off" class="layui-input"></td>'+
|
|
202
|
+ '<td style = "width: 300px"> <input type="text" name="FRAMEBRIDGEWIDTH" placeholder="鼻梁间距" autocomplete="off" class="layui-input"></td>'+
|
|
203
|
+ '<td style = "width: 300px"> <input type="text" name="SPK" placeholder="水平宽度" autocomplete="off" class="layui-input"></td>'+
|
|
204
|
+ '<td style = "width: 300px"> <input type="text" name="JFRAMESHAPE" placeholder="加工镜架框形" autocomplete="off" class="layui-input"></td>'+
|
|
205
|
+ '<td style = "width: 300px"> <input type="text" name="COLOR" placeholder="颜色" autocomplete="off" class="layui-input"></td>'+
|
|
206
|
+ '<td style = "width: 300px"> <input type="text" name="lEN_DIAMETER" placeholder="直径" autocomplete="off" class="layui-input"></td>'+
|
|
207
|
+ '<td style = "width: 300px"> <input type="text" name="PX" placeholder="片型" autocomplete="off" class="layui-input"></td>'+
|
|
208
|
+ '<td style = "width: 300px"> <input type="text" name="PS" placeholder="片色" autocomplete="off" class="layui-input"></td>'+
|
|
209
|
+ '<td style = "width: 300px"> <input type="text" name="MARK" placeholder="备注" autocomplete="off" class="layui-input"></td>'+
|
|
210
|
+ '</tr>';
|
|
211
|
+ //添加到表格最后
|
|
212
|
+ $(html).appendTo($('#table tbody:last'));
|
|
213
|
+ form.render();
|
|
214
|
+ }
|
|
215
|
+ window.dele= function (obj){
|
|
216
|
+ debugger;
|
|
217
|
+ var otr = obj.parentNode.parentNode;
|
|
218
|
+// var tab = document.getElementById("tab");
|
|
219
|
+// tab.deleteRow(otr.rowIndex)
|
|
220
|
+ var tab = otr.parentNode; //自己的父节点 就是table
|
|
221
|
+ 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
|
+ };
|
|
233
|
+ window.adddata= function() {
|
|
234
|
+ table=document.getElementById("table");
|
|
235
|
+ let tr=table.getElementsByTagName("tr");
|
|
236
|
+ var arrayObj = new Array();
|
|
237
|
+ for (var i=0; i<tr.length; i++){
|
|
238
|
+ let target=tr[i].querySelectorAll("[name]"),obj={};
|
|
239
|
+ for (var j=0; j<target.length; j++){
|
|
240
|
+ if(target[j].value){
|
|
241
|
+ obj[target[j].getAttribute("name")]=target[j].value;
|
|
242
|
+ }else{
|
|
243
|
+ obj[target[j].getAttribute("name")]=target[j].getAttribute("value");
|
|
244
|
+ }
|
|
245
|
+ }
|
|
246
|
+ arrayObj.push(obj);
|
|
247
|
+ }
|
|
248
|
+ var json=JSON.stringify(arrayObj);
|
|
249
|
+ json = json.replace(/[+]/g, '+');
|
|
250
|
+ $.ajax({
|
|
251
|
+ url: 'insert',
|
|
252
|
+ type: 'post',
|
|
253
|
+ data: "list="+json,
|
|
254
|
+ async: false,
|
|
255
|
+ dataType: "json",
|
|
256
|
+ success: function (data) {
|
|
257
|
+ layer.msg('提交成功!', {
|
|
258
|
+ time : 5000
|
|
259
|
+ });
|
|
260
|
+ }, error: function (xhr, status, error) {
|
|
261
|
+ layer.alert('请求失败: ' + error);
|
|
262
|
+ }
|
|
263
|
+ });
|
|
264
|
+ }
|
|
265
|
+ form.on('submit(login)', function (data) {
|
|
266
|
+ //alert(data.value);
|
|
267
|
+ });
|
|
268
|
+ });
|
|
269
|
+
|
|
270
|
+</script>
|
|
271
|
+
|
|
272
|
+</body>
|
|
273
|
+</html>
|