接口报错

yanzili 3 years ago
parent b2dbff671d
commit db4ee4ca6d

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

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

@ -46,19 +46,55 @@ export const constantRouterMap = [
] ]
}, },
{ {
path: '/report', path: '/datasource',
component: Layout, component: Layout,
redirect: '/report/datasource', redirect: '/report/datasource',
name: '报表管理', name: '数据源',
meta: { title: '报表管理', icon: 'iconnavicon-ywcs' }, meta: { title: '数据源', icon: 'iconnavicon-ywcs' },
children: [ children: [
{ path: 'datasource', name: 'datasource', component: () => import('@/views/report/datasource/index'), meta: { title: '数据源', icon: 'iconeventbridgexiaoxishijianzongxian', keepAlive: true, isBack: true } }, { 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: '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: '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: '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: '/404', component: () => import('@/views/404'), hidden: true },
{ path: '*', redirect: '/index', hidden: true }, { path: '*', redirect: '/index', hidden: true },
] ]

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

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

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

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

Loading…
Cancel
Save