生成引擎类

master
Qin Dong Ming 2024-09-02 21:13:43 +08:00
parent 00167769d7
commit 8bfb40147c
2 changed files with 67 additions and 30 deletions

View File

@ -117,3 +117,17 @@ export function sel(id){
//根据版本id查询版本信息
export function generate(data){
return request({
url: "/engine/version/generate",
method: "post",
data:data
})
}

View File

@ -49,12 +49,13 @@
<el-input v-model="versions.description" autocomplete="off"></el-input>
</el-form-item>
<!-- ref="mycode" :value="curCode" class="code"-->
<codemirror :options="cmOptions" v-show="opens">
<!-- ref="mycode" " class="code"-->
<div v-show="opens">
<codemirror :value="this.javaClass" :options="cmOptions" >
</codemirror>
</div>
</codemirror>
</el-form>
<div slot="footer" class="dialog-footer">
@ -63,7 +64,7 @@
<el-button type="primary" @click=handleInsert()> </el-button>
<el-button type="primary" @click=showCode()>生成引擎类</el-button>
<el-button type="primary" @click=showCode(versions)>生成引擎类</el-button>
</div>
@ -219,7 +220,7 @@
<script>
import {add, dels, findById, forbiddenEngine, onEngine, sel, selectEngineById} from "@/api/engine/engine";
import {add, dels, findById, forbiddenEngine, generate, onEngine, sel, selectEngineById} from "@/api/engine/engine";
import Java from "@/components/JavaIDE.vue/java.vue";
@ -259,28 +260,48 @@ export default {
},
opens: false,
javaClass: "package com.muyu.rule.engine.custom;\n" +
"\n" +
"import com.muyu.engine.action.ActionDiscard;\n" +
"import com.muyu.engine.scope.DataModelEngine;\n" +
"\n" +
"/**\n" +
" * @Author: DongZeLiang\n" +
" * @date: 2024/5/6\n" +
" * @Description: 231-231\n" +
" * @Version: 1.0\n" +
" */\n" +
"public class undefined_231 extends DataModelEngine {\n" +
" @Override\n" +
" public void execution () {\n" +
" Object value = getValue();\n" +
"\n" +
" if (value == null || \"\".equals(value) || \"null\".equals(value)) {\n" +
" throw new ActionDiscard();\n" +
" }\n" +
" }\n" +
"}",
//
// javaClass: "package com.muyu.rule.engine.custom;\n" +
//
// "\n" +
//
// "import com.muyu.engine.action.ActionDiscard;\n" +
//
// "import com.muyu.engine.scope.DataModelEngine;\n" +
//
// "\n" +
//
// "/**\n" +
//
// " * @Author: qdm\n" +
//
// new Date+
//
// "\n * @Description: \n" +
//
// " * @Version: 2.2\n" +
//
// " */\n" +
//
// "public class engine_80 extends DataModelEngine {\n" +
//
// " @Override\n" +
//
// " public void execution () {\n" +
//
// " Object value = getValue();\n" +
//
// "\n" +
//
// " if (value == null || \"\".equals(value) || \"null\".equals(value)) {\n" +
//
// " throw new ActionDiscard();\n" +
//
// " }\n" +
//
// " }\n" +
//
// "}",
title: "",
@ -353,9 +374,11 @@ export default {
showCode() {
this.opens = true
generate(this.versions).then(res =>{
this.javaClass;
this.$message.success(res.msg || "成功");
})
},