<!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">
</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">
                        <table class="layui-hide" id="datagrid" lay-filter="datagrid-operate"></table>

                        <button class="layui-btn" id="submit_btn" 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.config({
    base: '../../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'table'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,table = layui.table
    ,form = layui.form;
    table.render({
                elem: '#datagrid'
                ,url: '/purchase/search_price/'
              ,cols: [[
                {field:'name', title:'产品名称', width:100}
                ,{field:'model', title:'产品代码', width:120}
                ,{field:'price', align:'right', title:'价格', width:100}
                ,{field:'supplier', title:'供应商', width:120}
                 ,{field:'notes', title:'备注', minWidth:120}
              ]]
              ,height: 'full-60'
                ,done:function (res) {
                }
              });
    form.on('submit(component-form-element)', function () {
        admin.req({
            url: '/purchase/purchase_price/report/'
            , data: {}
            , type: 'post'
            , done: function (res) {
                parent.layui.onSubmitChild();
            }
        });
        return false;
    });
    parent.layui.submitChild = function () {
      $("#submit_btn").click();
    };
})
  </script>
</body>
</html>