From decaabd448af293d33e17a626442a2e9ad613187 Mon Sep 17 00:00:00 2001 From: hawind Date: Sun, 21 Mar 2021 05:07:01 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E7=B3=BB=E7=BB=9F=E9=99=84?= =?UTF-8?q?=E4=BB=B6=E5=AD=97=E6=AE=B5=E9=80=BB=E8=BE=91=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=90=84=E6=A8=A1=E5=9D=97=E9=99=84=E4=BB=B6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Gdoo/Article/views/article/show.blade.php | 2 +- .../Calendar/Controllers/EventController.php | 18 +- app/Gdoo/Calendar/views/event/add.blade.php | 2 +- app/Gdoo/Chat/Controllers/ChatController.php | 5 +- .../File/Controllers/AttachmentController.php | 4 +- .../Controllers/InspectReportController.php | 3 +- .../Controllers/AttachmentController.php | 84 +---- app/Gdoo/Index/Services/AttachmentService.php | 35 +- app/Gdoo/Model/Form.php | 17 +- app/Gdoo/Model/Services/FieldService.php | 238 +++++------- .../Project/Controllers/CommentController.php | 10 + .../Project/Controllers/ProjectController.php | 18 +- .../Project/Controllers/TaskController.php | 57 ++- app/Gdoo/Project/views/comment/add.blade.php | 10 +- app/Gdoo/Project/views/comment/edit.blade.php | 9 +- .../Project/views/project/index.blade.php | 6 +- app/Gdoo/Project/views/project/show.blade.php | 0 app/Gdoo/Project/views/task/add.blade.php | 4 +- app/Gdoo/Project/views/task/edit.blade.php | 19 +- .../Project/views/task/index/gantt.blade.php | 64 +--- .../Project/views/task/index/header.blade.php | 35 ++ .../Project/views/task/index/index.blade.php | 90 ++--- .../Project/views/task/index/js.blade.php | 57 ++- app/Gdoo/Project/views/task/show.blade.php | 106 ------ .../Controllers/MaterialController.php | 2 +- .../System/Controllers/MediaController.php | 30 +- app/Providers/AppServiceProvider.php | 3 + app/Support/Image.php | 2 +- app/Support/helpers.php | 299 +++------------ database/gdoo-2.2.sql | 356 +++++++++--------- public/assets/vendor/webuploader/demo.js | 4 +- resources/views/attachment/add.blade.php | 87 ----- resources/views/attachment/create.blade.php | 36 +- resources/views/attachment/create2.blade.php | 45 --- resources/views/attachment/file.blade.php | 97 ----- resources/views/attachment/image.blade.php | 1 - .../views/attachment/mobile/file.blade.php | 90 ----- resources/views/attachment/qrcode.blade.php | 108 ------ resources/views/attachment/show.blade.php | 44 ++- resources/views/attachment/show2.blade.php | 15 - .../{uploader.blade.php => upload.blade.php} | 4 +- resources/views/attachment/view.blade.php | 23 -- resources/views/headers.blade.php | 28 +- resources/views/searchForm.blade.php | 2 + .../{default.blade.php => gdoo.blade.php} | 0 45 files changed, 656 insertions(+), 1513 deletions(-) delete mode 100644 app/Gdoo/Project/views/project/show.blade.php create mode 100644 app/Gdoo/Project/views/task/index/header.blade.php delete mode 100644 app/Gdoo/Project/views/task/show.blade.php delete mode 100644 resources/views/attachment/add.blade.php delete mode 100644 resources/views/attachment/create2.blade.php delete mode 100644 resources/views/attachment/file.blade.php delete mode 100644 resources/views/attachment/image.blade.php delete mode 100644 resources/views/attachment/mobile/file.blade.php delete mode 100644 resources/views/attachment/qrcode.blade.php delete mode 100644 resources/views/attachment/show2.blade.php rename resources/views/attachment/{uploader.blade.php => upload.blade.php} (87%) delete mode 100644 resources/views/attachment/view.blade.php rename resources/views/vendor/pagination/{default.blade.php => gdoo.blade.php} (100%) diff --git a/app/Gdoo/Article/views/article/show.blade.php b/app/Gdoo/Article/views/article/show.blade.php index d2347767..ab0f58cb 100644 --- a/app/Gdoo/Article/views/article/show.blade.php +++ b/app/Gdoo/Article/views/article/show.blade.php @@ -30,7 +30,7 @@
- @include('attachment/view') + @include('attachment/show')
diff --git a/app/Gdoo/Calendar/Controllers/EventController.php b/app/Gdoo/Calendar/Controllers/EventController.php index 45d99373..29004698 100644 --- a/app/Gdoo/Calendar/Controllers/EventController.php +++ b/app/Gdoo/Calendar/Controllers/EventController.php @@ -285,12 +285,9 @@ class EventController extends DefaultController $repeats['repeat_date'] = ''; $repeats['repeat_year'] = 'bydate'; - $attachment['model'] = 'calendar_attachment'; - $attachment['path'] = 'calendar'; - $attachment['draft'] = AttachmentService::draft(Auth::id()); - + $attachment = AttachmentService::edit('', 'calendar_object', 'attachment', 'calendar'); return $this->render(array( - 'attachList' => $attachment, + 'attachment' => $attachment, 'options' => $options, 'repeats' => $repeats, )); @@ -594,14 +591,10 @@ class EventController extends DefaultController $repeats['repeat_year'] = 'bydate'; } - $attachment['model'] = 'calendar_attachment'; - $attachment['path'] = 'calendar'; - $attachment['draft'] = AttachmentService::draft(Auth::id()); - $attachment['queue'] = AttachmentService::get($event['attachment']); - + $attachment = AttachmentService::edit($event['attachment'], 'calendar_object', 'attachment', 'calendar'); $share = ShareService::getItem('event', $gets['id']); return $this->render(array( - 'attachList' => $attachment, + 'attachment' => $attachment, 'repeats' => $repeats, 'options' => $options, 'share' => $share, @@ -673,7 +666,7 @@ class EventController extends DefaultController $attach['model'] = 'calendar_attachment'; $attach['path'] = 'calendar'; - $attach['main'] = AttachmentService::get($event['attachment']); + $attach['rows'] = AttachmentService::get($event['attachment']); $calendar = CalendarService::getCalendar($event['calendarid'], false); $share = ShareService::getItem('event', $id); @@ -692,6 +685,7 @@ class EventController extends DefaultController if ($id > 0) { CalendarService::remove($id); ShareService::removeItem('event', $id); + return $this->json('删除成功。', true); } } diff --git a/app/Gdoo/Calendar/views/event/add.blade.php b/app/Gdoo/Calendar/views/event/add.blade.php index 1076dd07..94b7845b 100644 --- a/app/Gdoo/Calendar/views/event/add.blade.php +++ b/app/Gdoo/Calendar/views/event/add.blade.php @@ -73,7 +73,7 @@ 附件列表 - @include('attachment/add') + @include('attachment/create') diff --git a/app/Gdoo/Chat/Controllers/ChatController.php b/app/Gdoo/Chat/Controllers/ChatController.php index b8880bee..50cfca49 100644 --- a/app/Gdoo/Chat/Controllers/ChatController.php +++ b/app/Gdoo/Chat/Controllers/ChatController.php @@ -16,6 +16,7 @@ use Gdoo\Chat\Models\Message; use Gdoo\Chat\Services\ChatService; use Gdoo\Index\Controllers\Controller; +use Str; class ChatController extends Controller { @@ -76,10 +77,10 @@ class ChatController extends Controller $upload_path = upload_path().'/'.$path; // 文件新名字 - $filename = date('dhis_').str_random(4).'.'.$extension; + $filename = date('dhis_').Str::random(4).'.'.$extension; $filename = mb_strtolower($filename); - $size = $file->getClientSize(); + $size = $file->getSize(); $name = mb_strtolower($file->getClientOriginalName()); $mime = $file->getMimeType(); diff --git a/app/Gdoo/File/Controllers/AttachmentController.php b/app/Gdoo/File/Controllers/AttachmentController.php index 234a5a5a..459f0b43 100644 --- a/app/Gdoo/File/Controllers/AttachmentController.php +++ b/app/Gdoo/File/Controllers/AttachmentController.php @@ -48,7 +48,7 @@ class AttachmentController extends DefaultController // 扩展名称 $extension = $file->getClientOriginalExtension(); // 附件新名字 - $filename = date('dhis_').str_random(4).'.'.$extension; + $filename = date('dhis_').Str::random(4).'.'.$extension; $filename = mb_strtolower($filename); $uploadSuccess = $file->move($upload_path, $filename); @@ -58,7 +58,7 @@ class AttachmentController extends DefaultController $draft->name = mb_strtolower($file->getClientOriginalName()); $draft->path = $path.'/'.$filename; $draft->type = $extension; - $draft->size = $file->getClientSize(); + $draft->size = $file->getSize(); $draft->save(); return $draft->id; } diff --git a/app/Gdoo/File/Controllers/InspectReportController.php b/app/Gdoo/File/Controllers/InspectReportController.php index 2de7337e..a2353f7e 100644 --- a/app/Gdoo/File/Controllers/InspectReportController.php +++ b/app/Gdoo/File/Controllers/InspectReportController.php @@ -85,6 +85,7 @@ class InspectReportController extends DefaultController // 附件新名字 $filename = date('dhis_').Str::random(4).'.'.$extension; $filename = mb_strtolower($filename); + $filesize = $file->getSize(); $uploadSuccess = $file->move($upload_path, $filename); if ($uploadSuccess) { // 数据库写入 @@ -92,7 +93,7 @@ class InspectReportController extends DefaultController $draft->name = $name; $draft->path = $path.'/'.$filename; $draft->type = $extension; - $draft->size = $file->getClientSize(); + $draft->size = $filesize; $draft->save(); return $this->json('文件上传成功。', true); } diff --git a/app/Gdoo/Index/Controllers/AttachmentController.php b/app/Gdoo/Index/Controllers/AttachmentController.php index a787c346..dbc4d65d 100644 --- a/app/Gdoo/Index/Controllers/AttachmentController.php +++ b/app/Gdoo/Index/Controllers/AttachmentController.php @@ -11,12 +11,22 @@ use URL; class AttachmentController extends DefaultController { - public $permission = ['list','view','preview','create','delete','download','show', 'uploader', 'draft', 'qrcode']; + public $permission = [ + 'list', + 'preview', + 'create', + 'upload', + 'delete', + 'download', + 'show', + 'draft', + 'qrcode' + ]; /** * 上传文件 */ - public function uploader() + public function upload() { if (Request::method() == 'POST') { $file = Request::file('file'); @@ -34,7 +44,8 @@ class AttachmentController extends DefaultController } // 获取上传uri第一个目录 - $key = Request::get('key', 'default'); + $table = Request::get('table'); + $field = Request::get('field'); $node = Request::get('path', 'default'); $path = $node.date('/Ym/'); @@ -43,15 +54,16 @@ class AttachmentController extends DefaultController // 文件新名字 $filename = date('dhis_').Str::random(4).'.'.$extension; $filename = mb_strtolower($filename); + $filesize = $file->getSize(); if ($file->move($upload_path, $filename)) { $data = [ 'name' => mb_strtolower($file->getClientOriginalName()), - 'node' => $node, + 'table' => $table, + 'field' => $field, 'path' => $path.$filename, 'type' => $extension, - 'key' => $key, - 'size' => $file->getClientSize(), + 'size' => $filesize, ]; $insertId = DB::table('attachment')->insertGetId($data); $data['id'] = $insertId; @@ -61,68 +73,12 @@ class AttachmentController extends DefaultController } } $query = Request::all(); - $SERVER_URL = url("index/attachment/uploader", $query); + $SERVER_URL = url("index/attachment/upload", $query); return $this->render([ 'SERVER_URL' => $SERVER_URL, - 'key' => $query['key'], + 'key' => $query['table'].'_'.$query['field'], ]); } - - /** - * 新建文件 - */ - public function create() - { - set_time_limit(0); - - $file = Request::file('Filedata'); - - $rules = [ - 'file' => 'mimes:'.$this->setting['upload_type'], - ]; - $v = Validator::make(['file' => $file], $rules); - - if ($file->isValid() && $v->passes()) { - // 获取上传uri第一个目录 - $path = Request::get('path', 'main').date('/Y/m/'); - - $upload_path = upload_path().'/'.$path; - - // 文件后缀名 - $extension = $file->getClientOriginalExtension(); - - // 文件新名字 - $filename = date('dhis_').Str::random(4).'.'.$extension; - $filename = mb_strtolower($filename); - - if ($file->move($upload_path, $filename)) { - return DB::table('attachment')->insertGetId([ - 'name' => mb_strtolower($file->getClientOriginalName()), - 'path' => $path.$filename, - 'type' => $extension, - 'size' => $file->getClientSize(), - ]); - } - } - return 0; - } - - /** - * 二维码上传 - */ - public function qrcode() - { - $key = Request::get('key'); - $path = Request::get('path'); - list($table, $field) = explode('.', $key); - $model = DB::table('model')->where('table', $table)->first(); - $token = Request::get('x-auth-token'); - return $this->render([ - 'model' => $model, - 'token' => $token, - 'key' => $key, - ], 'attachment.qrcode'); - } /** * 获取文件列表 diff --git a/app/Gdoo/Index/Services/AttachmentService.php b/app/Gdoo/Index/Services/AttachmentService.php index 05c3780a..4c792438 100644 --- a/app/Gdoo/Index/Services/AttachmentService.php +++ b/app/Gdoo/Index/Services/AttachmentService.php @@ -3,6 +3,7 @@ use Request; use DB; use Auth; +use Str; class AttachmentService { @@ -26,15 +27,16 @@ class AttachmentService } // 文件新名字 - $name = date('dhis_').str_random(4).'.'.$extension; + $name = date('dhis_').Str::random(4).'.'.$extension; $name = mb_strtolower($name); + $size = $file->getSize(); if ($file->move($upload_path, $name)) { $res[] = DB::table('attachment')->insertGetId([ 'name' => $name, 'path' => $path.'/'.$name, 'type' => $extension, - 'size' => $file->getClientSize(), + 'size' => $size, 'status' => 1, ]); } @@ -55,7 +57,7 @@ class AttachmentService $res = []; foreach ($images as $image) { - $name = date('dhis_').str_random(4).'.'.$extension; + $name = date('dhis_').Str::random(4).'.'.$extension; $name = mb_strtolower($name); $image = base64_decode(str_replace(' ', '+', $image)); @@ -81,8 +83,7 @@ class AttachmentService if (is_array($ids)) { return $ids; } - $ids = array_filter(explode("\n", $ids)); - + $ids = array_filter(explode(",", $ids)); return (array)$ids; } @@ -91,7 +92,7 @@ class AttachmentService */ public static function get($ids) { - $ids = self::getIds($ids); + $ids = static::getIds($ids); return DB::table('attachment') ->whereIn('id', $ids) ->where('status', 1)->get(); @@ -100,10 +101,13 @@ class AttachmentService /** * 获取当前ID附件和草稿 */ - public static function edit($ids, $key) + public static function edit($ids, $table, $field, $path = 'default') { - $res['rows'] = self::get($ids); - $res['draft'] = self::draft($key); + $res['path'] = $path; + $res['table'] = $table; + $res['field'] = $field; + $res['rows'] = static::get($ids); + $res['draft'] = static::draft($table, $field); return $res; } @@ -112,7 +116,7 @@ class AttachmentService */ public static function show($ids) { - $res['rows'] = self::get($ids); + $res['rows'] = static::get($ids); return $res; } @@ -121,7 +125,7 @@ class AttachmentService */ public static function publish($ids) { - $ids = self::getIds($ids); + $ids = static::getIds($ids); $rows = DB::table('attachment') ->whereIn('id', $ids) ->where('status', 0) @@ -137,9 +141,9 @@ class AttachmentService /** * 发布附件,改成状态为可用 */ - public static function store($key) + public static function store($table, $field) { - $rows = self::draft($key); + $rows = static::draft($table, $field); foreach ($rows as $row) { DB::table('attachment')->where('id', $row['id'])->update([ 'status' => 1, @@ -151,14 +155,15 @@ class AttachmentService /** * 获取草稿文件 */ - public static function draft($key, $user_id = 0) + public static function draft($table, $field, $user_id = 0) { if ($user_id == 0) { $user_id = auth()->id(); } return DB::table('attachment') ->where('created_id', $user_id) - ->where('key', $key) + ->where('table', $table) + ->where('field', $field) ->where('status', '0') ->get(); } diff --git a/app/Gdoo/Model/Form.php b/app/Gdoo/Model/Form.php index 6f451d67..c5ba5d97 100644 --- a/app/Gdoo/Model/Form.php +++ b/app/Gdoo/Model/Form.php @@ -469,10 +469,6 @@ class Form $attribute = []; - if ($action == 'show') { - $field['is_show'] = true; - } - $permission_table = $permission[$flow['table']]; $p = $permission_table[$field['field']]; $field['is_print'] = $action == 'print'; @@ -481,12 +477,13 @@ class Form $field['is_auto'] = $p['m'] == 1 ? 1 : 0; $field['is_hide'] = $p['s'] == 1 ? 1 : $field['is_hide']; - $validate = (array) $p['v']; - - if ($action == 'print') { - $field['is_show'] = true; + if ($action == 'show' || $action == 'print') { + $field['is_show'] = 1; + $field['is_write'] = 0; } + $validate = (array) $p['v']; + if ($action == 'print') { } else { $required = ''; @@ -2000,7 +1997,7 @@ class Form // 权限可写 if ($permission['w'] == 1) { - + // 自定义过滤器 $_field_data = Hook::fire($table.'.onFieldFilter', ['table' => $table, 'master' => $master, 'field' => $field, 'values' => $values]); extract($_field_data); @@ -2033,7 +2030,7 @@ class Form case 'files': $value = (array)$value; $dataFiles = array_merge($dataFiles, $value); - $value = join("\n", $value); + $value = join(",", $value); break; case 'images': $value = join("\n", (array)$value); diff --git a/app/Gdoo/Model/Services/FieldService.php b/app/Gdoo/Model/Services/FieldService.php index b8e7d9b4..2dd8854e 100644 --- a/app/Gdoo/Model/Services/FieldService.php +++ b/app/Gdoo/Model/Services/FieldService.php @@ -1343,6 +1343,38 @@ class FieldService return join(' ', $str); } + public static function content_location($field, $content = '', $row) + { + $field = static::content_field($field); + $setting = $field['setting']; + + $attribute = $field['attribute']; + $id = $attribute['id']; + $name = $attribute['name']; + + $attribute['readonly'] = 'readonly'; + + if ($field['is_show']) { + return ' +
+ '.$content.' +
'; + } else { + $str = ' +
+ +
+
+ + + +
'; + } + return $str; + } + public static function content_image($field, $content = '') { $field = static::content_field($field); @@ -1453,38 +1485,6 @@ class FieldService return $html; } - public static function content_location($field, $content = '', $row) - { - $field = static::content_field($field); - $setting = $field['setting']; - - $attribute = $field['attribute']; - $id = $attribute['id']; - $name = $attribute['name']; - - $attribute['readonly'] = 'readonly'; - - if ($field['is_show']) { - return ' -
- '.$content.' -
'; - } else { - $str = ' -
- -
-
- - - -
'; - } - return $str; - } - public static function content_file($name, $content = '', $field = '') { // 配置 @@ -1502,140 +1502,100 @@ class FieldService { $field = static::content_field($field); $setting = $field['setting']; - $attribute = $field['attribute']; $name = $attribute['name']; - $key = $attribute['key']; + $input_id = $attribute['id']; $config = Setting::where('type', 'system')->pluck('value', 'key'); - $input_id = $attribute['id']; + $attachment = AttachmentService::edit($content, $field['table'], $field['field']); - $attachment = AttachmentService::edit($content, $key); + $str = '
'; - if ($field['is_read'] || $field['is_show']) { - $str = '
'; + if ($field['is_write']) { + $str .= ' 文件上传'; + $str .= '
'; + } - if (count((array)$attachment['rows'])) { - foreach ($attachment['rows'] as $file) { - $str .= '
- '.$file['name'].' - '; - - if (in_array($file['type'], ['pdf'])) { - $str .= '[预览]'; - } elseif (in_array($file['type'], ['jpg','png','gif','bmp'])) { - // $str .= '[预览]'; - $str .= '[预览]'; - } - $str .= '('.human_filesize($file['size']).') '.$file['created_by'].' '; - $str .= '
'; + if (count((array)$attachment['rows'])) { + foreach ($attachment['rows'] as $file) { + $str .= '
+ '.$file['name'].' + '; + + // pdf + if (in_array($file['type'], ['pdf'])) { + $str .= '[预览]'; + } + + // 图片 + if (in_array($file['type'], ['jpg','png','gif','bmp'])) { + $str .= '[预览]'; } + + // 删除 + if ($field['is_write']) { + $str .= ''; + } + + $str .= '('.human_filesize($file['size']).') '.$file['created_by'].' '; + $str .= '
'; } - $str .= '
'; - - $str .= ''; - - return $str; - } else { - //$qrcode = url('index/attachment/qrcode', ['path' => Request::module(), 'key' => $key, 'x-auth-token' => create_token(auth()->id(), 7)]); - $str = ' -
'; - /* - - - */ - $str .= ' 文件上传'; - /* - 扫码上传 - - */ - $str .= '
-
'; - - if (count((array)$attachment['rows'])) { - foreach ($attachment['rows'] as $file) { - $str .= '
- '.$file['name'].' - ('.human_filesize($file['size']).') - - -
-
'; - } - } - - $str .= '
'; + '; + $str .= '
'; if (count($attachment['draft'])) { foreach ($attachment['draft'] as $file) { $str .= '
! '.$file['name'].' - ('.human_filesize($file['size']).') - + ('.human_filesize($file['size']).')'; + + // pdf + if (in_array($file['type'], ['pdf'])) { + $str .= '[预览]'; + } + + // 图片 + if (in_array($file['type'], ['jpg','png','gif','bmp'])) { + $str .= '[预览]'; + } + + $str .= '
'; } } - $str .= '
'; - - /* - $str .= ''; - */ - return $str; + $str .= '
'; } + + $str .= '
'; + return $str; } } diff --git a/app/Gdoo/Project/Controllers/CommentController.php b/app/Gdoo/Project/Controllers/CommentController.php index ef1a7242..59a86480 100644 --- a/app/Gdoo/Project/Controllers/CommentController.php +++ b/app/Gdoo/Project/Controllers/CommentController.php @@ -13,6 +13,7 @@ use Gdoo\Project\Models\Task; use Gdoo\Project\Models\Log; use Gdoo\Index\Controllers\DefaultController; +use Gdoo\Index\Services\AttachmentService; class CommentController extends DefaultController { @@ -43,7 +44,9 @@ class CommentController extends DefaultController $task_id = $request->input('task_id'); + $attachment = AttachmentService::edit('', 'project_task_log', 'attachment', 'project'); return $this->render([ + 'attachment' => $attachment, 'task_id' => $task_id, ]); } @@ -68,7 +71,9 @@ class CommentController extends DefaultController $id = $request->input('id'); $log = Log::find($id); + $attachment = AttachmentService::edit($log['attachment'], 'project_task_log', 'attachment', 'project'); return $this->render([ + 'attachment' => $attachment, 'log' => $log, ]); } @@ -84,8 +89,13 @@ class CommentController extends DefaultController return $this->json('请先选择数据。'); } + $rows = Log::whereIn('id', $id)->get(); Log::whereIn('id', $id)->delete(); + foreach($rows as $row) { + AttachmentService::remove($row['attachment']); + } + return $this->json('恭喜你,删除评论成功。', true); } } diff --git a/app/Gdoo/Project/Controllers/ProjectController.php b/app/Gdoo/Project/Controllers/ProjectController.php index a1e34802..10375891 100644 --- a/app/Gdoo/Project/Controllers/ProjectController.php +++ b/app/Gdoo/Project/Controllers/ProjectController.php @@ -23,8 +23,9 @@ class ProjectController extends DefaultController public function index() { $search = search_form([ + 'advanced' => '', 'referer' => 1, - 'status' => 0 + 'status' => 1 ], [ ['text', 'project.title', '名称'], ['text', 'project.user_id', '拥有者'], @@ -62,25 +63,14 @@ class ProjectController extends DefaultController $rows = $model->paginate()->appends($query); - $tabs = [ - 'name' => 'status', - 'items' => Project::$tabs - ]; - return $this->display([ 'auth_id' => $auth_id, 'rows' => $rows, - 'search' => $search, - 'tabs' => $tabs, + 'query' => $query, + 'search' => $search ]); } - // 项目详情 - public function show(Request $request) - { - return $this->display([]); - } - // 添加项目 public function add(Request $request) { diff --git a/app/Gdoo/Project/Controllers/TaskController.php b/app/Gdoo/Project/Controllers/TaskController.php index 7914bd81..d3fd3988 100644 --- a/app/Gdoo/Project/Controllers/TaskController.php +++ b/app/Gdoo/Project/Controllers/TaskController.php @@ -27,14 +27,29 @@ class TaskController extends DefaultController public function index(Request $request) { $search = search_form([ + 'advanced' => '', 'project_id' => '', - 'tpl' => 'gantt', - 'referer' => '', + 'tpl' => 'index', ], [ - ['text','project_task.name','任务名称'], - ['text','project_task.user_id','执行者'], - ]); + ['form_type' => 'text', 'name' => '任务名称', 'field' => 'project_task.name', 'value' => '', 'options' => []], + ['form_type' => 'text', 'name' => '执行者', 'field' => 'project_task.user_id', 'value' => '', 'options' => []], + ], 'model'); + $header = [ + 'master_name' => '项目任务', + 'simple_search_form' => 1, + 'table' => 'project_task', + 'master_table' => 'project_task', + ]; + + /* + $header['buttons'] = [ + ['name' => '删除', 'icon' => 'fa-remove', 'action' => 'delete', 'display' => $this->access['delete']], + ['name' => '导出', 'icon' => 'fa-share', 'action' => 'export', 'display' => 1], + ]; + */ + + $header['search_form'] = $search; $query = $search['query']; if ($request->ajax() && $request->wantsJson()) { @@ -62,38 +77,14 @@ class TaskController extends DefaultController 'add_task' => $project['user_id'] == $user_id, ]; - // 返回页面 - $referer = session()->get('referer_'.$request->module().'_project_index'); - return $this->display([ + 'header' => $header, 'project' => $project, - 'search' => $search, - 'query' => $query, - 'referer' => $referer, 'permission' => $permission, ], 'index/'.$query['tpl']); } - // 显示任务 - public function show(Request $request) - { - $search = search_form([ - 'project_id' => '' - ], [ - ['text','project.title','任务名称'], - ['text','project.created_at','执行者'], - ]); - - $project_id = $request->input('project_id'); - $project = Project::find($project_id); - - return $this->render([ - 'project' => $project, - 'search' => $search, - ]); - } - // 移动任务 public function drag(Request $request) { @@ -180,8 +171,11 @@ class TaskController extends DefaultController ->get(); $tpl = $type == 'item' ? 'item/add' : 'add'; + + $attachment = AttachmentService::edit('', 'project_task', 'attachment', 'project'); return $this->render([ 'items' => $items, + 'attachment' => $attachment, 'project_id' => $project_id, 'parent_id' => $parent_id, 'type' => $type, @@ -300,12 +294,15 @@ class TaskController extends DefaultController ]; } $tpl = $type == 'item' ? 'item/edit' : 'edit'; + + $attachment = AttachmentService::edit($task['attachment'], 'project_task', 'attachment', 'project'); return $this->render([ 'task' => $task, 'logs' => $logs, 'items' => $items, 'tasks' => $tasks, 'type' => $type, + 'attachment' => $attachment, 'permission' => $permission, ], $tpl); } diff --git a/app/Gdoo/Project/views/comment/add.blade.php b/app/Gdoo/Project/views/comment/add.blade.php index cd39e005..8c382a3b 100644 --- a/app/Gdoo/Project/views/comment/add.blade.php +++ b/app/Gdoo/Project/views/comment/add.blade.php @@ -1,29 +1,21 @@ -
- - - -
- {{attachment_uploader('comment_attachment', $comment['attachment'], 'project_task_log')}} + @include('attachment/create')
- - -
\ No newline at end of file diff --git a/app/Gdoo/Project/views/comment/edit.blade.php b/app/Gdoo/Project/views/comment/edit.blade.php index 9ae66bcb..4f814b02 100644 --- a/app/Gdoo/Project/views/comment/edit.blade.php +++ b/app/Gdoo/Project/views/comment/edit.blade.php @@ -4,26 +4,19 @@
- - - -
- {{attachment_uploader('comment_attachment', $comment['attachment'], 'project_task_log')}} + @include('attachment/create')
- - -
\ No newline at end of file diff --git a/app/Gdoo/Project/views/project/index.blade.php b/app/Gdoo/Project/views/project/index.blade.php index 388146ef..58635fcc 100644 --- a/app/Gdoo/Project/views/project/index.blade.php +++ b/app/Gdoo/Project/views/project/index.blade.php @@ -1,6 +1,6 @@
-
+
@include('project/query')
@@ -16,7 +16,7 @@ @if($row->tasks->count()) {{$row->tasks->count()}} @endif - + {{$row->name}} @@ -48,7 +48,7 @@
- {{$rows->render()}} + {{$rows->links()}}
diff --git a/app/Gdoo/Project/views/project/show.blade.php b/app/Gdoo/Project/views/project/show.blade.php deleted file mode 100644 index e69de29b..00000000 diff --git a/app/Gdoo/Project/views/task/add.blade.php b/app/Gdoo/Project/views/task/add.blade.php index 35eedd71..b38f9be2 100644 --- a/app/Gdoo/Project/views/task/add.blade.php +++ b/app/Gdoo/Project/views/task/add.blade.php @@ -3,8 +3,8 @@
- + @if($type == 'subtask') @endif @@ -72,7 +72,7 @@ 附件 - {{attachment_uploader('attachment', '', 'project_task')}} + @include('attachment/create') diff --git a/app/Gdoo/Project/views/task/edit.blade.php b/app/Gdoo/Project/views/task/edit.blade.php index 45cee2d1..0bb30080 100644 --- a/app/Gdoo/Project/views/task/edit.blade.php +++ b/app/Gdoo/Project/views/task/edit.blade.php @@ -1,11 +1,10 @@
@@ -126,9 +125,9 @@ 附件 @if($permission['attachment']) - {{attachment_uploader('attachment', $task['attachment'], 'project_task')}} + @include('attachment/create') @else - {{attachment_show('attachment', $task['attachment'], 'project_task')}} + @include('attachment/show') @endif @@ -179,10 +178,8 @@
- -
diff --git a/app/Gdoo/Project/views/task/index/gantt.blade.php b/app/Gdoo/Project/views/task/index/gantt.blade.php index a6e9a245..fbf2b010 100644 --- a/app/Gdoo/Project/views/task/index/gantt.blade.php +++ b/app/Gdoo/Project/views/task/index/gantt.blade.php @@ -4,11 +4,9 @@ -
- -
- {{$project['name']}} {{$project['description']}} -
- -
- - -
-
- 列表 - 甘特图 - -
-
- - 返回 - - @if(isset($access['add'])) - - @if($permission['add_item']) - 添加列表 - @endif - - @if($permission['add_task']) - 添加任务 - @endif - - @endif - - @include('searchForm') - - -
+
+ @include('task/index/header')
@@ -163,7 +117,6 @@ var params = {project_id:project_id}; gantt.config.columns = [ {name:"name", label:"任务列表", tree:true, width:'*', resize: true} ]; - gantt.config.scale_unit = 'month'; gantt.config.date_scale = '%Y - %m'; gantt.config.scale_height = 50; @@ -284,7 +237,7 @@ gantt._do_autosize = function() { // 设置高度 var height = $('#gantt-wrapper').outerHeight(); var iframeHeight = $(window).height(); - $('#gantt-view').height(iframeHeight - height - 68 + 'px'); + $('#gantt-view').height(iframeHeight - height - 102 + 'px'); var resize = this._get_resize_options(); var boxSizes = this._get_box_styles(); @@ -308,15 +261,6 @@ gantt._do_autosize = function() { gantt.init("gantt-view"); gantt.load(app.url('project/task/index', params)); -$('#search-submit').on('click', function() { - var query = $('#search-task-form').serializeArray(); - $.map(query, function(row) { - params[row.name] = row.value; - }); - dataReload(); - return false; -}); - function dataReload() { gantt.clearAll(); gantt.load(app.url('project/task/index', params)); diff --git a/app/Gdoo/Project/views/task/index/header.blade.php b/app/Gdoo/Project/views/task/index/header.blade.php new file mode 100644 index 00000000..aa4d1d13 --- /dev/null +++ b/app/Gdoo/Project/views/task/index/header.blade.php @@ -0,0 +1,35 @@ +
+ {{$project['name']}} {{$project['description']}} +
+ +
+
+ +
+ +
+ + @section('left_buttons') + @if(isset($access['add'])) + @if($permission['add_item']) + 添加列表 + @endif + + @if($permission['add_task']) + 添加任务 + @endif + @endif + @endsection + + @include('headers') + +
+
+ \ No newline at end of file diff --git a/app/Gdoo/Project/views/task/index/index.blade.php b/app/Gdoo/Project/views/task/index/index.blade.php index 19873ef6..13e25b13 100644 --- a/app/Gdoo/Project/views/task/index/index.blade.php +++ b/app/Gdoo/Project/views/task/index/index.blade.php @@ -1,40 +1,8 @@ -
- -
- {{$project['name']}} {{$project['description']}} -
- -
-
-
- -
- - 返回 - - @if(isset($access['add'])) - - @if($permission['add_item']) - 添加列表 - @endif - - @if($permission['add_task']) - 添加任务 - @endif - - @endif - - @include('searchForm') -
-
- +
+ @include('task/index/header')
-
diff --git a/app/Gdoo/Project/views/task/index/js.blade.php b/app/Gdoo/Project/views/task/index/js.blade.php index 9782cd0c..f6121621 100644 --- a/app/Gdoo/Project/views/task/index/js.blade.php +++ b/app/Gdoo/Project/views/task/index/js.blade.php @@ -1,4 +1,59 @@ - - - - 文件上传 - 文件大小限制{{$setting['upload_max']}} MB - -
- -
-@if($attachList['queue']) - @foreach($attachList['queue'] as $n => $v) -
- {{$v['title']}} - ({{human_filesize($v['size'])}}) - 插入编辑器 - 删除 - -
- @endforeach -@endif -
- -
-@if($attachList['draft']) - @foreach($attachList['draft'] as $n => $v) -
- ! {{$v['title']}} - ({{human_filesize($v['size'])}}) - 插入编辑器 - 删除 - -
- @endforeach -@endif -
\ No newline at end of file diff --git a/resources/views/attachment/create.blade.php b/resources/views/attachment/create.blade.php index 0ceaae9b..8a2edb68 100644 --- a/resources/views/attachment/create.blade.php +++ b/resources/views/attachment/create.blade.php @@ -1,4 +1,4 @@ - diff --git a/resources/views/attachment/create2.blade.php b/resources/views/attachment/create2.blade.php deleted file mode 100644 index 11846b2d..00000000 --- a/resources/views/attachment/create2.blade.php +++ /dev/null @@ -1,45 +0,0 @@ - - -
- - 附件 -
- -
- - @if($attachments['rows']) - @foreach($attachments['rows'] as $n => $file) -
- {{$file['name']}} - ({{human_filesize($file['size'])}}) - - -
-
- @endforeach - @endif - -
- -
- @if($attachments['draft']) - @foreach($attachments['draft'] as $n => $file) -
- ! {{$file['name']}} - ({{human_filesize($file['size'])}}) - - -
-
- @endforeach - @endif -
-
diff --git a/resources/views/attachment/file.blade.php b/resources/views/attachment/file.blade.php deleted file mode 100644 index 25f2d4f0..00000000 --- a/resources/views/attachment/file.blade.php +++ /dev/null @@ -1,97 +0,0 @@ - - - - -@if($attach['auth']['add'] == true) - - 文件上传 -  文件大小限制{{$setting['upload_max']}} MB - - -@endif - -
-@if($attach['queue']) - @if($attach['queue']) - @foreach($attach['queue'] as $v) -
- {{$v['title']}} - ( - 上传者: {{get_user($v['add_user_id'], 'name')}} -  上传时间: @datetime($v['add_time']) -  大小: {{human_filesize($v['size'])}} - ) - - @if($attach['auth']['add'] == true) - 删除 - @endif - - -
- @endforeach - @endif -@endif -
- -
- @if($attach['draft']) - @foreach($attach['draft'] as $k => $v) -
- ! {{$v['title']}} - ( -  上传者: {{get_user($v['add_user_id'], 'name')}} -  上传时间: @datetime($v['add_time']) -  大小: {{human_filesize($v['size'])}} - ) - - @if($attach['auth']['add'] == true) - 删除 - @endif - - -
- @endforeach - @endif -
diff --git a/resources/views/attachment/image.blade.php b/resources/views/attachment/image.blade.php deleted file mode 100644 index fd8e8fb2..00000000 --- a/resources/views/attachment/image.blade.php +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/resources/views/attachment/mobile/file.blade.php b/resources/views/attachment/mobile/file.blade.php deleted file mode 100644 index 568600dc..00000000 --- a/resources/views/attachment/mobile/file.blade.php +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - -@if($attach['auth']['add'] == true) - 文件上传 -  文件大小限制{{$setting['upload_max']}} MB -@endif - -
-@if($attach['queue']) - @if($attach['queue']) - @foreach($attach['queue'] as $v) -
- {{$v['title']}} - ( - 上传者: {{get_user($v['add_user_id'], 'name')}} -  上传时间: @datetime($v['add_time']) -  大小: {{human_filesize($v['size'])}} - ) - - @if($attach['auth']['add'] == true) - 删除 - @endif - - -
- @endforeach - @endif -@endif -
-
- @if($attach['draft']) - @foreach($attach['draft'] as $k => $v) -
- ! {{$v['title']}} ({{human_filesize($v['size'])}}) - - {{get_user($v['add_user_id'], 'name')}} - @datetime($v['add_time']) - - @if($attach['auth']['add'] == true) - 删除 - @endif - - -
- @endforeach - @endif -
diff --git a/resources/views/attachment/qrcode.blade.php b/resources/views/attachment/qrcode.blade.php deleted file mode 100644 index 7cb066b2..00000000 --- a/resources/views/attachment/qrcode.blade.php +++ /dev/null @@ -1,108 +0,0 @@ - - - - - {{$setting['title']}} - - - - - - - -
- -
- -
-
- 单据名称 - -
- -
- 文件名称 - -
- -
- 扫一扫 - - - -
- - -
- - - diff --git a/resources/views/attachment/show.blade.php b/resources/views/attachment/show.blade.php index 9254a245..a80feba8 100644 --- a/resources/views/attachment/show.blade.php +++ b/resources/views/attachment/show.blade.php @@ -1,19 +1,35 @@
-
- - @if(count($attachments['main'])) - @foreach($attachments['main'] as $n => $file) -
- {{$file['name']}} - ({{human_filesize($file['size'])}}) - - -
-
- @endforeach + @if($attachment['rows']) + @foreach($attachment['rows'] as $n => $file) +
+ {{$file['name']}} + ({{human_filesize($file['size'])}}) + + @if(in_array($file['type'], ['pdf'])) + [预览] + @endif + + @if(in_array($file['type'], ['jpg','png','gif','bmp'])) + [预览] + @endif + +
+
+ @endforeach @endif -
-
+ \ No newline at end of file diff --git a/resources/views/attachment/show2.blade.php b/resources/views/attachment/show2.blade.php deleted file mode 100644 index 44cb5424..00000000 --- a/resources/views/attachment/show2.blade.php +++ /dev/null @@ -1,15 +0,0 @@ -
-
- @if($attachments['main']) - @foreach($attachments['main'] as $n => $file) -
- {{$file['name']}} - ({{human_filesize($file['size'])}}) - - -
-
- @endforeach - @endif -
-
diff --git a/resources/views/attachment/uploader.blade.php b/resources/views/attachment/upload.blade.php similarity index 87% rename from resources/views/attachment/uploader.blade.php rename to resources/views/attachment/upload.blade.php index 99a1cd5a..77403405 100644 --- a/resources/views/attachment/uploader.blade.php +++ b/resources/views/attachment/upload.blade.php @@ -20,8 +20,8 @@
diff --git a/resources/views/attachment/view.blade.php b/resources/views/attachment/view.blade.php deleted file mode 100644 index 141ed10c..00000000 --- a/resources/views/attachment/view.blade.php +++ /dev/null @@ -1,23 +0,0 @@ - - 附件 {{count($attachment['rows'])}} - - -
- @foreach($attachment['rows'] as $row) -
- - {{$row['name']}} - -  ({{human_filesize($row['size'])}}) -   - @if(in_array(strtolower($row['type']), ['pdf'])) - 预览 - @elseif(in_array(strtolower($row['type']), ['jpg','png','gif','bmp'])) - 预览 - @else - 下载 - @endif -
-
- @endforeach -
新建 @endif - + + @yield('left_buttons') + {{:$button_count = 0}} @foreach($header['buttons'] as $button) @if($button['display']) @@ -62,10 +64,6 @@
  • @else @if($button['display']) - - @if($header['exist_sub_table'] == 1 && $button['action'] == 'delete') - - @endif
  • {{$button['name']}}
  • @endif @endif @@ -110,13 +108,6 @@
    - @else 筛选 @@ -147,11 +138,6 @@
  • {{$item['name']}}
  • @endif @endforeach -
    @endif @@ -195,14 +181,6 @@ @endforeach
    - - \ No newline at end of file diff --git a/resources/views/searchForm.blade.php b/resources/views/searchForm.blade.php index aaa11bfa..b5005f69 100644 --- a/resources/views/searchForm.blade.php +++ b/resources/views/searchForm.blade.php @@ -63,6 +63,7 @@
    + @if(is_numeric($search['query']['advanced']))
    diff --git a/resources/views/vendor/pagination/default.blade.php b/resources/views/vendor/pagination/gdoo.blade.php similarity index 100% rename from resources/views/vendor/pagination/default.blade.php rename to resources/views/vendor/pagination/gdoo.blade.php