first commit

This commit is contained in:
2026-07-23 09:40:36 +08:00
commit 090abf48fa
989 changed files with 145728 additions and 0 deletions
+49
View File
@@ -0,0 +1,49 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
use think\facade\Db;
//读取职位
function get_position()
{
$position = Db::name('Position')->where(['status' => 1])->select()->toArray();
return $position;
}
//读取印章类型
function oa_seal_cate()
{
$list = Db::name('SealCate')->where(['status' => 1])->select()->toArray();
return $list;
}
//读取会议室
function oa_meeting_cate()
{
$list = Db::name('MeetingCate')->where(['status' => 1])->select()->toArray();
return $list;
}
//读取车辆类型
function oa_car_cate()
{
$list = Db::name('CarCate')->where(['status' => 1])->select()->toArray();
return $list;
}
//读取费用类型
function oa_cost_cate()
{
$list = Db::name('CostCate')->where(['status' => 1])->select()->toArray();
return $list;
}
+117
View File
@@ -0,0 +1,117 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\oa\controller;
use app\api\BaseController;
use app\oa\model\Schedule;
use think\facade\Db;
use think\facade\View;
class Api extends BaseController
{
//获取工作日志列表
public function get_schedule()
{
$param = get_params();
$project_id = isset($param['project_id']) ? $param['project_id'] : 0;
$task_id = isset($param['task_id']) ? $param['task_id'] : 0;
if ($project_id>0) {
$task_ids = Db::name('ProjectTask')->where(['delete_time' => 0, 'project_id' => $project_id])->column('id');
$where[] = ['a.tid', 'in', $task_ids];
}
if ($task_id>0) {
$where[] = ['a.tid', '=', $task_id];
}
$where[] = ['a.delete_time', '=', 0];
$model = new Schedule();
$list = $model->datalist($param,$where);
return table_assign(0, '', $list);
}
//调整工时
public function update_schedule()
{
$param = get_params();
$is_leader = isLeader($this->uid);
$role_auth = isAuth($this->uid,'office_admin','conf_1');
$hour_auth = valueAuth('office_admin','conf_2');
$edit_role = false;
if($hour_auth==4 && $role_auth > 0){
$edit_role = true;
}
if($hour_auth==3 && $is_leader > 0){
$edit_role = true;
}
if($hour_auth==2){
$admin_id = Db::name('Schedule')->where('id',$param['id'])->value('admin_id');
if($admin_id == $this->uid){
$edit_role = true;
}
}
if($edit_role == false){
return to_assign(1, "您无权限编辑");
}
if (isset($param['start_time_a'])) {
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
}
if (isset($param['end_time_a'])) {
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
}
if($param['start_time']>time()){
return to_assign(1, "开始时间不能大于当前时间");
}
if ($param['end_time'] <= $param['start_time']) {
return to_assign(1, "结束时间需要大于开始时间");
}
$where1[] = ['delete_time', '=', 0];
$where1[] = ['id', '<>', $param['id']];
$where1[] = ['admin_id', '=', $param['admin_id']];
$where1[] = ['start_time', 'between', [$param['start_time'], $param['end_time'] - 1]];
$where2[] = ['delete_time', '=', 0];
$where2[] = ['id', '<>', $param['id']];
$where2[] = ['admin_id', '=', $param['admin_id']];
$where2[] = ['start_time', '<=', $param['start_time']];
$where2[] = ['start_time', '>=', $param['end_time']];
$where3[] = ['delete_time', '=', 0];
$where3[] = ['id', '<>', $param['id']];
$where3[] = ['admin_id', '=', $param['admin_id']];
$where3[] = ['end_time', 'between', [$param['start_time'] + 1, $param['end_time']]];
$record = Db::name('Schedule')
->where(function ($query) use ($where1) {
$query->where($where1);
})
->whereOr(function ($query) use ($where2) {
$query->where($where2);
})
->whereOr(function ($query) use ($where3) {
$query->where($where3);
})
->count();
if ($record > 0) {
return to_assign(1, "您所选的时间区间已有工作记录,请重新选时间");
}
$param['labor_time'] = ($param['end_time'] - $param['start_time']) / 3600;
$res = Db::name('Schedule')->strict(false)->field(true)->update($param);
if ($res !== false) {
return to_assign(0, "操作成功");
add_log('edit', $param['id'], $param);
} else {
return to_assign(1, "操作失败");
}
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\oa\controller;
use app\base\BaseController;
use app\adm\model\MeetingRecords as MeetingRecordsModel;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Meeting extends BaseController
{
/**
* 构造函数
*/
protected $model;
public function __construct()
{
parent::__construct(); // 调用父类构造函数
$this->model = new MeetingRecordsModel();
}
//会议纪要
public function datalist()
{
if (request()->isAjax()) {
$param = get_params();
$where=[];
$whereOr = [];
$uid = $this->uid;
if (!empty($param['keywords'])) {
$where[] = ['title', 'like', '%' . $param['keywords'] . '%'];
}
if (!empty($param['anchor_id'])) {
$where[] = ['anchor_id', '=', $param['anchor_id']];
}
if (!empty($param['diff_time'])) {
$diff_time =explode('~', $param['diff_time']);
$where[] = ['meeting_date', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1].' 23:59:59'))]];
}
$where[] = ['delete_time', '=', 0];
$whereOr[] = ['recorder_id|anchor_id','=',$uid];
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',join_uids)")];
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',sign_uids)")];
$whereOr[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',share_uids)")];
$list = $this->model->datalist($param,$where,$whereOr);
return table_assign(0, '', $list);
} else {
return view();
}
}
//查看会议纪要
public function view($id)
{
View::assign('detail', $this->model->getById($id));
if(is_mobile()){
return view('qiye@/index/meeting_view');
}
return view();
}
}
+80
View File
@@ -0,0 +1,80 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\oa\controller;
use app\base\BaseController;
use app\adm\model\News as NewsModel;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class News extends BaseController
{
/**
* 构造函数
*/
protected $model;
public function __construct()
{
parent::__construct(); // 调用父类构造函数
$this->model = new NewsModel();
}
/**
* 数据列表
*/
public function datalist()
{
$param = get_params();
if (request()->isAjax()) {
$where=[];
$where[]=['delete_time','=',0];
if (!empty($param['keywords'])) {
$where[] = ['id|title', 'like', '%' . $param['keywords'] . '%'];
}
$list = $this->model->datalist($where, $param);
return table_assign(0, '', $list);
}
else{
return view();
}
}
/**
* 查看
*/
public function view($id)
{
$detail = $this->model->getById($id);
if (!empty($detail)) {
$detail['cate'] = Db::name('NoteCate')->where(['id' => $detail['cate_id']])->value('title');
$detail['admin_name'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name');
if($detail['file_ids'] !=''){
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
$detail['file_array'] = $file_array;
}
View::assign('detail', $detail);
if(is_mobile()){
return view('qiye@/index/news_view');
}
return view();
}
else{
return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
}
}
}
+81
View File
@@ -0,0 +1,81 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\oa\controller;
use app\base\BaseController;
use app\adm\model\Note as NoteModel;
use think\exception\ValidateException;
use think\facade\Db;
use think\facade\View;
class Note extends BaseController
{
/**
* 构造函数
*/
protected $model;
public function __construct()
{
parent::__construct(); // 调用父类构造函数
$this->model = new NoteModel();
}
/**
* 数据列表
*/
public function datalist()
{
$param = get_params();
if (request()->isAjax()) {
$where=[];
$where[]=['a.delete_time','=',0];
$where[]=['a.status','=',1];
if (!empty($param['keywords'])) {
$where[] = ['a.id|a.title', 'like', '%' . $param['keywords'] . '%'];
}
$list = $this->model->datalist($where, $param);
return table_assign(0, '', $list);
}
else{
return view();
}
}
/**
* 查看
*/
public function view($id)
{
$detail = $this->model->getById($id);
if (!empty($detail)) {
$detail['cate'] = Db::name('NoteCate')->where(['id' => $detail['cate_id']])->value('title');
$detail['admin_name'] = Db::name('Admin')->where(['id' => $detail['admin_id']])->value('name');
if($detail['file_ids'] !=''){
$file_array = Db::name('File')->where('id','in',$detail['file_ids'])->select();
$detail['file_array'] = $file_array;
}
View::assign('detail', $detail);
if(is_mobile()){
return view('qiye@/index/note_view');
}
return view();
}
else{
return view(EEEOR_REPORTING,['code'=>404,'warning'=>'找不到页面']);
}
}
}
+236
View File
@@ -0,0 +1,236 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\oa\controller;
use app\base\BaseController;
use app\oa\model\Plan as PlanList;
use schedule\Schedule as ScheduleIndex;
use think\facade\Db;
use think\facade\View;
class Plan extends BaseController
{
function datalist() {
if (request()->isAjax()) {
$param = get_params();
//按时间检索
if (!empty($param['diff_time'])) {
$diff_time =explode('~', $param['diff_time']);
$where[] = ['a.start_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1].' 23:59:59'))]];
}
if (!empty($param['keywords'])) {
$where[] = ['a.title', 'like', '%' . trim($param['keywords']) . '%'];
}
if (!empty($param['uid'])) {
$where[] = ['a.admin_id', '=', $param['uid']];
} else {
$where[] = ['a.admin_id', '=', $this->uid];
}
if (!empty($param['type'])) {
$where[] = ['a.type', '=', $param['type']];
}
$where[] = ['a.delete_time', '=', 0];
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$plan = PlanList::where($where)
->field('a.*,u.name as create_admin')
->alias('a')
->join('admin u', 'u.id = a.admin_id', 'LEFT')
->order('a.id desc')
->paginate(['list_rows'=> $rows])
->each(function ($item, $key) {
$item->remind_time = empty($item->remind_time) ? '-' : to_date($item->remind_time,'Y-m-d H:i');
$item->start_time = empty($item->start_time) ? '' : to_date($item->start_time,'Y-m-d H:i');
$item->end_time = empty($item->end_time) ? '': to_date($item->end_time,'Y-m-d H:i');
});
return table_assign(0, '', $plan);
} else {
View::assign('is_leader', isLeader($this->uid));
return view();
}
}
//工作记录
public function calendar()
{
if (request()->isAjax()) {
$param = get_params();
$uid = $this->uid;
if (!empty($param['uid'])) {
$uid = $param['uid'];
}
$where = [];
$where[] = ['start_time','<=',strtotime($param['end'])];
$where[] = ['end_time','>=',strtotime($param['start'])];
$where[] = ['delete_time', '=', 0];
$where[] = ['admin_id', '=', $uid];
$schedule = Db::name('Plan')
->where($where)
->field('id,title,type,remind_type,start_time,end_time')
->select()->toArray();
$events = [];
$bg_array=['#ECECEC','#FFD3D3','#F6F6C7','#D7EBFF','#CCEBCC','#E9E9CB'];
$border_array=['#CCCCCC','#FF9999','#E8E89B','#99CCFF','#99CC99','#CCCC99'];
foreach ($schedule as $k => $v) {
$v['backgroundColor'] = $bg_array[$v['type']];
$v['borderColor'] = $border_array[$v['type']];
$v['title'] = $v['title'];
$v['start'] = date('Y-m-d H:i', $v['start_time']);
$v['end'] = date('Y-m-d H:i', $v['end_time']);
unset($v['start_time']);
unset($v['end_time']);
$events[] = $v;
}
$input_arrays = $events;
$range_start = parseDateTime($param['start']);
$range_end = parseDateTime($param['end']);
$timeZone = null;
if (isset($_GET['timeZone'])) {
$timeZone = new DateTimeZone($_GET['timeZone']);
}
// Accumulate an output array of event data arrays.
$output_arrays = array();
foreach ($input_arrays as $array) {
// Convert the input array into a useful Event object
$event = new ScheduleIndex($array, $timeZone);
// If the event is in-bounds, add it to the output
if ($event->isWithinDayRange($range_start, $range_end)) {
$output_arrays[] = $event->toArray();
}
}
return json($output_arrays);
} else {
View::assign('is_leader', isLeader($this->uid));
return view();
}
}
//保存日志数据
public function add()
{
$param = get_params();
$admin_id = $this->uid;
if (isset($param['start_time'])) {
$param['start_time'] = strtotime($param['start_time']);
}
if (isset($param['end_time'])) {
$param['end_time'] = strtotime($param['end_time']);
}
if (isset($param['start_time_a'])) {
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
}
if (isset($param['end_time_a'])) {
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
}
if ($param['end_time'] <= $param['start_time']) {
return to_assign(1, "结束时间需要大于开始时间");
}
/*
if ($param['start_time'] <= time()) {
return to_assign(1, "开始时间需要大于当前时间");
}
*/
if (isset($param['remind_type'])) {
if($param['remind_type']==1){
$param['remind_time'] = $param['start_time']-5*60;
}
if($param['remind_type']==2){
$param['remind_time'] = $param['start_time']-15*60;
}
if($param['remind_type']==3){
$param['remind_time'] = $param['start_time']-30*60;
}
if($param['remind_type']==4){
$param['remind_time'] = $param['start_time']-60*60;
}
if($param['remind_type']==5){
$param['remind_time'] = $param['start_time']-120*60;
}
if($param['remind_type']==6){
$param['remind_time'] = $param['start_time']-1440*60;
}
}
if ($param['id'] == 0) {
$param['admin_id'] = $admin_id;
$param['did'] = get_admin($admin_id)['did'];
$param['create_time'] = time();
$addid = Db::name('Plan')->strict(false)->field(true)->insertGetId($param);
if ($addid > 0) {
add_log('add', $addid, $param);
return to_assign(0, '操作成功');
} else {
return to_assign(0, '操作失败');
}
} else {
$param['update_time'] = time();
$res = Db::name('Plan')->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('edit', $param['id'], $param);
return to_assign(0, '操作成功');
} else {
return to_assign(0, '操作失败');
}
}
}
//删除工作记录
public function del()
{
$id = get_params("id");
$data['id'] = $id;
$data['delete_time'] = time();
if (Db::name('Plan')->update($data) !== false) {
add_log('delete', $data['id'], $data);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
public function detail()
{
$id = get_params("id");
$schedule = Db::name('Plan')->where(['id' => $id])->find();
if (!empty($schedule)) {
$schedule['remind_time'] = $schedule['remind_time'] == 0?'-':date('Y-m-d H:i', $schedule['remind_time']);
$schedule['start_time_a'] = date('Y-m-d', $schedule['start_time']);
$schedule['end_time_a'] = date('Y-m-d', $schedule['end_time']);
$schedule['start_time_b'] = date('H:i', $schedule['start_time']);
$schedule['end_time_b'] = date('H:i', $schedule['end_time']);
$schedule['start_time'] = date('Y-m-d H:i', $schedule['start_time']);
$schedule['end_time'] = date('Y-m-d H:i', $schedule['end_time']);
$schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
$schedule['user'] = Db::name('Admin')->where(['id' => $schedule['admin_id']])->value('name');
}
return $schedule;
}
//读取日程弹层详情
public function view()
{
$id = get_params("id");
$schedule = $this->detail($id);
if (request()->isAjax()) {
return to_assign(0, "", $schedule);
} else {
return $schedule;
}
}
}
+282
View File
@@ -0,0 +1,282 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\oa\controller;
use app\base\BaseController;
use app\oa\model\Schedule as ScheduleModel;
use schedule\Schedule as ScheduleIndex;
use think\facade\Db;
use think\facade\View;
class Schedule extends BaseController
{
/**
* 构造函数
*/
protected $model;
public function __construct()
{
parent::__construct(); // 调用父类构造函数
$this->model = new ScheduleModel();
}
function datalist() {
if (request()->isAjax()) {
$param = get_params();
$where = [];
$whereOr = [];
$uid= $this->uid;
if (!empty($param['keywords'])) {
$where[] = ['a.title', 'like', '%' . trim($param['keywords']) . '%'];
}
if (!empty($param['labor_type'])) {
$where[] = ['a.labor_type', '=',$param['labor_type']];
}
if (!empty($param['cid'])) {
$where[] = ['a.cid', '=',$param['cid']];
}
//按时间检索
if (!empty($param['diff_time'])) {
$diff_time =explode('~', $param['diff_time']);
$where[] = ['a.start_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1].' 23:59:59'))]];
}
$where[] = ['a.delete_time', '=', 0];
if (!empty($param['uid'])) {
$where[] = ['a.admin_id', '=', $param['uid']];
} else {
$whereOr[] = ['a.admin_id', '=', $uid];
$dids_a = get_leader_departments($uid);
$dids_b = get_role_departments($uid);
$dids = array_merge($dids_a, $dids_b);
if(!empty($dids)){
$whereOr[] = ['a.did','in',$dids];
}
}
$list = $this->model->datalist($param,$where,$whereOr);
return table_assign(0, '', $list);
} else {
View::assign('is_leader', isLeader($this->uid));
View::assign('role_auth', isAuth($this->uid,'office_admin','conf_1'));
View::assign('hour_auth', valueAuth('office_admin','conf_2'));
return view();
}
}
//工作记录
public function calendar()
{
if (request()->isAjax()) {
$param = get_params();
$uid = $this->uid;
if (!empty($param['uid'])) {
$uid = $param['uid'];
}
$where = [];
$where[] = ['start_time', '>=', strtotime($param['start'])];
$where[] = ['end_time', '<=', strtotime($param['end'])];
$where[] = ['admin_id', '=', $uid];
$where[] = ['delete_time', '=', 0];
$schedule = Db::name('Schedule')->where($where)->field('id,title,labor_time,start_time,end_time')->select()->toArray();
$events = [];
$countEvents = [];
foreach ($schedule as $k => $v) {
$v['backgroundColor'] = '#12bb37';
$v['borderColor'] = '#12bb37';
$v['title'] = '[' . $v['labor_time'] . '工时] ' . $v['title'];
$v['start'] = date('Y-m-d H:i', $v['start_time']);
$v['end'] = date('Y-m-d H:i', $v['end_time']);
$temData = date('Y-m-d', $v['start_time']);
if (array_key_exists($temData, $countEvents)) {
$countEvents[$temData]['times'] += $v['labor_time'];
} else {
$countEvents[$temData]['times'] = $v['labor_time'];
$countEvents[$temData]['start'] = date('Y-m-d', $v['start_time']);
}
unset($v['start_time']);
unset($v['end_time']);
$events[] = $v;
}
foreach ($countEvents as $kk => $vv) {
$vv['backgroundColor'] = '#eeeeee';
$vv['borderColor'] = '#eeeeee';
$vv['title'] = '【当天总工时:' . $vv['times'] . '】';
$vv['end'] = $vv['start'];
$vv['id'] = 0;
unset($vv['times']);
$events[] = $vv;
}
$input_arrays = $events;
$range_start = parseDateTime($param['start']);
$range_end = parseDateTime($param['end']);
$timeZone = null;
if (isset($_GET['timeZone'])) {
$timeZone = new DateTimeZone($_GET['timeZone']);
}
// Accumulate an output array of event data arrays.
$output_arrays = array();
foreach ($input_arrays as $array) {
// Convert the input array into a useful Event object
$event = new ScheduleIndex($array, $timeZone);
// If the event is in-bounds, add it to the output
if ($event->isWithinDayRange($range_start, $range_end)) {
$output_arrays[] = $event->toArray();
}
}
return json($output_arrays);
} else {
View::assign('is_leader', isLeader($this->uid));
return view();
}
}
//保存日志数据
public function add()
{
$param = get_params();
$admin_id = $this->uid;
if ($param['id'] == 0) {
if (isset($param['start_time'])) {
$param['start_time'] = strtotime($param['start_time']);
}
if (isset($param['end_time'])) {
$param['end_time'] = strtotime($param['end_time']);
}
if (isset($param['end_time_a'])) {
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
}
if (isset($param['start_time_a'])) {
$param['start_time'] = strtotime($param['start_time_a'] . '' . $param['start_time_b']);
}
if (isset($param['end_time_a'])) {
$param['end_time'] = strtotime($param['end_time_a'] . '' . $param['end_time_b']);
}
if($param['start_time']>time()){
return to_assign(1, "开始时间不能大于现在时间");
}
if ($param['end_time'] <= $param['start_time']) {
return to_assign(1, "结束时间需要大于开始时间");
}
if (date('d',$param['end_time']) != date('d',$param['start_time'])) {
return to_assign(1, "结束时间与开始时间必须是同一天");
}
$where1[] = ['delete_time', '=', 0];
$where1[] = ['admin_id', '=', $admin_id];
$where1[] = ['start_time', 'between', [$param['start_time'], $param['end_time'] - 1]];
$where2[] = ['delete_time', '=', 0];
$where2[] = ['admin_id', '=', $admin_id];
$where2[] = ['start_time', '<=', $param['start_time']];
$where2[] = ['start_time', '>=', $param['end_time']];
$where3[] = ['delete_time', '=', 0];
$where3[] = ['admin_id', '=', $admin_id];
$where3[] = ['end_time', 'between', [$param['start_time'] + 1, $param['end_time']]];
$record = Db::name('Schedule')
->where(function ($query) use ($where1) {
$query->where($where1);
})
->whereOr(function ($query) use ($where2) {
$query->where($where2);
})
->whereOr(function ($query) use ($where3) {
$query->where($where3);
})
->count();
if ($record > 0) {
return to_assign(1, "您所选的时间区间已有工作记录,请重新选时间");
}
$param['labor_time'] = ($param['end_time'] - $param['start_time']) / 3600;
$param['admin_id'] = $admin_id;
$param['did'] = get_admin($admin_id)['did'];
$param['create_time'] = time();
$sid = Db::name('Schedule')->strict(false)->field(true)->insertGetId($param);
if ($sid > 0) {
add_log('add', $sid, $param);
return to_assign(0, '操作成功');
} else {
return to_assign(0, '操作失败');
}
} else {
$param['update_time'] = time();
$res = Db::name('Schedule')->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('edit', $param['id'], $param);
return to_assign(0, '操作成功');
} else {
return to_assign(0, '操作失败');
}
}
}
//删除工作记录
public function del()
{
$id = get_params("id");
$data['id'] = $id;
$data['delete_time'] = time();
if (Db::name('schedule')->update($data) !== false) {
add_log('delete', $data['id'], $data);
return to_assign(0, "删除成功");
} else {
return to_assign(1, "删除失败");
}
}
public function view()
{
$id = get_params('id');
$schedule = Db::name('Schedule')->where(['id' => $id])->find();
if (!empty($schedule)) {
$schedule['start_time_1'] = date('H:i', $schedule['start_time']);
$schedule['end_time_1'] = date('H:i', $schedule['end_time']);
$schedule['start_time'] = date('Y-m-d', $schedule['start_time']);
$schedule['end_time'] = date('Y-m-d', $schedule['end_time']);
$schedule['create_time'] = date('Y-m-d H:i:s', $schedule['create_time']);
$schedule['name'] = Db::name('Admin')->where(['id' => $schedule['admin_id']])->value('name');
$schedule['labor_type_string'] = '案头工作';
if($schedule['labor_type'] == 2){
$schedule['labor_type_string'] = '外勤工作';
}
$schedule['department'] = get_admin($schedule['admin_id'])['department'];
$schedule['work_cate'] = Db::name('WorkCate')->where(['id' => $schedule['cid']])->value('title');
if($schedule['tid']>0){
$task = Db::name('ProjectTask')->where(['id' => $schedule['tid']])->find();
$schedule['task'] = $task['title'];
if($task['project_id']>0){
$schedule['project'] = Db::name('Project')->where(['id' => $task['project_id']])->value('name');
}
else{
$schedule['project'] ='-';
}
}
else{
$schedule['task'] ='-';
}
}
if (request()->isAjax()) {
return to_assign(0, "", $schedule);
} else {
View::assign('detail',$schedule);
if(is_mobile()){
return view('qiye@/index/schedule_view');
}
return $schedule;
}
}
}
+289
View File
@@ -0,0 +1,289 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
declare (strict_types = 1);
namespace app\oa\controller;
use app\base\BaseController;
use app\oa\model\Work as WorkModel;
use app\oa\model\WorkRecord;
use think\facade\Db;
use think\facade\View;
class Work extends BaseController
{
/**
* 构造函数
*/
protected $model;
public function __construct()
{
parent::__construct(); // 调用父类构造函数
$this->model = new WorkModel();
}
//获取接收汇报列表
public function get_accept($map = [], $param = [])
{
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$Work = WorkRecord::alias('a')
->field('a.id,a.from_uid,a.to_uid,a.send_time,a.read_time,w.id as wid,w.types,w.works,w.file_ids,w.start_date,w.end_date')
->join('Work w','a.work_id = w.id','left')
->where($map)
->order('a.send_time desc')
->paginate(['list_rows'=> $rows])
->each(function ($item, $key) {
$item->send_time = empty($item->send_time) ? '-' : to_date($item->send_time,'Y-m-d H:i:s');
$item->from_name = Db::name('Admin')->where(['id' => $item->from_uid])->value('name');
$item->to_name = Db::name('Admin')->where(['id' => $item->to_uid])->value('name');
if($item->start_date>0){
$item->start_date = date('Y-m-d',$item->start_date);
}
if($item->end_date>0){
$item->end_date = date('Y-m-d',$item->end_date);
}
$item->files = Db::name('File')->where('id', 'in', $item->file_ids)->count();
});
return $Work;
}
//汇报列表
public function datalist()
{
if (request()->isAjax()) {
$param = get_params();
$map = [];
//按关键字检索
if( !empty($param['keywords']) ){
$map[] = ['works', 'like', '%'.$param['keywords'].'%'];
}
if($param['send']==1){
if (!empty($param['types'])) {
$map[] = ['types', '=', $param['types']];
}
//按时间检索
if (!empty($param['diff_time'])) {
$diff_time =explode('~', $param['diff_time']);
$map[] = ['start_date', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
}
$map[] = ['admin_id', '=', $this->uid];
$map[] = ['delete_time', '=', 0];
$list = $this->model->get_send($param,$map);
}
else{
if (!empty($param['read'])) {
if($param['read']==1){
$map[] = ['a.read_time', '=', 0];
}else{
$map[] = ['a.read_time', '>', 0];
}
}
if (!empty($param['types'])) {
$map[] = ['w.types', '=', $param['types']];
}
$map[] = ['a.to_uid', '=', $this->uid];
$map[] = ['a.delete_time', '=', 0];
//按时间检索
if (!empty($param['diff_time'])) {
$diff_time =explode('~', $param['diff_time']);
$map[] = ['a.send_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]];
}
$list = $this->get_accept($map, $param);
}
return table_assign(0, '', $list);
} else {
$send = empty(get_params('send')) ? 1 : get_params('send');
return view('datalist_'.$send);
}
}
//新增&编辑
public function add()
{
if (request()->isAjax()) {
$param = get_params();
$id = $param['id'] ? $param['id'] : 0;
if(!empty($param['start_date'])){
$param['start_date'] = strtotime($param['start_date']);
}
if(!empty($param['end_date'])){
$param['end_date'] = strtotime($param['end_date']);
}
if(!empty($param['range_date'])){
$range_date =explode('~', $param['range_date']);
$param['start_date'] = strtotime(urldecode($range_date[0]));
$param['end_date'] = strtotime(urldecode($range_date[1]));
}
if($id>0){
$param['update_time'] = time();
$res = Db::name('Work')->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('edit',$id,$param);
if($param['send']==1){
$users = explode(',',$param['to_uids']);
//组合要发的消息
$send_data = [];
foreach ($users as $key => $value) {
if (!$value || ($value == $this->uid)) {
continue;
}
$send_data[] = array(
'work_id' => $id,//关联id
'to_uid' => $value,//接收人
'from_uid' => $this->uid,//发送人
'send_time' => time()
);
}
Db::name('WorkRecord')->strict(false)->field(true)->insertAll($send_data);
Db::name('Work')->strict(false)->field('send_time')->update(['id' => $id,'send_time' => time()]);
add_log('send',$id);
$msg=[
'from_uid'=>$this->uid,//发送人
'to_uids'=>$param['to_uids'],//接收人
'template_id'=>'work',//消息模板标识
'content'=>[ //消息内容
'send_time'=>date('Y-m-d H:i:s'),
'action_id'=>$id
]
];
event('SendMessage',$msg);
return to_assign(0, '发送成功');
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
else{
$param['admin_id'] = $this->uid;
$param['create_time'] = time();
$wid = Db::name('Work')->strict(false)->field(true)->insertGetId($param);
if ($wid !== false) {
add_log('add',$wid,$param);
if($param['send']==1){
$users = explode(',',$param['to_uids']);
//组合要发的内容
$send_data = [];
foreach ($users as $key => $value) {
if (!$value || ($value == $this->uid)) {
continue;
}
$send_data[] = array(
'work_id' => $wid,//关联id
'to_uid' => $value,//接收人
'from_uid' => $this->uid,//发送人
'send_time' => time()
);
}
Db::name('WorkRecord')->strict(false)->field(true)->insertAll($send_data);
Db::name('Work')->strict(false)->field('send_time')->update(['id' => $wid,'send_time' => time()]);
add_log('send',$wid);
$msg=[
'from_uid'=>$this->uid,//发送人
'to_uids'=>$param['to_uids'],//接收人
'template_id'=>'work',//消息模板ID
'content'=>[ //消息内容
'create_time'=>date('Y-m-d H:i:s'),
'action_id'=>$wid
]
];
event('SendMessage',$msg);
return to_assign(0, '发送成功');
}
return to_assign();
}
else{
return to_assign(1,'操作失败');
}
}
}
else{
$id = empty(get_params('id')) ? 0 : get_params('id');
$types = empty(get_params('types')) ? 1 : get_params('types');
if ($id > 0) {
$detail = $this->model->detail($id);
$types = $detail['types'];
View::assign('detail', $detail);
}
View::assign('id', $id);
View::assign('types', $types);
return view('add_'.$types);
}
}
//查看
public function view()
{
$param = get_params();
$id = $param['id'];
$detail = $this->model->detail($id);
//已读人查询
$read_user_names = [];
if($detail['admin_id'] !=$this->uid){
$record = Db::name('WorkRecord')->where(['work_id' => $detail['id'],'to_uid' => $this->uid])->count();
if ($record == 0) {
echo '<div style="text-align:center;color:red;margin-top:20%;">该汇报不存在</div>';exit;
}
else{
Db::name('WorkRecord')->where(['work_id' => $detail['id'],'to_uid' => $this->uid])->update(['read_time' => time()]);
}
}
else{
$read_user_ids= Db::name('WorkRecord')->where([['work_id','=',$detail['id']],['read_time','>',0]])->column('to_uid');
$read_user_names = Db::name('Admin')->where('id', 'in', $read_user_ids)->column('name');
}
$sender = get_admin($detail['admin_id']);
$detail['person_name'] = $sender['name'];
if($detail['send_time']>0){
$detail['send_time'] = to_date($detail['send_time']);
}
//接收人查询
$user_names = Db::name('Admin')->where('status', 1)->where('id', 'in', $detail['to_uids'])->column('name');
$detail['users'] = implode(",", $user_names);
$detail['read_users'] = implode(",", $read_user_names);
$detail['comment_auth'] = 0;
$type_user_array = explode(",", $detail['to_uids']);
if (in_array($this->uid, $type_user_array)) {
$detail['comment_auth'] = 1;
}
View::assign('detail', $detail);
if(is_mobile()){
return view('qiye@/index/work_view');
}
return view();
}
//删除汇报
public function del()
{
$param = get_params();
$id = $param['id'];
$detail = Db::name('Work')->where(['id' => $id])->find();
if($detail['admin_id'] == $this->uid){
$res = Db::name('Work')->where('id',$detail['id'])->update(['delete_time' => time()]);
if($res!==false){
Db::name('WorkRecord')->where('work_id',$detail['id'])->update(['delete_time' => time()]);
add_log('delete', $param['id']);
return to_assign();
}
else{
return to_assign(1, '操作失败');
}
}
else{
return to_assign(1, '无权限删除');
}
}
}
+9
View File
@@ -0,0 +1,9 @@
<?php
return [
'listen' => [
//注册监听类
'SendMessage' => ['app\listener\SendMessage'],
],
//'subscribe' => ['app\subscribe\Message'],
];
+9
View File
@@ -0,0 +1,9 @@
<?php
// 这是系统自动生成的middleware定义文件
return [
//开启session中间件
//'think\middleware\SessionInit',
//验证勾股OA是否完成安装
\app\home\middleware\Install::class,
];
+19
View File
@@ -0,0 +1,19 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
namespace app\oa\model;
use think\Model;
class Plan extends Model
{
}
+77
View File
@@ -0,0 +1,77 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
namespace app\oa\model;
use think\Model;
use think\facade\Db;
class Schedule extends Model
{
/**
* 获取分页列表
* @param $where
* @param $param
*/
public function datalist($param=[], $where=[], $whereOr=[])
{
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$order = empty($param['order']) ? 'a.end_time desc' : $param['order'];
try {
$list = self::field('a.*,u.name,w.title as work_cate')
->alias('a')
->join('Admin u', 'a.admin_id = u.id', 'LEFT')
->join('WorkCate w', 'w.id = a.cid', 'LEFT')
->where($where)
->where(function ($query) use ($whereOr) {
if (!empty($whereOr))
$query->whereOr($whereOr);
})
->order($order)
->paginate(['list_rows'=> $rows])
->each(function ($item, $key) {
$item->labor_type_string = '案头工作';
if($item->labor_type == 2){
$item->labor_type_string = '外勤工作';
}
if($item->did > 0){
$item->department = Db::name('Department')->where(['id' => $item->did])->value('title');
}
else{
$item->department='-';
}
if($item->tid > 0){
$task = Db::name('ProjectTask')->where(['id' => $item->tid])->find();
$item->task = $task['title'];
if($task['project_id']>0){
$item->project = Db::name('Project')->where(['id' => $task['project_id']])->value('name');
}
else{
$item->project='-';
}
}
else{
$item->task = '-';
}
$item->start_time_a = empty($item->start_time) ? '' : date('Y-m-d', $item->start_time);
$item->start_time_b = empty($item->start_time) ? '' : date('H:i', $item->start_time);
$item->end_time_a = empty($item->end_time) ? '' : date('Y-m-d', $item->end_time);
$item->end_time_b = empty($item->end_time) ? '' : date('H:i', $item->end_time);
$item->start_time = empty($item->start_time) ? '' : date('Y-m-d H:i', $item->start_time);
$item->end_time = empty($item->end_time) ? '' : date('H:i', $item->end_time);
$item->create_time = to_date($item->create_time );
});
return $list;
} catch(\Exception $e) {
return ['code' => 1, 'data' => [], 'msg' => $e->getMessage()];
}
}
}
+63
View File
@@ -0,0 +1,63 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
namespace app\oa\model;
use think\Model;
use think\facade\Db;
class Work extends Model
{
//获取发送汇报列表
public function get_send($param = [],$where = [])
{
$rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit'];
$order = empty($param['order']) ? 'create_time desc' : $param['order'];
try {
$list = self::where($where)
->order($order)
->paginate(['list_rows'=> $rows])
->each(function ($item, $key) {
if($item['start_date']>0){
$item['start_date'] = date('Y-m-d',$item['start_date']);
}
if($item['end_date']>0){
$item['end_date'] = date('Y-m-d',$item['end_date']);
}
$to_names = Db::name('Admin')->where('status', 1)->where('id', 'in', $item['to_uids'])->column('name');
$item['to_names'] = implode(",", $to_names);
$item['files'] = Db::name('File')->where('id', 'in', $item['file_ids'])->count();
$item->create_time = to_date($item->create_time);
});
return $list;
} catch(\Exception $e) {
return ['code' => 1, 'data' => [], 'msg' => $e->getMessage()];
}
}
//详情
public function detail($id)
{
$detail = self::find($id);
if($detail['types']>1){
$detail['range_date'] = date('Y-m-d',$detail['start_date']).' ~ '.date('Y-m-d',$detail['end_date']);
}
else{
$detail['range_date'] = date('Y-m-d',$detail['start_date']);
}
$to_unames = Db::name('Admin')->where('status', 1)->where('id', 'in', $detail['to_uids'])->column('name');
$detail['to_unames'] = implode(",", $to_unames);
$detail['file_array'] = Db::name('File')->where([['id','in',$detail['file_ids']]])->select()->toArray();
return $detail;
}
}
+22
View File
@@ -0,0 +1,22 @@
<?php
/**
+-----------------------------------------------------------------------------------------------
* GouGuOPEN [ 左手研发,右手开源,未来可期!]
+-----------------------------------------------------------------------------------------------
* @Copyright (c) 2021~2024 http://www.gouguoa.com All rights reserved.
+-----------------------------------------------------------------------------------------------
* @Licensed 勾股OA,开源且可免费使用,但并不是自由软件,未经授权许可不能去除勾股OA的相关版权信息
+-----------------------------------------------------------------------------------------------
* @Author 勾股工作室 <hdm58@qq.com>
+-----------------------------------------------------------------------------------------------
*/
namespace app\oa\model;
use think\Model;
use think\facade\Db;
class WorkRecord extends Model
{
}
+102
View File
@@ -0,0 +1,102 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<style>
.layui-table-tool-temp{padding-right:0}
</style>
<div class="p-page">
<form class="layui-form gg-form-bar border-x border-t" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:300px;">
<input type="text" class="layui-input" id="diff_time" placeholder="会议日期" readonly name="diff_time">
</div>
<div class="layui-input-inline" style="width:220px;">
<input type="text" name="keywords" placeholder="会议主题" class="layui-input"/>
</div>
<div class="layui-input-inline" style="width:150px;">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
</div>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<h3>会议纪要</h3>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','oaPicker','laydatePlus','tablePlus'];
function gouguInit() {
var table = layui.tablePlus, tool = layui.tool ,form = layui.form, laydatePlus = layui.laydatePlus;
//日期范围
var diff_time = new laydatePlus({'target':'diff_time'});
layui.pageTable = table.render({
elem: '#test',
title: '会议纪要列表',
toolbar: '#toolbarDemo',
defaultToolbar: false,
page: true, //开启分页
limit: 20,
height: 'full-114',
url: "/oa/meeting/datalist", //数据接口
cols: [
[
{type:'checkbox',fixed:'left'},
{
field: 'id',
title: '序号',
align: 'center',
width: 80
}, {
field: 'meeting_date',
title: '会议日期',
align: 'center',
width: 100
},{
field: 'title',
title: '会议主题',
minWidth:240
},{
field: 'did_name',
title: '主办部门',
align: 'center',
width: 90
},{
field: 'anchor',
title: '主持人',
align: 'center',
width: 90
},{
field: 'recorder_name',
title: '记录人',
align: 'center',
width: 90
}, {
field: 'right',
title: '操作',
width: 80,
align: 'center',
templet: function(d){
return '<span class="layui-btn layui-btn-xs layui-bg-blue" lay-event="view">查看</span>';
}
}
]
]
});
//监听行工具事件
table.on('tool(test)', function(obj) {
var data = obj.data;
if (obj.event === 'view') {
tool.side("/adm/meeting/records_view?id="+data.id);
return;
}
});
}
</script>
{/block}
<!-- /脚本 -->
+64
View File
@@ -0,0 +1,64 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">会议纪要</h3>
<table class="layui-table layui-table-form">
<tr>
<td class="layui-td-gray">会议时间</td>
<td>{$detail.meeting_date|date='Y-m-d H:i:s'}</td>
<td class="layui-td-gray">主持人</td>
<td>{$detail.anchor_name}</td>
<td class="layui-td-gray">记录人</td>
<td>{$detail.recorder_name}</td>
</tr>
<tr>
<td class="layui-td-gray">会 议 室</td>
<td colspan="3">{$detail.room}</td>
<td class="layui-td-gray">主办部门</td>
<td>{$detail.did_name|default=""}</td>
</tr>
<tr>
<td class="layui-td-gray">参会人员</td>
<td colspan="5">{$detail.join_names}</td>
</tr>
<tr>
<td class="layui-td-gray">会议主题</td>
<td colspan="5">{$detail.title}</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">会议内容</td>
<td colspan="5">{$detail.content}</td>
</tr>
<tr>
<td class="layui-td-gray-2" style="vertical-align:top;">下一步<br>工作计划</td>
<td colspan="5">{$detail.plans}</td>
</tr>
<tr>
<td class="layui-td-gray">参会人员签字</td>
<td colspan="5">{$detail.sign_names}</td>
</tr>
<tr>
<td class="layui-td-gray">共享给谁</td>
<td colspan="5">{$detail.share_names}</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">备注信息</td>
<td colspan="5">{$detail.remarks|default=''}</td>
</tr>
</table>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
}
</script>
{/block}
<!-- /脚本 -->
+63
View File
@@ -0,0 +1,63 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-page">
<form class="layui-form gg-form-bar border-t border-x" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:300px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off" />
</div>
<div class="layui-input-inline" style="width:150px">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
</div>
</form>
<table class="layui-hide" id="table_news" lay-filter="table_news"></table>
</div>
<script type="text/html" id="toolbarDemo">
<h3>公司新闻</h3>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','tablePlus'];
function gouguInit() {
var table = layui.tablePlus, tool = layui.tool;
layui.pageTable = table.render({
elem: "#table_news"
, toolbar: "#toolbarDemo"
,url: "/oa/news/datalist"
,page: true
,limit: 20
,cellMinWidth: 80
,height: 'full-114'
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '名称'}
,{field:'admin_name',title: '创建人',width:90,align:'center'}
,{field:'create_time', title: '创建时间',width:150,align:'center'}
,{width:80,fixed:'right',title: '操作', align:'center',ignoreExport:true,templet: function(d){
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详细</a>';
return btn;
}}
]]
});
table.on('tool(table_news)',function (obj) {
var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
var data = obj.data;
if (obj.event === 'view') {
tool.side("/oa/news/view?id="+data.id);
return;
}
});
}
</script>
{/block}
<!-- /脚本 -->
+63
View File
@@ -0,0 +1,63 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__GOUGU__}/third_party/prism/prism.css"/>
<style>
.text-detial-ops{line-height: 30px; color:#999; font-size: 12px; padding: 12px 0;}
.text-detial-ops span{margin-right: 20px;}
.text-detial-ops a{margin-right:10px;}
.text-detial-content{padding: 8px 0; color:#333; word-break: break-all; border-top:1px solid #e8e8e8;font-size: 16px!important; line-height: 1.72!important;}
.text-detial-content p{padding: 8px 0;}
.text-detial-content img{max-width:98%!important; margin:0 auto; display:block; border: 1px solid #e6e6e6; -webkit-box-shadow: 0 2px 6px rgba(26,26,26,.08); box-shadow: 0 2px 6px rgba(26,26,26,.08); border-radius: 4px;}
.text-detial-content h1,.text-detial-content h2,.text-detial-content h3,.text-detial-content h4,.text-detial-content h5{margin-top:10px;}
.text-detial-content a{color:#186AF2; font-style:italic;}
.text-detial-content a:hover{text-decoration:underline;}
.text-detial-content p code,.blog-detial-content pre{margin:0 3px;font-size: 14px; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; background: #f6f6f6; padding: 10px; border-radius: 2px;}
.text-detial-content p code{border: 1px solid #eee;padding: 2px 4px;}
.text-detial-content table {border-collapse: collapse; border-spacing: 0; display: block; width: 100%; overflow: auto; word-break: normal;word-break: keep-all; margin-top: 0;margin-bottom: 16px;}
.text-detial-content table tr {background-color: #fff;border-top: 1px solid #ccc;}
.text-detial-content table tr:nth-child(2n) {background-color: #f8f8f8;}
.text-detial-content table td, .blog-detial-content table th { padding: 6px 12px;border: 1px solid #ddd; font-size:14px; }
.text-detial-content table th {font-weight: 800;}
.text-detial-content li {list-style: initial;margin-left: 20px;}
:not(pre)>code[class*=language-], pre[class*=language-]{background:#fff!important;border:1px solid #e8e8e8!important; border-radius:3px;}
.upload-file{padding:12px; background-color:#fff; border:1px solid #eee; margin-bottom:12px;}
.upload-file h3{margin-bottom:12px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
<h1>{$detail.title}</h1>
<div class="text-detial-ops">
<span>{$detail.admin_name}发表于:{$detail.create_time | date='Y-m-d H:i:s'}</span>
</div>
<div class="text-detial-content">
{$detail.content|raw}
</div>
{notempty name="$detail.src"}
<div class="py-3" style="font-size:16px;">
关联链接:<a class="blue" href="{$detail.src}" target="_blank">{$detail.src}</a>
</div>
{/notempty}
{notempty name="$detail.file_ids"}
<div class="upload-file layui-row">
<h3>相关附件</h3>
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md4" id="uploadFile{$vo.id}">{:file_card($vo,'view')}</div>
{/volist}
</div>
{/notempty}
</div>
{/block}
<!-- 脚本 -->
{block name="script"}
<script src="{__GOUGU__}/third_party/prism/prism.js"></script>
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
}
</script>
{/block}
<!-- /脚本 -->
+64
View File
@@ -0,0 +1,64 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-page">
<form class="layui-form gg-form-bar border-t border-x" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:300px">
<input type="text" name="keywords" placeholder="关键字" class="layui-input" autocomplete="off" />
</div>
<div class="layui-input-inline" style="width:150px">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
</div>
</form>
<table class="layui-hide" id="table_note" lay-filter="table_note"></table>
</div>
<script type="text/html" id="toolbarDemo">
<h3>公告通知</h3>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','tablePlus'];
function gouguInit() {
var table = layui.tablePlus, tool = layui.tool;
layui.pageTable = table.render({
elem: "#table_note"
, toolbar: "#toolbarDemo"
,url: "/oa/note/datalist"
,page: true
,limit: 20
,cellMinWidth: 80
,height: 'full-114'
,cols: [[
{field:'id',width:80, title: 'ID号', align:'center'}
,{field:'title',title: '公告主题'}
,{field:'cate',title: '所属分类',width:120,align:'center'}
,{field:'admin_name',title: '创建人',width:90,align:'center'}
,{field:'create_time', title: '创建时间',width:150,align:'center'}
,{width:80,fixed:'right',title: '操作', align:'center',ignoreExport:true,templet: function(d){
var btn='<a class="layui-btn layui-btn-normal layui-btn-xs" lay-event="view">详细</a>';
return btn;
}}
]]
});
table.on('tool(table_note)',function (obj) {
var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
var data = obj.data;
if (obj.event === 'view') {
tool.side("/oa/note/view?id="+data.id);
return;
}
});
}
</script>
{/block}
<!-- /脚本 -->
+63
View File
@@ -0,0 +1,63 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__GOUGU__}/third_party/prism/prism.css"/>
<style>
.text-detial-ops{line-height: 30px; color:#999; font-size: 12px; padding: 12px 0;}
.text-detial-ops span{margin-right: 20px;}
.text-detial-ops a{margin-right:10px;}
.text-detial-content{padding: 8px 0; color:#333; word-break: break-all; border-top:1px solid #e8e8e8;font-size: 16px!important; line-height: 1.72!important;}
.text-detial-content p{padding: 8px 0;}
.text-detial-content img{max-width:98%!important; margin:0 auto; display:block; border: 1px solid #e6e6e6; -webkit-box-shadow: 0 2px 6px rgba(26,26,26,.08); box-shadow: 0 2px 6px rgba(26,26,26,.08); border-radius: 4px;}
.text-detial-content h1,.text-detial-content h2,.text-detial-content h3,.text-detial-content h4,.text-detial-content h5{margin-top:10px;}
.text-detial-content a{color:#186AF2; font-style:italic;}
.text-detial-content a:hover{text-decoration:underline;}
.text-detial-content p code,.blog-detial-content pre{margin:0 3px;font-size: 14px; font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; background: #f6f6f6; padding: 10px; border-radius: 2px;}
.text-detial-content p code{border: 1px solid #eee;padding: 2px 4px;}
.text-detial-content table {border-collapse: collapse; border-spacing: 0; display: block; width: 100%; overflow: auto; word-break: normal;word-break: keep-all; margin-top: 0;margin-bottom: 16px;}
.text-detial-content table tr {background-color: #fff;border-top: 1px solid #ccc;}
.text-detial-content table tr:nth-child(2n) {background-color: #f8f8f8;}
.text-detial-content table td, .blog-detial-content table th { padding: 6px 12px;border: 1px solid #ddd; font-size:14px; }
.text-detial-content table th {font-weight: 800;}
.text-detial-content li {list-style: initial;margin-left: 20px;}
:not(pre)>code[class*=language-], pre[class*=language-]{background:#fff!important;border:1px solid #e8e8e8!important; border-radius:3px;}
.upload-file{padding:12px; background-color:#fff; border:1px solid #eee; margin-bottom:12px;}
.upload-file h3{margin-bottom:12px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-5">
<h1>{$detail.title}</h1>
<div class="text-detial-ops">
<span>{$detail.admin_name}发表于:{$detail.create_time | date='Y-m-d H:i:s'}</span><span>公告分类:{$detail.cate}</span>
</div>
<div class="text-detial-content">
{$detail.content|raw}
</div>
{notempty name="$detail.src"}
<div class="py-3" style="font-size:16px;">
关联链接:<a class="blue" href="{$detail.src}" target="_blank">{$detail.src}</a>
</div>
{/notempty}
{notempty name="$detail.file_ids"}
<div class="upload-file layui-row">
<h3>相关附件</h3>
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md4" id="uploadFile{$vo.id}">{:file_card($vo,'view')}</div>
{/volist}
</div>
{/notempty}
</div>
{/block}
<!-- 脚本 -->
{block name="script"}
<script src="{__GOUGU__}/third_party/prism/prism.js"></script>
<script>
const moduleInit = ['tool'];
function gouguInit() {
var form = layui.form,tool=layui.tool;
}
</script>
{/block}
<!-- /脚本 -->
+548
View File
@@ -0,0 +1,548 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__GOUGU__}/third_party/fullcalendar/main.min.css"/>
<style>
#calendar {width: 100%;margin: 0 auto; background-color:#fff;
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
}
.fc .fc-toolbar.fc-header-toolbar{margin-bottom:0;border:1px solid #eeeeee; border-bottom:none;padding:15px 12px;}
.fc-col-header{background-color:#fafafa;}
.fc .fc-button-primary {color: #fff; background-color: #1E9FFF; border-color: #1E9FFF;}
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { color: #fff; background-color: #FBBC05; border-color: #FBBC05;}
.fc .fc-button-primary:focus, .fc .fc-button-primary:not(:disabled).fc-button-active:focus, .fc .fc-button-primary:not(:disabled):active:focus {box-shadow: 0 0 0 0;}
.fc .fc-button-primary:hover{color:#fff; background-color:#52B5FF; border-color:#52B5FF;}
.fc-daygrid-event-harness{cursor:pointer;}
.fc .fc-daygrid-week-number{font-size:12px;}
.fc-daygrid-block-event .fc-event-time{font-weight:800}
.fc-h-event .fc-event-main{color:#111111}
.fc-theme-standard .fc-scrollgrid,.fc-theme-standard td, .fc-theme-standard th{border-color:#eee;}
.fc-v-event .fc-event-main-frame{color:#333}
/*今天背景色和字体颜色 */
.fc .fc-daygrid-day.fc-day-today .fc-event-title,.fc .fc-daygrid-day.fc-day-today .fc-event-time,.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number{font-weight:800;color:#FF5722;}
.calendar-select{width:100px; height:40px; position:absolute; top:31px; right:262px; z-index:100;}
.calendar-select .layui-input{height: 36px; line-height: 1.2;}
.layui-tags-span {padding: 3px 6px;font-size: 12px; background-color:#fff; border-radius: 3px; margin:2px 0; margin-right: 5px; border: 1px solid #e6e6e6; display: inline-block;}
.layui-layer-content .layui-table-view .layui-table td,.layui-layer-content .layui-table-view .layui-table th{padding:1px 0;}
.layui-unselect dl {max-height:188px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<script src="{__GOUGU__}/third_party/fullcalendar/main.min.js"></script>
<div class="p-page">
<div id="calendar"></div>
{gt name="is_leader" value="0"}
<div class="calendar-select">
<div class="layui-input-inline"><input type="text" placeholder="选择下属员工" class="layui-input" data-event="select" autocomplete="off"/></div>
</div>
{/gt}
</div>
<!-- /主体 -->
{/block}
{block name="copyright"}{/block}
<!-- 脚本 -->
{block name="script"}
<script type="text/javascript">
var uid=0;
function addZero(num){
if(num<10){
num='0'+num;
}
return num;
}
const moduleInit = ['tool','oaPicker'];
function gouguInit() {
var form = layui.form,tool=layui.tool, oaPicker = layui.oaPicker,laydate = layui.laydate,dropdown = layui.dropdown;
// 选择下属员工
$('body').on('click','[data-event="select"]',function(){
var that = $(this);
oaPicker.employeeInit({
title:"选择下属",
department_url: "/api/index/get_department_tree_sub",
employee_url: "/api/index/get_employee_sub",
ids: '',
names: '',
type: 1,
callback:function(data){
//这里是选择后的回调方法,可以根据具体需求自定义写哦
let select_id=[],select_name=[];
for(var a=0; a<data.length;a++){
select_id.push(data[a].id);
select_name.push(data[a].name);
}
that.val(select_name.join(','));
uid = select_id.join(',');
calendar.refetchEvents();
}
})
});
function addEvent(detail){
var type='<span style="color:#aaa">请选择</span>';
if(detail.type==1){
type = '<span class="layui-badge-dot"></span> 紧急';
}
else if(detail.type==2){
type = '<span class="layui-badge-dot layui-bg-orange"></span> 重要';
}
else if(detail.type==3){
type = '<span class="layui-badge-dot layui-bg-blue"></span> 次要';
}
else if(detail.type==4){
type = '<span class="layui-badge-dot layui-bg-green"></span> 不重要';
}
else if(detail.type==5){
type = '<span class="layui-badge-dot layui-bg-black"></span> 无优先级';
}
var remind_type='不提醒';
if(detail.remind_type==1){
remind_type = '提前5分钟';
}
else if(detail.remind_type==2){
remind_type = '提前15分钟';
}
else if(detail.remind_type==3){
remind_type = '提前30分钟';
}
else if(detail.remind_type==4){
remind_type = '提前1小时';
}
else if(detail.remind_type==5){
remind_type = '提前2小时';
}else if(detail.remind_type==6){
remind_type = '提前1天';
}
var content='<form class="layui-form" style="width:728px">\
<table class="layui-table" style="margin:12px 12px 0;">\
<tr>\
<td class="layui-td-gray-2">日程时间范围<font>*</font></td>\
<td>\
<input id="start_time_a" name="start_time_a" style="width:90px; display:inline-block;" autocomplete="off" class="layui-input" value="'+detail.start_time_a+'" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="start_time_b" id="start_time_b"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:90px; display:inline-block;" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="end_time_b" id="end_time_b"></select></div>\
</td>\
<td class="layui-td-gray">提醒<font>*</font></td>\
<td>\
<div class="layui-input" id="remind_type" style="width:120px; line-height:35px;">'+remind_type+'</div>\
</td>\
</tr>\
<tr>\
<td class="layui-td-gray">日程内容<font>*</font></td>\
<td><input name="title" class="layui-input" value="'+detail.title+'" lay-verify="required" placeholder="请完成日程内容" lay-reqText="请完成日程内容"></td>\
<td class="layui-td-gray">优先级<font>*</font></td>\
<td>\
<div class="layui-input" id="type" style="width:120px; line-height:35px;">'+type+'</div>\
</td>\
</tr>\
<tr>\
<td class="layui-td-gray-2">日程详细描述</td>\
<td colspan="3">\
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:150px;">'+detail.remark+'</textarea>\
</td>\
</tr>\
</table>\
</form>';
layer.open({
type:1,
title:'创建日程安排',
area:['750px','399px'],
content:content,
success:function(){
//日期时间范围
laydate.render({
elem: '#start_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(a,b,c){
detail.start_time_a=a;
}
});
//日期时间范围
laydate.render({
elem: '#end_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(a,b,c){
detail.end_time_a=a;
}
});
$('#start_time_a,#end_time_a').empty();
var hourArray=[];
for(var h=0;h<24;h++){
var t=h<10?'0'+h:h
var t_1=t+':00',t_2=t+':15',t_3=t+':30',t_4=t+':45';
hourArray.push(t_1,t_2,t_3,t_4);
}
var html_1='', html_2='',def_h1=detail.start_time_b=detail.start_time_b,def_h2='';
for(var s=0;s<hourArray.length;s++){
var check_1='',check_2='';
if(hourArray[s]==def_h1){
check_1='selected';
}
if(hourArray[s]==def_h2){
check_2='selected';
}
html_1 += '<option value="'+hourArray[s]+'" '+check_1+'>'+hourArray[s]+'</option>';
html_2 += '<option value="'+hourArray[s]+'" '+check_2+'>'+hourArray[s]+'</option>';
}
$('#start_time_b').append(html_1);
$('#end_time_b').append(html_2);
form.render();
$('[name="title"]').on('input',function(){
var _val=$(this).val();
detail.title=_val;
});
form.on('select(start_time_b)', function(data){
detail.start_time_b=data.value;
});
form.on('select(end_time_b)', function(data){
detail.end_time_b=data.value;
});
$('[form-input="remark"]').on('input',function(){
var _val=$(this).val();
detail.remark=_val;
});
dropdown.render({
elem: '#type'
,data: [{
title: '紧急',
templet: function(d){
return '<span class="layui-badge-dot"></span> ' + d.title;
},
id: 1
},{
title: '重要',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-orange"></span> ' + d.title;
},
id: 2
},{
title: '次要',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-blue"></span> ' + d.title;
},
id: 3
},{
title: '不重要',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-green"></span> ' + d.title;
},
id: 4
},{
title: '无优先级',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-black"></span> ' + d.title;
},
id: 5
}]
,click: function(obj){
this.elem.html(obj.title);
detail.type = obj.id;
}
,style: 'width: 120px;'
});
dropdown.render({
elem: '#remind_type'
,data: [{
title: '不提醒',
id: 0
},{
title: '提前5分钟',
id: 1
},{
title: '提前15分钟',
id: 2
},{
title: '提前30分钟',
id: 3
},{
title: '提前1小时',
id: 4
},{
title: '提前2小时',
id: 5
},{
title: '提前1天',
id:6
}]
,click: function(obj){
this.elem.html(obj.title);
detail.remind_type = obj.id;
}
,style: 'width: 120px;'
});
},
btn: ['确定提交'],
btnAlign:'c',
yes: function(idx){
if(detail.start_time_a=='' || detail.end_time_a==''){
layer.msg('请完善日程时间范围');
return;
}
if(detail.title==''){
layer.msg('请填写日程内容');
return;
}
if(detail.type==0){
layer.msg('请选择日程优先级');
return;
}
console.log(detail);
$.ajax({
url: "/oa/plan/add",
type:'post',
data:detail,
success:function(e){
layer.msg(e.msg);
if(e.code==0){
layer.close(idx);
setTimeout(function(){
window.location.reload();
},1000)
}
}
})
}
})
}
//查看日程记录
function viewEvent(detail){
var work_type='<span style="color:#393D49">无优先级</span>';
if(detail.type==1){
work_type = '<span style="color:#FF5722">紧急</span>';
}
else if(detail.type==2){
work_type = '<span style="color:#FFB800">重要</span>';
}
else if(detail.type==3){
work_type = '<span style="color:#1E9FFF">次要</span>';
}
else if(detail.type==4){
work_type = '<span style="color:#009688">不重要</span>';
}
var content='<div style="width:724px">\
<table class="layui-table" style="margin:12px 12px 0;">\
<tr>\
<td class="layui-td-gray-2">日程时间范围</td>\
<td>'+detail.start_time+' 至 '+detail.end_time+'</td>\
<td class="layui-td-gray">提醒时间</td>\
<td>'+detail.remind_time+'</td>\
</tr>\
<tr>\
<td class="layui-td-gray-2">日程安排内容</td>\
<td>'+detail.title+'</td>\
<td class="layui-td-gray">优先级</td>\
<td>'+work_type+'</td>\
</tr>\
<tr>\
<td class="layui-td-gray-2">日程内容描述</td>\
<td colspan="3">'+detail.remark+'</td>\
</tr>\
</table>\
</div>';
layer.open({
type:1,
title:'查看日程安排',
area:['750px','398px'],
content:content,
success:function(){
},
btn: ['关闭'],
btnAlign: 'c',
yes: function(idx){
layer.close(idx);
}
})
}
//请求事件api数据
function eventApi(id){
if(id==0){
return false;
}
$.ajax({
url: "/oa/plan/view",
type:'post',
data:{id:id},
success:function(res){
var detail=res.data;
viewEvent(detail);
}
});
}
//日历
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
views: {
dayGrid: {
viewDidMount:function(arg){
calendar.setOption('height', window.innerHeight-30);
}
},
timeGrid: {
viewDidMount:function(arg){
calendar.setOption('height', 'auto');
}
},
week: {
viewDidMount:function(arg){
calendar.setOption('height', 'auto');
}
},
day: {
viewDidMount:function(arg){
calendar.setOption('height', 'auto');
}
}
},
//initialDate: '2020-09-12',//默认显示日期
initialView: 'dayGridMonth',//默认显示月视图
customButtons: {
clear: {
text: '清空员工', click: function () {
uid = 0;
$('[data-event="select"]').val('');
calendar.refetchEvents();
}
}
},
headerToolbar: {
left: 'prev,next',//prev,next today add
center: 'title',
right: 'clear dayGridMonth,timeGridWeek,listWeek' //clear dayGridMonth,timeGridWeek,timeGridDay,listWeek
},
height: 'auto',//自动高度
navLinks: true, // can click day/week names to navigate views
editable: true,//确定是否可以拖拉调整日历事件的时间。
eventResize:function(ev) {
var arg = ev.event
console.log(arg);
var detail={};
detail['id']=arg.id;
detail['start_time_a']=arg.start.getFullYear()+'-'+addZero(arg.start.getMonth()+1)+'-'+addZero(arg.start.getDate());
detail['end_time_a']=arg.end.getFullYear()+'-'+addZero(arg.end.getMonth()+1)+'-'+addZero(arg.end.getDate());
detail['start_time_b']=addZero(arg.start.getHours())+':'+addZero(arg.start.getMinutes());
detail['end_time_b']=addZero(arg.end.getHours())+':'+addZero(arg.end.getMinutes());
console.log(detail);
$.ajax({
url: "/home/plan/add",
type:'post',
data:detail,
success:function(e){
layer.msg(e.msg);
if(e.code==1){
ev.revert();
}
}
})
},
eventDrop:function(ev) {
var arg = ev.event
console.log(arg);
var detail={};
detail['id']=arg.id;
detail['start_time_a']=arg.start.getFullYear()+'-'+addZero(arg.start.getMonth()+1)+'-'+addZero(arg.start.getDate());
detail['end_time_a']=arg.end.getFullYear()+'-'+addZero(arg.end.getMonth()+1)+'-'+addZero(arg.end.getDate());
detail['start_time_b']=addZero(arg.start.getHours())+':'+addZero(arg.start.getMinutes());
detail['end_time_b']=addZero(arg.end.getHours())+':'+addZero(arg.end.getMinutes());
console.log(detail);
$.ajax({
url: "/oa/plan/add",
type:'post',
data:detail,
success:function(e){
layer.msg(e.msg);
if(e.code==1){
ev.revert();
}
}
})
},
selectable: true,//拖拉选择日期
selectMirror: true,//是否在用户拖动时绘制"占位符"事件。
select: function(arg) {
var detail={};
detail['id']=0;
detail['title']='';
detail['start_time_a']=arg.start.getFullYear()+'-'+addZero(arg.start.getMonth()+1)+'-'+addZero(arg.start.getDate());
detail['end_time_a']="";
detail['start_time_b']="09:00";
detail['end_time_b']="00:00";
detail['remark']='';
detail['type']=0;
detail['remind_type']=0;
console.log(detail);
addEvent(detail);
},
nowIndicator: true,
firstDay: 1,
weekNumbers: true,// 是否开启周数
displayEventEnd: false, //所有视图显示结束时间
eventTimeFormat: { // 事件的时间格式,like '14:30:00'
hour: '2-digit',
minute: '2-digit',
//second: '2-digit',
meridiem: false,
hour12: false //设置时间为24小时
},
slotLabelFormat: { // 列表视图左边的时间格式,like '14:30:00'
hour: '2-digit',
minute: '2-digit',
//second: '2-digit',
meridiem: false,
hour12: false //设置时间为24小时
},
locale: 'zh-cn',//语言
buttonText: {
//按钮文本
today: '今天',
month: '月',
week: '周',
day: '日',
list: '日程列表',
},
weekText: '周',
allDayText: '全天',
moreLinkText: function(n) {
return '另外 ' + n + ' 个'
},
noEventsText: '没有事件显示',
events: function(fetchInfo, successCallback, failureCallback ){
$.ajax({
type:"POST",
url: "/oa/plan/calendar",
dataType:"json",
data:{start:fetchInfo.startStr,end:fetchInfo.endStr,uid:uid},
success:function(result){
//console.info(result);
successCallback(result);
},
error:function(){
failureCallback();
}
})
},
eventClick: function(info) {
//console.log(info.event);
eventApi(info.event.id);
}
});
calendar.render();
}
</script>
{/block}
<!-- /脚本 -->
+464
View File
@@ -0,0 +1,464 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.layui-unselect dl {max-height:188px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="p-page">
<form class="layui-form gg-form-bar border-x border-t" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:180px">
<input type="text" name="diff_time" class="layui-input tool-time" data-range="~" placeholder="选择时间区间" readonly>
</div>
{gt name="is_leader" value="0"}
<div class="layui-input-inline" style="width:120px;">
<input type="text" name="username" placeholder="请选择下属员工" class="layui-input picker-sub" readonly />
<input type="text" name="uid" value="" style="display:none" />
</div>
{/gt}
<div class="layui-input-inline" style="width:120px;">
<select name="type">
<option value="">选择优先级</option>
<option value="1">紧急</option>
<option value="2">重要</option>
<option value="3">次要</option>
<option value="4">不重要</option>
<option value="5">无优先级</option>
</select>
</div>
<div class="layui-input-inline" style="width:240px;">
<input type="text" name="keywords" placeholder="输入关键字,日程安排内容" class="layui-input"/>
</div>
<div class="layui-input-inline" style="width:150px;">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
</div>
</form>
<div>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm addLoan" type="button">+ 新增日程安排</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','tablePlus','oaPicker'];
function gouguInit() {
var form = layui.form,table = layui.tablePlus,tool=layui.tool,dropdown = layui.dropdown,laydate = layui.laydate;
layui.pageTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'日程安排列表'
,url: "/oa/plan/datalist"
,cellMinWidth: 80
,height: 'full-114'
,cols: [[ //表头
{field: 'id', title: '序号',fixed: 'left', width:80, align:'center'}
,{field: 'type', title: '优先级', align:'center',width:100,templet:function(d){
var html='';
if(d.type==1){
html = '<span style="color:#FF5722">『紧急』</span>';
}
else if(d.type==2){
html = '<span style="color:#FFB800">『重要』</span>';
}
else if(d.type==3){
html = '<span style="color:#1E9FFF">『次要』</span>';
}
else if(d.type==4){
html = '<span style="color:#009688">『不重要』</span>';
}
else if(d.type==5){
html = '<span style="color:#393D49">『无优先级』</span>';
}
return html;
}}
,{field: 'start_time', title: '日程时间范围', align:'center',width:280,templet:function(d){
var html=d.start_time+'至'+d.end_time;
return html;
}}
,{field: 'title', title: '日程安排内容'}
,{field: 'remind_time', title: '提醒时间', align:'center',width:136}
,{field: 'right', title: '操作',fixed:'right', width:120, align:'center',templet:function(d){
var html='<div class="layui-btn-group">';
html+='<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">查看</button>';
if(d.admin_id==login_admin){
html+='<button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button>';
html+='<button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</button>';
}
html+='</div>';
return html;
}}
]]
});
//操作
table.on('tool(test)', function(obj){
var data = obj.data;
if(obj.event === 'edit'){
$.ajax({
url: "/oa/plan/view",
type:'get',
data:{id:data.id},
success:function(e){
if(e.code==0){
var detail={};
detail['id']=e.data.id;
detail['title']=e.data.title;
detail['start_time_a']=e.data.start_time_a;
detail['end_time_a']=e.data.end_time_a;
detail['start_time_b']=e.data.start_time_b;
detail['end_time_b']=e.data.end_time_b;
detail['remark']=e.data.remark;
detail['type']=e.data.type;
detail['remind_type']=e.data.remind_type;
addEvent(detail);
}
}
})
return;
}
else if(obj.event === 'view'){
$.ajax({
url: "/oa/plan/view",
type:'get',
data:{id:data.id},
success:function(e){
if(e.code==0){
viewEvent(e.data);
}
}
})
return;
}
else if(obj.event === 'del'){
layer.confirm('您确定要删除该日程', {
icon: 3,
title: '提示'
}, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.pageTable.reload();
}
}
tool.delete("/oa/plan/del", { id: obj.data.id }, callback);
layer.close(index);
});
return;
}
});
//查看日程记录
function viewEvent(detail){
var work_type='<span style="color:#393D49">无优先级</span>';
if(detail.type==1){
work_type = '<span style="color:#FF5722">紧急</span>';
}
else if(detail.type==2){
work_type = '<span style="color:#FFB800">重要</span>';
}
else if(detail.type==3){
work_type = '<span style="color:#1E9FFF">次要</span>';
}
else if(detail.type==4){
work_type = '<span style="color:#009688">不重要</span>';
}
var content='<div style="width:724px">\
<table class="layui-table" style="margin:12px 12px 0;">\
<tr>\
<td class="layui-td-gray-2">日程时间范围</td>\
<td>'+detail.start_time+' 至 '+detail.end_time+'</td>\
<td class="layui-td-gray">提醒时间</td>\
<td>'+detail.remind_time+'</td>\
</tr>\
<tr>\
<td class="layui-td-gray-2">日程安排内容</td>\
<td>'+detail.title+'</td>\
<td class="layui-td-gray">优先级</td>\
<td>'+work_type+'</td>\
</tr>\
<tr>\
<td class="layui-td-gray-2">日程内容描述</td>\
<td colspan="3">'+detail.remark+'</td>\
</tr>\
</table>\
</div>';
layer.open({
type:1,
title:'日程安排',
area:['750px','398px'],
content:content,
success:function(){
},
btn: ['关闭'],
btnAlign: 'c',
yes: function(idx){
layer.close(idx);
}
})
}
$('body').on('click','.addLoan',function(){
var detail={};
detail['id']=0;
detail['title']='';
detail['start_time_a']='';
detail['end_time_a']='';
detail['start_time_b']='09:00';
detail['end_time_b']='18:00';
detail['remark']='';
detail['type']=0;
detail['remind_type']=0;
addEvent(detail);
});
function addEvent(detail){
var type='<span style="color:#aaa">请选择</span>';
if(detail.type==1){
type = '<span class="layui-badge-dot"></span> 紧急';
}
else if(detail.type==2){
type = '<span class="layui-badge-dot layui-bg-orange"></span> 重要';
}
else if(detail.type==3){
type = '<span class="layui-badge-dot layui-bg-blue"></span> 次要';
}
else if(detail.type==4){
type = '<span class="layui-badge-dot layui-bg-green"></span> 不重要';
}
else if(detail.type==5){
type = '<span class="layui-badge-dot layui-bg-black"></span> 无优先级';
}
var remind_type='不提醒';
if(detail.remind_type==1){
remind_type = '提前5分钟';
}
else if(detail.remind_type==2){
remind_type = '提前15分钟';
}
else if(detail.remind_type==3){
remind_type = '提前30分钟';
}
else if(detail.remind_type==4){
remind_type = '提前1小时';
}
else if(detail.remind_type==5){
remind_type = '提前2小时';
}else if(detail.remind_type==6){
remind_type = '提前1天';
}
var content='<form class="layui-form" style="width:728px">\
<table class="layui-table" style="margin:12px 12px 0;">\
<tr>\
<td class="layui-td-gray-2">日程时间范围<font>*</font></td>\
<td>\
<input id="start_time_a" name="start_time_a" style="width:90px; display:inline-block;" autocomplete="off" class="layui-input" value="'+detail.start_time_a+'" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="start_time_b" id="start_time_b"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:90px; display:inline-block;" autocomplete="off" class="layui-input" value="'+detail.end_time_a+'" readonly lay-verify="required" placeholder="请选择时间" lay-reqText="请选择时间"><div style="display: inline-block; margin-left:3px; width: 80px;"><select lay-filter="end_time_b" id="end_time_b"></select></div>\
</td>\
<td class="layui-td-gray">提醒<font>*</font></td>\
<td>\
<div class="layui-input" id="remind_type" style="width:120px; line-height:35px;">'+remind_type+'</div>\
</td>\
</tr>\
<tr>\
<td class="layui-td-gray">日程内容<font>*</font></td>\
<td><input name="title" class="layui-input" value="'+detail.title+'" lay-verify="required" placeholder="请完成日程内容" lay-reqText="请完成日程内容"></td>\
<td class="layui-td-gray">优先级<font>*</font></td>\
<td>\
<div class="layui-input" id="type" style="width:120px; line-height:35px;">'+type+'</div>\
</td>\
</tr>\
<tr>\
<td class="layui-td-gray-2">日程详细描述</td>\
<td colspan="3">\
<textarea name="remark" form-input="remark" class="layui-textarea" style="min-height:150px;">'+detail.remark+'</textarea>\
</td>\
</tr>\
</table>\
</form>';
layer.open({
type:1,
title:'日程安排',
area:['750px','398px'],
content:content,
success:function(){
//日期时间范围
laydate.render({
elem: '#start_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(a,b,c){
detail.start_time_a=a;
}
});
//日期时间范围
laydate.render({
elem: '#end_time_a',
type: 'date',
format: 'yyyy-MM-dd',
showBottom: false,
done:function(a,b,c){
detail.end_time_a=a;
}
});
$('#start_time_a,#end_time_a').empty();
var hourArray=[];
for(var h=0;h<24;h++){
var t=h<10?'0'+h:h
var t_1=t+':00',t_2=t+':15',t_3=t+':30',t_4=t+':45';
hourArray.push(t_1,t_2,t_3,t_4);
}
var html_1='', html_2='',def_h1=detail.start_time_b,def_h2=detail.end_time_b;
for(var s=0;s<hourArray.length;s++){
var check_1='',check_2='';
if(hourArray[s]==def_h1){
check_1='selected';
}
if(hourArray[s]==def_h2){
check_2='selected';
}
html_1 += '<option value="'+hourArray[s]+'" '+check_1+'>'+hourArray[s]+'</option>';
html_2 += '<option value="'+hourArray[s]+'" '+check_2+'>'+hourArray[s]+'</option>';
}
$('#start_time_b').append(html_1);
$('#end_time_b').append(html_2);
form.render();
$('[name="title"]').on('input',function(){
var _val=$(this).val();
detail.title=_val;
});
form.on('select(start_time_b)', function(data){
detail.start_time_b=data.value;
});
form.on('select(end_time_b)', function(data){
detail.end_time_b=data.value;
});
$('[form-input="remark"]').on('input',function(){
var _val=$(this).val();
detail.remark=_val;
});
dropdown.render({
elem: '#type'
,data: [{
title: '紧急',
templet: function(d){
return '<span class="layui-badge-dot"></span> ' + d.title;
},
id: 1
},{
title: '重要',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-orange"></span> ' + d.title;
},
id: 2
},{
title: '次要',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-blue"></span> ' + d.title;
},
id: 3
},{
title: '不重要',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-green"></span> ' + d.title;
},
id: 4
},{
title: '无优先级',
templet: function(d){
return '<span class="layui-badge-dot layui-bg-black"></span> ' + d.title;
},
id: 5
}]
,click: function(obj){
this.elem.html(obj.title);
detail.type = obj.id;
}
,style: 'width: 120px;'
});
dropdown.render({
elem: '#remind_type'
,data: [{
title: '不提醒',
id: 0
},{
title: '提前5分钟',
id: 1
},{
title: '提前15分钟',
id: 2
},{
title: '提前30分钟',
id: 3
},{
title: '提前1小时',
id: 4
},{
title: '提前2小时',
id: 5
},{
title: '提前1天',
id:6
}]
,click: function(obj){
this.elem.html(obj.title);
detail.remind_type = obj.id;
}
,style: 'width: 120px;'
});
},
btn: ['确定提交'],
btnAlign:'c',
yes: function(idx){
if(detail.start_time_a=='' || detail.end_time_a==''){
layer.msg('请完善日程时间范围');
return;
}
if(detail.type==0){
layer.msg('请选择日程优先级');
return;
}
if(detail.title==''){
layer.msg('请填写日程内容');
return;
}
console.log(detail);
$.ajax({
url: "/oa/plan/add",
type:'post',
data:detail,
success:function(e){
layer.msg(e.msg);
if(e.code==0){
layer.close(idx);
layui.pageTable.reload();
}
}
})
}
})
}
}
</script>
{/block}
<!-- /脚本 -->
+219
View File
@@ -0,0 +1,219 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<link rel="stylesheet" href="{__GOUGU__}/third_party/fullcalendar/main.min.css"/>
<style>
#calendar {width: 100%;margin: 0 auto; background-color:#fff;
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
}
.fc .fc-toolbar.fc-header-toolbar{margin-bottom:0;border:1px solid #eeeeee; border-bottom:none;padding:15px 12px;}
.fc-col-header{background-color:#fafafa;}
.fc .fc-button-primary {color: #fff; background-color: #1E9FFF; border-color: #1E9FFF;}
.fc .fc-button-primary:not(:disabled).fc-button-active, .fc .fc-button-primary:not(:disabled):active { color: #fff; background-color: #FBBC05; border-color: #FBBC05;}
.fc .fc-button-primary:focus, .fc .fc-button-primary:not(:disabled).fc-button-active:focus, .fc .fc-button-primary:not(:disabled):active:focus {box-shadow: 0 0 0 0;}
.fc .fc-button-primary:hover{color:#fff; background-color:#52B5FF; border-color:#52B5FF;}
.fc-daygrid-event-harness{cursor:pointer;}
.fc .fc-daygrid-week-number{font-size:12px;}
.fc-daygrid-block-event .fc-event-time{font-weight:800}
.fc-h-event .fc-event-main{color:#111111}
.fc-theme-standard .fc-scrollgrid,.fc-theme-standard td, .fc-theme-standard th{border-color:#eee;}
/*今天背景色和字体颜色 */
.fc .fc-daygrid-day.fc-day-today .fc-event-title,.fc .fc-daygrid-day.fc-day-today .fc-event-time,.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number{font-weight:800;color:#FF5722;}
.calendar-select{width:100px; height:40px; position:absolute; top:31px; right:262px; z-index:100;}
.calendar-select .layui-input{height: 36px; line-height: 1.2;}
.layui-tags-span {padding: 3px 6px;font-size: 12px; background-color:#fff; border-radius: 3px; margin:2px 0; margin-right: 5px; border: 1px solid #e6e6e6; display: inline-block;}
.layui-layer-content .layui-table-view .layui-table td,.layui-layer-content .layui-table-view .layui-table th{padding:1px 0;}
.layui-unselect dl {max-height:188px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<script src="{__GOUGU__}/third_party/fullcalendar/main.min.js"></script>
<div class="p-page">
<div id="calendar"></div>
{gt name="is_leader" value="0"}
<div class="calendar-select">
<div class="layui-input-inline"><input type="text" placeholder="选择下属员工" class="layui-input" data-event="select" autocomplete="off"/></div>
</div>
{/gt}
</div>
<!-- /主体 -->
{/block}
{block name="copyright"}{/block}
<!-- 脚本 -->
{block name="script"}
<script type="text/javascript">
var uid=0;
function addZero(num){
if(num<10){
num='0'+num;
}
return num;
}
const moduleInit = ['tool','oaPicker','oaSchedule'];
function gouguInit() {
var form = layui.form,tool=layui.tool, oaPicker = layui.oaPicker,laydate = layui.laydate,work = layui.oaSchedule;
// 选择下属员工
$('body').on('click','[data-event="select"]',function(){
var that = $(this);
oaPicker.employeeInit({
title:"选择下属",
department_url: "/api/index/get_department_tree_sub",
employee_url: "/api/index/get_employee_sub",
ids: '',
names: '',
type: 1,
callback:function(data){
//这里是选择后的回调方法,可以根据具体需求自定义写哦
let select_id=[],select_name=[];
for(var a=0; a<data.length;a++){
select_id.push(data[a].id);
select_name.push(data[a].name);
}
that.val(select_name.join(','));
uid = select_id.join(',');
calendar.refetchEvents();
}
})
});
//请求事件api数据
function eventApi(id){
if(id==0){
return false;
}
$.ajax({
url: "/oa/schedule/view",
type:'post',
data:{id:id},
success:function(res){
detail=res.data;
work.view(detail);
}
});
}
//日历
var calendarEl = document.getElementById('calendar');
var calendar = new FullCalendar.Calendar(calendarEl, {
views: {
dayGrid: {
viewDidMount:function(arg){
calendar.setOption('height', window.innerHeight-30);
}
},
timeGrid: {
viewDidMount:function(arg){
calendar.setOption('height', 'auto');
}
},
week: {
viewDidMount:function(arg){
calendar.setOption('height', 'auto');
}
},
day: {
viewDidMount:function(arg){
calendar.setOption('height', 'auto');
}
}
},
//initialDate: '2020-09-12',//默认显示日期
initialView: 'dayGridMonth',//默认显示月视图
customButtons: {
clear: {
text: '清空员工', click: function () {
uid = 0;
$('[data-event="select"]').val('');
calendar.refetchEvents();
}
}
},
headerToolbar: {
left: 'prev,next',
center: 'title',
right: 'clear dayGridMonth,timeGridWeek,listWeek'
},
height: 'auto',//自动高度
navLinks: true, // can click day/week names to navigate views
editable: false,//确定是否可以拖拉调整日历事件的时间。
selectable: false,//拖拉选择日期
selectMirror: false,//是否在用户拖动时绘制"占位符"事件。
dateClick: function(arg) {
var dateStr = arg.date.getFullYear()+'-'+addZero(arg.date.getMonth()+1)+'-'+addZero(arg.date.getDate());
const dateToCheck = new Date(dateStr);
const currentDate = new Date();
const sevenDaysAgo = new Date();
sevenDaysAgo.setDate(currentDate.getDate() - 7);
if (dateToCheck < sevenDaysAgo) {
// 七日前的日期不可选,可以显示提示信息
layer.msg('不能选择七日前的日期。');
return false;
} else {
var detail={};
detail['id']=0;
detail['title']='';
detail['labor_type']=0;
detail['start_time_a']=dateStr;
detail['end_time_a']=dateStr;
detail['start_time_b']='09:00';
detail['end_time_b']='09:30';
detail['remark']='';
detail['type']=0;
detail['remind_type']=0;
//console.log(detail);
work.add(0, detail);
}
},
nowIndicator: true,
weekNumbers: true,// 是否开启周数
firstDay: 1,
displayEventEnd: false, //所有视图显示结束时间
eventTimeFormat: { // like '14:30:00'
hour: '2-digit',
minute: '2-digit',
//second: '2-digit',
meridiem: false,
hour12: false //设置时间为24小时
},
locale: 'zh-cn',//语言
buttonText: {
//按钮文本
today: '今天',
month: '月',
week: '周',
day: '日',
list: '记录列表',
},
weekText: '周',
allDayText: '全天',
moreLinkText: function(n) {
return '另外 ' + n + ' 个'
},
noEventsText: '没有事件显示',
events: function(fetchInfo, successCallback, failureCallback ){
$.ajax({
type:"POST",
url: "/oa/schedule/calendar",
dataType:"json",
data:{start:fetchInfo.startStr,end:fetchInfo.endStr,uid:uid},
success:function(result){
//console.info(result);
successCallback(result);
},
error:function(){
failureCallback();
}
})
},
eventClick: function(info) {
//console.log(info.event);
eventApi(info.event.id);
}
});
calendar.render();
}
</script>
{/block}
<!-- /脚本 -->
+261
View File
@@ -0,0 +1,261 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.layui-unselect dl {max-height:200px;}
</style>
{/block}
<!-- 主体 -->
{block name="body"}
<div class="p-page">
<form class="layui-form gg-form-bar border-x border-t" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:180px">
<input type="text" name="diff_time" class="layui-input tool-time" data-range="~" placeholder="选择时间区间" readonly>
</div>
{gt name="is_leader" value="0"}
<div class="layui-input-inline" style="width:120px;">
<input type="text" name="username" placeholder="请选择下属员工" class="layui-input picker-sub" readonly />
<input type="text" name="uid" value="" style="display:none" />
</div>
{/gt}
<div class="layui-input-inline" style="width:130px;">
<select name="cid">
<option value="">选择工作类别</option>
{volist name=":get_base_data('WorkCate')" id="vo"}
<option value="{$vo.id}">{$vo.title}</option>
{/volist}
</select>
</div>
<div class="layui-input-inline" style="width:130px;">
<select name="labor_type">
<option value="">选择工作类型</option>
<option value="1">案头工作</option>
<option value="2">外勤工作</option>
</select>
</div>
<div class="layui-input-inline" style="width:220px;">
<input type="text" name="keywords" placeholder="输入关键字,工作内容" class="layui-input"/>
</div>
<div class="layui-input-inline" style="width:150px;">
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
</div>
</form>
<div>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm addLoan" type="button">+ 新增工作记录</button>
</div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const is_leader = '{$is_leader}';
const role_auth = '{$role_auth}';
const hour_auth = '{$hour_auth}';
const moduleInit = ['tool','tablePlus','oaPicker','oaSchedule'];
function gouguInit() {
var form = layui.form,table = layui.tablePlus,tool=layui.tool, laydate = layui.laydate,work = layui.oaSchedule;
//日期范围
laydate.render({
elem: '#barDate',
range: ['#start_time', '#end_time']
});
layui.scheduleTable = table.render({
elem: '#test'
,toolbar: '#toolbarDemo'
,title:'工作记录列表'
,url: "/oa/schedule/datalist"
,cellMinWidth: 80
,height: 'full-114'
,cols: [[ //表头
{field: 'id', title: '序号',fixed: 'left', width:80, align:'center'}
,{field: 'labor_type_string', title: '工作类型', align:'center',width:100,templet:function(d){
var html='';
if(d.labor_type==0){
html='<span class="layui-color-'+d.labor_type+'">-</span>';
}
else if(d.labor_type == 1){
html='<span class="layui-color-'+d.labor_type+'">『案头工作』</span>';
}
else if(d.labor_type == 2){
html='<span class="layui-color-'+d.labor_type+'">『外勤工作』</span>';
}
return html;
}}
,{field: 'work_cate', title: '工作类别', align:'center',width:100}
,{field: 'start_time', title: '工作时间范围', align:'center',width:186,templet:function(d){
var html=d.start_time+'至'+d.end_time;
return html;
}}
,{field: 'name', title: '执行人', align:'center',width:80}
,{field: 'labor_time', title: '工时', align:'center',width:80}
,{field: 'title', title: '工作内容'}
,{field: 'create_time', title: '记录时间', align:'center',width:150}
,{field: 'right', title: '操作',fixed:'right', width:180, align:'center',templet:function(d){
var html='<div class="layui-btn-group">';
if(hour_auth==2 && d.admin_id==login_admin){
//开放员工自己调整
html+='<button class="layui-btn layui-btn-xs layui-bg-orange" lay-event="time">调整工时</button>';
html+='<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</button>';
}
if(hour_auth==3 && is_leader > 0){
//开放部门负责人调整
html+='<button class="layui-btn layui-btn-xs layui-bg-orange" lay-event="time">调整工时</button>';
html+='<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</button>';
}
if(hour_auth==4 && role_auth > 0){
//开放日常办公数据管理员调整
html+='<button class="layui-btn layui-btn-xs layui-bg-orange" lay-event="time">调整工时</button>';
html+='<button class="layui-btn layui-btn-xs layui-btn-danger" lay-event="del">删除</button>';
}
if(d.admin_id==login_admin){
html+='<button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button>';
}
html+='<button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">查看</button>';
html+='</div>';
return html;
}}
]]
});
//更改工时
table.on('tool(test)', function(obj){
var data = obj.data;
if(obj.event === 'time'){
var content='<form class="layui-form" style="width:666px">\
<table class="layui-table" style="margin:12px 12px 0;">\
<tr>\
<td class="layui-td-gray-2">工作时间范围<font>*</font></td>\
<td>\
<input id="start_time_a" name="start_time_a" style="width:150px; display:inline-block;" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:5px; width: 90px;"><select lay-filter="start_time_b" id="start_time_b"></select></div> 至 <input id="end_time_a" name="end_time_a" style="width:150px; display:inline-block;" autocomplete="off" class="layui-input" value="" readonly lay-verify="required" lay-reqText="请选择"><div style="display: inline-block; margin-left:5px; width: 90px;"><select lay-filter="end_time_b" id="end_time_b"></select></div>\
</td>\
</tr>\
</table>\
</form>';
layer.open({
type:1,
title:'调整工时',
area:['692px','398px'],
content:content,
success:function(){
//日期时间范围
laydate.render({
elem: '#start_time_a',
type: 'date',
max:0,
format: 'yyyy-MM-dd',
showBottom: false,
done:function(a,b,c){
$('#end_time_a').val(a);
}
});
//日期时间范围
laydate.render({
elem: '#end_time_a',
type: 'date',
max:0,
format: 'yyyy-MM-dd',
showBottom: false,
done:function(a,b,c){
$('#start_time_a').val(a);
}
});
$('#start_time_b,#end_time_b').empty();
var hourArray=[];
for(var h=0;h<24;h++){
var t=h<10?'0'+h:h
var t_1=t+':00',t_2=t+':15',t_3=t+':30',t_4=t+':45';
hourArray.push(t_1,t_2,t_3,t_4);
}
var html_1='', html_2='',def_h1='09:00',def_h2='09:30';
for(var s=0;s<hourArray.length;s++){
var check_1='',check_2='';
if(hourArray[s]==def_h1){
check_1='selected';
}
if(hourArray[s]==def_h2){
check_2='selected';
}
html_1 += '<option value="'+hourArray[s]+'" '+check_1+'>'+hourArray[s]+'</option>';
html_2 += '<option value="'+hourArray[s]+'" '+check_2+'>'+hourArray[s]+'</option>';
}
$('#start_time_b').append(html_1);
$('#end_time_b').append(html_2);
form.render();
},
btn: ['确定提交'],
btnAlign: 'c',
yes: function(idx){
let start_time_a = $('#start_time_a').val();
let end_time_a = $('#end_time_a').val();
let start_time_b = $('#start_time_b').val();
let end_time_b = $('#end_time_b').val();
if(start_time_a=='' || end_time_a==''){
layer.msg('请选择工作时间范围');
return;
}
$.ajax({
url: "/oa/api/update_schedule",
type:'post',
data:{
id:data.id,
admin_id:data.admin_id,
start_time_a:start_time_a,
end_time_a:end_time_a,
start_time_b:start_time_b,
end_time_b:end_time_b
},
success:function(e){
layer.msg(e.msg);
if(e.code==0){
layer.close(idx);
layui.scheduleTable.reload();
}
}
})
}
})
}
else if(obj.event === 'edit'){
work.add(0, obj.data);
}
else if(obj.event === 'view'){
work.view(obj.data);
}
else if(obj.event === 'del'){
layer.confirm('您确定要删除该工作记录?', {
icon: 3,
title: '提示'
}, function (index) {
let callback = function (e) {
layer.msg(e.msg);
if (e.code == 0) {
layui.scheduleTable.reload();
}
}
tool.delete("/oa/schedule/del", { id: obj.data.id }, callback);
layer.close(index);
});
}
});
$('body').on('click','.addLoan',function(){
work.add(0,{'id':0});
});
}
</script>
{/block}
<!-- /脚本 -->
+113
View File
@@ -0,0 +1,113 @@
{extend name="../../base/view/common/base" /}
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">工作日报汇报</h3>
<table class="layui-table layui-table-form">
<tr>
{if ($id == 0) OR ($detail.send_time == 0) }
<td class="layui-td-gray">接收人<font>*</font></td>
<td>
<input type="text" name="to_unames" value="{$detail.to_unames|default=''}" lay-verify="required" lay-reqText="请选择接收人" placeholder="请选择接收人" readonly class="layui-input picker-admin" data-type="2">
<input type="hidden" name="to_uids" value="{$detail.to_uids|default=''}">
</td>
{else/}
<td class="layui-td-gray">接收人</td>
<td>{$detail.to_unames|default=''}</td>
{/if}
<td class="layui-td-gray">汇报周期<font>*</font></td>
<td><input type="text" class="layui-input tool-time" name="start_date" readonly value="{$detail.range_date|default=''}" lay-verify="required" lay-reqText="请完善汇报周期"></td>
</tr>
<tr>
<td class="layui-td-gray">今日工作<font>*</font></td>
<td colspan="3"><textarea name="works" placeholder="请输入今日工作内容" class="layui-textarea" style="height: 120px;" lay-verify="required" lay-reqText="请输入今日工作内容">{$detail.works|default=''}</textarea></td>
</tr>
<tr><td class="layui-td-gray">明日计划</td>
<td colspan="3"><textarea name="plans" placeholder="请输入明日计划" class="layui-textarea" style="height: 120px;">{$detail.plans|default=''}</textarea></td>
</tr>
<tr><td class="layui-td-gray">其它事项</td>
<td colspan="3"><textarea name="remark" placeholder="请输入其它事项" class="layui-textarea" style="height: 120px;">{$detail.remark|default=''}</textarea></td>
</tr>
<tr>
<td class="layui-td-gray"><div class="layui-input-inline">附件</div> <div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="uploadBtn"><i class="layui-icon"></i></button></div></td>
<td colspan="3">
<div class="layui-row" id="uploadBox">
<input type="hidden" name="file_ids" data-type="file" value="{$detail.file_ids|default=''}">
{notempty name="$detail.file_array"}
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md4">{:file_card($vo)}</div>
{/volist}
{/notempty}
</div>
</td>
</tr>
</table>
<div class="pt-4">
<input type="hidden" value="{$id}" name="id">
<input type="hidden" value="{$types}" name="types">
<input type="hidden" value="0" name="send">
<button class="layui-btn" lay-submit="" lay-filter="webform1">仅保存</button>
{if ($id == 0) OR ($detail.send_time == 0) }
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">保存并发送</button>
{/if}
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','oaPicker','uploadPlus'];
function gouguInit() {
var form = layui.form,tool=layui.tool,uploadPlus = layui.uploadPlus;
var attachment = new uploadPlus({
"title":'上传文件',
"target":'uploadBtn',
"targetBox":'uploadBox'
});
//监听发送
form.on('submit(webform)', function(data){
if(data.field.uids==login_admin){
layer.msg('接收人不能是自己');
return false;
}
data.field.send=1;
tool.ask('确定要保存后直接发送该工作汇报吗?', function(index){
$.ajax({
url: "/oa/work/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
return false;
});
//监听保存
form.on('submit(webform1)', function(data){
tool.ask('确定要仅保存该工作汇报吗?', function(index){
$.ajax({
url: "/oa/work/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->
+113
View File
@@ -0,0 +1,113 @@
{extend name="../../base/view/common/base" /}
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">工作周报汇报</h3>
<table class="layui-table layui-table-form">
<tr>
{if ($id == 0) OR ($detail.send_time == 0) }
<td class="layui-td-gray">接收人<font>*</font></td>
<td>
<input type="text" name="to_unames" value="{$detail.to_unames|default=''}" lay-verify="required" lay-reqText="请选择接收人" placeholder="请选择接收人" readonly class="layui-input picker-admin" data-type="2">
<input type="hidden" name="to_uids" value="{$detail.to_uids|default=''}">
</td>
{else/}
<td class="layui-td-gray">接收人</td>
<td>{$detail.to_unames|default=''}</td>
{/if}
<td class="layui-td-gray">汇报周期<font>*</font></td>
<td><input type="text" class="layui-input tool-time" data-range="~" name="range_date" readonly value="{$detail.range_date|default=''}" lay-verify="required" lay-reqText="请完善汇报周期"></td>
</tr>
<tr>
<td class="layui-td-gray">本周工作<font>*</font></td>
<td colspan="3"><textarea name="works" placeholder="请输入本周工作内容" class="layui-textarea" style="height: 120px;" lay-verify="required" lay-reqText="请输入本周工作内容">{$detail.works|default=''}</textarea></td>
</tr>
<tr><td class="layui-td-gray">下周计划</td>
<td colspan="3"><textarea name="plans" placeholder="请输入下周计划" class="layui-textarea" style="height: 120px;">{$detail.plans|default=''}</textarea></td>
</tr>
<tr><td class="layui-td-gray">其它事项</td>
<td colspan="3"><textarea name="remark" placeholder="请输入其它事项" class="layui-textarea" style="height: 120px;">{$detail.remark|default=''}</textarea></td>
</tr>
<tr>
<td class="layui-td-gray"><div class="layui-input-inline">附件</div> <div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="uploadBtn"><i class="layui-icon"></i></button></div></td>
<td colspan="3">
<div class="layui-row" id="uploadBox">
<input type="hidden" name="file_ids" data-type="file" value="{$detail.file_ids|default=''}">
{notempty name="$detail.file_array"}
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md4">{:file_card($vo)}</div>
{/volist}
{/notempty}
</div>
</td>
</tr>
</table>
<div class="pt-4">
<input type="hidden" value="{$id}" name="id">
<input type="hidden" value="{$types}" name="types">
<input type="hidden" value="0" name="send">
<button class="layui-btn" lay-submit="" lay-filter="webform1">仅保存</button>
{if ($id == 0) OR ($detail.send_time == 0) }
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">保存并发送</button>
{/if}
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','oaPicker','uploadPlus'];
function gouguInit() {
var form = layui.form,tool=layui.tool,uploadPlus = layui.uploadPlus;
var attachment = new uploadPlus({
"title":'上传文件',
"target":'uploadBtn',
"targetBox":'uploadBox'
});
//监听发送
form.on('submit(webform)', function(data){
if(data.field.uids==login_admin){
layer.msg('接收人不能是自己');
return false;
}
data.field.send=1;
tool.ask('确定要保存后直接发送该工作汇报吗?', function(index){
$.ajax({
url: "/oa/work/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
return false;
});
//监听保存
form.on('submit(webform1)', function(data){
tool.ask('确定要仅保存该工作汇报吗?', function(index){
$.ajax({
url: "/oa/work/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->
+113
View File
@@ -0,0 +1,113 @@
{extend name="../../base/view/common/base" /}
{block name="body"}
<form class="layui-form p-4">
<h3 class="pb-3">工作月报汇报</h3>
<table class="layui-table layui-table-form">
<tr>
{if ($id == 0) OR ($detail.send_time == 0) }
<td class="layui-td-gray">接收人<font>*</font></td>
<td>
<input type="text" name="to_unames" value="{$detail.to_unames|default=''}" lay-verify="required" lay-reqText="请选择接收人" placeholder="请选择接收人" readonly class="layui-input picker-admin" data-type="2">
<input type="hidden" name="to_uids" value="{$detail.to_uids|default=''}">
</td>
{else/}
<td class="layui-td-gray">接收人</td>
<td>{$detail.to_unames|default=''}</td>
{/if}
<td class="layui-td-gray">汇报周期<font>*</font></td>
<td><input type="text" class="layui-input tool-time" data-range="~" name="range_date" readonly value="{$detail.range_date|default=''}" lay-verify="required" lay-reqText="请完善汇报周期"></td>
</tr>
<tr>
<td class="layui-td-gray">本月工作<font>*</font></td>
<td colspan="3"><textarea name="works" placeholder="请输入本月工作内容" class="layui-textarea" style="height: 120px;" lay-verify="required" lay-reqText="请输入本月工作内容">{$detail.works|default=''}</textarea></td>
</tr>
<tr><td class="layui-td-gray">下月计划</td>
<td colspan="3"><textarea name="plans" placeholder="请输入下月计划" class="layui-textarea" style="height: 120px;">{$detail.plans|default=''}</textarea></td>
</tr>
<tr><td class="layui-td-gray">其它事项</td>
<td colspan="3"><textarea name="remark" placeholder="请输入其它事项" class="layui-textarea" style="height: 120px;">{$detail.remark|default=''}</textarea></td>
</tr>
<tr>
<td class="layui-td-gray"><div class="layui-input-inline">附件</div> <div class="layui-input-inline"><button type="button" class="layui-btn layui-btn-xs" id="uploadBtn"><i class="layui-icon"></i></button></div></td>
<td colspan="3">
<div class="layui-row" id="uploadBox">
<input type="hidden" name="file_ids" data-type="file" value="{$detail.file_ids|default=''}">
{notempty name="$detail.file_array"}
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md4">{:file_card($vo)}</div>
{/volist}
{/notempty}
</div>
</td>
</tr>
</table>
<div class="pt-4">
<input type="hidden" value="{$id}" name="id">
<input type="hidden" value="{$types}" name="types">
<input type="hidden" value="0" name="send">
<button class="layui-btn" lay-submit="" lay-filter="webform1">仅保存</button>
{if ($id == 0) OR ($detail.send_time == 0) }
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">保存并发送</button>
{/if}
</div>
</form>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','oaPicker','uploadPlus'];
function gouguInit() {
var form = layui.form,tool=layui.tool,uploadPlus = layui.uploadPlus;
var attachment = new uploadPlus({
"title":'上传文件',
"target":'uploadBtn',
"targetBox":'uploadBox'
});
//监听发送
form.on('submit(webform)', function(data){
if(data.field.uids==login_admin){
layer.msg('接收人不能是自己');
return false;
}
data.field.send=1;
tool.ask('确定要保存后直接发送该工作汇报吗?', function(index){
$.ajax({
url: "/oa/work/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
return false;
});
//监听保存
form.on('submit(webform1)', function(data){
tool.ask('确定要仅保存该工作汇报吗?', function(index){
$.ajax({
url: "/oa/work/add",
type:'post',
data:data.field,
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
tool.sideClose(1000);
}
}
})
layer.close(index);
});
return false;
});
}
</script>
{/block}
<!-- /脚本 -->
+157
View File
@@ -0,0 +1,157 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-page">
<div class="layui-tab layui-tab-brief border" lay-filter="tab" style="background-color:#fff; margin:0; border-bottom:0">
<ul class="layui-tab-title">
<li class="layui-this"><a href="/oa/work/datalist?send=1">发送的汇报</a></li>
<li><a href="/oa/work/datalist?send=2">接受的汇报</a></li>
</ul>
</div>
<form class="layui-form gg-form-bar border-x" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:180px">
<input type="text" name="diff_time" class="layui-input tool-time" data-range="~" placeholder="选择时间区间" readonly>
</div>
<div class="layui-input-inline" style="width:136px">
<select name="types">
<option value="">选择类型</option>
<option value="1">日报</option>
<option value="2">周报</option>
<option value="3">月报</option>
</select>
</div>
<div class="layui-input-inline" style="width:240px;">
<input type="text" name="keywords" placeholder="输入关键字,工作内容" class="layui-input"/>
</div>
<div class="layui-input-inline" style="width:150px;">
<input type="hidden" name="send" value="1" />
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
</div>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<div class="layui-btn-container">
<button class="layui-btn layui-btn-sm" lay-event="add">
<span>+ 新建汇报</span>
<i class="layui-icon layui-icon-down layui-font-12"></i>
</button>
</div>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">查看</button>
<button class="layui-btn layui-btn-xs" lay-event="edit">编辑</button><button class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del"></button></div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','tablePlus'];
const work_types = [{"id":1,"title":"日报"},{"id":2,"title":"周报"},{"id":3,"title":"月报"}];
function gouguInit() {
var form = layui.form,dropdown = layui.dropdown,table = layui.tablePlus,tool=layui.tool;
layui.pageTable = table.render({
elem: '#test',
toolbar: '#toolbarDemo',
title:'工作汇报列表',
url: "/oa/work/datalist", //数据接口
where:{'send':1},
height: 'full-154',
cellMinWidth: 80, //全局定义常规单元格的最小宽度
cols: [[ //表头
{field:'id',title: '序号',width:80,align:'center'},
{field: 'types', title: '汇报类型',width:80,align:'center',templet:function(d){
var html='';
if(d.types==1){
html = '<span class="green">『日报』</span>';
}
else if(d.types==2){
html = '<span class="blue">『周报』</span>';
}
else if(d.types==3){
html = '<span class="yellow">『月报』</span>';
}
return html;
}},
{field: 'send_time', title: '发送状态',width:80,align:'center',templet:function(d){
var html='';
if(d.send_time==0){
html = '<span class="red">未发送</span>';
}
else{
html = '<span class="green">已发送</span>';
}
return html;
}},
{field: 'to_names', title: '接收人', width:240},
{field: 'works', title: '工作内容'},
{field: 'create_time', title: '汇报周期', align:'center',width:200,templet:function(d){
if(d.types==1){
return d.start_date;
}else{
return d.start_date+' 至 '+d.end_date;
}
}
},
{field: 'create_time', title: '汇报时间', align:'center',width:160},
{field: 'files', title: '附件(个)',align:'center', width:80},
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:120, align:'center'}
]],
});
//监听行工具事件
table.on('tool(test)', function(obj){
var data = obj.data;
if(obj.event === 'edit'){
tool.side('/oa/work/add?id='+data.id);
return;
}
if(obj.event === 'del'){
layer.confirm('确定要删除该汇报吗?', {icon: 3, title:'提示'}, function(index){
$.ajax({
url: "/oa/work/del",
type:'post',
data:{id:data.id},
success:function(e){
layer.msg(e.msg);
if (e.code == 0) {
obj.del();
}
}
})
layer.close(index);
});
}
if(obj.event === 'view'){
tool.side('/oa/work/view?id='+data.id);
return;
}
});
//表头工具栏事件
table.on('toolbar(test)', function(obj){
var checkStatus = table.checkStatus(obj.config.id); //获取选中行状态
var data = checkStatus.data;
var that = this;
if (obj.event === 'add'){
dropdown.render({
elem: that,
show: true, // 外部事件触发即显示
data: work_types,
click: function(obj){
tool.side('/oa/work/add?types='+obj.id);
}
});
return;
}
});
}
</script>
{/block}
<!-- /脚本 -->
+103
View File
@@ -0,0 +1,103 @@
{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-page">
<div class="layui-tab layui-tab-brief border" lay-filter="tab" style="background-color:#fff; margin:0; border-bottom:0">
<ul class="layui-tab-title">
<li><a href="/oa/work/datalist?send=1">发送的汇报</a></li>
<li class="layui-this"><a href="/oa/work/datalist?send=2">接受的汇报</a></li>
</ul>
</div>
<form class="layui-form gg-form-bar border-x" lay-filter="barsearchform">
<div class="layui-input-inline" style="width:180px">
<input type="text" name="diff_time" class="layui-input tool-time" data-range="~" placeholder="选择时间区间" readonly>
</div>
<div class="layui-input-inline" style="width:136px">
<select name="types">
<option value="">选择类型</option>
<option value="1">日报</option>
<option value="2">周报</option>
<option value="3">月报</option>
</select>
</div>
<div class="layui-input-inline" style="width:240px;">
<input type="text" name="keywords" placeholder="输入关键字,工作内容" class="layui-input"/>
</div>
<div class="layui-input-inline" style="width:150px;">
<input type="hidden" name="send" value="2" />
<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="table-search"><i class="layui-icon layui-icon-search mr-1"></i>搜索</button>
<button type="reset" class="layui-btn layui-btn-reset" lay-filter="table-reset">清空</button>
</div>
</form>
<table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="toolbarDemo">
<h3>接受的工作汇报</h3>
</script>
<script type="text/html" id="barDemo">
<div class="layui-btn-group"><button class="layui-btn layui-btn-xs layui-btn-normal" lay-event="view">查看</button></div>
</script>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const moduleInit = ['tool','tablePlus'];
const work_types = [{"id":1,"title":"日报"},{"id":2,"title":"周报"},{"id":3,"title":"月报"}];
function gouguInit() {
var form = layui.form,dropdown = layui.dropdown,table = layui.tablePlus,tool=layui.tool;
layui.pageTable = table.render({
elem: '#test',
toolbar: '#toolbarDemo',
title:'工作汇报列表',
url: "/oa/work/datalist", //数据接口
where:{'send':2},
height: 'full-154',
cellMinWidth: 80, //全局定义常规单元格的最小宽度
cols: [[ //表头
{field:'id',title: '序号',width:80,align:'center'},
{field: 'types', title: '汇报类型',width:80,align:'center',templet:function(d){
var html='';
if(d.types==1){
html = '<span class="green">『日报』</span>';
}
else if(d.types==2){
html = '<span class="blue">『周报』</span>';
}
else if(d.types==3){
html = '<span class="yellow">『月报』</span>';
}
return html;
}},
{field: 'from_name', title: '汇报人', width:100,align:'center'},
{field: 'works', title: '工作内容'},
{field: 'create_time', title: '汇报周期', align:'center',width:200,templet:function(d){
if(d.types==1){
return d.start_date;
}else{
return d.start_date+' 至 '+d.end_date;
}
}
},
{field: 'send_time', title: '汇报时间', align:'center',width:160},
{field: 'files', title: '附件(个)',align:'center', width:80},
{field: 'right', title: '操作',fixed:'right', toolbar: '#barDemo', width:120, align:'center'}
]],
});
//监听行工具事件
table.on('tool(test)', function(obj){
var data = obj.data;
if(obj.event === 'view'){
tool.side('/oa/work/view?id='+data.wid);
return;
}
});
}
</script>
{/block}
<!-- /脚本 -->
+108
View File
@@ -0,0 +1,108 @@
{extend name="../../base/view/common/base" /}
{block name="style"}
<style>
.comment-input .comment-image{width:40px; height:40px; border-radius:50%}
.comment-item .comment-avatar{width:50px; float:left}
.comment-item .comment-image{width:36px; height:36px; border-radius:50%}
.comment-item .comment-body{margin-left:50px;}
.comment-item .comment-content blockquote{border-left:3px solid #f1f1f1; padding:4px 8px;}
.comment-item .comment-actions a{color:#8c95a8; cursor:pointer; font-size:12px;}
.comment-item .comment-actions a:hover{color:#3582fb;}
.comment-meta span{font-size:12px;}
</style>
{/block}
{block name="body"}
<div class="p-4">
<h3 class="pb-1">汇报详情</h3>
<table class="layui-table">
<tr>
<td class="layui-td-gray">汇报人</td>
<td>{$detail.person_name}</td>
<td class="layui-td-gray">汇报类型</td>
<td>
{eq name="$detail.types" value="1"}<span class="green">『日报』</span>{/eq}
{eq name="$detail.types" value="2"}<span class="blue">『周报』</span>{/eq}
{eq name="$detail.types" value="3"}<span class="yellow">『月报』</span>{/eq}
</td>
<td class="layui-td-gray">汇报时间</td>
<td>
{eq name="$detail.send_time" value="0"}
<span class="red">未汇报</span>
{else/}
{$detail.send_time}
{/eq}
</td>
</tr>
<tr>
<td class="layui-td-gray">汇报周期</td>
<td>{$detail.range_date}</td>
<td class="layui-td-gray">接收人</td>
<td colspan="3">{$detail.users}</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">工作内容</td>
<td colspan="5">
{:nl2br($detail.works)}
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">工作计划</td>
<td colspan="5">
{:nl2br($detail.plans)}
</td>
</tr>
<tr>
<td class="layui-td-gray" style="vertical-align:top;">其他事项</td>
<td colspan="5">
{:nl2br($detail.remark)}
</td>
</tr>
{notempty name="$detail.file_array"}
<tr>
<td class="layui-td-gray">相关附件</td>
<td colspan="5">
<div class="layui-row">
{volist name="$detail.file_array" id="vo"}
<div class="layui-col-md4">{:file_card($vo,'view')}</div>
{/volist}
</div>
</td>
</tr>
{/notempty}
{notempty name="$detail.read_users"}
<tr>
<td class="layui-td-gray">已读回执</td>
<td colspan="5" class="yellow">{$detail.read_users}</td>
</tr>
{/notempty}
</table>
{gt name="$detail.update_time" value="0"}
<div style="color:#999; padding:10px 0">该汇报于 {$detail.update_time} 进行过编辑</div>
{/gt}
<div class="p-3 border bg-white">
<h3 class="pb-3">工作点评</h3>
<div class="comment-input">
<input type="text" id="commentInput" readonly placeholder="发表一下你的看法" class="layui-input" value="">
</div>
<div id="commentBox" class="pt-3"></div>
</div>
</div>
{/block}
<!-- /主体 -->
<!-- 脚本 -->
{block name="script"}
<script>
const work_id = {$detail.id};
const moduleInit = ['tool','oaComment'];
function gouguInit() {
var form = layui.form,tool=layui.tool,comment = layui.oaComment;
comment.init({
"box":'commentBox',//容器id
"input": 'commentInput',
"topic_id":work_id,
"module": 'work',
});
}
</script>
{/block}