mirror of
https://gitee.com/dromara/mayfly-go
synced 2025-11-16 06:10:24 +08:00
feat: 新增sql脚本执行及其他优化
This commit is contained in:
@@ -219,13 +219,31 @@ export default defineComponent({
|
||||
}
|
||||
|
||||
if (script.type == enums.scriptTypeEnum['REAL_TIME'].value) {
|
||||
state.terminalDialog.cmd = script.script;
|
||||
script = script.script
|
||||
if (state.scriptParamsDialog.params) {
|
||||
script = templateResolve(script, state.scriptParamsDialog.params)
|
||||
}
|
||||
state.terminalDialog.cmd = script;
|
||||
state.terminalDialog.visible = true;
|
||||
state.terminalDialog.machineId = props.machineId;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 解析 {{.param}} 形式模板字符串
|
||||
*/
|
||||
function templateResolve(template: string, param: any) {
|
||||
return template.replace(/\{{.\w+\}}/g, (word) => {
|
||||
const key = word.substring(3, word.length - 2);
|
||||
const value = param[key];
|
||||
if (value != null || value != undefined) {
|
||||
return value;
|
||||
}
|
||||
return '';
|
||||
});
|
||||
}
|
||||
|
||||
const closeTermnial = () => {
|
||||
state.terminalDialog.visible = false;
|
||||
state.terminalDialog.machineId = 0;
|
||||
|
||||
Reference in New Issue
Block a user