导入模型、清屏

dev_2022-03-03
yujialong 3 years ago
parent f35f79973c
commit 34299e9fa3
  1. 127
      src/components/codemirror.vue

@ -9,12 +9,24 @@
ref="codemirror"
></codemirror>
<div v-if="isSubmit" class="code-mask"></div>
<el-button
class="run btn"
type="primary"
@click="runCode(false)"
:disabled="runEnable"
>运行</el-button>
<div class="btns">
<el-button
class="btn"
type="info"
@click="clearCode"
>清屏</el-button>
<el-button
class="btn"
type="warning"
@click="importModel"
>导入模型</el-button>
<el-button
class="run btn"
type="primary"
@click="runCode(false)"
:disabled="runEnable"
>运行</el-button>
</div>
</div>
<div class="code-right answer">
<p class="text-wrapper">{{ runResult }}</p>
@ -45,6 +57,22 @@
</el-dialog>
</div>
</div>
<!-- 导入模型 -->
<el-dialog title="请选择要导入的模型" :visible.sync="modelVisible" width="400px" :close-on-click-modal="false">
<el-tree
:data="modelData"
ref="tree"
@check-change="treeCheckChange"
show-checkbox
:check-strictly="true"
node-key="id">
</el-tree>
<span slot="footer" class="dialog-footer">
<el-button size="small" @click="typeVisible = false">取消</el-button>
<el-button size="small" type="primary" @click="submit">导入</el-button>
</span>
</el-dialog>
</div>
</template>
@ -142,7 +170,59 @@ export default {
inputTextReg: /^((?!#).*?(,|\(|\[|\{|\s)+)?input(?!\w)\(['|"]([\s\S]+?)['|"]\)/m, // input()
requestList: [], // inputaxios
sourceCode: '', // inputexit
requestTimer: null //
requestTimer: null, //
modelVisible: false,
modelData: [
{
id: 1,
label: '品牌一',
children: [
{
id: 4,
label: '华东区域',
children: [
{
id: 9,
label: '上海'
},
{
id: 10,
label: '昆山'
}
]
}
]
},
{
id: 2,
label: '品牌二',
children: [
{
id: 5,
label: '华东区域'
},
{
id: 6,
label: '华南区域'
}
]
},
{
id: 3,
label: '品牌三',
children: [
{
id: 7,
label: '华北区域'
},
{
id: 8,
label: '华南区域'
}
]
}
]
};
},
components: {
@ -171,6 +251,34 @@ export default {
code.showHint()
});
},
//
clearCode() {
this.codeVal = ''
this.isError = ''
this.runResult = ''
this.$emit('update:codeId', '') // coddeId
this.$emit('update:answer', '') //
this.$emit('update:retResult', '') //
},
//
importModel() {
this.modelVisible = true
},
//
treeCheckChange(data, checked, indeterminate) {
const checkKey = this.$refs.tree.getCheckedKeys()
//
if (checkKey.length > 1 && checked) {
this.$refs.tree.setCheckedNodes(checkKey, false)
this.$refs.tree.setChecked(data.id, true)
}
},
//
submit() {
// this.$post(this.api.sourceModelClassification).then(res => {
// }).catch(res => {})
},
/**
* python代码里如果有input函数的话是做了单独的处理的原理是先把所有input函数都替换成exit函数再在exit函数里加上特定标识再通过接口传给后端去执行
* 因为exit函数是跟input有类似的效果就是都会产生阻塞所以python引擎一旦遇到exit进程就会被停止然后返回exit函数里面的值而这个值就是上面说的特定标识加上原本这个input函数里的值
@ -514,11 +622,14 @@ export default {
bottom: 0;
right: 0;
}
.run{
.btns {
z-index:99;
position:absolute;
right: 50px;
bottom:15px;
display: flex;
}
.run{
width:100px;
color:#fff;
}

Loading…
Cancel
Save