优化工作报告

This commit is contained in:
kuaifan 2022-01-21 23:06:50 +08:00
parent 230ff75c0b
commit cc767b164e
13 changed files with 68 additions and 29 deletions

View File

@ -8,7 +8,9 @@ use App\Models\Report;
use App\Models\ReportReceive;
use App\Models\User;
use App\Module\Base;
use App\Tasks\PushTask;
use Carbon\Carbon;
use Hhxsv5\LaravelS\Swoole\Task\Task;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Validation\Rule;
@ -206,6 +208,22 @@ class ReportController extends AbstractController
$report->Receives()->createMany($input["receive_content"]);
}
// 推送消息
$userids = [];
foreach ($input["receive_content"] as $item) {
$userids[] = $item['userid'];
}
if ($userids) {
$params = [
'ignoreFd' => Request::header('fd'),
'userid' => $userids,
'msg' => [
'type' => 'report',
'action' => 'unreadUpdate',
]
];
Task::deliver(new PushTask($params, false));
}
});
return Base::retSuccess('保存成功');
}

View File

@ -1,6 +1,6 @@
{
"name": "DooTask",
"version": "0.6.65",
"version": "0.6.78",
"description": "DooTask is task management system.",
"main": "main.js",
"license": "MIT",

View File

@ -1,6 +1,6 @@
{
"name": "DooTask",
"version": "0.6.65",
"version": "0.6.78",
"description": "DooTask is task management system.",
"scripts": {
"start": "./cmd dev",

2
public/css/app.css vendored

File diff suppressed because one or more lines are too long

2
public/js/app.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -277,8 +277,8 @@ export default {
natificationReady: false,
notificationClass: null,
reportTabs: "my",
reportUnreadNumber: 0,
reportTabs: "my"
}
},
@ -291,9 +291,9 @@ export default {
this.$store.dispatch("getUserInfo").catch(() => {})
this.$store.dispatch("getTaskPriority").catch(() => {})
//
this.getReportUnread(0);
this.notificationInit();
this.onVisibilityChange();
this.getReportUnread(); //
//
this.addTaskSubscribe = Store.subscribe('addTask', this.onAddTask);
this.dialogMsgSubscribe = Store.subscribe('dialogMsgPush', this.addDialogMsg);
@ -336,7 +336,9 @@ export default {
'wsOpenNum',
'themeMode',
'themeList'
'themeList',
'wsMsg'
]),
...mapGetters(['taskData', 'dashboardTask']),
@ -421,13 +423,19 @@ export default {
msgAllUnread() {
if (this.$Electron) {
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal);
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal + this.reportUnreadNumber);
}
},
dashboardTotal() {
if (this.$Electron) {
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal);
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal + this.reportUnreadNumber);
}
},
reportUnreadNumber() {
if (this.$Electron) {
this.$Electron.ipcRenderer.send('setDockBadge', this.msgAllUnread + this.dashboardTotal + this.reportUnreadNumber);
}
},
@ -456,8 +464,23 @@ export default {
this.wsOpenTimeout && clearTimeout(this.wsOpenTimeout)
this.wsOpenTimeout = setTimeout(() => {
this.$store.dispatch("getBasicData")
this.getReportUnread()
}, 5000)
}
},
wsMsg: {
handler(info) {
const {type, action} = info;
switch (type) {
case 'report':
if (action == 'unreadUpdate') {
this.getReportUnread()
}
break;
}
},
deep: true,
},
},
methods: {
@ -683,6 +706,17 @@ export default {
}
},
getReportUnread(timeout) {
this.reportUnreadTimeout && clearTimeout(this.reportUnreadTimeout)
this.reportUnreadTimeout = setTimeout(() => {
this.$store.dispatch("call", {
url: 'report/unread',
}).then(({data}) => {
this.reportUnreadNumber = data.total ? data.total : 0;
}).catch(() => {});
}, typeof timeout === "number" ? timeout : 1000)
},
notificationInit() {
this.notificationClass = new notificationKoro(this.$L("打开通知成功"));
if (this.notificationClass.support) {
@ -743,15 +777,6 @@ export default {
}
document.addEventListener(visibilityChangeEvent, visibilityChangeListener);
},
getReportUnread() {
this.$store.dispatch("call", {
url: 'report/unread',
method: 'get',
}).then(({data}) => {
this.reportUnreadNumber = data.total ? data.total : 0;
}).catch(() => {});
},
}
}
</script>

View File

@ -70,8 +70,9 @@ export default {
sendRead() {
this.$store.dispatch("call", {
url: 'report/read',
data: {ids: [this.data.id]},
method: 'get',
data: {
ids: [this.data.id]
},
}).then(({data, msg}) => {
// data
// msg

View File

@ -174,7 +174,6 @@ export default {
offset: this.reportData.offset,
id: this.id
},
method: 'get',
}).then(({data, msg}) => {
// data
if (data.id) {
@ -217,7 +216,6 @@ export default {
data: {
id: reportId
},
method: 'get',
}).then(({data, msg}) => {
// data
this.reportData.title = data.title;
@ -257,7 +255,6 @@ export default {
this.userInputShow = false;
this.$store.dispatch("call", {
url: 'report/last_submitter',
method: 'get',
}).then(({data, msg}) => {
// data
this.reportData.receive = data;

View File

@ -167,7 +167,6 @@ export default {
created_at: this.createAt,
type: this.reportType
},
method: 'get',
}).then(({data, msg}) => {
// data
this.lists = data.data;

View File

@ -191,7 +191,6 @@ export default {
created_at: this.createAt,
type: this.reportType
},
method: 'get',
}).then(({data, msg}) => {
// data
this.lists = data.data;