mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-04 21:08:30 +08:00
替换 this.$nextTick nextTick
This commit is contained in:
parent
b917e9d30d
commit
f1aef8986f
@ -6,13 +6,29 @@
|
||||
<a-space class="tool-bar-end">
|
||||
<div>
|
||||
皮肤:
|
||||
<a-select v-model="cmOptions.theme" @select="handleSelectTheme" show-search option-filter-prop="children" :filter-option="filterOption" placeholder="请选择皮肤" style="width: 150px">
|
||||
<a-select
|
||||
v-model="cmOptions.theme"
|
||||
@select="handleSelectTheme"
|
||||
show-search
|
||||
option-filter-prop="children"
|
||||
:filter-option="filterOption"
|
||||
placeholder="请选择皮肤"
|
||||
style="width: 150px"
|
||||
>
|
||||
<a-select-option v-for="item in cmThemeOptions" :key="item">{{ item }}</a-select-option>
|
||||
</a-select>
|
||||
</div>
|
||||
<div>
|
||||
语言:
|
||||
<a-select v-model="cmOptions.mode" @select="handleSelectMode" show-search option-filter-prop="children" :filter-option="filterOption" placeholder="请选择语言模式" style="width: 150px">
|
||||
<a-select
|
||||
v-model="cmOptions.mode"
|
||||
@select="handleSelectMode"
|
||||
show-search
|
||||
option-filter-prop="children"
|
||||
:filter-option="filterOption"
|
||||
placeholder="请选择语言模式"
|
||||
style="width: 150px"
|
||||
>
|
||||
<a-select-option value="">请选择语言模式</a-select-option>
|
||||
<a-select-option v-for="item in cmEditorModeOptions" :key="item">{{ item }}</a-select-option>
|
||||
</a-select>
|
||||
@ -26,7 +42,9 @@
|
||||
<li>Shift-Ctrl-G / Shift-Cmd-G Find previous</li>
|
||||
<li>Shift-Ctrl-F / Cmd-Option-F Replace</li>
|
||||
<li>Shift-Ctrl-R / Shift-Cmd-Option-F Replace all</li>
|
||||
<li>Alt-F Persistent search (dialog doesn't autoclose, enter to find next, Shift-Enter to find previous)</li>
|
||||
<li>
|
||||
Alt-F Persistent search (dialog doesn't autoclose, enter to find next, Shift-Enter to find previous)
|
||||
</li>
|
||||
<li>Alt-G Jump to line</li>
|
||||
</ul>
|
||||
</template>
|
||||
@ -51,7 +69,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Codemirror } from "vue-codemirror";
|
||||
import { Codemirror } from 'vue-codemirror'
|
||||
// import "codemirror/lib/codemirror.css";
|
||||
|
||||
// import "codemirror/theme/blackboard.css";
|
||||
@ -97,7 +115,7 @@ import { Codemirror } from "vue-codemirror";
|
||||
|
||||
// window.JSHINT = JSHINT;
|
||||
|
||||
const requireAll = (requireContext) => requireContext.keys().map(requireContext);
|
||||
const requireAll = (requireContext) => requireContext.keys().map(requireContext)
|
||||
|
||||
// 引入支持的语法
|
||||
// const reqMode = require.context("codemirror/mode/", true, /\.js$/);
|
||||
@ -106,7 +124,7 @@ const requireAll = (requireContext) => requireContext.keys().map(requireContext)
|
||||
// return item.split("/")[1];
|
||||
// });
|
||||
// modeList.unshift("json");
|
||||
const modeList = [];
|
||||
const modeList = []
|
||||
|
||||
// // 引入支持的皮肤
|
||||
// const reqTheme = require.context("codemirror/theme/", false, /\.css$/);
|
||||
@ -114,73 +132,73 @@ const modeList = [];
|
||||
// const themeList = reqTheme.keys().map((item) => {
|
||||
// return item.substring(2, item.length - 4);
|
||||
// });
|
||||
const themeList = [];
|
||||
const themeList = []
|
||||
|
||||
// 文件后缀与语言对应表
|
||||
const fileSuffixToModeMap = {
|
||||
html: "htmlmixed",
|
||||
css: "css",
|
||||
yml: "yaml",
|
||||
yaml: "yaml",
|
||||
json: "json",
|
||||
sh: "shell",
|
||||
bat: "powershell",
|
||||
vue: "vue",
|
||||
xml: "xml",
|
||||
sql: "sql",
|
||||
py: "python",
|
||||
php: "php",
|
||||
md: "markdown",
|
||||
dockerfile: "dockerfile",
|
||||
properties: "properties",
|
||||
lua: "lua",
|
||||
go: "go",
|
||||
};
|
||||
html: 'htmlmixed',
|
||||
css: 'css',
|
||||
yml: 'yaml',
|
||||
yaml: 'yaml',
|
||||
json: 'json',
|
||||
sh: 'shell',
|
||||
bat: 'powershell',
|
||||
vue: 'vue',
|
||||
xml: 'xml',
|
||||
sql: 'sql',
|
||||
py: 'python',
|
||||
php: 'php',
|
||||
md: 'markdown',
|
||||
dockerfile: 'dockerfile',
|
||||
properties: 'properties',
|
||||
lua: 'lua',
|
||||
go: 'go'
|
||||
}
|
||||
|
||||
export default {
|
||||
name: "CodeEditor",
|
||||
name: 'CodeEditor',
|
||||
components: {
|
||||
Codemirror,
|
||||
Codemirror
|
||||
},
|
||||
model: {
|
||||
prop: "code",
|
||||
event: "input",
|
||||
prop: 'code',
|
||||
event: 'input'
|
||||
},
|
||||
props: {
|
||||
cmHintOptions: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
return {}
|
||||
}
|
||||
},
|
||||
code: {
|
||||
type: String,
|
||||
default: "",
|
||||
default: ''
|
||||
},
|
||||
options: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
},
|
||||
return {}
|
||||
}
|
||||
},
|
||||
fileSuffix: {
|
||||
type: String,
|
||||
type: String
|
||||
},
|
||||
showTool: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
default: false
|
||||
}
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
codeMirrorHeight: "100%",
|
||||
codeMirrorHeight: '100%',
|
||||
editorValue: this.code,
|
||||
cmThemeOptions: themeList,
|
||||
cmEditorModeOptions: modeList,
|
||||
cmOptions: {
|
||||
theme: localStorage.getItem("editorTheme") || "idea",
|
||||
mode: "",
|
||||
theme: localStorage.getItem('editorTheme') || 'idea',
|
||||
mode: '',
|
||||
// // 是否应滚动或换行以显示长行
|
||||
lineWrapping: true,
|
||||
lineNumbers: true,
|
||||
@ -197,19 +215,19 @@ export default {
|
||||
viewportMargin: 10,
|
||||
hintOptions: this.cmHintOptions || {},
|
||||
extraKeys: {
|
||||
"Alt-Q": "autocomplete",
|
||||
"Ctrl-Alt-L": () => {
|
||||
'Alt-Q': 'autocomplete',
|
||||
'Ctrl-Alt-L': () => {
|
||||
try {
|
||||
if (this.cmOptions.mode == "json" && this.editorValue) {
|
||||
this.editorValue = this.formatStrInJson(this.editorValue);
|
||||
if (this.cmOptions.mode == 'json' && this.editorValue) {
|
||||
this.editorValue = this.formatStrInJson(this.editorValue)
|
||||
}
|
||||
} catch (e) {
|
||||
$message.error("格式化代码出错:" + e.toString());
|
||||
$message.error('格式化代码出错:' + e.toString())
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
lint: { esversion: "8" },
|
||||
gutters: ["CodeMirror-lint-markers", "CodeMirror-linenumbers", "CodeMirror-foldgutter"],
|
||||
lint: { esversion: '8' },
|
||||
gutters: ['CodeMirror-lint-markers', 'CodeMirror-linenumbers', 'CodeMirror-foldgutter'],
|
||||
foldGutter: true,
|
||||
autoCloseBrackets: true,
|
||||
autoCloseTags: true,
|
||||
@ -219,95 +237,95 @@ export default {
|
||||
autoRefresh: true,
|
||||
highlightSelectionMatches: {
|
||||
minChars: 2,
|
||||
style: "matchhighlight",
|
||||
showToken: true,
|
||||
style: 'matchhighlight',
|
||||
showToken: true
|
||||
},
|
||||
styleSelectedText: true,
|
||||
enableAutoFormatJson: true,
|
||||
defaultJsonIndentation: 2,
|
||||
},
|
||||
};
|
||||
defaultJsonIndentation: 2
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
myCodemirror() {
|
||||
return this.$refs.myCm.codemirror;
|
||||
return this.$refs.myCm.codemirror
|
||||
},
|
||||
inCode: {
|
||||
get() {
|
||||
return this.code;
|
||||
return this.code
|
||||
},
|
||||
set() {},
|
||||
},
|
||||
set() {}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
fileSuffix: {
|
||||
handler(v) {
|
||||
if (!v) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
if (v.indexOf(".") > -1) {
|
||||
const textArr = v.split(".");
|
||||
const suffix = textArr.length ? textArr[textArr.length - 1] : v;
|
||||
const newMode = fileSuffixToModeMap[suffix];
|
||||
if (v.indexOf('.') > -1) {
|
||||
const textArr = v.split('.')
|
||||
const suffix = textArr.length ? textArr[textArr.length - 1] : v
|
||||
const newMode = fileSuffixToModeMap[suffix]
|
||||
if (newMode) {
|
||||
this.cmOptions = { ...this.cmOptions, mode: newMode };
|
||||
this.cmOptions = { ...this.cmOptions, mode: newMode }
|
||||
}
|
||||
} else {
|
||||
const v2 = v.toLowerCase();
|
||||
const v2 = v.toLowerCase()
|
||||
for (let key in fileSuffixToModeMap) {
|
||||
if (v2.endsWith(key)) {
|
||||
const newMode = fileSuffixToModeMap[key];
|
||||
const newMode = fileSuffixToModeMap[key]
|
||||
if (newMode) {
|
||||
this.cmOptions = { ...this.cmOptions, mode: newMode };
|
||||
this.cmOptions = { ...this.cmOptions, mode: newMode }
|
||||
}
|
||||
break;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: false,
|
||||
immediate: true,
|
||||
immediate: true
|
||||
},
|
||||
options: {
|
||||
handler(n) {
|
||||
if (Object.keys(n).length) {
|
||||
const options = JSON.parse(JSON.stringify(n));
|
||||
this.cmOptions = { ...this.cmOptions, ...options };
|
||||
const options = JSON.parse(JSON.stringify(n))
|
||||
this.cmOptions = { ...this.cmOptions, ...options }
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
immediate: true
|
||||
},
|
||||
code(n) {
|
||||
// 延迟赋值,避免行号错乱
|
||||
if (this.cmOptions.mode === "json") {
|
||||
if (this.cmOptions.mode === 'json') {
|
||||
try {
|
||||
this.editorValue = this.formatStrInJson(n);
|
||||
this.editorValue = this.formatStrInJson(n)
|
||||
} catch (error) {
|
||||
this.editorValue = n;
|
||||
this.editorValue = n
|
||||
// 啥也不做
|
||||
}
|
||||
} else {
|
||||
this.editorValue = n;
|
||||
this.editorValue = n
|
||||
}
|
||||
setTimeout(() => {
|
||||
this.myCodemirror.refresh();
|
||||
}, 100);
|
||||
},
|
||||
this.myCodemirror.refresh()
|
||||
}, 100)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.codeMirrorHeight = this.showTool ? `calc( 100% - ${this.$refs.toolBar.offsetHeight + 10}px )` : "100%";
|
||||
this.codeMirrorHeight = this.showTool ? `calc( 100% - ${this.$refs.toolBar.offsetHeight + 10}px )` : '100%'
|
||||
try {
|
||||
// if (!this.editorValue) {
|
||||
// this.cmOptions.lint = false;
|
||||
// return;
|
||||
// }
|
||||
if (this.cmOptions.mode === "json" && this.cmOptions.enableAutoFormatJson) {
|
||||
this.editorValue = this.formatStrInJson(this.editorValue);
|
||||
if (this.cmOptions.mode === 'json' && this.cmOptions.enableAutoFormatJson) {
|
||||
this.editorValue = this.formatStrInJson(this.editorValue)
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("初始化codemirror出错:" + e);
|
||||
console.log('初始化codemirror出错:' + e)
|
||||
// $message.error("初始化codemirror出错:" + e);
|
||||
}
|
||||
},
|
||||
@ -315,20 +333,20 @@ export default {
|
||||
methods: {
|
||||
// 选择语言
|
||||
handleSelectMode(v) {
|
||||
this.cmOptions.mode = v;
|
||||
this.cmOptions.mode = v
|
||||
},
|
||||
|
||||
// 选择皮肤
|
||||
handleSelectTheme(v) {
|
||||
this.cmOptions.theme = v;
|
||||
localStorage.setItem("editorTheme", v);
|
||||
this.cmOptions.theme = v
|
||||
localStorage.setItem('editorTheme', v)
|
||||
},
|
||||
|
||||
// 黏贴事件处理函数
|
||||
OnPaste() {
|
||||
if (this.cmOptions.mode === "json") {
|
||||
if (this.cmOptions.mode === 'json') {
|
||||
try {
|
||||
this.editorValue = this.formatStrInJson(this.editorValue);
|
||||
this.editorValue = this.formatStrInJson(this.editorValue)
|
||||
} catch (e) {
|
||||
// 啥都不做
|
||||
}
|
||||
@ -337,46 +355,46 @@ export default {
|
||||
|
||||
// 失去焦点时处理函数
|
||||
onCmBlur(cm) {
|
||||
this.$emit("onCmBlur", cm.getValue());
|
||||
this.$emit('onCmBlur', cm.getValue())
|
||||
},
|
||||
|
||||
// 按下键盘事件处理函数
|
||||
onKeyDown(event) {
|
||||
const keyCode = event.keyCode || event.which || event.charCode;
|
||||
const keyCombination = event.ctrlKey || event.altKey || event.metaKey;
|
||||
const keyCode = event.keyCode || event.which || event.charCode
|
||||
const keyCombination = event.ctrlKey || event.altKey || event.metaKey
|
||||
//满足条件触发代码提示
|
||||
if (!keyCombination && keyCode > 64 && keyCode < 123) {
|
||||
this.myCodemirror.showHint({ completeSingle: false });
|
||||
this.myCodemirror.showHint({ completeSingle: false })
|
||||
}
|
||||
},
|
||||
|
||||
// 按下鼠标时事件处理函数
|
||||
onMouseDown() {
|
||||
//取消代码提示
|
||||
this.myCodemirror.closeHint();
|
||||
this.myCodemirror.closeHint()
|
||||
},
|
||||
|
||||
onCmCodeChanges(cm) {
|
||||
this.editorValue = cm.getValue();
|
||||
this.editorValue = cm.getValue()
|
||||
},
|
||||
|
||||
// 格式化字符串为json格式字符串
|
||||
formatStrInJson(strValue) {
|
||||
//this.$emit("checkJson", strValue);
|
||||
return JSON.stringify(JSON.parse(strValue), null, this.cmOptions.defaultJsonIndentation);
|
||||
return JSON.stringify(JSON.parse(strValue), null, this.cmOptions.defaultJsonIndentation)
|
||||
},
|
||||
|
||||
// 过滤选项
|
||||
filterOption(input, option) {
|
||||
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
},
|
||||
scrollToBottom() {
|
||||
this.$nextTick(() => {
|
||||
this.myCodemirror.execCommand("goDocEnd");
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
nextTick(() => {
|
||||
this.myCodemirror.execCommand('goDocEnd')
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.CodeMirror {
|
||||
|
@ -4,84 +4,92 @@
|
||||
ref="codemirror"
|
||||
:style="`height:${this.height}`"
|
||||
v-model="showContext"
|
||||
:options="{ theme: 'panda-syntax', mode: 'verilog', cursorBlinkRate: -1, tabSize: 2, readOnly: true, styleActiveLine: true, lineWrapping: this.config.wordBreak }"
|
||||
:options="{
|
||||
theme: 'panda-syntax',
|
||||
mode: 'verilog',
|
||||
cursorBlinkRate: -1,
|
||||
tabSize: 2,
|
||||
readOnly: true,
|
||||
styleActiveLine: true,
|
||||
lineWrapping: this.config.wordBreak
|
||||
}"
|
||||
></code-editor>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ansiparse from "@/utils/parse-ansi";
|
||||
import codeEditor from "@/components/codeEditor";
|
||||
import ansiparse from '@/utils/parse-ansi'
|
||||
import codeEditor from '@/components/codeEditor'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
codeEditor,
|
||||
codeEditor
|
||||
},
|
||||
props: {
|
||||
height: {
|
||||
String,
|
||||
default: "50vh",
|
||||
default: '50vh'
|
||||
},
|
||||
|
||||
config: Object,
|
||||
id: {
|
||||
String,
|
||||
default: "logScrollArea",
|
||||
},
|
||||
default: 'logScrollArea'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
defText: "loading context...",
|
||||
logContext: "",
|
||||
};
|
||||
defText: 'loading context...',
|
||||
logContext: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
wordBreak() {
|
||||
this.changeBuffer();
|
||||
return this.config.wordBreak || false;
|
||||
this.changeBuffer()
|
||||
return this.config.wordBreak || false
|
||||
},
|
||||
showContext: {
|
||||
get() {
|
||||
return this.logContext || this.defText;
|
||||
return this.logContext || this.defText
|
||||
},
|
||||
set() {},
|
||||
},
|
||||
set() {}
|
||||
}
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
//
|
||||
appendLine(data) {
|
||||
if (!data) {
|
||||
return;
|
||||
return
|
||||
}
|
||||
const dataArray = Array.isArray(data) ? data : [data];
|
||||
const dataArray = Array.isArray(data) ? data : [data]
|
||||
this.logContext += dataArray
|
||||
.map((item) => {
|
||||
return (
|
||||
// gitee isuess I657JR
|
||||
ansiparse(item)
|
||||
.map((ansiItem) => {
|
||||
return ansiItem.text;
|
||||
return ansiItem.text
|
||||
})
|
||||
.join("") + "\r\n"
|
||||
);
|
||||
.join('') + '\r\n'
|
||||
)
|
||||
})
|
||||
.join("");
|
||||
.join('')
|
||||
if (this.config.logScroll) {
|
||||
setTimeout(() => {
|
||||
// 延迟触发滚动
|
||||
this.$nextTick(() => {
|
||||
this.$refs?.codemirror?.scrollToBottom();
|
||||
});
|
||||
}, 500);
|
||||
nextTick(() => {
|
||||
this.$refs?.codemirror?.scrollToBottom()
|
||||
})
|
||||
}, 500)
|
||||
}
|
||||
},
|
||||
|
||||
clearLogCache() {
|
||||
this.logContext = "";
|
||||
},
|
||||
},
|
||||
};
|
||||
this.logContext = ''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
|
@ -40,7 +40,7 @@ export default {
|
||||
},
|
||||
computed: {},
|
||||
mounted() {
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.initSocket()
|
||||
}, 200)
|
||||
|
@ -847,7 +847,7 @@ export default {
|
||||
handleAdd() {
|
||||
this.temp = {}
|
||||
this.editBuildVisible = 2
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.$refs.editBuild.handleAdd()
|
||||
})
|
||||
},
|
||||
@ -862,14 +862,14 @@ export default {
|
||||
handleEdit(record) {
|
||||
this.editBuildVisible = 2
|
||||
this.temp = { id: record.id, triggerToken: record.triggerToken }
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.$refs.editBuild.handleEdit({ ...record })
|
||||
})
|
||||
},
|
||||
handleDetails(record) {
|
||||
this.editBuildVisible = 1
|
||||
this.temp = { id: record.id, triggerToken: record.triggerToken }
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.$refs.editBuild.handleEdit({ ...record })
|
||||
})
|
||||
},
|
||||
|
@ -1189,7 +1189,7 @@ export default {
|
||||
},
|
||||
// 编辑分发
|
||||
handleEditDispatch(record) {
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.$refs['linkDispatchForm'] && this.$refs['linkDispatchForm'].resetFields()
|
||||
})
|
||||
this.loadNodeList(() => {
|
||||
@ -1308,7 +1308,7 @@ export default {
|
||||
this.loadGroupList()
|
||||
|
||||
this.editDispatchVisible = true
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.$refs['editDispatchForm'].resetFields()
|
||||
setTimeout(() => {
|
||||
this.introGuide()
|
||||
@ -1318,7 +1318,7 @@ export default {
|
||||
},
|
||||
// 编辑分发项目
|
||||
handleEditDispatchProject(record) {
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.$refs['editDispatchForm'] && this.$refs['editDispatchForm'].resetFields()
|
||||
})
|
||||
|
||||
|
@ -424,7 +424,7 @@ export default {
|
||||
// handleClose(removedTag) {},
|
||||
showInput() {
|
||||
this.temp = { ...this.temp, inputVisible: true }
|
||||
this.$nextTick(function () {
|
||||
nextTick(function () {
|
||||
this.$refs.tagInput.focus()
|
||||
})
|
||||
},
|
||||
|
@ -226,7 +226,7 @@ export default {
|
||||
if (this.logTimerMap[key]) {
|
||||
return
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
const data = this.temp.taskList?.filter((item1) => {
|
||||
return item1.id === key
|
||||
})[0]
|
||||
|
@ -678,7 +678,7 @@ const handleWorkspaceChange = (value: string) => {
|
||||
// getUserInfo().then((res) => {
|
||||
// if (res.code === 200) {
|
||||
// this.temp = { ...this.temp, status: res.data.bindMfa };
|
||||
// this.$nextTick(() => {
|
||||
// nextTick(() => {
|
||||
// this.$refs?.twoCode?.focus();
|
||||
// });
|
||||
// }
|
||||
@ -692,11 +692,11 @@ const showQrCode = () => {
|
||||
return
|
||||
}
|
||||
this.tempVue = Vue
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
const qrCodeDom = document.getElementById('qrCodeUrl')
|
||||
qrCodeDom.innerHTML = ''
|
||||
this.creatQrCode(qrCodeDom, this.temp.url)
|
||||
this.$nextTick(function () {
|
||||
nextTick(function () {
|
||||
this.$refs.twoCode.focus()
|
||||
})
|
||||
})
|
||||
|
@ -179,7 +179,6 @@ import QrcodeVue from 'qrcode.vue'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { useAppStore } from '@/stores/app'
|
||||
import { useRouter } from 'vue-router'
|
||||
const { proxy }: any = getCurrentInstance()
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
@ -211,7 +210,7 @@ const handleLogin = (values: any) => {
|
||||
const appStore = useAppStore()
|
||||
// 登录不成功,更新验证码
|
||||
if (res.code === 200) {
|
||||
proxy.$notification.success({
|
||||
$notification.success({
|
||||
message: res.msg
|
||||
})
|
||||
const tokenData = res.data.tokenData
|
||||
@ -229,7 +228,7 @@ const handleLogin = (values: any) => {
|
||||
const handleMfaSure = () => {
|
||||
bindMfa(mfaForm).then((res) => {
|
||||
if (res.code === 200) {
|
||||
proxy.$notification.success({
|
||||
$notification.success({
|
||||
message: res.msg
|
||||
})
|
||||
// 跳转主页面;
|
||||
@ -240,7 +239,7 @@ const handleMfaSure = () => {
|
||||
|
||||
// 忽略 mfa
|
||||
const handleIgnoreBindMfa = () => {
|
||||
proxy.$confirm({
|
||||
$confirm({
|
||||
title: '系统提示',
|
||||
content: '确定要忽略绑定两步验证吗?强烈建议超级管理员开启两步验证来保证账号安全性',
|
||||
okText: '确认',
|
||||
|
@ -336,7 +336,7 @@ export default {
|
||||
loadUserList(fn) {
|
||||
getUserListAll().then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.userList = res.data.map((element) => {
|
||||
let canUse = element.email || element.dingDing || element.workWx
|
||||
return { key: element.id, name: element.name, disabled: !canUse }
|
||||
@ -387,7 +387,7 @@ export default {
|
||||
this.editMonitorVisible = true
|
||||
this.loadUserList()
|
||||
this.loadNodeProjectList()
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.introGuide()
|
||||
}, 500)
|
||||
|
@ -263,7 +263,7 @@ export default {
|
||||
this.monitorUserKeys = []
|
||||
this.loadUserList()
|
||||
this.editOperateMonitorVisible = true
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.introGuide()
|
||||
}, 500)
|
||||
|
@ -293,7 +293,7 @@ export default {
|
||||
this.treeList = res.data
|
||||
}
|
||||
// 取出第一个默认选中
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
const node = this.treeList[0]
|
||||
if (node) {
|
||||
this.tempNode = node
|
||||
|
@ -4,38 +4,38 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { scriptLog } from "@/api/node-other";
|
||||
import LogView from "@/components/logView";
|
||||
import { scriptLog } from '@/api/node-other'
|
||||
import LogView from '@/components/logView'
|
||||
export default {
|
||||
components: {
|
||||
LogView,
|
||||
LogView
|
||||
},
|
||||
props: {
|
||||
temp: {
|
||||
type: Object,
|
||||
},
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
logTimer: null,
|
||||
// logText: "loading...",
|
||||
line: 1,
|
||||
};
|
||||
line: 1
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.logTimer) {
|
||||
clearInterval(this.logTimer);
|
||||
clearInterval(this.logTimer)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.loadData();
|
||||
this.loadData()
|
||||
this.logTimer = setInterval(() => {
|
||||
this.loadData();
|
||||
}, 2000);
|
||||
this.loadData()
|
||||
}, 2000)
|
||||
},
|
||||
// 加载日志内容
|
||||
loadData() {
|
||||
@ -44,13 +44,13 @@ export default {
|
||||
executeId: this.temp.id,
|
||||
id: this.temp.scriptId,
|
||||
nodeId: this.temp.nodeId,
|
||||
line: this.line,
|
||||
};
|
||||
line: this.line
|
||||
}
|
||||
scriptLog(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
// 停止请求
|
||||
if (res.data.run === false) {
|
||||
clearInterval(this.logTimer);
|
||||
clearInterval(this.logTimer)
|
||||
}
|
||||
// 更新日志
|
||||
// if (this.logText === "loading...") {
|
||||
@ -60,11 +60,11 @@ export default {
|
||||
// lines.forEach((element) => {
|
||||
// this.logText += `${element}\r\n`;
|
||||
// });
|
||||
this.$refs.logView.appendLine(res.data.dataLines);
|
||||
this.line = res.data.line;
|
||||
this.$refs.logView.appendLine(res.data.dataLines)
|
||||
this.line = res.data.line
|
||||
// if (lines.length) {
|
||||
// // 自动滚动到底部
|
||||
// this.$nextTick(() => {
|
||||
// nextTick(() => {
|
||||
// setTimeout(() => {
|
||||
// const textarea = document.getElementById("script-log-textarea");
|
||||
// if (textarea) {
|
||||
@ -74,9 +74,9 @@ export default {
|
||||
// });
|
||||
// }
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
@ -938,7 +938,7 @@ export default {
|
||||
this.loadAccesList()
|
||||
|
||||
this.editProjectVisible = true
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.introGuide()
|
||||
}, 500)
|
||||
|
@ -43,70 +43,100 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { getRecoverList } from "../../../../api/node-project";
|
||||
import { getRecoverList } from '../../../../api/node-project'
|
||||
export default {
|
||||
props: {
|
||||
node: {
|
||||
type: Object,
|
||||
},
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
tableHeight: "70vh",
|
||||
tableHeight: '70vh',
|
||||
list: [],
|
||||
temp: {},
|
||||
detailData: [],
|
||||
detailVisible: false,
|
||||
columns: [
|
||||
{ title: "项目名称", dataIndex: "nodeProjectInfoModel.name", width: 150, ellipsis: true, scopedSlots: { customRender: "name" } },
|
||||
{ title: "项目 ID", dataIndex: "nodeProjectInfoModel.id", width: 150, ellipsis: true, scopedSlots: { customRender: "id" } },
|
||||
{ title: "分组", dataIndex: "nodeProjectInfoModel.group", width: 150, ellipsis: true, scopedSlots: { customRender: "group" } },
|
||||
{ title: "项目路径", dataIndex: "nodeProjectInfoModel.lib", width: 150, ellipsis: true, scopedSlots: { customRender: "lib" } },
|
||||
{ title: "删除时间", dataIndex: "delTime", width: 180, ellipsis: true, scopedSlots: { customRender: "delTime" } },
|
||||
{ title: "操作人", dataIndex: "delUser", width: 150, ellipsis: true, scopedSlots: { customRender: "delUser" } },
|
||||
{ title: "操作", dataIndex: "operation", scopedSlots: { customRender: "operation" }, width: 100 },
|
||||
],
|
||||
};
|
||||
{
|
||||
title: '项目名称',
|
||||
dataIndex: 'nodeProjectInfoModel.name',
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'name' }
|
||||
},
|
||||
{
|
||||
title: '项目 ID',
|
||||
dataIndex: 'nodeProjectInfoModel.id',
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'id' }
|
||||
},
|
||||
{
|
||||
title: '分组',
|
||||
dataIndex: 'nodeProjectInfoModel.group',
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'group' }
|
||||
},
|
||||
{
|
||||
title: '项目路径',
|
||||
dataIndex: 'nodeProjectInfoModel.lib',
|
||||
width: 150,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'lib' }
|
||||
},
|
||||
{
|
||||
title: '删除时间',
|
||||
dataIndex: 'delTime',
|
||||
width: 180,
|
||||
ellipsis: true,
|
||||
scopedSlots: { customRender: 'delTime' }
|
||||
},
|
||||
{ title: '操作人', dataIndex: 'delUser', width: 150, ellipsis: true, scopedSlots: { customRender: 'delUser' } },
|
||||
{ title: '操作', dataIndex: 'operation', scopedSlots: { customRender: 'operation' }, width: 100 }
|
||||
]
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.calcTableHeight();
|
||||
this.loadRecoverList();
|
||||
this.calcTableHeight()
|
||||
this.loadRecoverList()
|
||||
},
|
||||
methods: {
|
||||
// 计算表格高度
|
||||
calcTableHeight() {
|
||||
this.$nextTick(() => {
|
||||
this.tableHeight = window.innerHeight - 120;
|
||||
});
|
||||
nextTick(() => {
|
||||
this.tableHeight = window.innerHeight - 120
|
||||
})
|
||||
},
|
||||
// 加载数据
|
||||
loadRecoverList() {
|
||||
this.loading = true;
|
||||
this.loading = true
|
||||
getRecoverList(this.node.id).then((res) => {
|
||||
if (res.code === 200) {
|
||||
this.list = res.data;
|
||||
this.list = res.data
|
||||
}
|
||||
this.loading = false;
|
||||
});
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
// 详情
|
||||
handleDetail(record) {
|
||||
this.detailData = [];
|
||||
this.detailVisible = true;
|
||||
this.temp = Object.assign({}, record);
|
||||
this.detailData = []
|
||||
this.detailVisible = true
|
||||
this.temp = Object.assign({}, record)
|
||||
this.detailData.push({
|
||||
title: "项目信息",
|
||||
description: `项目名称: ${this.temp.nodeProjectInfoModel.name} | 项目 ID: ${this.temp.nodeProjectInfoModel.id} | 分组: ${this.temp.nodeProjectInfoModel.group}`,
|
||||
});
|
||||
this.detailData.push({ title: "项目目录", description: this.temp.nodeProjectInfoModel.lib });
|
||||
this.detailData.push({ title: "mainClass", description: this.temp.nodeProjectInfoModel.mainClass });
|
||||
this.detailData.push({ title: "日志目录", description: this.temp.nodeProjectInfoModel.log });
|
||||
this.detailData.push({ title: "JVM 参数", description: this.temp.nodeProjectInfoModel.jvm });
|
||||
this.detailData.push({ title: "args 参数", description: this.temp.nodeProjectInfoModel.args });
|
||||
this.detailData.push({ title: "WebHooks", description: this.temp.nodeProjectInfoModel.token });
|
||||
this.detailData.push({ title: "Build 标识", description: this.temp.nodeProjectInfoModel.buildTag });
|
||||
},
|
||||
},
|
||||
};
|
||||
title: '项目信息',
|
||||
description: `项目名称: ${this.temp.nodeProjectInfoModel.name} | 项目 ID: ${this.temp.nodeProjectInfoModel.id} | 分组: ${this.temp.nodeProjectInfoModel.group}`
|
||||
})
|
||||
this.detailData.push({ title: '项目目录', description: this.temp.nodeProjectInfoModel.lib })
|
||||
this.detailData.push({ title: 'mainClass', description: this.temp.nodeProjectInfoModel.mainClass })
|
||||
this.detailData.push({ title: '日志目录', description: this.temp.nodeProjectInfoModel.log })
|
||||
this.detailData.push({ title: 'JVM 参数', description: this.temp.nodeProjectInfoModel.jvm })
|
||||
this.detailData.push({ title: 'args 参数', description: this.temp.nodeProjectInfoModel.args })
|
||||
this.detailData.push({ title: 'WebHooks', description: this.temp.nodeProjectInfoModel.token })
|
||||
this.detailData.push({ title: 'Build 标识', description: this.temp.nodeProjectInfoModel.buildTag })
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -4,38 +4,38 @@
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { scriptLog } from "@/api/server-script";
|
||||
import LogView from "@/components/logView";
|
||||
import { scriptLog } from '@/api/server-script'
|
||||
import LogView from '@/components/logView'
|
||||
export default {
|
||||
components: {
|
||||
LogView,
|
||||
LogView
|
||||
},
|
||||
props: {
|
||||
temp: {
|
||||
type: Object,
|
||||
},
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
logTimer: null,
|
||||
// logText: "loading...",
|
||||
line: 1,
|
||||
};
|
||||
line: 1
|
||||
}
|
||||
},
|
||||
beforeDestroy() {
|
||||
if (this.logTimer) {
|
||||
clearInterval(this.logTimer);
|
||||
clearInterval(this.logTimer)
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
init() {
|
||||
this.loadData();
|
||||
this.loadData()
|
||||
this.logTimer = setInterval(() => {
|
||||
this.loadData();
|
||||
}, 2000);
|
||||
this.loadData()
|
||||
}, 2000)
|
||||
},
|
||||
// 加载日志内容
|
||||
loadData() {
|
||||
@ -44,13 +44,13 @@ export default {
|
||||
executeId: this.temp.id,
|
||||
id: this.temp.scriptId,
|
||||
nodeId: this.temp.nodeId,
|
||||
line: this.line,
|
||||
};
|
||||
line: this.line
|
||||
}
|
||||
scriptLog(params).then((res) => {
|
||||
if (res.code === 200) {
|
||||
// 停止请求
|
||||
if (res.data.run === false) {
|
||||
clearInterval(this.logTimer);
|
||||
clearInterval(this.logTimer)
|
||||
}
|
||||
// 更新日志
|
||||
// if (this.logText === "loading...") {
|
||||
@ -60,11 +60,11 @@ export default {
|
||||
// lines.forEach((element) => {
|
||||
// this.logText += `${element}\r\n`;
|
||||
// });
|
||||
this.$refs.logView.appendLine(res.data.dataLines);
|
||||
this.line = res.data.line;
|
||||
this.$refs.logView.appendLine(res.data.dataLines)
|
||||
this.line = res.data.line
|
||||
// if (lines.length) {
|
||||
// // 自动滚动到底部
|
||||
// this.$nextTick(() => {
|
||||
// nextTick(() => {
|
||||
// setTimeout(() => {
|
||||
// const textarea = document.getElementById("script-log-textarea");
|
||||
// if (textarea) {
|
||||
@ -74,9 +74,9 @@ export default {
|
||||
// });
|
||||
// }
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style scoped></style>
|
||||
|
@ -115,7 +115,7 @@ export default {
|
||||
this.logMap[item.id].line = res.data.line
|
||||
// if (lines.length) {
|
||||
// // 自动滚动到底部
|
||||
// this.$nextTick(() => {
|
||||
// nextTick(() => {
|
||||
// setTimeout(() => {
|
||||
// const textarea = document.getElementById("build-log-textarea-" + item.id);
|
||||
// if (textarea) {
|
||||
@ -135,7 +135,7 @@ export default {
|
||||
if (this.logTimerMap[key]) {
|
||||
return
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
const index = this.logList
|
||||
.map((item1, index) => {
|
||||
return item1.id == key ? index : -1
|
||||
|
@ -71,7 +71,7 @@ export default {
|
||||
watch: {},
|
||||
created() {
|
||||
this.loadData()
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
setTimeout(() => {
|
||||
this.introGuide()
|
||||
}, 500)
|
||||
|
@ -222,7 +222,7 @@ export default {
|
||||
// };
|
||||
// this.envVarListQuery.workspaceId = record.id;
|
||||
this.envVarListVisible = true
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.$refs.workspaceEnv.loadDataEnvVar()
|
||||
})
|
||||
},
|
||||
|
@ -143,7 +143,7 @@ export default {
|
||||
const cron = this.$route.query.cron
|
||||
if (cron) {
|
||||
this.temp = { ...this.temp, cron: cron }
|
||||
this.$nextTick(() => {
|
||||
nextTick(() => {
|
||||
this.onSubmit()
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user