feat()随机字段显示队列

dev-1
王熙朝 2024-05-14 22:39:57 +08:00
parent 459eb95b4d
commit 9ff9e0a3e4
2 changed files with 135 additions and 100 deletions

View File

@ -1,9 +1,16 @@
import request from '@/utils/request'
// 查询引擎列表
export function randomField(id,tableName) {
export function getRabdomData(id,tableName,ruleLevel) {
return request({
url: '/test/data/randomField?id=' + id + "&tableName=" + tableName,
url: '/test/extract/getRabdomData?id=' + id + "&tableName=" + tableName + "&ruleLevel=" + ruleLevel,
method: 'get'
})
}
export function getColumn(id,tableName,ruleLevel) {
return request({
url: '/test/extract/getColumn?id=' + id + "&tableName=" + tableName + "&ruleLevel=" + ruleLevel,
method: 'get'
})
}

View File

@ -176,95 +176,81 @@
<el-col :span="12">
<encoding style="margin-top: 20px" v-model="selectList.ruleContent"></encoding>
</el-col>
<el-col :span="12">
<el-col :span="primaryId == null ? 24:12">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>选择资产结构</span>
</div>
<el-select v-model="primaryId" style="width: 100%">
<el-option v-for="asses in primary"
:key="asses"
:value="asses"
:key="asses.tableLists"
:value="asses.tableLists"
:label="asses.name+'('+asses.databaseName+')'">
</el-option>
</el-select>
</el-card>
<el-col :span="12">
<el-card class="box-card" v-if="primaryId != null && ruleInfo.ruleLevel==1">
</el-col>
<el-col :span="12" v-if="primaryId != []">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>选择资产模型</span>
</div>
<el-descriptions direction="vertical" :column="3" border>
<el-descriptions-item v-for="_dataModel in primaryId.tableLists"
:label='_dataModel.name + "("+_dataModel.databaseName+")"'>
任务
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="box-card" v-if="primaryId != null && ruleInfo.ruleLevel == 2">
<div slot="header" class="clearfix">
<span>选择资产模型</span>
</div>
数据集
<el-descriptions direction="vertical" :column="3" border>
<el-descriptions-item>
<el-checkbox-group v-model="columns">
<el-checkbox v-for="dong in primaryId.tableLists"
:key="dong"
:label="dong.databaseName+'('+dong.tableName+')'"
:value="dong"></el-checkbox>
</el-checkbox-group>
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="box-card" v-if="primaryId != null && ruleInfo.ruleLevel ==3">
<div slot="header" class="clearfix">
<span>选择资产模型</span>
</div>
记录
<el-descriptions direction="vertical" :column="3" border>
<el-descriptions-item >
<el-select v-model="columnOne" style="width: 100%">
<el-option v-for="tab in primaryId.tableLists"
:key="tab"
:value="tab"
:label="tab.databaseName+'('+tab.tableName+')'">
</el-option>
</el-select>
</el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="box-card" v-if="primaryId != null && ruleInfo.ruleLevel ==4">
<div slot="header" class="clearfix">
<span>选择资产模型</span>
</div>
数据字段
<el-select v-model="columnOne" style="width: 100%">
<el-option v-for="tab in primaryId.tableLists"
:key="tab"
:value="tab"
:label="tab.databaseName+'('+tab.tableName+')'">
</el-option>
<el-select v-model="tableLisrs" style="width: 100%;">
<el-option v-for="model in primaryId"
:key="model.id+model.tableName"
:value="model.id+model.tableName"
:label="model.databaseName+'('+model.tableName+')'"
></el-option>
</el-select>
</el-card>
</el-col>
<el-col :span="12">
<el-card class="box-card" v-if="columnOne != null && ruleInfo.ruleLevel==3">
<el-col :span="24" v-if="tableLisrs != null">
<el-card class="box-card" v-if="ruleInfo.ruleLevel === 1">
<div slot="header" class="clearfix">
<span>选择字段</span>
<span>任务</span>
</div>
记录
</el-card>
<el-card class="box-card" v-if="columnOne != null && ruleInfo.ruleLevel==4">
<el-card class="box-card" v-if="ruleInfo.ruleLevel === 2">
<div slot="header" class="clearfix">
<span>选择字段</span>
<span>数据集</span>
</div>
字段
<button @click="dield(primaryId.id,columnOne.tableName)"></button>
<el-table ref="multipleTable" :data="columnOne2" max-height="200px">
<el-table-column type="selection" width="55"></el-table-column>
<!-- <el-table-column v-for="dataModel in columnOne2" :label="dataModel.comment" :prop="dataModel.name"/>-->
<el-table-column v-for="(val, key) in columnOne2[0]" :key="key" :label="key" :prop="key"></el-table-column>
</el-table>
<div style="margin-top: 20px">
<el-button @click="toggleSelection()"></el-button>
</div>
</el-card>
<el-card class="box-card" v-if="ruleInfo.ruleLevel === 3">
<div slot="header" class="clearfix">
<span>记录</span>
</div>
<el-table :data="columnOne2" max-height="200px">
<el-table-column v-for="(val, key) in columnOne2[0]" :key="key" :label="key" :prop="key"></el-table-column>
<el-table-column label="操作">
<template slot-scope="scope">
<el-button type="text" @click="dataRecordSelect(scope.row)"></el-button>
</template>
</el-table-column>
</el-table>
<el-descriptions title="字段" :column="3" border>
<el-descriptions-item ></el-descriptions-item>
</el-descriptions>
</el-card>
<el-card class="box-card" v-if="ruleInfo.ruleLevel === 4">
<div slot="header" class="clearfix">
<span>数据字段</span>
</div>
<button @click="dield(tableLisrs,ruleInfo.ruleLevel)"></button>
<el-descriptions title="字段" :column="3" border>
<el-descriptions-item v-for="tab in fields" :label="tab.key">{{tab.val}}</el-descriptions-item>
</el-descriptions>
</el-card>
</el-col>
</el-col>
</el-row>
</el-drawer>
</div>
@ -274,7 +260,7 @@
import { selectRuleEngineOne, updateRuleIsActivate, updateRuleStatus, spliceNameToCode } from "@/api/goods/engine";
import { selectListRuleId, getEdition, delEdition, addEdition, updateEdition } from "@/api/goods/edition";
import { selectFrimary } from "@/api/system/accredit";
import { randomField } from "@/api/test/testData";
import { getRabdomData, getColumn } from "@/api/test/testData";
import Encoding from "@/components/Encoding/index.vue";
export default {
@ -302,7 +288,7 @@ export default {
//
total: 0,
//
editionList: [],
editionList: null,
//
title: "",
//
@ -319,14 +305,19 @@ export default {
//
ruleEngineTest:{},
primary: [],
//
dataModelList: [],
//
columns: [],
//
columnOne: null,
columnOne: [],
columnOne2: [],
//
fields: [],
fieldd: [],
//
primaryId: null,
primaryId: [],
tableLisrs: null,
//
form: {
versionClass: "",
@ -340,6 +331,14 @@ export default {
}
};
},
watch: {
// conditionVar
tableLisrs(newVal, oldVal) {
if (newVal !== null && newVal !== oldVal) {
this.executeApi(); // tableListsnull
}
},
},
created() {
this.getList();
},
@ -357,20 +356,50 @@ export default {
* 随机字段
* @param id
*/
dield(id,tableName) {
alert(tableName)
randomField(id,tableName).then(res => {
dield(tableLisrs,ruleLevel) {
console.log(tableLisrs)
var id = parseInt(tableLisrs.split('')[0]);
var tableName = tableLisrs.slice(1)
getRabdomData(id,tableName,ruleLevel).then(res => {
this.fields = res.data;
console.log(res.data)
})
},
//
executeApi() {
var id = parseInt(this.tableLisrs.split('')[0]);
var tableName = this.tableLisrs.slice(1)
getColumn(id,tableName,this.ruleInfo.ruleLevel).then(res => {
this.columnOne = res.data
var list = this.columnOne;
var list2 = [];
list.forEach(function (sublist) {
var dict2 = {}
sublist.forEach(function (item) {
dict2[item["key"]] = item["val"];
})
list2.push(dict2)
})
this.columnOne2 = list2;
console.log(list2)
console.log(res.data)
console.log(this.columnOne2)
})
},
toggleSelection() {
this.$refs.multipleTable.clearSelection();
},
//
dataRecordSelect(row) {
console.log(row)
this.fieldd = row
},
/** 查询规则引擎版本列表 */
getList() {
this.form.ruleId = this.ruleId
selectFrimary().then(res => {
this.primary = res.data
})
this.primaryId = null
selectRuleEngineOne(this.ruleId).then(res => {
this.ruleInfo = res.data;
})
@ -388,7 +417,6 @@ export default {
saveCoding(row) {
updateEdition(row).then(res => {
this.$message.success(res.data)
})
},
//