Init Repo

This commit is contained in:
root
2019-09-06 23:53:10 +08:00
commit f0ef89dfbb
7905 changed files with 914138 additions and 0 deletions

View File

@ -0,0 +1,156 @@
var mmg;
function initGrid(staffId){
var h = WST.pageHeight();
var cols = [
{title:'图标', name:'expressImg' ,width:50, align:'center', renderer: function(val,item,rowIndex){
return '<img src="'+WST.conf.IMGURL+'/'+item['expressImg']+'" height="28px" />';
}},
{title:'快递名称', name:'expressName', width: 160},
{title:'快递代码', name:'expressCode' ,width:60},
{title:'操作', name:'' ,width:150, align:'center', renderer: function(val,item,rowIndex){
var h = "";
if(WST.GRANT.KDGL_02)h += "<a class='btn btn-blue' onclick='javascript:getForEdit(" + item['expressId'] + ")'><i class='fa fa-pencil'></i>修改</a> ";
if(WST.GRANT.KDGL_03)h += "<a class='btn btn-red' onclick='javascript:toDel(" + item['expressId'] + ")'><i class='fa fa-trash-o'></i>删除</a> ";
return h;
}}
];
mmg = $('.mmg').mmGrid({height: (h-155),indexCol: true, cols: cols,method:'POST',
url: WST.U('admin/express/pageQuery'), fullWidthRows: true, autoLoad: true,
plugins: [
$('#pg').mmPaginator({})
]
});
$('#headTip').WSTTips({width:90,height:35,callback:function(v){
if(v){
mmg.resize({height:h-155});
}else{
mmg.resize({height:h-128});
}
}});
}
function toDel(id){
var box = WST.confirm({content:"您确定要删除该记录吗?",yes:function(){
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/express/del'),{id:id},function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
layer.close(box);
mmg.load();
}else{
WST.msg(json.msg,{icon:2});
}
});
}});
}
function getForEdit(id){
var loading = WST.msg('正在获取数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/express/get'),{id:id},function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.expressId){
WST.setValues(json);
//显示原来的图片
$('#preview').html('<img src="'+WST.conf.IMGURL+'/'+json.expressImg+'" height="75px" />');
$('#isImg').val('ok');
toEdit(json.expressId);
}else{
WST.msg(json.msg,{icon:2});
}
});
}
function toEdit(id){
if(!isInitUpload){
initUpload();
}
var title = "新增";
if(id>0){
title = "编辑";
}else{
$('#expressForm')[0].reset();
}
var box = WST.open({title:title,type:1,content:$('#expressBox'),area: ['450px', '400px'],btn:['确定','取消'],
end:function(){
$('#expressBox').hide();
//重置表单
$('#expressForm')[0].reset();
//清空预览图
$('#preview').html('');
$('#expressImg').val('');
},yes:function(){
$('#expressForm').submit();
},cancel:function(){
//重置表单
$('#expressForm')[0].reset();
//清空预览图
$('#preview').html('');
$('#expressImg').val('');
}});
$('#expressForm').validator({
fields: {
expressName: {
rule:"required;",
msg:{required:"快递名称不能为空"},
tip:"请输入快递名称",
ok:"",
},
expressImg: {
rule:"required;",
msg:{required:"请上传图标"},
tip:"请上传图标",
ok:"",
}
},
valid: function(form){
var params = WST.getParams('.ipt');
params.expressId = id;
var loading = WST.msg('正在提交数据,请稍后...', {icon: 16,time:60000});
$.post(WST.U('admin/express/'+((id==0)?"add":"edit")),params,function(data,textStatus){
layer.close(loading);
var json = WST.toAdminJson(data);
if(json.status=='1'){
WST.msg("操作成功",{icon:1});
$('#expressForm')[0].reset();
//清空预览图
$('#preview').html('');
//清空图片隐藏域
$('#expressImg').val('');
layer.close(box);
mmg.load();
}else{
WST.msg(json.msg,{icon:2});
}
});
}
});
}
var isInitUpload = false;
function initUpload(){
isInitUpload = true;
//文件上传
WST.upload({
pick:'#adFilePicker',
formData: {dir:'accreds'},
accept: {extensions: 'gif,jpg,jpeg,png',mimeTypes: 'image/jpg,image/jpeg,image/png,image/gif'},
callback:function(f){
var json = WST.toAdminJson(f);
if(json.status==1){
$('#uploadMsg').empty().hide();
//将上传的图片路径赋给全局变量
$('#expressImg').val(json.savePath+json.name);
$('#preview').html('<img src="'+WST.conf.IMGURL+'/'+json.savePath+json.thumb+'" height="75" />');
}else{
WST.msg(json.msg,{icon:2});
}
},
progress:function(rate){
$('#uploadMsg').show().html('已上传'+rate+"%");
}
});
}

View File

@ -0,0 +1,59 @@
{extend name="base" /}
{block name="css"}
<link rel="stylesheet" type="text/css" href="__ADMIN__/js/mmgrid/mmGrid.css?v={$v}" />
<link rel="stylesheet" type="text/css" href="__STATIC__/plugins/webuploader/webuploader.css?v={$v}" />
{/block}
{block name="js"}
<script src="__ADMIN__/js/mmgrid/mmGrid.js?v={$v}" type="text/javascript"></script>
<script src="__ADMIN__/express/express.js?v={$v}" type="text/javascript"></script>
<script type='text/javascript' src='__STATIC__/plugins/webuploader/webuploader.js?v={$v}'></script>
{/block}
{block name="main"}
{if WSTGrant('KDGL_01')}
<div id='alertTips' class='alert alert-success alert-tips fade in'>
<div id='headTip' class='head'><i class='fa fa-lightbulb-o'></i>操作说明</div>
<ul class='body'>
<li>本功能主要用于管理快递公司的信息。快递代码主要用于物流插件的快递识别查询,填写时请参照各物流插件的快递代码填写。</li>
</ul>
</div>
<div class="wst-toolbar">
<button class="btn btn-success f-right" onclick='javascript:toEdit(0)'><i class='fa fa-plus'></i>新增</button>
<div style="clear:both"></div>
{/if}
</div>
<div class='wst-grid'>
<div id="mmg" class="mmg"></div>
<div id="pg" style="text-align: right;"></div>
</div>
<div id='expressBox' style='display:none'>
<form id='expressForm' autocomplete="off">
<table class='wst-form wst-box-top'>
<tr>
<th width='100'>快递名称<font color='red'>*</font></th>
<td><input type='text' id='expressName' name="expressName" class='ipt' maxLength='20'/></td>
</tr>
<tr>
<th width='100'>快递代码:</th>
<td><input type='text' id='expressCode' name="expressCode" class='ipt' maxLength='20'/></td>
</tr>
<tr>
<td colspan="2" style="padding-left: 35px;">快递代码是用于物流查询,请查询所启用插件的快递代码</td>
</tr>
<tr>
<th>图标:</th>
<td>
<div id='adFilePicker'>上传图标</div><span id='uploadMsg'></span>
<input type='hidden' id='expressImg' name="expressImg" class="ipt" />
</td>
</tr>
<tr>
<th>预览图:</th>
<td><div style="min-height:70px;" id="preview"></div></td>
</tr>
</table>
</form>
</div>
<script>
$(function(){initGrid()});
</script>
{/block}