Skip to content

Commit 09b027f

Browse files
committed
feat: task request cancel, input inline editor on-change-callback
1 parent 2f6062f commit 09b027f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/components/common/InputInlineEditor.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {nextTick, ref} from "vue";
33
44
const props = defineProps<{
55
value: string | null | undefined;
6-
onChange?: (value: string) => Promise<boolean>;
6+
onChangeCallback?: (value: string) => Promise<boolean>;
77
}>();
88
const emit = defineEmits({
99
change: (value: string) => true,
@@ -21,8 +21,8 @@ const doEnter = () => {
2121
});
2222
};
2323
const doConfirm = () => {
24-
if (props.onChange) {
25-
props.onChange(valueEdit.value).then((ok) => {
24+
if (props.onChangeCallback) {
25+
props.onChangeCallback(valueEdit.value).then((ok) => {
2626
if (ok) {
2727
visible.value = false;
2828
emit("change", valueEdit.value);

src/store/modules/task.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ export type TaskBiz = {
6565
successFunc: (bizId: string, bizParam: any) => Promise<void>;
6666
// Make sure the "failFunc" function always not throw an error
6767
failFunc: (bizId: string, msg: string, bizParam: any) => Promise<void>;
68+
// request cancel callback, when user request cancel a task, will call this function
69+
requestCancelFunc?: (bizId: string, bizParam: any) => Promise<void>;
6870
// ----------------------------------------------------
6971
// the following not use in schedule, only for biz
7072
[key: string]: any;
@@ -353,6 +355,11 @@ export const taskStore = defineStore("task", {
353355
expire: TimeUtil.timestampMS() + 60 * 60 * 1000,
354356
};
355357
this.fireChange({biz, bizId}, 'requestCancel')
358+
if (this.bizMap[biz]?.requestCancelFunc) {
359+
this.bizMap[biz]?.requestCancelFunc?.(bizId, {}).catch(e => {
360+
$mapi.log.error("Task.RequestCancelFunc.Error", e.toString()).then();
361+
});
362+
}
356363
},
357364
shouldCancel(biz: string, bizId: string) {
358365
// expire old

0 commit comments

Comments
 (0)