|
|
@ -2,11 +2,8 @@
|
|
|
|
<div>
|
|
|
|
<div>
|
|
|
|
<el-card style="margin: 8px">
|
|
|
|
<el-card style="margin: 8px">
|
|
|
|
<el-form :inline="true" :model="selectForm" class="demo-form-inline" label-width="120px">
|
|
|
|
<el-form :inline="true" :model="selectForm" class="demo-form-inline" label-width="120px">
|
|
|
|
<el-form-item label="数据源名称">
|
|
|
|
<el-form-item label="页面名称">
|
|
|
|
<el-input v-model="selectForm.dataSourceName" clearable />
|
|
|
|
<el-input v-model="selectForm.pageConfigName" clearable />
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="请求地址">
|
|
|
|
|
|
|
|
<el-input v-model="selectForm.requestUrl" clearable />
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-form-item>
|
|
|
|
<el-button type="primary" @click="queryList">查询</el-button>
|
|
|
|
<el-button type="primary" @click="queryList">查询</el-button>
|
|
|
@ -14,17 +11,17 @@
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
</el-card>
|
|
|
|
</el-card>
|
|
|
|
<el-card style="margin: 8px">
|
|
|
|
<el-card style="margin: 8px">
|
|
|
|
<el-button plain type="primary" icon="Plus" @click="constructionData">新增</el-button>
|
|
|
|
<el-button plain type="primary" icon="Plus" @click="addBoard">新增</el-button>
|
|
|
|
<!-- <el-button plain type="success" icon="Edit" @click="editData">修改</el-button>-->
|
|
|
|
|
|
|
|
<!-- <el-button plain type="danger" icon="Delete" @click="delData">删除</el-button>-->
|
|
|
|
|
|
|
|
</el-card>
|
|
|
|
</el-card>
|
|
|
|
<el-card style="margin: 8px">
|
|
|
|
<el-card style="margin: 8px">
|
|
|
|
<el-table :data="tableData" style="width: 100%" v-loading="loading">
|
|
|
|
<el-table :data="tableData" style="width: 100%" v-loading="loading">
|
|
|
|
<el-table-column prop="dataSourceName" label="数据源名称" align="center" />
|
|
|
|
<el-table-column prop="pageConfigName" label="页面名称" align="center" />
|
|
|
|
<el-table-column prop="requestMethod" label="请求方式" align="center" />
|
|
|
|
|
|
|
|
<el-table-column prop="requestUrl" label="请求地址" align="center" />
|
|
|
|
|
|
|
|
<el-table-column label="操作" width="300" align="center">
|
|
|
|
<el-table-column label="操作" width="300" align="center">
|
|
|
|
<template #default="scope">
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-button text type="primary" size="small" @click="compileBoard(scope.row)">编辑
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button text type="primary" size="small" @click="viewboard(scope.row)">查看
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
<el-button text type="primary" size="small" @click="editDataSource(scope.row)">修改
|
|
|
|
<el-button text type="primary" size="small" @click="editDataSource(scope.row)">修改
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
<el-button
|
|
|
|
<el-button
|
|
|
@ -53,98 +50,19 @@
|
|
|
|
<el-dialog v-model="constructionDataFormVisible" draggable width="800">
|
|
|
|
<el-dialog v-model="constructionDataFormVisible" draggable width="800">
|
|
|
|
<template #header>
|
|
|
|
<template #header>
|
|
|
|
<div style="width: 100%">
|
|
|
|
<div style="width: 100%">
|
|
|
|
<span>{{ constructionDataForm.dataSourceId ? '修改' : '构造' }}数据源</span>
|
|
|
|
<span>{{ constructionDataForm.pageConfigId ? '修改' : '添加' }}看板</span>
|
|
|
|
<div style="text-align:right;display: inline-block;width: calc(100% - 100px)">
|
|
|
|
|
|
|
|
<span>简易模式</span>
|
|
|
|
|
|
|
|
<el-switch v-model="isEasy" />
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<el-form :model="constructionDataForm">
|
|
|
|
<el-form :model="constructionDataForm">
|
|
|
|
<el-form-item label="数据名称" prop="dataSourceName">
|
|
|
|
<el-form-item label="页面名称" prop="pageConfigName">
|
|
|
|
<el-input v-model="constructionDataForm.dataSourceName" />
|
|
|
|
<el-input v-model="constructionDataForm.pageConfigName" />
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="请求地址" prop="requestUrl">
|
|
|
|
|
|
|
|
<el-input v-model="constructionDataForm.requestUrl">
|
|
|
|
|
|
|
|
<template #prepend>
|
|
|
|
|
|
|
|
<el-select v-model="constructionDataForm.requestMethod" style="width: 100px">
|
|
|
|
|
|
|
|
<el-option label="get" value="get" />
|
|
|
|
|
|
|
|
<el-option label="post" value="post" />
|
|
|
|
|
|
|
|
<el-option label="socket" value="socket" />
|
|
|
|
|
|
|
|
</el-select>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-input>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="请求数据" v-if="isEasy">
|
|
|
|
|
|
|
|
<el-table :data="paramsTableData" style="width: 100%">
|
|
|
|
|
|
|
|
<el-table-column label="字段名称" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-input v-model="scope.row.name" style="width: 100%" />
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="备注" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-input v-model="scope.row.remark" style="width: 100%" />
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="测试数据" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-input v-model="scope.row.test" style="width: 100%" />
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="操作" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-button link size="small" type="primary"
|
|
|
|
|
|
|
|
@click="paramsTableData.splice(scope.$index, 1)">
|
|
|
|
|
|
|
|
删除
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<el-button style="width: 100%" @click="paramsTableData.push({})">
|
|
|
|
|
|
|
|
添加字段
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
|
|
|
|
<el-form-item label="输出数据">
|
|
|
|
|
|
|
|
<el-table :data="constructionDataForm.designDataFieldList" style="width: 100%">
|
|
|
|
|
|
|
|
<el-table-column label="字段名称" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-input v-model="scope.row.name" style="width: 100%" />
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column v-if="!isEasy" label="字段层级" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-input v-model="scope.row.tier" style="width: 100%" />
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="备注" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-input v-model="scope.row.remark" style="width: 100%" />
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
<el-table-column label="操作" min-width="120">
|
|
|
|
|
|
|
|
<template #default="scope">
|
|
|
|
|
|
|
|
<el-button link size="small" type="primary"
|
|
|
|
|
|
|
|
@click="constructionDataForm.designDataFieldList.splice(scope.$index, 1)">
|
|
|
|
|
|
|
|
删除
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
</el-table-column>
|
|
|
|
|
|
|
|
</el-table>
|
|
|
|
|
|
|
|
<el-button style="width: 100%" @click="constructionDataForm.designDataFieldList.push({})">
|
|
|
|
|
|
|
|
添加字段
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
<el-button v-if="isEasy" style="width: 100%;margin: 12px 0 0 0"
|
|
|
|
|
|
|
|
@click="findTier">
|
|
|
|
|
|
|
|
查找
|
|
|
|
|
|
|
|
</el-button>
|
|
|
|
|
|
|
|
</el-form-item>
|
|
|
|
</el-form-item>
|
|
|
|
</el-form>
|
|
|
|
</el-form>
|
|
|
|
<template #footer>
|
|
|
|
<template #footer>
|
|
|
|
<div class="dialog-footer">
|
|
|
|
<div class="dialog-footer">
|
|
|
|
<el-button @click="constructionDataFormVisible = false">关闭</el-button>
|
|
|
|
<el-button @click="constructionDataFormVisible = false">关闭</el-button>
|
|
|
|
<el-button type="primary" @click="createData ">
|
|
|
|
<el-button type="primary" @click="createData ">
|
|
|
|
{{ constructionDataForm.dataSourceId ? '确定' : '创建' }}
|
|
|
|
{{ constructionDataForm.pageConfigId ? '确定' : '创建' }}
|
|
|
|
</el-button>
|
|
|
|
</el-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
@ -152,21 +70,17 @@
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
<script lang="ts" setup>
|
|
|
|
|
|
|
|
import { useRouter } from 'vue-router';
|
|
|
|
import axios from 'axios';
|
|
|
|
import axios from 'axios';
|
|
|
|
import request from '@/utils/request';
|
|
|
|
import request from '@/utils/request';
|
|
|
|
import { options } from './tool.js';
|
|
|
|
import { options } from './tool.js';
|
|
|
|
import { addDataSourceApi, delDataSourceApi, editDataSourceApi, getDataSourceList } from './api/dataSource';
|
|
|
|
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
|
|
|
|
|
|
import { addBoardApi, delBoardApi, editBoardApi, getBoardListApi } from '@/views/boardGenerate/api/boardList';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
|
|
const comparisonTable = {
|
|
|
|
|
|
|
|
starttime: '开始时间',
|
|
|
|
|
|
|
|
time: '时间',
|
|
|
|
|
|
|
|
value: '值'
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const isEasy = ref(false);
|
|
|
|
|
|
|
|
const loading = ref(false);
|
|
|
|
const loading = ref(false);
|
|
|
|
const paramsTableData = ref([]);
|
|
|
|
|
|
|
|
const selectForm = ref({
|
|
|
|
const selectForm = ref({
|
|
|
|
pageNum: 1,
|
|
|
|
pageNum: 1,
|
|
|
|
pageSize: 10
|
|
|
|
pageSize: 10
|
|
|
@ -177,7 +91,7 @@ const constructionDataForm = ref({ designDataFieldList: [] });
|
|
|
|
const constructionDataFormVisible = ref(false);
|
|
|
|
const constructionDataFormVisible = ref(false);
|
|
|
|
const getList = async () => {
|
|
|
|
const getList = async () => {
|
|
|
|
loading.value = true;
|
|
|
|
loading.value = true;
|
|
|
|
getDataSourceList(selectForm.value)
|
|
|
|
getBoardListApi(selectForm.value)
|
|
|
|
.then((res) => {
|
|
|
|
.then((res) => {
|
|
|
|
console.log(res);
|
|
|
|
console.log(res);
|
|
|
|
tableData.value = res.rows;
|
|
|
|
tableData.value = res.rows;
|
|
|
@ -194,24 +108,13 @@ const queryList = async () => {
|
|
|
|
const pageChange = () => {
|
|
|
|
const pageChange = () => {
|
|
|
|
getList();
|
|
|
|
getList();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const constructionData = () => {
|
|
|
|
const addBoard = () => {
|
|
|
|
paramsTableData.value = [];
|
|
|
|
|
|
|
|
constructionDataForm.value = { designDataFieldList: [] };
|
|
|
|
|
|
|
|
constructionDataFormVisible.value = true;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const editData = () => {
|
|
|
|
|
|
|
|
paramsTableData.value = [];
|
|
|
|
|
|
|
|
constructionDataForm.value = { designDataFieldList: [] };
|
|
|
|
|
|
|
|
constructionDataFormVisible.value = true;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
const delData = () => {
|
|
|
|
|
|
|
|
paramsTableData.value = [];
|
|
|
|
|
|
|
|
constructionDataForm.value = { designDataFieldList: [] };
|
|
|
|
constructionDataForm.value = { designDataFieldList: [] };
|
|
|
|
constructionDataFormVisible.value = true;
|
|
|
|
constructionDataFormVisible.value = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const editDataSource = (e) => {
|
|
|
|
const editDataSource = (e) => {
|
|
|
|
constructionDataFormVisible.value = true;
|
|
|
|
|
|
|
|
constructionDataForm.value = e;
|
|
|
|
constructionDataForm.value = e;
|
|
|
|
|
|
|
|
constructionDataFormVisible.value = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const delDataSource = (e) => {
|
|
|
|
const delDataSource = (e) => {
|
|
|
|
ElMessageBox.confirm(
|
|
|
|
ElMessageBox.confirm(
|
|
|
@ -224,7 +127,7 @@ const delDataSource = (e) => {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
)
|
|
|
|
.then(() => {
|
|
|
|
.then(() => {
|
|
|
|
delDataSourceApi(e.dataSourceId).then(() => {
|
|
|
|
delBoardApi(e.pageConfigId).then(() => {
|
|
|
|
ElMessage({
|
|
|
|
ElMessage({
|
|
|
|
type: 'success',
|
|
|
|
type: 'success',
|
|
|
|
message: '删除成功'
|
|
|
|
message: '删除成功'
|
|
|
@ -243,8 +146,12 @@ const createData = () => {
|
|
|
|
if (!constructionDataForm.value.designDataFieldList) {
|
|
|
|
if (!constructionDataForm.value.designDataFieldList) {
|
|
|
|
constructionDataForm.value.designDataFieldList = [];
|
|
|
|
constructionDataForm.value.designDataFieldList = [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (constructionDataForm.value.dataSourceId) {
|
|
|
|
if (constructionDataForm.value.pageConfigId) {
|
|
|
|
editDataSourceApi(constructionDataForm.value).then(() => {
|
|
|
|
editBoardApi({
|
|
|
|
|
|
|
|
...constructionDataForm.value,
|
|
|
|
|
|
|
|
designPageEdgesList: constructionDataForm.value.designPageEdgesList || [],
|
|
|
|
|
|
|
|
designPagePointList: constructionDataForm.value.designPagePointList || []
|
|
|
|
|
|
|
|
}).then(() => {
|
|
|
|
constructionDataFormVisible.value = false;
|
|
|
|
constructionDataFormVisible.value = false;
|
|
|
|
ElMessage({
|
|
|
|
ElMessage({
|
|
|
|
type: 'success',
|
|
|
|
type: 'success',
|
|
|
@ -253,7 +160,7 @@ const createData = () => {
|
|
|
|
getList();
|
|
|
|
getList();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
addDataSourceApi(constructionDataForm.value).then(() => {
|
|
|
|
addBoardApi({ ...constructionDataForm.value, designPageEdgesList: [], designPagePointList: [] }).then(() => {
|
|
|
|
constructionDataFormVisible.value = false;
|
|
|
|
constructionDataFormVisible.value = false;
|
|
|
|
ElMessage({
|
|
|
|
ElMessage({
|
|
|
|
type: 'success',
|
|
|
|
type: 'success',
|
|
|
@ -262,58 +169,12 @@ const createData = () => {
|
|
|
|
getList();
|
|
|
|
getList();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// let nowData = JSON.parse(localStorage.getItem('DATANODE') || '[]');
|
|
|
|
|
|
|
|
// nowData.push(constructionDataForm.value);
|
|
|
|
|
|
|
|
// localStorage.setItem('DATANODE', JSON.stringify(nowData));
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
const findTier = () => {
|
|
|
|
const compileBoard = (row) => {
|
|
|
|
constructionDataForm.value.designDataFieldList = [];
|
|
|
|
router.push({ path: '/boardGenerate', query: { id: row.pageConfigId } });
|
|
|
|
let params = {};
|
|
|
|
};
|
|
|
|
(paramsTableData.value || []).forEach((item) => {
|
|
|
|
const viewboard = (row) => {
|
|
|
|
params[item.name] = item.test;
|
|
|
|
router.push({ path: '/boardView', query: { id: row.pageConfigId } });
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(options.isD ? request : axios.request)({
|
|
|
|
|
|
|
|
method: constructionDataForm.value.requestMethod,
|
|
|
|
|
|
|
|
url: constructionDataForm.value.requestUrl,
|
|
|
|
|
|
|
|
params: constructionDataForm.value.requestMethod === 'get' ? params : '',
|
|
|
|
|
|
|
|
data: constructionDataForm.value.requestMethod === 'post' ? params : ''
|
|
|
|
|
|
|
|
}).then(res => {
|
|
|
|
|
|
|
|
let data = (options.isD ? res : res.data);
|
|
|
|
|
|
|
|
console.log(data);
|
|
|
|
|
|
|
|
if (data?.data) {
|
|
|
|
|
|
|
|
Object.keys(data.data?.[0]).forEach(key => {
|
|
|
|
|
|
|
|
constructionDataForm.value.designDataFieldList.push({
|
|
|
|
|
|
|
|
name: key,
|
|
|
|
|
|
|
|
remark: comparisonTable[key],
|
|
|
|
|
|
|
|
tier: `data,map%${key}`
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else if (data?.rows) {
|
|
|
|
|
|
|
|
console.log(data?.rows);
|
|
|
|
|
|
|
|
Object.keys(data.rows?.[0]).forEach(key => {
|
|
|
|
|
|
|
|
constructionDataForm.value.designDataFieldList.push({
|
|
|
|
|
|
|
|
name: key,
|
|
|
|
|
|
|
|
remark: comparisonTable[key],
|
|
|
|
|
|
|
|
tier: `rows,map%${key}`
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
let exclude = ['code'];
|
|
|
|
|
|
|
|
Object.keys(data).forEach(key => {
|
|
|
|
|
|
|
|
if (!exclude.includes(key.toLowerCase())) {
|
|
|
|
|
|
|
|
if (typeof data[key] === 'string' || typeof data[key] === 'string') {
|
|
|
|
|
|
|
|
constructionDataForm.value.designDataFieldList.push({
|
|
|
|
|
|
|
|
name: key,
|
|
|
|
|
|
|
|
remark: comparisonTable[key],
|
|
|
|
|
|
|
|
tier: `${key}`
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
onMounted(async () => {
|
|
|
|
onMounted(async () => {
|
|
|
|
await queryList();
|
|
|
|
await queryList();
|
|
|
|