v1.0

parent f2095b0a
......@@ -1029,7 +1029,7 @@ function Export($errcode=0,$errmsg='成功',$data=''){
}
function ExportLayui($errcode=0,$errmsg=0,$data=[],$count=0,$other=''){
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{
echo json_encode(['errcode'=>$errcode,'errmsg'=>$errmsg,'data'=>$data,'count'=>$count,'other'=>$other], JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES);
}
......
;!function () {
window.app = {
init: function () {
app.tableList(1);
app.tableList();
//刷新搜索
$("#search").click(function () {
app.tableList(1)
console.log($("#form1").serialize())
app.tableList()
})
},
tableList:function (page) {
var res = ajax_push(URL_YUNXIN + '/api/ApiGoodsAuditList',{'p':page,'abnormal_id':$("#abnormal_id").val()})
if (res.errcode == 0) {
var html;
for (i = 0; i < res.data.length; i++) {
var s = res.data[i];
html += "<tr class=\"you\"> " +
"<td><span class=\"t1\">"+s.goods_code+"</span></td>" +
"<td><span class=\"t1\">"+s.goods_name+"</span></td>" +
"<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>"
tableList:function () {
layui.table.render({
elem: '#list'
,url:'/api/ApiGoodsAuditList'
,method:'post'
,cellMinWidth: 100 //全局定义常规单元格的最小宽度
,request: {
pageName: 'p' //页码的参数名称,默认:page
,limitName: 'limit' //每页数据量的参数名,默认:limit
}
$("#shopListContent").html(html)
layui.laypage.render({
elem: 'pagination',
theme: '#1080d0',
count: res.count,
groups:10,
curr: page,
jump:function (obj, first) {
if(!first){
app.tableList(obj.curr)
}
}
});
,where: formJson('form1')
,loading:true
,first: true //不显示首页
,last: false //不显示尾页
,cols: [[
{field:'id', title: '全选',type:'checkbox',align:'center'}
,{field:'goods_code', title: '商品编码',align:'center'}
,{field:'goods_name', title: '商品型号',align:'center'}
,{field:'brand_name', title: '品牌名称',align:'center'}
,{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 {
alert_err(res.errmsg)
return false;
$('.export').removeClass('layui-disabled');
}
}
});
}
}, $(function () {
......
......@@ -34,6 +34,19 @@ function ajax_push(url,data){
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 id 表单id
......
......@@ -6,7 +6,7 @@
</div>
<div class="con-section shop-list">
<p class="text">{{ $title }}</p>
<form action="">
<form action="" id="form1">
<div class="search-bar">
<div class="lineBlock input-inline va-m">
<label class="tag">商品编码:</label>
......@@ -29,27 +29,29 @@
</div>
</form>
<div class="table-list" id="shopList">
<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">
<table class="layui-table" lay-filter="test" id="list"></table>
</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 class="pagination-with" id="pagination"></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