mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-10 09:52:53 +00:00
feat: 添加个人任务上限设置,限制负责人或协助人的未完成任务数量
This commit is contained in:
parent
6a7cc95b23
commit
f0e844c308
@ -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',
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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'];
|
||||
}
|
||||
|
||||
@ -1221,6 +1221,8 @@ OKR 结果分析
|
||||
未完成
|
||||
AI 机器人
|
||||
任务相关
|
||||
个人任务上限
|
||||
负责人或协助人的未完成任务数量上限,最大2000。
|
||||
请填写名称!
|
||||
使用代理
|
||||
支持 http 或 socks 代理
|
||||
@ -2271,4 +2273,4 @@ AI 分析已更新
|
||||
|
||||
请输入 URL
|
||||
URL不能为空
|
||||
仅管理员可使用此功能
|
||||
仅管理员可使用此功能
|
||||
|
||||
50
resources/assets/js/functions/common.js
vendored
50
resources/assets/js/functions/common.js
vendored
@ -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上虚拟键盘引起的触控错位
|
||||
*/
|
||||
|
||||
@ -124,6 +124,16 @@
|
||||
:placeholder="$L('请选择提醒时间')"
|
||||
transfer/>
|
||||
</FormItem>
|
||||
<FormItem :label="$L('个人任务上限')" prop="taskUserLimit">
|
||||
<div style="width: 110px;">
|
||||
<Input type="number" number v-model="formDatum.task_user_limit" @on-keyup="$A.inputNumberLimit($event, 1, 2000)">
|
||||
<template #append>
|
||||
<span>{{$L('个')}}</span>
|
||||
</template>
|
||||
</Input>
|
||||
</div>
|
||||
<div class="form-tip">{{$L('负责人或协助人的未完成任务数量上限,最大2000。')}}</div>
|
||||
</FormItem>
|
||||
</div>
|
||||
</div>
|
||||
<div class="block-setting-box">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user