feat(): 引擎维护,规则维护,初始化,测试连接
parent
0bf495b599
commit
92091dfb28
|
@ -42,3 +42,17 @@ export function delEngine(id) {
|
||||||
method: 'delete'
|
method: 'delete'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function initializeRuleEngine(data) {
|
||||||
|
return request({
|
||||||
|
url: '/data/engine/initializeRuleEngine',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function testMethod(encoding) {
|
||||||
|
return request({
|
||||||
|
url: `/data/engine/testMethod/` + encoding ,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="height: 800px">
|
<div style="height: 800px">
|
||||||
<codemirror ref="codeMirror" :value="code" :options="cmOptions" style="height: 800px"/>
|
<codemirror ref="codeMirror" v-model="code" :value="code" :options="cmOptions" style="height: 800px"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -26,11 +26,39 @@ import 'codemirror/addon/fold/foldcode.js';
|
||||||
import 'codemirror/addon/fold/foldgutter.js';
|
import 'codemirror/addon/fold/foldgutter.js';
|
||||||
import 'codemirror/addon/fold/foldgutter.css';
|
import 'codemirror/addon/fold/foldgutter.css';
|
||||||
import 'codemirror/addon/fold/brace-fold.js';
|
import 'codemirror/addon/fold/brace-fold.js';
|
||||||
|
import {updateEngine} from "@/api/data/engine";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
codemirror,
|
codemirror,
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
'value': {
|
||||||
|
handler(val) {
|
||||||
|
this.code = val
|
||||||
|
},
|
||||||
|
},
|
||||||
|
'modification': {
|
||||||
|
handler(val) {
|
||||||
|
if (val != null) {
|
||||||
|
console.log(val)
|
||||||
|
console.log(this.code)
|
||||||
|
updateEngine({id: this.modification, codeText: this.code}).then(res => {
|
||||||
|
this.$message.success('保存成功')
|
||||||
|
setTimeout(() => {
|
||||||
|
this.$router.push({path: `/rule/engineMaintenance`});
|
||||||
|
}, 100)
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
props: {
|
props: {
|
||||||
|
modification: {
|
||||||
|
default: null,
|
||||||
|
type: Number
|
||||||
|
},
|
||||||
value: {
|
value: {
|
||||||
default: "",
|
default: "",
|
||||||
type: String
|
type: String
|
||||||
|
|
|
@ -114,7 +114,21 @@
|
||||||
<el-button
|
<el-button
|
||||||
size="mini"
|
size="mini"
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-takeaway-box"
|
icon="el-icon-key"
|
||||||
|
@click="initializeRuleEngine(scope.row)"
|
||||||
|
>初始化
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-switch-button"
|
||||||
|
@click="testMethod(scope.row)"
|
||||||
|
>测试
|
||||||
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-setting"
|
||||||
@click="toEngineVersion(scope.row)"
|
@click="toEngineVersion(scope.row)"
|
||||||
v-hasPermi="['system:engine:edit']"
|
v-hasPermi="['system:engine:edit']"
|
||||||
>规则维护
|
>规则维护
|
||||||
|
@ -221,8 +235,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {listEngine, getEngine, delEngine, addEngine, updateEngine} from "@/api/data/engine";
|
import { listEngine, getEngine, delEngine, addEngine, updateEngine, initializeRuleEngine, testMethod } from "@/api/data/engine";
|
||||||
import item from "@/layout/components/Sidebar/Item.vue";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Engine",
|
name: "Engine",
|
||||||
|
@ -265,6 +278,51 @@ export default {
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
testMethod(row) {
|
||||||
|
testMethod(row.encoding).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message.success(response.msg)
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
initializeRuleEngine(row) {
|
||||||
|
if (row.type === "规则模板") {
|
||||||
|
row.type = 1
|
||||||
|
} else if (item.type === "自定义模板") {
|
||||||
|
row.type = 2
|
||||||
|
}
|
||||||
|
if (row.scope === "数据字段") {
|
||||||
|
row.scope = 1
|
||||||
|
} else if (row.scope === '数据集') {
|
||||||
|
row.scope = 2
|
||||||
|
} else if (row.scope === '记录') {
|
||||||
|
row.scope = 3
|
||||||
|
}
|
||||||
|
if (row.activatedOrNot === '激活') {
|
||||||
|
row.activatedOrNot = "Y"
|
||||||
|
} else if (row.activatedOrNot === '未激活') {
|
||||||
|
row.activatedOrNot = "N"
|
||||||
|
}
|
||||||
|
if (row.status === '正常') {
|
||||||
|
row.status = "Y"
|
||||||
|
} else if (row.status === '停用') {
|
||||||
|
row.status = "N"
|
||||||
|
}
|
||||||
|
initializeRuleEngine(row).then(response => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.$message.success(response.msg)
|
||||||
|
} else {
|
||||||
|
this.$message.error(response.msg)
|
||||||
|
}
|
||||||
|
this.getList()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
toEngineVersion(row) {
|
||||||
|
console.log(row.id)
|
||||||
|
this.$router.push({path: `/rule/ruleEngine`,query:{id: row.id}})
|
||||||
|
},
|
||||||
/** 查询引擎维护列表 */
|
/** 查询引擎维护列表 */
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
|
@ -1,20 +1,63 @@
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
{{ruleEngineId}}
|
<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>
|
||||||
|
</div>
|
||||||
|
<div class="text item">
|
||||||
|
<encoding ref="encoding" style="height: 800px" :modification="modification"
|
||||||
|
:value="ruleEngineInfo.codeText"></encoding>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
|
||||||
|
<el-dialog
|
||||||
|
title="提示"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
width="20%">
|
||||||
|
<span style="font-size: 16px;align-content: center">确认保存吗?</span>
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="dialogVisible = false">取 消</el-button>
|
||||||
|
<el-button type="primary" @click="updRuleEngine">确 定</el-button>
|
||||||
|
</span>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import Encoding from "@/components/Encoding/index.vue";
|
||||||
|
import {getEngine} from "@/api/data/engine";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "EngineVersion",
|
name: "EngineVersion",
|
||||||
|
components: {Encoding},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
ruleEngineId: this.$route.params && this.$route.params.ruleEngineId,
|
dialogVisible: false,
|
||||||
|
ruleEngineId: this.$route.query.id,
|
||||||
|
ruleEngineInfo: {},
|
||||||
|
modification: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
this.getInfo()
|
||||||
},
|
},
|
||||||
methods: {}
|
methods: {
|
||||||
|
updRuleEngine() {
|
||||||
|
this.modification = parseInt(this.ruleEngineId)
|
||||||
|
setTimeout(() => {
|
||||||
|
this.modification = null
|
||||||
|
this.dialogVisible = false
|
||||||
|
}, 50)
|
||||||
|
},
|
||||||
|
getInfo() {
|
||||||
|
getEngine(this.$route.query.id).then(res => {
|
||||||
|
this.ruleEngineInfo = res.data
|
||||||
|
console.log(this.ruleEngineInfo)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue