|
|
|
@ -60,6 +60,7 @@ |
|
|
|
|
|
|
|
|
|
<!-- 导入模型 --> |
|
|
|
|
<el-dialog title="请选择要导入的模型" :visible.sync="modelVisible" width="400px" :close-on-click-modal="false"> |
|
|
|
|
<div class="model-wrap"> |
|
|
|
|
<el-tree |
|
|
|
|
:data="modelData" |
|
|
|
|
ref="tree" |
|
|
|
@ -70,6 +71,7 @@ |
|
|
|
|
node-key="id" |
|
|
|
|
:props="{children: 'children', label: 'categoryName', isLeaf: 'leaf'}"> |
|
|
|
|
</el-tree> |
|
|
|
|
</div> |
|
|
|
|
<span slot="footer" class="dialog-footer"> |
|
|
|
|
<el-button size="small" @click="modelVisible = false">取消</el-button> |
|
|
|
|
<el-button size="small" type="primary" @click="submit">导入</el-button> |
|
|
|
@ -234,7 +236,6 @@ export default { |
|
|
|
|
records.map(n => { |
|
|
|
|
n.categoryName = n.modelName |
|
|
|
|
}) |
|
|
|
|
console.log(records) |
|
|
|
|
e.children = [...e.children, ...records] |
|
|
|
|
resolve() |
|
|
|
|
}).catch(res => { |
|
|
|
@ -264,8 +265,13 @@ export default { |
|
|
|
|
const id = this.$refs.tree.getCheckedKeys() |
|
|
|
|
if (!id.length) return this.$message.error('请选择模型!') |
|
|
|
|
this.$post(`${this.api.referenceFindById}?id=${id[0]}`).then(res => { |
|
|
|
|
this.codeVal += '\n\n' + res.data.modelDemo |
|
|
|
|
this.codeVal += '\n\n' + res.data.modelDemo // 空两行插入 |
|
|
|
|
this.modelVisible = false |
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
const codemirror = this.$refs.codemirror.codemirror |
|
|
|
|
codemirror.focus() |
|
|
|
|
codemirror.setCursor(codemirror.lineCount(), 0) |
|
|
|
|
}) |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}, |
|
|
|
|
/** |
|
|
|
@ -386,7 +392,9 @@ export default { |
|
|
|
|
this.$emit('update:codeId', res.codeId) // 更新coddeId |
|
|
|
|
this.$emit('update:answer', this.runResult) // 更新运行结果 |
|
|
|
|
this.$emit('update:retResult', data.retResult) // 更新返回结果 |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}).catch(err => { |
|
|
|
|
this.loadIns.close() |
|
|
|
|
}) |
|
|
|
|
} else { |
|
|
|
|
this.loadIns = Loading.service({ |
|
|
|
|
background: 'transparent' |
|
|
|
@ -440,8 +448,8 @@ export default { |
|
|
|
|
this.errLine = parseInt(result.substring(result.indexOf("line") + 4, result.length)) |
|
|
|
|
} |
|
|
|
|
}).catch(res => { |
|
|
|
|
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。') |
|
|
|
|
this.loadIns.close() |
|
|
|
|
res.status == 500 && this.$message.error('检测到代码里有非法代码,请检查是否有调用系统命令。') |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -455,7 +463,6 @@ export default { |
|
|
|
|
}, |
|
|
|
|
// 下载图片 |
|
|
|
|
downloadPic(i) { |
|
|
|
|
console.log(11, this.$refs['picLink' + i][0]) |
|
|
|
|
this.$refs['picLink' + i][0].click() |
|
|
|
|
}, |
|
|
|
|
// 获取正式答案 |
|
|
|
@ -647,4 +654,8 @@ export default { |
|
|
|
|
max-width: 100%; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
.model-wrap { |
|
|
|
|
max-height: 400px; |
|
|
|
|
overflow: auto; |
|
|
|
|
} |
|
|
|
|
</style> |