新增quickcommand.showLoadingBar,支持显示加载条

This commit is contained in:
fofolee
2025-02-17 22:38:19 +08:00
parent d7508c36a7
commit 3eca3b448e
14 changed files with 339 additions and 84 deletions

View File

@@ -126,7 +126,6 @@ export default {
if (command.program === "quickcomposer") {
command.cmd = generateFlowsCode(command.flows);
}
this.$root.isRunningCommand = true;
this.needTempPayload && (await this.getTempPayload(command));
// 如果命令包含子输入框,则设置子输入框
if (command.cmd.includes("{{subinput")) return this.setSubInput(command);
@@ -292,7 +291,6 @@ export default {
};
},
handleResult(stdout, stderr, options) {
this.$root.isRunningCommand = false;
if (stderr) {
return options.earlyExit
? alert(stderr)
@@ -302,7 +300,6 @@ export default {
},
// 显示运行结果
async showRunResult(content, isSuccess) {
this.$root.isRunningCommand = false;
content = await this.handleContent(content);
this.runResultStatus = isSuccess;
this.runResult = this.runResult.concat(content);

View File

@@ -17,9 +17,6 @@
/>
</div>
</div>
<q-inner-loading :showing="hasCommandNeedLoading && $root.isRunningCommand">
<q-spinner-cube size="50px" color="primary" />
</q-inner-loading>
</div>
</template>
@@ -38,7 +35,6 @@ export default defineComponent({
data() {
return {
availableCommands,
hasCommandNeedLoading: false,
};
},
props: {
@@ -57,16 +53,6 @@ export default defineComponent({
// 直接转发事件和代码
this.$emit("action", actionType, actionData);
},
findCommandNeedLoading(flow) {
// 暂时只在运行单独命令时显示载入界面,因为运行整个命令流时,如果不打印输出,是无法判断什么时候运行结束的,
// 运行单独命令时添加了打印流程且showLoading参数可控
if (!flow) return;
return flow.some(
(cmd) =>
cmd.showLoading ||
cmd.subCommands?.find((c) => c.value === cmd.value)?.showLoading
);
},
},
});
</script>