From 8c63d848645c07ad18ab07e364e3364a76853f62 Mon Sep 17 00:00:00 2001 From: yangzhicheng Date: Thu, 18 Jul 2024 16:15:50 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=A4=84=E7=90=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/inspection/inspectionplan.vue | 4 ++-- src/views/inspection/inspectionroute.vue | 4 ++-- src/views/spares/materialDetail.vue | 5 ++++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/views/inspection/inspectionplan.vue b/src/views/inspection/inspectionplan.vue index 96d4a7b..129e7df 100644 --- a/src/views/inspection/inspectionplan.vue +++ b/src/views/inspection/inspectionplan.vue @@ -320,7 +320,7 @@ return; } this.cancelBox = true; - this.$refs.cancelForm.resetForm(); + this.cancelForm.cancelReason = ''; }, handleDetailCancel() { this.$confirm("是否将选择数据改为失效状态?", { @@ -332,7 +332,7 @@ return lapse(this.ids, this.cancelForm.cancelReason); }) .then(() => { - this.$refs.cancelForm.resetForm(); + this.cancelForm.cancelReason = ''; this.cancelBox = false; this.onLoad(this.page); this.$message({ diff --git a/src/views/inspection/inspectionroute.vue b/src/views/inspection/inspectionroute.vue index 89654af..17801cf 100644 --- a/src/views/inspection/inspectionroute.vue +++ b/src/views/inspection/inspectionroute.vue @@ -302,7 +302,7 @@ return; } this.cancelBox = true; - this.$refs.cancelForm.resetForm(); + this.cancelForm.cancelReason = ''; }, handleDetailCancel() { this.$confirm("是否将选择数据改为失效状态?", { @@ -314,7 +314,7 @@ return lapse(this.ids, this.cancelForm.cancelReason); }) .then(() => { - this.$refs.cancelForm.resetForm(); + this.cancelForm.cancelReason = ''; this.cancelBox = false; this.onLoad(this.page); this.$message({ diff --git a/src/views/spares/materialDetail.vue b/src/views/spares/materialDetail.vue index 5db6cb9..be4f991 100644 --- a/src/views/spares/materialDetail.vue +++ b/src/views/spares/materialDetail.vue @@ -442,6 +442,8 @@ }, methods: { test(val) { + this.diaForm.code = ''; + this.diaForm.type = ''; this.dialogVisible = true; }, handleFormSubmit() { @@ -630,7 +632,8 @@ if (valid) { done() codeAdd(this.diaForm).then(() => { - this.$refs.diaForm.resetForm(); + this.diaForm.code = ''; + this.diaForm.type = ''; this.dialogVisible = false; this.SearchClassCode(); this.$message({ From 464063e106627babfb9145db8016f7c83e587a9b Mon Sep 17 00:00:00 2001 From: zhen <1173776308@qq.com> Date: Thu, 18 Jul 2024 16:33:49 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=BC=A0=E5=90=8C=E6=9C=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/smart/operationticket.vue | 6 +++--- src/views/smart/operationticketDetail.vue | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/smart/operationticket.vue b/src/views/smart/operationticket.vue index 6a55c54..6e4bc31 100644 --- a/src/views/smart/operationticket.vue +++ b/src/views/smart/operationticket.vue @@ -70,9 +70,9 @@
取消 + size="small" + plain + @click="handleDetailCancel">取消
- @@ -96,7 +96,7 @@
- 取消 From 53b87e0a01fa115f52a3b82aa8f7ee299eab2964 Mon Sep 17 00:00:00 2001 From: Dayu <1010@qq.com> Date: Thu, 18 Jul 2024 16:50:56 +0800 Subject: [PATCH 3/6] =?UTF-8?q?bug=20=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/leger/equipmentledgerDetail.vue | 20 ++++++++----- src/views/leger/toolinventoryrecordDetail.vue | 20 ++++++++----- src/views/spares/material.vue | 29 ++++++++++++++----- 3 files changed, 47 insertions(+), 22 deletions(-) diff --git a/src/views/leger/equipmentledgerDetail.vue b/src/views/leger/equipmentledgerDetail.vue index 7ab5584..df1d7eb 100644 --- a/src/views/leger/equipmentledgerDetail.vue +++ b/src/views/leger/equipmentledgerDetail.vue @@ -128,6 +128,18 @@ export default { name: "equipmentledgerDetail", data () { + var validatePage = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入页数')); + } else { + var r = /^\+?[0-9][0-9]*$/; + if(!r.test(value)) { + callback(new Error('输入的页数不合法')); + } else { + callback(); + } + } + }; return { checkStatusValue: this.$route.query.checkstatus, optionCheckStatus: [{ @@ -614,14 +626,8 @@ { label: "页数", prop: "page", - type: 'number', - step: 1, span: 20, - rules: [{ - required: true, - message: "请输入页数", - trigger: "blur" - }], + rules: [{required: true, validator: validatePage, trigger: 'blur' }] }, { label: "关键字", diff --git a/src/views/leger/toolinventoryrecordDetail.vue b/src/views/leger/toolinventoryrecordDetail.vue index 460e0d1..98dbfdd 100644 --- a/src/views/leger/toolinventoryrecordDetail.vue +++ b/src/views/leger/toolinventoryrecordDetail.vue @@ -175,6 +175,18 @@ import {getListByTaskNo} from "@/api/inspection/inspectionresult"; export default { name: "equipmentledgerDetail", data () { + var validatePage = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入页数')); + } else { + var r = /^\+?[0-9][0-9]*$/; + if(!r.test(value)) { + callback(new Error('输入的页数不合法')); + } else { + callback(); + } + } + }; return { checkStatusValue:{}, optionCheckStatus: [{ @@ -552,13 +564,7 @@ export default { label: "页数", prop: "page", span: 20, - type: 'number', - step: 1, - rules: [{ - required: true, - message: "请输入页数", - trigger: "blur" - }], + rules: [{required: true, validator: validatePage, trigger: 'blur' }] }, { label: "关键字", diff --git a/src/views/spares/material.vue b/src/views/spares/material.vue index c434b2b..d888254 100644 --- a/src/views/spares/material.vue +++ b/src/views/spares/material.vue @@ -103,13 +103,30 @@ export default { data() { + var validateInCount = (rule, value, callback) => { + if (value === '') { + callback(new Error('请输入入库数量')); + } else { + var r = /^\+?[0-9][0-9]*$/; + if(!r.test(value)) { + callback(new Error('入库数量不合法')); + } else { + callback(); + } + } + }; var validateCount = (rule, value, callback) => { if (value === '') { callback(new Error('请输入出库数量')); - } else if(this.count < value) { - callback(new Error('输入的出库数量大于库存数量')); } else { - callback(); + var r = /^\+?[0-9][0-9]*$/; + if(!r.test(value)) { + callback(new Error('出库数量不合法')); + } else if(this.count < value) { + callback(new Error('输入的出库数量大于库存数量')); + } else { + callback(); + } } }; return { @@ -329,11 +346,7 @@ label: "入库数量", prop: "inboundCount", span: 22, - rules: [{ - required: true, - message: "请输入入库数量", - trigger: "blur" - }] + rules: [{required: true, validator: validateInCount, trigger: 'blur' }] }, { label: "入库申领人", From cd2dd194781e316a4e4014ad28b127ef04036261 Mon Sep 17 00:00:00 2001 From: yangzhicheng Date: Thu, 18 Jul 2024 17:17:04 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E5=BC=B9=E7=AA=97=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=A4=84=E7=90=86=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/inspection/inspectionplan.vue | 4 ++-- src/views/inspection/inspectionroute.vue | 4 ++-- src/views/spares/materialDetail.vue | 6 ++---- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/views/inspection/inspectionplan.vue b/src/views/inspection/inspectionplan.vue index 129e7df..96d4a7b 100644 --- a/src/views/inspection/inspectionplan.vue +++ b/src/views/inspection/inspectionplan.vue @@ -320,7 +320,7 @@ return; } this.cancelBox = true; - this.cancelForm.cancelReason = ''; + this.$refs.cancelForm.resetForm(); }, handleDetailCancel() { this.$confirm("是否将选择数据改为失效状态?", { @@ -332,7 +332,7 @@ return lapse(this.ids, this.cancelForm.cancelReason); }) .then(() => { - this.cancelForm.cancelReason = ''; + this.$refs.cancelForm.resetForm(); this.cancelBox = false; this.onLoad(this.page); this.$message({ diff --git a/src/views/inspection/inspectionroute.vue b/src/views/inspection/inspectionroute.vue index 17801cf..89654af 100644 --- a/src/views/inspection/inspectionroute.vue +++ b/src/views/inspection/inspectionroute.vue @@ -302,7 +302,7 @@ return; } this.cancelBox = true; - this.cancelForm.cancelReason = ''; + this.$refs.cancelForm.resetForm(); }, handleDetailCancel() { this.$confirm("是否将选择数据改为失效状态?", { @@ -314,7 +314,7 @@ return lapse(this.ids, this.cancelForm.cancelReason); }) .then(() => { - this.cancelForm.cancelReason = ''; + this.$refs.cancelForm.resetForm(); this.cancelBox = false; this.onLoad(this.page); this.$message({ diff --git a/src/views/spares/materialDetail.vue b/src/views/spares/materialDetail.vue index be4f991..78e8882 100644 --- a/src/views/spares/materialDetail.vue +++ b/src/views/spares/materialDetail.vue @@ -442,8 +442,7 @@ }, methods: { test(val) { - this.diaForm.code = ''; - this.diaForm.type = ''; + this.$refs.diaForm.resetForm(); this.dialogVisible = true; }, handleFormSubmit() { @@ -632,8 +631,7 @@ if (valid) { done() codeAdd(this.diaForm).then(() => { - this.diaForm.code = ''; - this.diaForm.type = ''; + this.$refs.diaForm.resetForm(); this.dialogVisible = false; this.SearchClassCode(); this.$message({ From ac47b484e9eaf0f6dbd5f65c7d9a185ea1abfdb6 Mon Sep 17 00:00:00 2001 From: Dayu <1010@qq.com> Date: Thu, 18 Jul 2024 17:27:21 +0800 Subject: [PATCH 5/6] =?UTF-8?q?bug=20=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/inspection/inspectiontasks.vue | 41 ++++++++++++++---------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/src/views/inspection/inspectiontasks.vue b/src/views/inspection/inspectiontasks.vue index cff2358..ddebc78 100644 --- a/src/views/inspection/inspectiontasks.vue +++ b/src/views/inspection/inspectiontasks.vue @@ -563,26 +563,33 @@ return; } this.stopBox = true; + this.$refs.stopForm.resetForm(); }, submitStop(){ - this.$confirm("是否将选择巡检任务停止?", { - confirmButtonText: "确定", - cancelButtonText: "取消", - type: "warning" + this.$refs.stopForm.validate((valid, done, msg) => { + if (valid) { + done() + this.$confirm("是否将选择巡检任务停止?", { + confirmButtonText: "确定", + cancelButtonText: "取消", + type: "warning" + }) + .then(() => { + return stop(this.ids, this.stopForm.cancelReason); + }) + .then(() => { + this.$refs.stopForm.resetForm(); + this.stopBox = false; + this.onLoad(this.page); + this.$message({ + type: "success", + message: "操作成功!" + }); + this.$refs.crud.toggleSelection(); + }); + } }) - .then(() => { - return stop(this.ids, this.stopForm.cancelReason); - }) - .then(() => { - this.stopForm.cancelReason = ''; - this.stopBox = false; - this.onLoad(this.page); - this.$message({ - type: "success", - message: "操作成功!" - }); - this.$refs.crud.toggleSelection(); - }); + }, handleExport() { this.$confirm("是否导出数据?", "提示", { From 69ddeb4baf5cb7e38399bc2489874197b26f78eb Mon Sep 17 00:00:00 2001 From: liuyiliang Date: Fri, 19 Jul 2024 09:30:54 +0800 Subject: [PATCH 6/6] sso --- src/api/user.js | 9 +++++++ src/components/scada-login/main.vue | 41 +++++++++++++++++++++++++++++ src/permission.js | 5 ++-- src/router/page/index.js | 14 +++++++++- src/store/modules/user.js | 21 ++++++++++++++- src/views/wel/index.vue | 1 + 6 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 src/components/scada-login/main.vue diff --git a/src/api/user.js b/src/api/user.js index 90138a0..a318491 100644 --- a/src/api/user.js +++ b/src/api/user.js @@ -18,6 +18,15 @@ export const loginByUsername = (tenantId, account, password, type, key, code) => } }); +export const loginByScada = (token) => request({ + url: '/api/daf-auth/scada-token', + method: 'post', + params: { + token + } +}); + + export const loginBySocial = (tenantId, source, code, state) => request({ url: '/api/daf-auth/token', method: 'post', diff --git a/src/components/scada-login/main.vue b/src/components/scada-login/main.vue new file mode 100644 index 0000000..8a36238 --- /dev/null +++ b/src/components/scada-login/main.vue @@ -0,0 +1,41 @@ + + + + + diff --git a/src/permission.js b/src/permission.js index 8fc72d8..ffdb0ef 100644 --- a/src/permission.js +++ b/src/permission.js @@ -7,7 +7,8 @@ import store from './store' import {validatenull} from '@/util/validate' import {getToken} from '@/util/auth' import NProgress from 'nprogress' // progress bar -import 'nprogress/nprogress.css' // progress bar style +import 'nprogress/nprogress.css' +import Cookies from "js-cookie"; // progress bar style NProgress.configure({showSpinner: false}); const lockPage = store.getters.website.lockPage; //锁屏页 router.beforeEach((to, from, next) => { @@ -21,7 +22,7 @@ router.beforeEach((to, from, next) => { next({path: '/'}) } else { //如果用户信息为空则获取用户信息,获取用户信息失败,跳转到登录页 - if (store.getters.token.length === 0) { + if (store.getters.token.length === 0 && !Cookies.get('scada-access-token')) { store.dispatch('FedLogOut').then(() => { next({path: '/login'}) }) diff --git a/src/router/page/index.js b/src/router/page/index.js index 01dcc4d..a1ae221 100644 --- a/src/router/page/index.js +++ b/src/router/page/index.js @@ -21,6 +21,18 @@ export default [{ isAuth: false } }, +{ + path: '/scada-login', + requiresAuth: false, + name: 'scada登录', + component: () => + import( /* webpackChunkName: "page" */ '@/components/scada-login/main'), + meta: { + keepAlive: true, + isTab: false, + isAuth: false, + } +}, { path: '/404', component: () => @@ -77,4 +89,4 @@ export default [{ path: '*', redirect: '/404' } -] \ No newline at end of file +] diff --git a/src/store/modules/user.js b/src/store/modules/user.js index f4c6a7a..d913f5b 100644 --- a/src/store/modules/user.js +++ b/src/store/modules/user.js @@ -4,9 +4,10 @@ import {isURL, validatenull} from '@/util/validate' import {deepClone} from '@/util/util' import webiste from '@/config/website' import {Message, Notification} from 'element-ui' -import {loginByUsername, loginBySocial, getUserInfo, getMenu, getTopMenu, logout, refreshToken, getButtons, getLicense} from '@/api/user' +import {loginByUsername, loginByScada, loginBySocial, getUserInfo, getMenu, getTopMenu, logout, refreshToken, getButtons, getLicense} from '@/api/user' import vue from '../../main.js' import website from "../../config/website"; +import Cookies from "js-cookie"; function addPath(ele, first) { @@ -58,6 +59,22 @@ const user = { }) }) }, + loginByScada({commit}, userInfo) { + return new Promise((resolve, reject) => { + loginByScada(userInfo.token).then(res => { + const data = res.data.data; + var inFifteenMinutes = new Date(new Date().getTime() + 120 * 60 * 1000); + Cookies.set('scada-access-token', data.accessToken, { expires: inFifteenMinutes }); + commit('SET_TOKEN', data.accessToken); + commit('SET_USER_INFO', data); + commit('DEL_ALL_TAG'); + commit('CLEAR_LOCK'); + resolve(); + }).catch(error => { + reject(error); + }) + }) + }, //根据第三方信息登录 LoginBySocial({ commit }, userInfo) { return new Promise((resolve) => { @@ -118,6 +135,7 @@ const user = { LogOut({commit}) { return new Promise((resolve, reject) => { logout().then(() => { + Cookies.remove('scada-access-token'); commit('SET_TOKEN', ''); commit('SET_MENU', []) commit('SET_MENU_ALL', []); @@ -134,6 +152,7 @@ const user = { //注销session FedLogOut({commit}) { return new Promise(resolve => { + Cookies.remove('scada-access-token'); commit('SET_TOKEN', ''); commit('SET_MENU', []); commit('SET_MENU_ALL', []); diff --git a/src/views/wel/index.vue b/src/views/wel/index.vue index 199d3b9..27ede76 100644 --- a/src/views/wel/index.vue +++ b/src/views/wel/index.vue @@ -37,6 +37,7 @@ && !homePageData.manufacturerInfoAudit && !homePageData.warehouseAudit && !homePageData.workPermitAudit + && !homePageData.materialAudit && !homePageData.workOperationTicketAudit && !homePageData.toolInventoryRecordsAudit && !homePageData.equipmentLedgerAudit">