<!DOCTYPE html>
<html style="height: 100%;min-height: 100%;">
<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>
      h3, td, th{color: #000000}
      .layui-table td, .layui-table th {border-color: #000000;height: 1px}
  </style>
</head>
<body style="background-color: #fff;height: 100%;min-height: 100%;">

  <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">
                <h3 align="center" style="font-weight: bold;letter-spacing:8px;"><span id="company"></span></br>生产计划</h3>
                <table class="layui-table">
                    <tr>
                        <td align="right">单号</td>
                        <td id="no"></td>
                        <td align="right">名称</td>
                        <td id="name"></td>
                        <td align="right">状态</td>
                        <td id="status_text"></td>
                    </tr>
                    <tr>
                        <td align="right">审核人</td>
                        <td id="check_user"></td>
                        <td align="right">审核时间</td>
                        <td id="check_time"></td>
                        <td align="right">下单时间</td>
                        <td id="create_time"></td>
                    </tr>
                    <tr>
                       <td align="right">备注</td>
                       <td id="td_notes" colspan="5"></td>
                    </tr>
                </table>
                <table class="layui-table">
                    <tr>
                        <td colspan="8" align="center" style="font-weight: bold;letter-spacing:8px;">产品明细</td>
                    </tr>
                    <tr>
                        <td align="left" width="100">产品名称</td>
                        <td align="left" width="60">产品代码</td>
                        <td align="left" width="60">质量要求</td>
                        <td align="right" width="60">数量</td>
                        <td align="left" width="100">生产车间</td>
                        <td align="left" width="150">生产时间</td>
                        <td align="left" width="60">负责人</td>
                        <td align="left">备注</td>
                    </tr>
                    <tr id="tr_item_total"></tr>
                </table>
                <table class="table-embed" border='0' width='100%' height="50px">
                    <tr style="height: 80px;">
                        <td align="center">制单人签字：__________</td>
                        <td align="center">审核人签字：__________</td>
                        <td align="center">财务签字：__________</td>
                        <td align="center">总经理签字：__________</td>
                    </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 id = layui.view.getParameterByName('id');

      admin.req({
          url: '/plan/production/detail/?id=' + id
          , done: function (data) {
              var production_item = data.data.production;
              var items = data.data.goods_items;
              for (var i in production_item) {
              $('#no').html(production_item[i].no);
              $('#company').html(production_item[i].company);
              $('#name').html(production_item[i].name);
              $('#status_text').html(production_item[i].status_text);
              $('#check_user').html(production_item[i].check_user);
              $('#check_time').html(production_item[i].check_time);
              $('#create_time').html(production_item[i].create_time);
              $('#td_notes').html(production_item[i].notes || '');
               }
              for (var n in items) {
                  $('#tr_item_total').before("<tr>\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>");
              }
          }
      });
  });
    parent.layui.submitChild = function () {
      window.scrollTo(0,0);
      doPrint();
      parent.layui.onSubmitChild();
  };

    function doPrint() {
        var $ = layui.$;
        document.body.innerHTML=$('#print_div').html();
        window.print();
    }
  </script>
</body>
</html>

