mirror of
https://gitee.com/apiadmin/ApiAdmin.git
synced 2025-04-23 09:50:16 +08:00
modified 完善JS脚本,避免数据带来的语法错误
This commit is contained in:
parent
7493f0f0c3
commit
edecf5db77
@ -35,10 +35,6 @@ class Menu extends Base {
|
|||||||
[
|
[
|
||||||
'field' => 'sort',
|
'field' => 'sort',
|
||||||
'info' => '排序'
|
'info' => '排序'
|
||||||
],
|
|
||||||
[
|
|
||||||
'field' => 'action',
|
|
||||||
'info' => '操作'
|
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'topButton' => [
|
'topButton' => [
|
||||||
@ -46,14 +42,14 @@ class Menu extends Base {
|
|||||||
'href' => url('Menu/add'),
|
'href' => url('Menu/add'),
|
||||||
'class'=> 'btn-success',
|
'class'=> 'btn-success',
|
||||||
'info'=> '新增',
|
'info'=> '新增',
|
||||||
'icon' => 'plus',
|
'icon' => 'fa fa-plus',
|
||||||
'confirm' => 0,
|
'confirm' => 0,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'href' => url('Menu/del'),
|
'href' => url('Menu/del'),
|
||||||
'class'=> 'btn-danger',
|
'class'=> 'btn-danger',
|
||||||
'info'=> '删除',
|
'info'=> '删除',
|
||||||
'icon' => 'trash',
|
'icon' => 'fa fa-trash',
|
||||||
'confirm' => 1,
|
'confirm' => 1,
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
|
@ -88,7 +88,9 @@ function refresh( url ) {
|
|||||||
success: function(data){
|
success: function(data){
|
||||||
if( data.code == 200 ){
|
if( data.code == 200 ){
|
||||||
if( data.data.tempType == 'table' ){
|
if( data.data.tempType == 'table' ){
|
||||||
$.getScript('/static/js/template/table.js');
|
$.getScript('/static/js/template/table.js', function (){
|
||||||
|
$('#content').html($.buildTable(data.data));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
$.alertMsg('请求失败!')
|
$.alertMsg('请求失败!')
|
||||||
|
@ -4,14 +4,17 @@
|
|||||||
(function ($) {
|
(function ($) {
|
||||||
$.buildTable = function ( tableObj ) {
|
$.buildTable = function ( tableObj ) {
|
||||||
var tableHtml = '<div class="box"><div class="box-body">';
|
var tableHtml = '<div class="box"><div class="box-body">';
|
||||||
if( tableObj.topButton ){
|
if( tableObj.rightButton && tableObj.rightButton.length ){
|
||||||
|
tableObj.header.push({field:"action",info:"操作"});
|
||||||
|
}
|
||||||
|
if( tableObj.topButton && tableObj.topButton.length ){
|
||||||
tableHtml += buildTopButton( tableObj );
|
tableHtml += buildTopButton( tableObj );
|
||||||
}
|
}
|
||||||
tableHtml += '<table class="table table-bordered"> <tbody>';
|
tableHtml += '<table class="table table-bordered"> <tbody>';
|
||||||
if( tableObj.header ){
|
if( tableObj.header && tableObj.header.length ){
|
||||||
tableHtml += buildHeader( tableObj );
|
tableHtml += buildHeader( tableObj );
|
||||||
}
|
}
|
||||||
if( tableObj.data ){
|
if( tableObj.data && tableObj.data.length ){
|
||||||
tableHtml += buildDataList( tableObj );
|
tableHtml += buildDataList( tableObj );
|
||||||
}else{
|
}else{
|
||||||
tableHtml += buildEmptyTable( tableObj );
|
tableHtml += buildEmptyTable( tableObj );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user