修复日历事件共享bug
This commit is contained in:
@@ -21,17 +21,7 @@ class WidgetController extends DefaultController
|
||||
->permission('receive_id')
|
||||
->orderBy('created_at', 'desc');
|
||||
|
||||
// 查询是否已经阅读
|
||||
$reader = function ($q) {
|
||||
$q->selectRaw('1')
|
||||
->from('article_reader')
|
||||
->whereRaw('article_reader.article_id = article.id')
|
||||
->where('article_reader.created_id', auth()->id());
|
||||
};
|
||||
$model->whereNotExists($reader);
|
||||
|
||||
$rows = $model->get(['id', 'name', 'created_at']);
|
||||
|
||||
$rows = $model->limit(15)->get(['id', 'name', 'created_at']);
|
||||
$json['total'] = sizeof($rows);
|
||||
$json['data'] = $rows;
|
||||
return $json;
|
||||
@@ -73,6 +63,7 @@ class WidgetController extends DefaultController
|
||||
'count2' => $count2,
|
||||
'rate' => $rate,
|
||||
];
|
||||
|
||||
return $this->render([
|
||||
'dates' => $config['dates'],
|
||||
'info' => $config['info'],
|
||||
|
||||
@@ -14,7 +14,7 @@ return [
|
||||
'more_url' => 'article/article/index',
|
||||
],
|
||||
'info_article_index' => [
|
||||
'name' => '新增公告',
|
||||
'name' => '未读公告',
|
||||
'type' => 2,
|
||||
'url' => 'article/widget/info',
|
||||
'more_url' => 'article/article/index',
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="info-r">
|
||||
<div>较{{$dates[$info['params']['date']]}}</div>
|
||||
<div>比{{$dates[$info['params']['date']]}}</div>
|
||||
<div class="rate @if($res['rate'] > 100) red @endif">{{$res['rate']}}%</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -58,16 +58,16 @@ class CalendarController extends DefaultController
|
||||
$url = url('event/index', ['calendar_id'=>$calendar['id']]);
|
||||
}
|
||||
$sources[] = [
|
||||
'url' => $url,
|
||||
'id' => $calendar['id'],
|
||||
'userid' => $calendar['userid'],
|
||||
'url' => $url,
|
||||
'id' => $calendar['id'],
|
||||
'userid' => $calendar['userid'],
|
||||
'backgroundColor' => $calendar['calendarcolor'],
|
||||
"borderColor" => $calendar['calendarcolor'],
|
||||
"borderColor" => $calendar['calendarcolor'],
|
||||
];
|
||||
}
|
||||
return $this->json([
|
||||
'calendars' => $calendars,
|
||||
'sources' => $sources,
|
||||
'sources' => $sources,
|
||||
], true);
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class EventController extends DefaultController
|
||||
}
|
||||
|
||||
// 获取共享事件
|
||||
$shared = ShareService::getItemsSourceBy(['event'], $gets['user_id']);
|
||||
$shared = ShareService::getItemsSourceBy(['event'], $gets['user_id'], $gets['start'], $gets['end']);
|
||||
$share_id = Arr::pluck($shared, 'source_id');
|
||||
if (count($share_id)) {
|
||||
$share = Arr::pluck($shared, 'name', 'source_id');
|
||||
|
||||
@@ -15,7 +15,7 @@ class Controller extends BaseController
|
||||
/**
|
||||
* @var 程序版本
|
||||
*/
|
||||
public $version = '2.3.4';
|
||||
public $version = '2.3.5';
|
||||
|
||||
/**
|
||||
* @var 配置参数
|
||||
|
||||
@@ -17,7 +17,6 @@ class DashboardController extends DefaultController
|
||||
$widgets = DB::table('widget')
|
||||
->where('type', 1)
|
||||
->where('status', 1)
|
||||
->where('default', 1)
|
||||
->permission('receive_id')
|
||||
->orderBy('sort', 'asc')
|
||||
->get();
|
||||
@@ -30,7 +29,6 @@ class DashboardController extends DefaultController
|
||||
$widgets->transform(function ($row) use($user_widgets) {
|
||||
$user_widget = $user_widgets[$row['id']];
|
||||
if (not_empty($user_widget)) {
|
||||
$row['id'] = $user_widget['id'];
|
||||
$row['status'] = $user_widget['status'];
|
||||
$row['grid'] = $user_widget['grid'];
|
||||
$row['sort'] = $user_widget['sort'];
|
||||
@@ -44,15 +42,16 @@ class DashboardController extends DefaultController
|
||||
$row['icon'] = $user_widget['icon'];
|
||||
}
|
||||
$row['params'] = json_decode($user_widget['params'], true);
|
||||
return $row;
|
||||
} else {
|
||||
$row['status'] = $row['default'] == 1;
|
||||
}
|
||||
return $row;
|
||||
});
|
||||
$widgets = $widgets->sortBy('sort');
|
||||
$widgets = $widgets->sortBy('sort')->values();
|
||||
|
||||
$infos = DB::table('widget')
|
||||
->where('type', 2)
|
||||
->where('status', 1)
|
||||
->where('default', 1)
|
||||
->permission('receive_id')
|
||||
->orderBy('sort', 'asc')
|
||||
->get();
|
||||
@@ -65,7 +64,6 @@ class DashboardController extends DefaultController
|
||||
$infos->transform(function ($row) use($user_infos) {
|
||||
$user_info = $user_infos[$row['id']];
|
||||
if (not_empty($user_info)) {
|
||||
$row['id'] = $user_info['id'];
|
||||
$row['status'] = $user_info['status'];
|
||||
$row['sort'] = $user_info['sort'];
|
||||
if ($user_info['name']) {
|
||||
@@ -78,10 +76,12 @@ class DashboardController extends DefaultController
|
||||
$row['icon'] = $user_info['icon'];
|
||||
}
|
||||
$row['params'] = json_decode($user_info['params'], true);
|
||||
return $row;
|
||||
} else {
|
||||
$row['status'] = $row['default'] == 1;
|
||||
}
|
||||
return $row;
|
||||
});
|
||||
$infos = $infos->sortBy('sort');
|
||||
$infos = $infos->sortBy('sort')->values();
|
||||
|
||||
$quicks = Menu::leftJoin('user_widget', 'user_widget.node_id', '=', 'menu.id')
|
||||
->where('user_widget.user_id', $auth['id'])
|
||||
@@ -159,15 +159,14 @@ class DashboardController extends DefaultController
|
||||
$widgets = DB::table('widget')
|
||||
->where('type', 1)
|
||||
->where('status', 1)
|
||||
->where('default', 1)
|
||||
->permission('receive_id')
|
||||
->orderBy('sort', 'asc')
|
||||
->get(['id', 'name', 'color', 'icon', 'grid', 'status']);
|
||||
->get();
|
||||
|
||||
$user_widgets = UserWidget::where('user_id', $auth['id'])
|
||||
->where('type', 1)
|
||||
->orderBy('sort', 'asc')
|
||||
->get(['id', 'name', 'color', 'icon', 'grid', 'node_id', 'status'])->keyBy('node_id');
|
||||
->get()->keyBy('node_id');
|
||||
|
||||
$widgets->transform(function ($row) use($user_widgets) {
|
||||
$user_widget = $user_widgets[$row['id']];
|
||||
@@ -189,20 +188,19 @@ class DashboardController extends DefaultController
|
||||
}
|
||||
return $row;
|
||||
});
|
||||
$widgets = $widgets->sortBy('sort');
|
||||
$widgets = $widgets->sortBy('sort')->values();
|
||||
|
||||
$infos = DB::table('widget')
|
||||
->where('type', 2)
|
||||
->where('status', 1)
|
||||
->where('default', 1)
|
||||
->permission('receive_id')
|
||||
->orderBy('sort', 'asc')
|
||||
->get(['id', 'name', 'color', 'icon', 'grid', 'status']);
|
||||
->get();
|
||||
|
||||
$user_infos = UserWidget::where('user_id', $auth['id'])
|
||||
->where('type', 2)
|
||||
->orderBy('sort', 'asc')
|
||||
->get(['id', 'name', 'color', 'icon', 'grid', 'node_id', 'status', 'params'])->keyBy('node_id');
|
||||
->get()->keyBy('node_id');
|
||||
|
||||
$infos->transform(function ($row) use($user_infos) {
|
||||
$user_info = $user_infos[$row['id']];
|
||||
@@ -224,7 +222,7 @@ class DashboardController extends DefaultController
|
||||
}
|
||||
return $row;
|
||||
});
|
||||
$infos = $infos->sortBy('sort');
|
||||
$infos = $infos->sortBy('sort')->values();
|
||||
|
||||
$menus = UserWidget::where('user_id', $auth['id'])
|
||||
->where('type', 3)
|
||||
@@ -281,13 +279,16 @@ class DashboardController extends DefaultController
|
||||
$info_id = Request::input('info_id');
|
||||
$row = UserWidget::where('id', $info_id)->first();
|
||||
$widget = Widget::where('id', $row['node_id'])->first();
|
||||
$params = json_decode($row['params'], true);
|
||||
|
||||
if (empty($row['date'])) {
|
||||
$row['date'] = 'month';
|
||||
if (empty($params['date'])) {
|
||||
$params['date'] = 'month';
|
||||
}
|
||||
if (empty($row['permission'])) {
|
||||
$row['permission'] = 'dept';
|
||||
if (empty($params['permission'])) {
|
||||
$params['permission'] = 'dept';
|
||||
}
|
||||
$row['params'] = $params;
|
||||
|
||||
$row['widget_name'] = $widget['name'];
|
||||
|
||||
return $this->render([
|
||||
@@ -303,12 +304,16 @@ class DashboardController extends DefaultController
|
||||
$widget_id = Request::input('widget_id');
|
||||
$row = UserWidget::where('id', $widget_id)->first();
|
||||
$widget = Widget::where('id', $row['node_id'])->first();
|
||||
if (empty($row['date'])) {
|
||||
$row['date'] = 'month';
|
||||
$params = json_decode($row['params'], true);
|
||||
|
||||
if (empty($params['date'])) {
|
||||
$params['date'] = 'month';
|
||||
}
|
||||
if (empty($row['permission'])) {
|
||||
$row['permission'] = 'dept';
|
||||
if (empty($params['permission'])) {
|
||||
$params['permission'] = 'dept';
|
||||
}
|
||||
$row['params'] = $params;
|
||||
|
||||
$row['widget_name'] = $widget['name'];
|
||||
|
||||
return $this->render([
|
||||
|
||||
@@ -36,12 +36,12 @@ class InfoService
|
||||
'year2' => '前年',
|
||||
];
|
||||
|
||||
$user_info = UserWidget::where('user_id', $auth['id'])
|
||||
->where('id', $gets['id'])->first();
|
||||
|
||||
$info = Widget::where('id', $user_info['node_id'])
|
||||
$info = Widget::where('id', $gets['id'])
|
||||
->first();
|
||||
|
||||
$user_info = UserWidget::where('user_id', $auth['id'])
|
||||
->where('node_id', $gets['id'])->first();
|
||||
|
||||
if (not_empty($user_info)) {
|
||||
$info['id'] = $user_info['id'];
|
||||
if ($user_info['name']) {
|
||||
@@ -59,6 +59,9 @@ class InfoService
|
||||
|
||||
$permission = empty($params['permission']) ? 'department' : $params['permission'];
|
||||
$date = empty($params['date']) ? 'month' : $params['date'];
|
||||
$params['permission'] = $permission;
|
||||
$params['date'] = $date;
|
||||
$info['params'] = $params;
|
||||
|
||||
switch ($date) {
|
||||
case 'day':
|
||||
@@ -104,8 +107,8 @@ class InfoService
|
||||
$sql = $sql2 = '';
|
||||
switch ($date) {
|
||||
case 'day':
|
||||
$sql = sql_year_month_day($table.'created_at','ts')."='$day'";
|
||||
$sql2 = sql_year_month_day($table.'created_at','ts')."='$day2'";
|
||||
$sql = sql_year_month_day($table.'.created_at','ts')."='$day'";
|
||||
$sql2 = sql_year_month_day($table.'.created_at','ts')."='$day2'";
|
||||
break;
|
||||
case 'day2':
|
||||
$sql = sql_year_month_day($table.'.created_at','ts')."='$day2'";
|
||||
|
||||
@@ -8,13 +8,24 @@ class ShareService
|
||||
/**
|
||||
* 获取分享数据
|
||||
*/
|
||||
public static function getItemsSourceBy(array $source_type, $user_id)
|
||||
public static function getItemsSourceBy(array $source_type, $user_id, $start_at = null, $end_at = null)
|
||||
{
|
||||
$user = User::find($user_id);
|
||||
return Share::leftJoin('user', 'share.created_id', '=', 'user.id')
|
||||
|
||||
$model = Share::leftJoin('user', 'share.created_id', '=', 'user.id')
|
||||
->permission('share.receive_id', $user)
|
||||
->whereIn('share.source_type', $source_type)
|
||||
->get(['share.*', 'user.name', 'user.username']);
|
||||
->whereIn('share.source_type', $source_type);
|
||||
|
||||
$start_at = strtotime($start_at);
|
||||
$end_at = strtotime($end_at) + 86400;
|
||||
if ($start_at > 0 && $end_at > 0) {
|
||||
$model->whereRaw('
|
||||
(share.start_at between '.$start_at.' and '.$end_at.' or share.end_at between '.$start_at.' and '.$end_at.')
|
||||
or (share.is_repeat = 1 and share.start_at <= '.$end_at.')
|
||||
');
|
||||
}
|
||||
|
||||
return $model->get(['share.*', 'user.name', 'user.username']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -286,7 +286,7 @@ var settingWidget = Vue.createApp({
|
||||
var me = this;
|
||||
formDialog({
|
||||
title: '配置',
|
||||
url: app.url('index/dashboard/settingInfo', {info_id:item.info_id}),
|
||||
url: app.url('index/dashboard/settingInfo', {id:item.id}),
|
||||
id: 'setting-info',
|
||||
dialogClass:'modal-sm',
|
||||
onSubmit: function() {
|
||||
@@ -303,7 +303,7 @@ var settingWidget = Vue.createApp({
|
||||
var me = this;
|
||||
formDialog({
|
||||
title: '配置',
|
||||
url: app.url('index/dashboard/settingWidget', {widget_id:item.widget_id}),
|
||||
url: app.url('index/dashboard/settingWidget', {id:item.id}),
|
||||
id: 'setting-widget',
|
||||
dialogClass:'modal-sm',
|
||||
onSubmit: function() {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<td>
|
||||
<select class="form-control input-sm" name="permission" id="permission">
|
||||
@foreach($permissions as $key => $permission)
|
||||
<option value="{{$key}}" @if($row['permission'] == $key) selected="selected" @endif>{{$permission}}</option>
|
||||
<option value="{{$key}}" @if($row['params']['permission'] == $key) selected="selected" @endif>{{$permission}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
@@ -27,7 +27,7 @@
|
||||
<td>
|
||||
<select class="form-control input-sm" name="date" id="date">
|
||||
@foreach($dates as $key => $date)
|
||||
<option value="{{$key}}" @if($row['date'] == $key) selected="selected" @endif>{{$date}}</option>
|
||||
<option value="{{$key}}" @if($row['params']['date'] == $key) selected="selected" @endif>{{$date}}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</td>
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
#order-index-widget .ag-header-cell-label {
|
||||
justify-content: left !important;
|
||||
}
|
||||
#order-index-widget .ag-header {
|
||||
border-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
<div class="wrapper-sm p-t-none">
|
||||
<div class="gdoo-list-grid">
|
||||
@@ -14,6 +17,7 @@
|
||||
var options = new agGridOptions();
|
||||
options.remoteDataUrl = '{{url()}}';
|
||||
options.remoteParams = {};
|
||||
options.headerHeight = 0;
|
||||
var columnDefs = [{
|
||||
field: 'title',
|
||||
cellClass:'text-left',
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</a>
|
||||
</div>
|
||||
<div class="info-r">
|
||||
<div>较{{$dates[$info['params']['date']]}}</div>
|
||||
<div>比{{$dates[$info['params']['date']]}}</div>
|
||||
<div class="rate @if($res['rate'] > 100) red @endif">{{$res['rate']}}%</div>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user