feat: 规则引擎
parent
8b58d6775d
commit
9c86b8819d
|
@ -39,6 +39,7 @@
|
||||||
"@riophae/vue-treeselect": "0.4.0",
|
"@riophae/vue-treeselect": "0.4.0",
|
||||||
"axios": "0.24.0",
|
"axios": "0.24.0",
|
||||||
"clipboard": "2.0.8",
|
"clipboard": "2.0.8",
|
||||||
|
"codemirror": "^5.65.16",
|
||||||
"core-js": "3.25.3",
|
"core-js": "3.25.3",
|
||||||
"echarts": "5.4.0",
|
"echarts": "5.4.0",
|
||||||
"element-ui": "2.15.13",
|
"element-ui": "2.15.13",
|
||||||
|
@ -53,6 +54,7 @@
|
||||||
"screenfull": "5.0.2",
|
"screenfull": "5.0.2",
|
||||||
"sortablejs": "1.10.2",
|
"sortablejs": "1.10.2",
|
||||||
"vue": "2.6.12",
|
"vue": "2.6.12",
|
||||||
|
"vue-codemirror": "^4.0.6",
|
||||||
"vue-count-to": "1.0.13",
|
"vue-count-to": "1.0.13",
|
||||||
"vue-cropper": "0.5.5",
|
"vue-cropper": "0.5.5",
|
||||||
"vue-meta": "2.4.0",
|
"vue-meta": "2.4.0",
|
||||||
|
|
|
@ -8,3 +8,32 @@ export function findDictionaryByStructureId(id) {
|
||||||
params:id
|
params:id
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
export function addDictionaryType(data) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dict/addDictionaryType',
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function addDictionaryData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dict/addDictionaryData',
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function deleteDictionaryData(id) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dict/deleteDictionaryData?id='+id,
|
||||||
|
method: 'post',
|
||||||
|
params:id,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
export function updateDictionaryData(data) {
|
||||||
|
return request({
|
||||||
|
url: '/dataSource/dict/updateDictionaryData',
|
||||||
|
method: 'post',
|
||||||
|
data:data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
//查询规则配置作用域列表
|
||||||
|
export function listScope() {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/config/getScopeList',
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//查询规则配置作用域
|
||||||
|
export function getScope(query) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/config/getScopeInfo/'+query,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询引擎规则配置列表
|
||||||
|
export function listConfig(query) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/config/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 测试引擎规则配置
|
||||||
|
export function ruleTest(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/config/test',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增引擎规则配置
|
||||||
|
export function addConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/config',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改引擎规则配置
|
||||||
|
export function updateConfig(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/config/'+data.id,
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除引擎规则配置
|
||||||
|
export function delConfig(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/config/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询引擎维护列表
|
||||||
|
export function listMaintenance(query) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/maintenance/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询引擎维护详细
|
||||||
|
export function getMaintenance(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/maintenance/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增引擎维护
|
||||||
|
export function addMaintenance(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/maintenance',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改引擎维护
|
||||||
|
export function updateMaintenance(data) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/maintenance/'+data.id,
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除引擎维护
|
||||||
|
export function delMaintenance(id) {
|
||||||
|
return request({
|
||||||
|
url: '/ruleEngine/maintenance/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
|
@ -0,0 +1,94 @@
|
||||||
|
<template>
|
||||||
|
<div style="height: 800px">
|
||||||
|
<codemirror ref="codeMirror" v-model="code" :options="cmOptions" style="height: 800px"/>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {codemirror} from 'vue-codemirror'
|
||||||
|
import 'codemirror/mode/clike/clike';
|
||||||
|
// cm-setting.js
|
||||||
|
// 组件样式
|
||||||
|
import 'codemirror/lib/codemirror.css';
|
||||||
|
// 主题
|
||||||
|
import 'codemirror/theme/eclipse.css';
|
||||||
|
// import 'codemirror/theme/monokai.css';
|
||||||
|
|
||||||
|
// html代码高亮
|
||||||
|
import 'codemirror/mode/htmlmixed/htmlmixed.js';
|
||||||
|
|
||||||
|
// 语言模式
|
||||||
|
import 'codemirror/mode/javascript/javascript.js';
|
||||||
|
import 'codemirror/mode/css/css.js';
|
||||||
|
import 'codemirror/mode/xml/xml.js';
|
||||||
|
// 代码展开折叠
|
||||||
|
import 'codemirror/addon/fold/foldcode.js';
|
||||||
|
import 'codemirror/addon/fold/foldgutter.js';
|
||||||
|
import 'codemirror/addon/fold/foldgutter.css';
|
||||||
|
import 'codemirror/addon/fold/brace-fold.js';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
codemirror,
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
default: "",
|
||||||
|
type: String
|
||||||
|
},
|
||||||
|
readOnly: {
|
||||||
|
default: false,
|
||||||
|
type: Boolean
|
||||||
|
}
|
||||||
|
},
|
||||||
|
name: "Encoding",
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
codemirror: null,
|
||||||
|
code: this.value,
|
||||||
|
cmOptions: {
|
||||||
|
autoRefresh: true, // 重点是这句,为true
|
||||||
|
value: '', // 初始内容
|
||||||
|
mode: 'text/x-java', //实现Java代码高亮
|
||||||
|
tabSize: 4, // tab的空格宽度
|
||||||
|
styleActiveLine: true, // 设置光标所在行高亮true/false
|
||||||
|
lineNumbers: true, //显示行号
|
||||||
|
theme: 'eclipse', //设置主题cobalt/monokai
|
||||||
|
// json: true,
|
||||||
|
readOnly: this.readOnly, // 设置为只读true/false;也可设置为"nocursor"失去焦点
|
||||||
|
lineWrapping: false,
|
||||||
|
foldGutter: true,
|
||||||
|
gutters: [
|
||||||
|
'CodeMirror-lint-markers', //代码错误检测
|
||||||
|
'CodeMirror-linenumbers',
|
||||||
|
'CodeMirror-foldgutter', //展开折叠
|
||||||
|
],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
code: {
|
||||||
|
handler(val) {
|
||||||
|
this.$emit('input', val);
|
||||||
|
},
|
||||||
|
immediate: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
},
|
||||||
|
methods: {}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.CodeMirror {
|
||||||
|
font-family: 'JetBrainsMono-Medium', monospace;
|
||||||
|
height: 800px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.CodeMirror-lines {
|
||||||
|
line-height: 1.5; /* 这里的1.5是示例,表示行间距是字体大小的1.5倍 */
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -4,7 +4,6 @@ import Cookies from 'js-cookie'
|
||||||
|
|
||||||
import Element from 'element-ui'
|
import Element from 'element-ui'
|
||||||
import './assets/styles/element-variables.scss'
|
import './assets/styles/element-variables.scss'
|
||||||
|
|
||||||
import '@/assets/styles/index.scss' // global css
|
import '@/assets/styles/index.scss' // global css
|
||||||
import '@/assets/styles/muyu.scss' // muyu css
|
import '@/assets/styles/muyu.scss' // muyu css
|
||||||
import App from './App'
|
import App from './App'
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>资产模型详细信息</span>
|
<span>资产模型详细信息</span>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- {{structureId}}-->
|
||||||
<el-table
|
<el-table
|
||||||
:data="databaseTable"
|
:data="databaseTable"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
|
@ -55,13 +56,9 @@
|
||||||
placement="left"
|
placement="left"
|
||||||
width="200"
|
width="200"
|
||||||
trigger="hover">
|
trigger="hover">
|
||||||
<el-table :data="[
|
<el-table :data="thisDict[scope.row.dictKey]">
|
||||||
{ label: '男', value: '1' },
|
<el-table-column property="dictionaryName" label="字典标签"/>
|
||||||
{ label: '女', value: '2' },
|
<el-table-column dictionaryValue="value" label="字典值"/>
|
||||||
{ label: '未知', value: '0' },
|
|
||||||
]">
|
|
||||||
<el-table-column property="label" label="字典标签"/>
|
|
||||||
<el-table-column property="value" label="字典值"/>
|
|
||||||
</el-table>
|
</el-table>
|
||||||
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
||||||
</el-popover>
|
</el-popover>
|
||||||
|
@ -150,15 +147,15 @@
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item label="字典">
|
<el-form-item label="字典">
|
||||||
<el-select v-model="form.dictKey">
|
<el-select v-model="form.dictKey">
|
||||||
<el-option v-for="(value, key) in dictMap" :key="key" :label="key" :value="key"></el-option>
|
<el-option v-for="dictionary in dictionaryTypeList" :key="dictionary.id" :label="dictionary.dictionaryName" :value="dictionary.id"></el-option>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="24">
|
<el-col :span="24">
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-table :data="dictMap[form.dictKey]" striped border>
|
<el-table :data="thisDict" striped border>
|
||||||
<el-table-column property="label" label="字典标签"/>
|
<el-table-column property="dictionaryName" label="字典标签"/>
|
||||||
<el-table-column property="val" label="字典值"/>
|
<el-table-column property="dictionaryValue" label="字典值"/>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -193,6 +190,14 @@ export default {
|
||||||
value:Object,
|
value:Object,
|
||||||
default:{}
|
default:{}
|
||||||
},
|
},
|
||||||
|
structureId:{
|
||||||
|
value:Number,
|
||||||
|
default:0
|
||||||
|
},
|
||||||
|
dictionaryTypeList:{
|
||||||
|
value:Array,
|
||||||
|
default:[]
|
||||||
|
},
|
||||||
childrenList:{
|
childrenList:{
|
||||||
value:Array,
|
value:Array,
|
||||||
default:[]
|
default:[]
|
||||||
|
@ -202,17 +207,6 @@ export default {
|
||||||
return {
|
return {
|
||||||
form: {},
|
form: {},
|
||||||
formStatus: false,
|
formStatus: false,
|
||||||
dictMap: {
|
|
||||||
"system_sex": [
|
|
||||||
{ label: '男', val: '1', isEdit: false },
|
|
||||||
{ label: '女', val: '2', isEdit: false },
|
|
||||||
{ label: '未知', val: '0', isEdit: false },
|
|
||||||
],
|
|
||||||
"system_y_n": [
|
|
||||||
{ label: '是', val: '1', isEdit: false },
|
|
||||||
{ label: '否', val: '0', isEdit: false }
|
|
||||||
],
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
watch:{
|
||||||
|
@ -235,11 +229,11 @@ export default {
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// this.findDataBaseByInformationId()
|
// this.findDataBaseByInformationId()
|
||||||
// this.init();
|
this.init();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
init(){
|
init(){
|
||||||
|
console.log("123",this.dictionaryTypeList)
|
||||||
},
|
},
|
||||||
update(row) {
|
update(row) {
|
||||||
this.form = row;
|
this.form = row;
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<el-input v-model="dictAddName"></el-input>
|
<el-input v-model="dictAddName"></el-input>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="6">
|
<el-col :span="6">
|
||||||
<el-button @click="addDict(bb,dictAddName)">确定</el-button>
|
<el-button @click="addDict(structureId,dictAddName)">确定</el-button>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-button style="float: right; padding: 3px 0" type="text" slot="reference" >新增字典</el-button>
|
<el-button style="float: right; padding: 3px 0" type="text" slot="reference" >新增字典</el-button>
|
||||||
|
@ -68,7 +68,7 @@
|
||||||
>新增</el-button>
|
>新增</el-button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table :data="item.dictionaryDataList" style="width: 100%" height="280px">
|
<el-table :data="item.dictionaryDataL0t" style="width: 100%" height="280px">
|
||||||
<el-table-column prop="dictionaryName" label="标签">
|
<el-table-column prop="dictionaryName" label="标签">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<span v-if="scope.row.status === 0">{{scope.row.dictionaryLabel}}</span>
|
<span v-if="scope.row.status === 0">{{scope.row.dictionaryLabel}}</span>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<el-input v-if="scope.row.status === 1" v-model="scope.row.dictionaryValue" size="mini"></el-input>
|
<el-input v-if="scope.row.status === 1" v-model="scope.row.dictionaryValue" size="mini"></el-input>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="val" label="操作">
|
<el-table-column prop="val" label="操作 ">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
v-if="scope.row.status === 0"
|
v-if="scope.row.status === 0"
|
||||||
|
@ -97,6 +97,12 @@
|
||||||
type="text"
|
type="text"
|
||||||
icon="el-icon-finished"
|
icon="el-icon-finished"
|
||||||
>确定</el-button>
|
>确定</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="scope.row.status === 0"
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
@click="deleteConfirm(scope.row)"
|
||||||
|
>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
|
@ -121,12 +127,22 @@
|
||||||
import CountTo from 'vue-count-to'
|
import CountTo from 'vue-count-to'
|
||||||
import OverallAssetStructure from "@/views/dataSource/assets/OverallAssetStructure.vue";
|
import OverallAssetStructure from "@/views/dataSource/assets/OverallAssetStructure.vue";
|
||||||
import table from "table";
|
import table from "table";
|
||||||
|
import {
|
||||||
|
addDictionaryData,
|
||||||
|
addDictionaryType,
|
||||||
|
deleteDictionaryData,
|
||||||
|
updateDictionaryData
|
||||||
|
} from "@/api/dataSource/dictionary";
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "-"
|
default: "-"
|
||||||
},
|
},
|
||||||
|
structureId:{
|
||||||
|
type:Object,
|
||||||
|
default:0
|
||||||
|
},
|
||||||
num:{
|
num:{
|
||||||
type:Object,
|
type:Object,
|
||||||
default:0
|
default:0
|
||||||
|
@ -166,33 +182,67 @@ export default {
|
||||||
// console.log(this.databaseTable);
|
// console.log(this.databaseTable);
|
||||||
// },
|
// },
|
||||||
init(){
|
init(){
|
||||||
let rows = [
|
|
||||||
{
|
|
||||||
tableName: "sys_user",
|
|
||||||
tableAsName: "用户表"
|
|
||||||
},
|
},
|
||||||
{
|
deleteConfirm(row){
|
||||||
tableName: "sys_dept",
|
console.log(row)
|
||||||
tableAsName: "部门表"
|
deleteDictionaryData(row.id).then(
|
||||||
},
|
res=>{
|
||||||
];
|
this.$message.success(res.msg);
|
||||||
this.tableList = rows;
|
|
||||||
this.activeName = rows[0].tableName;
|
|
||||||
},
|
|
||||||
editConfirm(row){
|
|
||||||
if (!row.label || !row.val) {
|
|
||||||
this.$message.error('字典标签或字典值,不可为空');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
row.isEdit = false;
|
)
|
||||||
},
|
},
|
||||||
addDict(){
|
editConfirm(item,row){
|
||||||
|
console.log(item)
|
||||||
|
console.log(row)
|
||||||
|
|
||||||
|
if (row.id!=null) {
|
||||||
|
updateDictionaryData(row).then(
|
||||||
|
res=>{
|
||||||
|
this.$message.success(res.msg);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
let dictionaryDataList = {
|
||||||
|
dictionaryLabel:row.dictionaryLabel,
|
||||||
|
dictionaryValue:row.dictionaryValue,
|
||||||
|
dictionaryType:item.dictionaryType,
|
||||||
|
dictionaryName:item.dictionaryName,
|
||||||
|
}
|
||||||
|
addDictionaryData(dictionaryDataList).then(
|
||||||
|
res=>{
|
||||||
|
this.$message.success(res.msg);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
addDict(structureId,dictAddName){
|
||||||
|
console.log(structureId)
|
||||||
|
console.log(dictAddName)
|
||||||
if (!this.dictAddName){
|
if (!this.dictAddName){
|
||||||
this.$message.error('数据字典,不可为空');
|
this.$message.error('数据字典,不可为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.dictMap[this.dictAddName] = []
|
const dictAddNameArr= dictAddName.split(",");
|
||||||
this.dictAddName = null
|
const dictionaryType=dictAddNameArr[0];
|
||||||
|
const dictionaryName=dictAddNameArr[1];
|
||||||
|
|
||||||
|
console.log(dictionaryType)
|
||||||
|
console.log(dictionaryName)
|
||||||
|
let dictionaryTypeList = {
|
||||||
|
structureId,dictionaryType,dictionaryName,dictAddName
|
||||||
|
}
|
||||||
|
console.log(dictionaryTypeList)
|
||||||
|
addDictionaryType(dictionaryTypeList).then(
|
||||||
|
res=>{
|
||||||
|
this.$message.success(res.msg);
|
||||||
|
// this.dictionaryTypeList();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
// this.dictName[this.dictName.dictionaryTypes] = []
|
||||||
|
// this.dictName.dictionaryTypes = null
|
||||||
},
|
},
|
||||||
handleSetLineChartData(type) {
|
handleSetLineChartData(type) {
|
||||||
this.$emit('handleSetLineChartData', type)
|
this.$emit('handleSetLineChartData', type)
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
<el-container>
|
<el-container>
|
||||||
<el-main>
|
<el-main>
|
||||||
<overall-assets v-if="showAssets==null" :sum="sum"/>
|
<overall-assets v-if="showAssets==null" :sum="sum"/>
|
||||||
<overall-specific-assets v-if="showAssets === 0" :dictionaryTypeList="dictionaryTypeList" :num="num" :dataTotal="dataTotal" :databaseTableInformationList="databaseTableInformationList" :title="title"/>
|
<overall-specific-assets v-if="showAssets === 0" :structureId="structureId" :dictionaryTypeList="dictionaryTypeList" :num="num" :dataTotal="dataTotal" :databaseTableInformationList="databaseTableInformationList" :title="title"/>
|
||||||
<overall-asset-structure v-if="showAssets === 1" :databaseTable="databaseTable" :databaseTableInformation="databaseTableInformation" :childrenList="childrenList" :title="title"/>
|
<overall-asset-structure v-if="showAssets === 1" :structureId="structureId" :dictionaryTypeList="dictionaryTypeList" :databaseTable="databaseTable" :databaseTableInformation="databaseTableInformation" :childrenList="childrenList" :title="title"/>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
@ -27,7 +27,6 @@ import OverallSpecificAssets from "@/views/dataSource/assets/OverallSpecificAsse
|
||||||
import OverallAssets from "@/views/dataSource/assets/OverallAssets.vue";
|
import OverallAssets from "@/views/dataSource/assets/OverallAssets.vue";
|
||||||
import {
|
import {
|
||||||
findAssetStructure, findDataBaseByAssetId, findDataBaseByInformationId, findDataBaseTable,
|
findAssetStructure, findDataBaseByAssetId, findDataBaseByInformationId, findDataBaseTable,
|
||||||
findDataBaseTableById,
|
|
||||||
findInformationById
|
findInformationById
|
||||||
} from "@/api/dataSource/source";
|
} from "@/api/dataSource/source";
|
||||||
import OverallAssetStructure from "@/views/dataSource/assets/OverallAssetStructure.vue";
|
import OverallAssetStructure from "@/views/dataSource/assets/OverallAssetStructure.vue";
|
||||||
|
@ -55,6 +54,7 @@ export default {
|
||||||
num:0,
|
num:0,
|
||||||
dataTotal:0,
|
dataTotal:0,
|
||||||
dictionaryTypeList:[],
|
dictionaryTypeList:[],
|
||||||
|
structureId:0,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -77,7 +77,7 @@ export default {
|
||||||
)
|
)
|
||||||
findDictionaryByStructureId(data.id).then(
|
findDictionaryByStructureId(data.id).then(
|
||||||
res=>{
|
res=>{
|
||||||
console.log(data.id)
|
this.structureId=data.id;
|
||||||
this.dictionaryTypeList=res.data;
|
this.dictionaryTypeList=res.data;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
<template>
|
||||||
|
<el-col :span="22" :offset="1">
|
||||||
|
<el-card>
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>公共配置</span>
|
||||||
|
</div>
|
||||||
|
<el-form ref="form" :model="ruleEngineCommonConfig" label-width="120px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规则基础目录">
|
||||||
|
<el-input v-model="ruleEngineCommonConfig.packageName" disabled></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
</el-card>
|
||||||
|
<el-col>
|
||||||
|
<el-card>
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>作用域</span>
|
||||||
|
</div>
|
||||||
|
<el-tabs type="border-card" v-model="activeName">
|
||||||
|
<el-tab-pane :key="index" v-for="(scope,index) in scopeList" :label="scope.type" :name="index+''">
|
||||||
|
<encoding v-if="activeName===index.toString()" style="height: 600px" v-model="scope.code" :read-only="true"></encoding>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
</el-card>
|
||||||
|
</el-col>
|
||||||
|
</el-col>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import Encoding from "@/components/Encoding/index.vue";
|
||||||
|
import {listScope} from "@/api/rule_engine/config";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "config",
|
||||||
|
components: {Encoding},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
activeName: '0',
|
||||||
|
ruleEngineCommonConfig: {
|
||||||
|
packageName: "com.ruoyi.ruleEngine",
|
||||||
|
},
|
||||||
|
scopeList: []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getList(){
|
||||||
|
listScope().then(response=>{
|
||||||
|
this.scopeList=response.data;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.el-col {
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,386 @@
|
||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||||
|
<el-form-item label="规则名称" prop="name" >
|
||||||
|
<el-input style="width:190px"
|
||||||
|
v-model="queryParams.name"
|
||||||
|
placeholder="请输入规则名称"
|
||||||
|
clearable
|
||||||
|
@keyup.enter.native="handleQuery"
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规则类型" prop="type" >
|
||||||
|
<el-select v-model="queryParams.type" placeholder="请选择规则类型" style="width:190px" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.rule_engine_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="是否激活" prop="isActivate" >
|
||||||
|
<el-select v-model="queryParams.isActivate" placeholder="请选择是否激活" style="width:190px" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.rule_engine_activate_status"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="规则状态" prop="status" >
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择规则状态" style="width:190px" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['system:engine:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['system:engine:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="engineList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="规则名称" align="center" prop="name" />
|
||||||
|
<el-table-column label="规则类型" align="center" prop="type">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_type" :value="scope.row.type"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规则作用域" align="center" prop="scope">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_level" :value="scope.row.scope"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="引擎编码" align="center" prop="engineCode" />
|
||||||
|
<el-table-column label="是否激活" align="center" prop="isActivate">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.rule_engine_activate_status" :value="scope.row.isActivate"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="规则状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-takeaway-box"
|
||||||
|
@click="toEngineVersion(scope.row)"
|
||||||
|
v-hasPermi="['system:engine:edit']"
|
||||||
|
>规则维护</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['system:engine:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['system:engine:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改规则引擎对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="80%" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规则名称" prop="name">
|
||||||
|
<el-input v-model="form.name" placeholder="请输入规则名称" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规则编码" prop="code">
|
||||||
|
<el-input v-model="form.engineCode" placeholder="请输入规则编码" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规则类型" prop="type">
|
||||||
|
<el-select v-model="form.type" placeholder="请选择规则类型" style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.rule_engine_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规则级别" prop="scope">
|
||||||
|
<el-select v-model="form.scope" placeholder="请选择规则级别" style="width: 100%">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.rule_engine_level"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="是否激活" prop="isActivate">
|
||||||
|
<el-radio-group v-model="form.isActivate">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.rule_engine_activate_status"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="12">
|
||||||
|
<el-form-item label="规则状态" prop="status">
|
||||||
|
<el-radio-group v-model="form.status">
|
||||||
|
<el-radio
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.value"
|
||||||
|
>{{dict.label}}</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
<el-row>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="规则描述">
|
||||||
|
<editor v-model="form.description" :min-height="192"/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="24">
|
||||||
|
<el-form-item label="备注" prop="remark">
|
||||||
|
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
</el-row>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
import {addMaintenance, delMaintenance, listMaintenance, updateMaintenance} from "@/api/rule_engine/maintenance";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "maintenance",
|
||||||
|
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 规则引擎表格数据
|
||||||
|
engineList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
name: null,
|
||||||
|
type: null,
|
||||||
|
isActivate: null,
|
||||||
|
status: null,
|
||||||
|
description: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
name: [
|
||||||
|
{ required: true, message: "规则名称不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
type: [
|
||||||
|
{ required: true, message: "规则类型不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
engineCode: [
|
||||||
|
{ required: true, message: "规则编码不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
level: [
|
||||||
|
{ required: true, message: "规则级别不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
isActivate: [
|
||||||
|
{ required: true, message: "是否激活不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
status: [
|
||||||
|
{ required: true, message: "规则状态不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
createBy: [
|
||||||
|
{ required: true, message: "创建者不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
createTime: [
|
||||||
|
{ required: true, message: "创建时间不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
beforeRouteUpdate(to, from, next) {
|
||||||
|
// 在组件重用时重新加载数据
|
||||||
|
this.getList();
|
||||||
|
next();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
toEngineVersion(row){
|
||||||
|
this.$router.push({ path: `version/${row.id}`});
|
||||||
|
},
|
||||||
|
/** 查询规则引擎列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listMaintenance(this.queryParams).then(response=>{
|
||||||
|
this.engineList = response.data.rows;
|
||||||
|
this.total = response.data.total;
|
||||||
|
this.loading = false;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
name: null,
|
||||||
|
type: null,
|
||||||
|
scope:null,
|
||||||
|
engineCode:null,
|
||||||
|
isActivate: "N",
|
||||||
|
status: "0",
|
||||||
|
remark: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length !== 1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加规则引擎";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
this.form = row;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改规则引擎";
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateMaintenance(this.form).then(response=>{
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.getList();
|
||||||
|
this.open = false;
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
addMaintenance(this.form).then(response=>{
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.getList();
|
||||||
|
this.open = false;
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除规则引擎编号为"' + ids + '"的数据项?').then(() => {
|
||||||
|
delMaintenance(ids).then(response=>{
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
|
@ -0,0 +1,204 @@
|
||||||
|
<template>
|
||||||
|
<div>
|
||||||
|
<el-card style="width: 95%;margin-left: 35px;margin-top: 10px">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>引擎规则基本信息</span>
|
||||||
|
<el-button style="float: right" @click="goBack" size="medium" type="text">返回</el-button>
|
||||||
|
</div>
|
||||||
|
<el-descriptions border :column="3">
|
||||||
|
<el-descriptions-item label="规则名称">{{ruleInfo.name}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="规则编码">{{ruleInfo.engineCode}}</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="作用域"><dict-tag :options="dict.type.rule_engine_level" :value="ruleInfo.scope"/></el-descriptions-item>
|
||||||
|
<el-descriptions-item label="状态"><dict-tag :options="dict.type.sys_normal_disable" :value="ruleInfo.status"/></el-descriptions-item>
|
||||||
|
<el-descriptions-item label="是否激活"><dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleInfo.isActivate"/></el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
|
</el-card>
|
||||||
|
<el-card :body-style="{ padding: '0.3px' }" class="versionContainer" style="width: 95%;margin-left: 35px;margin-top: 10px">
|
||||||
|
<div slot="header" class="clearfix">
|
||||||
|
<span>规则内容</span>
|
||||||
|
<el-button style="float: right;margin-left: 5px" @click="handleDel" size="medium" type="text">删除此版本</el-button>
|
||||||
|
<el-button style="float: right;margin-left: 5px" @click="handleAdd" size="medium" type="text">新增版本</el-button>
|
||||||
|
<el-button style="float: right;margin-left: 5px" @click="()=>{this.visible=true;}" size="medium" type="text">测试规则</el-button>
|
||||||
|
<el-button style="float: right;margin-left: 5px" @click="saveContent" size="medium" type="text">保存此版本</el-button>
|
||||||
|
</div>
|
||||||
|
<div style="padding: 0!important;overflow: hidden;position: relative;">
|
||||||
|
<el-empty v-if="versionList.length===0" description="暂无规则内容" style="height: 450px"></el-empty>
|
||||||
|
<el-tabs v-else type="border-card" v-model="activeName" >
|
||||||
|
<el-tab-pane :key="index" v-for="(scope,index) in versionList" :label="scope.versionCode" :name="index+''">
|
||||||
|
<encoding v-if="activeName===index.toString()" style="height: 600px" v-model="scope.ruleContent" ></encoding>
|
||||||
|
</el-tab-pane>
|
||||||
|
</el-tabs>
|
||||||
|
<el-drawer
|
||||||
|
title="规则测试"
|
||||||
|
:visible.sync="visible"
|
||||||
|
:before-close="handleClose"
|
||||||
|
:lockScroll="false"
|
||||||
|
:modal="false"
|
||||||
|
direction="rtl"
|
||||||
|
style="position: absolute;"
|
||||||
|
>
|
||||||
|
<el-form >
|
||||||
|
<el-form-item label="测试数据" style="margin-left: 5px">
|
||||||
|
<el-input type="textarea" v-model="testData" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="测试结果" style="margin-left: 5px">
|
||||||
|
<el-input type="textarea" v-model="resData" ></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item style="margin-left: 5px">
|
||||||
|
<el-button type="primary" size="small" @click="handleTest">测试</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
</el-drawer>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
<!-- 添加或修改引擎规则配置对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="版本编码" prop="versionCode">
|
||||||
|
<el-input v-model="form.versionCode" placeholder="请输入版本编码" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="新增依据" prop="newBasis">
|
||||||
|
<el-select v-model="form.newBasis" placeholder="请选择新增依据" style="width: 100%" @change="handlerChange">
|
||||||
|
<el-option :key="-1" label="克隆公共配置" value="-1"></el-option>
|
||||||
|
<el-option
|
||||||
|
v-for="(item,index) in versionList"
|
||||||
|
:key="index"
|
||||||
|
:label="'克隆'+item.versionCode+'版本'"
|
||||||
|
:value="index">
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {getMaintenance} from "@/api/rule_engine/maintenance";
|
||||||
|
import Encoding from "@/components/Encoding/index.vue";
|
||||||
|
import {addConfig, delConfig, getScope, listConfig, ruleTest, updateConfig} from "@/api/rule_engine/config";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "version",
|
||||||
|
components: {Encoding},
|
||||||
|
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
visible: false,
|
||||||
|
open:false,
|
||||||
|
configId: this.$route.params && this.$route.params.configId,
|
||||||
|
ruleInfo:{},
|
||||||
|
activeName:'0',
|
||||||
|
versionList:[],
|
||||||
|
title:'',
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
versionCode: [
|
||||||
|
{ required: true, message: "版本编码不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
newBasis: [
|
||||||
|
{ required: true, message: "新增依据不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
},
|
||||||
|
baseRuleContent:'',
|
||||||
|
testData:'1424587994@163com,2949451835@qq.com',
|
||||||
|
resData:''
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getInfo();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getInfo() {
|
||||||
|
getMaintenance(this.configId).then(response => {
|
||||||
|
this.ruleInfo = response.data;
|
||||||
|
})
|
||||||
|
listConfig({engineMaintenanceId: this.configId}).then(response => {
|
||||||
|
this.versionList = response.data;
|
||||||
|
})
|
||||||
|
getScope(0).then(response=>{
|
||||||
|
this.baseRuleContent=response.data.code;
|
||||||
|
})
|
||||||
|
},
|
||||||
|
goBack() {
|
||||||
|
this.$router.go(-1);
|
||||||
|
},
|
||||||
|
saveContent() {
|
||||||
|
updateConfig(this.versionList[Number(this.activeName)]).then(response => {
|
||||||
|
this.$message.success("保存成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
versionCode: null,
|
||||||
|
engineMaintenanceId: null,
|
||||||
|
newBasis:null,
|
||||||
|
ruleContent:null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.form.engineMaintenanceId=this.ruleInfo.id;
|
||||||
|
this.title = "添加引擎规则配置";
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
addConfig(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getInfo();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handlerChange(val){
|
||||||
|
if(val!=='-1'){
|
||||||
|
this.form.ruleContent=this.versionList[Number(val)].ruleContent;
|
||||||
|
}else {
|
||||||
|
this.form.ruleContent=this.baseRuleContent;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
handleDel() {
|
||||||
|
let data=this.versionList[Number(this.activeName)];
|
||||||
|
this.$modal.confirm('是否确认删除版本编号为"' + data.versionCode + '"的数据项?').then(function() {
|
||||||
|
return delConfig(data.id);
|
||||||
|
}).then(() => {
|
||||||
|
this.getInfo();
|
||||||
|
this.activeName='0';
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
handleTest() {
|
||||||
|
ruleTest({id:this.versionList[Number(this.activeName)].id,list:this.testData.split(',')}).then(response=>{
|
||||||
|
this.resData=response.data;
|
||||||
|
this.$message.success("测试成功");
|
||||||
|
})
|
||||||
|
},
|
||||||
|
handleClose() {
|
||||||
|
this.visible=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
</style>
|
Loading…
Reference in New Issue