<!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.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="../../layuiadmin/style/admin.css" media="all">
       <style type="text/css">
        .table-overlay .layui-table-view,
        .table-overlay .layui-table-header,
        .table-overlay .layui-table-box,
        .table-overlay .layui-table-body{overflow: visible;}
        .table-overlay .layui-table-cell{height: auto; overflow: visible;}
    </style>
</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body" pad15>
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">

                    <form class="layui-form" action="" lay-filter="component-form-element">
                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
                                <label class="layui-form-label"><font color='red' size="4">*</font>发票号：</label>
                                <div class="layui-input-block">
                                    <input id="id_invoice_no" type="text" name="invoice_no"  autocomplete="off" lay-verify="required" class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
                                <label class="layui-form-label"><font color='red' size="4">*</font>发票金额：</label>
                                <div class="layui-input-block">
                                    <input id="id_invoice_amount" type="text" name="invoice_amount"  autocomplete="off" lay-verify="required|numberGtZ" class="layui-input">
                                </div>
                            </div>
                        </div>

                        <div class="layui-row layui-col-space10">
                            <div class="layui-col-xs12 layui-col-sm4 layui-col-md4">
                                <label class="layui-form-label"><font color='red' size="4">*</font>开票日期：</label>
                                <div class="layui-input-block">
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" autocomplete="off" lay-verify="required|date"  name="invoice_date" id="id_invoice_date">
                                    </div>
                                </div>
                            </div>
                        </div>

                        <button class="layui-btn" id="purchase-order-submit" lay-submit lay-filter="component-form-element" style="display: none">保存</button>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>

  <script src="../../layuiadmin/layui/layui.js"></script>
  <script>

  layui.link('../../../layuiadmin/style/autocomplete.css');
  layui.config({
    base: '../../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index',
    autocomplete: 'autocomplete'
  }).use(['index','utils', 'form', 'element', 'laydate'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
    ,form = layui.form
    ,laydate = layui.laydate;

    var editdata = JSON.parse(JSON.stringify(parent.layui.table.editdata));

    form.render(null, 'component-form-element');
    element.render('breadcrumb', 'breadcrumb');
    form.on('submit(component-form-element)', function(data){

        var items = [];
        for (var i in editdata){
            items.push({'id': editdata[i].id})
        }
        data.field.items = items;
        admin.req({
        url: '/purchase/purchase_invoice/save/'
            ,data: JSON.stringify(data.field)
            ,type: 'post'
            , done: function (res) {
                parent.layui.onSubmitChild();
            }
        });
        return false;
    });

    parent.layui.submitChild = function () {
      $("#purchase-order-submit").click();
    };
    laydate.render({
        elem: '#id_invoice_date',
        trigger: 'click',
        closeStop: '#id_invoice_date'
    });

  });

  </script>
</body>
</html>