mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-03 10:21:55 +00:00
perf: 优化仪表盘任务更新规则
This commit is contained in:
parent
a07913181a
commit
440b633bad
12
resources/assets/js/store/actions.js
vendored
12
resources/assets/js/store/actions.js
vendored
@ -1354,9 +1354,9 @@ export default {
|
||||
dispatch("call", {
|
||||
url: 'project/lists',
|
||||
data: callData.get()
|
||||
}).then(({data, xhr}) => {
|
||||
}).then(({data}) => {
|
||||
dispatch("saveProject", data.data);
|
||||
callData.save(data, xhr.timeData.serverDate).then(ids => dispatch("forgetProject", ids))
|
||||
callData.save(data).then(ids => dispatch("forgetProject", ids))
|
||||
state.projectTotal = data.total_all;
|
||||
//
|
||||
resolve(data)
|
||||
@ -1853,12 +1853,12 @@ export default {
|
||||
dispatch("call", {
|
||||
url: 'project/task/lists',
|
||||
data: callData.get()
|
||||
}).then(({data, xhr}) => {
|
||||
}).then(({data}) => {
|
||||
if (requestData.project_id) {
|
||||
state.projectLoad--;
|
||||
}
|
||||
dispatch("saveTask", data.data);
|
||||
callData.save(data, xhr.timeData.serverDate).then(ids => dispatch("forgetTask", ids))
|
||||
callData.save(data).then(ids => dispatch("forgetTask", ids))
|
||||
//
|
||||
if (data.next_page_url) {
|
||||
requestData.page = data.current_page + 1
|
||||
@ -2757,9 +2757,9 @@ export default {
|
||||
dispatch("call", {
|
||||
url: 'dialog/lists',
|
||||
data: callData.get()
|
||||
}).then(({data, xhr}) => {
|
||||
}).then(({data}) => {
|
||||
dispatch("saveDialog", data.data);
|
||||
callData.save(data, xhr.timeData.serverDate).then(ids => dispatch("forgetDialog", ids))
|
||||
callData.save(data).then(ids => dispatch("forgetDialog", ids))
|
||||
//
|
||||
if (data.current_page === 1) {
|
||||
dispatch("getDialogLatestMsgs", data.data.map(({id}) => id))
|
||||
|
||||
6
resources/assets/js/store/utils.js
vendored
6
resources/assets/js/store/utils.js
vendored
@ -14,6 +14,7 @@ function __callData(key, requestData, state) {
|
||||
'timerange',
|
||||
])).toString())
|
||||
const callData = state.callAt.find(item => item.key === callKey) || {}
|
||||
callData.__last = $A.dayjs().unix()
|
||||
if (typeof callData.key === "undefined") {
|
||||
callData.key = callKey
|
||||
callData.updated = 0
|
||||
@ -34,16 +35,15 @@ function __callData(key, requestData, state) {
|
||||
* @param total
|
||||
* @param current_page
|
||||
* @param deleted_id
|
||||
* @param serverDate
|
||||
* @returns {Promise<unknown>}
|
||||
*/
|
||||
this.save = ({total, current_page, deleted_id}, serverDate = undefined) => {
|
||||
this.save = ({total, current_page, deleted_id}) => {
|
||||
return new Promise(async resolve => {
|
||||
if (current_page !== 1) {
|
||||
return
|
||||
}
|
||||
let hasUpdate = false
|
||||
const time = $A.dayjs(serverDate).unix()
|
||||
const time = callData.__last || $A.dayjs().unix()
|
||||
if (total > 0) {
|
||||
callData.updated = time
|
||||
hasUpdate = true
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user