<!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">

            <div id="print_div">
                <table class="layui-table">
                    <tr>
                        <td id="no" class="cell">单号</td>
                        <td id="name" class="cell">名称</td>
                    </tr>
                    <tr>
                        <td id="status_text" class="cell">状态</td>
                        <td id="create_time" class="cell">下单时间</td>
                    </tr>
                    <tr>
                        <td id="check_user_text" class="cell">审核人</td>
                        <td id="check_time" class="cell">审核时间</td>
                    </tr>
                    <tr>
                        <td id="total_count" class="cell">合计数量</td>
                        <td id="notes" class="cell">备注</td>
                    </tr>
                </table>
                <table class="layui-table">
                    <tr>
                        <td>序号</td>
                        <td>产品名称</td>
                        <td>产品代码</td>
                        <td>质量要求</td>
                        <td align="right">数量</td>
                        <td>生产车间</td>
                        <td>生产时间</td>
                        <td>负责人</td>
                        <td>备注</td>
                    </tr>

                    <tr id="tr_item_total">
                    </tr>
                </table>
            </div>
          </div>
        </div>
        </div>
    </div>
  </div>

  <script src="../../layuiadmin/layui/layui.js?t=1"></script>
  <script>
  layui.config({
    base: '../../../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'table'], function(){
    var $ = layui.$
    ,admin = layui.admin;
    var data = JSON.parse(JSON.stringify(parent.layui.table.editdata));
    $('.cell').each(function (index, element) {
        element.innerHTML += '：' + (data[element.id]||'')
    });

    admin.req({
        url: '/plan/production/detail/?id='+data.id
        ,done: function(data){
            var items = data.data.goods_items;
            for(var n in items){
                $('#tr_item_total').before("<tr>\n" +
                    "                        <td>"+(parseInt(n)+1)+"</td>\n" +
                    "                        <td>"+items[n].name+"</td>\n" +
                    "                        <td>"+items[n].model+"</td>\n" +
                    "                        <td>"+items[n].quality_request_text+"</td>\n" +
                    "                        <td align=\"right\">"+items[n].count+"</td>\n" +
                    "                        <td>"+items[n].p_department_text+"</td>\n" +
                    "                        <td>"+items[n].product_time+"</td>\n" +
                    "                        <td>"+items[n].product_user_text+"</td>\n" +
                    "                        <td>"+items[n].notes+"</td>\n" +
                    "                    </tr>");
            }
        }
    });
  });
  </script>
</body>
</html>

