index.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. {extend name="common/common2" /}
  2. {block name="main"}
  3. <style>
  4. .p-div{
  5. height: 26px;
  6. line-height: 26px;
  7. cursor: pointer;
  8. font-size: 14px;
  9. }
  10. .cate-title{
  11. width: auto;
  12. background-color: #ecf5ff;
  13. border-color: #d9ecff;
  14. color: #f99c34;
  15. display: inline-block;
  16. height: 32px;
  17. padding: 0 10px;
  18. line-height: 30px;
  19. font-size: 12px;
  20. color: #f99c34;
  21. border-width: 1px;
  22. border-style: solid;
  23. border-radius: 4px;
  24. -webkit-box-sizing: border-box;
  25. box-sizing: border-box;
  26. white-space: nowrap;
  27. margin-bottom: 3px;
  28. }
  29. .el-tag__close{
  30. cursor: pointer;
  31. }
  32. </style>
  33. <div class="ibox">
  34. <div class="ibox-content">
  35. <div class="row">
  36. <div class="col-xs-3">
  37. <a href="{:url('add')}" class="btn btn-sm btn-primary">新增</a>
  38. </div>
  39. <div class="col-xs-9" style="text-align: right;">
  40. <form class="form-inline" id="form-search" action="{:url('index')}?cateId={$cateId}">
  41. <div class="input-group">
  42. <input type="text" class="form-control" name="title" placeholder="名称/编号">
  43. </div>
  44. <div class="input-group">
  45. <select name="class_id" class="form-control">
  46. <option value="">选择类别</option>
  47. {volist name="class" id="v"}
  48. <option value="{$v.id}">{$v.title}</option>
  49. {/volist}
  50. </select>
  51. </div>
  52. <div class="input-group">
  53. <select name="add_id" class="form-control">
  54. <option value="">选择增加方式</option>
  55. {volist name="add" id="v"}
  56. <option value="{$v.id}">{$v.title}</option>
  57. {/volist}
  58. </select>
  59. </div>
  60. <div class="input-group">
  61. <select name="enable" class="form-control">
  62. <option value="">选择状态</option>
  63. <option value="1">在库</option>
  64. <option value="2">使用</option>
  65. <option value="4">维修</option>
  66. <option value="5">处置</option>
  67. </select>
  68. </div>
  69. <div class="input-group">
  70. <span class="input-group-btn">
  71. <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
  72. </span>
  73. <span class="input-group-btn">
  74. <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
  75. </span>
  76. <span class="input-group-btn">
  77. <button data-url="{:url('export',[],'')}" title="导出" class="btn-sm btn-primary" onclick="excel_download(this)" type="button" ><i class="fa fa-cloud-download"></i></button>
  78. </span>
  79. </div>
  80. </form>
  81. </div>
  82. </div>
  83. </div>
  84. <div class="ibox-content" style="overflow: hidden">
  85. <div class="col-xs-2" style="overflow: hidden">
  86. {if condition="$tree"}
  87. {:widget_view('asset_items/tree',['data'=>$tree,'depth'=>0])}
  88. {else /}
  89. <div style="margin-top: 30px;text-align: center">暂无数据</div>
  90. {/if}
  91. </div>
  92. <div class="col-xs-10">
  93. {if $cateTitle}
  94. <div class="cate-title">{$cateTitle} <i class="el-tag__close el-icon-close" onclick="clearClick()"></i></div>
  95. {/if}
  96. <div class="jqGrid_wrapper">
  97. <table id="table" style="border-collapse: collapse"></table>
  98. <div id="pager"></div>
  99. <div style="line-height: 40px;color: red" id="countPrice">原值合计:{$countPrice}</div>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. {/block}
  105. {block name="script"}
  106. <script>
  107. $(function () {
  108. $(window).bind("resize",function(){
  109. var width=$(".jqGrid_wrapper").width();
  110. $("#table").setGridWidth(width);
  111. });
  112. $.jgrid.defaults.styleUI="Bootstrap";
  113. $("#table").jqGrid({
  114. url:"{:url('index')}?cateId={$cateId}",
  115. datatype: "json",
  116. colModel:[
  117. {label:'编号',name:'sn',index:'sn', width:100,editable: false, sortable: false,frozen:true},
  118. {label:'名称',name:'title',index:'title', width:100,sortable: false},
  119. {label:'规格',name:'spec',index:'spec', width:80,sortable: false},
  120. // {label:'数量',name:'nums',index:'nums', width:50,sortable: false},
  121. {label:'状态',name:'statusTxt',index:'statusTxt', width:80,sortable: false},
  122. {label:'类型',name:'cateName',index:'cateName', width:80,sortable: false},
  123. {label:'类别',name:'className',index:'className', width:80,sortable: false},
  124. {label:'增加方式',name:'addName',index:'addName', width:80,sortable: false},
  125. {label:'品牌',name:'brand',index:'brand', width:80,sortable: false},
  126. {label:'原值',name:'price',index:'price', width:80,sortable: false},
  127. {label:'存放地点',name:'address',index:'address', width:80,sortable: false},
  128. {label:'资产用途',name:'used',index:'used', width:80,sortable: false},
  129. {label:'购买日期',name:'buy_time',index:'buy_time', width:80,sortable: false},
  130. {label:'使用部门',name:'depName',index:'depName', width:80,sortable: false},
  131. {label:'使用人员',name:'userName',index:'userName', width:80,sortable: false},
  132. {label:'是否打印标签',name:'print',index:'print', width:100,sortable: false},
  133. {label:'备注',name:'remark',index:'remark', width:80,sortable: false},
  134. {label:'操作',width:200,sortable: false,editable: false,frozen:true, formatter: function (a, b, c) {
  135. var editurl = "{:url('edit',[],'')}/id/"+c.id;
  136. var delurl = "{:url('del',[],'')}/id/"+c.id;
  137. // var printurl = "{:url('print',[],'')}/id/"+c.id;
  138. var qrcodeurl = "{:url('qrcode',[],'')}/id/"+c.id;
  139. var allot_url = "{:url('allot',[],'')}/id/"+c.id;
  140. var btn = '<a href="'+editurl+'"><span class="label label-primary" title="编辑">编辑</span></a>&nbsp;';
  141. // btn += '<a url="'+printurl+'" href="javascript:;" data-title="打印条码" onclick="layer_open(this,1)" data-width="500px" data-height="370px" ><span class="label label-success" title="打印条码">打印条码</span></a>&nbsp;';
  142. btn += '<a url="'+qrcodeurl+'" href="javascript:;" data-title="二维码" onclick="layer_open(this,1)" data-width="600px" data-height="500px" ><span class="label label-success" title="二维码">二维码</span></a>&nbsp;';
  143. btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a>&nbsp;';
  144. if(c.is_ly == 1){
  145. btn += '<a url="'+allot_url+'" href="javascript:;" data-title="调拨" onclick="layer_open(this,1)" data-width="700px" data-height="400px" ><span class="label label-primary" title="调拨">调拨</span></a>&nbsp;';
  146. }
  147. return btn;
  148. }},
  149. ],
  150. rowNum:10,
  151. rowList:[10,20,30,50,100],
  152. pager: '#pager',
  153. sortname: 'id',
  154. viewrecords: true,
  155. autowidth:true,
  156. shrinkToFit: false,
  157. // rownumbers:true,
  158. mtype: 'post',
  159. height: 'auto',
  160. emptyrecords: "暂无数据",
  161. sortorder: "desc",
  162. caption:"资产列表",
  163. loadComplete: function (xhr) {
  164. if(xhr.code==0){
  165. layer.msg(xhr.msg);
  166. return false;
  167. }
  168. var countPrice = xhr.countPrice;
  169. $('#countPrice').html('原值合计:'+countPrice);
  170. psid = 0;
  171. psinfo = null;
  172. },
  173. onSelectRow : function(id) {
  174. let objs = jQuery("#table").jqGrid('getRowData');
  175. psid = id;
  176. psinfo = null;
  177. objs.forEach((item) => {
  178. if(Number(item.id) == Number(id)){
  179. psinfo = item;
  180. console.log('psinfo',psinfo);
  181. }
  182. });
  183. },
  184. });
  185. /*固定表头及侧边*/
  186. $("#table").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "auto" });
  187. $("#table").jqGrid('setFrozenColumns');
  188. });
  189. </script>
  190. <script>
  191. //导出
  192. function excel_download(_self){
  193. var url = $(_self).attr('data-url');
  194. var param = $('#form-search').serialize();
  195. window.location.href = url+'?cateId={$cateId}&'+param;
  196. }
  197. function clearClick(){
  198. var url = "{:url('AssetItems/index')}";
  199. window.location.href = url;
  200. }
  201. </script>
  202. {/block}