mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-20 15:37:22 +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", {
|
dispatch("call", {
|
||||||
url: 'project/lists',
|
url: 'project/lists',
|
||||||
data: callData.get()
|
data: callData.get()
|
||||||
}).then(({data, xhr}) => {
|
}).then(({data}) => {
|
||||||
dispatch("saveProject", data.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;
|
state.projectTotal = data.total_all;
|
||||||
//
|
//
|
||||||
resolve(data)
|
resolve(data)
|
||||||
@ -1853,12 +1853,12 @@ export default {
|
|||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'project/task/lists',
|
url: 'project/task/lists',
|
||||||
data: callData.get()
|
data: callData.get()
|
||||||
}).then(({data, xhr}) => {
|
}).then(({data}) => {
|
||||||
if (requestData.project_id) {
|
if (requestData.project_id) {
|
||||||
state.projectLoad--;
|
state.projectLoad--;
|
||||||
}
|
}
|
||||||
dispatch("saveTask", data.data);
|
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) {
|
if (data.next_page_url) {
|
||||||
requestData.page = data.current_page + 1
|
requestData.page = data.current_page + 1
|
||||||
@ -2757,9 +2757,9 @@ export default {
|
|||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'dialog/lists',
|
url: 'dialog/lists',
|
||||||
data: callData.get()
|
data: callData.get()
|
||||||
}).then(({data, xhr}) => {
|
}).then(({data}) => {
|
||||||
dispatch("saveDialog", data.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) {
|
if (data.current_page === 1) {
|
||||||
dispatch("getDialogLatestMsgs", data.data.map(({id}) => id))
|
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',
|
'timerange',
|
||||||
])).toString())
|
])).toString())
|
||||||
const callData = state.callAt.find(item => item.key === callKey) || {}
|
const callData = state.callAt.find(item => item.key === callKey) || {}
|
||||||
|
callData.__last = $A.dayjs().unix()
|
||||||
if (typeof callData.key === "undefined") {
|
if (typeof callData.key === "undefined") {
|
||||||
callData.key = callKey
|
callData.key = callKey
|
||||||
callData.updated = 0
|
callData.updated = 0
|
||||||
@ -34,16 +35,15 @@ function __callData(key, requestData, state) {
|
|||||||
* @param total
|
* @param total
|
||||||
* @param current_page
|
* @param current_page
|
||||||
* @param deleted_id
|
* @param deleted_id
|
||||||
* @param serverDate
|
|
||||||
* @returns {Promise<unknown>}
|
* @returns {Promise<unknown>}
|
||||||
*/
|
*/
|
||||||
this.save = ({total, current_page, deleted_id}, serverDate = undefined) => {
|
this.save = ({total, current_page, deleted_id}) => {
|
||||||
return new Promise(async resolve => {
|
return new Promise(async resolve => {
|
||||||
if (current_page !== 1) {
|
if (current_page !== 1) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let hasUpdate = false
|
let hasUpdate = false
|
||||||
const time = $A.dayjs(serverDate).unix()
|
const time = callData.__last || $A.dayjs().unix()
|
||||||
if (total > 0) {
|
if (total > 0) {
|
||||||
callData.updated = time
|
callData.updated = time
|
||||||
hasUpdate = true
|
hasUpdate = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user