fix:(规则引擎)

master
zhang xu 2024-05-05 15:18:31 +08:00
parent d327a2771f
commit 57f894455d
3 changed files with 86 additions and 32 deletions

View File

@ -40,8 +40,7 @@ export default {
'modification':{
handler(val) {
if (val != null){
console.log(val)
console.log(this.code)
console.log({id: this.modification,codeText: this.code})
updateMaintenance({id: this.modification,codeText: this.code}).then(res => {
this.$message.success('修改成功')
setTimeout(() => {

View File

@ -106,27 +106,30 @@
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'"
size="mini"
type="text"
icon="el-icon-takeaway-box"
@click="initializeRuleEngine(scope.row)"
>初始化</el-button>
<el-button
v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'"
size="mini"
type="text"
icon="el-icon-takeaway-box"
@click="testMethod(scope.row)"
>调用测试</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-takeaway-box"
@click="toEngineVersion(scope.row)"
v-hasPermi="['system:engine:edit']"
>规则维护</el-button>
<!-- <el-button-->
<!-- v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'"-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-takeaway-box"-->
<!-- @click="initializeRuleEngine(scope.row)"-->
<!-- >初始化</el-button>-->
<el-button type="primary" @click="initializeRuleEngine(scope.row)"></el-button>
<!-- <el-button-->
<!-- v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'"-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-takeaway-box"-->
<!-- @click="testMethod(scope.row)"-->
<!-- >调用测试</el-button>-->
<el-button type="primary" @click="testMethod(scope.row)"></el-button>
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-takeaway-box"-->
<!-- @click="toEngineVersion(scope.row)"-->
<!-- v-hasPermi="['system:engine:edit']"-->
<!-- >规则维护</el-button>-->
<el-button type="primary" @click="toEngineVersion(scope.row)"></el-button>
<el-button
size="mini"
type="text"
@ -236,24 +239,51 @@
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
<!--dummy dialog-->
<el-dialog title="提示" :visible.sync="dialogVisible" width="30%" :before-close="handleClose">
<el-card style="height: 90%">
<div slot="header" class="clearfix">
<span>{{ruleEngineInfo.name}}</span>
<el-button @click="updRuleEngine(ruleEngineInfo)" style="float: right;" type="primary">保存</el-button>
</div>
<div class="text item">
<encoding ref="encoding" style="height: 800px" :modification="modification" :value="ruleEngineInfo.codeText"></encoding>
</div>
</el-card>
</el-dialog>
</div>
</template>
<script>
import {
addMaintenance,
addMaintenance, getMaintenance,
initializeRuleEngine,
listMaintenance,
testMethod,
updateMaintenance
} from "@/api/ruleEngine/maintenance";
import Encoding from "@/components/Encoding/index.vue";
export default {
name: "EngineMaintenance",
components: {Encoding},
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level'],
data() {
return {
dialogVisible: false,
ruleEngineId: 0,
ruleEngineInfo:{},
modification: null,
//
loading: true,
//
@ -319,17 +349,37 @@ export default {
this.getList();
},
methods: {
updRuleEngine(ruleEngineInfo){
this.modification = parseInt(ruleEngineInfo.id)
setTimeout(() => {
this.modification = null
this.dialogVisible = false
},50)
},
handleClose(done) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
},
testMethod(row){
testMethod(row.code).then(res => {
if (res.code === 200){
this.$message({
type: 'success',
message: '测试成功!'
message: '测试成功拉拉拉拉!'
});
}else {
this.$message({
type: 'error',
message: '测试失败!'
message: '测试失败嘿嘿嘿!'
});
}
})
@ -339,18 +389,23 @@ export default {
if (res.code === 200){
this.$message({
type: 'success',
message: '初始化成功!'
message: '初始化成功啦啦啦啦啦!'
});
}else {
this.$message({
type: 'error',
message: '初始化失败!'
message: '初始化失败嘿嘿嘿!'
});
}
})
},
toEngineVersion(row){
this.$router.push({ path: `/ruleEngine/engineVersion/${row.id}`});
getMaintenance(row.id).then(res => {
this.ruleEngineInfo = res.data
console.log(this.ruleEngineInfo)
})
this.dialogVisible=true
},
/** 查询规则引擎列表 */
getList() {

View File

@ -3,7 +3,7 @@
<el-card style="height: 90%">
<div slot="header" class="clearfix">
<span>{{ruleEngineInfo.name}}</span>
<el-button @click="dialogVisible = true" style="float: right;" type="primary"> </el-button>
<el-button @click="dialogVisible = true" style="float: right;" type="primary"></el-button>
</div>
<div class="text item">
<encoding ref="encoding" style="height: 800px" :modification="modification" :value="ruleEngineInfo.codeText"></encoding>
@ -44,13 +44,13 @@ export default {
},
methods: {
updRuleEngine(){
console.log(this.modification)
this.modification = parseInt(this.ruleEngineId)
setTimeout(() => {
this.modification = null
this.dialogVisible = false
},50)
},100)
},
getInfo(){
getMaintenance(this.$route.params.ruleEngineId).then(res => {