|
|
|
@ -1,221 +1,557 @@
|
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-card style="width: 95%;margin-left: 35px;margin-top: 10px">
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-descriptions class="margin-top" :title="ruleEngineInfo.name" :column="3" border>
|
|
|
|
|
<template slot="extra">
|
|
|
|
|
<el-dropdown split-button type="primary" @command="handleClick">
|
|
|
|
|
更多操作
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
<el-dropdown-item command="add">版本添加</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item command="activate">{{ (ruleEngineInfo.isActivate === 'N' ? "激活" : "禁用") + '引擎' }}
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item command="status">{{ (ruleEngineInfo.status === 'Y' ? "关闭" : "开启") + '引擎' }}
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
<el-descriptions-item label="规则名称"> {{ ruleEngineInfo.name }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="规则类型">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_type" :value="ruleEngineInfo.type"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="规则作用域">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_level" :value="ruleEngineInfo.scope"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="引擎编码"> {{ ruleEngineInfo.engineCode }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否激活">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineInfo.isActivate"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="规则状态">
|
|
|
|
|
<dict-tag :options="dict.type.sys_normal_disable" :value="ruleEngineInfo.status"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
<editor style="margin-top: 20px" :read-only="true" v-model="ruleEngineInfo.description"></editor>
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>引擎规则基本信息</span>
|
|
|
|
|
<el-button style="float: right" @click="goBack" size="medium" type="text">返回</el-button>
|
|
|
|
|
<span>规则引擎版本</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-descriptions border :column="3">
|
|
|
|
|
<el-descriptions-item label="规则名称">{{ ruleInfo.name }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="规则类型">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_type" :value="ruleInfo.type"/>
|
|
|
|
|
</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="规则编码">{{ ruleInfo.engineCode }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否激活">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleInfo.isActivate"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="规则状态">
|
|
|
|
|
<dict-tag :options="dict.type.sys_normal_disable" :value="ruleInfo.status"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
<editor style="margin-top: 20px" :read-only="true" v-model="ruleInfo.description"></editor>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12" v-for="ruleEngineVersion in ruleEngineInfo.engineVersionList">
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>{{ ruleEngineVersion.name + "-" + ruleEngineVersion.versionCode }}</span>
|
|
|
|
|
<el-dropdown style="float: right; padding: 3px 0" @command="checkRuleEngineVersion">
|
|
|
|
|
<span class="el-dropdown-link">
|
|
|
|
|
更多操作<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
|
|
</span>
|
|
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
|
|
<el-dropdown-item :command="{event: 'info', ruleEngineVersion: ruleEngineVersion}">规则详情
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item :command="{event: 'test', ruleEngineVersion: ruleEngineVersion}"
|
|
|
|
|
:disabled="ruleEngineVersion.status === '0'"
|
|
|
|
|
>测试规则
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item :command="{event: 'status', ruleEngineVersion: ruleEngineVersion}"
|
|
|
|
|
:disabled="ruleEngineVersion.status !== '2'">
|
|
|
|
|
{{ ruleEngineVersion.isActivate !== 'N' ? "禁用" : "激活" }}规则
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
<el-dropdown-item
|
|
|
|
|
:command="{event: 'publish', ruleEngineVersion: ruleEngineVersion}"
|
|
|
|
|
v-if="ruleEngineVersion.status === '1' && ruleEngineVersion.testStatus === '1'">
|
|
|
|
|
发布规则
|
|
|
|
|
</el-dropdown-item>
|
|
|
|
|
</el-dropdown-menu>
|
|
|
|
|
</el-dropdown>
|
|
|
|
|
</div>
|
|
|
|
|
<el-descriptions class="margin-top" :column="2" border>
|
|
|
|
|
<el-descriptions-item label="版本类" :span="2"> {{ ruleEngineVersion.versionClass }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本名称"> {{ ruleEngineVersion.name }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本CODE"> {{ ruleEngineVersion.versionCode }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否激活">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_status" :value="ruleEngineVersion.isActivate"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本状态">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersion.status"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否测试">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_is_test" :value="ruleEngineVersion.testStatus"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
<editor style="margin-top: 10px" :read-only="true" v-model="ruleEngineVersion.description"></editor>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</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
|
|
|
|
|
title="新增版本" :visible.sync="addVersionStatus"
|
|
|
|
|
width="75%">
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>基本信息</span>
|
|
|
|
|
<el-button style="float: right; padding: 3px 0" type="text" @click="genEngineVersion">生成引擎版本类
|
|
|
|
|
</el-button>
|
|
|
|
|
</div>
|
|
|
|
|
<el-form :label-position="engineVersionForm" label-width="80px" :model="engineVersionForm">
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-form-item label="版本类">
|
|
|
|
|
<el-input v-model="engineVersionForm.versionClass" disabled
|
|
|
|
|
placeholder="点击类生成自动生成类名称"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="名称">
|
|
|
|
|
<el-input v-model="engineVersionForm.name"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="编码">
|
|
|
|
|
<el-input v-model="engineVersionForm.versionCode"></el-input>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="状态">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_version_status" :value="engineVersionForm.status"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-form-item label="是否激活">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_status" :value="engineVersionForm.isActivate"/>
|
|
|
|
|
</el-form-item>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-form>
|
|
|
|
|
<editor v-model="engineVersionForm.description" :min-height="150"/>
|
|
|
|
|
</el-card>
|
|
|
|
|
<el-card class="box-card" v-if="engineVersionForm.ruleContent != null">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>引擎编码</span>
|
|
|
|
|
</div>
|
|
|
|
|
<encoding style="height: 800px" v-model="engineVersionForm.ruleContent"></encoding>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
|
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
|
|
<el-button @click="addVersionCancel">取 消</el-button>
|
|
|
|
|
<el-button type="primary" @click="addVersionSubmission">确 定</el-button>
|
|
|
|
|
</span>
|
|
|
|
|
</el-dialog>
|
|
|
|
|
<el-drawer
|
|
|
|
|
title="规则版本详情" size="80%" :before-close="ruleEngineVersionInfoStatusClose"
|
|
|
|
|
:visible.sync="ruleEngineVersionInfoStatus"
|
|
|
|
|
:direction="'rtl'">
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<el-descriptions v-if="ruleEngineVersionInfoAndTest != null" class="margin-top" :column="2" border>
|
|
|
|
|
<el-descriptions-item label="版本类" :span="2"> {{ ruleEngineVersionInfoAndTest.versionClass }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本名称"> {{ ruleEngineVersionInfoAndTest.name }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本CODE"> {{ ruleEngineVersionInfoAndTest.versionCode }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否激活">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_status"
|
|
|
|
|
:value="ruleEngineVersionInfoAndTest.isActivate"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本状态">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersionInfoAndTest.status"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否测试">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_is_test"
|
|
|
|
|
:value="ruleEngineVersionInfoAndTest.testStatus"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
<editor style="margin-top: 10px" :read-only="true" :min-height="100"
|
|
|
|
|
v-model="ruleEngineVersionInfoAndTest.description"></editor>
|
|
|
|
|
<el-row style="margin-top: 10px">
|
|
|
|
|
<el-button @click="saveCoding">保存代码</el-button>
|
|
|
|
|
</el-row>
|
|
|
|
|
<encoding style="height: 800px; margin-top: 20px" v-model="ruleEngineVersionInfoAndTest.ruleContent"></encoding>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
</el-drawer>
|
|
|
|
|
<el-drawer
|
|
|
|
|
title="规则版本测试" size="80%" :before-close="ruleEngineVersionTestStatusClose"
|
|
|
|
|
:visible.sync="ruleEngineVersionTestStatus"
|
|
|
|
|
:direction="'rtl'">
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-descriptions v-if="ruleEngineVersionInfoAndTest != null" class="margin-top" :column="2" border>
|
|
|
|
|
<el-descriptions-item label="版本类" :span="2"> {{ ruleEngineVersionInfoAndTest.versionClass }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本名称"> {{ ruleEngineVersionInfoAndTest.name }}</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本CODE"> {{ ruleEngineVersionInfoAndTest.versionCode }}
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否激活">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_status"
|
|
|
|
|
:value="ruleEngineVersionInfoAndTest.isActivate"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="版本状态">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_version_status" :value="ruleEngineVersionInfoAndTest.status"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
<el-descriptions-item label="是否测试">
|
|
|
|
|
<dict-tag :options="dict.type.rule_engine_activate_is_test"
|
|
|
|
|
:value="ruleEngineVersionInfoAndTest.testStatus"/>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<editor style="margin-top: 10px" :read-only="true" :min-height="105"
|
|
|
|
|
v-model="ruleEngineVersionInfoAndTest.description"></editor>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
<el-row :gutter="20">
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<encoding style="margin-top: 20px" v-model="ruleEngineVersionInfoAndTest.ruleContent"
|
|
|
|
|
:read-only="true"></encoding>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12">
|
|
|
|
|
<el-col :span="assetStructure == null ? 24 : 12">
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>选择数据接入</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-select v-model="assetStructure" style="width: 100%;">
|
|
|
|
|
<el-option v-for="_assetStructure in assetStructureList"
|
|
|
|
|
:key="_assetStructure.name"
|
|
|
|
|
:value="_assetStructure.name"
|
|
|
|
|
:label="_assetStructure.name+'('+_assetStructure.systemName+')'"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="12" v-if="assetStructure != null">
|
|
|
|
|
<el-card class="box-card">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>选择资产结构</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-select v-model="assets" style="width: 100%;">
|
|
|
|
|
<el-option v-for="_assets in assetsList"
|
|
|
|
|
:key="_assets.name"
|
|
|
|
|
:value="_assets.name"
|
|
|
|
|
:label="_assets.name+'('+_assets.as+')'"
|
|
|
|
|
></el-option>
|
|
|
|
|
</el-select>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24">
|
|
|
|
|
<el-card class="box-card" v-if="assets != null">
|
|
|
|
|
<div slot="header" class="clearfix">
|
|
|
|
|
<span>选择资产模型</span>
|
|
|
|
|
</div>
|
|
|
|
|
<el-descriptions direction="vertical" :column="3" border>
|
|
|
|
|
<el-descriptions-item v-for="_dataModel in dataModelList"
|
|
|
|
|
:label='_dataModel.name + "("+_dataModel.comment+")"'>
|
|
|
|
|
<el-radio v-model="dataMode" :label="_dataModel.name" :value="_dataModel.id">
|
|
|
|
|
{{ dataModeMap[_dataModel.name] }}
|
|
|
|
|
</el-radio>
|
|
|
|
|
</el-descriptions-item>
|
|
|
|
|
</el-descriptions>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :span="24" style="margin-top: 10px" v-if="dataMode != null">
|
|
|
|
|
<el-button>测试</el-button>
|
|
|
|
|
<el-input style="margin-top: 10px" v-model="testResult" type="textarea" placeholder="请点击测试"/>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-drawer>
|
|
|
|
|
</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";
|
|
|
|
|
import {getRuleEngineInfo} from "@/api/rule_engine/maintenance";
|
|
|
|
|
import {createVersionClass} from "@/api/rule_engine/version";
|
|
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "version",
|
|
|
|
|
name: "EngineVersion",
|
|
|
|
|
components: {Encoding},
|
|
|
|
|
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable', 'rule_engine_level'],
|
|
|
|
|
dicts: ['rule_engine_activate_status', 'rule_engine_type', 'sys_normal_disable',
|
|
|
|
|
'rule_engine_level', 'rule_engine_version_status', 'rule_engine_activate_is_test'],
|
|
|
|
|
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"}
|
|
|
|
|
],
|
|
|
|
|
ruleEngineId: this.$route.params && this.$route.params.ruleEngineId,
|
|
|
|
|
ruleEngineInfo: {},
|
|
|
|
|
// 新增版本
|
|
|
|
|
addVersionStatus: false,
|
|
|
|
|
engineVersionForm: {
|
|
|
|
|
"name": "", "code": "", "status": "0",
|
|
|
|
|
"versionCode": "",
|
|
|
|
|
"isActivate": "N",
|
|
|
|
|
"description": "",
|
|
|
|
|
"ruleContent": null
|
|
|
|
|
},
|
|
|
|
|
baseRuleContent: '',
|
|
|
|
|
testData: '',
|
|
|
|
|
resData: ''
|
|
|
|
|
// 详情抽屉状态
|
|
|
|
|
ruleEngineVersionInfoStatus: false,
|
|
|
|
|
// 测试抽屉状态
|
|
|
|
|
ruleEngineVersionTestStatus: false,
|
|
|
|
|
// 弹框抽屉
|
|
|
|
|
ruleEngineVersionInfoAndTest: {},
|
|
|
|
|
// 数据接入集合
|
|
|
|
|
assetStructureList: [
|
|
|
|
|
{
|
|
|
|
|
name: "测试1",
|
|
|
|
|
systemName: "云计算系统",
|
|
|
|
|
databaseName: "yunjisuan",
|
|
|
|
|
type: "dataSource"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "测试2",
|
|
|
|
|
systemName: "网站系统",
|
|
|
|
|
databaseName: "wangzhan",
|
|
|
|
|
type: "dataSource"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "测试3",
|
|
|
|
|
systemName: "物联网系统",
|
|
|
|
|
databaseName: "wulianwang",
|
|
|
|
|
type: "dataSource"
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "测试4",
|
|
|
|
|
systemName: "传媒系统",
|
|
|
|
|
databaseName: "chuanmei",
|
|
|
|
|
type: "dataSource"
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
// 数据接入集合选择
|
|
|
|
|
assetStructure: null,
|
|
|
|
|
// 数据资产
|
|
|
|
|
assetsList: [
|
|
|
|
|
{
|
|
|
|
|
name: "sys_user",
|
|
|
|
|
as: "用户表",
|
|
|
|
|
dataTotal: 635847,
|
|
|
|
|
type: "dataTable",
|
|
|
|
|
childrenList: []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "sys_dept",
|
|
|
|
|
as: "部门表",
|
|
|
|
|
dataTotal: 362548,
|
|
|
|
|
type: "dataTable",
|
|
|
|
|
childrenList: []
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "sys_notice",
|
|
|
|
|
as: "通知公告",
|
|
|
|
|
dataTotal: 6347,
|
|
|
|
|
type: "dataTable",
|
|
|
|
|
childrenList: []
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
// 数据资产选择
|
|
|
|
|
assets: null,
|
|
|
|
|
// 数据模型
|
|
|
|
|
dataModelList: [
|
|
|
|
|
{
|
|
|
|
|
id: 1,
|
|
|
|
|
name: "id",
|
|
|
|
|
comment: "主键",
|
|
|
|
|
isPrimaryKey: "Y",
|
|
|
|
|
type: "bigint",
|
|
|
|
|
mappingType: "Long",
|
|
|
|
|
length: "-",
|
|
|
|
|
decimalPlaces: "-",
|
|
|
|
|
isNull: "N",
|
|
|
|
|
defaultValue: "-",
|
|
|
|
|
isDict: "N",
|
|
|
|
|
dictKey: "-",
|
|
|
|
|
}, {
|
|
|
|
|
id: 2,
|
|
|
|
|
name: "name",
|
|
|
|
|
comment: "姓名",
|
|
|
|
|
isPrimaryKey: "N",
|
|
|
|
|
type: "varchar",
|
|
|
|
|
mappingType: "String",
|
|
|
|
|
length: "64",
|
|
|
|
|
decimalPlaces: "-",
|
|
|
|
|
isNull: "N",
|
|
|
|
|
defaultValue: "-",
|
|
|
|
|
isDict: "N",
|
|
|
|
|
dictKey: "-",
|
|
|
|
|
}, {
|
|
|
|
|
id: 3,
|
|
|
|
|
name: "sex",
|
|
|
|
|
comment: "性别",
|
|
|
|
|
isPrimaryKey: "N",
|
|
|
|
|
type: "char",
|
|
|
|
|
mappingType: "String",
|
|
|
|
|
length: "1",
|
|
|
|
|
decimalPlaces: "-",
|
|
|
|
|
isNull: "N",
|
|
|
|
|
defaultValue: "-",
|
|
|
|
|
isDict: "Y",
|
|
|
|
|
dictKey: "system_sex",
|
|
|
|
|
}, {
|
|
|
|
|
id: 4,
|
|
|
|
|
name: "price",
|
|
|
|
|
comment: "金额",
|
|
|
|
|
isPrimaryKey: "N",
|
|
|
|
|
type: "double",
|
|
|
|
|
mappingType: "BigDecimal",
|
|
|
|
|
length: "10",
|
|
|
|
|
decimalPlaces: "2",
|
|
|
|
|
isNull: "N",
|
|
|
|
|
defaultValue: "0.00",
|
|
|
|
|
isDict: "N",
|
|
|
|
|
dictKey: "-",
|
|
|
|
|
}, {
|
|
|
|
|
id: 5,
|
|
|
|
|
name: "create_time",
|
|
|
|
|
comment: "创建时间",
|
|
|
|
|
isPrimaryKey: "N",
|
|
|
|
|
type: "datetime",
|
|
|
|
|
mappingType: "Date",
|
|
|
|
|
length: "-",
|
|
|
|
|
decimalPlaces: "-",
|
|
|
|
|
isNull: "Y",
|
|
|
|
|
defaultValue: "-",
|
|
|
|
|
isDict: "N",
|
|
|
|
|
dictKey: "-",
|
|
|
|
|
},],
|
|
|
|
|
// 数据模型选择
|
|
|
|
|
dataMode: null,
|
|
|
|
|
// 数据示例
|
|
|
|
|
dataModeMap: {
|
|
|
|
|
id: 1,
|
|
|
|
|
name: "张三",
|
|
|
|
|
sex: 1,
|
|
|
|
|
price: "653.69",
|
|
|
|
|
create_time: "2024-5-7 16:37:16",
|
|
|
|
|
},
|
|
|
|
|
testResult: "",
|
|
|
|
|
versionClassCreateReq: {}
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
created() {
|
|
|
|
|
this.getInfo();
|
|
|
|
|
this.initRuleEngine();
|
|
|
|
|
},
|
|
|
|
|
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;
|
|
|
|
|
saveCoding() {
|
|
|
|
|
this.$message.success('编码保存成功');
|
|
|
|
|
},
|
|
|
|
|
ruleEngineVersionInfoStatusClose(done) {
|
|
|
|
|
this.$confirm('确认关闭?')
|
|
|
|
|
.then(_ => {
|
|
|
|
|
this.ruleEngineVersionInfoAndTest = {};
|
|
|
|
|
done();
|
|
|
|
|
})
|
|
|
|
|
.catch(_ => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
ruleEngineVersionTestStatusClose(done) {
|
|
|
|
|
this.$confirm('确认关闭?')
|
|
|
|
|
.then(_ => {
|
|
|
|
|
this.ruleEngineVersionInfoAndTest = {};
|
|
|
|
|
done();
|
|
|
|
|
})
|
|
|
|
|
.catch(_ => {
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 点击规则事件
|
|
|
|
|
checkRuleEngineVersion(command) {
|
|
|
|
|
switch (command.event) {
|
|
|
|
|
case "info"://详情
|
|
|
|
|
this.ruleEngineVersionInfoStatus = true;
|
|
|
|
|
this.ruleEngineVersionInfoAndTest = command.ruleEngineVersion;
|
|
|
|
|
break;
|
|
|
|
|
case "test"://测试
|
|
|
|
|
this.ruleEngineVersionTestStatus = true;
|
|
|
|
|
this.ruleEngineVersionInfoAndTest = command.ruleEngineVersion;
|
|
|
|
|
break;
|
|
|
|
|
case "status"://激活状态
|
|
|
|
|
command.ruleEngineVersion.isActivate = 'no-activate' === command.ruleEngineVersion.isActivate ? 'activated' : 'no-activate'
|
|
|
|
|
break;
|
|
|
|
|
case "publish"://发布
|
|
|
|
|
command.ruleEngineVersion.status = '2'
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
console.log(command.event);
|
|
|
|
|
console.log(command.ruleEngineVersion);
|
|
|
|
|
},
|
|
|
|
|
// 生成规则版本
|
|
|
|
|
genEngineVersion() {
|
|
|
|
|
if (this.engineVersionForm.name == null || this.engineVersionForm.name === "") {
|
|
|
|
|
this.$message.error('规则名称不可为空');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (this.engineVersionForm.versionCode == null || this.engineVersionForm.versionCode === "") {
|
|
|
|
|
this.$message.error('规则CODE不可为空');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
if (this.engineVersionForm.description == null || this.engineVersionForm.description === "") {
|
|
|
|
|
this.$message.error('规则版本使用描述不可为空');
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// this.engineVersionForm.versionCode = this.ruleEngineInfo.engineCode + "_" + this.engineVersionForm.code
|
|
|
|
|
// this.engineVersionForm.ruleContent = this.getCodeIng()
|
|
|
|
|
this.versionClassCreateReq.engineCode = this.ruleEngineInfo.engineCode
|
|
|
|
|
this.versionClassCreateReq.scope = this.ruleEngineInfo.scope
|
|
|
|
|
this.versionClassCreateReq.versionCode = this.engineVersionForm.versionCode
|
|
|
|
|
createVersionClass(this.versionClassCreateReq).then(res => {
|
|
|
|
|
this.engineVersionForm.versionClass = res.data.versionClass
|
|
|
|
|
this.engineVersionForm.ruleContent = res.data.ruleContent
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
goBack() {
|
|
|
|
|
this.$router.go(-1);
|
|
|
|
|
// 确定新增
|
|
|
|
|
addVersionSubmission() {
|
|
|
|
|
this.ruleEngineInfo.ruleEngineVersionList.push({...this.engineVersionForm})
|
|
|
|
|
this.addVersionStatus = false;
|
|
|
|
|
},
|
|
|
|
|
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
|
|
|
|
|
// 取消新增
|
|
|
|
|
addVersionCancel() {
|
|
|
|
|
this.engineVersionForm = {
|
|
|
|
|
"name": "", "code": "", "status": "0", "isTest": "0",
|
|
|
|
|
"versionCode": "",
|
|
|
|
|
"isActivate": "N",
|
|
|
|
|
"description": "",
|
|
|
|
|
"ruleContent": null, "ruleEngineVersionList": []
|
|
|
|
|
};
|
|
|
|
|
this.resetForm("form");
|
|
|
|
|
this.addVersionStatus = false;
|
|
|
|
|
},
|
|
|
|
|
/** 新增按钮操作 */
|
|
|
|
|
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;
|
|
|
|
|
handleClick(clickType) {
|
|
|
|
|
if (clickType === "add") {
|
|
|
|
|
this.addVersionStatus = true;
|
|
|
|
|
} else if (clickType === "activate") {
|
|
|
|
|
this.ruleEngineInfo.isActivate = 'no-activate' === this.ruleEngineInfo.isActivate ? 'activated' : 'no-activate'
|
|
|
|
|
this.$modal.msgSuccess("引擎激活状态修改成功");
|
|
|
|
|
} else if (clickType === "status") {
|
|
|
|
|
this.ruleEngineInfo.status = '0' === this.ruleEngineInfo.status ? '1' : '0'
|
|
|
|
|
this.$modal.msgSuccess("引擎状态操作成功");
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
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("测试成功");
|
|
|
|
|
initRuleEngine() {
|
|
|
|
|
getRuleEngineInfo(this.ruleEngineId).then(res => {
|
|
|
|
|
this.ruleEngineInfo = res.data
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
handleClose() {
|
|
|
|
|
this.visible = false;
|
|
|
|
|
// 获取代码模板
|
|
|
|
|
getCodeIng() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
<style scoped>
|
|
|
|
|
.box-card {
|
|
|
|
|
margin-top: 20px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-dropdown-link {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
color: #409EFF;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.el-icon-arrow-down {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.CodeMirror {
|
|
|
|
|
height: 600px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|