123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>采购页面</title>
- <meta name="renderer" content="webkit">
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
- <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="format-detection" content="telephone=no">
- <link rel="icon" href="${basePath!}/static/logo.png">
- <link rel="stylesheet" href="${basePath!}/static/layui/css/layui.css" media="all" />
- <link rel="stylesheet" href="${basePath!}/static/css/public.css" media="all" />
- <script src="${basePath!}/static/layui/layui.js" charset="utf-8"></script>
- <script src="${basePath!}/static/layui/layui.all.js" charset="utf-8"></script>
- <script src="${basePath!}/static/layui/lay/modules/jquery.js"></script>
- </head>
- <body>
- <hr>
- <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
- <legend>订单信息</legend>
- <div class="layui-form" style="width: 100%; margin-top: 20px;">
- <center>
- <form class="layui-form" action="">
- <div class="layui-form-item" id="materialchoose">
- <div class="layui-form-label">物料信息</div>
- <div class="layui-input-inline" style="width: 300px;">
- <select name="materialType" id="materialType" class="province-selector" data-value="品类" lay-filter="materialType" onclick="dele()" lay-search="">
- <option value="">品类</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width: 300px;">
- <select name="brand" id ="brand" class="city-selector" data-value="品牌" lay-filter="brand" onclick="selectbrand()" lay-search="">
- <option value="">品牌</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width: 200px;">
- <select name="materialGroup" id ="materialGroup" class="county-selector" data-value="物料组" lay-filter="materialGroup" lay-search="">
- <option value="">物料组</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width: 400px;">
- <select name="materialdetil" id ="materialdetil" class="county-selector" data-value="物料描述" lay-filter="materialdetil">
- <option value="">物料描述</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width: 200px;">
- <select name="materialCode" id ="materialCode" class="county-selector" data-value="物料编码" lay-filter="materialCode">
- <option value="">物料编码</option>
- </select>
- </div>
- <div class="layui-input-inline" style="width: 100px;">
- <a class="layui-btn layui-btn add" onclick="addtable()">添加</a>
- </div>
- </div>
- </form>
- </center>
- </div>
- <form class="layui-form" method="post" >
- <div class="layui-form-item" style="width:5000px;">
- <center>
- <table class="layui-table" style ="width:5000px; overflow:scroll;" id="table" lay-filter="table" border="1">
- <colgroup>
- <col width="150">
- <col width="200">
- <col>
- </colgroup>
- <thead style="align: center">
- <tr style="align: center">
- <th style = "width: 200px"> 操作</th>
- <th style = "width: 200px"> 镜片位置</th>
- <th style = "width: 200px"> 采购/退货</th>
- <th style = "width: 200px"> 用户名</th>
- <th style = "width: 300px"> 物料编码</th>
- <th style = "width: 800px"> 物料描述</th>
- <th style = "width: 300px"> 物料价格</th>
- <th style = "width: 300px"> 数量</th>
- <th style = "width: 300px"> 球镜</th>
- <th style = "width: 300px"> 柱镜</th>
- <th style = "width: 300px"> 轴位</th>
- <th style = "width: 300px"> 瞳距</th>
- <th style = "width: 300px"> 瞳高</th>
- <th style = "width: 300px"> 下加光</th>
- <th style = "width: 300px"> 通道</th>
- <th style = "width: 300px"> 棱镜</th>
- <th style = "width: 300px"> 镜片度数</th>
- <th style = "width: 300px"> 镜片型号/基弧</th>
- <th style = "width: 300px"> 是否染色</th>
- <th style = "width: 300px"> 色度</th>
- <th style = "width: 300px"> 来板染色</th>
- <th style = "width: 300px"> 厂家色板</th>
- <th style = "width: 300px"> 标准色号</th>
- <th style = "width: 300px"> 美薄加工</th>
- <th style = "width: 300px"> 丽薄加工</th>
- <th style = "width: 300px"> 镜架框形</th>
- <th style = "width: 300px"> 镜架高度</th>
- <th style = "width: 300px"> 鼻梁间距</th>
- <th style = "width: 300px"> 水平宽度</th>
- <th style = "width: 300px"> 加工镜架框形</th>
- <th style = "width: 300px"> 颜色</th>
- <th style = "width: 300px"> 直径</th>
- <th style = "width: 300px"> 片型</th>
- <th style = "width: 300px"> 片色</th>
- <th style = "width: 300px">备注</th>
- </tr>
- </thead>
- <tbody style="text-align: center">
- </tbody>
- </table>
- </center>
- <div class="layui-form-item">
- <div class="layui-input-block">
- <button class="layui-btn" lay-submit lay-filter="formDemo" onclick="adddata(); return false;">立即提交</button>
- <button type="reset" class="layui-btn layui-btn-primary">重置</button>
- </div>
- </div>
- </div>
- </form>
- </fieldset>
- <script>
- layui.use('form', function(){
- var form = layui.form;
- form.render();
- });
- layui.use(['form', 'table', "laydate", 'layer','jquery'], function () {
- var materialdetil=null;
- var material=null;
- var form = layui.form;
- var table = layui.table;
- var $ = layui.$ //重点处
- ,layer = layui.layer;
- $.ajax({
- url: 'varietyLists',
- type: 'get',
- success: function (data) {
- $("#materialType").empty();
- $.each($.parseJSON(data), function(idx, obj) {
- $("#materialType").append("<option value=\""+obj.varietyId+"\">"+obj.variety+"</option>");
- });
- layui.form.render("select");
- },error:function (xhr, status, error) {
- layer.alert('请求失败: ' + error);
- }});
- form.on('select(materialType)', function(data){
- $.ajax({
- url: 'varietyDetailsLists',
- type: 'post',
- data:{'id':data.value},
- success: function (data) {
- $("#brand").empty();
- $("#brand").append('<option value="">品牌</option>');
- $.each($.parseJSON(data), function(idx, obj) {
- $("#brand").append("<option value=\""+obj.id+"\">"+obj.varietyDetails+"</option>");
- });
- layui.form.render("select");
- },error:function (xhr, status, error) {
- layer.alert('请求失败: ' + error);
- }});
- });
- form.on('select(brand)', function(data){
- $.ajax({
- url: 'group',
- type: 'post',
- data:{'brand':data.value},
- success: function (data) {
- $("#materialGroup").empty();
- $("#materialGroup").append('<option value="">物料组</option>');
- $.each($.parseJSON(data), function(idx, obj) {
- $("#materialGroup").append("<option value=\""+obj.materialGroupCode+"\">"+obj.materialGroupName+"</option>");
- });
- layui.form.render("select");
- },error:function (xhr, status, error) {
- layer.alert('请求失败: ' + error);
- }});
- });
- form.on('select(materialGroup)', function(data){
- $.ajax({
- url: 'price',
- type: 'post',
- data:{'group':data.value},
- success: function (data) {
- $("#materialdetil").empty();
- $("#materialdetil").append('<option value="">物料描述</option>');
- $.each($.parseJSON(data), function(idx, obj) {
- $("#materialdetil").append("<option value=\""+obj.materialCode+"\">"+obj.materialName+"</option>");
- });
- layui.form.render("select");
- },error:function (xhr, status, error) {
- layer.alert('请求失败: ' + error);
- }});
- });
- form.on('select(materialdetil)', function(data){
- $.ajax({
- url: 'code',
- type: 'post',
- data:{'code':data.value},
- success: function (data) {
- $("#materialCode").empty();
- $("#materialRealPrice").empty();
- $.each($.parseJSON(data), function(idx, obj) {
- $("#materialCode").append("<option value=\""+obj.materialCode+"\">"+obj.materialCode+"</option>");
- $("#materialRealPrice").append("<option value=\""+obj.retailPrice+"\">"+obj.retailPrice+"</option>");
- });
- layui.form.render("select");
- },error:function (xhr, status, error) {
- layer.alert('请求失败: ' + error);
- }});
- });
- //因为动态添加的元素class属性是无效的,所以不能用$('.add').click(function(){});
- window.addtable= function(){
- var html = '<tr>'+
- '<td style = "width: 100px"><input type="button" class="layui-btn layui-btn-radius" onclick="dele(this)" value="删除" /></td>'+
- '<td style="width:200px">'+
- '<select name="WZ" lay-verify="required">'+
- '<option value="">--请选择--</option>'+
- '<option value="L">L</option>'+
- '<option value="R">R</option>'+
- '</select></td>'+
- '<td style="width:300px">'+
- '<select name="LY" lay-verify="required">'+
- '<option value="">--请选择--</option>'+
- '<option value="C">采购</option>'+
- '<option value="T">退货</option>'+
- '</select></td>'+
- '<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>'+
- '<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>'+
- '<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>'+
- '<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>'+
- '<td style = "width: 100px"> <input type="text" name="NUM" required lay-verify="required" placeholder="数量" autocomplete="off" class="layui-input" value ="1"/></td>'+
- '<td style = "width: 300px"> <input type="text" name="SPH" placeholder="球镜" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="CYL" placeholder="柱镜" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="AXIS" placeholder="轴位" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="PDFOD" placeholder="瞳距" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="PH" placeholder="瞳高" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="XADD" placeholder="下加光" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="YULIU1" placeholder="通道" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="PRISM" placeholder="棱镜" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="CVA" placeholder="镜片度数" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="OPTICBC" placeholder="镜片型号/基弧" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="RS" placeholder="是否染色" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="SD" placeholder="色度" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="LRS" placeholder="来板染色" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="CRS" placeholder="厂家色板" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="BRS" placeholder="标准色号" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="MPRO" placeholder="美薄加工" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="LBPO" placeholder="丽薄加工" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="FRAMESHAPE" placeholder="镜架框形" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="FRAMEHEIGHT" placeholder="镜架高度" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="FRAMEBRIDGEWIDTH" placeholder="鼻梁间距" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="SPK" placeholder="水平宽度" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="JFRAMESHAPE" placeholder="加工镜架框形" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="COLOR" placeholder="颜色" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="lEN_DIAMETER" placeholder="直径" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="PX" placeholder="片型" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="PS" placeholder="片色" autocomplete="off" class="layui-input"></td>'+
- '<td style = "width: 300px"> <input type="text" name="MARK" placeholder="备注" autocomplete="off" class="layui-input"></td>'+
- '</tr>';
- //添加到表格最后
- $(html).appendTo($('#table tbody:last'));
- form.render();
- }
- window.dele= function (obj){
- debugger;
- var otr = obj.parentNode.parentNode;
- // var tab = document.getElementById("tab");
- // tab.deleteRow(otr.rowIndex)
- var tab = otr.parentNode; //自己的父节点 就是table
- tab.removeChild(otr);
- }
- window.deltable= function() {
- if ($('#table tbody tr').length === 1) {
- layer.msg('只有一条不允许删除。', {
- time : 2000
- });
- } else {
- //删除当前按钮所在的tr
- $(this).closest('tr').remove();
- }
- };
- window.adddata= function() {
- table=document.getElementById("table");
- let tr=table.getElementsByTagName("tr");
- var arrayObj = new Array();
- for (var i=0; i<tr.length; i++){
- let target=tr[i].querySelectorAll("[name]"),obj={};
- for (var j=0; j<target.length; j++){
- if(target[j].value){
- obj[target[j].getAttribute("name")]=target[j].value;
- }else{
- obj[target[j].getAttribute("name")]=target[j].getAttribute("value");
- }
- }
- arrayObj.push(obj);
- }
- var json=JSON.stringify(arrayObj);
- json = json.replace(/[+]/g, '+');
- $.ajax({
- url: 'insert',
- type: 'post',
- data: "list="+json,
- async: false,
- dataType: "json",
- success: function (data) {
- layer.msg('提交成功!', {
- time : 5000
- });
- }, error: function (xhr, status, error) {
- layer.alert('请求失败: ' + error);
- }
- });
- }
- form.on('submit(login)', function (data) {
- //alert(data.value);
- });
- });
- </script>
- </body>
- </html>
|