From 6aadef58bf7f84fbbb3ee9ab1a53fa6850a69a75 Mon Sep 17 00:00:00 2001 From: cxx Date: Tue, 21 May 2024 13:40:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=84=E8=AE=BA=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/public/lib/dayjs/relativeTime.js | 1 + app/service/task.js | 30 +++++ app/view/component/taskCommentList.html | 155 ++++++++++++++++++++++ app/view/component/workflowBasicInfo.html | 20 +-- app/view/page/approvalManagement.html | 50 ++++++- app/view/page/taskManagement.html | 48 +++++++ 6 files changed, 293 insertions(+), 11 deletions(-) create mode 100644 app/public/lib/dayjs/relativeTime.js create mode 100644 app/view/component/taskCommentList.html diff --git a/app/public/lib/dayjs/relativeTime.js b/app/public/lib/dayjs/relativeTime.js new file mode 100644 index 0000000..0ddc536 --- /dev/null +++ b/app/public/lib/dayjs/relativeTime.js @@ -0,0 +1 @@ +!function(r,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):r.dayjs_plugin_relativeTime=t()}(this,function(){"use strict";return function(r,t,e){var n=t.prototype;e.en.relativeTime={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};var o=function(r,t,n,o){for(var d,i,u=n.$locale().relativeTime,a=[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],f=a.length,s=0;s0&&(l=a[s-1]),i=u[l.l].replace("%d",h);break}}return t?i:(d>0?u.future:u.past).replace("%s",i)};n.to=function(r,t){return o(r,t,this,!0)},n.from=function(r,t){return o(r,t,this)};var d=function(r){return r.$u?e.utc():e()};n.toNow=function(r){return this.to(d(this),r)},n.fromNow=function(r){return this.from(d(this),r)}}}); \ No newline at end of file diff --git a/app/service/task.js b/app/service/task.js index cea54dd..fa99fea 100644 --- a/app/service/task.js +++ b/app/service/task.js @@ -599,6 +599,36 @@ class TaskService extends Service { throw new Error("审批信息已更新,请重新刷新页面!") } } + + async updateComment() { + const { jianghuKnex } = this.app; + const { userId, username } = this.ctx.userInfo; + const { actionData, where } = this.ctx.request.body.appData; + const { taskCommentList, taskInitUser, taskEditUserList } = actionData; + + const noticeInsertData = [] + var noticeUser = taskEditUserList && taskEditUserList.split(',') || [] + // 如果是审批单申请人添加的备注,就只给当前审批人发送(已经通过审批人的不会收到提醒); + // 如果是已经审批了的审批人添加的备注,就给其他当前节点未审批的审批人和申请人发送消息提醒。 + if (userId !== taskInitUser) { + noticeUser.push(taskInitUser) + } + + noticeInsertData.push({ + noticeId: await idGenerateUtil.uuid(), + noticeName: "通知-审批-" + where.taskId, + noticeContent: _.uniq(noticeUser).join(','), + pushContent: '{}', + pushStatus: "success", + pushAt: dayjs().format("YYYY-MM-DD HH:mm:ss") + }) + + await jianghuKnex.transaction(async trx => { + await trx("task", this.ctx).where(where).jhUpdate({ taskCommentList: JSON.stringify(taskCommentList) }); + if (noticeInsertData.length > 0) await trx("notice_push", this.ctx).jhInsert(noticeInsertData); + }) + + } } module.exports = TaskService; diff --git a/app/view/component/taskCommentList.html b/app/view/component/taskCommentList.html new file mode 100644 index 0000000..c0f7c95 --- /dev/null +++ b/app/view/component/taskCommentList.html @@ -0,0 +1,155 @@ + + + + + \ No newline at end of file diff --git a/app/view/component/workflowBasicInfo.html b/app/view/component/workflowBasicInfo.html index efefa8a..17d637c 100644 --- a/app/view/component/workflowBasicInfo.html +++ b/app/view/component/workflowBasicInfo.html @@ -103,18 +103,18 @@ 若指定成员也异常,将自动通过 - + diff --git a/app/view/page/approvalManagement.html b/app/view/page/approvalManagement.html index e3b1422..d7dc73e 100644 --- a/app/view/page/approvalManagement.html +++ b/app/view/page/approvalManagement.html @@ -159,6 +159,31 @@ + + + +
+ 评论列表 + + + 如果是审批单申请人添加的备注,就只给当前审批人发送(已经通过审批人的不会收到提醒); + 如果是已经审批了的审批人添加的备注,就给其他当前节点未审批的审批人和申请人发送消息提醒。 + +
+ +
+
+ @@ -201,6 +226,8 @@ {% include 'component/tpl/formComponentList.html' %} {% include 'component/taskHistory.html' %} {% include 'common/jianghuJs/fixedTableHeightV4.html' %} +{% include 'component/taskCommentList.html' %} + diff --git a/app/view/page/taskManagement.html b/app/view/page/taskManagement.html index 2ce7172..3025a19 100644 --- a/app/view/page/taskManagement.html +++ b/app/view/page/taskManagement.html @@ -122,6 +122,31 @@ + + + +
+ 评论列表 + + + 如果是审批单申请人添加的备注,就只给当前审批人发送(已经通过审批人的不会收到提醒); + 如果是已经审批了的审批人添加的备注,就给其他当前节点未审批的审批人和申请人发送消息提醒。 + +
+ +
+
+ @@ -163,6 +188,8 @@ {% include 'component/tpl/formComponentList.html' %} {% include 'component/taskHistory.html' %} {% include 'common/jianghuJs/fixedTableHeightV4.html' %} +{% include 'component/taskCommentList.html' %} +