Compare commits
2 Commits
8b58d6775d
...
143e5be5d9
Author | SHA1 | Date |
---|---|---|
|
143e5be5d9 | |
|
9c86b8819d |
|
@ -39,6 +39,7 @@
|
|||
"@riophae/vue-treeselect": "0.4.0",
|
||||
"axios": "0.24.0",
|
||||
"clipboard": "2.0.8",
|
||||
"codemirror": "^5.65.16",
|
||||
"core-js": "3.25.3",
|
||||
"echarts": "5.4.0",
|
||||
"element-ui": "2.15.13",
|
||||
|
@ -53,6 +54,7 @@
|
|||
"screenfull": "5.0.2",
|
||||
"sortablejs": "1.10.2",
|
||||
"vue": "2.6.12",
|
||||
"vue-codemirror": "^4.0.6",
|
||||
"vue-count-to": "1.0.13",
|
||||
"vue-cropper": "0.5.5",
|
||||
"vue-meta": "2.4.0",
|
||||
|
|
|
@ -8,3 +8,32 @@ export function findDictionaryByStructureId(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
|
||||
})
|
||||
}
|
||||
|
|
|
@ -116,3 +116,11 @@ export function dataBaseTableInformation(){
|
|||
method:'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function updateDatabaseTable(data){
|
||||
return request({
|
||||
url:'dataSource/source/updateDatabaseTable',
|
||||
method:'post',
|
||||
data:data,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询规则引擎列表
|
||||
export function listRuleengine(query) {
|
||||
return request({
|
||||
url: '/ruleengine/ruleengine/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询规则引擎详细
|
||||
export function getRuleengine(id) {
|
||||
return request({
|
||||
url: '/ruleengine/ruleengine/' + id,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function ruleengine(content) {
|
||||
return request({
|
||||
url: `/ruleengine/ruleengine/compiler`,
|
||||
method: 'post',
|
||||
data:content
|
||||
})
|
||||
}
|
||||
|
||||
export function getRuleContent(ruleId) {
|
||||
return request({
|
||||
url: `/ruleengine/ruleengine/getRuleContent?ruleId=`+ruleId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function loader() {
|
||||
return request({
|
||||
url: `/ruleengine/ruleengine/loader`,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
// 新增规则引擎
|
||||
export function addRuleengine(data) {
|
||||
return request({
|
||||
url: '/ruleengine/ruleengine',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改规则引擎
|
||||
export function updateRuleengine(data) {
|
||||
return request({
|
||||
url: '/ruleengine/ruleengine/'+data.id,
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除规则引擎
|
||||
export function delRuleengine(id) {
|
||||
return request({
|
||||
url: '/ruleengine/ruleengine/' + 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 './assets/styles/element-variables.scss'
|
||||
|
||||
import '@/assets/styles/index.scss' // global css
|
||||
import '@/assets/styles/muyu.scss' // muyu css
|
||||
import App from './App'
|
||||
|
|
|
@ -17,9 +17,11 @@
|
|||
<div slot="header" class="clearfix">
|
||||
<span>资产模型详细信息</span>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:data="databaseTable"
|
||||
style="width: 100%;">
|
||||
{{databaseTable}}
|
||||
<el-table-column prop="name" label="名称" />
|
||||
<el-table-column prop="comment" label="注释" />
|
||||
<el-table-column prop="isPrimaryKey" label="是否主键" >
|
||||
|
@ -55,13 +57,9 @@
|
|||
placement="left"
|
||||
width="200"
|
||||
trigger="hover">
|
||||
<el-table :data="[
|
||||
{ label: '男', value: '1' },
|
||||
{ label: '女', value: '2' },
|
||||
{ label: '未知', value: '0' },
|
||||
]">
|
||||
<el-table :data="dictMap[scope.row.dictKey]">
|
||||
<el-table-column property="label" label="字典标签"/>
|
||||
<el-table-column property="value" label="字典值"/>
|
||||
<el-table-column property="val" label="字典值"/>
|
||||
</el-table>
|
||||
<el-tag slot="reference">{{scope.row.dictKey}}</el-tag>
|
||||
</el-popover>
|
||||
|
@ -76,6 +74,7 @@
|
|||
</el-card>
|
||||
<el-dialog title="资产结构修改" width="80%" :visible.sync="formStatus">
|
||||
<el-form :model="form" label-width="120px">
|
||||
{{form}}
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="名称">
|
||||
|
@ -129,11 +128,6 @@
|
|||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="映射字段">
|
||||
<el-input v-model="form.mappingType" readonly autocomplete="off"></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否字典">
|
||||
<el-switch
|
||||
|
@ -166,13 +160,13 @@
|
|||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="formStatus = false">取 消</el-button>
|
||||
<el-button type="primary" @click="formStatus = false">确 定</el-button>
|
||||
<el-button type="primary" @click="updateDatabaseTable(form)">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {findDataBaseByInformationId} from "@/api/dataSource/source";
|
||||
import {findDataBaseByInformationId, updateDatabaseTable} from "@/api/dataSource/source";
|
||||
|
||||
export default {
|
||||
name: 'OverallAssetStructure',
|
||||
|
@ -193,6 +187,14 @@ export default {
|
|||
value:Object,
|
||||
default:{}
|
||||
},
|
||||
structureId:{
|
||||
value:Object,
|
||||
default:0
|
||||
},
|
||||
dictionaryTypeList:{
|
||||
value:Array,
|
||||
default:[]
|
||||
},
|
||||
childrenList:{
|
||||
value:Array,
|
||||
default:[]
|
||||
|
@ -202,23 +204,12 @@ export default {
|
|||
return {
|
||||
form: {},
|
||||
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 }
|
||||
],
|
||||
}
|
||||
dictMap:{}
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
table:{
|
||||
handler(val){
|
||||
console.log("res",val)
|
||||
if (val!=null){
|
||||
findDataBaseByInformationId(val.id).then(
|
||||
res=>{
|
||||
|
@ -231,15 +222,35 @@ export default {
|
|||
|
||||
},
|
||||
immediate:true
|
||||
},
|
||||
"dictionaryTypeList": {
|
||||
handler(val) {
|
||||
val.forEach(item => {
|
||||
const key = `${item.dictionaryName.toLowerCase().replace(/ /g, '_')}`; // 构造 key
|
||||
this.$set(this.dictMap, key, item.dictionaryDataList.map(dataModel => ({
|
||||
label: dataModel.dictionaryLabel,
|
||||
val: dataModel.dictionaryValue,
|
||||
status: dataModel.status
|
||||
})));
|
||||
});
|
||||
},
|
||||
immediate: true
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.findDataBaseByInformationId()
|
||||
// this.init();
|
||||
this.init();
|
||||
},
|
||||
methods:{
|
||||
updateDatabaseTable(form){
|
||||
updateDatabaseTable(form).then(
|
||||
res=>{
|
||||
this.$message.success(res.msg);
|
||||
this.formStatus=false
|
||||
this.table();
|
||||
}
|
||||
)
|
||||
},
|
||||
init(){
|
||||
|
||||
},
|
||||
update(row) {
|
||||
this.form = row;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<el-row :gutter="40" class="panel-group">
|
||||
<div class="title-header">
|
||||
{{title}} - 资产结构概述
|
||||
{{title}} - 资产结构概述{{structureId}}
|
||||
</div>
|
||||
<el-col :sm="12" :xs="12" class="card-panel-col">
|
||||
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
||||
|
@ -50,7 +50,7 @@
|
|||
<el-input v-model="dictAddName"></el-input>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-button @click="addDict(bb,dictAddName)">确定</el-button>
|
||||
<el-button @click="addDict(structureId,dictAddName)">确定</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-button style="float: right; padding: 3px 0" type="text" slot="reference" >新增字典</el-button>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<el-input v-if="scope.row.status === 1" v-model="scope.row.dictionaryValue" size="mini"></el-input>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="val" label="操作">
|
||||
<el-table-column prop="val" label="操作 ">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
v-if="scope.row.status === 0"
|
||||
|
@ -97,6 +97,12 @@
|
|||
type="text"
|
||||
icon="el-icon-finished"
|
||||
>确定</el-button>
|
||||
<el-button
|
||||
v-if="scope.row.status === 0"
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="deleteConfirm(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
@ -109,7 +115,7 @@
|
|||
<el-col :span="24" style="margin-top: 20px">
|
||||
<el-tabs :value="activeName" type="border-card" >
|
||||
<el-tab-pane v-for="(table,index) in databaseTableInformationList" :label="table.name+'('+table.as+')'" :name="index+''" >
|
||||
<OverallAssetStructure :table="table"/>
|
||||
<OverallAssetStructure :table="table" :dictionaryTypeList="dictionaryTypeList" />
|
||||
</el-tab-pane>
|
||||
</el-tabs>
|
||||
</el-col>
|
||||
|
@ -121,12 +127,22 @@
|
|||
import CountTo from 'vue-count-to'
|
||||
import OverallAssetStructure from "@/views/dataSource/assets/OverallAssetStructure.vue";
|
||||
import table from "table";
|
||||
import {
|
||||
addDictionaryData,
|
||||
addDictionaryType,
|
||||
deleteDictionaryData,
|
||||
updateDictionaryData
|
||||
} from "@/api/dataSource/dictionary";
|
||||
export default {
|
||||
props: {
|
||||
title: {
|
||||
type: String,
|
||||
default: "-"
|
||||
},
|
||||
structureId:{
|
||||
type:Object,
|
||||
default:0
|
||||
},
|
||||
num:{
|
||||
type:Object,
|
||||
default:0
|
||||
|
@ -166,33 +182,67 @@ export default {
|
|||
// console.log(this.databaseTable);
|
||||
// },
|
||||
init(){
|
||||
let rows = [
|
||||
{
|
||||
tableName: "sys_user",
|
||||
tableAsName: "用户表"
|
||||
},
|
||||
{
|
||||
tableName: "sys_dept",
|
||||
tableAsName: "部门表"
|
||||
},
|
||||
];
|
||||
this.tableList = rows;
|
||||
this.activeName = rows[0].tableName;
|
||||
|
||||
},
|
||||
editConfirm(row){
|
||||
if (!row.label || !row.val) {
|
||||
this.$message.error('字典标签或字典值,不可为空');
|
||||
deleteConfirm(row){
|
||||
// console.log(row)
|
||||
deleteDictionaryData(row.id).then(
|
||||
res=>{
|
||||
this.$message.success(res.msg);
|
||||
}
|
||||
)
|
||||
},
|
||||
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);
|
||||
}
|
||||
)
|
||||
}
|
||||
row.isEdit = false;
|
||||
|
||||
},
|
||||
addDict(){
|
||||
addDict(structureId,dictAddName){
|
||||
console.log(structureId)
|
||||
console.log(dictAddName)
|
||||
if (!this.dictAddName){
|
||||
this.$message.error('数据字典,不可为空');
|
||||
return;
|
||||
}
|
||||
this.dictMap[this.dictAddName] = []
|
||||
this.dictAddName = null
|
||||
const dictAddNameArr= dictAddName.split(",");
|
||||
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) {
|
||||
this.$emit('handleSetLineChartData', type)
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
<el-container>
|
||||
<el-main>
|
||||
<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-asset-structure v-if="showAssets === 1" :databaseTable="databaseTable" :databaseTableInformation="databaseTableInformation" :childrenList="childrenList" :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" :structureId="structureId" :dictionaryTypeList="dictionaryTypeList" :databaseTable="databaseTable" :databaseTableInformation="databaseTableInformation" :childrenList="childrenList" :title="title"/>
|
||||
</el-main>
|
||||
</el-container>
|
||||
</el-container>
|
||||
|
@ -27,7 +27,6 @@ import OverallSpecificAssets from "@/views/dataSource/assets/OverallSpecificAsse
|
|||
import OverallAssets from "@/views/dataSource/assets/OverallAssets.vue";
|
||||
import {
|
||||
findAssetStructure, findDataBaseByAssetId, findDataBaseByInformationId, findDataBaseTable,
|
||||
findDataBaseTableById,
|
||||
findInformationById
|
||||
} from "@/api/dataSource/source";
|
||||
import OverallAssetStructure from "@/views/dataSource/assets/OverallAssetStructure.vue";
|
||||
|
@ -35,7 +34,7 @@ import {findDictionaryByStructureId} from "@/api/dataSource/dictionary";
|
|||
|
||||
export default {
|
||||
name: 'assets',
|
||||
components: {OverallAssetStructure, OverallSpecificAssets, OverallAssets },
|
||||
components: {OverallAssetStructure, OverallSpecificAssets, OverallAssets },
|
||||
data() {
|
||||
return {
|
||||
mainHeight: window.innerHeight - 85,
|
||||
|
@ -55,6 +54,7 @@ export default {
|
|||
num:0,
|
||||
dataTotal:0,
|
||||
dictionaryTypeList:[],
|
||||
structureId:0,
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
@ -77,8 +77,10 @@ export default {
|
|||
)
|
||||
findDictionaryByStructureId(data.id).then(
|
||||
res=>{
|
||||
console.log(data.id)
|
||||
this.structureId=data.id;
|
||||
console.log("res",this.structureId)
|
||||
this.dictionaryTypeList=res.data;
|
||||
console.log(this.dictionaryTypeList)
|
||||
}
|
||||
)
|
||||
findDataBaseTable(data.id).then(
|
||||
|
@ -96,7 +98,7 @@ export default {
|
|||
res=>{
|
||||
|
||||
this.databaseTable=res.data;
|
||||
console.log("res",this.databaseTable)
|
||||
// console.log("res",this.databaseTable)
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
<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="codeCardStatus">
|
||||
<el-tab-pane v-for="scope in scopeList" :label="scope.type" :name="scope.value">
|
||||
<encoding v-if="codeCardStatus === scope.value" style="height: 800px" 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";
|
||||
|
||||
export default {
|
||||
name: "EngineConfig",
|
||||
components: {Encoding},
|
||||
data() {
|
||||
return {
|
||||
codeCardStatus: "taskContext",
|
||||
ruleEngineCommonConfig: {
|
||||
packageName: "com.muyu.rule.engine",
|
||||
},
|
||||
scopeList: [
|
||||
{ type: "任务", value: "taskContext", "code":
|
||||
"package com.muyu.scope;\n" +
|
||||
"\n" +
|
||||
"/**\n" +
|
||||
" * @Author: DongZeLiang\n" +
|
||||
" * @date: 2024/4/29\n" +
|
||||
" * @Description: 任务上下文\n" +
|
||||
" * @Version: 1.0\n" +
|
||||
" */\n" +
|
||||
"public class TaskContext {\n" +
|
||||
"\n" +
|
||||
" public static TaskContext build(){\n" +
|
||||
" return new TaskContext();\n" +
|
||||
" }\n" +
|
||||
"}\n"
|
||||
},
|
||||
{ type: "资产集", value: "recordContext", "code":
|
||||
"package com.muyu.scope;\n" +
|
||||
"\n" +
|
||||
"/**\n" +
|
||||
" * @Author: DongZeLiang\n" +
|
||||
" * @date: 2024/4/29\n" +
|
||||
" * @Description: 数据集\n" +
|
||||
" * @Version: 1.0\n" +
|
||||
" */\n" +
|
||||
"public class DataSetContext {\n" +
|
||||
"\n" +
|
||||
" private final RecordContext recordContext;\n" +
|
||||
"\n" +
|
||||
" public DataSetContext (RecordContext recordContext) {\n" +
|
||||
" this.recordContext = recordContext;\n" +
|
||||
" }\n" +
|
||||
"}\n" },
|
||||
{ type: "资产记录", value: "dataSetContext", "code":
|
||||
"package com.muyu.scope;\n" +
|
||||
"\n" +
|
||||
"/**\n" +
|
||||
" * @Author: DongZeLiang\n" +
|
||||
" * @date: 2024/4/29\n" +
|
||||
" * @Description: 记录/资产模型\n" +
|
||||
" * @Version: 1.0\n" +
|
||||
" */\n" +
|
||||
"public class RecordContext {\n" +
|
||||
"\n" +
|
||||
" private final TaskContext taskContext;\n" +
|
||||
"\n" +
|
||||
" public RecordContext (TaskContext taskContext) {\n" +
|
||||
" this.taskContext = taskContext;\n" +
|
||||
" }\n" +
|
||||
"}\n" },
|
||||
{ type: "资产模型", value: "dataModelContext", "code":
|
||||
"package com.muyu.scope;\n" +
|
||||
"\n" +
|
||||
"/**\n" +
|
||||
" * @Author: DongZeLiang\n" +
|
||||
" * @date: 2024/4/29\n" +
|
||||
" * @Description: 数据模型\n" +
|
||||
" * @Version: 1.0\n" +
|
||||
" */\n" +
|
||||
"public class DataModelContext {\n" +
|
||||
"\n" +
|
||||
" private final DataSetContext dataSetContext;\n" +
|
||||
"\n" +
|
||||
" public DataModelContext (DataSetContext dataSetContext) {\n" +
|
||||
" this.dataSetContext = dataSetContext;\n" +
|
||||
" }\n" +
|
||||
"}\n" }
|
||||
]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
},
|
||||
methods: {}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-col {
|
||||
margin-top: 20px;
|
||||
}
|
||||
</style>
|
|
@ -0,0 +1,78 @@
|
|||
<template>
|
||||
<div>
|
||||
{{ruleEngineId}}
|
||||
<div ref="editor" style="height: 300px; border: 1px solid #ccc; padding: 10px;"></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import 'codemirror/lib/codemirror.css';
|
||||
import 'codemirror/mode/javascript/javascript.js';
|
||||
import CodeMirror from 'codemirror';
|
||||
import {getRuleContent, ruleengine} from "@/api/ruleengine/ruleengine";
|
||||
export default {
|
||||
name: "EngineVersion",
|
||||
data() {
|
||||
return {
|
||||
ruleEngineId:0,
|
||||
editor: null,
|
||||
ruleContentReq:{},
|
||||
value:''
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'$route.query.id': function(toVal, oldVal) {
|
||||
this.ruleEngineId = toVal;
|
||||
if (this.ruleEngineId) {
|
||||
this.getRuleContentAndUpdateEditor();
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.ruleEngineId=this.$route.query && this.$route.query.id
|
||||
// 初始化 CodeMirror(如果尚未初始化)
|
||||
if (!this.editor) {
|
||||
this.$nextTick(() => {
|
||||
this.editor = CodeMirror(this.$refs.editor, {
|
||||
value: "",
|
||||
mode: "javascript",
|
||||
lineNumbers: true,
|
||||
});
|
||||
if (this.ruleEngineId) {
|
||||
this.getRuleContentAndUpdateEditor();
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getRuleContentAndUpdateEditor() {
|
||||
getRuleContent(this.ruleEngineId).then(
|
||||
res => {
|
||||
if (res && res.data && res.data.ruleContent) {
|
||||
console.log('Received rule content:', res.data.ruleContent);
|
||||
this.editor.setValue(res.data.ruleContent);
|
||||
} else {
|
||||
console.log('No rule content found for id', this.ruleEngineId);
|
||||
}
|
||||
}
|
||||
).catch(error => {
|
||||
console.error('Error fetching rule content:', error);
|
||||
});
|
||||
},
|
||||
tosend(){
|
||||
const code = this.editor.getValue();
|
||||
this.ruleContentReq.ruleContent=code
|
||||
console.log(this.ruleContentReq)
|
||||
ruleengine(this.ruleContentReq).then(
|
||||
res=>{
|
||||
this.$message.success(res.data)
|
||||
}
|
||||
)
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
|
@ -0,0 +1,483 @@
|
|||
<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
|
||||
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="请选择规则类型" 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="请选择是否激活" 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="请选择规则状态" 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>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="warning"
|
||||
plain
|
||||
icon="el-icon-download"
|
||||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['system:engine:export']"
|
||||
>导出
|
||||
</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="level">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.rule_engine_level" :value="scope.row.level"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="引擎编码" align="center" prop="code"/>
|
||||
<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"
|
||||
@click="loader(scope.row)"
|
||||
>加载
|
||||
</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
@click="addEngine(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
|
||||
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.code" 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="level">
|
||||
<el-select v-model="form.level" 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>
|
||||
|
||||
<!--编写代码-->
|
||||
<el-dialog
|
||||
title="代码编辑器"
|
||||
:visible.sync="dialogVisible"
|
||||
width="50%"
|
||||
>
|
||||
<div ref="editor" style="height: 300px; border: 1px solid #ccc; padding: 10px;"></div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="tosend">确 定</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import 'codemirror/lib/codemirror.css';
|
||||
import 'codemirror/mode/javascript/javascript.js';
|
||||
import CodeMirror from 'codemirror';
|
||||
import {
|
||||
addRuleengine,
|
||||
getRuleengine,
|
||||
listRuleengine,
|
||||
loader,
|
||||
ruleengine,
|
||||
updateRuleengine
|
||||
} from "@/api/ruleengine/ruleengine";
|
||||
|
||||
export default {
|
||||
name: "EngineMaintenance",
|
||||
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"}
|
||||
],
|
||||
code: [
|
||||
{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"}
|
||||
],
|
||||
},
|
||||
editor: null,
|
||||
isEditorVisible:false,
|
||||
dialogVisible:false,
|
||||
ruleContentReq:{}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
addEngine(row) {
|
||||
this.ruleContentReq.ruleId=row.id
|
||||
this.isEditorVisible = true
|
||||
this.dialogVisible = true;
|
||||
// 初始化 CodeMirror(如果尚未初始化)
|
||||
if (!this.editor) {
|
||||
this.$nextTick(() => {
|
||||
this.editor = CodeMirror(this.$refs.editor, {
|
||||
value: "public class Test {\n public boolean execute(String name) {\n if (name == null || name.length() == 0) {\n System.out.println(\"哈哈哈哈\");\n return true;\n }\n return false;\n }\n}",
|
||||
mode: "javascript",
|
||||
lineNumbers: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
loader(){
|
||||
loader().then(
|
||||
res=>{
|
||||
this.$message.success(res.data)
|
||||
}
|
||||
)
|
||||
},
|
||||
tosend(){
|
||||
const code = this.editor.getValue();
|
||||
this.ruleContentReq.ruleContent=code
|
||||
console.log(this.ruleContentReq)
|
||||
ruleengine(this.ruleContentReq).then(
|
||||
res=>{
|
||||
this.$message.success(res.data)
|
||||
}
|
||||
)
|
||||
},
|
||||
toEngineVersion(row) {
|
||||
console.log(row)
|
||||
this.$router.push({path: '/ruleengine/engineVersion', query: {id: row.id}});
|
||||
},
|
||||
/** 查询规则引擎列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listRuleengine(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,
|
||||
isActivate: "no-activate",
|
||||
status: "0",
|
||||
description: null,
|
||||
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();
|
||||
const id = row.id || this.ids
|
||||
getRuleengine(id).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改规则引擎";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id != null) {
|
||||
updateRuleengine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addRuleengine(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const ids = row.id || this.ids;
|
||||
this.$modal.confirm('是否确认删除规则引擎编号为"' + ids + '"的数据项?').then(function () {
|
||||
return delRuleengine(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('ruleengine/ruleengine/export', {
|
||||
...this.queryParams
|
||||
}, `ruleengine_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue