From 3df2939fb44381f54c53ba8c2236d22d7e764b93 Mon Sep 17 00:00:00 2001 From: lb Date: Thu, 4 Aug 2022 14:41:47 +0800 Subject: [PATCH] update list response --- public/index.html | 3 +- src/mixins/view-module.js | 32 ++++++++++--------- src/router/index.js | 4 +-- src/utils/request.js | 2 +- src/views/main-navbar.vue | 2 +- src/views/modules/code/equipmenFile.vue | 4 +-- src/views/modules/code/equipmenGroup.vue | 4 +-- src/views/modules/code/equipmenattr.vue | 4 +-- src/views/modules/code/equipment.vue | 4 +-- src/views/modules/code/equipmentAlarmLog.vue | 4 +-- .../modules/code/equipmentGroupAlarm.vue | 4 +-- src/views/modules/code/equipmentPlc.vue | 4 +-- .../modules/code/equipmentPlcConnect.vue | 4 +-- src/views/modules/code/equipmentPlcParam.vue | 4 +-- src/views/modules/code/equipmentQuantity.vue | 4 +-- src/views/modules/code/equipmentStatusLog.vue | 4 +-- src/views/modules/code/equipmentType.vue | 4 +-- src/views/modules/code/equipmentTypeFile.vue | 4 +-- src/views/modules/code/factory.vue | 6 ++-- src/views/modules/code/producArrt.vue | 4 +-- src/views/modules/code/product.vue | 4 +-- src/views/modules/code/productionLine.vue | 4 +-- .../modules/code/productionLineRecSch.vue | 4 +-- .../modules/code/qualityInspectionDet.vue | 4 +-- .../modules/code/qualityInspectionRecord.vue | 4 +-- .../modules/code/qualityInspectionType.vue | 4 +-- src/views/modules/code/reportSheet.vue | 4 +-- .../modules/code/reportSheetCategory.vue | 4 +-- src/views/modules/code/sysfile.vue | 4 +-- src/views/modules/code/sysfileType.vue | 4 +-- src/views/modules/code/workShopSection.vue | 4 +-- .../modules/code/workShopSectionEquipment.vue | 4 +-- src/views/pages/login.vue | 2 +- 33 files changed, 79 insertions(+), 76 deletions(-) diff --git a/public/index.html b/public/index.html index 53f0c2b..40d3f71 100644 --- a/public/index.html +++ b/public/index.html @@ -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') { %> <% } %> diff --git a/src/mixins/view-module.js b/src/mixins/view-module.js index 4306320..76047a5 100644 --- a/src/mixins/view-module.js +++ b/src/mixins/view-module.js @@ -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 diff --git a/src/router/index.js b/src/router/index.js index 4fe984f..65efea5 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -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' }) diff --git a/src/utils/request.js b/src/utils/request.js index 0de12ac..74202e6 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -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 } /** diff --git a/src/views/main-navbar.vue b/src/views/main-navbar.vue index f07cb75..741b933 100644 --- a/src/views/main-navbar.vue +++ b/src/views/main-navbar.vue @@ -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) } diff --git a/src/views/modules/code/equipmenFile.vue b/src/views/modules/code/equipmenFile.vue index d005d2f..a675cb2 100644 --- a/src/views/modules/code/equipmenFile.vue +++ b/src/views/modules/code/equipmenFile.vue @@ -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 diff --git a/src/views/modules/code/equipmenGroup.vue b/src/views/modules/code/equipmenGroup.vue index 98a8b5b..9d7a157 100644 --- a/src/views/modules/code/equipmenGroup.vue +++ b/src/views/modules/code/equipmenGroup.vue @@ -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 diff --git a/src/views/modules/code/equipmenattr.vue b/src/views/modules/code/equipmenattr.vue index 0be6837..fe267d8 100644 --- a/src/views/modules/code/equipmenattr.vue +++ b/src/views/modules/code/equipmenattr.vue @@ -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 diff --git a/src/views/modules/code/equipment.vue b/src/views/modules/code/equipment.vue index 325f714..09cc26c 100644 --- a/src/views/modules/code/equipment.vue +++ b/src/views/modules/code/equipment.vue @@ -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 diff --git a/src/views/modules/code/equipmentAlarmLog.vue b/src/views/modules/code/equipmentAlarmLog.vue index 30a9ca3..e982642 100644 --- a/src/views/modules/code/equipmentAlarmLog.vue +++ b/src/views/modules/code/equipmentAlarmLog.vue @@ -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 diff --git a/src/views/modules/code/equipmentGroupAlarm.vue b/src/views/modules/code/equipmentGroupAlarm.vue index 426c3bf..5d04953 100644 --- a/src/views/modules/code/equipmentGroupAlarm.vue +++ b/src/views/modules/code/equipmentGroupAlarm.vue @@ -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 diff --git a/src/views/modules/code/equipmentPlc.vue b/src/views/modules/code/equipmentPlc.vue index 9f6a29b..8aeea71 100644 --- a/src/views/modules/code/equipmentPlc.vue +++ b/src/views/modules/code/equipmentPlc.vue @@ -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 diff --git a/src/views/modules/code/equipmentPlcConnect.vue b/src/views/modules/code/equipmentPlcConnect.vue index 1ab3d13..d4e1230 100644 --- a/src/views/modules/code/equipmentPlcConnect.vue +++ b/src/views/modules/code/equipmentPlcConnect.vue @@ -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 diff --git a/src/views/modules/code/equipmentPlcParam.vue b/src/views/modules/code/equipmentPlcParam.vue index 7e84a95..47d1dee 100644 --- a/src/views/modules/code/equipmentPlcParam.vue +++ b/src/views/modules/code/equipmentPlcParam.vue @@ -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 diff --git a/src/views/modules/code/equipmentQuantity.vue b/src/views/modules/code/equipmentQuantity.vue index ec99044..01fba3b 100644 --- a/src/views/modules/code/equipmentQuantity.vue +++ b/src/views/modules/code/equipmentQuantity.vue @@ -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 diff --git a/src/views/modules/code/equipmentStatusLog.vue b/src/views/modules/code/equipmentStatusLog.vue index ac863bb..dc753dc 100644 --- a/src/views/modules/code/equipmentStatusLog.vue +++ b/src/views/modules/code/equipmentStatusLog.vue @@ -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 diff --git a/src/views/modules/code/equipmentType.vue b/src/views/modules/code/equipmentType.vue index 098ffd8..92dc925 100644 --- a/src/views/modules/code/equipmentType.vue +++ b/src/views/modules/code/equipmentType.vue @@ -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 diff --git a/src/views/modules/code/equipmentTypeFile.vue b/src/views/modules/code/equipmentTypeFile.vue index c18e4cb..b57bf88 100644 --- a/src/views/modules/code/equipmentTypeFile.vue +++ b/src/views/modules/code/equipmentTypeFile.vue @@ -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 diff --git a/src/views/modules/code/factory.vue b/src/views/modules/code/factory.vue index e7a0318..5d8af78 100644 --- a/src/views/modules/code/factory.vue +++ b/src/views/modules/code/factory.vue @@ -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 diff --git a/src/views/modules/code/producArrt.vue b/src/views/modules/code/producArrt.vue index 04c4fa4..af0e9ae 100644 --- a/src/views/modules/code/producArrt.vue +++ b/src/views/modules/code/producArrt.vue @@ -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 diff --git a/src/views/modules/code/product.vue b/src/views/modules/code/product.vue index 062062b..aaf1e31 100644 --- a/src/views/modules/code/product.vue +++ b/src/views/modules/code/product.vue @@ -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 diff --git a/src/views/modules/code/productionLine.vue b/src/views/modules/code/productionLine.vue index 5e5ca75..aac24d9 100644 --- a/src/views/modules/code/productionLine.vue +++ b/src/views/modules/code/productionLine.vue @@ -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 diff --git a/src/views/modules/code/productionLineRecSch.vue b/src/views/modules/code/productionLineRecSch.vue index 511a118..2acebd9 100644 --- a/src/views/modules/code/productionLineRecSch.vue +++ b/src/views/modules/code/productionLineRecSch.vue @@ -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 diff --git a/src/views/modules/code/qualityInspectionDet.vue b/src/views/modules/code/qualityInspectionDet.vue index 35f97a0..f48eabc 100644 --- a/src/views/modules/code/qualityInspectionDet.vue +++ b/src/views/modules/code/qualityInspectionDet.vue @@ -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 diff --git a/src/views/modules/code/qualityInspectionRecord.vue b/src/views/modules/code/qualityInspectionRecord.vue index d4d77c3..41565d3 100644 --- a/src/views/modules/code/qualityInspectionRecord.vue +++ b/src/views/modules/code/qualityInspectionRecord.vue @@ -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 diff --git a/src/views/modules/code/qualityInspectionType.vue b/src/views/modules/code/qualityInspectionType.vue index 8ae4ffa..7ed816a 100644 --- a/src/views/modules/code/qualityInspectionType.vue +++ b/src/views/modules/code/qualityInspectionType.vue @@ -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 diff --git a/src/views/modules/code/reportSheet.vue b/src/views/modules/code/reportSheet.vue index 5f98900..c5c0292 100644 --- a/src/views/modules/code/reportSheet.vue +++ b/src/views/modules/code/reportSheet.vue @@ -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 diff --git a/src/views/modules/code/reportSheetCategory.vue b/src/views/modules/code/reportSheetCategory.vue index 3e59ebb..878b45e 100644 --- a/src/views/modules/code/reportSheetCategory.vue +++ b/src/views/modules/code/reportSheetCategory.vue @@ -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 diff --git a/src/views/modules/code/sysfile.vue b/src/views/modules/code/sysfile.vue index 73cf920..93a537e 100644 --- a/src/views/modules/code/sysfile.vue +++ b/src/views/modules/code/sysfile.vue @@ -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 diff --git a/src/views/modules/code/sysfileType.vue b/src/views/modules/code/sysfileType.vue index cf2946e..83c465e 100644 --- a/src/views/modules/code/sysfileType.vue +++ b/src/views/modules/code/sysfileType.vue @@ -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 diff --git a/src/views/modules/code/workShopSection.vue b/src/views/modules/code/workShopSection.vue index ff186a2..cb950c0 100644 --- a/src/views/modules/code/workShopSection.vue +++ b/src/views/modules/code/workShopSection.vue @@ -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 diff --git a/src/views/modules/code/workShopSectionEquipment.vue b/src/views/modules/code/workShopSectionEquipment.vue index 5f65eb3..acbae86 100644 --- a/src/views/modules/code/workShopSectionEquipment.vue +++ b/src/views/modules/code/workShopSectionEquipment.vue @@ -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 diff --git a/src/views/pages/login.vue b/src/views/pages/login.vue index 2def271..fedc0f2 100644 --- a/src/views/pages/login.vue +++ b/src/views/pages/login.vue @@ -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)