top升级

This commit is contained in:
clay 2022-07-31 21:04:29 +08:00
parent e127a8ef3a
commit 047bdad640
17 changed files with 248 additions and 141 deletions

View File

@ -4,6 +4,7 @@ ENV = 'development'
# EBTS/开发环境 # EBTS/开发环境
#VUE_APP_BASE_API = '/dev-api' #VUE_APP_BASE_API = '/dev-api'
VUE_APP_BASE_API = 'http://localhost:8085/dev-api' VUE_APP_BASE_API = 'http://localhost:8085/dev-api'
#VUE_APP_BASE_API = 'https://api.ebts.top/dev-api'
# 路由懒加载 # 路由懒加载

View File

@ -1,14 +1,14 @@
import request from "@/utils/request"; import request from "@/utils/request";
// 获取查询基本信息 // 获取查询基本信息
export function RealInfo(id){ export function realInfo(id){
return request({ return request({
url: "/data/real/"+id, url: "/data/real/"+id,
method: 'get', method: 'get',
}) })
} }
// 查询数据 // 查询数据
export function RealData(data){ export function realData(data){
return request({ return request({
url: "/data/real", url: "/data/real",
method: 'put', method: 'put',

View File

@ -51,7 +51,7 @@ export default {
}, },
pathCompile(path) { pathCompile(path) {
const { params } = this.$route const { params } = this.$route
var toPath = pathToRegexp.compile(path) let toPath = pathToRegexp.compile(path)
return toPath(params) return toPath(params)
}, },
handleLink(item) { handleLink(item) {

View File

@ -5,13 +5,13 @@
:key="item.id" :key="item.id"
:label="item.ucName"> :label="item.ucName">
<el-input v-if="item.type == 1" v-model="item.ucReal" <el-input v-if="item.type === 1" v-model="item.ucReal"
clearable clearable
:placeholder="outPlaceholder(item)" :placeholder="outPlaceholder(item)"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
<div style="width: 200px" v-else-if="item.type == 2"> <div style="width: 200px" v-else-if="item.type === 2">
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :span="12"> <el-col :span="12">
<el-input size="small" placeholder="开始值" v-model="item.ucReal.begin"></el-input> <el-input size="small" placeholder="开始值" v-model="item.ucReal.begin"></el-input>
@ -22,14 +22,14 @@
</el-row> </el-row>
</div> </div>
<el-date-picker <el-date-picker
v-else-if="item.type ==3" v-else-if="item.type ===3"
v-model="item.ucReal" v-model="item.ucReal"
type="date" type="date"
format="yyyy-MM-dd" format="yyyy-MM-dd"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="选择日期时间"> placeholder="选择日期时间">
</el-date-picker> </el-date-picker>
<el-date-picker v-else-if="item.type ==4" <el-date-picker v-else-if="item.type ===4"
v-model="item.ucReal" v-model="item.ucReal"
size="small" size="small"
style="width: 240px" style="width: 240px"
@ -78,13 +78,13 @@
</template> </template>
<script> <script>
import {RealInfo, RealData,exportReal} from "@/api/system/data" import {realInfo, realData, exportReal} from "@/api/system/data"
function listInit(list) { function listInit(list) {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
if (list[i].type == 2) { if (list[i].type === 2) {
list[i].ucReal = {begin: null, end: null} list[i].ucReal = {begin: null, end: null}
} else if (list[i].type == 4) { } else if (list[i].type === 4) {
list[i].ucReal = [] list[i].ucReal = []
} }
} }
@ -111,7 +111,7 @@ export default {
}, },
created() { created() {
this.dataId = this.$route.fullPath.split("/")[3] this.dataId = this.$route.fullPath.split("/")[3]
RealInfo(this.dataId).then(res => { realInfo(this.dataId).then(res => {
let data = res.data let data = res.data
this.uconList = listInit(data.uniCons) this.uconList = listInit(data.uniCons)
this.realDate.header = data.infoList this.realDate.header = data.infoList
@ -140,27 +140,23 @@ export default {
pageSize: this.queryParams.pageSize, pageSize: this.queryParams.pageSize,
} }
data.uniCons = this.uconList data.uniCons = this.uconList
RealData(data).then(res => { realData(data).then(res => {
this.realDate.data = res.rows this.realDate.data = res.rows
this.total = res.total this.total = res.total
// this.realDate.header = []
// for (var key in this.realDate.data[0]) {
// this.realDate.header.push(key)
// }
}) })
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
var that = this let that = this
this.$confirm('是否确认导出查询数据项?', "警告", { this.$confirm('是否确认导出查询数据项?', "警告", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function () { }).then(function () {
let data = { let data = {
id:that.dataId, id: that.dataId,
uniCons:that.uconList, uniCons: that.uconList,
} }
return exportReal(data) return exportReal(data)
}).then(response => { }).then(response => {

View File

@ -99,9 +99,9 @@ export default {
}, },
methods: { methods: {
transform() { transform() {
var mid = this.info.mId let mid = this.info.mId
var str = '' let str = ''
var start = true let start = true
for (let i = 0; i < this.moduleList.length; i++) { for (let i = 0; i < this.moduleList.length; i++) {
if (mid == this.moduleList[i].id) { if (mid == this.moduleList[i].id) {
str = this.moduleList[i].mName str = this.moduleList[i].mName

View File

@ -314,7 +314,7 @@
getClassPreview(id).then(res =>{ getClassPreview(id).then(res =>{
this.preview.data = res.data; this.preview.data = res.data;
this.preview.open = true; this.preview.open = true;
var keys = Object.keys(res.data) let keys = Object.keys(res.data)
this.preview.activeName = keys[0] this.preview.activeName = keys[0]
}) })
}, },
@ -325,7 +325,7 @@
/** 高亮显示 */ /** 高亮显示 */
highlightedCode(code, key) { highlightedCode(code, key) {
const vmName = key; const vmName = key;
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length); let language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
const result = hljs.highlight(language, code || "", true); const result = hljs.highlight(language, code || "", true);
return result.value || '&nbsp;'; return result.value || '&nbsp;';
}, },
@ -348,9 +348,9 @@
this.$router.push("/apiclass/edit/" + apiclassId); this.$router.push("/apiclass/edit/" + apiclassId);
}, },
transform() { transform() {
var mid = this.form.mId let mid = this.form.mId
var str = '' let str = ''
var start = true let start = true
for (let i = 0; i < this.moduleList.length; i++) { for (let i = 0; i < this.moduleList.length; i++) {
if (mid == this.moduleList[i].id) { if (mid == this.moduleList[i].id) {
str = this.moduleList[i].mName str = this.moduleList[i].mName

View File

@ -641,7 +641,7 @@ export default {
}, },
/** 设置关联外键 */ /** 设置关联外键 */
setSubTableColumns(value) { setSubTableColumns(value) {
for (var item in this.tables) { for (let item in this.tables) {
const name = this.tables[item].tableName; const name = this.tables[item].tableName;
if (value === name) { if (value === name) {
this.subColumns = this.tables[item].columns; this.subColumns = this.tables[item].columns;

View File

@ -309,7 +309,7 @@ export default {
/** 高亮显示 */ /** 高亮显示 */
highlightedCode(code, key) { highlightedCode(code, key) {
const vmName = key; const vmName = key;
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length); let language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
const result = hljs.highlight(language, code || "", true); const result = hljs.highlight(language, code || "", true);
return result.value || '&nbsp;'; return result.value || '&nbsp;';
}, },

View File

@ -251,7 +251,7 @@ export default {
getModulePreview(id).then(res=>{ getModulePreview(id).then(res=>{
this.preview.data = res.data; this.preview.data = res.data;
this.preview.open = true; this.preview.open = true;
var keys = Object.keys(res.data) let keys = Object.keys(res.data)
this.preview.activeName = keys[0] this.preview.activeName = keys[0]
}) })
}, },
@ -262,7 +262,7 @@ export default {
/** 高亮显示 */ /** 高亮显示 */
highlightedCode(code, key) { highlightedCode(code, key) {
const vmName = key; const vmName = key;
var language = vmName.substring(vmName.indexOf(".") + 1, vmName.length); let language = vmName.substring(vmName.indexOf(".") + 1, vmName.length);
const result = hljs.highlight(language, code || "", true); const result = hljs.highlight(language, code || "", true);
return result.value || '&nbsp;'; return result.value || '&nbsp;';
}, },

View File

@ -49,9 +49,9 @@
}, },
methods:{ methods:{
transform() { transform() {
var mid = this.info.mId let mid = this.info.mId
var str = '' let str = ''
var start = true let start = true
for (let i = 0; i < this.moduleList.length; i++) { for (let i = 0; i < this.moduleList.length; i++) {
if (mid == this.moduleList[i].id) { if (mid == this.moduleList[i].id) {
str = this.moduleList[i].mName str = this.moduleList[i].mName

View File

@ -46,7 +46,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['tool:query:add']" v-hasPermi="['tool:query:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -57,7 +58,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['tool:query:edit']" v-hasPermi="['tool:query:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -68,7 +70,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['tool:query:remove']" v-hasPermi="['tool:query:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -78,16 +81,17 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['tool:query:export']" v-hasPermi="['tool:query:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="queryList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="queryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column type="index" width="50"></el-table-column> <el-table-column type="index" width="50"></el-table-column>
<el-table-column label="名称" align="center" prop="uqName" /> <el-table-column label="名称" align="center" prop="uqName"/>
<el-table-column label="描述" align="center" prop="uqDescribe" /> <el-table-column label="描述" align="center" prop="uqDescribe"/>
<el-table-column label="创建时间" align="center" prop="createTime"> <el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
@ -100,6 +104,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.isRelease===2">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -113,7 +118,7 @@
icon="el-icon-edit-outline" icon="el-icon-edit-outline"
@click="handleEditTable(scope.row)" @click="handleEditTable(scope.row)"
v-hasPermi="['tool:query:update']" v-hasPermi="['tool:query:update']"
>编辑</el-button> >设计</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -121,6 +126,15 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['tool:query:remove']" v-hasPermi="['tool:query:remove']"
>删除</el-button> >删除</el-button>
</span>
<span v-if="scope.row.isRelease===1">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handRelease(scope.row.id)"
>撤销</el-button>
</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -137,13 +151,10 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="uqName"> <el-form-item label="名称" prop="uqName">
<el-input v-model="form.uqName" placeholder="请输入名称" /> <el-input v-model="form.uqName" placeholder="请输入名称"/>
</el-form-item>
<el-form-item label="sql语句" prop="uqSql">
<el-input v-model="form.uqSql" type="textarea" placeholder="请输入内容" />
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="uqDescribe"> <el-form-item label="描述" prop="uqDescribe">
<el-input v-model="form.uqDescribe" placeholder="请输入描述" /> <el-input v-model="form.uqDescribe" placeholder="请输入描述"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -155,12 +166,12 @@
</template> </template>
<script> <script>
import { listQuery, getQuery, delQuery, addQuery, updateQuery, exportQuery } from "@/api/tool/query"; import {listQuery, getQuery, delQuery, addQuery, updateQuery, exportQuery, Release} from "@/api/tool/query";
import {Message} from "element-ui";
export default { export default {
name: "Query", name: "Query",
components: { components: {},
},
data() { data() {
return { return {
// //
@ -189,17 +200,17 @@ export default {
pageSize: 10, pageSize: 10,
uqName: null, uqName: null,
uqDescribe: null, uqDescribe: null,
type:1 type: 1
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
uqName: [ uqName: [
{ required: true, message: "名称不能为空}", trigger: "blur" }, {required: true, message: "名称不能为空}", trigger: "blur"},
], ],
uqDescribe: [ uqDescribe: [
{ required: true, message: "描述不能为空}", trigger: "blur" }, {required: true, message: "描述不能为空}", trigger: "blur"},
], ],
} }
}; };
@ -211,7 +222,7 @@ export default {
/** 查询万能查询列表 */ /** 查询万能查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listQuery(this.addCreateDateRange(this.queryParams,this.daterangeCreateTime)).then(response =>{ listQuery(this.addCreateDateRange(this.queryParams, this.daterangeCreateTime)).then(response => {
this.queryList = response.rows; this.queryList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -227,7 +238,6 @@ export default {
this.form = { this.form = {
id: null, id: null,
uqName: null, uqName: null,
uqSql: null,
uqDescribe: null, uqDescribe: null,
}; };
this.resetForm("form"); this.resetForm("form");
@ -237,9 +247,30 @@ export default {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
handleEditTable(row){ handleEditTable(row) {
this.$router.push("/query/edit/" + row.id); this.$router.push("/query/edit/" + row.id);
}, },
/** 发布与撤销 */
handRelease(id) {
let that = this
this.$confirm('是否确认撤销该查询?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
let data = {
id: id,
isRelease: 2
}
Release(data).then(res => {
Message({
message: res.msg,
type: 'success'
})
that.getList()
})
})
},
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.daterangeCreateTime = []; this.daterangeCreateTime = [];
@ -249,7 +280,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -296,7 +327,7 @@ export default {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return delQuery(ids); return delQuery(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
@ -310,7 +341,7 @@ export default {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return exportQuery(queryParams); return exportQuery(queryParams);
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg);

View File

@ -23,20 +23,19 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="6"> <el-col :span="6">
<span v-if="info.isRelease === 2">
<el-button type="text" icon="el-icon-upload" size="medium" @click="submitForm">提交</el-button> <el-button type="text" icon="el-icon-upload" size="medium" @click="submitForm">提交</el-button>
<el-button type="text" icon="el-icon-view" size="medium" @click="previewQuery">预览</el-button> <el-button type="text" icon="el-icon-view" size="medium" @click="previewQuery">预览</el-button>
<el-button type="text" icon="el-icon-plus" size="medium" @click="handleAdd">新增</el-button> <el-button type="text" icon="el-icon-plus" size="medium" @click="handleAdd">新增</el-button>
<el-button type="text" icon="el-icon-upload2" size="medium" @click="fieldExtract">字段提取</el-button>
<el-button type="text" icon="el-icon-edit" size="medium" @click="fieldEdit">字段修改</el-button>
</span>
<el-button type="text" icon="el-icon-download" size="medium" @click="handleExport">导出</el-button> <el-button type="text" icon="el-icon-download" size="medium" @click="handleExport">导出</el-button>
<el-button type="text" icon="el-icon-download" size="medium" @click="fieldExtract">字段提取</el-button>
<el-button type="text" icon="el-icon-download" size="medium" @click="fieldEdit">字段修改
</el-button>
<el-button v-if="info.isRelease === 2" type="text" icon="el-icon-success" size="medium" <el-button v-if="info.isRelease === 2" type="text" icon="el-icon-success" size="medium"
@click="handRelease(1)" @click="handRelease(1)">发布
>发布
</el-button> </el-button>
<el-button v-if="info.isRelease === 1" type="text" icon="el-icon-error" size="medium" <el-button v-if="info.isRelease === 1" type="text" icon="el-icon-error" size="medium"
@click="handRelease(2)" @click="handRelease(2)">撤销
>撤销
</el-button> </el-button>
</el-col> </el-col>
</el-form> </el-form>
@ -203,15 +202,14 @@ import 'codemirror/mode/sql/sql.js'
import 'codemirror/addon/hint/show-hint.css' import 'codemirror/addon/hint/show-hint.css'
import 'codemirror/addon/hint/show-hint.js' import 'codemirror/addon/hint/show-hint.js'
import 'codemirror/addon/hint/sql-hint.js' import 'codemirror/addon/hint/sql-hint.js'
import { getQueryInfo, editQueryInfo, previewQueryData, Release, exportMock } from '@/api/tool/query' import {getQueryInfo, editQueryInfo, previewQueryData, Release, exportMock} from '@/api/tool/query'
import { Message } from 'element-ui' import {Message} from 'element-ui'
function JSONString(list) { function JSONString(list) {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
if (list[i].type === 2) {
if (list[i].type == 2) {
list[i].ucMock = JSON.stringify(list[i].ucMock) list[i].ucMock = JSON.stringify(list[i].ucMock)
} else if (list[i].type == 4) { } else if (list[i].type === 4) {
let time = { let time = {
startTime: list[i].ucMock[0], startTime: list[i].ucMock[0],
endTime: list[i].ucMock[1] endTime: list[i].ucMock[1]
@ -258,7 +256,7 @@ export default {
// //
lineNumbers: true, lineNumbers: true,
line: true, line: true,
extraKeys: { 'Tab': 'autocomplete' }, extraKeys: {'Tab': 'autocomplete'},
lineWrapping: true,// lineWrapping: true,//
matchBrackets: true// matchBrackets: true//
} }
@ -285,8 +283,8 @@ export default {
header: [] header: []
}, },
rules: { rules: {
uqName: [{ required: true, message: '请输入名称', trigger: 'blur' }], uqName: [{required: true, message: '请输入名称', trigger: 'blur'}],
uqDescribe: [{ required: true, message: '请输入描述', trigger: 'blur' }] uqDescribe: [{required: true, message: '请输入描述', trigger: 'blur'}]
} }
} }
}, },
@ -302,7 +300,7 @@ export default {
this.columns = JSONparse(data.list) this.columns = JSONparse(data.list)
this.sqlConfig.coder.setValue(this.info.uqSql) this.sqlConfig.coder.setValue(this.info.uqSql)
}) })
this.$nextTick(function() { this.$nextTick(function () {
this.initialize() this.initialize()
}) })
}, },
@ -329,7 +327,7 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function () {
that.doFieldExtract() that.doFieldExtract()
}) })
} }
@ -374,7 +372,7 @@ export default {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'info' type: 'info'
}).then(function() { }).then(function () {
that.doFieldExtractToPreviewData() that.doFieldExtractToPreviewData()
}) })
return return
@ -425,15 +423,22 @@ export default {
}, },
/** 发布与撤销 */ /** 发布与撤销 */
handRelease(release) { handRelease(release) {
let data = { let that = this
id: this.queryId, this.$confirm('是否确认'+(release===2?'撤销':'发布')+'该查询?', '警告', {
isRelease: release confirmButtonText: '确定',
} cancelButtonText: '取消',
Release(data).then(res => { type: 'warning'
this.info.isRelease = (this.info.isRelease == 1) ? 2 : 1 }).then(function () {
Message({ let data = {
message: res.msg, id: that.queryId,
type: 'success' isRelease: release
}
Release(data).then(res => {
that.info.isRelease = (that.info.isRelease === 1) ? 2 : 1
Message({
message: res.msg,
type: 'success'
})
}) })
}) })
}, },
@ -442,7 +447,12 @@ export default {
this.$refs['elForm'].validate(valid => { this.$refs['elForm'].validate(valid => {
if (valid) { if (valid) {
let list = JSONString(this.columns) let list = JSONString(this.columns)
let data = this.info let data = {
pageNum: this.queryParams.pageNum,
pageSize: this.queryParams.pageSize,
uqSql: this.info.uqSql
}
if (list.length > 0) { if (list.length > 0) {
if (this.changUniCon(list)) { if (this.changUniCon(list)) {
data.uniCons = list data.uniCons = list
@ -450,8 +460,6 @@ export default {
return return
} }
} }
data.pageNum = this.queryParams.pageNum
data.pageSize = this.queryParams.pageSize
previewQueryData(data).then(res => { previewQueryData(data).then(res => {
this.previewDate.data = res.rows this.previewDate.data = res.rows
this.total = res.total this.total = res.total
@ -465,7 +473,7 @@ export default {
}) })
}) })
} else { } else {
for (var key in this.previewDate.data[0]) { for (let key in this.previewDate.data[0]) {
this.previewDate.header.push({ this.previewDate.header.push({
key: key, key: key,
label: key, label: key,
@ -499,6 +507,9 @@ export default {
/** 删除按钮 */ /** 删除按钮 */
handleDelete(index) { handleDelete(index) {
this.columns.splice(index, 1) this.columns.splice(index, 1)
if (!this.columns) {
this.columns = []
}
}, },
ucTypeChang(index, row) { ucTypeChang(index, row) {
if (row.ucType == 'input' && row.ucCon != 'BETWEEN') { if (row.ucType == 'input' && row.ucCon != 'BETWEEN') {
@ -508,7 +519,7 @@ export default {
} }
} else if (row.ucType == 'input' && row.ucCon == 'BETWEEN') { } else if (row.ucType == 'input' && row.ucCon == 'BETWEEN') {
this.columns[index].type = 2 this.columns[index].type = 2
this.columns[index].ucMock = { begin: '', end: '' } this.columns[index].ucMock = {begin: '', end: ''}
} else if (row.ucType == 'datetime' && row.ucCon != 'BETWEEN') { } else if (row.ucType == 'datetime' && row.ucCon != 'BETWEEN') {
this.columns[index].type = 3 this.columns[index].type = 3
this.columns[index].ucMock = '' this.columns[index].ucMock = ''
@ -540,7 +551,7 @@ export default {
if (list.length > 0) { if (list.length > 0) {
data.uniCons = list data.uniCons = list
} }
if (this.columnInfo.list.length === 0){ if (this.columnInfo.list.length === 0) {
Message({ Message({
message: '字段信息为空,请提取字段信息', message: '字段信息为空,请提取字段信息',
type: 'error' type: 'error'
@ -563,14 +574,15 @@ export default {
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
var that = this let that = this
let list = JSONString(that.cloumns) console.log(this.columns);
let list = JSONString(that.columns)
let data = that.info let data = that.info
this.$confirm('是否确认导出查询数据项?', '警告', { this.$confirm('是否确认导出查询数据项?', '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function () {
if (list.length > 0) { if (list.length > 0) {
if (that.changUniCon(list)) { if (that.changUniCon(list)) {
data.uniCons = list data.uniCons = list
@ -580,7 +592,7 @@ export default {
} }
return exportMock(data) return exportMock(data)
}).then(response => { }).then(response => {
that.cloumns = JSONparse(list) that.columns = JSONparse(list)
this.download(response.msg) this.download(response.msg)
}) })
} }

View File

@ -46,7 +46,8 @@
size="mini" size="mini"
@click="handleAdd" @click="handleAdd"
v-hasPermi="['tool:query:add']" v-hasPermi="['tool:query:add']"
>新增</el-button> >新增
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -57,7 +58,8 @@
:disabled="single" :disabled="single"
@click="handleUpdate" @click="handleUpdate"
v-hasPermi="['tool:query:edit']" v-hasPermi="['tool:query:edit']"
>修改</el-button> >修改
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -68,7 +70,8 @@
:disabled="multiple" :disabled="multiple"
@click="handleDelete" @click="handleDelete"
v-hasPermi="['tool:query:remove']" v-hasPermi="['tool:query:remove']"
>删除</el-button> >删除
</el-button>
</el-col> </el-col>
<el-col :span="1.5"> <el-col :span="1.5">
<el-button <el-button
@ -78,16 +81,17 @@
size="mini" size="mini"
@click="handleExport" @click="handleExport"
v-hasPermi="['tool:query:export']" v-hasPermi="['tool:query:export']"
>导出</el-button> >导出
</el-button>
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="queryList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="queryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center"/>
<el-table-column type="index" width="50"></el-table-column> <el-table-column type="index" width="50"></el-table-column>
<el-table-column label="名称" align="center" prop="uqName" /> <el-table-column label="名称" align="center" prop="uqName"/>
<el-table-column label="描述" align="center" prop="uqDescribe" /> <el-table-column label="描述" align="center" prop="uqDescribe"/>
<el-table-column label="创建时间" align="center" prop="createTime"> <el-table-column label="创建时间" align="center" prop="createTime">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span> <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
@ -100,6 +104,7 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<span v-if="scope.row.isRelease===2">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -113,7 +118,7 @@
icon="el-icon-edit-outline" icon="el-icon-edit-outline"
@click="handleEditTable(scope.row)" @click="handleEditTable(scope.row)"
v-hasPermi="['top:edit']" v-hasPermi="['top:edit']"
>编辑</el-button> >设计</el-button>
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
@ -121,6 +126,15 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPermi="['tool:query:remove']" v-hasPermi="['tool:query:remove']"
>删除</el-button> >删除</el-button>
</span>
<span v-if="scope.row.isRelease===1">
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handRelease(scope.row.id)"
>撤销</el-button>
</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -137,10 +151,10 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <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 ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="名称" prop="uqName"> <el-form-item label="名称" prop="uqName">
<el-input v-model="form.uqName" placeholder="请输入名称" /> <el-input v-model="form.uqName" placeholder="请输入名称"/>
</el-form-item> </el-form-item>
<el-form-item label="描述" prop="uqDescribe"> <el-form-item label="描述" prop="uqDescribe">
<el-input v-model="form.uqDescribe" placeholder="请输入描述" /> <el-input v-model="form.uqDescribe" placeholder="请输入描述"/>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
@ -152,12 +166,12 @@
</template> </template>
<script> <script>
import { listQuery, getQuery, delQuery, addQuery, updateQuery, exportQuery } from "@/api/tool/query"; import {listQuery, getQuery, delQuery, addQuery, updateQuery, exportQuery, Release} from "@/api/tool/query";
import {Message} from "element-ui";
export default { export default {
name: "Query", name: "Query",
components: { components: {},
},
data() { data() {
return { return {
// //
@ -186,17 +200,17 @@ export default {
pageSize: 10, pageSize: 10,
uqName: null, uqName: null,
uqDescribe: null, uqDescribe: null,
type:2 type: 2
}, },
// //
form: {}, form: {},
// //
rules: { rules: {
uqName: [ uqName: [
{ required: true, message: "名称不能为空}", trigger: "blur" }, {required: true, message: "名称不能为空}", trigger: "blur"},
], ],
uqDescribe: [ uqDescribe: [
{ required: true, message: "描述不能为空}", trigger: "blur" }, {required: true, message: "描述不能为空}", trigger: "blur"},
], ],
} }
}; };
@ -208,7 +222,7 @@ export default {
/** 查询万能查询列表 */ /** 查询万能查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
listQuery(this.addCreateDateRange(this.queryParams,this.daterangeCreateTime)).then(response =>{ listQuery(this.addCreateDateRange(this.queryParams, this.daterangeCreateTime)).then(response => {
this.queryList = response.rows; this.queryList = response.rows;
this.total = response.total; this.total = response.total;
this.loading = false; this.loading = false;
@ -234,8 +248,9 @@ export default {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
handleEditTable(row){ handleEditTable(row) {
this.$router.push("/top/edit/" + row.id); window.open("/top/edit/" + row.id)
// this.$router.push("/top/edit/" + row.id);
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
@ -246,7 +261,7 @@ export default {
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map(item => item.id) this.ids = selection.map(item => item.id)
this.single = selection.length!==1 this.single = selection.length !== 1
this.multiple = !selection.length this.multiple = !selection.length
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
@ -293,13 +308,34 @@ export default {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return delQuery(ids); return delQuery(ids);
}).then(() => { }).then(() => {
this.getList(); this.getList();
this.msgSuccess("删除成功"); this.msgSuccess("删除成功");
}) })
}, },
/** 发布与撤销 */
handRelease(id) {
let that = this
this.$confirm('是否确认撤销该查询?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function () {
let data = {
id: id,
isRelease: 2
}
Release(data).then(res => {
Message({
message: res.msg,
type: 'success'
})
that.getList()
})
})
},
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
const queryParams = this.queryParams; const queryParams = this.queryParams;
@ -307,7 +343,7 @@ export default {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}).then(function() { }).then(function () {
return exportQuery(queryParams); return exportQuery(queryParams);
}).then(response => { }).then(response => {
this.download(response.msg); this.download(response.msg);

View File

@ -49,22 +49,33 @@
<!--<el-button size="mini" @click="$parent.dagreLayoutHandler">层次</el-button>--> <!--<el-button size="mini" @click="$parent.dagreLayoutHandler">层次</el-button>-->
<!-- <el-button size="mini" @click="$parent.autoLayoutHandler">自动old</el-button>--> <!-- <el-button size="mini" @click="$parent.autoLayoutHandler">自动old</el-button>-->
<el-button size="mini" v-hasPermi="['top:preview']" @click="$parent.searchPreview">预览</el-button> <el-button size="mini" v-hasPermi="['top:preview']" @click="$parent.searchPreview">预览</el-button>
<el-button size="mini" v-hasPermi="['top:online']" @click="$parent.searchOnLine">上线</el-button> <el-button v-if="isRelease === 2" size="mini" @click="$parent.searchOnLine(1)">上线</el-button>
<el-button v-if="isRelease === 1" size="mini" @click="$parent.undoOnLine(2)">撤销</el-button>
<!-- 返回到预览模式 --> <!-- 返回到预览模式 -->
<!-- <top-button size="mini" @click="$parent.changeModeHandler('preview')">返回</top-button>--> <!-- <top-button size="mini" @click="$parent.changeModeHandler('preview')">返回</top-button>-->
<top-button size="mini" v-hasPermi="['top:edit']" @click="$parent.saveDataHandler">保存</top-button> <top-button v-if="isRelease === 2" size="mini" v-hasPermi="['top:edit']" @click="$parent.saveDataHandler">保存</top-button>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import { Button, Dropdown } from '../../elements'; import { Button, Dropdown } from '../../elements';
import {eventBus} from "@/views/tool/top/utils/eventBus";
export default { export default {
name: "ToolbarEdit", name: "ToolbarEdit",
components: { components: {
"top-button": Button, "top-button": Button,
"top-dropdown": Dropdown "top-dropdown": Dropdown
},
data(){
return{
isRelease:null
}
},
mounted() {
eventBus.$on('isRelease',(res)=> {
this.isRelease = res
})
} }
}; };
</script> </script>

View File

@ -840,7 +840,8 @@ export default {
}, },
// //
reBack() { reBack() {
this.$router.replace('/tool/er-top') window.close()
// this.$router.replace('/tool/er-top')
}, },
undoHandler() { undoHandler() {
if (this.historyIndex > 0 && this.historyIndex - (this.undoCount + 1) >= 0) { if (this.historyIndex > 0 && this.historyIndex - (this.undoCount + 1) >= 0) {
@ -1374,8 +1375,12 @@ export default {
this.$emit('doPreview', graphData) this.$emit('doPreview', graphData)
}, },
// 线 // 线
searchOnLine() { searchOnLine(release) {
this.$emit('doOnLine') this.$emit('doOnLine',release)
},
// 线
undoOnLine(release) {
this.$emit('undoOnLine',release)
}, },
// //
saveDataHandler() { saveDataHandler() {

View File

@ -12,7 +12,8 @@
@doChangeMode="doChangeMode" @doChangeMode="doChangeMode"
@doSaveData="doSaveData" @doSaveData="doSaveData"
@doPreview="doPreview" @doPreview="doPreview"
@doOnLine="doOnLine" @doOnLine="changeOnLine"
@undoOnLine="changeOnLine"
> >
</topology> </topology>
@ -23,13 +24,13 @@
:label="item.ucName" :label="item.ucName"
> >
<el-input v-if="item.type == 1" v-model="item.ucReal" <el-input v-if="item.type === 1" v-model="item.ucReal"
clearable clearable
:placeholder="outPlaceholder(item)" :placeholder="outPlaceholder(item)"
size="small" size="small"
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
<div style="width: 200px" v-else-if="item.type == 2"> <div style="width: 200px" v-else-if="item.type === 2">
<el-row :gutter="15"> <el-row :gutter="15">
<el-col :span="12"> <el-col :span="12">
<el-input size="small" placeholder="开始值" v-model="item.ucReal.begin"></el-input> <el-input size="small" placeholder="开始值" v-model="item.ucReal.begin"></el-input>
@ -40,7 +41,7 @@
</el-row> </el-row>
</div> </div>
<el-date-picker <el-date-picker
v-else-if="item.type ==3" v-else-if="item.type ===3"
v-model="item.ucReal" v-model="item.ucReal"
type="date" type="date"
format="yyyy-MM-dd" format="yyyy-MM-dd"
@ -103,9 +104,11 @@
import Topology from './packages/topology/src/topology' import Topology from './packages/topology/src/topology'
import { deepClone } from './utils/index' import { deepClone } from './utils/index'
import { getQuery, getTables, updateQuery, preview } from '@/api/tool/top' import { getQuery, getTables, updateQuery, preview } from '@/api/tool/top'
import { RealData } from '@/api/system/data' import { realData } from '@/api/system/data'
import { exportReal } from '../../../api/system/data' import { exportReal } from '../../../api/system/data'
import {eventBus} from "@/views/tool/top/utils/eventBus";
import {Release} from "@/api/tool/query";
import {Message} from "element-ui";
export default { export default {
name: 'DemoTopology', name: 'DemoTopology',
components: { components: {
@ -155,6 +158,9 @@ export default {
this.topId = this.$route.params && this.$route.params.topId this.topId = this.$route.params && this.$route.params.topId
getQuery(this.topId).then(res => { getQuery(this.topId).then(res => {
this.baseData = res.data this.baseData = res.data
eventBus.$emit('isRelease',this.baseData.isRelease)
console.log(res.data)
if (res.data.topJson) { if (res.data.topJson) {
this.graphData = JSON.parse(res.data.topJson) this.graphData = JSON.parse(res.data.topJson)
} else { } else {
@ -163,6 +169,7 @@ export default {
edges: [] edges: []
} }
} }
this.baseData.topJson = null
let graphData = deepClone(this.graphData) let graphData = deepClone(this.graphData)
this.$refs.topology.initTopo(graphData) this.$refs.topology.initTopo(graphData)
this.randomChange() this.randomChange()
@ -183,7 +190,7 @@ export default {
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
var that = this let that = this
this.$confirm('是否确认导出查询数据项?', '警告', { this.$confirm('是否确认导出查询数据项?', '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
@ -206,7 +213,7 @@ export default {
} }
data.uniCons = this.previewDate.uconList data.uniCons = this.previewDate.uconList
//todo //todo
RealData(data).then(res => { realData(data).then(res => {
this.previewDate.data = res.rows this.previewDate.data = res.rows
this.total = res.total this.total = res.total
}) })
@ -245,13 +252,24 @@ export default {
this.msgSuccess(res.msg) this.msgSuccess(res.msg)
}) })
}, },
doOnLine() { changeOnLine(release) {
this.$confirm('请确认top图结构无误并预览结果无误后上线?', '警告', { let that = this
this.$confirm(release === 1?'请确认top图结构无误并预览结果无误后上线?':'请确认是否撤销当前发布内容!', '警告', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
let data = {
id: that.baseData.id,
isRelease: release
}
Release(data).then(res => {
that.$router.replace('/tool/er-top')
Message({
message: res.msg,
type: 'success'
})
})
}) })
}, },
// //
@ -286,10 +304,6 @@ export default {
}), }),
id: this.topId id: this.topId
} }
console.log({
nodes: nodes,
edges: edges
})
preview(data).then(res => { preview(data).then(res => {
this.previewDate.data = res.rows this.previewDate.data = res.rows
this.previewDate.total = res.total this.previewDate.total = res.total
@ -306,7 +320,6 @@ export default {
prop: info.prop prop: info.prop
}) })
}) })
this.previewDate.title = this.baseData.uqName + '数据预览' this.previewDate.title = this.baseData.uqName + '数据预览'
this.previewDate.open = true this.previewDate.open = true
}) })
@ -316,7 +329,6 @@ export default {
}, },
randomChange() { randomChange() {
let graphData = deepClone(this.$refs.topology.getGraphData()) let graphData = deepClone(this.$refs.topology.getGraphData())
let { nodes } = graphData
this.$refs.topology.changeGraphData(graphData) this.$refs.topology.changeGraphData(graphData)
} }
} }

View File

@ -0,0 +1,3 @@
import Vue from "vue";
export const eventBus = new Vue();