modified 细节优化

This commit is contained in:
zhaoxiang 2016-11-09 11:00:00 +08:00
parent e532947d3c
commit d3091a140f
3 changed files with 47 additions and 41 deletions

View File

@ -600,48 +600,14 @@
<!-- AdminLTE for demo purposes --> <!-- AdminLTE for demo purposes -->
<script src="__JS__/demo.js"></script> <script src="__JS__/demo.js"></script>
<script src="__PLUGIN__/vue/vue.min.js"></script> <script src="__PLUGIN__/vue/vue.min.js"></script>
<script src="__JS__/template.js"></script>
<script> <script>
function refresh(url) { var JS_PATH = '__JS__';
$.ajax({ var CSS_PATH = '__CSS__';
type: "GET", var STATIC_PATH = '__STATIC__';
url: url, var IMG_PATH = '__IMG__';
success: function(data){ var PLUGIN_PATH = '__PLUGIN__';
if( data.code == 200 ){
if( data.data.tempType == 'table' ){
if( $.buildTable ){
$('#content').html($.buildTable(data.data));
$('#tableBox').hide().fadeIn(800);
}else{
$.getScript('__JS__/template/table.js', function (){
$('#content').html($.buildTable(data.data));
$('#tableBox').hide().fadeIn(800);
});
}
}
if( data.data.tempType == 'form' ){
if( $.buildForm ){
$('#content').html($.buildForm(data.data));
$('#tableBox').hide().fadeIn(800);
}else{
$.getScript('__JS__/template/form.js', function (){
$('#content').html($.buildForm(data.data));
$('#formBox').hide().fadeIn(800);
});
}
}
}else{
$.alertMsg(data.msg);
setTimeout(function() {
if (data.url) {
location.href = data.url;
}
}, 1000*data.wait);
}
}
});
}
</script> </script>
<script src="__JS__/template.js"></script>
{block name="myScript"}{/block} {block name="myScript"}{/block}
</body> </body>
</html> </html>

View File

@ -79,3 +79,43 @@
}); });
})(jQuery); })(jQuery);
var refresh = function(url) {
$.ajax({
type: "GET",
url: url,
success: function(data){
if( data.code == 200 ){
if( data.data.tempType == 'table' ){
if( $.buildTable ){
$('#content').html($.buildTable(data.data));
$('#tableBox').hide().fadeIn(800);
}else{
$.getScript(JS_PATH + '/template/table.js', function (){
$('#content').html($.buildTable(data.data));
$('#tableBox').hide().fadeIn(800);
});
}
}
if( data.data.tempType == 'form' ){
if( $.buildForm ){
$('#content').html($.buildForm(data.data));
$('#tableBox').hide().fadeIn(800);
}else{
$.getScript(JS_PATH + '/template/form.js', function (){
$('#content').html($.buildForm(data.data));
$('#formBox').hide().fadeIn(800);
});
}
}
}else{
$.alertMsg(data.msg);
setTimeout(function() {
if (data.url) {
location.href = data.url;
}
}, 1000*data.wait);
}
}
});
};

View File

@ -11,7 +11,7 @@
* @returns {string} * @returns {string}
*/ */
$.buildTable = function ( tableObj ) { $.buildTable = function ( tableObj ) {
var tableHtml = '<div class="box" id="tableBox"><div class="box-body">'; var tableHtml = '<div class="box box-primary" id="tableBox"><div class="box-body">';
if( tableObj.rightButton && tableObj.rightButton.length ){ if( tableObj.rightButton && tableObj.rightButton.length ){
tableObj.header.push({field:"action",info:"操作"}); tableObj.header.push({field:"action",info:"操作"});
} }