update list response

This commit is contained in:
lb 2022-08-04 14:41:47 +08:00
parent d3752c4f40
commit 3df2939fb4
33 changed files with 79 additions and 76 deletions

View File

@ -10,6 +10,7 @@
window.SITE_CONFIG['version'] = 'v5.0.0';
window.SITE_CONFIG['nodeEnv'] = '<%= process.env.VUE_APP_NODE_ENV %>';
window.SITE_CONFIG['apiURL'] = ''; // api请求地址
window.SITE_CONFIG['projURL'] = '/yd-monitor'; // api请求地址
window.SITE_CONFIG['storeState'] = {}; // vuex本地储存初始化状态用于不刷新页面的情况下也能重置初始化项目中所有状态
window.SITE_CONFIG['contentTabDefault'] = { // 内容标签页默认属性对象
'name': '', // 名称, 由 this.$route.name 自动赋值(默认,名称 === 路由名称 === 路由路径)
@ -30,7 +31,7 @@
<!-- 开发环境 -->
<% if (process.env.VUE_APP_NODE_ENV === 'dev') { %>
<script>
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.65:8080/yd-monitor';
window.SITE_CONFIG['apiURL'] = 'http://192.168.1.65:8080';
</script>
<% } %>
<!-- 集成测试环境 -->

View File

@ -1,7 +1,7 @@
import Cookies from 'js-cookie'
import qs from 'qs'
export default {
data () {
data() {
/* eslint-disable */
return {
// 设置属性
@ -29,22 +29,24 @@ export default {
}
/* eslint-enable */
},
created () {
created() {
if (this.mixinViewModuleOptions.createdIsNeed) {
this.query()
}
},
activated () {
activated() {
if (this.mixinViewModuleOptions.activatedIsNeed) {
this.query()
}
},
methods: {
// 获取数据列表
query () {
query() {
this.dataListLoading = true
this.$http.get(
this.mixinViewModuleOptions.getDataListURL,
this.$http.adornUrl(
this.mixinViewModuleOptions.getDataListURL
),
{
params: {
order: this.order,
@ -68,11 +70,11 @@ export default {
})
},
// 多选
dataListSelectionChangeHandle (val) {
dataListSelectionChangeHandle(val) {
this.dataListSelections = val
},
// 排序
dataListSortChangeHandle (data) {
dataListSortChangeHandle(data) {
if (!data.order || !data.prop) {
this.order = ''
this.orderField = ''
@ -83,13 +85,13 @@ export default {
this.query()
},
// 分页, 每页条数
pageSizeChangeHandle (val) {
pageSizeChangeHandle(val) {
this.page = 1
this.limit = val
this.query()
},
// 分页, 当前页
pageCurrentChangeHandle (val) {
pageCurrentChangeHandle(val) {
this.page = val
this.query()
},
@ -98,7 +100,7 @@ export default {
this.query()
},
// 新增 / 修改
addOrUpdateHandle (id) {
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true
this.$nextTick(() => {
this.$refs.addOrUpdate.dataForm.id = id
@ -106,7 +108,7 @@ export default {
})
},
// 关闭当前窗口
closeCurrentTab (data) {
closeCurrentTab(data) {
var tabName = this.$store.state.contentTabsActiveName
this.$store.state.contentTabs = this.$store.state.contentTabs.filter(item => item.name !== tabName)
if (this.$store.state.contentTabs.length <= 0) {
@ -118,7 +120,7 @@ export default {
}
},
// 删除
deleteHandle (id) {
deleteHandle(id) {
if (this.mixinViewModuleOptions.deleteIsBatch && !id && this.dataListSelections.length <= 0) {
return this.$message({
message: this.$t('prompt.deleteBatch'),
@ -148,11 +150,11 @@ export default {
this.query()
}
})
}).catch(() => {})
}).catch(() => {})
}).catch(() => { })
}).catch(() => { })
},
// 导出
exportHandle () {
exportHandle() {
var params = qs.stringify({
'token': Cookies.get('token'),
...this.dataForm

View File

@ -92,7 +92,7 @@ router.beforeEach((to, from, next) => {
return next()
}
// 获取字典列表, 添加并全局变量保存
http.get('/sys/dict/type/all').then(({ data: res }) => {
http.get(http.adornUrl('/sys/dict/type/all')).then(({ data: res }) => {
if (res.code !== 0) {
return
}
@ -101,7 +101,7 @@ router.beforeEach((to, from, next) => {
// console.log("catch /sys/dict/type/all", err)
})
// 获取菜单列表, 添加并全局变量保存
http.get('/sys/menu/nav').then(({ data: res }) => {
http.get(http.adornUrl('/sys/menu/nav')).then(({ data: res }) => {
if (res.code !== 0) {
Vue.prototype.$message.error(res.msg)
return next({ name: 'login' })

View File

@ -68,7 +68,7 @@ http.interceptors.response.use(response => {
*/
http.adornUrl = (actionName) => {
// 非生产环境 && 开启代理, 接口前缀统一使用[/proxyApi/]前缀做代理拦截!
return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi/' : window.SITE_CONFIG.baseUrl) + actionName
return (process.env.NODE_ENV !== 'production' && process.env.OPEN_PROXY ? '/proxyApi/' : window.SITE_CONFIG.projURL) + actionName
}
/**

View File

@ -89,7 +89,7 @@ export default {
cancelButtonText: this.$t('cancel'),
type: 'warning'
}).then(() => {
this.$http.post('/doLogout').then(({ data: res }) => {
this.$http.post(this.$http.adornUrl('/doLogout')).then(({ data: res }) => {
if (res.code !== 200) {
return this.$message.error(res.msg)
}

View File

@ -187,8 +187,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -169,8 +169,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -163,8 +163,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -251,8 +251,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -169,8 +169,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -199,8 +199,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -217,8 +217,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -163,8 +163,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -247,8 +247,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -193,8 +193,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -187,8 +187,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -181,8 +181,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -187,8 +187,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -172,7 +172,7 @@
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/monitoring/factory/list'),
url: this.$http.adornUrl('/monitoring/factory/page'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
@ -181,8 +181,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.totalCount
} else {
this.dataList = []
this.totalPage = 0

View File

@ -187,8 +187,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -205,8 +205,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -193,8 +193,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -133,8 +133,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -163,8 +163,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -193,8 +193,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -157,8 +157,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -193,8 +193,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -175,8 +175,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -169,8 +169,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -157,8 +157,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -187,8 +187,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -163,8 +163,8 @@
})
}).then(({data}) => {
if (data && data.code === 0) {
this.dataList = data.page.list
this.totalPage = data.page.totalCount
this.dataList = data.list
this.totalPage = data.total
} else {
this.dataList = []
this.totalPage = 0

View File

@ -98,7 +98,7 @@ export default {
if (!valid) {
return false
}
this.$http.post('/login', this.dataForm).then(({ data: res }) => {
this.$http.post(this.$http.adornUrl('/login'), this.dataForm).then(({ data: res }) => {
if (res.code !== 200) {
// this.getCaptcha()
return this.$message.error(res.msg)