Compare commits
No commits in common. "143e5be5d9aa5d395aac44aaf493ce1250490e6f" and "8b58d6775d6362464531d1359a2a2bcc25495173" have entirely different histories.
143e5be5d9
...
8b58d6775d
|
@ -39,7 +39,6 @@
|
||||||
"@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",
|
||||||
|
@ -54,7 +53,6 @@
|
||||||
"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,32 +8,3 @@ 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
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
@ -116,11 +116,3 @@ export function dataBaseTableInformation(){
|
||||||
method:'get',
|
method:'get',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function updateDatabaseTable(data){
|
|
||||||
return request({
|
|
||||||
url:'dataSource/source/updateDatabaseTable',
|
|
||||||
method:'post',
|
|
||||||
data:data,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
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'
|
|
||||||
})
|
|
||||||
}
|
|
|
@ -1,94 +0,0 @@
|
||||||
<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,6 +4,7 @@ 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,11 +17,9 @@
|
||||||
<div slot="header" class="clearfix">
|
<div slot="header" class="clearfix">
|
||||||
<span>资产模型详细信息</span>
|
<span>资产模型详细信息</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-table
|
<el-table
|
||||||
:data="databaseTable"
|
:data="databaseTable"
|
||||||
style="width: 100%;">
|
style="width: 100%;">
|
||||||
{{databaseTable}}
|
|
||||||
<el-table-column prop="name" label="名称" />
|
<el-table-column prop="name" label="名称" />
|
||||||
<el-table-column prop="comment" label="注释" />
|
<el-table-column prop="comment" label="注释" />
|
||||||
<el-table-column prop="isPrimaryKey" label="是否主键" >
|
<el-table-column prop="isPrimaryKey" label="是否主键" >
|
||||||
|
@ -57,9 +55,13 @@
|
||||||
placement="left"
|
placement="left"
|
||||||
width="200"
|
width="200"
|
||||||
trigger="hover">
|
trigger="hover">
|
||||||
<el-table :data="dictMap[scope.row.dictKey]">
|
<el-table :data="[
|
||||||
|
{ label: '男', value: '1' },
|
||||||
|
{ label: '女', value: '2' },
|
||||||
|
{ label: '未知', value: '0' },
|
||||||
|
]">
|
||||||
<el-table-column property="label" label="字典标签"/>
|
<el-table-column property="label" label="字典标签"/>
|
||||||
<el-table-column property="val" 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>
|
||||||
|
@ -74,7 +76,6 @@
|
||||||
</el-card>
|
</el-card>
|
||||||
<el-dialog title="资产结构修改" width="80%" :visible.sync="formStatus">
|
<el-dialog title="资产结构修改" width="80%" :visible.sync="formStatus">
|
||||||
<el-form :model="form" label-width="120px">
|
<el-form :model="form" label-width="120px">
|
||||||
{{form}}
|
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="名称">
|
<el-form-item label="名称">
|
||||||
|
@ -128,6 +129,11 @@
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-row>
|
</el-row>
|
||||||
<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-col :span="12">
|
||||||
<el-form-item label="是否字典">
|
<el-form-item label="是否字典">
|
||||||
<el-switch
|
<el-switch
|
||||||
|
@ -160,13 +166,13 @@
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button @click="formStatus = false">取 消</el-button>
|
<el-button @click="formStatus = false">取 消</el-button>
|
||||||
<el-button type="primary" @click="updateDatabaseTable(form)">确 定</el-button>
|
<el-button type="primary" @click="formStatus = false">确 定</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import {findDataBaseByInformationId, updateDatabaseTable} from "@/api/dataSource/source";
|
import {findDataBaseByInformationId} from "@/api/dataSource/source";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OverallAssetStructure',
|
name: 'OverallAssetStructure',
|
||||||
|
@ -187,14 +193,6 @@ export default {
|
||||||
value:Object,
|
value:Object,
|
||||||
default:{}
|
default:{}
|
||||||
},
|
},
|
||||||
structureId:{
|
|
||||||
value:Object,
|
|
||||||
default:0
|
|
||||||
},
|
|
||||||
dictionaryTypeList:{
|
|
||||||
value:Array,
|
|
||||||
default:[]
|
|
||||||
},
|
|
||||||
childrenList:{
|
childrenList:{
|
||||||
value:Array,
|
value:Array,
|
||||||
default:[]
|
default:[]
|
||||||
|
@ -204,12 +202,23 @@ export default {
|
||||||
return {
|
return {
|
||||||
form: {},
|
form: {},
|
||||||
formStatus: false,
|
formStatus: false,
|
||||||
dictMap:{}
|
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:{
|
||||||
table:{
|
table:{
|
||||||
handler(val){
|
handler(val){
|
||||||
|
console.log("res",val)
|
||||||
if (val!=null){
|
if (val!=null){
|
||||||
findDataBaseByInformationId(val.id).then(
|
findDataBaseByInformationId(val.id).then(
|
||||||
res=>{
|
res=>{
|
||||||
|
@ -222,35 +231,15 @@ export default {
|
||||||
|
|
||||||
},
|
},
|
||||||
immediate:true
|
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() {
|
created() {
|
||||||
this.init();
|
// this.findDataBaseByInformationId()
|
||||||
|
// this.init();
|
||||||
},
|
},
|
||||||
methods:{
|
methods:{
|
||||||
updateDatabaseTable(form){
|
|
||||||
updateDatabaseTable(form).then(
|
|
||||||
res=>{
|
|
||||||
this.$message.success(res.msg);
|
|
||||||
this.formStatus=false
|
|
||||||
this.table();
|
|
||||||
}
|
|
||||||
)
|
|
||||||
},
|
|
||||||
init(){
|
init(){
|
||||||
|
|
||||||
},
|
},
|
||||||
update(row) {
|
update(row) {
|
||||||
this.form = row;
|
this.form = row;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<el-row :gutter="40" class="panel-group">
|
<el-row :gutter="40" class="panel-group">
|
||||||
<div class="title-header">
|
<div class="title-header">
|
||||||
{{title}} - 资产结构概述{{structureId}}
|
{{title}} - 资产结构概述
|
||||||
</div>
|
</div>
|
||||||
<el-col :sm="12" :xs="12" class="card-panel-col">
|
<el-col :sm="12" :xs="12" class="card-panel-col">
|
||||||
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
<div class="card-panel" @click="handleSetLineChartData('messages')">
|
||||||
|
@ -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(structureId,dictAddName)">确定</el-button>
|
<el-button @click="addDict(bb,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>
|
||||||
|
@ -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,12 +97,6 @@
|
||||||
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>
|
||||||
|
@ -115,7 +109,7 @@
|
||||||
<el-col :span="24" style="margin-top: 20px">
|
<el-col :span="24" style="margin-top: 20px">
|
||||||
<el-tabs :value="activeName" type="border-card" >
|
<el-tabs :value="activeName" type="border-card" >
|
||||||
<el-tab-pane v-for="(table,index) in databaseTableInformationList" :label="table.name+'('+table.as+')'" :name="index+''" >
|
<el-tab-pane v-for="(table,index) in databaseTableInformationList" :label="table.name+'('+table.as+')'" :name="index+''" >
|
||||||
<OverallAssetStructure :table="table" :dictionaryTypeList="dictionaryTypeList" />
|
<OverallAssetStructure :table="table"/>
|
||||||
</el-tab-pane>
|
</el-tab-pane>
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-col>
|
</el-col>
|
||||||
|
@ -127,22 +121,12 @@
|
||||||
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
|
||||||
|
@ -182,67 +166,33 @@ export default {
|
||||||
// console.log(this.databaseTable);
|
// console.log(this.databaseTable);
|
||||||
// },
|
// },
|
||||||
init(){
|
init(){
|
||||||
|
let rows = [
|
||||||
|
{
|
||||||
|
tableName: "sys_user",
|
||||||
|
tableAsName: "用户表"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tableName: "sys_dept",
|
||||||
|
tableAsName: "部门表"
|
||||||
|
},
|
||||||
|
];
|
||||||
|
this.tableList = rows;
|
||||||
|
this.activeName = rows[0].tableName;
|
||||||
},
|
},
|
||||||
deleteConfirm(row){
|
editConfirm(row){
|
||||||
// console.log(row)
|
if (!row.label || !row.val) {
|
||||||
deleteDictionaryData(row.id).then(
|
this.$message.error('字典标签或字典值,不可为空');
|
||||||
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;
|
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(structureId,dictAddName){
|
addDict(){
|
||||||
console.log(structureId)
|
|
||||||
console.log(dictAddName)
|
|
||||||
if (!this.dictAddName){
|
if (!this.dictAddName){
|
||||||
this.$message.error('数据字典,不可为空');
|
this.$message.error('数据字典,不可为空');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const dictAddNameArr= dictAddName.split(",");
|
this.dictMap[this.dictAddName] = []
|
||||||
const dictionaryType=dictAddNameArr[0];
|
this.dictAddName = null
|
||||||
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" :structureId="structureId" :dictionaryTypeList="dictionaryTypeList" :num="num" :dataTotal="dataTotal" :databaseTableInformationList="databaseTableInformationList" :title="title"/>
|
<overall-specific-assets v-if="showAssets === 0" :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"/>
|
<overall-asset-structure v-if="showAssets === 1" :databaseTable="databaseTable" :databaseTableInformation="databaseTableInformation" :childrenList="childrenList" :title="title"/>
|
||||||
</el-main>
|
</el-main>
|
||||||
</el-container>
|
</el-container>
|
||||||
</el-container>
|
</el-container>
|
||||||
|
@ -27,6 +27,7 @@ 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";
|
||||||
|
@ -34,7 +35,7 @@ import {findDictionaryByStructureId} from "@/api/dataSource/dictionary";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'assets',
|
name: 'assets',
|
||||||
components: {OverallAssetStructure, OverallSpecificAssets, OverallAssets },
|
components: {OverallAssetStructure, OverallSpecificAssets, OverallAssets },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
mainHeight: window.innerHeight - 85,
|
mainHeight: window.innerHeight - 85,
|
||||||
|
@ -54,7 +55,6 @@ export default {
|
||||||
num:0,
|
num:0,
|
||||||
dataTotal:0,
|
dataTotal:0,
|
||||||
dictionaryTypeList:[],
|
dictionaryTypeList:[],
|
||||||
structureId:0,
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -77,10 +77,8 @@ export default {
|
||||||
)
|
)
|
||||||
findDictionaryByStructureId(data.id).then(
|
findDictionaryByStructureId(data.id).then(
|
||||||
res=>{
|
res=>{
|
||||||
this.structureId=data.id;
|
console.log(data.id)
|
||||||
console.log("res",this.structureId)
|
|
||||||
this.dictionaryTypeList=res.data;
|
this.dictionaryTypeList=res.data;
|
||||||
console.log(this.dictionaryTypeList)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
findDataBaseTable(data.id).then(
|
findDataBaseTable(data.id).then(
|
||||||
|
@ -98,7 +96,7 @@ export default {
|
||||||
res=>{
|
res=>{
|
||||||
|
|
||||||
this.databaseTable=res.data;
|
this.databaseTable=res.data;
|
||||||
// console.log("res",this.databaseTable)
|
console.log("res",this.databaseTable)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,129 +0,0 @@
|
||||||
<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>
|
|
|
@ -1,78 +0,0 @@
|
||||||
<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>
|
|
|
@ -1,483 +0,0 @@
|
||||||
<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