123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- {extend name="common/common2" /}
- {block name="main"}
- <style>
- .p-div{
- height: 26px;
- line-height: 26px;
- cursor: pointer;
- font-size: 14px;
- }
- .cate-title{
- width: auto;
- background-color: #ecf5ff;
- border-color: #d9ecff;
- color: #f99c34;
- display: inline-block;
- height: 32px;
- padding: 0 10px;
- line-height: 30px;
- font-size: 12px;
- color: #f99c34;
- border-width: 1px;
- border-style: solid;
- border-radius: 4px;
- -webkit-box-sizing: border-box;
- box-sizing: border-box;
- white-space: nowrap;
- margin-bottom: 3px;
- }
- .el-tag__close{
- cursor: pointer;
- }
- </style>
- <div class="ibox">
- <div class="ibox-content">
- <div class="row">
- <div class="col-xs-3">
- <a href="{:url('add')}" class="btn btn-sm btn-primary">新增</a>
- </div>
- <div class="col-xs-9" style="text-align: right;">
- <form class="form-inline" id="form-search" action="{:url('index')}?cateId={$cateId}">
- <div class="input-group">
- <input type="text" class="form-control" name="title" placeholder="名称/编号">
- </div>
- <div class="input-group">
- <select name="class_id" class="form-control">
- <option value="">选择类别</option>
- {volist name="class" id="v"}
- <option value="{$v.id}">{$v.title}</option>
- {/volist}
- </select>
- </div>
- <div class="input-group">
- <select name="add_id" class="form-control">
- <option value="">选择增加方式</option>
- {volist name="add" id="v"}
- <option value="{$v.id}">{$v.title}</option>
- {/volist}
- </select>
- </div>
- <div class="input-group">
- <select name="enable" class="form-control">
- <option value="">选择状态</option>
- <option value="1">在库</option>
- <option value="2">使用</option>
- <option value="4">维修</option>
- <option value="5">处置</option>
- </select>
- </div>
- <div class="input-group">
- <span class="input-group-btn">
- <button class="btn-sm btn-primary" type="button" id ="search-btn" ><i class="fa fa-search"></i></button>
- </span>
- <span class="input-group-btn">
- <button class="btn-sm btn-primary " type="button" id="search-clear"><i class="fa fa-undo"></i></button>
- </span>
- <span class="input-group-btn">
- <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>
- </span>
- </div>
- </form>
- </div>
- </div>
- </div>
- <div class="ibox-content" style="overflow: hidden">
- <div class="col-xs-2" style="overflow: hidden">
- {if condition="$tree"}
- {:widget_view('asset_items/tree',['data'=>$tree,'depth'=>0])}
- {else /}
- <div style="margin-top: 30px;text-align: center">暂无数据</div>
- {/if}
- </div>
- <div class="col-xs-10">
- {if $cateTitle}
- <div class="cate-title">{$cateTitle} <i class="el-tag__close el-icon-close" onclick="clearClick()"></i></div>
- {/if}
- <div class="jqGrid_wrapper">
- <table id="table" style="border-collapse: collapse"></table>
- <div id="pager"></div>
- <div style="line-height: 40px;color: red" id="countPrice">原值合计:{$countPrice}</div>
- </div>
- </div>
- </div>
- </div>
- {/block}
- {block name="script"}
- <script>
- $(function () {
- $(window).bind("resize",function(){
- var width=$(".jqGrid_wrapper").width();
- $("#table").setGridWidth(width);
- });
- $.jgrid.defaults.styleUI="Bootstrap";
- $("#table").jqGrid({
- url:"{:url('index')}?cateId={$cateId}",
- datatype: "json",
- colModel:[
- {label:'编号',name:'sn',index:'sn', width:100,editable: false, sortable: false,frozen:true},
- {label:'名称',name:'title',index:'title', width:100,sortable: false},
- {label:'规格',name:'spec',index:'spec', width:80,sortable: false},
- // {label:'数量',name:'nums',index:'nums', width:50,sortable: false},
- {label:'状态',name:'statusTxt',index:'statusTxt', width:80,sortable: false},
- {label:'类型',name:'cateName',index:'cateName', width:80,sortable: false},
- {label:'类别',name:'className',index:'className', width:80,sortable: false},
- {label:'增加方式',name:'addName',index:'addName', width:80,sortable: false},
- {label:'品牌',name:'brand',index:'brand', width:80,sortable: false},
- {label:'原值',name:'price',index:'price', width:80,sortable: false},
- {label:'存放地点',name:'address',index:'address', width:80,sortable: false},
- {label:'资产用途',name:'used',index:'used', width:80,sortable: false},
- {label:'购买日期',name:'buy_time',index:'buy_time', width:80,sortable: false},
- {label:'使用部门',name:'depName',index:'depName', width:80,sortable: false},
- {label:'使用人员',name:'userName',index:'userName', width:80,sortable: false},
- {label:'是否打印标签',name:'print',index:'print', width:100,sortable: false},
- {label:'备注',name:'remark',index:'remark', width:80,sortable: false},
- {label:'操作',width:200,sortable: false,editable: false,frozen:true, formatter: function (a, b, c) {
- var editurl = "{:url('edit',[],'')}/id/"+c.id;
- var delurl = "{:url('del',[],'')}/id/"+c.id;
- // var printurl = "{:url('print',[],'')}/id/"+c.id;
- var qrcodeurl = "{:url('qrcode',[],'')}/id/"+c.id;
- var allot_url = "{:url('allot',[],'')}/id/"+c.id;
- var btn = '<a href="'+editurl+'"><span class="label label-primary" title="编辑">编辑</span></a> ';
- // 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> ';
- 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> ';
- btn += '<a href="'+delurl+'" class="confirm ajax-get" data-confirm="确定要删除此记录吗?" data-table="1"><span class="label label-danger" title="删除">删除</span></a> ';
- if(c.is_ly == 1){
- 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> ';
- }
- return btn;
- }},
- ],
- rowNum:10,
- rowList:[10,20,30,50,100],
- pager: '#pager',
- sortname: 'id',
- viewrecords: true,
- autowidth:true,
- shrinkToFit: false,
- // rownumbers:true,
- mtype: 'post',
- height: 'auto',
- emptyrecords: "暂无数据",
- sortorder: "desc",
- caption:"资产列表",
- loadComplete: function (xhr) {
- if(xhr.code==0){
- layer.msg(xhr.msg);
- return false;
- }
- var countPrice = xhr.countPrice;
- $('#countPrice').html('原值合计:'+countPrice);
- psid = 0;
- psinfo = null;
- },
- onSelectRow : function(id) {
- let objs = jQuery("#table").jqGrid('getRowData');
- psid = id;
- psinfo = null;
- objs.forEach((item) => {
- if(Number(item.id) == Number(id)){
- psinfo = item;
- console.log('psinfo',psinfo);
- }
- });
- },
- });
- /*固定表头及侧边*/
- $("#table").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "auto" });
- $("#table").jqGrid('setFrozenColumns');
- });
- </script>
- <script>
- //导出
- function excel_download(_self){
- var url = $(_self).attr('data-url');
- var param = $('#form-search').serialize();
- window.location.href = url+'?cateId={$cateId}&'+param;
- }
- function clearClick(){
- var url = "{:url('AssetItems/index')}";
- window.location.href = url;
- }
- </script>
- {/block}
|