add.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .rr{
  5. padding-right: 10px;
  6. }
  7. .layui-laydate-content>.layui-laydate-list {
  8. padding-bottom: 0px;
  9. overflow: hidden;
  10. }
  11. .layui-laydate-content>.layui-laydate-list>li{
  12. width:50%
  13. }
  14. </style>
  15. <div class="row">
  16. <div class="col-sm-12">
  17. <div class="ibox float-e-margins">
  18. <div class="ibox-title">
  19. <h5>创建领用单</h5>
  20. <div class="ibox-tools">
  21. <a class="toback" href="{:url('index')}">
  22. 返回上一页
  23. </a>
  24. </div>
  25. </div>
  26. <div class="ibox-content">
  27. <form method="post" action="{:url('add')}" class="form-horizontal">
  28. <input type="hidden" name="id" value="{$info['id']|default='0'}">
  29. <div class="form-group">
  30. <label class="col-sm-2 control-label">领用人员<span class="text-danger">*</span></label>
  31. <div class="col-sm-6">
  32. {:widget_view('common/user-group-select',['name'=>'receive_user_id','multi'=>1,'lists'=>$userList, 'val' => '','msg'=>'','send_user_num'=>1])}
  33. </div>
  34. </div>
  35. <div class="form-group">
  36. <label class="col-sm-2 control-label">存放地点</label>
  37. <div class="col-sm-6">
  38. <input type="text" class="form-control" name="address" value="{$info.address|default=''}">
  39. </div>
  40. </div>
  41. <div class="form-group">
  42. <label class="col-sm-2 control-label">资产用途</label>
  43. <div class="col-sm-6">
  44. <input type="text" class="form-control" name="used" value="{$info.used|default=''}">
  45. </div>
  46. </div>
  47. <div class="form-group">
  48. <label class="col-sm-2 control-label">备注</label>
  49. <div class="col-sm-6">
  50. <input type="text" class="form-control" name="remark" value="{$info.remark|default=''}">
  51. </div>
  52. </div>
  53. <div class="form-group" id="goods" >
  54. <label class="col-sm-2 control-label">领用物品<span class="text-danger">*</span></label>
  55. <div class="col-sm-8">
  56. <a url="{:url('selectGoods')}" id="gUrl" href="javascript:;" data-title="选择物品" onclick="layer_open(this,0)" class="btn btn-primary">选择物品</a>
  57. <table class="table table-striped table-bordered">
  58. <thead>
  59. <tr>
  60. <th>编号</th>
  61. <th>名称</th>
  62. <th>规格</th>
  63. <th>分类</th>
  64. <th>价格</th>
  65. <th>数量</th>
  66. <th>操作</th>
  67. </tr>
  68. </thead>
  69. <tbody class="layer-photos" id="layer-photos">
  70. </tbody>
  71. </table>
  72. </div>
  73. </div>
  74. <div class="col-sm-12">
  75. <div class="hr-line-dashed">
  76. </div>
  77. </div>
  78. <div class="form-group">
  79. <div class="col-sm-6 col-sm-offset-2">
  80. <button class="btn btn-primary ajax-post" target-form="form-horizontal" type="submit">确定</button>
  81. <a href="{:url('index')}" class="btn btn-default">取 消</a>
  82. </div>
  83. </div>
  84. </form>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. {/block}
  90. {block name="script"}
  91. <script src="/static/layDate-v5.0.9/laydate.js"></script>
  92. <script>
  93. function setGoods(id) {
  94. // if(id !=''){
  95. // $("#goods").css('display','block')
  96. // $("#gUrl").attr('url','/admin/dispose/selectgoods.html?warehouse_id='+id);
  97. //
  98. // }else{
  99. // $("#goods").css('display','none')
  100. // $("#gUrl").attr('url','/admin/dispose/selectgoods.html?warehouse_id=0');
  101. //
  102. // }
  103. }
  104. $(function () {
  105. laydate.render({
  106. elem: '#delivery_time',
  107. trigger: 'click',
  108. theme: '#6eb7ff',
  109. type: 'date',
  110. format:'yyyy-MM-dd',
  111. });
  112. });
  113. var lists = [];
  114. function ddl(id) {
  115. var newArr = [];
  116. for (let o in lists){
  117. if(lists[o].id!=id){
  118. newArr.push(lists[o]);
  119. }
  120. }
  121. lists = newArr;
  122. formatList();
  123. }
  124. $(document).ready(function(){
  125. localStorage.removeItem("mateapply");
  126. localStorage.removeItem("mateapplyids");
  127. formatList();
  128. });
  129. function formatList() {
  130. var str = '';
  131. let ids = [];
  132. for (let o in lists){
  133. ids.push(lists[o].id);
  134. str += '<tr>';
  135. str += '<td>'+lists[o].sn+'</td>';
  136. str += '<td>'+lists[o].title+'</td>';
  137. str += '<td>'+lists[o].spec+'</td>';
  138. str += '<td>'+lists[o].cateName+'</td>';
  139. str += '<td>'+lists[o].price+'</td>';
  140. str += '<td>'+lists[o].nums+'</td>';
  141. str += '<input type="hidden" value="'+lists[o].id+'" class="form-control input-sm" name="items['+lists[o].id+'][id]"></td>';
  142. str += '<td><button onclick="ddl('+lists[o].id+')" type="button">删除</button></td>';
  143. str += '</tr>';
  144. }
  145. $('#layer-photos').html(str);
  146. if(ids.length > 0){
  147. localStorage.setItem("mateapply", JSON.stringify(lists));
  148. localStorage.setItem("mateapplyids", JSON.stringify(ids));
  149. }else{
  150. localStorage.removeItem("mateapply");
  151. localStorage.removeItem("mateapplyids");
  152. }
  153. }
  154. </script>
  155. {/block}