feat(): 规则版本:故障引擎测试
parent
83aef04330
commit
44e2f68813
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="height: 800px">
|
<div>
|
||||||
<codemirror ref="codeMirror" :value="code" :options="cmOptions" style="height: 800px"/>
|
<codemirror ref="codeMirror" :value="code" :options="cmOptions"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ export default {
|
||||||
|
|
||||||
.CodeMirror {
|
.CodeMirror {
|
||||||
font-family: 'JetBrainsMono-Medium', monospace;
|
font-family: 'JetBrainsMono-Medium', monospace;
|
||||||
height: 800px;
|
height: 500px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.CodeMirror-lines {
|
.CodeMirror-lines {
|
||||||
|
|
|
@ -43,7 +43,9 @@
|
||||||
</span>
|
</span>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
<el-dropdown-item :command="{event: 'info', ruleEngineVersion: ruleEngineVersion}">规则详情</el-dropdown-item>
|
<el-dropdown-item :command="{event: 'info', ruleEngineVersion: ruleEngineVersion}">规则详情</el-dropdown-item>
|
||||||
<el-dropdown-item :command="{event: 'test', ruleEngineVersion: ruleEngineVersion}">测试规则</el-dropdown-item>
|
<el-dropdown-item :command="{event: 'test', ruleEngineVersion: ruleEngineVersion}"
|
||||||
|
:disabled="ruleEngineVersion.status === '0'"
|
||||||
|
>测试规则</el-dropdown-item>
|
||||||
<el-dropdown-item :command="{event: 'status', ruleEngineVersion: ruleEngineVersion}" :disabled="ruleEngineVersion.status !== '2'">
|
<el-dropdown-item :command="{event: 'status', ruleEngineVersion: ruleEngineVersion}" :disabled="ruleEngineVersion.status !== '2'">
|
||||||
{{ruleEngineVersion.isActivate !== 'no-activate' ? "禁用" : "激活"}}规则
|
{{ruleEngineVersion.isActivate !== 'no-activate' ? "禁用" : "激活"}}规则
|
||||||
</el-dropdown-item>
|
</el-dropdown-item>
|
||||||
|
@ -130,16 +132,109 @@
|
||||||
</span>
|
</span>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
title="规则版本详情" size="80%"
|
title="规则版本详情" size="80%" :before-close="ruleEngineVersionInfoStatusClose"
|
||||||
:visible.sync="ruleEngineVersionInfoStatus"
|
:visible.sync="ruleEngineVersionInfoStatus"
|
||||||
:direction="'rtl'">
|
:direction="'rtl'">
|
||||||
|
<div class="app-container">
|
||||||
|
<el-descriptions v-if="ruleEngineVersionInfoAndTest != null" class="margin-top" :column="2" border>
|
||||||
|
<el-descriptions-item label="版本类" :span="2"> {{ruleEngineVersionInfoAndTest.versionCode}} </el-descriptions-item>
|
||||||
|
<el-descriptions-item label="版本名称"> {{ruleEngineVersionInfoAndTest.name}} </el-descriptions-item>
|
||||||
|
<el-descriptions-item label="版本CODE"> {{ruleEngineVersionInfoAndTest.code}} </el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否激活">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineVersionInfoAndTest.isActivate"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="版本状态">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersionInfoAndTest.status"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否测试">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_activate_is_test" :value="ruleEngineVersionInfoAndTest.isTest"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
<editor style="margin-top: 10px" :read-only="true" :min-height="100" v-model="ruleEngineVersionInfoAndTest.description"></editor>
|
||||||
|
<el-row style="margin-top: 10px">
|
||||||
|
<el-button @click="saveCoding">保存代码</el-button>
|
||||||
|
</el-row>
|
||||||
|
<encoding style="height: 800px; margin-top: 20px" v-model="ruleEngineVersionInfoAndTest.codeIng"></encoding>
|
||||||
|
</div>
|
||||||
|
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
<el-drawer
|
<el-drawer
|
||||||
title="规则版本测试" size="80%"
|
title="规则版本测试" size="80%" :before-close="ruleEngineVersionTestStatusClose"
|
||||||
:visible.sync="ruleEngineVersionTestStatus"
|
:visible.sync="ruleEngineVersionTestStatus"
|
||||||
:direction="'rtl'">
|
:direction="'rtl'">
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-descriptions v-if="ruleEngineVersionInfoAndTest != null" class="margin-top" :column="2" border>
|
||||||
|
<el-descriptions-item label="版本类" :span="2"> {{ruleEngineVersionInfoAndTest.versionCode}} </el-descriptions-item>
|
||||||
|
<el-descriptions-item label="版本名称"> {{ruleEngineVersionInfoAndTest.name}} </el-descriptions-item>
|
||||||
|
<el-descriptions-item label="版本CODE"> {{ruleEngineVersionInfoAndTest.code}} </el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否激活">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineVersionInfoAndTest.isActivate"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="版本状态">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersionInfoAndTest.status"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否测试">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_activate_is_test" :value="ruleEngineVersionInfoAndTest.isTest"/>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<editor style="margin-top: 10px" :read-only="true" :min-height="105" v-model="ruleEngineVersionInfoAndTest.description"></editor>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row :gutter="20">
|
||||||
|
<el-col :span="12">
|
||||||
|
<encoding style="margin-top: 20px" v-model="ruleEngineVersionInfoAndTest.codeIng" :read-only="true"></encoding>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-col :span="assetStructure == null ? 24 : 12">
|
||||||
|
<el-card class="box-card">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>选择数据接入</span>
|
||||||
|
</div>
|
||||||
|
<el-select v-model="assetStructure" style="width: 100%;">
|
||||||
|
<el-option v-for="_assetStructure in assetStructureList"
|
||||||
|
:key="_assetStructure.name"
|
||||||
|
:value="_assetStructure.name"
|
||||||
|
:label="_assetStructure.name+'('+_assetStructure.systemName+')'"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12" v-if="assetStructure != null">
|
||||||
|
<el-card class="box-card" >
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>选择资产结构</span>
|
||||||
|
</div>
|
||||||
|
<el-select v-model="assets" style="width: 100%;">
|
||||||
|
<el-option v-for="_assets in assetsList"
|
||||||
|
:key="_assets.name"
|
||||||
|
:value="_assets.name"
|
||||||
|
:label="_assets.name+'('+_assets.as+')'"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-card class="box-card" v-if="assets != null">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>选择资产模型</span>
|
||||||
|
</div>
|
||||||
|
<el-descriptions direction="vertical" :column="3" border>
|
||||||
|
<el-descriptions-item v-for="_dataModel in dataModelList"
|
||||||
|
:label='_dataModel.name + "("+_dataModel.comment+")"'>
|
||||||
|
<el-radio v-model="dataMode" :label="_dataModel.name" :value="_dataModel.id">{{dataModeMap[_dataModel.name]}}</el-radio>
|
||||||
|
</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24" style="margin-top: 10px" v-if="dataMode != null">
|
||||||
|
<el-button>测试</el-button>
|
||||||
|
<el-input style="margin-top: 10px" v-model="testResult" type="textarea" placeholder="请点击测试" />
|
||||||
|
</el-col>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
@ -181,21 +276,178 @@ export default {
|
||||||
ruleEngineVersionInfoStatus: false,
|
ruleEngineVersionInfoStatus: false,
|
||||||
// 测试抽屉状态
|
// 测试抽屉状态
|
||||||
ruleEngineVersionTestStatus: false,
|
ruleEngineVersionTestStatus: false,
|
||||||
|
// 弹框抽屉
|
||||||
|
ruleEngineVersionInfoAndTest: {},
|
||||||
|
// 数据接入集合
|
||||||
|
assetStructureList: [
|
||||||
|
{
|
||||||
|
name: "测试1",
|
||||||
|
systemName: "云计算系统",
|
||||||
|
databaseName: "yunjisuan",
|
||||||
|
type: "dataSource"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "测试2",
|
||||||
|
systemName: "网站系统",
|
||||||
|
databaseName: "wangzhan",
|
||||||
|
type: "dataSource"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "测试3",
|
||||||
|
systemName: "物联网系统",
|
||||||
|
databaseName: "wulianwang",
|
||||||
|
type: "dataSource"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "测试4",
|
||||||
|
systemName: "传媒系统",
|
||||||
|
databaseName: "chuanmei",
|
||||||
|
type: "dataSource"
|
||||||
|
},
|
||||||
|
],
|
||||||
|
// 数据接入集合选择
|
||||||
|
assetStructure: null,
|
||||||
|
// 数据资产
|
||||||
|
assetsList: [
|
||||||
|
{
|
||||||
|
name: "sys_user",
|
||||||
|
as: "用户表",
|
||||||
|
dataTotal: 635847,
|
||||||
|
type: "dataTable",
|
||||||
|
childrenList: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sys_dept",
|
||||||
|
as: "部门表",
|
||||||
|
dataTotal: 362548,
|
||||||
|
type: "dataTable",
|
||||||
|
childrenList: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sys_notice",
|
||||||
|
as: "通知公告",
|
||||||
|
dataTotal: 6347,
|
||||||
|
type: "dataTable",
|
||||||
|
childrenList: []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
// 数据资产选择
|
||||||
|
assets: null,
|
||||||
|
// 数据模型
|
||||||
|
dataModelList: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "id",
|
||||||
|
comment: "主键",
|
||||||
|
isPrimaryKey: "Y",
|
||||||
|
type: "bigint",
|
||||||
|
mappingType: "Long",
|
||||||
|
length: "-",
|
||||||
|
decimalPlaces: "-",
|
||||||
|
isNull: "N",
|
||||||
|
defaultValue: "-",
|
||||||
|
isDict: "N",
|
||||||
|
dictKey: "-",
|
||||||
|
}, {
|
||||||
|
id: 2,
|
||||||
|
name: "name",
|
||||||
|
comment: "姓名",
|
||||||
|
isPrimaryKey: "N",
|
||||||
|
type: "varchar",
|
||||||
|
mappingType: "String",
|
||||||
|
length: "64",
|
||||||
|
decimalPlaces: "-",
|
||||||
|
isNull: "N",
|
||||||
|
defaultValue: "-",
|
||||||
|
isDict: "N",
|
||||||
|
dictKey: "-",
|
||||||
|
}, {
|
||||||
|
id: 3,
|
||||||
|
name: "sex",
|
||||||
|
comment: "性别",
|
||||||
|
isPrimaryKey: "N",
|
||||||
|
type: "char",
|
||||||
|
mappingType: "String",
|
||||||
|
length: "1",
|
||||||
|
decimalPlaces: "-",
|
||||||
|
isNull: "N",
|
||||||
|
defaultValue: "-",
|
||||||
|
isDict: "Y",
|
||||||
|
dictKey: "system_sex",
|
||||||
|
}, {
|
||||||
|
id: 4,
|
||||||
|
name: "price",
|
||||||
|
comment: "金额",
|
||||||
|
isPrimaryKey: "N",
|
||||||
|
type: "double",
|
||||||
|
mappingType: "BigDecimal",
|
||||||
|
length: "10",
|
||||||
|
decimalPlaces: "2",
|
||||||
|
isNull: "N",
|
||||||
|
defaultValue: "0.00",
|
||||||
|
isDict: "N",
|
||||||
|
dictKey: "-",
|
||||||
|
}, {
|
||||||
|
id: 5,
|
||||||
|
name: "create_time",
|
||||||
|
comment: "创建时间",
|
||||||
|
isPrimaryKey: "N",
|
||||||
|
type: "datetime",
|
||||||
|
mappingType: "Date",
|
||||||
|
length: "-",
|
||||||
|
decimalPlaces: "-",
|
||||||
|
isNull: "Y",
|
||||||
|
defaultValue: "-",
|
||||||
|
isDict: "N",
|
||||||
|
dictKey: "-",
|
||||||
|
}, ],
|
||||||
|
// 数据模型选择
|
||||||
|
dataMode: null,
|
||||||
|
// 数据示例
|
||||||
|
dataModeMap: {
|
||||||
|
id: 1,
|
||||||
|
name: "张三",
|
||||||
|
sex: 1,
|
||||||
|
price: "653.69",
|
||||||
|
create_time: "2024-5-7 16:37:16",
|
||||||
|
},
|
||||||
|
testResult: ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.initRuleEngine();
|
this.initRuleEngine();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
saveCoding(){
|
||||||
|
this.$message.success('编码保存成功');
|
||||||
|
},
|
||||||
|
ruleEngineVersionInfoStatusClose(done) {
|
||||||
|
this.$confirm('确认关闭?')
|
||||||
|
.then(_ => {
|
||||||
|
this.ruleEngineVersionInfoAndTest = {};
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(_ => {});
|
||||||
|
},
|
||||||
|
ruleEngineVersionTestStatusClose(done) {
|
||||||
|
this.$confirm('确认关闭?')
|
||||||
|
.then(_ => {
|
||||||
|
this.ruleEngineVersionInfoAndTest = {};
|
||||||
|
done();
|
||||||
|
})
|
||||||
|
.catch(_ => {});
|
||||||
|
},
|
||||||
// 点击规则事件
|
// 点击规则事件
|
||||||
checkRuleEngineVersion(command) {
|
checkRuleEngineVersion(command) {
|
||||||
switch (command.event) {
|
switch (command.event) {
|
||||||
case "info"://详情
|
case "info"://详情
|
||||||
this.ruleEngineVersionInfoStatus = true
|
this.ruleEngineVersionInfoStatus = true;
|
||||||
|
this.ruleEngineVersionInfoAndTest = command.ruleEngineVersion;
|
||||||
break;
|
break;
|
||||||
case "test"://测试
|
case "test"://测试
|
||||||
this.ruleEngineVersionTestStatus = true
|
this.ruleEngineVersionTestStatus = true;
|
||||||
|
this.ruleEngineVersionInfoAndTest = command.ruleEngineVersion;
|
||||||
break;
|
break;
|
||||||
case "status"://激活状态
|
case "status"://激活状态
|
||||||
command.ruleEngineVersion.isActivate = 'no-activate' === command.ruleEngineVersion.isActivate ? 'activated' : 'no-activate'
|
command.ruleEngineVersion.isActivate = 'no-activate' === command.ruleEngineVersion.isActivate ? 'activated' : 'no-activate'
|
||||||
|
@ -270,12 +522,52 @@ export default {
|
||||||
{
|
{
|
||||||
"name": "163剔除", "code": "IAW3S02", "status": "0", "isTest": "0",
|
"name": "163剔除", "code": "IAW3S02", "status": "0", "isTest": "0",
|
||||||
"versionCode": "engine_custom_email_IAW3S02", "isActivate": "no-activate",
|
"versionCode": "engine_custom_email_IAW3S02", "isActivate": "no-activate",
|
||||||
"description": "<p>根据邮箱规则进行数据校验,内包含所有邮箱校验规则</p>"
|
"description": "<p>根据邮箱规则进行数据校验,内包含所有邮箱校验规则</p>","codeIng": "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: ce-IAW3S02\n" +
|
||||||
|
" * @Version: 1.0\n" +
|
||||||
|
" */\n" +
|
||||||
|
"public class engine_custom_email_IAW3S02 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" +
|
||||||
|
"}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "筛选不合规邮箱", "code": "JISID8S", "status": "2", "isTest": "1",
|
"name": "筛选不合规邮箱", "code": "JISID8S", "status": "2", "isTest": "1",
|
||||||
"versionCode": "engine_custom_email_JISID8S", "isActivate": "activated",
|
"versionCode": "engine_custom_email_JISID8S", "isActivate": "activated",
|
||||||
"description": "<p>根据邮箱规则进行数据校验,内包含所有邮箱校验规则</p>"
|
"description": "<p>根据邮箱规则进行数据校验,内包含所有邮箱校验规则</p>","codeIng": "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: ce-JISID8S\n" +
|
||||||
|
" * @Version: 1.0\n" +
|
||||||
|
" */\n" +
|
||||||
|
"public class engine_custom_email_JISID8S 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" +
|
||||||
|
"}"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "剔除自定义邮箱", "code": "DJ8S9EA", "status": "2", "isTest": "2",
|
"name": "剔除自定义邮箱", "code": "DJ8S9EA", "status": "2", "isTest": "2",
|
||||||
|
@ -338,4 +630,7 @@ public class ${this.engineVersionForm.versionCode} extends ${parentClass} {
|
||||||
.el-icon-arrow-down {
|
.el-icon-arrow-down {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
|
.CodeMirror {
|
||||||
|
height: 600px;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue