top升级
This commit is contained in:
parent
e127a8ef3a
commit
047bdad640
|
|
@ -4,6 +4,7 @@ ENV = 'development'
|
|||
# EBTS/开发环境
|
||||
#VUE_APP_BASE_API = '/dev-api'
|
||||
VUE_APP_BASE_API = 'http://localhost:8085/dev-api'
|
||||
#VUE_APP_BASE_API = 'https://api.ebts.top/dev-api'
|
||||
|
||||
|
||||
# 路由懒加载
|
||||
|
|
|
|||
|
|
@ -1,14 +1,14 @@
|
|||
import request from "@/utils/request";
|
||||
|
||||
// 获取查询基本信息
|
||||
export function RealInfo(id){
|
||||
export function realInfo(id){
|
||||
return request({
|
||||
url: "/data/real/"+id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
// 查询数据
|
||||
export function RealData(data){
|
||||
export function realData(data){
|
||||
return request({
|
||||
url: "/data/real",
|
||||
method: 'put',
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export default {
|
|||
},
|
||||
pathCompile(path) {
|
||||
const { params } = this.$route
|
||||
var toPath = pathToRegexp.compile(path)
|
||||
let toPath = pathToRegexp.compile(path)
|
||||
return toPath(params)
|
||||
},
|
||||
handleLink(item) {
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@
|
|||
:key="item.id"
|
||||
: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
|
||||
:placeholder="outPlaceholder(item)"
|
||||
size="small"
|
||||
@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-col :span="12">
|
||||
<el-input size="small" placeholder="开始值" v-model="item.ucReal.begin"></el-input>
|
||||
|
|
@ -22,14 +22,14 @@
|
|||
</el-row>
|
||||
</div>
|
||||
<el-date-picker
|
||||
v-else-if="item.type ==3"
|
||||
v-else-if="item.type ===3"
|
||||
v-model="item.ucReal"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
value-format="yyyy-MM-dd"
|
||||
placeholder="选择日期时间">
|
||||
</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"
|
||||
size="small"
|
||||
style="width: 240px"
|
||||
|
|
@ -78,13 +78,13 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
import {RealInfo, RealData,exportReal} from "@/api/system/data"
|
||||
import {realInfo, realData, exportReal} from "@/api/system/data"
|
||||
|
||||
function listInit(list) {
|
||||
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}
|
||||
} else if (list[i].type == 4) {
|
||||
} else if (list[i].type === 4) {
|
||||
list[i].ucReal = []
|
||||
}
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ export default {
|
|||
},
|
||||
created() {
|
||||
this.dataId = this.$route.fullPath.split("/")[3]
|
||||
RealInfo(this.dataId).then(res => {
|
||||
realInfo(this.dataId).then(res => {
|
||||
let data = res.data
|
||||
this.uconList = listInit(data.uniCons)
|
||||
this.realDate.header = data.infoList
|
||||
|
|
@ -140,27 +140,23 @@ export default {
|
|||
pageSize: this.queryParams.pageSize,
|
||||
}
|
||||
data.uniCons = this.uconList
|
||||
RealData(data).then(res => {
|
||||
realData(data).then(res => {
|
||||
this.realDate.data = res.rows
|
||||
this.total = res.total
|
||||
// this.realDate.header = []
|
||||
// for (var key in this.realDate.data[0]) {
|
||||
// this.realDate.header.push(key)
|
||||
// }
|
||||
})
|
||||
},
|
||||
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
var that = this
|
||||
let that = this
|
||||
this.$confirm('是否确认导出查询数据项?', "警告", {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function () {
|
||||
let data = {
|
||||
id:that.dataId,
|
||||
uniCons:that.uconList,
|
||||
id: that.dataId,
|
||||
uniCons: that.uconList,
|
||||
}
|
||||
return exportReal(data)
|
||||
}).then(response => {
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
transform() {
|
||||
var mid = this.info.mId
|
||||
var str = ''
|
||||
var start = true
|
||||
let mid = this.info.mId
|
||||
let str = ''
|
||||
let start = true
|
||||
for (let i = 0; i < this.moduleList.length; i++) {
|
||||
if (mid == this.moduleList[i].id) {
|
||||
str = this.moduleList[i].mName
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@
|
|||
getClassPreview(id).then(res =>{
|
||||
this.preview.data = res.data;
|
||||
this.preview.open = true;
|
||||
var keys = Object.keys(res.data)
|
||||
let keys = Object.keys(res.data)
|
||||
this.preview.activeName = keys[0]
|
||||
})
|
||||
},
|
||||
|
|
@ -325,7 +325,7 @@
|
|||
/** 高亮显示 */
|
||||
highlightedCode(code, 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);
|
||||
return result.value || ' ';
|
||||
},
|
||||
|
|
@ -348,9 +348,9 @@
|
|||
this.$router.push("/apiclass/edit/" + apiclassId);
|
||||
},
|
||||
transform() {
|
||||
var mid = this.form.mId
|
||||
var str = ''
|
||||
var start = true
|
||||
let mid = this.form.mId
|
||||
let str = ''
|
||||
let start = true
|
||||
for (let i = 0; i < this.moduleList.length; i++) {
|
||||
if (mid == this.moduleList[i].id) {
|
||||
str = this.moduleList[i].mName
|
||||
|
|
|
|||
|
|
@ -641,7 +641,7 @@ export default {
|
|||
},
|
||||
/** 设置关联外键 */
|
||||
setSubTableColumns(value) {
|
||||
for (var item in this.tables) {
|
||||
for (let item in this.tables) {
|
||||
const name = this.tables[item].tableName;
|
||||
if (value === name) {
|
||||
this.subColumns = this.tables[item].columns;
|
||||
|
|
|
|||
|
|
@ -309,7 +309,7 @@ export default {
|
|||
/** 高亮显示 */
|
||||
highlightedCode(code, 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);
|
||||
return result.value || ' ';
|
||||
},
|
||||
|
|
|
|||
|
|
@ -251,7 +251,7 @@ export default {
|
|||
getModulePreview(id).then(res=>{
|
||||
this.preview.data = res.data;
|
||||
this.preview.open = true;
|
||||
var keys = Object.keys(res.data)
|
||||
let keys = Object.keys(res.data)
|
||||
this.preview.activeName = keys[0]
|
||||
})
|
||||
},
|
||||
|
|
@ -262,7 +262,7 @@ export default {
|
|||
/** 高亮显示 */
|
||||
highlightedCode(code, 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);
|
||||
return result.value || ' ';
|
||||
},
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@
|
|||
},
|
||||
methods:{
|
||||
transform() {
|
||||
var mid = this.info.mId
|
||||
var str = ''
|
||||
var start = true
|
||||
let mid = this.info.mId
|
||||
let str = ''
|
||||
let start = true
|
||||
for (let i = 0; i < this.moduleList.length; i++) {
|
||||
if (mid == this.moduleList[i].id) {
|
||||
str = this.moduleList[i].mName
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@
|
|||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['tool:query:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -57,7 +58,8 @@
|
|||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['tool:query:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -68,7 +70,8 @@
|
|||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['tool:query:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -78,16 +81,17 @@
|
|||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['tool:query:export']"
|
||||
>导出</el-button>
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<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 label="名称" align="center" prop="uqName" />
|
||||
<el-table-column label="描述" align="center" prop="uqDescribe" />
|
||||
<el-table-column label="名称" align="center" prop="uqName"/>
|
||||
<el-table-column label="描述" align="center" prop="uqDescribe"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||
|
|
@ -100,6 +104,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.isRelease===2">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -113,7 +118,7 @@
|
|||
icon="el-icon-edit-outline"
|
||||
@click="handleEditTable(scope.row)"
|
||||
v-hasPermi="['tool:query:update']"
|
||||
>编辑</el-button>
|
||||
>设计</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -121,6 +126,15 @@
|
|||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['tool:query:remove']"
|
||||
>删除</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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -137,13 +151,10 @@
|
|||
<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="uqName">
|
||||
<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-input v-model="form.uqName" placeholder="请输入名称"/>
|
||||
</el-form-item>
|
||||
<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>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
|
@ -155,12 +166,12 @@
|
|||
</template>
|
||||
|
||||
<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 {
|
||||
name: "Query",
|
||||
components: {
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
|
@ -189,17 +200,17 @@ export default {
|
|||
pageSize: 10,
|
||||
uqName: null,
|
||||
uqDescribe: null,
|
||||
type:1
|
||||
type: 1
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
uqName: [
|
||||
{ required: true, message: "名称不能为空}", trigger: "blur" },
|
||||
{required: true, message: "名称不能为空}", trigger: "blur"},
|
||||
],
|
||||
uqDescribe: [
|
||||
{ required: true, message: "描述不能为空}", trigger: "blur" },
|
||||
{required: true, message: "描述不能为空}", trigger: "blur"},
|
||||
],
|
||||
}
|
||||
};
|
||||
|
|
@ -211,7 +222,7 @@ export default {
|
|||
/** 查询万能查询列表 */
|
||||
getList() {
|
||||
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.total = response.total;
|
||||
this.loading = false;
|
||||
|
|
@ -227,7 +238,6 @@ export default {
|
|||
this.form = {
|
||||
id: null,
|
||||
uqName: null,
|
||||
uqSql: null,
|
||||
uqDescribe: null,
|
||||
};
|
||||
this.resetForm("form");
|
||||
|
|
@ -237,9 +247,30 @@ export default {
|
|||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
handleEditTable(row){
|
||||
handleEditTable(row) {
|
||||
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() {
|
||||
this.daterangeCreateTime = [];
|
||||
|
|
@ -249,7 +280,7 @@ export default {
|
|||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
|
|
@ -296,7 +327,7 @@ export default {
|
|||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
}).then(function () {
|
||||
return delQuery(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
|
|
@ -310,7 +341,7 @@ export default {
|
|||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
}).then(function () {
|
||||
return exportQuery(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
|
|
|
|||
|
|
@ -23,20 +23,19 @@
|
|||
</el-form-item>
|
||||
</el-col>
|
||||
<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-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-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="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"
|
||||
@click="handRelease(1)"
|
||||
>发布
|
||||
@click="handRelease(1)">发布
|
||||
</el-button>
|
||||
<el-button v-if="info.isRelease === 1" type="text" icon="el-icon-error" size="medium"
|
||||
@click="handRelease(2)"
|
||||
>撤销
|
||||
@click="handRelease(2)">撤销
|
||||
</el-button>
|
||||
</el-col>
|
||||
</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.js'
|
||||
import 'codemirror/addon/hint/sql-hint.js'
|
||||
import { getQueryInfo, editQueryInfo, previewQueryData, Release, exportMock } from '@/api/tool/query'
|
||||
import { Message } from 'element-ui'
|
||||
import {getQueryInfo, editQueryInfo, previewQueryData, Release, exportMock} from '@/api/tool/query'
|
||||
import {Message} from 'element-ui'
|
||||
|
||||
function JSONString(list) {
|
||||
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)
|
||||
} else if (list[i].type == 4) {
|
||||
} else if (list[i].type === 4) {
|
||||
let time = {
|
||||
startTime: list[i].ucMock[0],
|
||||
endTime: list[i].ucMock[1]
|
||||
|
|
@ -258,7 +256,7 @@ export default {
|
|||
// 显示行号
|
||||
lineNumbers: true,
|
||||
line: true,
|
||||
extraKeys: { 'Tab': 'autocomplete' },
|
||||
extraKeys: {'Tab': 'autocomplete'},
|
||||
lineWrapping: true,//代码折叠
|
||||
matchBrackets: true//括号匹配
|
||||
}
|
||||
|
|
@ -285,8 +283,8 @@ export default {
|
|||
header: []
|
||||
},
|
||||
rules: {
|
||||
uqName: [{ required: true, message: '请输入名称', trigger: 'blur' }],
|
||||
uqDescribe: [{ required: true, message: '请输入描述', trigger: 'blur' }]
|
||||
uqName: [{required: true, message: '请输入名称', trigger: 'blur'}],
|
||||
uqDescribe: [{required: true, message: '请输入描述', trigger: 'blur'}]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -302,7 +300,7 @@ export default {
|
|||
this.columns = JSONparse(data.list)
|
||||
this.sqlConfig.coder.setValue(this.info.uqSql)
|
||||
})
|
||||
this.$nextTick(function() {
|
||||
this.$nextTick(function () {
|
||||
this.initialize()
|
||||
})
|
||||
},
|
||||
|
|
@ -329,7 +327,7 @@ export default {
|
|||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function() {
|
||||
}).then(function () {
|
||||
that.doFieldExtract()
|
||||
})
|
||||
}
|
||||
|
|
@ -374,7 +372,7 @@ export default {
|
|||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'info'
|
||||
}).then(function() {
|
||||
}).then(function () {
|
||||
that.doFieldExtractToPreviewData()
|
||||
})
|
||||
return
|
||||
|
|
@ -425,15 +423,22 @@ export default {
|
|||
},
|
||||
/** 发布与撤销 */
|
||||
handRelease(release) {
|
||||
let data = {
|
||||
id: this.queryId,
|
||||
isRelease: release
|
||||
}
|
||||
Release(data).then(res => {
|
||||
this.info.isRelease = (this.info.isRelease == 1) ? 2 : 1
|
||||
Message({
|
||||
message: res.msg,
|
||||
type: 'success'
|
||||
let that = this
|
||||
this.$confirm('是否确认'+(release===2?'撤销':'发布')+'该查询?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
let data = {
|
||||
id: that.queryId,
|
||||
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 => {
|
||||
if (valid) {
|
||||
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 (this.changUniCon(list)) {
|
||||
data.uniCons = list
|
||||
|
|
@ -450,8 +460,6 @@ export default {
|
|||
return
|
||||
}
|
||||
}
|
||||
data.pageNum = this.queryParams.pageNum
|
||||
data.pageSize = this.queryParams.pageSize
|
||||
previewQueryData(data).then(res => {
|
||||
this.previewDate.data = res.rows
|
||||
this.total = res.total
|
||||
|
|
@ -465,7 +473,7 @@ export default {
|
|||
})
|
||||
})
|
||||
} else {
|
||||
for (var key in this.previewDate.data[0]) {
|
||||
for (let key in this.previewDate.data[0]) {
|
||||
this.previewDate.header.push({
|
||||
key: key,
|
||||
label: key,
|
||||
|
|
@ -499,6 +507,9 @@ export default {
|
|||
/** 删除按钮 */
|
||||
handleDelete(index) {
|
||||
this.columns.splice(index, 1)
|
||||
if (!this.columns) {
|
||||
this.columns = []
|
||||
}
|
||||
},
|
||||
ucTypeChang(index, row) {
|
||||
if (row.ucType == 'input' && row.ucCon != 'BETWEEN') {
|
||||
|
|
@ -508,7 +519,7 @@ export default {
|
|||
}
|
||||
} else if (row.ucType == 'input' && row.ucCon == 'BETWEEN') {
|
||||
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') {
|
||||
this.columns[index].type = 3
|
||||
this.columns[index].ucMock = ''
|
||||
|
|
@ -540,7 +551,7 @@ export default {
|
|||
if (list.length > 0) {
|
||||
data.uniCons = list
|
||||
}
|
||||
if (this.columnInfo.list.length === 0){
|
||||
if (this.columnInfo.list.length === 0) {
|
||||
Message({
|
||||
message: '字段信息为空,请提取字段信息',
|
||||
type: 'error'
|
||||
|
|
@ -563,14 +574,15 @@ export default {
|
|||
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
var that = this
|
||||
let list = JSONString(that.cloumns)
|
||||
let that = this
|
||||
console.log(this.columns);
|
||||
let list = JSONString(that.columns)
|
||||
let data = that.info
|
||||
this.$confirm('是否确认导出查询数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function() {
|
||||
}).then(function () {
|
||||
if (list.length > 0) {
|
||||
if (that.changUniCon(list)) {
|
||||
data.uniCons = list
|
||||
|
|
@ -580,7 +592,7 @@ export default {
|
|||
}
|
||||
return exportMock(data)
|
||||
}).then(response => {
|
||||
that.cloumns = JSONparse(list)
|
||||
that.columns = JSONparse(list)
|
||||
this.download(response.msg)
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,8 @@
|
|||
size="mini"
|
||||
@click="handleAdd"
|
||||
v-hasPermi="['tool:query:add']"
|
||||
>新增</el-button>
|
||||
>新增
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -57,7 +58,8 @@
|
|||
:disabled="single"
|
||||
@click="handleUpdate"
|
||||
v-hasPermi="['tool:query:edit']"
|
||||
>修改</el-button>
|
||||
>修改
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -68,7 +70,8 @@
|
|||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
v-hasPermi="['tool:query:remove']"
|
||||
>删除</el-button>
|
||||
>删除
|
||||
</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
|
|
@ -78,16 +81,17 @@
|
|||
size="mini"
|
||||
@click="handleExport"
|
||||
v-hasPermi="['tool:query:export']"
|
||||
>导出</el-button>
|
||||
>导出
|
||||
</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<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 label="名称" align="center" prop="uqName" />
|
||||
<el-table-column label="描述" align="center" prop="uqDescribe" />
|
||||
<el-table-column label="名称" align="center" prop="uqName"/>
|
||||
<el-table-column label="描述" align="center" prop="uqDescribe"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{m}:{s}') }}</span>
|
||||
|
|
@ -100,6 +104,7 @@
|
|||
</el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.isRelease===2">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -113,7 +118,7 @@
|
|||
icon="el-icon-edit-outline"
|
||||
@click="handleEditTable(scope.row)"
|
||||
v-hasPermi="['top:edit']"
|
||||
>编辑</el-button>
|
||||
>设计</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
|
|
@ -121,6 +126,15 @@
|
|||
@click="handleDelete(scope.row)"
|
||||
v-hasPermi="['tool:query:remove']"
|
||||
>删除</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>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
|
@ -137,10 +151,10 @@
|
|||
<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="uqName">
|
||||
<el-input v-model="form.uqName" placeholder="请输入名称" />
|
||||
<el-input v-model="form.uqName" placeholder="请输入名称"/>
|
||||
</el-form-item>
|
||||
<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>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
|
|
@ -152,12 +166,12 @@
|
|||
</template>
|
||||
|
||||
<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 {
|
||||
name: "Query",
|
||||
components: {
|
||||
},
|
||||
components: {},
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
|
|
@ -186,17 +200,17 @@ export default {
|
|||
pageSize: 10,
|
||||
uqName: null,
|
||||
uqDescribe: null,
|
||||
type:2
|
||||
type: 2
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
uqName: [
|
||||
{ required: true, message: "名称不能为空}", trigger: "blur" },
|
||||
{required: true, message: "名称不能为空}", trigger: "blur"},
|
||||
],
|
||||
uqDescribe: [
|
||||
{ required: true, message: "描述不能为空}", trigger: "blur" },
|
||||
{required: true, message: "描述不能为空}", trigger: "blur"},
|
||||
],
|
||||
}
|
||||
};
|
||||
|
|
@ -208,7 +222,7 @@ export default {
|
|||
/** 查询万能查询列表 */
|
||||
getList() {
|
||||
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.total = response.total;
|
||||
this.loading = false;
|
||||
|
|
@ -234,8 +248,9 @@ export default {
|
|||
this.queryParams.pageNum = 1;
|
||||
this.getList();
|
||||
},
|
||||
handleEditTable(row){
|
||||
this.$router.push("/top/edit/" + row.id);
|
||||
handleEditTable(row) {
|
||||
window.open("/top/edit/" + row.id)
|
||||
// this.$router.push("/top/edit/" + row.id);
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
|
|
@ -246,7 +261,7 @@ export default {
|
|||
// 多选框选中数据
|
||||
handleSelectionChange(selection) {
|
||||
this.ids = selection.map(item => item.id)
|
||||
this.single = selection.length!==1
|
||||
this.single = selection.length !== 1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
|
|
@ -293,13 +308,34 @@ export default {
|
|||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
}).then(function () {
|
||||
return delQuery(ids);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
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() {
|
||||
const queryParams = this.queryParams;
|
||||
|
|
@ -307,7 +343,7 @@ export default {
|
|||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning"
|
||||
}).then(function() {
|
||||
}).then(function () {
|
||||
return exportQuery(queryParams);
|
||||
}).then(response => {
|
||||
this.download(response.msg);
|
||||
|
|
|
|||
|
|
@ -49,22 +49,33 @@
|
|||
<!--<el-button size="mini" @click="$parent.dagreLayoutHandler">层次</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: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" 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>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Button, Dropdown } from '../../elements';
|
||||
|
||||
import {eventBus} from "@/views/tool/top/utils/eventBus";
|
||||
export default {
|
||||
name: "ToolbarEdit",
|
||||
components: {
|
||||
"top-button": Button,
|
||||
"top-dropdown": Dropdown
|
||||
},
|
||||
data(){
|
||||
return{
|
||||
isRelease:null
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
eventBus.$on('isRelease',(res)=> {
|
||||
this.isRelease = res
|
||||
})
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -840,7 +840,8 @@ export default {
|
|||
},
|
||||
// 返回
|
||||
reBack() {
|
||||
this.$router.replace('/tool/er-top')
|
||||
window.close()
|
||||
// this.$router.replace('/tool/er-top')
|
||||
},
|
||||
undoHandler() {
|
||||
if (this.historyIndex > 0 && this.historyIndex - (this.undoCount + 1) >= 0) {
|
||||
|
|
@ -1374,8 +1375,12 @@ export default {
|
|||
this.$emit('doPreview', graphData)
|
||||
},
|
||||
// 上线
|
||||
searchOnLine() {
|
||||
this.$emit('doOnLine')
|
||||
searchOnLine(release) {
|
||||
this.$emit('doOnLine',release)
|
||||
},
|
||||
// 上线
|
||||
undoOnLine(release) {
|
||||
this.$emit('undoOnLine',release)
|
||||
},
|
||||
// 保存函数
|
||||
saveDataHandler() {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@
|
|||
@doChangeMode="doChangeMode"
|
||||
@doSaveData="doSaveData"
|
||||
@doPreview="doPreview"
|
||||
@doOnLine="doOnLine"
|
||||
@doOnLine="changeOnLine"
|
||||
@undoOnLine="changeOnLine"
|
||||
>
|
||||
|
||||
</topology>
|
||||
|
|
@ -23,13 +24,13 @@
|
|||
: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
|
||||
:placeholder="outPlaceholder(item)"
|
||||
size="small"
|
||||
@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-col :span="12">
|
||||
<el-input size="small" placeholder="开始值" v-model="item.ucReal.begin"></el-input>
|
||||
|
|
@ -40,7 +41,7 @@
|
|||
</el-row>
|
||||
</div>
|
||||
<el-date-picker
|
||||
v-else-if="item.type ==3"
|
||||
v-else-if="item.type ===3"
|
||||
v-model="item.ucReal"
|
||||
type="date"
|
||||
format="yyyy-MM-dd"
|
||||
|
|
@ -103,9 +104,11 @@
|
|||
import Topology from './packages/topology/src/topology'
|
||||
import { deepClone } from './utils/index'
|
||||
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 {eventBus} from "@/views/tool/top/utils/eventBus";
|
||||
import {Release} from "@/api/tool/query";
|
||||
import {Message} from "element-ui";
|
||||
export default {
|
||||
name: 'DemoTopology',
|
||||
components: {
|
||||
|
|
@ -155,6 +158,9 @@ export default {
|
|||
this.topId = this.$route.params && this.$route.params.topId
|
||||
getQuery(this.topId).then(res => {
|
||||
this.baseData = res.data
|
||||
eventBus.$emit('isRelease',this.baseData.isRelease)
|
||||
|
||||
console.log(res.data)
|
||||
if (res.data.topJson) {
|
||||
this.graphData = JSON.parse(res.data.topJson)
|
||||
} else {
|
||||
|
|
@ -163,6 +169,7 @@ export default {
|
|||
edges: []
|
||||
}
|
||||
}
|
||||
this.baseData.topJson = null
|
||||
let graphData = deepClone(this.graphData)
|
||||
this.$refs.topology.initTopo(graphData)
|
||||
this.randomChange()
|
||||
|
|
@ -183,7 +190,7 @@ export default {
|
|||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
var that = this
|
||||
let that = this
|
||||
this.$confirm('是否确认导出查询数据项?', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
|
|
@ -206,7 +213,7 @@ export default {
|
|||
}
|
||||
data.uniCons = this.previewDate.uconList
|
||||
//todo 需要修改
|
||||
RealData(data).then(res => {
|
||||
realData(data).then(res => {
|
||||
this.previewDate.data = res.rows
|
||||
this.total = res.total
|
||||
})
|
||||
|
|
@ -245,13 +252,24 @@ export default {
|
|||
this.msgSuccess(res.msg)
|
||||
})
|
||||
},
|
||||
doOnLine() {
|
||||
this.$confirm('请确认top图结构无误并预览结果无误后上线?', '警告', {
|
||||
changeOnLine(release) {
|
||||
let that = this
|
||||
this.$confirm(release === 1?'请确认top图结构无误并预览结果无误后上线?':'请确认是否撤销当前发布内容!', '警告', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).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
|
||||
}
|
||||
console.log({
|
||||
nodes: nodes,
|
||||
edges: edges
|
||||
})
|
||||
preview(data).then(res => {
|
||||
this.previewDate.data = res.rows
|
||||
this.previewDate.total = res.total
|
||||
|
|
@ -306,7 +320,6 @@ export default {
|
|||
prop: info.prop
|
||||
})
|
||||
})
|
||||
|
||||
this.previewDate.title = this.baseData.uqName + '数据预览'
|
||||
this.previewDate.open = true
|
||||
})
|
||||
|
|
@ -316,7 +329,6 @@ export default {
|
|||
},
|
||||
randomChange() {
|
||||
let graphData = deepClone(this.$refs.topology.getGraphData())
|
||||
let { nodes } = graphData
|
||||
this.$refs.topology.changeGraphData(graphData)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
import Vue from "vue";
|
||||
|
||||
export const eventBus = new Vue();
|
||||
Loading…
Reference in New Issue