v1.0

parent f2095b0a
...@@ -1029,7 +1029,7 @@ function Export($errcode=0,$errmsg='成功',$data=''){ ...@@ -1029,7 +1029,7 @@ function Export($errcode=0,$errmsg='成功',$data=''){
} }
function ExportLayui($errcode=0,$errmsg=0,$data=[],$count=0,$other=''){ function ExportLayui($errcode=0,$errmsg=0,$data=[],$count=0,$other=''){
if(is_array($errcode)){ if(is_array($errcode)){
echo json_encode(['errcode'=>$errcode[0],'errmsg'=>$errcode[1],'data'=>@$errcode[2],'count'=>@$errcode[3],'other'=>!empty(@$errcode[4]) ? @$errcode[4] : ''], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); echo json_encode(['code'=>$errcode[0],'errmsg'=>$errcode[1],'data'=>@$errcode[2],'count'=>@$errcode[3],'other'=>!empty(@$errcode[4]) ? @$errcode[4] : ''], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
}else{ }else{
echo json_encode(['errcode'=>$errcode,'errmsg'=>$errmsg,'data'=>$data,'count'=>$count,'other'=>$other], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES); echo json_encode(['errcode'=>$errcode,'errmsg'=>$errmsg,'data'=>$data,'count'=>$count,'other'=>$other], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
} }
......
;!function () { ;!function () {
window.app = { window.app = {
init: function () { init: function () {
app.tableList(1); app.tableList();
//刷新搜索 //刷新搜索
$("#search").click(function () { $("#search").click(function () {
app.tableList(1) console.log($("#form1").serialize())
app.tableList()
}) })
}, },
tableList:function (page) { tableList:function () {
var res = ajax_push(URL_YUNXIN + '/api/ApiGoodsAuditList',{'p':page,'abnormal_id':$("#abnormal_id").val()}) layui.table.render({
if (res.errcode == 0) { elem: '#list'
var html; ,url:'/api/ApiGoodsAuditList'
for (i = 0; i < res.data.length; i++) { ,method:'post'
var s = res.data[i]; ,cellMinWidth: 100 //全局定义常规单元格的最小宽度
html += "<tr class=\"you\"> " + ,request: {
"<td><span class=\"t1\">"+s.goods_code+"</span></td>" + pageName: 'p' //页码的参数名称,默认:page
"<td><span class=\"t1\">"+s.goods_name+"</span></td>" + ,limitName: 'limit' //每页数据量的参数名,默认:limit
"<td><span class=\"t1\">"+s.brand_name+"</span></td>" +
"<td><span class=\"t1\">"+s.status+"</span></td>" +
"<td><span class=\"t1\">"+s.encap+"</span></td>" +
"<td><span class=\"t1\">"+s.packing+"</span></td>" +
"<td><span class=\"t1\">"+s.mpq+"</span></td>" +
"<td><span class=\"t1\">"+s.last_price+"</span></td>" +
"<td><span class=\"t1\">"+s.new_price+"</span></td>" +
"<td><span class=\"t1\">"+s.create_name+"</span></td>" +
"<td><span class=\"t1\">"+s.create_time+"</span></td>" +
"<td><span class=\"t1\">"+s.deal_name+"</span></td>" +
"<td><span class=\"t1\">"+s.deal_time+"</span></td>" +
"<td><span class=\"t1\">"+s.remark+"</span></td>" +
"</tr>"
} }
$("#shopListContent").html(html) ,where: formJson('form1')
layui.laypage.render({ ,loading:true
elem: 'pagination', ,first: true //不显示首页
theme: '#1080d0', ,last: false //不显示尾页
count: res.count, ,cols: [[
groups:10, {field:'id', title: '全选',type:'checkbox',align:'center'}
curr: page, ,{field:'goods_code', title: '商品编码',align:'center'}
jump:function (obj, first) { ,{field:'goods_name', title: '商品型号',align:'center'}
if(!first){ ,{field:'brand_name', title: '品牌名称',align:'center'}
app.tableList(obj.curr) ,{field:'status', title: '状态',align:'center'}
} ,{field:'encap', title: '封装',align:'center'}
} ,{field:'packing', title: '包装方式',align:'center'}
}); ,{field:'mpq', title: '标准包装量',align:'center'}
,{field:'last_price', title: '原始售价',align:'center'}
,{field:'new_price', title: '最新售价',align:'center'}
,{field:'create_name', title: '创建人',align:'center'}
,{field:'create_time', title: '创建时间',align:'center'}
,{field:'deal_name', title: '处理人',align:'center'}
,{field:'deal_time', title: '处理人名称',align:'center'}
,{field:'remark', title: '备注',align:'center'}
//,{field:'cahe', title: '操作',templet:'#cahe',width:150,align:'center', fixed: 'right'}
]]
,id:'Abnormal'
,page:{
}
,done: function(res, curr, count) {
// 若无数据,则禁用导出按钮
if (!count) {
$('.export').addClass('layui-disabled');
} else { } else {
alert_err(res.errmsg) $('.export').removeClass('layui-disabled');
return false; }
} }
});
} }
}, $(function () { }, $(function () {
......
...@@ -34,6 +34,19 @@ function ajax_push(url,data){ ...@@ -34,6 +34,19 @@ function ajax_push(url,data){
return result; return result;
} }
/* /*
表单数据转json
*/
function formJson(id) {
var forms = $('#'+id).serializeArray();
var data = {};
$.each(forms, function (i, v) {
if(v['value'] !== ""){
data[v['name']] = v['value'];
}
});
return data;
}
/*
导出数据 导出数据
@param str url 网址 @param str url 网址
@param str id 表单id @param str id 表单id
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</div> </div>
<div class="con-section shop-list"> <div class="con-section shop-list">
<p class="text">{{ $title }}</p> <p class="text">{{ $title }}</p>
<form action=""> <form action="" id="form1">
<div class="search-bar"> <div class="search-bar">
<div class="lineBlock input-inline va-m"> <div class="lineBlock input-inline va-m">
<label class="tag">商品编码:</label> <label class="tag">商品编码:</label>
...@@ -29,27 +29,29 @@ ...@@ -29,27 +29,29 @@
</div> </div>
</form> </form>
<div class="table-list" id="shopList"> <div class="table-list" id="shopList">
<table> <table class="layui-table" lay-filter="test" id="list"></table>
<tr>
<th>商品编码<b></b></th>
<th>商品型号<b></b></th>
<th>品牌名称<b></b></th>
<th>状态<b></b></th>
<th>封装<b></b></th>
<th>包装方式<b></b></th>
<th>标准包装量<b></b></th>
<th>原始售价<b></b></th>
<th>最新售价<b></b></th>
<th>创建人<b></b></th>
<th>创建时间<b></b></th>
<th>处理人<b></b></th>
<th>处理人名称<b></b></th>
<th>备注<b></b></th>
</tr>
<tbody id="shopListContent">
</tbody> {{--<table>--}}
</table> {{--<tr>--}}
{{--<th>商品编码<b></b></th>--}}
{{--<th>商品型号<b></b></th>--}}
{{--<th>品牌名称<b></b></th>--}}
{{--<th>状态<b></b></th>--}}
{{--<th>封装<b></b></th>--}}
{{--<th>包装方式<b></b></th>--}}
{{--<th>标准包装量<b></b></th>--}}
{{--<th>原始售价<b></b></th>--}}
{{--<th>最新售价<b></b></th>--}}
{{--<th>创建人<b></b></th>--}}
{{--<th>创建时间<b></b></th>--}}
{{--<th>处理人<b></b></th>--}}
{{--<th>处理人名称<b></b></th>--}}
{{--<th>备注<b></b></th>--}}
{{--</tr>--}}
{{--<tbody id="shopListContent">--}}
{{--</tbody>--}}
{{--</table>--}}
</div> </div>
<div class="pagination-with" id="pagination"></div> <div class="pagination-with" id="pagination"></div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment