接口报错

yanzili 3 years ago
parent b2dbff671d
commit db4ee4ca6d

@ -1,6 +1,6 @@
import axios from 'axios';
import { Message, MessageBox } from 'element-ui';
import { setItem, getItem, delItem } from '@/utils/storage';
import { getItem, delItem } from '@/utils/storage';
import signUtil from '@/utils/signUtil';
import { deepClone } from "@/utils"
@ -9,7 +9,7 @@ const service = axios.create({
withCredentials: false,
timeout: 60000,
headers: {
'Content-Type': 'application/json',
'Content-Type': 'application/json'
}
})
@ -17,8 +17,8 @@ service.interceptors.request.use(
config => {
// 在发送请求之前做些什么
var token = getItem('token');
config = signUtil.sign(token, deepClone(config));
// console.log(config, 'config')
// config = signUtil.sign(token, deepClone(config));
console.log(config, 'config')
return config
},
error => {
@ -32,27 +32,24 @@ service.interceptors.request.use(
service.interceptors.response.use(
response => {
const res = response.data;
if (res.repCode == '0000') {
if (res.code == 200) {
return res
}
else if (res.repCode == '0024') {
else if (res.code == '0024') {
//登录超时或被登出,弹确认框,用户确认后,跳转到登录页面
MessageBox({
message: "当前登录已失效或异地登录,请重新登录",
type: 'error',
duration: 3 * 1000,
}).then(() => {
console.log(1)
sessionStorage.clear();
localStorage.clear();
delItem('token')
// location.reload();
window.location.href = "/";
}).catch(err => {
console.log(2)
})
} else if (res.repCode == "3100" || res.repCode == "3101") {
} else if (res.code == "3100" || res.code == "3101") {
return res;
}
else {
@ -65,13 +62,13 @@ service.interceptors.response.use(
}
},
error => {
var errorStatus = error.response.status;
var errorStatus = error.response.code;
var errorData = error.response.data;
var messageTxt = "";
if (errorStatus != 200) {
messageTxt = "服务器内部错误,请联系管理员";
} else {
messageTxt = '失败原因:' + errorData.repCode + '--' + errorData.repMsg;
messageTxt = '失败原因:' + errorData.code + '--' + errorData.repMsg;
}
Message({
message: messageTxt,

@ -8,15 +8,15 @@
import request from '@/utils/request'
// 数据字典接口
export function dataDictionary(dictName) {
export function dataDictionary (dictName) {
return request({
url: `/gaeaDict/select/${dictName}`,
url: '/gaeaDict/select/' + dictName,
method: 'GET',
})
}
// 图片上传接口
export function uploadImg(data) {
export function uploadImg (data) {
return request({
url: '/file/upload',
method: 'POST',

@ -1,35 +0,0 @@
import request from '@/utils/request'
/** i18n版本*/
export function add (data) {
return request({
url: 'deviceInfo',
method: 'post',
data,
})
}
export function del (ids) {
return request({
url: 'deviceInfo/' + ids,
method: 'delete',
data: ids,
})
}
export function edit (data) {
return request({
url: 'deviceInfo',
method: 'put',
data,
})
}
export function preview (data) {
return request({
url: 'deviceInfo/' + data.id,
method: 'get',
params: data,
})
}
export default { add, edit, del, preview }

@ -5,16 +5,15 @@
* @Last Modified time: 2021-03-04 10:46:26
*/
import request from '@/utils/request'
import { add, del, edit, preview } from '@/api/deviceInfo'
// datasource
export function pageList(params) {
export function pageList (params) {
return request({
url: '/dataSource/pageList',
method: 'get',
params,
})
}
export function dataSource(data) {
export function dataSource (data) {
return request({
url: '/dataSource/' + data.id,
method: 'get',
@ -22,28 +21,28 @@ export function dataSource(data) {
})
}
// delete datasource
export function deleteDataSource(data) {
export function deleteDataSource (data) {
return request({
url: '/dataSource/' + data.id,
method: 'delete',
data,
})
}
export function testConnection(data) {
export function testConnection (data) {
return request({
url: '/dataSource/testConnection',
method: 'post',
data,
})
}
export function addDataSource(data) {
export function addDataSource (data) {
return request({
url: '/dataSource',
method: 'post',
data,
})
}
export function editDataSource(data) {
export function editDataSource (data) {
return request({
url: '/dataSource',
method: 'put',
@ -51,21 +50,21 @@ export function editDataSource(data) {
})
}
// resultset
export function dataSetPreview(data) {
export function dataSetPreview (data) {
return request({
url: `/dataSet/detailBysetId/${data.id}`,
method: 'get',
})
}
export function addDataSet(data) {
export function addDataSet (data) {
return request({
url: '/dataSet',
method: 'post',
data,
})
}
export function editDataSet(data) {
export function editDataSet (data) {
return request({
url: '/dataSet',
method: 'put',
@ -73,7 +72,7 @@ export function editDataSet(data) {
})
}
// delete dataset
export function deleteDataSet(data) {
export function deleteDataSet (data) {
return request({
url: '/dataSet/' + data.id,
method: 'delete',
@ -81,7 +80,7 @@ export function deleteDataSet(data) {
})
}
// 下拉数据源
export function queryAllDataSourceSet(data) {
export function queryAllDataSourceSet (data) {
return request({
url: '/dataSource/queryAllDataSource',
method: 'get',
@ -89,7 +88,7 @@ export function queryAllDataSourceSet(data) {
})
}
// 数据集高级规则js验证
export function verificationSet(data) {
export function verificationSet (data) {
return request({
url: '/dataSetParam/verification',
method: 'post',
@ -97,7 +96,7 @@ export function verificationSet(data) {
})
}
// 测试数据转换以及返回数据table列表
export function testTransformSet(data) {
export function testTransformSet (data) {
return request({
url: '/dataSet/testTransform',
method: 'post',
@ -106,7 +105,7 @@ export function testTransformSet(data) {
}
// report
export function reportPageList(params) {
export function reportPageList (params) {
return request({
url: '/report/pageList',
method: 'get',
@ -114,7 +113,7 @@ export function reportPageList(params) {
})
}
// report
export function addReport(data) {
export function addReport (data) {
return request({
url: '/report',
method: 'post',
@ -123,7 +122,7 @@ export function addReport(data) {
}
// report
export function editReport(data) {
export function editReport (data) {
return request({
url: '/report',
method: 'put',
@ -132,7 +131,7 @@ export function editReport(data) {
}
// report
export function delReport(data) {
export function delReport (data) {
return request({
url: '/report/delReport',
method: 'delete',
@ -141,7 +140,7 @@ export function delReport(data) {
}
// report
export function detailReport(id, accessKey) {
export function detailReport (id, accessKey) {
return request({
url: `/report/${id}?accessKey=${accessKey}`,
method: 'get',
@ -149,7 +148,7 @@ export function detailReport(id, accessKey) {
}
// reportExcel
export function addReportExcel(data) {
export function addReportExcel (data) {
return request({
url: '/reportExcel',
method: 'post',
@ -158,13 +157,10 @@ export function addReportExcel(data) {
}
// reportExcel
export function editReportExcel(data) {
export function editReportExcel (data) {
return request({
url: '/reportExcel',
method: 'put',
data,
})
}
export default { add, edit, del, preview }
}

@ -46,19 +46,55 @@ export const constantRouterMap = [
]
},
{
path: '/report',
path: '/datasource',
component: Layout,
redirect: '/report/datasource',
name: '报表管理',
meta: { title: '报表管理', icon: 'iconnavicon-ywcs' },
name: '数据源',
meta: { title: '数据源', icon: 'iconnavicon-ywcs' },
children: [
{ path: 'datasource', name: 'datasource', component: () => import('@/views/report/datasource/index'), meta: { title: '数据源', icon: 'iconeventbridgexiaoxishijianzongxian', keepAlive: true, isBack: true } },
]
},
{
path: '/resultset',
component: Layout,
redirect: '/report/resultset',
name: '数据集',
meta: { title: '数据集', icon: 'iconnavicon-ywcs' },
children: [
{ path: 'resultset', name: 'resultset', component: () => import('@/views/report/resultset/index'), meta: { title: '数据集', icon: 'iconalikafkaxiaoxiduilieKafka', keepAlive: true, isBack: true } },
]
},
{
path: '/report',
component: Layout,
redirect: '/report/report',
name: '报表管理',
meta: { title: '报表管理', icon: 'iconnavicon-ywcs' },
children: [
{ path: 'report', name: 'reportIndex', component: () => import('@/views/report/report/index'), meta: { title: '报表管理', icon: 'iconnavicon-ywcs', keepAlive: true, isBack: true } },
]
},
{
path: '/bigscreen',
component: Layout,
redirect: '/report/bigscreen',
name: '大屏报表',
meta: { title: '大屏报表', icon: 'iconnavicon-ywcs' },
children: [
{ path: 'bigscreen', name: 'bigscreen', component: () => import('@/views/report/bigscreen/index'), meta: { title: '大屏报表', icon: 'iconchufaqipeizhi-hui', keepAlive: true, isBack: true } },
{ path: 'excelreport', name: 'excelreport', component: () => import('@/views/report/excelreport/index'), meta: { title: '表格报表', icon: 'iconliebiao', keepAlive: true, isBack: true } },
]
},
// {
// path: '/report',
// component: Layout,
// redirect: '/report/excelreport',
// name: '表格报表',
// meta: { title: '表格报表', icon: 'iconnavicon-ywcs' },
// children: [
// { path: 'excelreport', name: 'excelreport', component: () => import('@/views/report/excelreport/index'), meta: { title: '表格报表', icon: 'iconliebiao', keepAlive: true, isBack: true } },
// ]
// },
{ path: '/404', component: () => import('@/views/404'), hidden: true },
{ path: '*', redirect: '/index', hidden: true },
]

@ -28,7 +28,6 @@
<br>
<p class="title_name">在线大屏</p>
</h3>
<!-- <lang-select class="set_language" /> -->
</div>
<div class="form_fields">
<!-- 黄色条条 -->
@ -74,7 +73,6 @@
<span class="show_pwd"
@click="showPwd">
查看
<!-- <svg-icon :icon-class="passwordType === 'password' ? 'eye' : 'eye-open'" /> -->
</span>
</el-form-item>
</el-tooltip>
@ -86,7 +84,6 @@
type="checkbox">
<p>记住密码</p>
</div>
<!-- <p>{{ $t('login.forgetPsw') }}</p> -->
</div>
<el-button :loading="loading"
type="primary"
@ -162,7 +159,6 @@ export default {
getPsw () {
const cookVal = cookies.get(`u_${this.loginForm.username}`)
this.loginForm.password = cookVal && Decrypt(cookVal)
console.log(this.loginForm)
},
// top
setTop (val) {
@ -190,7 +186,6 @@ export default {
if (valid) {
this.$refs.verify.show()
} else {
console.log('error submit!!')
return false
}
})
@ -214,7 +209,6 @@ export default {
}
this.loginApi()
} else {
console.log('error submit!!')
return false
}
})

@ -20,6 +20,7 @@
<el-form-item label="数据源名称"
label-width="120px">
<el-input v-model.trim="params.sourceName"
size="mini"
clearable
placeholder="数据源名称"
class="filter-item"
@ -34,6 +35,7 @@
<el-form-item label="数据源编码"
label-width="120px">
<el-input v-model.trim="params.sourceCode"
size="mini"
clearable
placeholder="数据源Code"
class="filter-item"
@ -46,6 +48,7 @@
:lg="6"
:xl="4">
<el-form-item label="数据源类型"
size="mini"
label-width="120px">
<Dictionary v-model="params.sourceType"
:updata-dict="params.sourceType"
@ -58,14 +61,17 @@
:lg="4"
:xl="4">
<el-button type="primary"
size="mini"
@click="search('form')">查询</el-button>
<el-button type="danger"
size="mini"
@click="reset('form')">重置</el-button>
</el-col>
</el-row>
</el-form>
<el-button type="primary"
icon="el-icon-plus"
size="mini"
@click="showAddLogModel()">新增</el-button>
<!--表格渲染-->

@ -20,6 +20,7 @@
<el-form-item label="名称"
label-width="120px">
<el-input v-model="params.reportName"
size="mini"
clearable
placeholder="名称"
class="filter-item" />
@ -33,6 +34,7 @@
<el-form-item label="报表编码"
label-width="120px">
<el-input v-model="params.reportCode"
size="mini"
clearable
placeholder="报表编码"
class="filter-item" />
@ -44,10 +46,11 @@
:lg="6"
:xl="4">
<el-form-item label="报表类型"
label-width="120px">
<Dictionary v-model="params.reportType"
label-width="120px"
size="mini">
<!-- <Dictionary v-model="params.reportType"
:updata-dict="params.reportType"
:dict-key="'REPORT_TYPE'" />
:dict-key="'REPORT_TYPE'" /> -->
</el-form-item>
</el-col>
<el-col :xs="24"
@ -56,13 +59,16 @@
:lg="4"
:xl="4">
<el-button type="primary"
size="mini"
@click="search('form')">查询</el-button>
<el-button type="danger"
size="mini"
@click="reset('form')">重置</el-button>
</el-col>
</el-row>
</el-form>
<el-button type="primary"
size="mini"
icon="el-icon-plus"
@click="showAddReportModel()">新增</el-button>
@ -214,7 +220,7 @@
<script>
import { dataDictionary } from '@/api/common'
import { report, reportPageList, addReport, editReport, delReport } from '@/api/report'
import { reportPageList, addReport, editReport, delReport } from '@/api/report'
import Dictionary from '@/components/Dictionary/index'
var typeData
export default {
@ -272,16 +278,16 @@ export default {
typeData = this
},
created () {
this.$nextTick(() => {
dataDictionary('REPORT_GROUP').then((res) => {
this.dictionaryGroupOptions = res.data
this.dialogForm.reportGroup = this.dictionaryGroupOptions[0].text
})
dataDictionary('REPORT_TYPE').then((res) => {
this.dictionaryTypeOptions = res.data;
this.dialogForm.reportType = this.dictionaryTypeOptions[0].text
})
})
// this.$nextTick(() => {
// dataDictionary('REPORT_GROUP').then((res) => {
// this.dictionaryGroupOptions = res.data
// this.dialogForm.reportGroup = this.dictionaryGroupOptions[0].text
// })
// dataDictionary('REPORT_TYPE').then((res) => {
// this.dictionaryTypeOptions = res.data;
// this.dialogForm.reportType = this.dictionaryTypeOptions[0].text
// })
// })
this.queryByPage()
},
@ -405,5 +411,3 @@ export default {
},
}
</script>
<style scoped lang="scss"></style>

@ -17,6 +17,7 @@
<el-form-item label="数据集名称"
label-width="120px">
<el-input v-model.trim="query.setName"
size="mini"
clearable
placeholder="数据源名称"
class="filter-item" />
@ -30,6 +31,7 @@
<el-form-item label="数据集编码"
label-width="120px">
<el-input v-model.trim="query.setCode"
size="mini"
clearable
placeholder="数据集编码"
class="filter-item" />
@ -38,6 +40,7 @@
</el-row>
</el-form>
<el-button type="primary"
size="mini"
@click="addOrEditDataSet()">+ 新增</el-button>
<!--表格渲染-->

Loading…
Cancel
Save