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':{ 'modification':{
handler(val) { handler(val) {
if (val != null){ if (val != null){
console.log(val) console.log({id: this.modification,codeText: this.code})
console.log(this.code)
updateMaintenance({id: this.modification,codeText: this.code}).then(res => { updateMaintenance({id: this.modification,codeText: this.code}).then(res => {
this.$message.success('修改成功') this.$message.success('修改成功')
setTimeout(() => { setTimeout(() => {

View File

@ -106,27 +106,30 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <!-- <el-button-->
v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'" <!-- v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'"-->
size="mini" <!-- size="mini"-->
type="text" <!-- type="text"-->
icon="el-icon-takeaway-box" <!-- icon="el-icon-takeaway-box"-->
@click="initializeRuleEngine(scope.row)" <!-- @click="initializeRuleEngine(scope.row)"-->
>初始化</el-button> <!-- >初始化</el-button>-->
<el-button <el-button type="primary" @click="initializeRuleEngine(scope.row)"></el-button>
v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'" <!-- <el-button-->
size="mini" <!-- v-if="scope.row.isActivate === 'activated' && scope.row.status === '0'"-->
type="text" <!-- size="mini"-->
icon="el-icon-takeaway-box" <!-- type="text"-->
@click="testMethod(scope.row)" <!-- icon="el-icon-takeaway-box"-->
>调用测试</el-button> <!-- @click="testMethod(scope.row)"-->
<el-button <!-- >调用测试</el-button>-->
size="mini" <el-button type="primary" @click="testMethod(scope.row)"></el-button>
type="text" <!-- <el-button-->
icon="el-icon-takeaway-box" <!-- size="mini"-->
@click="toEngineVersion(scope.row)" <!-- type="text"-->
v-hasPermi="['system:engine:edit']" <!-- icon="el-icon-takeaway-box"-->
>规则维护</el-button> <!-- @click="toEngineVersion(scope.row)"-->
<!-- v-hasPermi="['system:engine:edit']"-->
<!-- >规则维护</el-button>-->
<el-button type="primary" @click="toEngineVersion(scope.row)"></el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -236,24 +239,51 @@
<el-button @click="cancel"> </el-button> <el-button @click="cancel"> </el-button>
</div> </div>
</el-dialog> </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> </div>
</template> </template>
<script> <script>
import { import {
addMaintenance, addMaintenance, getMaintenance,
initializeRuleEngine, initializeRuleEngine,
listMaintenance, listMaintenance,
testMethod, testMethod,
updateMaintenance updateMaintenance
} from "@/api/ruleEngine/maintenance"; } from "@/api/ruleEngine/maintenance";
import Encoding from "@/components/Encoding/index.vue";
export default { export default {
name: "EngineMaintenance", name: "EngineMaintenance",
components: {Encoding},
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level'], dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level'],
data() { data() {
return { return {
dialogVisible: false,
ruleEngineId: 0,
ruleEngineInfo:{},
modification: null,
// //
loading: true, loading: true,
// //
@ -319,17 +349,37 @@ export default {
this.getList(); this.getList();
}, },
methods: { 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){
testMethod(row.code).then(res => { testMethod(row.code).then(res => {
if (res.code === 200){ if (res.code === 200){
this.$message({ this.$message({
type: 'success', type: 'success',
message: '测试成功!' message: '测试成功拉拉拉拉!'
}); });
}else { }else {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '测试失败!' message: '测试失败嘿嘿嘿!'
}); });
} }
}) })
@ -339,18 +389,23 @@ export default {
if (res.code === 200){ if (res.code === 200){
this.$message({ this.$message({
type: 'success', type: 'success',
message: '初始化成功!' message: '初始化成功啦啦啦啦啦!'
}); });
}else { }else {
this.$message({ this.$message({
type: 'error', type: 'error',
message: '初始化失败!' message: '初始化失败嘿嘿嘿!'
}); });
} }
}) })
}, },
toEngineVersion(row){ 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() { getList() {

View File

@ -44,13 +44,13 @@ export default {
}, },
methods: { methods: {
updRuleEngine(){ updRuleEngine(){
console.log(this.modification)
this.modification = parseInt(this.ruleEngineId) this.modification = parseInt(this.ruleEngineId)
setTimeout(() => { setTimeout(() => {
this.modification = null this.modification = null
this.dialogVisible = false this.dialogVisible = false
},50) },100)
}, },
getInfo(){ getInfo(){
getMaintenance(this.$route.params.ruleEngineId).then(res => { getMaintenance(this.$route.params.ruleEngineId).then(res => {