fix() 修改测试数据的展示
parent
7c6949cef7
commit
9b25654551
|
@ -4,8 +4,8 @@ import request from '@/utils/request'
|
|||
export function listAccredit(query) {
|
||||
return request({
|
||||
url: '/etl/assetAccredit/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
method: 'post',
|
||||
data: query
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,15 @@ export function listSource(data) {
|
|||
})
|
||||
}
|
||||
|
||||
//查询数据字段列表
|
||||
export function listModel(data){
|
||||
return request({
|
||||
url: 'etl/model/list',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
export function statisticsInfo(){
|
||||
return request({
|
||||
url: '/etl/source/Statistics',
|
||||
|
|
|
@ -42,3 +42,12 @@ export function delVersion(id) {
|
|||
method: 'delete'
|
||||
})
|
||||
}
|
||||
|
||||
//获取数据区域列表
|
||||
export function getDataRegionList(data){
|
||||
return request({
|
||||
url: 'ruleEngine/version/GetDataRegionList',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
|
|
@ -90,7 +90,7 @@ export default {
|
|||
methods: {
|
||||
structureList(){
|
||||
this.source.sql = 'select * from '+(this.source.modeName == null ? '' : this.source.modeName+'.')+this.asset.tableName +' limit 1'
|
||||
structureList(this.source).then(res => {
|
||||
structureList(this.asset).then(res => {
|
||||
console.log(res)
|
||||
this.kvtList = res.data.kvtList
|
||||
this.structure = res.data.structure
|
||||
|
|
|
@ -216,21 +216,53 @@
|
|||
</el-select>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-card class="box-card" v-if="assets != null">
|
||||
<el-col :span="24" v-if="assets != null">
|
||||
<el-card class="box-card" v-if="this.ruleEngineInfo.level === 'data-field'">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>选择资产模型</span>
|
||||
<el-button style="float: right; padding: 3px 0" type="text" @click="dataModelRandom">随机数据</el-button>
|
||||
</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-radio v-model="dataMode" :label="_dataModel.name" :value="_dataModel.id">{{dataModeMapList[dataModeMapIndex][_dataModel.name].value}}</el-radio>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
</el-card>
|
||||
<el-card class="box-card" v-if="this.ruleEngineInfo.level !== 'data-field'">
|
||||
<div slot="header" class="clearfix">
|
||||
<span>{{this.ruleEngineInfo.level === "data-set" ? "选择资产集" : "选择资产记录"}}</span>
|
||||
</div>
|
||||
<el-table :data="dataModeMapList" max-height="200px"
|
||||
@selection-change="changeDataRow">
|
||||
<el-table-column type="selection" width="55" v-if="this.ruleEngineInfo.level === 'data-set'"></el-table-column>
|
||||
<el-table-column v-for="dataModel in dataModelList" :label="dataModel.name">
|
||||
<template slot-scope="scope">
|
||||
{{scope.row[dataModel.name].value}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" v-if="this.ruleEngineInfo.level !== 'data-set'">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="dataRecordSelect(scope.row)">选择</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-descriptions title="选择行数据" direction="vertical" :column="3" border style="margin-top: 20px" v-if="dataRecordSelectData != null">
|
||||
<el-descriptions-item v-for="(val, key) in dataRecordSelectData"
|
||||
:label="key">
|
||||
<el-checkbox v-model="dataRecordSelectKeyList" :label="key" :value="key">{{val.value}}</el-checkbox>
|
||||
</el-descriptions-item>
|
||||
</el-descriptions>
|
||||
<el-descriptions title="选择模型" :column="3" border style="margin-top: 20px" v-if="changeDataList.length !== 0">
|
||||
<el-descriptions-item v-for="_dataModel in dataModelList"
|
||||
:label="_dataModel.comment">
|
||||
<el-checkbox v-model="dataRecordSelectKeyList" :label="_dataModel.name" :value="_dataModel.id"></el-checkbox>
|
||||
</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-col :span="24" style="margin-top: 10px" v-if="dataMode != null || dataRecordSelectKeyList.length > 0">
|
||||
<el-button @click="dataTest">测试</el-button>
|
||||
<el-input style="margin-top: 10px" v-model="testResult" type="textarea" placeholder="请点击测试"></el-input>
|
||||
</el-col>
|
||||
</el-col>
|
||||
|
@ -242,8 +274,14 @@
|
|||
<script>
|
||||
import {getMaintenance, updateMaintenance} from "@/api/ruleEngine/maintenance";
|
||||
import Encoding from "@/components/Encoding/index.vue";
|
||||
import {addVersion, updateVersion} from "@/api/ruleEngine/version";
|
||||
import {dataAssetList, listSource} from "@/api/etl/source";
|
||||
import {
|
||||
addVersion,
|
||||
generatedCode,
|
||||
getDataRegionList,
|
||||
initializeRuleEngine,
|
||||
updateVersion
|
||||
} from "@/api/ruleEngine/version";
|
||||
import {dataAssetList, listModel, listSource} from "@/api/etl/source";
|
||||
export default {
|
||||
name: "EngineVersion",
|
||||
components: {Encoding},
|
||||
|
@ -263,6 +301,33 @@ export default {
|
|||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
'assets': {
|
||||
handler(val) {
|
||||
if (val != null) {
|
||||
let assetStructureData;
|
||||
let dataAssetStructureData;
|
||||
this.assetsList.forEach(_assetStructure => {
|
||||
if (_assetStructure.tableName === val) {
|
||||
assetStructureData = _assetStructure
|
||||
}
|
||||
})
|
||||
this.assetStructureList.forEach(_assetStructure => {
|
||||
if (_assetStructure.dataSourceName === this.assetStructure) {
|
||||
dataAssetStructureData = _assetStructure
|
||||
}
|
||||
})
|
||||
listModel({dataAssetId: assetStructureData.id}).then(res => {
|
||||
this.dataModelList = res.data.rows
|
||||
console.log(this.dataModelList)
|
||||
})
|
||||
getDataRegionList({dataSource: dataAssetStructureData,dataAsset: assetStructureData}).then(res => {
|
||||
this.dataModeMapList = res.data
|
||||
console.log(this.dataModeMapList)
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
|
@ -282,11 +347,84 @@ export default {
|
|||
//数据资产选择
|
||||
assets: null,
|
||||
//数据模型集合
|
||||
dataModelList: [],
|
||||
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:{},
|
||||
dataModeMapList: [],
|
||||
dataModeMapIndex: 0,
|
||||
dataRecordSelectData: null,
|
||||
//条记录选中key集合
|
||||
dataRecordSelectKeyList: [],
|
||||
//选择行记录List
|
||||
changeDataList: [],
|
||||
testResult: "",
|
||||
ruleEngineId: this.$route.params && this.$route.params.ruleEngineId,
|
||||
ruleEngineInfo: {},
|
||||
|
@ -308,6 +446,30 @@ export default {
|
|||
this.initRuleEngine();
|
||||
},
|
||||
methods: {
|
||||
//选中行
|
||||
dataRecordSelect(row) {
|
||||
this.dataRecordSelectKeyList = [];
|
||||
this.dataRecordSelectData = row;
|
||||
},
|
||||
//测试
|
||||
dataTest(){
|
||||
let number = Math.floor(Math.random()*3);
|
||||
if (number === 0){
|
||||
this.testResult = "测试正常,无异常数据返回";
|
||||
}else if (number === 1){
|
||||
this.testResult = "测试失败: 触发*****异常条例,数据发生动作[移出/忽略/记录]";
|
||||
}else if (number === 2){
|
||||
this.testResult = "程序异常: *****异常";
|
||||
}
|
||||
},
|
||||
//选择数据行
|
||||
changeDataRow(val){
|
||||
this.changeDataList = val
|
||||
},
|
||||
//随机单条数据
|
||||
dataModelRandom(){
|
||||
this.dataModeMapIndex = Math.floor(Math.random()*this.dataModeMapList.length)
|
||||
},
|
||||
//获取数据接入集合
|
||||
getAssetStructureList(){
|
||||
listSource({}).then(response => {
|
||||
|
@ -370,12 +532,19 @@ export default {
|
|||
this.$message.error('规则CODE不可为空');
|
||||
return false;
|
||||
}
|
||||
this.engineVersionForm.versionCode = this.ruleEngineInfo.engineCode + "_" + this.engineVersionForm.code
|
||||
this.engineVersionForm.codeIng = this.getCodeIng()
|
||||
console.log(this.engineVersionForm)
|
||||
generatedCode(this.engineVersionForm).then(res => {
|
||||
if (res.code === 200){
|
||||
console.log(res.data)
|
||||
this.engineVersionForm = res.data
|
||||
}
|
||||
})
|
||||
// this.engineVersionForm.versionCode = this.ruleEngineInfo.engineCode + "_" + this.engineVersionForm.code
|
||||
// this.engineVersionForm.codeIng = this.getCodeIng()
|
||||
},
|
||||
// 确定新增
|
||||
addVersionSubmission(){
|
||||
addVersion(this.engineVersionForm).then(res => {
|
||||
initializeRuleEngine(this.engineVersionForm).then(res => {
|
||||
if (res.code === 200){
|
||||
this.$modal.msgSuccess("新增版本成功");
|
||||
this.addVersionStatus = false;
|
||||
|
|
Loading…
Reference in New Issue