mirror of https://gitee.com/karson/fastadmin.git
parent
62d77f9f96
commit
c29e0accc7
|
|
@ -29,7 +29,17 @@ return [
|
|||
'Article' => '文章',
|
||||
'Page' => '单页',
|
||||
'OK' => '确定',
|
||||
'Apply' => '应用',
|
||||
'Cancel' => '取消',
|
||||
'Clear' => '清空',
|
||||
'Custom Range' => '自定义',
|
||||
'Cancel' => '取消',
|
||||
'Today' => '今天',
|
||||
'Yesterday' => '昨天',
|
||||
'Last 7 days' => '最近7天',
|
||||
'Last 30 days' => '最近30天',
|
||||
'Last month' => '上月',
|
||||
'This month' => '本月',
|
||||
'Loading' => '加载中',
|
||||
'More' => '更多',
|
||||
'Yes' => '是',
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ trait Backend
|
|||
}
|
||||
else
|
||||
{
|
||||
$count = $this->model->destory($ids);
|
||||
$count = $this->model->destroy($ids);
|
||||
}
|
||||
if ($count)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -300,6 +300,14 @@ class Backend extends Controller
|
|||
}
|
||||
$where[] = [$k, $sym, $arr];
|
||||
break;
|
||||
case 'RANGE':
|
||||
case 'NOT RANGE':
|
||||
$v = str_replace(' - ', ',', $v);
|
||||
$arr = array_slice(explode(',', $v), 0, 2);
|
||||
if (stripos($v, ',') === false || !array_filter($arr))
|
||||
continue;
|
||||
$where[] = [$k, str_replace('RANGE', 'BETWEEN', $sym) . ' time', $arr];
|
||||
break;
|
||||
case 'LIKE':
|
||||
case 'LIKE %...%':
|
||||
$where[] = [$k, 'LIKE', "%{$v}%"];
|
||||
|
|
|
|||
|
|
@ -30,7 +30,8 @@
|
|||
"Sortable": "^1.5.0",
|
||||
"nice-validator": "^1.1.1",
|
||||
"art-template": "^3.0.1",
|
||||
"requirejs-plugins": "^1.0.3"
|
||||
"requirejs-plugins": "^1.0.3",
|
||||
"bootstrap-daterangepicker": "^2.1.25"
|
||||
},
|
||||
"devDependencies": {
|
||||
"dragsort": "https://github.com/karsonzhang/dragsort.git",
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
@import url("../libs/layer/build/skin/default/layer.css");
|
||||
@import url("../libs/bootstrap-table/dist/bootstrap-table.min.css");
|
||||
@import url("../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css");
|
||||
@import url("../libs/bootstrap-daterangepicker/daterangepicker.css");
|
||||
@import url("../libs/nice-validator/dist/jquery.validator.css");
|
||||
@import url("../libs/selectpage/selectpage.css");
|
||||
body {
|
||||
|
|
@ -77,6 +78,12 @@ html.ios-fix body {
|
|||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.row-between .col-xs-6 + .col-xs-6:before {
|
||||
content: "-";
|
||||
position: absolute;
|
||||
left: -2%;
|
||||
top: 6px;
|
||||
}
|
||||
@media only screen and (min-width: 481px) {
|
||||
.row-flex {
|
||||
display: flex;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -3,7 +3,7 @@
|
|||
* @version: v0.0.1
|
||||
*
|
||||
* @update 2017-05-07 <http://git.oschina.net/pp/fastadmin>
|
||||
* @update 2017-09-09 <http://git.oschina.net/karson/fastadmin>
|
||||
* @update 2017-09-17 <http://git.oschina.net/karson/fastadmin>
|
||||
*/
|
||||
|
||||
!function ($) {
|
||||
|
|
@ -46,6 +46,46 @@
|
|||
});
|
||||
});
|
||||
}
|
||||
if ($(".datetimerange", form).size() > 0) {
|
||||
var ranges = {};
|
||||
ranges[__('Today')] = [Moment().startOf('day'), Moment().endOf('day')];
|
||||
ranges[__('Yesterday')] = [Moment().subtract(1, 'days').startOf('day'), Moment().subtract(1, 'days').endOf('day')];
|
||||
ranges[__('Last 7 Days')] = [Moment().subtract(6, 'days').startOf('day'), Moment().endOf('day')];
|
||||
ranges[__('Last 30 Days')] = [Moment().subtract(29, 'days').startOf('day'), Moment().endOf('day')];
|
||||
ranges[__('This Month')] = [Moment().startOf('month'), Moment().endOf('month')];
|
||||
ranges[__('Last Month')] = [Moment().subtract(1, 'month').startOf('month'), Moment().subtract(1, 'month').endOf('month')];
|
||||
var options = {
|
||||
timePicker: false,
|
||||
autoUpdateInput: false,
|
||||
timePickerSeconds: true,
|
||||
timePicker24Hour: true,
|
||||
autoApply: true,
|
||||
locale: {
|
||||
format: 'YYYY-MM-DD HH:mm:ss',
|
||||
customRangeLabel: __("Custom Range"),
|
||||
applyLabel: __("Apply"),
|
||||
cancelLabel: __("Clear"),
|
||||
},
|
||||
ranges: ranges,
|
||||
};
|
||||
var callback = function (start, end) {
|
||||
$(this.element).val(start.format(options.locale.format) + " - " + end.format(options.locale.format));
|
||||
};
|
||||
var column, index;
|
||||
require(['bootstrap-daterangepicker'], function () {
|
||||
$(".datetimerange").each(function () {
|
||||
$(this).on('apply.daterangepicker', function (ev, picker) {
|
||||
callback.call(picker, picker.startDate, picker.endDate);
|
||||
});
|
||||
$(this).on('cancel.daterangepicker', function (ev, picker) {
|
||||
$(this).val('');
|
||||
});
|
||||
index = $(this).data("index");
|
||||
column = pColumns[index];
|
||||
$(this).daterangepicker($.extend({}, options, column.options || {}), callback);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// 表单提交
|
||||
form.on("submit", function (event) {
|
||||
|
|
@ -64,7 +104,7 @@
|
|||
|
||||
var createFormCommon = function (pColumns, that) {
|
||||
var htmlForm = [];
|
||||
var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN', 'NOT IN', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'IS NULL', 'IS NOT NULL'];
|
||||
var opList = ['=', '>', '>=', '<', '<=', '!=', 'LIKE', 'LIKE %...%', 'NOT LIKE', 'IN', 'NOT IN', 'IN(...)', 'NOT IN(...)', 'BETWEEN', 'NOT BETWEEN', 'RANGE', 'NOT RANGE', 'IS NULL', 'IS NOT NULL'];
|
||||
htmlForm.push(sprintf('<form class="form-horizontal form-commonsearch" action="%s" >', that.options.actionForm));
|
||||
htmlForm.push('<fieldset>');
|
||||
if (that.options.titleForm.length > 0)
|
||||
|
|
@ -130,16 +170,12 @@
|
|||
var defaultValue = typeof vObjCol.defaultValue === 'undefined' ? '' : vObjCol.defaultValue;
|
||||
if (/BETWEEN$/.test(vObjCol.operate)) {
|
||||
var defaultValueArr = /^.+|.+$/.test(defaultValue) ? defaultValue.split('|') : ['', ''];
|
||||
htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValueArr[0], placeholder, vObjCol.field, style, data));
|
||||
|
||||
htmlForm.push('<div class="row row-between">');
|
||||
htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addclass, vObjCol.field, defaultValueArr[0], placeholder, vObjCol.field, i, style, data));
|
||||
htmlForm.push(sprintf('<div class="col-xs-6"><input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s></div>', type, addclass, vObjCol.field, defaultValueArr[1], placeholder, vObjCol.field, i, style, data));
|
||||
htmlForm.push('</div>');
|
||||
htmlForm.push('</div>');
|
||||
htmlForm.push('<div class="form-group col-xs-12 col-sm-6 col-md-4 col-lg-3">');
|
||||
htmlForm.push(sprintf('<label for="%s" class="control-label col-xs-4">%s</label>', vObjCol.field, "-"));
|
||||
htmlForm.push('<div class="col-xs-8">');
|
||||
htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValueArr[1], placeholder, vObjCol.field, style, data));
|
||||
} else {
|
||||
htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" %s %s>', type, addclass, vObjCol.field, defaultValue, placeholder, vObjCol.field, style, data));
|
||||
htmlForm.push(sprintf('<input type="%s" class="%s" name="%s" value="%s" placeholder="%s" id="%s" data-index="%s" %s %s>', type, addclass, vObjCol.field, defaultValue, placeholder, vObjCol.field, i, style, data));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,13 +232,6 @@
|
|||
if (typeof vObjCol.process === 'function') {
|
||||
value_begin = vObjCol.process(value_begin, 'begin');
|
||||
value_end = vObjCol.process(value_end, 'end');
|
||||
} else if ($("[name='" + name + "']:first", that.$commonsearch).attr('type') === 'datetime') { //datetime类型字段转换成时间戳
|
||||
var Hms = Moment(value_begin).format("HH:mm:ss");
|
||||
value_begin = value_begin ? parseInt(Moment(value_begin) / 1000) : '';
|
||||
value_end = value_end ? parseInt(Moment(value_end) / 1000) : '';
|
||||
if (value_begin === value_end && '00:00:00' === Hms) {
|
||||
value_end += 86399;
|
||||
}
|
||||
}
|
||||
value = value_begin + ',' + value_end;
|
||||
} else {
|
||||
|
|
@ -266,7 +295,6 @@
|
|||
'common-search.bs.table': 'onCommonSearch',
|
||||
'post-common-search.bs.table': 'onPostCommonSearch'
|
||||
});
|
||||
|
||||
$.extend($.fn.bootstrapTable.locales[$.fn.bootstrapTable.defaults.locale], {
|
||||
formatCommonSearch: function () {
|
||||
return "Common search";
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ require.config({
|
|||
'jquery': '../libs/jquery/dist/jquery.min',
|
||||
'bootstrap': '../libs/bootstrap/dist/js/bootstrap.min',
|
||||
'bootstrap-datetimepicker': '../libs/eonasdan-bootstrap-datetimepicker/build/js/bootstrap-datetimepicker.min',
|
||||
'bootstrap-daterangepicker': '../libs/bootstrap-daterangepicker/daterangepicker',
|
||||
'bootstrap-select': '../libs/bootstrap-select/dist/js/bootstrap-select.min',
|
||||
'bootstrap-select-lang': '../libs/bootstrap-select/dist/js/i18n/defaults-zh_CN',
|
||||
'bootstrap-table': '../libs/bootstrap-table/dist/bootstrap-table.min',
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -13,6 +13,7 @@
|
|||
@import url("../libs/layer/build/skin/default/layer.css");
|
||||
@import url("../libs/bootstrap-table/dist/bootstrap-table.min.css");
|
||||
@import url("../libs/eonasdan-bootstrap-datetimepicker/build/css/bootstrap-datetimepicker.min.css");
|
||||
@import url("../libs/bootstrap-daterangepicker/daterangepicker.css");
|
||||
@import url("../libs/nice-validator/dist/jquery.validator.css");
|
||||
@import url("../libs/selectpage/selectpage.css");
|
||||
|
||||
|
|
@ -97,6 +98,15 @@ html.ios-fix,html.ios-fix body {
|
|||
}
|
||||
}
|
||||
|
||||
.row-between{
|
||||
.col-xs-6 + .col-xs-6:before {
|
||||
content: "-";
|
||||
position: absolute;
|
||||
left: -2%;
|
||||
top: 6px;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (min-width : 481px) {
|
||||
.row-flex {
|
||||
display: flex;
|
||||
|
|
|
|||
Loading…
Reference in New Issue