mirror of https://gitee.com/karson/fastadmin.git
parent
8066902212
commit
193f33f11a
|
|
@ -21,7 +21,7 @@ class Config extends Backend
|
||||||
* @var \app\common\model\Config
|
* @var \app\common\model\Config
|
||||||
*/
|
*/
|
||||||
protected $model = null;
|
protected $model = null;
|
||||||
protected $noNeedRight = ['check'];
|
protected $noNeedRight = ['check', 'rulelist'];
|
||||||
|
|
||||||
public function _initialize()
|
public function _initialize()
|
||||||
{
|
{
|
||||||
|
|
@ -62,6 +62,7 @@ class Config extends Backend
|
||||||
}
|
}
|
||||||
$this->view->assign('siteList', $siteList);
|
$this->view->assign('siteList', $siteList);
|
||||||
$this->view->assign('typeList', ConfigModel::getTypeList());
|
$this->view->assign('typeList', ConfigModel::getTypeList());
|
||||||
|
$this->view->assign('ruleList', ConfigModel::getRegexList());
|
||||||
$this->view->assign('groupList', ConfigModel::getGroupList());
|
$this->view->assign('groupList', ConfigModel::getGroupList());
|
||||||
return $this->view->fetch();
|
return $this->view->fetch();
|
||||||
}
|
}
|
||||||
|
|
@ -201,6 +202,32 @@ class Config extends Backend
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 规则列表
|
||||||
|
* @internal
|
||||||
|
*/
|
||||||
|
public function rulelist()
|
||||||
|
{
|
||||||
|
//主键
|
||||||
|
$primarykey = $this->request->request("keyField");
|
||||||
|
//主键值
|
||||||
|
$keyValue = $this->request->request("keyValue", "");
|
||||||
|
|
||||||
|
$keyValueArr = array_filter(explode(',', $keyValue));
|
||||||
|
$regexList = \app\common\model\Config::getRegexList();
|
||||||
|
$list = [];
|
||||||
|
foreach ($regexList as $k => $v) {
|
||||||
|
if ($keyValueArr) {
|
||||||
|
if (in_array($k, $keyValueArr)) {
|
||||||
|
$list[] = ['id' => $k, 'name' => $v];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$list[] = ['id' => $k, 'name' => $v];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return json(['list' => $list]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送测试邮件
|
* 发送测试邮件
|
||||||
* @internal
|
* @internal
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ return [
|
||||||
'Array' => '数组',
|
'Array' => '数组',
|
||||||
'Array key' => '键名',
|
'Array key' => '键名',
|
||||||
'Array value' => '键值',
|
'Array value' => '键值',
|
||||||
|
'Custom' => '自定义',
|
||||||
'Content' => '数据列表',
|
'Content' => '数据列表',
|
||||||
'Rule' => '校验规则',
|
'Rule' => '校验规则',
|
||||||
'Site name' => '站点名称',
|
'Site name' => '站点名称',
|
||||||
|
|
@ -45,6 +46,8 @@ return [
|
||||||
'Fixed page' => '后台固定页',
|
'Fixed page' => '后台固定页',
|
||||||
'Category type' => '分类类型',
|
'Category type' => '分类类型',
|
||||||
'Config group' => '配置分组',
|
'Config group' => '配置分组',
|
||||||
|
'Rule tips' => '校验规则使用请参考Nice-validator文档',
|
||||||
|
'Extend tips' => '扩展属性支持{id}、{name}、{group}、{title}、{value}、{content}、{rule}替换',
|
||||||
'Mail type' => '邮件发送方式',
|
'Mail type' => '邮件发送方式',
|
||||||
'Mail smtp host' => 'SMTP服务器',
|
'Mail smtp host' => 'SMTP服务器',
|
||||||
'Mail smtp port' => 'SMTP端口',
|
'Mail smtp port' => 'SMTP端口',
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,22 @@
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
@media (max-width: 375px) {
|
@media (max-width: 375px) {
|
||||||
.edit-form tr td input{width:100%;}
|
.edit-form tr td input {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
.edit-form tr th:first-child, .edit-form tr td:first-child {
|
.edit-form tr th:first-child, .edit-form tr td:first-child {
|
||||||
width: 20%;
|
width: 20%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-form tr th:nth-last-of-type(-n+2), .edit-form tr td:nth-last-of-type(-n+2) {
|
.edit-form tr th:nth-last-of-type(-n+2), .edit-form tr td:nth-last-of-type(-n+2) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-form table > tbody > tr td a.btn-delcfg {
|
.edit-form table > tbody > tr td a.btn-delcfg {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.edit-form table > tbody > tr:hover td a.btn-delcfg {
|
.edit-form table > tbody > tr:hover td a.btn-delcfg {
|
||||||
visibility: visible;
|
visibility: visible;
|
||||||
}
|
}
|
||||||
|
|
@ -22,8 +28,8 @@
|
||||||
{foreach $siteList as $index=>$vo}
|
{foreach $siteList as $index=>$vo}
|
||||||
<li class="{$vo.active?'active':''}"><a href="#{$vo.name}" data-toggle="tab">{:__($vo.title)}</a></li>
|
<li class="{$vo.active?'active':''}"><a href="#{$vo.name}" data-toggle="tab">{:__($vo.title)}</a></li>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<li>
|
<li data-toggle="tooltip" title="{:__('Add new config')}">
|
||||||
<a href="#addcfg" data-toggle="tab" title="{:__('Add new config')}"><i class="fa fa-plus"></i></a>
|
<a href="#addcfg" data-toggle="tab"><i class="fa fa-plus"></i></a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -91,7 +97,8 @@
|
||||||
{case value="selects"}
|
{case value="selects"}
|
||||||
<select {$item.extend} name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-tip="{$item.tip}" {$item.type=='selects'?'multiple':''}>
|
<select {$item.extend} name="row[{$item.name}]{$item.type=='selects'?'[]':''}" class="form-control selectpicker" data-tip="{$item.tip}" {$item.type=='selects'?'multiple':''}>
|
||||||
{foreach name="item.content" item="vo"}
|
{foreach name="item.content" item="vo"}
|
||||||
<option value="{$key}" {in name="key" value="$item.value"}selected{/in}>{$vo}</option>
|
<option value="{$key}" {in name="key" value="$item.value" }selected{
|
||||||
|
/in}>{$vo}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
{/case}
|
{/case}
|
||||||
|
|
@ -124,6 +131,9 @@
|
||||||
<label for="row[{$item.name}]-yes"><input id="row[{$item.name}]-yes" name="row[{$item.name}]" type="radio" value="1" {$item.value?'checked':''} data-tip="{$item.tip}" /> {:__('Yes')}</label>
|
<label for="row[{$item.name}]-yes"><input id="row[{$item.name}]-yes" name="row[{$item.name}]" type="radio" value="1" {$item.value?'checked':''} data-tip="{$item.tip}" /> {:__('Yes')}</label>
|
||||||
<label for="row[{$item.name}]-no"><input id="row[{$item.name}]-no" name="row[{$item.name}]" type="radio" value="0" {$item.value?'':'checked'} data-tip="{$item.tip}" /> {:__('No')}</label>
|
<label for="row[{$item.name}]-no"><input id="row[{$item.name}]-no" name="row[{$item.name}]" type="radio" value="0" {$item.value?'':'checked'} data-tip="{$item.tip}" /> {:__('No')}</label>
|
||||||
{/case}
|
{/case}
|
||||||
|
{case custom}
|
||||||
|
{$item.extend}
|
||||||
|
{/case}
|
||||||
{/switch}
|
{/switch}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4"></div>
|
<div class="col-sm-4"></div>
|
||||||
|
|
@ -153,22 +163,25 @@
|
||||||
{/foreach}
|
{/foreach}
|
||||||
<div class="tab-pane fade" id="addcfg">
|
<div class="tab-pane fade" id="addcfg">
|
||||||
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('general.config/add')}">
|
<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="{:url('general.config/add')}">
|
||||||
|
{:token()}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
|
||||||
<div class="col-xs-12 col-sm-4">
|
<div class="col-xs-12 col-sm-4">
|
||||||
<select name="row[type]" class="form-control selectpicker">
|
<select name="row[type]" class="form-control selectpicker">
|
||||||
{foreach name="typeList" item="vo"}
|
{foreach name="typeList" item="vo"}
|
||||||
<option value="{$key}" {in name="key" value="string"}selected{/in}>{$vo}</option>
|
<option value="{$key}" {in name="key" value="string" }selected{
|
||||||
|
/in}>{$vo}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="group" class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
|
<label class="control-label col-xs-12 col-sm-2">{:__('Group')}:</label>
|
||||||
<div class="col-xs-12 col-sm-4">
|
<div class="col-xs-12 col-sm-4">
|
||||||
<select name="row[group]" class="form-control selectpicker">
|
<select name="row[group]" class="form-control selectpicker">
|
||||||
{foreach name="groupList" item="vo"}
|
{foreach name="groupList" item="vo"}
|
||||||
<option value="{$key}" {in name="key" value="basic"}selected{/in}>{$vo}</option>
|
<option value="{$key}" {in name="key" value="basic" }selected{
|
||||||
|
/in}>{$vo}</option>
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -194,7 +207,7 @@
|
||||||
<div class="form-group hide" id="add-content-container">
|
<div class="form-group hide" id="add-content-container">
|
||||||
<label for="content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
<label for="content" class="control-label col-xs-12 col-sm-2">{:__('Content')}:</label>
|
||||||
<div class="col-xs-12 col-sm-4">
|
<div class="col-xs-12 col-sm-4">
|
||||||
<textarea name="row[content]" id="content" cols="30" rows="5" class="form-control" data-rule="required">value1|title1
|
<textarea name="row[content]" id="content" cols="30" rows="5" class="form-control" data-rule="required(content)">value1|title1
|
||||||
value2|title2</textarea>
|
value2|title2</textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -207,13 +220,24 @@ value2|title2</textarea>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="rule" class="control-label col-xs-12 col-sm-2">{:__('Rule')}:</label>
|
<label for="rule" class="control-label col-xs-12 col-sm-2">{:__('Rule')}:</label>
|
||||||
<div class="col-xs-12 col-sm-4">
|
<div class="col-xs-12 col-sm-4">
|
||||||
<input type="text" class="form-control" id="rule" name="row[rule]" value="" />
|
<div class="input-group pull-left">
|
||||||
|
<input type="text" class="form-control" id="rule" name="row[rule]" value="" data-tip="{:__('Rule tips')}"/>
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button class="btn btn-primary dropdown-toggle" data-toggle="dropdown" type="button">{:__('Choose')}</button>
|
||||||
|
<ul class="dropdown-menu pull-right rulelist">
|
||||||
|
{volist name="ruleList" id="item"}
|
||||||
|
<li><a href="javascript:;" data-value="{$key}">{$item}<span class="text-muted">({$key})</span></a></li>
|
||||||
|
{/volist}
|
||||||
|
</ul>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<span class="msg-box n-right" for="rule"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="extend" class="control-label col-xs-12 col-sm-2">{:__('Extend')}:</label>
|
<label for="extend" class="control-label col-xs-12 col-sm-2">{:__('Extend')}:</label>
|
||||||
<div class="col-xs-12 col-sm-4">
|
<div class="col-xs-12 col-sm-4">
|
||||||
<textarea name="row[extend]" id="extend" cols="30" rows="5" class="form-control" data-rule=""></textarea>
|
<textarea name="row[extend]" id="extend" cols="30" rows="5" class="form-control" data-tip="{:__('Extend tips')}" data-rule="required(extend)" data-msg-extend="当类型为自定义时,扩展属性不能为空"></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,16 @@ class Config extends Model
|
||||||
return $regexList;
|
return $regexList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getExtendAttr($value, $data)
|
||||||
|
{
|
||||||
|
$result = preg_replace_callback("/\{([a-zA-Z]+)\}/", function ($matches) use ($data) {
|
||||||
|
if (isset($data[$matches[1]])) {
|
||||||
|
return $data[$matches[1]];
|
||||||
|
}
|
||||||
|
}, $data['extend']);
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 读取分类分组列表
|
* 读取分类分组列表
|
||||||
* @return array
|
* @return array
|
||||||
|
|
|
||||||
|
|
@ -51,9 +51,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
Form.api.bindevent($("form.edit-form"));
|
Form.api.bindevent($("form.edit-form"));
|
||||||
|
|
||||||
//不可见的元素不验证
|
//不可见的元素不验证
|
||||||
$("form#add-form").data("validator-options", {ignore: ':hidden'});
|
$("form#add-form").data("validator-options", {
|
||||||
Form.api.bindevent($("form#add-form"), null, function (ret) {
|
ignore: ':hidden',
|
||||||
|
rules: {
|
||||||
|
content: function () {
|
||||||
|
return ['radio', 'checkbox', 'select', 'selects'].indexOf($("#add-form select[name='row[type]']").val()) > -1;
|
||||||
|
},
|
||||||
|
extend: function () {
|
||||||
|
return $("#add-form select[name='row[type]']").val() == 'custom';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Form.api.bindevent($("form#add-form"), function (ret) {
|
||||||
|
setTimeout(function () {
|
||||||
location.reload();
|
location.reload();
|
||||||
|
}, 1500);
|
||||||
});
|
});
|
||||||
|
|
||||||
//切换显示隐藏变量字典列表
|
//切换显示隐藏变量字典列表
|
||||||
|
|
@ -61,6 +73,20 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
$("#add-content-container").toggleClass("hide", ['select', 'selects', 'checkbox', 'radio'].indexOf($(this).val()) > -1 ? false : true);
|
$("#add-content-container").toggleClass("hide", ['select', 'selects', 'checkbox', 'radio'].indexOf($(this).val()) > -1 ? false : true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
//选择规则
|
||||||
|
$(document).on("click", ".rulelist > li > a", function () {
|
||||||
|
var ruleArr = $("#rule").val() == '' ? [] : $("#rule").val().split(";");
|
||||||
|
var rule = $(this).data("value");
|
||||||
|
var index = ruleArr.indexOf(rule);
|
||||||
|
if (index > -1) {
|
||||||
|
ruleArr.splice(index, 1);
|
||||||
|
} else {
|
||||||
|
ruleArr.push(rule);
|
||||||
|
}
|
||||||
|
$("#rule").val(ruleArr.join(";"));
|
||||||
|
$(this).parent().toggleClass("active");
|
||||||
|
});
|
||||||
|
|
||||||
//添加向发件人发送测试邮件按钮和方法
|
//添加向发件人发送测试邮件按钮和方法
|
||||||
$('input[name="row[mail_from]"]').parent().next().append('<a class="btn btn-info testmail">' + __('Send a test message') + '</a>');
|
$('input[name="row[mail_from]"]').parent().next().append('<a class="btn btn-info testmail">' + __('Send a test message') + '</a>');
|
||||||
$(document).on("click", ".testmail", function () {
|
$(document).on("click", ".testmail", function () {
|
||||||
|
|
@ -77,7 +103,10 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefin
|
||||||
//删除配置
|
//删除配置
|
||||||
$(document).on("click", ".btn-delcfg", function () {
|
$(document).on("click", ".btn-delcfg", function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
Layer.confirm(__('Are you sure you want to delete this item?'), {icon: 3, title:'提示'}, function (index) {
|
Layer.confirm(__('Are you sure you want to delete this item?'), {
|
||||||
|
icon: 3,
|
||||||
|
title: '提示'
|
||||||
|
}, function (index) {
|
||||||
Backend.api.ajax({
|
Backend.api.ajax({
|
||||||
url: "general/config/del",
|
url: "general/config/del",
|
||||||
data: {name: $(that).data("name")}
|
data: {name: $(that).data("name")}
|
||||||
|
|
|
||||||
|
|
@ -7295,6 +7295,9 @@ define('upload',['jquery', 'bootstrap', 'plupload', 'template'], function ($, un
|
||||||
elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
|
elem = el.name && _checkable(el) ? me.$el.find('input[name="'+ el.name +'"]').get(0) : el;
|
||||||
// Get field
|
// Get field
|
||||||
if (!(field = me.getField(elem)) || !field.rule) {
|
if (!(field = me.getField(elem)) || !field.rule) {
|
||||||
|
if(!field.rule){
|
||||||
|
me.hideMsg(el);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Cache event type
|
// Cache event type
|
||||||
|
|
@ -9355,7 +9358,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
||||||
complete: function (xhr) {
|
complete: function (xhr) {
|
||||||
var token = xhr.getResponseHeader('__token__');
|
var token = xhr.getResponseHeader('__token__');
|
||||||
if (token) {
|
if (token) {
|
||||||
$("input[name='__token__']", form).val(token);
|
$("input[name='__token__']").val(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
|
|
@ -9363,7 +9366,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
||||||
if (data && typeof data === 'object') {
|
if (data && typeof data === 'object') {
|
||||||
//刷新客户端token
|
//刷新客户端token
|
||||||
if (typeof data.token !== 'undefined') {
|
if (typeof data.token !== 'undefined') {
|
||||||
$("input[name='__token__']", form).val(data.token);
|
$("input[name='__token__']").val(data.token);
|
||||||
}
|
}
|
||||||
//调用客户端事件
|
//调用客户端事件
|
||||||
if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
|
if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
|
||||||
|
|
@ -9377,7 +9380,7 @@ define('form',['jquery', 'bootstrap', 'upload', 'validator'], function ($, undef
|
||||||
}
|
}
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
|
if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
|
||||||
$("input[name='__token__']", form).val(data.token);
|
$("input[name='__token__']").val(data.token);
|
||||||
}
|
}
|
||||||
if (typeof error === 'function') {
|
if (typeof error === 'function') {
|
||||||
if (false === error.call(form, data, ret)) {
|
if (false === error.call(form, data, ret)) {
|
||||||
|
|
@ -11813,13 +11816,17 @@ define("addtabs", function(){});
|
||||||
SelectPage.prototype.setElem = function (combo_input) {
|
SelectPage.prototype.setElem = function (combo_input) {
|
||||||
// 1. build Dom object
|
// 1. build Dom object
|
||||||
var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
|
var elem = {}, p = this.option, css = this.css_class, msg = this.message, input = $(combo_input);
|
||||||
|
var cssWidth = input.css("width");
|
||||||
var orgWidth = input.outerWidth();
|
var orgWidth = input.outerWidth();
|
||||||
|
if (cssWidth.indexOf("%") > -1 || input.parent().size() > 0 && input.parent().width() == orgWidth) {
|
||||||
|
orgWidth = "100%";
|
||||||
|
} else {
|
||||||
// fix input width in hidden situation
|
// fix input width in hidden situation
|
||||||
if (orgWidth <= 0)
|
if (orgWidth <= 0)
|
||||||
orgWidth = this.elementRealSize(input, 'outerWidth');
|
orgWidth = this.elementRealSize(input, 'outerWidth');
|
||||||
if (orgWidth < 150)
|
if (orgWidth < 150)
|
||||||
orgWidth = 150;
|
orgWidth = 150;
|
||||||
|
}
|
||||||
elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
|
elem.combo_input = input.attr({'autocomplete': 'off'}).addClass(css.input).wrap('<div>');
|
||||||
if (p.selectOnly)
|
if (p.selectOnly)
|
||||||
elem.combo_input.prop('readonly', true);
|
elem.combo_input.prop('readonly', true);
|
||||||
|
|
@ -11865,7 +11872,7 @@ define("addtabs", function(){});
|
||||||
id: hidden_id
|
id: hidden_id
|
||||||
}).val('');
|
}).val('');
|
||||||
elem.combo_input.attr({
|
elem.combo_input.attr({
|
||||||
name: input_name + namePrefix,
|
name: typeof input.data('name') !== 'undefined' ? input.data('name') : input_name + namePrefix,
|
||||||
id: input_id + namePrefix
|
id: input_id + namePrefix
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -11961,11 +11968,8 @@ define("addtabs", function(){});
|
||||||
data = [data[0]];
|
data = [data[0]];
|
||||||
self.afterInit(self, data);
|
self.afterInit(self, data);
|
||||||
} else {//ajax data source mode to init selected item
|
} else {//ajax data source mode to init selected item
|
||||||
$.ajax({
|
var _paramsFunc = p.params, _params = {}, searchKey = p.searchField;
|
||||||
dataType: 'json',
|
var _orgParams = {
|
||||||
type: 'POST',
|
|
||||||
url: p.data,
|
|
||||||
data: {
|
|
||||||
searchTable: p.dbTable,
|
searchTable: p.dbTable,
|
||||||
searchKey: p.keyField,
|
searchKey: p.keyField,
|
||||||
searchValue: key,
|
searchValue: key,
|
||||||
|
|
@ -11974,7 +11978,22 @@ define("addtabs", function(){});
|
||||||
keyField: p.keyField,
|
keyField: p.keyField,
|
||||||
keyValue: key,
|
keyValue: key,
|
||||||
searchField: p.searchField
|
searchField: p.searchField
|
||||||
},
|
};
|
||||||
|
if (_paramsFunc) {
|
||||||
|
var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
|
||||||
|
if (result && $.isPlainObject(result)) {
|
||||||
|
_params = $.extend({}, _orgParams, result);
|
||||||
|
} else {
|
||||||
|
_params = _orgParams;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
_params = _orgParams;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
dataType: 'json',
|
||||||
|
type: 'POST',
|
||||||
|
url: p.data,
|
||||||
|
data: _params,
|
||||||
success: function (json) {
|
success: function (json) {
|
||||||
var d = null;
|
var d = null;
|
||||||
if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
|
if (p.eAjaxSuccess && $.isFunction(p.eAjaxSuccess))
|
||||||
|
|
@ -12543,14 +12562,15 @@ define("addtabs", function(){});
|
||||||
};
|
};
|
||||||
_orgParams[searchKey] = q_word[0];
|
_orgParams[searchKey] = q_word[0];
|
||||||
if (_paramsFunc) {
|
if (_paramsFunc) {
|
||||||
var result = $.isFunction(_paramsFunc) ? _paramsFunc() : _paramsFunc;
|
var result = $.isFunction(_paramsFunc) ? _paramsFunc(self) : _paramsFunc;
|
||||||
if (result && $.isPlainObject(result)) {
|
if (result && $.isPlainObject(result)) {
|
||||||
_params = $.extend({}, _orgParams, result);
|
_params = $.extend({}, _orgParams, result);
|
||||||
} else {
|
} else {
|
||||||
_params = _orgParams;
|
_params = _orgParams;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
_params = _orgParams;
|
_params = _orgParams;
|
||||||
|
}
|
||||||
self.prop.xhr = $.ajax({
|
self.prop.xhr = $.ajax({
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
url: p.data,
|
url: p.data,
|
||||||
|
|
@ -13553,6 +13573,5 @@ define("addtabs", function(){});
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
})(window.jQuery);
|
})(window.jQuery);
|
||||||
|
|
||||||
define("selectpage", function(){});
|
define("selectpage", function(){});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -431,7 +431,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
|
||||||
complete: function (xhr) {
|
complete: function (xhr) {
|
||||||
var token = xhr.getResponseHeader('__token__');
|
var token = xhr.getResponseHeader('__token__');
|
||||||
if (token) {
|
if (token) {
|
||||||
$("input[name='__token__']", form).val(token);
|
$("input[name='__token__']").val(token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
|
|
@ -439,7 +439,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
|
||||||
if (data && typeof data === 'object') {
|
if (data && typeof data === 'object') {
|
||||||
//刷新客户端token
|
//刷新客户端token
|
||||||
if (typeof data.token !== 'undefined') {
|
if (typeof data.token !== 'undefined') {
|
||||||
$("input[name='__token__']", form).val(data.token);
|
$("input[name='__token__']").val(data.token);
|
||||||
}
|
}
|
||||||
//调用客户端事件
|
//调用客户端事件
|
||||||
if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
|
if (typeof data.callback !== 'undefined' && typeof data.callback === 'function') {
|
||||||
|
|
@ -453,7 +453,7 @@ define(['jquery', 'bootstrap', 'upload', 'validator'], function ($, undefined, U
|
||||||
}
|
}
|
||||||
}, function (data, ret) {
|
}, function (data, ret) {
|
||||||
if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
|
if (data && typeof data === 'object' && typeof data.token !== 'undefined') {
|
||||||
$("input[name='__token__']", form).val(data.token);
|
$("input[name='__token__']").val(data.token);
|
||||||
}
|
}
|
||||||
if (typeof error === 'function') {
|
if (typeof error === 'function') {
|
||||||
if (false === error.call(form, data, ret)) {
|
if (false === error.call(form, data, ret)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue