|
|
|
@ -46,7 +46,7 @@
|
|
|
|
|
</span>
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
<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'">
|
|
|
|
|
{{ruleEngineVersion.isActivate !== 'no-activate' ? "禁用" : "激活"}}规则
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
@ -162,7 +162,7 @@
|
|
|
|
|
<el-drawer
|
|
|
|
|
title="规则版本测试" size="80%" :before-close="ruleEngineVersionTestStatusClose"
|
|
|
|
|
:visible.sync="ruleEngineVersionTestStatus"
|
|
|
|
|
:direction="'rtl'" v-if="ruleEngineVersionInfoAndTest.status === 1" v-else-if="ruleEngineVersionInfoAndTest.status">
|
|
|
|
|
:direction="'rtl'">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-descriptions v-if="ruleEngineVersionInfoAndTest != null" class="margin-top" :column="2" border>
|
|
|
|
@ -188,60 +188,60 @@
|
|
|
|
|
<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-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>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
import {details, versionsAdd, engineOnOff,statusOnOff} from "@/api/rule/maintenance"
|
|
|
|
|
import { details, versionsAdd, engineOnOff, statusOnOff, versionsUpd, ruleengine } from '@/api/rule/maintenance'
|
|
|
|
|
import Encoding from "@/components/Encoding/index.vue";
|
|
|
|
|
export default {
|
|
|
|
|
name: "EngineVersion",
|
|
|
|
@ -277,13 +277,16 @@ export default {
|
|
|
|
|
codeIng: null,
|
|
|
|
|
isTest:"0"
|
|
|
|
|
},
|
|
|
|
|
assetStructure:null,
|
|
|
|
|
assetStructureList:[],
|
|
|
|
|
// 详情抽屉状态
|
|
|
|
|
ruleEngineVersionInfoStatus: false,
|
|
|
|
|
// 测试抽屉状态
|
|
|
|
|
ruleEngineVersionTestStatus: false,
|
|
|
|
|
// 弹框抽屉
|
|
|
|
|
ruleEngineVersionInfoAndTest:{},
|
|
|
|
|
show:null,
|
|
|
|
|
//返回的编译数据
|
|
|
|
|
ruleContentReq: {},
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
@ -291,7 +294,33 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
//保存代码
|
|
|
|
|
|
|
|
|
|
saveCoding: function() {
|
|
|
|
|
this.ruleEngineVersionInfoAndTest.status = "1"
|
|
|
|
|
console.log(this.ruleEngineVersionInfoAndTest)
|
|
|
|
|
versionsUpd(this.ruleEngineVersionInfoAndTest).then(res=>{
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
const codeName = this.ruleEngineVersionInfoAndTest.codeIng;
|
|
|
|
|
this.ruleContentReq.ruleContent=codeName
|
|
|
|
|
this.ruleContentReq.className= this.ruleEngineVersionInfoAndTest.versionCode
|
|
|
|
|
this.$message.success(res.msg)
|
|
|
|
|
ruleengine(this.ruleContentReq).then(
|
|
|
|
|
res=>{
|
|
|
|
|
this.$message.error(res.msg)
|
|
|
|
|
this.ruleEngineVersionInfoStatus=false
|
|
|
|
|
this.initRuleEngine(this.ruleEngineId)
|
|
|
|
|
this.ruleEngineVersionInfoAndTest={}
|
|
|
|
|
}
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
}else {
|
|
|
|
|
this.$message.error(res.msg)
|
|
|
|
|
this.initRuleEngine(this.ruleEngineId)
|
|
|
|
|
this.ruleEngineVersionInfoAndTest={}
|
|
|
|
|
this.ruleEngineVersionInfoStatus=false
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
//规则版本详情
|
|
|
|
|
ruleEngineVersionInfoStatusClose(done) {
|
|
|
|
@ -349,21 +378,24 @@ export default {
|
|
|
|
|
getCodeIng(value){
|
|
|
|
|
let parentClass=null
|
|
|
|
|
console.log("规则作用域",value)
|
|
|
|
|
//数据集
|
|
|
|
|
if (value === 'taskContext') {
|
|
|
|
|
parentClass = "DataSetContext";
|
|
|
|
|
|
|
|
|
|
//记录
|
|
|
|
|
}else if (value === 'recordContext'){
|
|
|
|
|
parentClass = "RecordContext";
|
|
|
|
|
|
|
|
|
|
//数据字段
|
|
|
|
|
}else if (value === 'dataSetContext'){
|
|
|
|
|
parentClass = "DataModelEngine";
|
|
|
|
|
parentClass = "DataModelContext";
|
|
|
|
|
}
|
|
|
|
|
let packageName = "com.muyu.rule.engine";
|
|
|
|
|
|
|
|
|
|
let packageName = "com.muyu.engine";
|
|
|
|
|
let customName = "custom";
|
|
|
|
|
let templateName = "template";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let codeIng = `package ${packageName}.${customName};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.muyu.engine.action.ActionDiscard;
|
|
|
|
|
import com.muyu.engine.scope.${parentClass};
|
|
|
|
|
|
|
|
|
@ -374,13 +406,8 @@ import com.muyu.engine.scope.${parentClass};
|
|
|
|
|
* @Version: 1.0
|
|
|
|
|
*/
|
|
|
|
|
public class ${this.engineVersionForm.versionCode} extends ${parentClass} {
|
|
|
|
|
@Override
|
|
|
|
|
public void execution () {
|
|
|
|
|
Object value = getValue();
|
|
|
|
|
|
|
|
|
|
if (value == null || "".equals(value) || "null".equals(value)) {
|
|
|
|
|
throw new ActionDiscard();
|
|
|
|
|
}
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
return "zhangsan";
|
|
|
|
|
}
|
|
|
|
|
}`;
|
|
|
|
|
return codeIng;
|
|
|
|
|