From 0566808861c8ab40ac59b1584dcdaffb2376ae43 Mon Sep 17 00:00:00 2001 From: lb Date: Tue, 2 Aug 2022 17:06:11 +0800 Subject: [PATCH 001/127] add comments --- public/index.html | 2 +- src/i18n/index.js | 3 ++- src/router/index.js | 1 + src/utils/index.js | 2 +- src/views/main-navbar.vue | 4 ++-- src/views/pages/login.vue | 20 ++++++++++---------- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/public/index.html b/public/index.html index 71f176a..53f0c2b 100644 --- a/public/index.html +++ b/public/index.html @@ -30,7 +30,7 @@ <% if (process.env.VUE_APP_NODE_ENV === 'dev') { %> <% } %> diff --git a/src/i18n/index.js b/src/i18n/index.js index 1ea81ad..eb668d6 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -15,6 +15,7 @@ export const messages = { } export default new VueI18n({ - locale: Cookies.get('language') || 'zh-CN', + // locale: Cookies.get('language') || 'zh-CN', + locale: 'zh-CN', // 先默认中文 messages }) diff --git a/src/router/index.js b/src/router/index.js index 5c4c2a2..7f34f42 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -72,6 +72,7 @@ const router = new Router({ }) router.beforeEach((to, from, next) => { + console.log('[*] === router beforeEach: ', to, from) // 添加动态(菜单)路由 // 已添加或者当前路由为页面路由, 可直接访问 if (window.SITE_CONFIG['dynamicMenuRoutesHasAdded'] || fnCurrentRouteIsPageRoute(to, pageRoutes)) { diff --git a/src/utils/index.js b/src/utils/index.js index bf8bb9b..50decdf 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -73,7 +73,7 @@ export function getIconList () { } /** - * 树形数据转换 + * 树形数据转换,把扁平的数据,转换为树形结构的数据 * @param {*} data * @param {*} id * @param {*} pid diff --git a/src/views/main-navbar.vue b/src/views/main-navbar.vue index 83e1cb0..f07cb75 100644 --- a/src/views/main-navbar.vue +++ b/src/views/main-navbar.vue @@ -89,8 +89,8 @@ export default { cancelButtonText: this.$t('cancel'), type: 'warning' }).then(() => { - this.$http.post('/logout').then(({ data: res }) => { - if (res.code !== 0) { + this.$http.post('/doLogout').then(({ data: res }) => { + if (res.code !== 200) { return this.$message.error(res.msg) } clearLoginInfo() diff --git a/src/views/pages/login.vue b/src/views/pages/login.vue index 814999b..2def271 100644 --- a/src/views/pages/login.vue +++ b/src/views/pages/login.vue @@ -22,7 +22,7 @@ - + {{ $t('login.title') }} @@ -55,7 +55,7 @@ diff --git a/src/views/modules/code/equipmenGroup.vue b/src/views/modules/code/equipmenGroup.vue new file mode 100644 index 0000000..98a8b5b --- /dev/null +++ b/src/views/modules/code/equipmenGroup.vue @@ -0,0 +1,235 @@ + + + diff --git a/src/views/modules/code/equipmenalarmlog-add-or-update.vue b/src/views/modules/code/equipmenalarmlog-add-or-update.vue new file mode 100644 index 0000000..53cac61 --- /dev/null +++ b/src/views/modules/code/equipmenalarmlog-add-or-update.vue @@ -0,0 +1,192 @@ + + + diff --git a/src/views/modules/code/equipmenattr-add-or-update.vue b/src/views/modules/code/equipmenattr-add-or-update.vue new file mode 100644 index 0000000..4f324eb --- /dev/null +++ b/src/views/modules/code/equipmenattr-add-or-update.vue @@ -0,0 +1,183 @@ + + + diff --git a/src/views/modules/code/equipmenattr.vue b/src/views/modules/code/equipmenattr.vue new file mode 100644 index 0000000..0be6837 --- /dev/null +++ b/src/views/modules/code/equipmenattr.vue @@ -0,0 +1,229 @@ + + + diff --git a/src/views/modules/code/equipmenfile-add-or-update.vue b/src/views/modules/code/equipmenfile-add-or-update.vue new file mode 100644 index 0000000..cb3dd48 --- /dev/null +++ b/src/views/modules/code/equipmenfile-add-or-update.vue @@ -0,0 +1,219 @@ + + + diff --git a/src/views/modules/code/equipmengroup-add-or-update.vue b/src/views/modules/code/equipmengroup-add-or-update.vue new file mode 100644 index 0000000..e5afd0d --- /dev/null +++ b/src/views/modules/code/equipmengroup-add-or-update.vue @@ -0,0 +1,192 @@ + + + diff --git a/src/views/modules/code/equipmengroupalarm-add-or-update.vue b/src/views/modules/code/equipmengroupalarm-add-or-update.vue new file mode 100644 index 0000000..6295601 --- /dev/null +++ b/src/views/modules/code/equipmengroupalarm-add-or-update.vue @@ -0,0 +1,237 @@ + + + diff --git a/src/views/modules/code/equipmenplc-add-or-update.vue b/src/views/modules/code/equipmenplc-add-or-update.vue new file mode 100644 index 0000000..63f5653 --- /dev/null +++ b/src/views/modules/code/equipmenplc-add-or-update.vue @@ -0,0 +1,264 @@ + + + diff --git a/src/views/modules/code/equipmenplcconnect-add-or-update.vue b/src/views/modules/code/equipmenplcconnect-add-or-update.vue new file mode 100644 index 0000000..72766d2 --- /dev/null +++ b/src/views/modules/code/equipmenplcconnect-add-or-update.vue @@ -0,0 +1,183 @@ + + + diff --git a/src/views/modules/code/equipmenplcparam-add-or-update.vue b/src/views/modules/code/equipmenplcparam-add-or-update.vue new file mode 100644 index 0000000..28cda40 --- /dev/null +++ b/src/views/modules/code/equipmenplcparam-add-or-update.vue @@ -0,0 +1,309 @@ + + + diff --git a/src/views/modules/code/equipmenquantity-add-or-update.vue b/src/views/modules/code/equipmenquantity-add-or-update.vue new file mode 100644 index 0000000..ac1781a --- /dev/null +++ b/src/views/modules/code/equipmenquantity-add-or-update.vue @@ -0,0 +1,228 @@ + + + diff --git a/src/views/modules/code/equipmenstatuslog-add-or-update.vue b/src/views/modules/code/equipmenstatuslog-add-or-update.vue new file mode 100644 index 0000000..c68898b --- /dev/null +++ b/src/views/modules/code/equipmenstatuslog-add-or-update.vue @@ -0,0 +1,219 @@ + + + diff --git a/src/views/modules/code/equipment-add-or-update.vue b/src/views/modules/code/equipment-add-or-update.vue new file mode 100644 index 0000000..28e1d4c --- /dev/null +++ b/src/views/modules/code/equipment-add-or-update.vue @@ -0,0 +1,309 @@ + + + diff --git a/src/views/modules/code/equipment.vue b/src/views/modules/code/equipment.vue new file mode 100644 index 0000000..325f714 --- /dev/null +++ b/src/views/modules/code/equipment.vue @@ -0,0 +1,317 @@ + + + diff --git a/src/views/modules/code/equipmentAlarmLog.vue b/src/views/modules/code/equipmentAlarmLog.vue new file mode 100644 index 0000000..30a9ca3 --- /dev/null +++ b/src/views/modules/code/equipmentAlarmLog.vue @@ -0,0 +1,235 @@ + + + diff --git a/src/views/modules/code/equipmentGroupAlarm.vue b/src/views/modules/code/equipmentGroupAlarm.vue new file mode 100644 index 0000000..426c3bf --- /dev/null +++ b/src/views/modules/code/equipmentGroupAlarm.vue @@ -0,0 +1,265 @@ + + + diff --git a/src/views/modules/code/equipmentPlc.vue b/src/views/modules/code/equipmentPlc.vue new file mode 100644 index 0000000..9f6a29b --- /dev/null +++ b/src/views/modules/code/equipmentPlc.vue @@ -0,0 +1,283 @@ + + + diff --git a/src/views/modules/code/equipmentPlcConnect.vue b/src/views/modules/code/equipmentPlcConnect.vue new file mode 100644 index 0000000..1ab3d13 --- /dev/null +++ b/src/views/modules/code/equipmentPlcConnect.vue @@ -0,0 +1,229 @@ + + + diff --git a/src/views/modules/code/equipmentPlcParam.vue b/src/views/modules/code/equipmentPlcParam.vue new file mode 100644 index 0000000..7e84a95 --- /dev/null +++ b/src/views/modules/code/equipmentPlcParam.vue @@ -0,0 +1,313 @@ + + + diff --git a/src/views/modules/code/equipmentQuantity.vue b/src/views/modules/code/equipmentQuantity.vue new file mode 100644 index 0000000..ec99044 --- /dev/null +++ b/src/views/modules/code/equipmentQuantity.vue @@ -0,0 +1,259 @@ + + + diff --git a/src/views/modules/code/equipmentStatusLog.vue b/src/views/modules/code/equipmentStatusLog.vue new file mode 100644 index 0000000..ac863bb --- /dev/null +++ b/src/views/modules/code/equipmentStatusLog.vue @@ -0,0 +1,253 @@ + + + diff --git a/src/views/modules/code/equipmentType.vue b/src/views/modules/code/equipmentType.vue new file mode 100644 index 0000000..098ffd8 --- /dev/null +++ b/src/views/modules/code/equipmentType.vue @@ -0,0 +1,247 @@ + + + diff --git a/src/views/modules/code/equipmentTypeFile.vue b/src/views/modules/code/equipmentTypeFile.vue new file mode 100644 index 0000000..c18e4cb --- /dev/null +++ b/src/views/modules/code/equipmentTypeFile.vue @@ -0,0 +1,253 @@ + + + diff --git a/src/views/modules/code/equipmentype-add-or-update.vue b/src/views/modules/code/equipmentype-add-or-update.vue new file mode 100644 index 0000000..e79370b --- /dev/null +++ b/src/views/modules/code/equipmentype-add-or-update.vue @@ -0,0 +1,210 @@ + + + diff --git a/src/views/modules/code/equipmentypefile-add-or-update.vue b/src/views/modules/code/equipmentypefile-add-or-update.vue new file mode 100644 index 0000000..01c6423 --- /dev/null +++ b/src/views/modules/code/equipmentypefile-add-or-update.vue @@ -0,0 +1,219 @@ + + + diff --git a/src/views/modules/code/factory-add-or-update.vue b/src/views/modules/code/factory-add-or-update.vue new file mode 100644 index 0000000..6720d9f --- /dev/null +++ b/src/views/modules/code/factory-add-or-update.vue @@ -0,0 +1,210 @@ + + + diff --git a/src/views/modules/code/factory.vue b/src/views/modules/code/factory.vue new file mode 100644 index 0000000..e7a0318 --- /dev/null +++ b/src/views/modules/code/factory.vue @@ -0,0 +1,247 @@ + + + diff --git a/src/views/modules/code/producArrt.vue b/src/views/modules/code/producArrt.vue new file mode 100644 index 0000000..04c4fa4 --- /dev/null +++ b/src/views/modules/code/producArrt.vue @@ -0,0 +1,253 @@ + + + diff --git a/src/views/modules/code/producarrt-add-or-update.vue b/src/views/modules/code/producarrt-add-or-update.vue new file mode 100644 index 0000000..db5838b --- /dev/null +++ b/src/views/modules/code/producarrt-add-or-update.vue @@ -0,0 +1,219 @@ + + + diff --git a/src/views/modules/code/product-add-or-update.vue b/src/views/modules/code/product-add-or-update.vue new file mode 100644 index 0000000..43ddcc6 --- /dev/null +++ b/src/views/modules/code/product-add-or-update.vue @@ -0,0 +1,246 @@ + + + diff --git a/src/views/modules/code/product.vue b/src/views/modules/code/product.vue new file mode 100644 index 0000000..062062b --- /dev/null +++ b/src/views/modules/code/product.vue @@ -0,0 +1,271 @@ + + + diff --git a/src/views/modules/code/productionLine.vue b/src/views/modules/code/productionLine.vue new file mode 100644 index 0000000..5e5ca75 --- /dev/null +++ b/src/views/modules/code/productionLine.vue @@ -0,0 +1,259 @@ + + + diff --git a/src/views/modules/code/productionLineRecSch.vue b/src/views/modules/code/productionLineRecSch.vue new file mode 100644 index 0000000..511a118 --- /dev/null +++ b/src/views/modules/code/productionLineRecSch.vue @@ -0,0 +1,199 @@ + + + diff --git a/src/views/modules/code/productionline-add-or-update.vue b/src/views/modules/code/productionline-add-or-update.vue new file mode 100644 index 0000000..0a75e6c --- /dev/null +++ b/src/views/modules/code/productionline-add-or-update.vue @@ -0,0 +1,228 @@ + + + diff --git a/src/views/modules/code/productionlinerecsch-add-or-update.vue b/src/views/modules/code/productionlinerecsch-add-or-update.vue new file mode 100644 index 0000000..2ef2d21 --- /dev/null +++ b/src/views/modules/code/productionlinerecsch-add-or-update.vue @@ -0,0 +1,138 @@ + + + diff --git a/src/views/modules/code/qualityInspectionDet.vue b/src/views/modules/code/qualityInspectionDet.vue new file mode 100644 index 0000000..35f97a0 --- /dev/null +++ b/src/views/modules/code/qualityInspectionDet.vue @@ -0,0 +1,229 @@ + + + diff --git a/src/views/modules/code/qualityInspectionRecord.vue b/src/views/modules/code/qualityInspectionRecord.vue new file mode 100644 index 0000000..d4d77c3 --- /dev/null +++ b/src/views/modules/code/qualityInspectionRecord.vue @@ -0,0 +1,259 @@ + + + diff --git a/src/views/modules/code/qualityInspectionType.vue b/src/views/modules/code/qualityInspectionType.vue new file mode 100644 index 0000000..8ae4ffa --- /dev/null +++ b/src/views/modules/code/qualityInspectionType.vue @@ -0,0 +1,223 @@ + + + diff --git a/src/views/modules/code/qualityinspectiondet-add-or-update.vue b/src/views/modules/code/qualityinspectiondet-add-or-update.vue new file mode 100644 index 0000000..c98dc88 --- /dev/null +++ b/src/views/modules/code/qualityinspectiondet-add-or-update.vue @@ -0,0 +1,183 @@ + + + diff --git a/src/views/modules/code/qualityinspectionrecord-add-or-update.vue b/src/views/modules/code/qualityinspectionrecord-add-or-update.vue new file mode 100644 index 0000000..37316b5 --- /dev/null +++ b/src/views/modules/code/qualityinspectionrecord-add-or-update.vue @@ -0,0 +1,228 @@ + + + diff --git a/src/views/modules/code/qualityinspectiontype-add-or-update.vue b/src/views/modules/code/qualityinspectiontype-add-or-update.vue new file mode 100644 index 0000000..485d983 --- /dev/null +++ b/src/views/modules/code/qualityinspectiontype-add-or-update.vue @@ -0,0 +1,174 @@ + + + diff --git a/src/views/modules/code/reporsheecategory-add-or-update.vue b/src/views/modules/code/reporsheecategory-add-or-update.vue new file mode 100644 index 0000000..e51db33 --- /dev/null +++ b/src/views/modules/code/reporsheecategory-add-or-update.vue @@ -0,0 +1,201 @@ + + + diff --git a/src/views/modules/code/reporsheet-add-or-update.vue b/src/views/modules/code/reporsheet-add-or-update.vue new file mode 100644 index 0000000..183b6f6 --- /dev/null +++ b/src/views/modules/code/reporsheet-add-or-update.vue @@ -0,0 +1,228 @@ + + + diff --git a/src/views/modules/code/reportSheet.vue b/src/views/modules/code/reportSheet.vue new file mode 100644 index 0000000..5f98900 --- /dev/null +++ b/src/views/modules/code/reportSheet.vue @@ -0,0 +1,259 @@ + + + diff --git a/src/views/modules/code/reportSheetCategory.vue b/src/views/modules/code/reportSheetCategory.vue new file mode 100644 index 0000000..3e59ebb --- /dev/null +++ b/src/views/modules/code/reportSheetCategory.vue @@ -0,0 +1,241 @@ + + + diff --git a/src/views/modules/code/sysfile-add-or-update.vue b/src/views/modules/code/sysfile-add-or-update.vue new file mode 100644 index 0000000..5e56a41 --- /dev/null +++ b/src/views/modules/code/sysfile-add-or-update.vue @@ -0,0 +1,192 @@ + + + diff --git a/src/views/modules/code/sysfile.vue b/src/views/modules/code/sysfile.vue new file mode 100644 index 0000000..73cf920 --- /dev/null +++ b/src/views/modules/code/sysfile.vue @@ -0,0 +1,235 @@ + + + diff --git a/src/views/modules/code/sysfileType.vue b/src/views/modules/code/sysfileType.vue new file mode 100644 index 0000000..cf2946e --- /dev/null +++ b/src/views/modules/code/sysfileType.vue @@ -0,0 +1,223 @@ + + + diff --git a/src/views/modules/code/sysfiletype-add-or-update.vue b/src/views/modules/code/sysfiletype-add-or-update.vue new file mode 100644 index 0000000..ce3f8e8 --- /dev/null +++ b/src/views/modules/code/sysfiletype-add-or-update.vue @@ -0,0 +1,174 @@ + + + diff --git a/src/views/modules/code/workShopSection.vue b/src/views/modules/code/workShopSection.vue new file mode 100644 index 0000000..ff186a2 --- /dev/null +++ b/src/views/modules/code/workShopSection.vue @@ -0,0 +1,253 @@ + + + diff --git a/src/views/modules/code/workShopSectionEquipment.vue b/src/views/modules/code/workShopSectionEquipment.vue new file mode 100644 index 0000000..5f65eb3 --- /dev/null +++ b/src/views/modules/code/workShopSectionEquipment.vue @@ -0,0 +1,229 @@ + + + diff --git a/src/views/modules/code/workshopsection-add-or-update.vue b/src/views/modules/code/workshopsection-add-or-update.vue new file mode 100644 index 0000000..036c3c8 --- /dev/null +++ b/src/views/modules/code/workshopsection-add-or-update.vue @@ -0,0 +1,219 @@ + + + diff --git a/src/views/modules/code/workshopsectionequipment-add-or-update.vue b/src/views/modules/code/workshopsectionequipment-add-or-update.vue new file mode 100644 index 0000000..3a88db1 --- /dev/null +++ b/src/views/modules/code/workshopsectionequipment-add-or-update.vue @@ -0,0 +1,183 @@ + + + -- 2.45.2 From 3df2939fb44381f54c53ba8c2236d22d7e764b93 Mon Sep 17 00:00:00 2001 From: lb Date: Thu, 4 Aug 2022 14:41:47 +0800 Subject: [PATCH 003/127] 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) -- 2.45.2 From d4e7bda03bbb9fc4c11ff25b94ccf08b598b6f5d Mon Sep 17 00:00:00 2001 From: lb Date: Thu, 4 Aug 2022 15:12:26 +0800 Subject: [PATCH 004/127] =?UTF-8?q?=E6=9B=BF=E6=8D=A2hasPermission?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/main.vue | 138 ++++++++++-------- 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 | 7 +- 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 | 4 +- 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 +- 28 files changed, 131 insertions(+), 118 deletions(-) diff --git a/src/views/main.vue b/src/views/main.vue index 793c824..eeb443e 100644 --- a/src/views/main.vue +++ b/src/views/main.vue @@ -1,5 +1,9 @@ + + + + + diff --git a/src/views/main-navbar.vue b/src/views/main-navbar.vue index 3db671d..bb271a6 100644 --- a/src/views/main-navbar.vue +++ b/src/views/main-navbar.vue @@ -91,9 +91,9 @@ export default { }) .then(() => { this.$http - .post(this.$http.adornUrl('/doLogout')) + .post(this.$http.adornUrl('/logout')) .then(({ data: res }) => { - if (res.code !== 200) { + if (res.code !== 0) { return this.$message.error(res.msg) } clearLoginInfo() diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index a8bcbd7..2ede590 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -104,6 +104,8 @@ const addOrUpdateConfigs = { }, { name: 'processTime', + label: '加工时间', + placeholder: '请输入加工时间', type: 'number', // type: number(input+number) | default(input) | textarea | select(options在父组件里获取) | datetime required: true, rules: [ @@ -120,6 +122,10 @@ const addOrUpdateConfigs = { 'specifications', { name: 'typeDictValue', + // rules: [ + // {required: true, trigger: 'blur'} + // ], + label: '产品类型', // 对于非常见属性,最好自己指定label type: 'select', options: [ // 动态获取 @@ -129,6 +135,7 @@ const addOrUpdateConfigs = { }, { name: 'unitDictValue', + label: '单位', type: 'select', options: [ // 动态获取 diff --git a/src/views/pages/login.vue b/src/views/pages/login.vue index 2c7919c..165d007 100644 --- a/src/views/pages/login.vue +++ b/src/views/pages/login.vue @@ -101,14 +101,20 @@ export default { this.$http .post(this.$http.adornUrl('/login'), this.dataForm) .then(({ data: res }) => { - if (res.code !== 200) { + if (res.code !== 0) { // this.getCaptcha() return this.$message.error(res.msg) } Cookies.set('token', res.data.token) this.$router.replace({ name: 'home' }) }) - .catch(() => {}) + .catch((err) => { + this.$message({ + message: err.message, + type: 'error', + duration: 2000 + }) + }) }) }, 1000, -- 2.45.2 From 5d8f537d0572f4b91f5a98c29621d524aaf6ec75 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Tue, 9 Aug 2022 16:24:18 +0800 Subject: [PATCH 032/127] =?UTF-8?q?update=20=E6=94=B9=E7=89=88=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base-dialog/addOrUpdate/index.vue | 108 +++++++++--------- 1 file changed, 52 insertions(+), 56 deletions(-) diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 6e1509f..289d6d4 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -6,14 +6,14 @@ @@ -127,68 +127,64 @@ export default { // 本组件只实现了'一行两列'的表单布局 return Math.ceil(this.configs.fields.length / COLUMN_PER_ROW) } - // computedModel: { - // get(n, c) { - // return this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name - // ? dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name] - // : dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)]] - // }, - // set() {} - // } }, mounted() { this.$nextTick(() => { + /** 转换 configs.fields 的结构,把纯字符串转为对象 */ + this.configs.fields = this.configs.fields.map(item => { + if (typeof item === 'string') { + return { name: item } + } + return item + }) + /** 动态设置dataForm字段 */ this.configs.fields.forEach(item => { - if (typeof item === 'string') { - this.$set(this.dataForm, [item], '') - } else if (typeof item === 'object') { - this.$set(this.dataForm, [item.name], '') - if (item.api) { - /** 自动请求并填充 */ - this.$http({ - url: this.$http.adornUrl(item.api), - methods: 'get' - }).then(({ data: res }) => { - if (data & (data.code === 0)) { - this.dataFrom[item.name] = res.data // <=== 此处需要对接口 - } - }) - } // end if (item.api) + this.$set(this.dataForm, [item.name], '') + if (item.api) { + /** 自动请求并填充 */ + this.$http({ + url: this.$http.adornUrl(item.api), + methods: 'get' + }).then(({ data: res }) => { + if (data & (data.code === 0)) { + this.dataFrom[item.name] = res.data // <=== 此处需要对接口 + } + }) + } // end if (item.api) - if (item.required) { - const requiredRule = { - required: true, - message: '请输入必填项', - trigger: 'change' + if (item.required) { + const requiredRule = { + required: true, + message: '请输入必填项', + trigger: 'change' + } + /** 检查是否已经存在该字段的规则 */ + const exists = this.dataFormRules[item.name] || null + /** 设置验证规则 */ + if (exists) { + const unset = true + for (const rule of exists) { + if (rule.required) unset = false } - /** 检查是否已经存在该字段的规则 */ - const exists = this.dataFormRules[item.name] || null - /** 设置验证规则 */ - if (exists) { - const unset = true - for (const rule of exists) { - if (rule.required) unset = false - } - if (unset) { - exists.push(requiredRule) - } - } else { - /** 不存在已有规则 */ - this.$set(this.dataFormRules, [item.name], [requiredRule]) + if (unset) { + exists.push(requiredRule) } - } // end if (item.required) + } else { + /** 不存在已有规则 */ + this.$set(this.dataFormRules, [item.name], [requiredRule]) + } + } // end if (item.required) - if (item.rules) { - const exists = this.dataFormRules[item.name] || null - if (exists) { - // 浅拷贝过去 - exists.push(...item.rules) - } else { - this.$set(this.dataFormRules, [item.name], [...item.rules]) - } - } // end if (item.rules) - } + if (item.rules) { + const exists = this.dataFormRules[item.name] || null + if (exists) { + // 浅拷贝过去 + exists.push(...item.rules) + } else { + this.$set(this.dataFormRules, [item.name], [...item.rules]) + } + } // end if (item.rules) }) /** 检查是否需要额外的组件 */ @@ -225,7 +221,7 @@ export default { const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] if (opt) { // if opt is valid - return typeof opt === 'string' ? this.defaultNames[opt] : opt.label ? opt.label : this.defaultNames[opt.name] + return opt.label ? opt.label : this.defaultNames[opt.name] } }, getType(n, c) { -- 2.45.2 From cfec6ff3f524bee1e0e3b85a7b6be07d3c3a2fbc Mon Sep 17 00:00:00 2001 From: g7hoo Date: Tue, 9 Aug 2022 16:45:16 +0800 Subject: [PATCH 033/127] =?UTF-8?q?finish=20=E5=9F=BA=E6=9C=AC=E5=AE=8C?= =?UTF-8?q?=E6=88=90dialog=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base-dialog/addOrUpdate/index.vue | 82 ++++++++++++++----- src/views/modules/monitoring/product.vue | 2 +- 2 files changed, 64 insertions(+), 20 deletions(-) diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 289d6d4..ff1df4b 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -15,14 +15,22 @@ v-if="getType(n, c) === 'input'" :placeholder="configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].placeholder || '...'" v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]" + clearable /> - - - - - - - + + + + + + + + + @@ -145,10 +153,10 @@ export default { /** 自动请求并填充 */ this.$http({ url: this.$http.adornUrl(item.api), - methods: 'get' + method: 'POST' // 也可以改成动态决定 }).then(({ data: res }) => { - if (data & (data.code === 0)) { - this.dataFrom[item.name] = res.data // <=== 此处需要对接口 + if (res && res.code === 0) { + this.dataForm[item.name] = res.data // <=== 此处需要对接口 } }) } // end if (item.api) @@ -241,15 +249,51 @@ export default { this.visible = true }, handleClick(btn) { - switch (btn.name) { - case 'save': - break - case 'update': - break - case 'reset': - break - // add more.. - } + this.$refs['dataForm'].validate(valid => { + if (valid) { + /** 提取url */ + const urls = {} + this.configs.operations.map(item => { + urls[item.name] = item.url + }) + /** 操作 */ + switch (btn.name) { + case 'save': + case 'update': + this.$http({ + url: this.$http.adornUrl(urls[btn.name]), + method: btn.name === 'save' ? 'POST' : 'PUT', + data: this.dataForm + }).then(({ data: res }) => { + if (data && data.code === 0) { + this.$message({ + message: btn.name === 'save' ? '添加成功!' : '更新成功!', + type: 'success', + duration: 1500, + onClose() { + this.$emit('refreshDataList') + this.visible = false + } + }) + } + }) + return + case 'reset': + for (const key of Object.keys(this.dataForm)) { + if (typeof this.dataForm[key] === 'string') { + this.dataForm[key] = '' + } else if (this.dataForm[key] instanceof Array) { + this.dataForm[key].splice(0) + } else { + this.dataForm[key] = null + } + } + console.log('after reset: ', JSON.stringify(this.dataForm)) + break + // add more.. + } + } + }) }, handleClose() { if (this.isAdd || this.isUpdated) this.$emit('refreshDataList') diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index 2ede590..5e7fb39 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -100,7 +100,7 @@ const addOrUpdateConfigs = { 'name', { name: 'code', - api: 'xx/code' + api: '/monitoring/product/getCode' }, { name: 'processTime', -- 2.45.2 From 559cffc5f005767c95f99d75865c3ec9d7c5b080 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 10 Aug 2022 09:43:17 +0800 Subject: [PATCH 034/127] =?UTF-8?q?update=20=E6=95=B0=E6=8D=AE=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E7=BC=93=E5=AD=98&add=20momentjs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package-lock.json | 5 +++++ package.json | 3 ++- src/components/base-dialog/addOrUpdate/index.vue | 14 ++++++++------ src/views/modules/monitoring/product.vue | 11 ++++++++--- .../modules/sys/dict-data-add-or-update.vue | 16 +++++++++++++++- .../modules/sys/dict-type-add-or-update.vue | 2 +- src/views/pages/login.vue | 16 +++++++++++++++- 7 files changed, 54 insertions(+), 13 deletions(-) diff --git a/package-lock.json b/package-lock.json index 91aad73..1ebd4cc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10942,6 +10942,11 @@ "minimist": "^1.2.5" } }, + "moment": { + "version": "2.29.4", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.29.4.tgz", + "integrity": "sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w==" + }, "move-concurrently": { "version": "1.0.1", "resolved": "https://registry.npm.taobao.org/move-concurrently/download/move-concurrently-1.0.1.tgz", diff --git a/package.json b/package.json index 73b5dab..9010c37 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,10 @@ "element-ui": "^2.15.7", "js-cookie": "^2.2.1", "lodash": "^4.17.19", - "sass": "^1.26.5", + "moment": "^2.29.4", "qs": "^6.9.4", "quill": "^1.3.7", + "sass": "^1.26.5", "sass-loader": "^9.0.2", "screenfull": "^4.2.1", "svg-sprite-loader": "^5.0.0", diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index ff1df4b..aa5cd65 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -1,6 +1,6 @@ @@ -87,7 +89,7 @@ export default { * type: 'dialog' | 'drawer' | 'page' * fields: Array * - fields.object: { name, type: 'number'|'textarea'|'select'|'date'|.., required: boolean, validator: boolean(是否需要验证), [options]: any[], api: string(自动获取数据的接口,一般为getcode接口)} - * operations: Array[object], 操作名和对应的接口地址 + * operations: Array[object], 操作名和对应的接口地址,还有permission(如,sys:dict:update) */ type: Object, default: () => ({}) // 此处省去类型检查,使用者自行注意就好 @@ -265,7 +267,7 @@ export default { method: btn.name === 'save' ? 'POST' : 'PUT', data: this.dataForm }).then(({ data: res }) => { - if (data && data.code === 0) { + if (res && res.code === 0) { this.$message({ message: btn.name === 'save' ? '添加成功!' : '更新成功!', type: 'success', diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index 5e7fb39..b6d3b86 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -64,9 +64,14 @@ import BaseTable from '@/components/base-table' import TableOperateComponent from '@/components/base-table/components/operationComponent' import TableTextComponent from '@/components/base-table/components/detailComponent' import BaseDialog from '@/components/base-dialog/addOrUpdate' +import moment from 'moment' + +const UnitDictTypeId = '1557173812109242370' +const ProductTypeDictTypeId = ' ' + const tableConfigs = [ { type: 'index', name: '序号' }, - { prop: 'updateTime', name: '添加时间' }, + { prop: 'updateTime', name: '添加时间', filter: val => val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-' }, { prop: 'name', name: '产品名称' }, { prop: 'code', name: '产品编码' }, { prop: 'specifications', name: '规格' }, @@ -146,8 +151,8 @@ const addOrUpdateConfigs = { ], operations: [ { name: 'reset', url: true }, - { name: 'save', url: 'api/product/add' }, - { name: 'update', url: 'api/product/update' } + { name: 'save', url: '/monitoring/product', permission: "" }, + { name: 'update', url: '/monitoring/product', permission: "" } ] // extraComponents: [ // { diff --git a/src/views/modules/sys/dict-data-add-or-update.vue b/src/views/modules/sys/dict-data-add-or-update.vue index a5ff947..15ed332 100644 --- a/src/views/modules/sys/dict-data-add-or-update.vue +++ b/src/views/modules/sys/dict-data-add-or-update.vue @@ -78,7 +78,7 @@ export default { if (!valid) { return false } - this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dict/data', this.dataForm) + this.$http[!this.dataForm.id ? 'post' : 'put'](this.$http.adornUrl('/sys/dict/data'), this.dataForm) .then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) @@ -92,6 +92,20 @@ export default { this.$emit('refreshDataList') } }) + + /** 刷新dictlist */ + this.$http.get(this.$http.adornUrl('/sys/dict/data/getAll')).then(({ data: res }) => { + if (res && res.code === 0) { + localStorage.setItem('dictList', JSON.stringify(res.data)) + } else { + this.$message({ + message: '数据字典拉取失败,请检查!', + type: 'error', + duration: 2000 + }) + } + }) + }) .catch(() => {}) }) diff --git a/src/views/modules/sys/dict-type-add-or-update.vue b/src/views/modules/sys/dict-type-add-or-update.vue index 44e9a18..4872106 100644 --- a/src/views/modules/sys/dict-type-add-or-update.vue +++ b/src/views/modules/sys/dict-type-add-or-update.vue @@ -77,7 +77,7 @@ export default { if (!valid) { return false } - this.$http[!this.dataForm.id ? 'post' : 'put']('/sys/dict/type', this.dataForm) + this.$http[!this.dataForm.id ? 'post' : 'put'](this.$http.adornUrl('/sys/dict/type'), this.dataForm) .then(({ data: res }) => { if (res.code !== 0) { return this.$message.error(res.msg) diff --git a/src/views/pages/login.vue b/src/views/pages/login.vue index 165d007..bf9b823 100644 --- a/src/views/pages/login.vue +++ b/src/views/pages/login.vue @@ -106,9 +106,23 @@ export default { return this.$message.error(res.msg) } Cookies.set('token', res.data.token) + + /** 保存dictlist */ + this.$http.get(this.$http.adornUrl('/sys/dict/data/getAll')).then(({ data: res }) => { + if (res && res.code === 0) { + localStorage.setItem('dictList', JSON.stringify(res.data)) + } else { + this.$message({ + message: '数据字典拉取失败,请检查!', + type: 'error', + duration: 2000 + }) + } + }) + this.$router.replace({ name: 'home' }) }) - .catch((err) => { + .catch(err => { this.$message({ message: err.message, type: 'error', -- 2.45.2 From ffd095b6b8423d11cb81414a8c9ab49054756b67 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 10 Aug 2022 10:47:12 +0800 Subject: [PATCH 035/127] =?UTF-8?q?update=20=E6=95=B0=E6=8D=AE=E5=AD=97?= =?UTF-8?q?=E5=85=B8=E7=9B=B8=E5=85=B3=E9=80=BB=E8=BE=91=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base-dialog/addOrUpdate/index.vue | 4 +- .../components/operationComponent.js | 7 +++- src/components/base-table/index.vue | 2 +- src/mixins/dictlist-module.js | 24 ++++++++++++ .../monitoring/product-add-or-update.vue | 38 +++++++++---------- src/views/modules/monitoring/product.vue | 35 ++++++++++++++--- 6 files changed, 80 insertions(+), 30 deletions(-) create mode 100644 src/mixins/dictlist-module.js diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index aa5cd65..971d78b 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -25,7 +25,7 @@ v-model="dataForm[configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)].name]" clearable > - + @@ -272,7 +272,7 @@ export default { message: btn.name === 'save' ? '添加成功!' : '更新成功!', type: 'success', duration: 1500, - onClose() { + onClose: () => { this.$emit('refreshDataList') this.visible = false } diff --git a/src/components/base-table/components/operationComponent.js b/src/components/base-table/components/operationComponent.js index 409499f..33e400b 100644 --- a/src/components/base-table/components/operationComponent.js +++ b/src/components/base-table/components/operationComponent.js @@ -27,7 +27,7 @@ export default { // add more... }, text: { - // for i18n inject: + // TODO: i18n edit: '编辑', detail: '详情', delete: '删除', @@ -38,12 +38,15 @@ export default { }, methods: { // 发射事件 + emit(eventType) { + this.$emit('emit-data', { type: eventType, data: this.injectData.head?.emitFullData ? this.injectData : this.injectData.id }) + } }, render: function (h) { let btns = [] for (const optionStr of this.injectData.head?.options) { // btns.push(h('el-button', { props: { type: this.btnTypes[optionStr] } }, optionStr)) - btns.push(h('el-button', { props: { type: 'text' }, style: { color: this.colors[optionStr] || '#409EFF' } }, this.text[optionStr])) + btns.push(h('el-button', { props: { type: 'text' }, style: { color: this.colors[optionStr] || '#409EFF' }, on: { click: this.emit.bind(null, optionStr) } }, this.text[optionStr])) } return h('span', null, btns) } diff --git a/src/components/base-table/index.vue b/src/components/base-table/index.vue index 43ea43f..fd377fb 100644 --- a/src/components/base-table/index.vue +++ b/src/components/base-table/index.vue @@ -30,7 +30,7 @@ > diff --git a/src/mixins/dictlist-module.js b/src/mixins/dictlist-module.js new file mode 100644 index 0000000..0c4d17e --- /dev/null +++ b/src/mixins/dictlist-module.js @@ -0,0 +1,24 @@ + +export default { + data() { + return { + dictList: {} + } + }, + methods: { + initDictList(dictTypeIdList) { + const allDictList = JSON.parse(localStorage.getItem('dictList')) + if (!Object.keys(allDictList).length) { + return this.$message({ + // TODO: i18n + message: '未能获取数据字典', + type: 'error', + duration: 2000 + }) + } + dictTypeIdList.forEach(id => { + this.dictList[id] = allDictList[id].map(item => ({ label: item.dictLabel, value: item.dictValue })) + }) + } + } +} \ No newline at end of file diff --git a/src/views/modules/monitoring/product-add-or-update.vue b/src/views/modules/monitoring/product-add-or-update.vue index 6011f40..922ea52 100644 --- a/src/views/modules/monitoring/product-add-or-update.vue +++ b/src/views/modules/monitoring/product-add-or-update.vue @@ -129,25 +129,25 @@ export default { params: this.$http.adornParams() }).then(({ data }) => { if (data && data.code === 0) { - this.dataForm.code = data.product.code - this.dataForm.name = data.product.name - this.dataForm.description = data.product.description - this.dataForm.externalCode = data.product.externalCode - this.dataForm.specifications = data.product.specifications - this.dataForm.unitDictValue = data.product.unitDictValue - this.dataForm.area = data.product.area - this.dataForm.processTime = data.product.processTime - this.dataForm.typeDictValue = data.product.typeDictValue - this.dataForm.enabled = data.product.enabled - this.dataForm.remark = data.product.remark - this.dataForm.valid = data.product.valid - this.dataForm.creatorId = data.product.creatorId - this.dataForm.creatorName = data.product.creatorName - this.dataForm.createTime = data.product.createTime - this.dataForm.updaterId = data.product.updaterId - this.dataForm.updaterName = data.product.updaterName - this.dataForm.updateTime = data.product.updateTime - this.dataForm.version = data.product.version + this.dataForm.code = data.data.code + this.dataForm.name = data.data.name + this.dataForm.description = data.data.description + this.dataForm.externalCode = data.data.externalCode + this.dataForm.specifications = data.data.specifications + this.dataForm.unitDictValue = data.data.unitDictValue + this.dataForm.area = data.data.area + this.dataForm.processTime = data.data.processTime + this.dataForm.typeDictValue = data.data.typeDictValue + this.dataForm.enabled = data.data.enabled + this.dataForm.remark = data.data.remark + this.dataForm.valid = data.data.valid + this.dataForm.creatorId = data.data.creatorId + this.dataForm.creatorName = data.data.creatorName + this.dataForm.createTime = data.data.createTime + this.dataForm.updaterId = data.data.updaterId + this.dataForm.updaterName = data.data.updaterName + this.dataForm.updateTime = data.data.updateTime + this.dataForm.version = data.data.version } }) } diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index b6d3b86..056c749 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -40,7 +40,7 @@ --> - + val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-' }, + { prop: 'updateTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') }, { prop: 'name', name: '产品名称' }, { prop: 'code', name: '产品编码' }, { prop: 'specifications', name: '规格' }, @@ -151,8 +152,8 @@ const addOrUpdateConfigs = { ], operations: [ { name: 'reset', url: true }, - { name: 'save', url: '/monitoring/product', permission: "" }, - { name: 'update', url: '/monitoring/product', permission: "" } + { name: 'save', url: '/monitoring/product', permission: '' }, + { name: 'update', url: '/monitoring/product', permission: '' } ] // extraComponents: [ // { @@ -164,9 +165,9 @@ const addOrUpdateConfigs = { } export default { + mixins: [dictListMixin], data() { return { - tableConfigs, tableConfigs, dataForm: { key: '' @@ -187,6 +188,19 @@ export default { BaseTable, BaseDialog }, + created() { + this.initDictList([UnitDictTypeId, ProductTypeDictTypeId]) + this.addOrUpdateConfigs.fields.forEach(item => { + if (item.name) { + if (item.name === 'typeDictValue') { + console.log('dict : ', this.dictList) + item.options = this.dictList[ProductTypeDictTypeId] + } else if (item.name === 'unitDictValue') { + item.options = this.dictList[UnitDictTypeId] + } + } + }) + }, activated() { this.getDataList() }, @@ -242,6 +256,15 @@ export default { this.$refs.addOrUpdate.init(id) }) }, + // 表格操作事件管理 + handleOperations({type, data}) { + switch(type) { + case 'viewAttr': // <== 对照 tableConfig + return this.addOrUpdateHandle(data) + case 'delete': + return this.deleteHandle(data) + } + }, // 删除 deleteHandle(id) { var ids = id -- 2.45.2 From df3b11b6dde98a9341e29db4d84ecdb97eed598b Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 10 Aug 2022 10:58:21 +0800 Subject: [PATCH 036/127] add common filter --- src/utils/filters.js | 7 +++++++ src/views/modules/monitoring/product.vue | 16 ++++++---------- 2 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 src/utils/filters.js diff --git a/src/utils/filters.js b/src/utils/filters.js new file mode 100644 index 0000000..46188dc --- /dev/null +++ b/src/utils/filters.js @@ -0,0 +1,7 @@ +/** filters */ + +export const dictFilter = dictTypeId => { + return val => { + return JSON.parse(localStorage.getItem('dictList'))[dictTypeId].find(item => item.dictValue === val)?.dictLabel || '-' + } +} \ No newline at end of file diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index 056c749..8032eae 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -66,17 +66,17 @@ import TableTextComponent from '@/components/base-table/components/detailCompone import BaseDialog from '@/components/base-dialog/addOrUpdate' import moment from 'moment' import dictListMixin from '@/mixins/dictlist-module' +import { dictFilter } from '@/utils/filters' const UnitDictTypeId = '1557173812109242370' const ProductTypeDictTypeId = '1557179530308616193' - const tableConfigs = [ { type: 'index', name: '序号' }, { prop: 'updateTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') }, - { prop: 'name', name: '产品名称' }, + { prop: 'name', name: '产品名称'}, { prop: 'code', name: '产品编码' }, { prop: 'specifications', name: '规格' }, - { prop: 'unitDictValue', name: '单位' }, + { prop: 'unitDictValue', name: '单位', filter: dictFilter(UnitDictTypeId) }, // { prop: 'unitDictValue', name: '单位value,对应到数据字典label_value' }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['viewAttr', 'delete'] } @@ -135,8 +135,6 @@ const addOrUpdateConfigs = { type: 'select', options: [ // 动态获取 - { label: 'ces', value: 1 }, - { label: 'sec', value: 2 } ] }, { @@ -145,8 +143,6 @@ const addOrUpdateConfigs = { type: 'select', options: [ // 动态获取 - { label: 'h', value: 'h' }, - { label: 'l', value: 'l' } ] } ], @@ -257,10 +253,10 @@ export default { }) }, // 表格操作事件管理 - handleOperations({type, data}) { - switch(type) { + handleOperations({ type, data }) { + switch (type) { case 'viewAttr': // <== 对照 tableConfig - return this.addOrUpdateHandle(data) + return this.addOrUpdateHandle(data) case 'delete': return this.deleteHandle(data) } -- 2.45.2 From 9653474e2fff6fe7f5e470a4de1d7b8157871f30 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 10 Aug 2022 13:42:46 +0800 Subject: [PATCH 037/127] update --- .../base-dialog/addOrUpdate/index.vue | 87 ++++++++++--------- src/utils/request.js | 1 + src/views/modules/monitoring/product.vue | 2 + 3 files changed, 49 insertions(+), 41 deletions(-) diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 971d78b..b3e1a9f 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -11,20 +11,10 @@ :label="getLabel(n, c)" > - + - + @@ -129,7 +119,8 @@ export default { remark: '备注', specifications: '规格' // add more... - } + }, + defaultPlaceholders: {} // 自动根据 defaultNames 计算得来 } }, computed: { @@ -139,8 +130,14 @@ export default { } }, mounted() { + /** 计算 defaultPlaceholders */ + const prefix = '请输入' + Object.entries(this.defaultNames).map(([key, value]) => { + this.defaultPlaceholders[key] = prefix + value + }) + + /** 转换 configs.fields 的结构,把纯字符串转为对象 */ this.$nextTick(() => { - /** 转换 configs.fields 的结构,把纯字符串转为对象 */ this.configs.fields = this.configs.fields.map(item => { if (typeof item === 'string') { return { name: item } @@ -234,6 +231,13 @@ export default { return opt.label ? opt.label : this.defaultNames[opt.name] } }, + getPlaceholder(n, c) { + const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] + if (opt) { + // if opt is valid + return opt.placeholder ? opt.placeholder : this.defaultPlaceholders[opt.name] + } + }, getType(n, c) { const opt = this.configs.fields[(n - 1) * COLUMN_PER_ROW + (c - 1)] if (opt) { @@ -251,17 +255,18 @@ export default { this.visible = true }, handleClick(btn) { - this.$refs['dataForm'].validate(valid => { - if (valid) { - /** 提取url */ - const urls = {} - this.configs.operations.map(item => { - urls[item.name] = item.url - }) - /** 操作 */ - switch (btn.name) { - case 'save': - case 'update': + /** 提取url */ + const urls = {} + this.configs.operations.map(item => { + urls[item.name] = item.url + }) + /** 操作 */ + switch (btn.name) { + case 'save': + case 'update': + /** 需要验证表单的操作 */ + this.$refs['dataForm'].validate(valid => { + if (valid) { this.$http({ url: this.$http.adornUrl(urls[btn.name]), method: btn.name === 'save' ? 'POST' : 'PUT', @@ -279,23 +284,23 @@ export default { }) } }) - return - case 'reset': - for (const key of Object.keys(this.dataForm)) { - if (typeof this.dataForm[key] === 'string') { - this.dataForm[key] = '' - } else if (this.dataForm[key] instanceof Array) { - this.dataForm[key].splice(0) - } else { - this.dataForm[key] = null - } - } - console.log('after reset: ', JSON.stringify(this.dataForm)) - break - // add more.. + } + }) + return + case 'reset': + for (const key of Object.keys(this.dataForm)) { + if (typeof this.dataForm[key] === 'string') { + this.dataForm[key] = '' + } else if (this.dataForm[key] instanceof Array) { + this.dataForm[key].splice(0) + } else { + this.dataForm[key] = null + } } - } - }) + console.log('after reset: ', JSON.stringify(this.dataForm)) + break + // add more.. + } }, handleClose() { if (this.isAdd || this.isUpdated) this.$emit('refreshDataList') diff --git a/src/utils/request.js b/src/utils/request.js index 74202e6..7a81e32 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -97,6 +97,7 @@ http.adornData = (data = {}, openDefaultdata = true, contentType = 'json') => { } data = openDefaultdata ? merge(defaults, data) : data return contentType === 'json' ? JSON.stringify(data) : qs.stringify(data) + // return contentType === 'json' ? JSON.stringify(data, (_, v) => typeof v === 'bigint' ? v.toString() : v) : qs.stringify(data) } diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index 8032eae..22e394e 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -141,6 +141,7 @@ const addOrUpdateConfigs = { name: 'unitDictValue', label: '单位', type: 'select', + // placeholder: '请选择单位', options: [ // 动态获取 ] @@ -265,6 +266,7 @@ export default { deleteHandle(id) { var ids = id ? [id] + // ? [1556817256347828335] : this.dataListSelections.map(item => { return item.id }) -- 2.45.2 From 90e34584ec0b26b70c70f4e1917a0550362692cf Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 10 Aug 2022 14:12:23 +0800 Subject: [PATCH 038/127] =?UTF-8?q?hint=20DELETE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E5=8A=A0=E4=B8=8Aapplication/json=E5=A4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/monitoring/product.vue | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index 22e394e..af57a4d 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -54,7 +54,7 @@ - + @@ -73,7 +73,7 @@ const ProductTypeDictTypeId = '1557179530308616193' const tableConfigs = [ { type: 'index', name: '序号' }, { prop: 'updateTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') }, - { prop: 'name', name: '产品名称'}, + { prop: 'name', name: '产品名称' }, { prop: 'code', name: '产品编码' }, { prop: 'specifications', name: '规格' }, { prop: 'unitDictValue', name: '单位', filter: dictFilter(UnitDictTypeId) }, @@ -264,10 +264,11 @@ export default { }, // 删除 deleteHandle(id) { + console.log('id is: ', id) var ids = id ? [id] - // ? [1556817256347828335] - : this.dataListSelections.map(item => { + : // ? [1556817256347828335] + this.dataListSelections.map(item => { return item.id }) this.$confirm(`确定对[id=${ids.join(',')}]进行[${id ? '删除' : '批量删除'}]操作?`, '提示', { @@ -278,6 +279,9 @@ export default { this.$http({ url: this.$http.adornUrl('/monitoring/product'), method: 'delete', + headers: { + 'Content-Type': 'application/json' + }, data: this.$http.adornData(ids, false) }).then(({ data }) => { if (data && data.code === 0) { -- 2.45.2 From 83fb096f6d0bb5f4401c78e608e065ea2ab8d7ff Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 10 Aug 2022 14:49:17 +0800 Subject: [PATCH 039/127] =?UTF-8?q?update=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/request.js | 2 +- src/views/modules/monitoring/product.vue | 34 ++++++++++++------------ 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/utils/request.js b/src/utils/request.js index 7a81e32..c8256a7 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -96,7 +96,7 @@ http.adornData = (data = {}, openDefaultdata = true, contentType = 'json') => { 't': new Date().getTime() } data = openDefaultdata ? merge(defaults, data) : data - return contentType === 'json' ? JSON.stringify(data) : qs.stringify(data) + return contentType === 'raw' ? data : contentType === 'json' ? JSON.stringify(data) : qs.stringify(data) // return contentType === 'json' ? JSON.stringify(data, (_, v) => typeof v === 'bigint' ? v.toString() : v) : qs.stringify(data) } diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index af57a4d..a63803b 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -279,24 +279,24 @@ export default { this.$http({ url: this.$http.adornUrl('/monitoring/product'), method: 'delete', - headers: { - 'Content-Type': 'application/json' - }, - data: this.$http.adornData(ids, false) - }).then(({ data }) => { - if (data && data.code === 0) { - this.$message({ - message: '操作成功', - type: 'success', - duration: 1500, - onClose: () => { - this.getDataList() - } - }) - } else { - this.$message.error(data.msg) - } + data: ids + // or : data: this.$http.adornData(ids, false, 'raw') }) + // or: this.$http.delete(this.$http.adornUrl('/monitoring/product'), { data: this.$http.adornData(ids, false) }) + .then(({ data }) => { + if (data && data.code === 0) { + this.$message({ + message: '操作成功', + type: 'success', + duration: 1500, + onClose: () => { + this.getDataList() + } + }) + } else { + this.$message.error(data.msg) + } + }) }) } } -- 2.45.2 From e91520e99df3da475774bf670bb57061e23e99ce Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 10 Aug 2022 15:28:19 +0800 Subject: [PATCH 040/127] update scrollbar style --- .../base-dialog/addOrUpdate/index.vue | 102 ++++++++++++------ src/views/modules/monitoring/product.vue | 15 ++- 2 files changed, 85 insertions(+), 32 deletions(-) diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index b3e1a9f..67f79d7 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -1,38 +1,62 @@ @@ -71,7 +54,7 @@ const tableConfigs = [ { prop: 'sectionId', name: '工段id' }, { prop: 'checkPerson', name: '检测人员' }, // { prop: 'checkPerson', name: '检测人员,可以多个' }, - { prop: 'source', name: '来源' }, + { prop: 'source', name: '来源', filter: val => ({ 1: '手动', 2: '自动' }[val]) }, // { prop: 'source', name: '来源 1,手动(默认) 2,自动' }, { prop: 'explainText', name: '描述' }, { prop: 'remark', name: '备注' }, @@ -82,7 +65,27 @@ const addOrUpdateConfigs = { type: 'dialog', infoUrl: '/monitoring/qualityInspectionRecord', fields: [ - {name: '', label: '检测类型', type: 'select', options: []} + { name: 'checkTime', label: '检测时间', type: 'date', props: { style: 'width: 100%', type: 'datetime' }, placeholder: '请选择检测时间' }, + { name: 'productionId', label: '产线', type: 'select', options: [] }, + { name: 'sectionId', label: '工段', type: 'select', options: [] }, + { + name: 'source', + label: '来源', + type: 'select', + options: [ + { value: 1, label: '手动', default: true }, + { value: 2, label: '自动' } + ] + }, + { name: 'inspectionDetId', label: '检测内容', type: 'select', options: [] }, + { name: 'checkPerson', label: '检测人员' }, + { name: 'explainText', label: '描述' }, + 'remark' + ], + operations: [ + { name: 'cancel', showAlways: true }, + { name: 'save', url: '/monitoring/qualityInspectionRecord', permission: '', showOnEdit: false }, + { name: 'update', url: '/monitoring/qualityInspectionRecord', permission: '', showOnEdit: true } ] } @@ -109,8 +112,78 @@ export default { }, activated() { this.getDataList() + this.getInspectionDet() + this.getWorkSections() + this.getProductLines() }, methods: { + // handle + async handleSelectChange({ name, id }) { + if (name === 'productionId') { + // 如果选择了产线,就依据此更新工单的选项 + await this.getWorkSections(id) + } + }, + // 获取检测内容 + getInspectionDet() { + this.$http({ + url: this.$http.adornUrl('/monitoring/qualityInspectionDet/page'), + method: 'get', + params: this.$http.adornParams({ + page: this.pageIndex, + limit: this.pageSize, + key: this.dataForm.key + }) + }).then(({ data: res }) => { + console.log('insdet:', res) + const insDetOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'inspectionDetId') + if (insDetOpt) { + insDetOpt.options = res.data.list.map(item => ({ value: item.id, label: item.content })) || [] + } + }) + }, + // 获取产线 + getProductLines() { + this.$http({ + url: this.$http.adornUrl('/monitoring/productionLine/page'), + method: 'get', + params: this.$http.adornParams({ + // page: this.pageIndex, + // limit: this.pageSize, + // key: this.dataForm.key + }) + }).then(({ data: res }) => { + const plOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'productionId') + if (plOpt) { + plOpt.options = res.data.list.map(item => ({ value: item.id, label: item.name })) || [] + } + }) + }, + // 获取工段 + getWorkSections(lineId) { + this.$http({ + url: this.$http.adornUrl('/monitoring/workshopSection/page'), + method: 'get', + params: lineId + ? this.$http.adornParams({ + // page: this.pageIndex, + // limit: this.pageSize, + // key: this.dataForm.key + lineId + }) + : {} + }).then(({ data: res }) => { + if (res.data.total === 0) { + this.$message.error('该产线没有工段') + } else { + this.$message.success(`该产线有 ${res.data.total} 条工段`) + } + const wsOpt = this.addOrUpdateConfigs.fields.find(item => item.name === 'sectionId') + if (wsOpt) { + wsOpt.options = res.data.list.map(item => ({ value: item.id, label: item.name })) || [] + } + }) + }, // 获取数据列表 getDataList() { this.addOrUpdateVisible = false -- 2.45.2 From 56ab0220e2caaa0532f434a6254e9d5feaee21c3 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 17 Aug 2022 10:23:34 +0800 Subject: [PATCH 071/127] =?UTF-8?q?add=20SmallTitle=20&=20=E8=B4=A8?= =?UTF-8?q?=E9=87=8F=E5=9C=A8=E7=BA=BF=E6=A3=80=E6=B5=8B=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/small-title/index.vue | 66 +++++++++++++++++++ .../monitoring/qualityInspectionCurrent.vue | 30 +++++++++ 2 files changed, 96 insertions(+) create mode 100644 src/components/small-title/index.vue create mode 100644 src/views/modules/monitoring/qualityInspectionCurrent.vue diff --git a/src/components/small-title/index.vue b/src/components/small-title/index.vue new file mode 100644 index 0000000..413a8c2 --- /dev/null +++ b/src/components/small-title/index.vue @@ -0,0 +1,66 @@ + + + + + + diff --git a/src/views/modules/monitoring/qualityInspectionCurrent.vue b/src/views/modules/monitoring/qualityInspectionCurrent.vue new file mode 100644 index 0000000..2ffa900 --- /dev/null +++ b/src/views/modules/monitoring/qualityInspectionCurrent.vue @@ -0,0 +1,30 @@ + + + + + -- 2.45.2 From 8aaaf2c7ad448986f740aa22be253a24216b123f Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 17 Aug 2022 11:29:12 +0800 Subject: [PATCH 072/127] =?UTF-8?q?update=20=E5=9C=A8=E7=BA=BF=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E6=95=B0=E6=8D=AE=E2=80=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/small-title/index.vue | 3 +- .../monitoring/qualityInspectionCurrent.vue | 149 +++++++++++++++++- 2 files changed, 143 insertions(+), 9 deletions(-) diff --git a/src/components/small-title/index.vue b/src/components/small-title/index.vue index 413a8c2..a939ea0 100644 --- a/src/components/small-title/index.vue +++ b/src/components/small-title/index.vue @@ -55,7 +55,8 @@ $mgr: 6px; height: $height + 2px; border-radius: 1px; margin-right: $mgr; - background-color: #0b58ff; + // background-color: #0b58ff; + background-color: #409EFF; } } } diff --git a/src/views/modules/monitoring/qualityInspectionCurrent.vue b/src/views/modules/monitoring/qualityInspectionCurrent.vue index 2ffa900..a543f7a 100644 --- a/src/views/modules/monitoring/qualityInspectionCurrent.vue +++ b/src/views/modules/monitoring/qualityInspectionCurrent.vue @@ -1,23 +1,156 @@ @@ -25,6 +158,6 @@ export default { .base-container { min-height: 60vh; background: #fff; - padding: 8px; + padding: 12px; } -- 2.45.2 From 4cae583333612fd6b1e263e65dc9dcbb61e59511 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 17 Aug 2022 13:55:30 +0800 Subject: [PATCH 073/127] init base-detail-page --- src/components/base-detail-page/index.vue | 548 ++++++++++++++++++ .../modules/monitoring/equipment-details.vue | 0 2 files changed, 548 insertions(+) create mode 100644 src/components/base-detail-page/index.vue create mode 100644 src/views/modules/monitoring/equipment-details.vue diff --git a/src/components/base-detail-page/index.vue b/src/components/base-detail-page/index.vue new file mode 100644 index 0000000..3c7947a --- /dev/null +++ b/src/components/base-detail-page/index.vue @@ -0,0 +1,548 @@ + + + + + diff --git a/src/views/modules/monitoring/equipment-details.vue b/src/views/modules/monitoring/equipment-details.vue new file mode 100644 index 0000000..e69de29 -- 2.45.2 From 686002a48ed867a0190d950358becd8a9a724cab Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 17 Aug 2022 16:00:02 +0800 Subject: [PATCH 074/127] init charts --- package-lock.json | 31 ++++ package.json | 1 + .../monitoring/qualityInspectionCurrent.vue | 164 +++++++++++++++++- 3 files changed, 188 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5f4e71e..f5e8c84 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7120,6 +7120,22 @@ "safer-buffer": "^2.1.0" } }, + "echarts": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/echarts/-/echarts-5.3.3.tgz", + "integrity": "sha512-BRw2serInRwO5SIwRviZ6Xgm5Lb7irgz+sLiFMmy/HOaf4SQ+7oYqxKzRHAKp4xHQ05AuHw1xvoQWJjDQq/FGw==", + "requires": { + "tslib": "2.3.0", + "zrender": "5.3.2" + }, + "dependencies": { + "tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + } + } + }, "ee-first": { "version": "1.1.1", "resolved": "https://registry.npm.taobao.org/ee-first/download/ee-first-1.1.1.tgz", @@ -17269,6 +17285,21 @@ "integrity": "sha1-48mzFWnhBoEd8kL3FXJaH0xJQyA=" } } + }, + "zrender": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/zrender/-/zrender-5.3.2.tgz", + "integrity": "sha512-8IiYdfwHj2rx0UeIGZGGU4WEVSDEdeVCaIg/fomejg1Xu6OifAL1GVzIPHg2D+MyUkbNgPWji90t0a8IDk+39w==", + "requires": { + "tslib": "2.3.0" + }, + "dependencies": { + "tslib": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.0.tgz", + "integrity": "sha512-N82ooyxVNm6h1riLCoyS9e3fuJ3AMG2zIZs2Gd1ATcSFjSA23Q0fzjjZeh0jbJvWVDZ0cJT8yaNNaaXHzueNjg==" + } + } } } } diff --git a/package.json b/package.json index 763e35c..326b60a 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "babel-plugin-component": "^1.1.1", "ckeditor4-vue": "^2.1.1", "core-js": "^3.6.5", + "echarts": "^5.3.3", "element-theme": "^2.0.1", "element-ui": "^2.15.7", "js-cookie": "^2.2.1", diff --git a/src/views/modules/monitoring/qualityInspectionCurrent.vue b/src/views/modules/monitoring/qualityInspectionCurrent.vue index a543f7a..c71229a 100644 --- a/src/views/modules/monitoring/qualityInspectionCurrent.vue +++ b/src/views/modules/monitoring/qualityInspectionCurrent.vue @@ -43,8 +43,15 @@ - - + + @@ -56,23 +63,111 @@ import moment from 'moment' import BaseTable from '@/components/base-table' import SmallTitle from '@/components/small-title' +import * as echarts from 'echarts' const tableConfigStatic = [ { type: 'index', name: '序号' }, - { name: '上片总数', prop: '' }, - { name: '下片总数', prop: '' }, - { name: '检测总数', prop: '' }, + { name: '上片总数', prop: 'sumUp' }, + { name: '下片总数', prop: 'sumDown' }, + { name: '检测总数', prop: 'sumCheck' }, + { name: '比例', prop: 'scrapRatio', filter: val => (val || val === 0 ? `${val}%` : '-') } +] +const tableConfigDynamic = [ + { type: 'index', name: '序号' }, + { name: '检测类型', prop: 'inspectionContent' }, + /** dynamic */ + { name: '检测类型总数', prop: '' }, { name: '比例', prop: '' } ] -const tableConfigDynamic = [] + +const FakeChart = { + name: 'FakeChart', + props: { + categories: { + type: Array, + default: () => [] + }, + typeList: { + type: Array, + default: () => [] + } + }, + data() { + return { + chart: null, + defaultOpts: { + title: { + text: '统计数据' + }, + tooltip: {}, + xAxis: { + data: [ + /** dynamic */ + ] + }, + yAxis: {}, + series: [ + // dynamic + // { + // name: '销售', + // type: 'bar', + // data: [23, 42, 12, 4, 3] + // } + ] + } + } + }, + watch: { + categories: { + handler: function(val, oldVal) { + if (val && val !== oldVal) { + this.defaultOpts.xAxis.data.push(...val) + } + }, + immediate: true + }, + defaultOpts: { + handler: function(val) { + console.log('defaullt opts change: ', val) + this.setOptions() + }, + immediate: true, + deep: true + } + }, + mounted() { + this.$nextTick(() => { + this.initChart() + this.setOptions() + }) + }, + methods: { + initChart() { + if (!this.chart) { + this.chart = echarts.init(document.getElementById('bar-chart')) + } + }, + setOptions(opts) { + /** prop options */ + if (opts) { + } + + if (this.chart) this.chart.setOption(this.defaultOpts) + } + }, + render: function(h) { + return h('div', { attrs: { id: 'bar-chart' }, style: { background: '#eee', width: '100%', height: '300px', padding: '8px' } }, '') + } +} const dict = ['表格', '图形'] export default { name: 'QualityInspectionCurrent', - components: { BaseTable, SmallTitle, FakeChart: { render: h => h('span', null, 'fake-chart') } }, + components: { BaseTable, SmallTitle, FakeChart }, data() { return { tableConfigStatic, + tableConfigDynamic, dataListStatic: [], dataListDynamic: [], dict, @@ -91,7 +186,9 @@ export default { } } ] - } + }, + echartCategories: null, + echartCheckTypes: [] } }, mounted() { @@ -103,6 +200,8 @@ export default { this.showGraph = value === dict[0] ? false : true }, getDataList() { + this.echartCategories = null + this.echartCheckTypes.splice(0) /** 设置默认日期 */ const startTime = this.datetime[0] || @@ -118,12 +217,61 @@ export default { /** [1] 获取上下片数据 */ this.fetchList('sx', startTime, endTime).then(({ data: res }) => { console.log('sx: ', res) + this.dataListStatic = res.data || [] }) /** [2] 获取产线检测类型 */ this.fetchList('pl', startTime, endTime).then(({ data: res }) => { console.log('pl: ', res) + /** TODO: 解析 nameData */ + this.parseTableProps(res.data.nameData) + + this.dataListDynamic = this.parseDynamicData(res.data.data) || [] + + console.log('dyname', this.dataListDynamic) }) }, + + parseTableProps(nameData) { + const subProps = [] + const labelNameMap = new Map() + + if (nameData.length) { + /** 处理 nameData */ + nameData.forEach(item => { + if (!labelNameMap.get(item.name)) { + labelNameMap.set(item.name, 1) + subProps.push({ name: item.name, prop: item.name }) + } + }) + } + + this.tableConfigDynamic = [ + { type: 'index', name: '序号' }, + { name: '检测类型', prop: 'inspectionContent' }, + ...subProps, + { name: '检测类型总数', prop: 'sumInput' }, + { name: '比例', prop: 'scrapRatio', filter: val => (val || val === 0 ? `${val}%` : '-') } + ] + + /** echarts related */ + this.echartCategories = subProps.map(item => item.name) + }, + + parseDynamicData(data) { + this.echartCheckTypes.splice(0) + return data.map(item => { + /** echarts related */ + this.echartCheckTypes.push(item.inspectionContent) + if (item.data.length) { + /** 解析子数组 */ + item.data.forEach(subitem => { + item[subitem.dynamicName] = subitem.dynamicValue + }) + } + return item + }) + }, + fetchList(type, startTime, endTime) { switch (type) { case 'sx': -- 2.45.2 From 3c4af47e2d8969a4c49fe2a2f81180b5bf10ce45 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 17 Aug 2022 16:41:32 +0800 Subject: [PATCH 075/127] =?UTF-8?q?update=20=E5=9F=BA=E6=9C=AC=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=BD=93=E5=89=8D=E6=A3=80=E6=B5=8B=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitoring/qualityInspectionCurrent.vue | 66 +++++++++++++++++-- 1 file changed, 62 insertions(+), 4 deletions(-) diff --git a/src/views/modules/monitoring/qualityInspectionCurrent.vue b/src/views/modules/monitoring/qualityInspectionCurrent.vue index c71229a..c82d156 100644 --- a/src/views/modules/monitoring/qualityInspectionCurrent.vue +++ b/src/views/modules/monitoring/qualityInspectionCurrent.vue @@ -17,7 +17,7 @@ 查询 - 新增 + @@ -51,7 +51,7 @@ @operate-event="handleOperations" @refreshDataList="getDataList" /> - + @@ -90,6 +90,10 @@ const FakeChart = { typeList: { type: Array, default: () => [] + }, + seriesData: { + type: Array, + default: () => [] } }, data() { @@ -97,9 +101,17 @@ const FakeChart = { chart: null, defaultOpts: { title: { - text: '统计数据' + text: '检测类型统计数据' }, tooltip: {}, + legend: { + orient: 'vertical', + top: 10, + right: 20, + data: [ + /** dynamic */ + ] + }, xAxis: { data: [ /** dynamic */ @@ -126,6 +138,22 @@ const FakeChart = { }, immediate: true }, + typeList: { + handler: function(val, oldVal) { + if (val && val !== oldVal) { + this.defaultOpts.legend.data.push(...val) + } + }, + immediate: true + }, + seriesData: { + handler: function(val, oldVal) { + if (val && val !== oldVal) { + this.defaultOpts.series.push(...val) + } + }, + immediate: true + }, defaultOpts: { handler: function(val) { console.log('defaullt opts change: ', val) @@ -200,6 +228,8 @@ export default { this.showGraph = value === dict[0] ? false : true }, getDataList() { + this.showGraph = false + this.dataType = '表格' this.echartCategories = null this.echartCheckTypes.splice(0) /** 设置默认日期 */ @@ -227,7 +257,7 @@ export default { this.dataListDynamic = this.parseDynamicData(res.data.data) || [] - console.log('dyname', this.dataListDynamic) + this.buildGraphData() }) }, @@ -272,6 +302,34 @@ export default { }) }, + buildGraphData() { + /** 构造 echart 需要的数据 */ + const result = [] + + this.echartCheckTypes.forEach(ect => { + result.push({ name: ect, type: 'bar', data: [] }) + }) + + this.dataListDynamic.forEach((inspection, index) => { + console.log('inspection: ', inspection) + this.echartCategories.forEach(cate => { + if (cate in inspection) { + result[index].data.push(inspection[cate]) + } else { + result[index].data.push('0') + } + }) + }) + + this.echartsData = result + // [ + // { name: '11', type: 'bar', data: [/**产线1*/ 2, /**产线2*/ 3] }, + // { name: '222', type: 'bar', data: [1, 2, 3] } + // ] + + console.log('echarts data: ', this.echartsData) + }, + fetchList(type, startTime, endTime) { switch (type) { case 'sx': -- 2.45.2 From a15e78dcafcfcf1c3b0b04f58c721d206254e161 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Wed, 17 Aug 2022 17:02:58 +0800 Subject: [PATCH 076/127] =?UTF-8?q?update=20attr-form=20=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91,TODO:=E6=A3=80=E6=9F=A5=E4=BA=A7=E5=93=81=E6=B1=A0?= =?UTF-8?q?=E5=92=8C=E8=AE=BE=E5=A4=87=E4=BF=A1=E6=81=AF=E7=9A=84=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=AD=90=E8=A1=A8=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base-dialog/AttrForm/index.vue | 24 ++++++++++++------- .../base-dialog/addOrUpdate/index.vue | 2 +- src/views/modules/monitoring/equipment.vue | 12 ++++++++++ src/views/modules/monitoring/product.vue | 1 + 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/src/components/base-dialog/AttrForm/index.vue b/src/components/base-dialog/AttrForm/index.vue index ab4ef86..9d0bdce 100644 --- a/src/components/base-dialog/AttrForm/index.vue +++ b/src/components/base-dialog/AttrForm/index.vue @@ -66,8 +66,14 @@ export default { default: () => [] }, /** 表单提交需要的属性 */ - pId: { + relatedId: { type: String, + required: true, + default: null + }, + relatedField: { + type: String, + required: true, default: null } }, @@ -96,12 +102,12 @@ export default { }, mounted() { this.getDataList() - /** 设置 AttrForm 的 rules */ - for(const config of this.tableConfigs) { - if (config.rules) { - this.$set(this.AttrFormRules, [config.prop], config.rules) - } - } + /** 设置 AttrForm 的 rules */ + for (const config of this.tableConfigs) { + if (config.rules) { + this.$set(this.AttrFormRules, [config.prop], config.rules) + } + } }, methods: { /** init dataform */ @@ -127,7 +133,7 @@ export default { params: this.$http.adornParams({ page: this.pageIndex, limit: this.pageSize, - productId: this.pId + [this.relatedField]: this.relatedId // order: 'asc/desc', // orderField: 'name' }) @@ -210,7 +216,7 @@ export default { headers: { 'Content-Type': 'application/json' }, - data: JSON.stringify({ ...this.AttrForm, productId: this.pId }) + data: JSON.stringify({ ...this.AttrForm, [this.relatedField]: this.relatedId }) }).then(({ data }) => { if (data && data.code === 0) { this.$message({ diff --git a/src/components/base-dialog/addOrUpdate/index.vue b/src/components/base-dialog/addOrUpdate/index.vue index 2411e11..36dcd98 100644 --- a/src/components/base-dialog/addOrUpdate/index.vue +++ b/src/components/base-dialog/addOrUpdate/index.vue @@ -66,7 +66,7 @@ diff --git a/src/views/modules/monitoring/equipment.vue b/src/views/modules/monitoring/equipment.vue index d9eb275..8e3b289 100644 --- a/src/views/modules/monitoring/equipment.vue +++ b/src/views/modules/monitoring/equipment.vue @@ -154,6 +154,18 @@ const addOrUpdateConfigs = { } } ], + subtable: { + title: '查看设备属性', + url: '/monitoring/equipmentAttr', + relatedField: 'equipmentId', + tableConfigs: [ + { type: 'index', name: '序号' }, + { prop: 'createTime', name: '创建时间' }, + { prop: 'attrName', name: '属性名称', formField: true }, + { prop: 'attrValue', name: '属性值', formField: true }, + { prop: 'operate', name: '操作', options: ['edit', 'delete'] } + ] + }, operations: [ { name: 'cancel', showAlways: true }, { name: 'save', url: '/monitoring/equipment', permission: '', showOnEdit: false }, diff --git a/src/views/modules/monitoring/product.vue b/src/views/modules/monitoring/product.vue index 805c2ce..277bda0 100644 --- a/src/views/modules/monitoring/product.vue +++ b/src/views/modules/monitoring/product.vue @@ -140,6 +140,7 @@ const addOrUpdateConfigs = { // for i18n title: '动态属性', url: '/monitoring/productArrt', + relatedField: 'productId', tableConfigs: [ { type: 'index', name: '序号' }, { prop: 'createTime', name: '添加时间', filter: val => (val ? moment(val).format('YYYY-MM-DD hh:mm:ss') : '-') }, -- 2.45.2 From 93b401071a120f70fbda3039e0155a7749dfa980 Mon Sep 17 00:00:00 2001 From: g7hoo Date: Thu, 18 Aug 2022 09:01:06 +0800 Subject: [PATCH 077/127] =?UTF-8?q?update=20=E5=9F=BA=E6=9C=AC=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E8=B4=A8=E9=87=8F=E7=AE=A1=E7=90=86=E5=92=8C=E5=9F=BA?= =?UTF-8?q?=E7=A1=80=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/base-dialog/AttrForm/index.vue | 6 +- .../base-dialog/addOrUpdate/index.vue | 38 +++++++++---- src/components/base-upload/index.vue | 6 +- src/views/modules/monitoring/equipment.vue | 55 +++++++++++++------ 4 files changed, 76 insertions(+), 29 deletions(-) diff --git a/src/components/base-dialog/AttrForm/index.vue b/src/components/base-dialog/AttrForm/index.vue index 9d0bdce..bc29764 100644 --- a/src/components/base-dialog/AttrForm/index.vue +++ b/src/components/base-dialog/AttrForm/index.vue @@ -1,6 +1,6 @@ + 返回 @@ -347,7 +362,8 @@ export default { } }, - init(id) { + init(id, isdetail = false) { + this.isDetail = isdetail this.visible = true this.$nextTick(() => { this.$refs['dataForm'].resetFields() diff --git a/src/components/base-upload/index.vue b/src/components/base-upload/index.vue index 94562c1..7873bdd 100644 --- a/src/components/base-upload/index.vue +++ b/src/components/base-upload/index.vue @@ -13,7 +13,7 @@ - {{ buttonContent }} + {{ buttonContent }}
{{ tip }}
@@ -39,6 +39,10 @@ export default { // 从外部传进来 fileList,用于展示文件列表用 type: Array, default: () => [] + }, + readOnly: { + type: Boolean, + default: false } }, // inject: { diff --git a/src/views/modules/monitoring/equipment.vue b/src/views/modules/monitoring/equipment.vue index 8e3b289..30fb4f8 100644 --- a/src/views/modules/monitoring/equipment.vue +++ b/src/views/modules/monitoring/equipment.vue @@ -6,8 +6,8 @@ 查询 - test 新增 + 导出 @@ -163,7 +163,7 @@ const addOrUpdateConfigs = { { prop: 'createTime', name: '创建时间' }, { prop: 'attrName', name: '属性名称', formField: true }, { prop: 'attrValue', name: '属性值', formField: true }, - { prop: 'operate', name: '操作', options: ['edit', 'delete'] } + { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] } ] }, operations: [ @@ -272,31 +272,54 @@ export default { switch (type) { case 'view-detail': // const { name, code } = this.dataList.find(item => item.id === id) - this.$router.push({ - name: 'monitoring-equipmentAdd', - params: { - isdetail: true, - equipmentId: id - } - }) - break + // this.$router.push({ + // name: 'monitoring-equipmentAdd', + // params: { + // isdetail: true, + // equipmentId: id + // } + // }) + // break + return this.addOrUpdateHandle(id, true) case 'edit': return this.addOrUpdateHandle(id) case 'delete': return this.deleteHandle(id) } }, - test() { - this.addOrUpdateVisible = true - this.$nextTick(() => { - this.$refs.addOrUpdate.init() + exportHandle() { + // this.$http.get(this.$http.adornUrl('/monitoring/equipment/export')).then(({ data: res }) => { + this.$http({ url: this.$http.adornUrl('/monitoring/equipment/export'), method: 'get', responseType: 'blob' }).then(res => { + let fileName = 'equipment-list.xls' + if (res.headers['content-disposition']) { + const contentDisposition = res.headers['content-disposition'] + fileName = contentDisposition.slice(contentDisposition.indexOf('filename=') + 9) + } + + fileName = decodeURIComponent(fileName) + + const blob = new Blob([res.data]) + + if ('download' in document.createElement('a')) { + const alink = document.createElement('a') + alink.download = fileName + alink.style.display = 'none' + alink.target = '_blank' + alink.href = URL.createObjectURL(blob) + document.body.appendChild(alink) + alink.click() + URL.revokeObjectURL(alink.href) + document.body.removeChild(alink) + } else { + navigator.msSaveBlob(blob, fileName) + } }) }, // 新增 / 修改 - addOrUpdateHandle(id) { + addOrUpdateHandle(id, isdetail = false) { this.addOrUpdateVisible = true this.$nextTick(() => { - this.$refs.addOrUpdate.init(id) + this.$refs.addOrUpdate.init(id, isdetail) }) // this.$router.push({ // name: 'monitoring-equipmentAdd', -- 2.45.2 From dedcedec060d9fb90280aba8ff620e48fc906f4c Mon Sep 17 00:00:00 2001 From: g7hoo Date: Thu, 18 Aug 2022 14:00:15 +0800 Subject: [PATCH 078/127] =?UTF-8?q?update=20=E8=AE=BE=E5=A4=87plc=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/modules/monitoring/equipmentPlc.vue | 147 ++++++++++-------- .../monitoring/qualityInspectionRecord.vue | 10 +- 2 files changed, 92 insertions(+), 65 deletions(-) diff --git a/src/views/modules/monitoring/equipmentPlc.vue b/src/views/modules/monitoring/equipmentPlc.vue index 3890853..3fa70a0 100644 --- a/src/views/modules/monitoring/equipmentPlc.vue +++ b/src/views/modules/monitoring/equipmentPlc.vue @@ -6,42 +6,11 @@ 查询 - 新增 - + 新增 - - + + - + + + \ No newline at end of file diff --git a/src/views/modules/monitoring/equipmentPlc.vue b/src/views/modules/monitoring/equipmentPlc.vue index 3fa70a0..6faac7c 100644 --- a/src/views/modules/monitoring/equipmentPlc.vue +++ b/src/views/modules/monitoring/equipmentPlc.vue @@ -35,28 +35,15 @@ import TableTextComponent from '@/components/base-table/components/detailCompone const tableConfigs = [ { type: 'index', name: '序号' }, - // { prop: 'id', name: 'id' }, - // { "prop": "plcType", "name": "plc类型" }, { prop: 'code', name: '编码' }, { prop: 'name', name: '名称' }, { prop: 'enName', name: '英文名称' }, { prop: 'description', name: '描述' }, { prop: 'barcode', name: 'plc条码' }, - // { "prop": "controlType", "name": "链接方式,0 tcp,1 udp等" }, - // { "prop": "monitor", "name": "是否监控 0 代表不监控, 1 代表监控" }, { prop: 'collection', name: '是否采集', filter: val => ({ 0: '不采集', 1: '采集' }[val]) }, { prop: 'ip', name: 'IP' }, { prop: 'port', name: '端口号' }, - // { "prop": "enabled", "name": "启用状态:0 、停用,1、启用" }, { prop: 'remark', name: '备注' }, - // { prop: 'valid', name: '删除标志,是否有效:1 可用 0不可用' }, - // { prop: 'creatorId', name: '创建人' }, - // { prop: 'creatorName', name: '创建人姓名' }, - // { prop: 'createTime', name: '添加时间' }, - // { prop: 'updaterId', name: '更新人' }, - // { prop: 'updaterName', name: '更新人姓名' }, - // { prop: 'updateTime', name: '更新时间' }, - // { prop: 'version', name: '版本号' }, { prop: 'operations', name: '操作', fixed: 'right', width: 180, subcomponent: TableOperateComponent, options: ['edit', 'delete'] } ] diff --git a/src/views/modules/monitoring/equipmentPlcConnect.vue b/src/views/modules/monitoring/equipmentPlcConnect.vue index c3e0f8f..df39b20 100644 --- a/src/views/modules/monitoring/equipmentPlcConnect.vue +++ b/src/views/modules/monitoring/equipmentPlcConnect.vue @@ -6,32 +6,12 @@ 查询 - 新增 + 新增 - - + + + - + diff --git a/src/views/modules/monitoring/reportDesign.vue b/src/views/modules/monitoring/reportDesign.vue new file mode 100644 index 0000000..2f7ab10 --- /dev/null +++ b/src/views/modules/monitoring/reportDesign.vue @@ -0,0 +1,44 @@ +