diff --git a/app/Http/Controllers/Api/SystemController.php b/app/Http/Controllers/Api/SystemController.php index 707338d0e..eb23698be 100755 --- a/app/Http/Controllers/Api/SystemController.php +++ b/app/Http/Controllers/Api/SystemController.php @@ -44,7 +44,7 @@ class SystemController extends AbstractController * @apiParam {String} type * - get: 获取(默认) * - all: 获取所有(需要管理员权限) - * - save: 保存设置(参数:['reg', 'reg_identity', 'reg_invite', 'temp_account_alias', 'login_code', 'password_policy', 'project_invite', 'chat_information', 'anon_message', 'convert_video', 'compress_video', 'e2e_message', 'auto_archived', 'archived_day', 'task_visible', 'task_default_time', 'all_group_mute', 'all_group_autoin', 'user_private_chat_mute', 'user_group_chat_mute', 'system_alias', 'system_welcome', 'image_compress', 'image_quality', 'image_save_local']) + * - save: 保存设置(参数:['reg', 'reg_identity', 'reg_invite', 'temp_account_alias', 'login_code', 'password_policy', 'project_invite', 'chat_information', 'anon_message', 'convert_video', 'compress_video', 'e2e_message', 'auto_archived', 'archived_day', 'task_visible', 'task_default_time', 'task_user_limit', 'all_group_mute', 'all_group_autoin', 'user_private_chat_mute', 'user_group_chat_mute', 'system_alias', 'system_welcome', 'image_compress', 'image_quality', 'image_save_local']) * @apiSuccess {Number} ret 返回状态码(1正确、0错误) * @apiSuccess {String} msg 返回信息(错误描述) @@ -80,6 +80,7 @@ class SystemController extends AbstractController 'archived_day', 'task_visible', 'task_default_time', + 'task_user_limit', 'all_group_mute', 'all_group_autoin', 'user_private_chat_mute', diff --git a/app/Models/ProjectTask.php b/app/Models/ProjectTask.php index b12efb656..b6a08e2df 100644 --- a/app/Models/ProjectTask.php +++ b/app/Models/ProjectTask.php @@ -396,6 +396,7 @@ class ProjectTask extends AbstractModel $userid = User::userid(); $visibility = $data['visibility_appoint'] ?? $data['visibility']; $visibility_userids = $data['visibility_appointor'] ?: []; + $taskUserLimit = intval(Base::settingFind('system', 'task_user_limit')); // if (ProjectTask::whereProjectId($project_id) ->whereNull('project_tasks.complete_at') @@ -455,8 +456,8 @@ class ProjectTask extends AbstractModel if (ProjectTask::authData($uid) ->whereNull('project_tasks.complete_at') ->whereNull('project_tasks.archived_at') - ->count() > 500) { - throw new ApiException(User::userid2nickname($uid) . '负责或参与的未完成任务最多不能超过500个'); + ->count() > $taskUserLimit) { + throw new ApiException(User::userid2nickname($uid) . '负责或参与的未完成任务最多不能超过' . $taskUserLimit . '个'); } $tmpArray[] = $uid; } diff --git a/app/Models/Setting.php b/app/Models/Setting.php index eccf46a69..3c10689d7 100644 --- a/app/Models/Setting.php +++ b/app/Models/Setting.php @@ -55,6 +55,7 @@ class Setting extends AbstractModel $value['image_compress'] = $value['image_compress'] ?: 'open'; $value['image_quality'] = min(100, max(0, intval($value['image_quality']) ?: 90)); $value['image_save_local'] = $value['image_save_local'] ?: 'open'; + $value['task_user_limit'] = min(2000, max(1, intval($value['task_user_limit']) ?: 500)); if (!is_array($value['task_default_time']) || count($value['task_default_time']) != 2 || !Timer::isTime($value['task_default_time'][0]) || !Timer::isTime($value['task_default_time'][1])) { $value['task_default_time'] = ['09:00', '18:00']; } diff --git a/language/original-web.txt b/language/original-web.txt index a8111d789..0e7a169ec 100644 --- a/language/original-web.txt +++ b/language/original-web.txt @@ -1221,6 +1221,8 @@ OKR 结果分析 未完成 AI 机器人 任务相关 +个人任务上限 +负责人或协助人的未完成任务数量上限,最大2000。 请填写名称! 使用代理 支持 http 或 socks 代理 @@ -2271,4 +2273,4 @@ AI 分析已更新 请输入 URL URL不能为空 -仅管理员可使用此功能 \ No newline at end of file +仅管理员可使用此功能 diff --git a/resources/assets/js/functions/common.js b/resources/assets/js/functions/common.js index 38f42b827..fed8ae58d 100755 --- a/resources/assets/js/functions/common.js +++ b/resources/assets/js/functions/common.js @@ -887,6 +887,56 @@ const timezone = require("dayjs/plugin/timezone"); }, 10); }, + /** + * 输入框数字限制 + * @param object + * @param min + * @param max + * @returns + */ + inputNumberLimit(object, min = null, max = null) { + if (object === null || typeof object !== "object") return; + if (object && typeof object.target === "object") { + object = object.target; + } + let eleDom = null; + if (object && typeof object.$el === "object") { + eleDom = object.$el; + } else if (typeof object.length === "number" && object.length > 0) { + eleDom = object[0]; + } else if (object && (object.nodeType === 1 || object.tagName)) { + eleDom = object; + } + if (!eleDom) return; + + let ele = $A(eleDom); + if (ele.length === 0) return; + + if (eleDom.tagName != "INPUT" && eleDom.tagName != "TEXTAREA") { + if (ele.find("input").length === 0) { + ele = ele.find("textarea"); + }else{ + ele = ele.find("input"); + } + } + if (ele.length === 0) return; + eleDom = ele[0]; + + if (eleDom.tagName != "INPUT" && eleDom.tagName != "TEXTAREA") return; + + let val = parseFloat(ele.val()); + if (!isNaN(val)) { + if (min !== null && val < min) { + val = min; + } + if (max !== null && val > max) { + val = max; + } + ele.val(val); + eleDom.dispatchEvent(new Event('input')); + } + }, + /** * iOS上虚拟键盘引起的触控错位 */ diff --git a/resources/assets/js/pages/manage/setting/components/SystemSetting.vue b/resources/assets/js/pages/manage/setting/components/SystemSetting.vue index 38c389066..bfa305c94 100644 --- a/resources/assets/js/pages/manage/setting/components/SystemSetting.vue +++ b/resources/assets/js/pages/manage/setting/components/SystemSetting.vue @@ -124,6 +124,16 @@ :placeholder="$L('请选择提醒时间')" transfer/> + +
+ + + +
+
{{$L('负责人或协助人的未完成任务数量上限,最大2000。')}}
+