From 2a2d753357f4d3c26b3622513ffb6e647f64704a Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期日, 27 四月 2025 13:19:19 +0800
Subject: [PATCH] 工艺路线修改
---
src/permission.js | 115 ++++++++++++++++++++++----------------
src/views/technology/routing/routing-form.vue | 54 ++++++++++++++---
2 files changed, 111 insertions(+), 58 deletions(-)
diff --git a/src/permission.js b/src/permission.js
index e4b0dc0..4692ede 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -2,80 +2,99 @@
* 鍏ㄧ珯鏉冮檺閰嶇疆
*
*/
-import router from './router/router';
-import store from '@/store';
-import { validatenull } from '@/util/validate';
-import NProgress from 'nprogress'; // progress bar
-import 'nprogress/nprogress.css'; // progress bar style
-NProgress.configure({ showSpinner: false });
+import router from './router/router'
+import store from '@/store'
+import { validatenull } from '@/util/validate'
+import NProgress from 'nprogress' // progress bar
+import 'nprogress/nprogress.css' // progress bar style
+NProgress.configure({ showSpinner: false })
router.beforeEach((to, from, next) => {
- NProgress.start();
- const meta = to.meta || {};
- const whiteList = ['/login', '/404', '/401', '/lock','/pack']
+ NProgress.start()
+ const meta = to.meta || {}
+ const whiteList = ['/login', '/404', '/401', '/lock', '/pack']
if (store.getters.access_token) {
if (store.getters.isLock && to.path !== '/lock') {
- next({ path: '/lock' });
+ next({ path: '/lock' })
} else if (to.path === '/login') {
- next({ path: '/' });
+ next({ path: '/' })
} else {
- const value = to.query.src || to.fullPath;
- const label = to.query.name || to.name;
- if (meta.isTab !== false && !validatenull(value) && !validatenull(label)) {
+ const value = to.query.src || to.fullPath
+ const label = to.query.name || to.name
+ // 妫�鏌ュ綋鍓嶈杩涘叆鐨勯〉闈㈡槸鍚﹀湪鏍囩鍒楄〃涓�
+ const existingTag = store.getters.tagList.find(
+ (tag) => tag.label === label
+ )
+ if (existingTag) {
+ // 濡傛灉瀛樺湪锛屽垹闄よ鏍囩
+ store.commit('DEL_TAG', existingTag)
+ }
+ if (
+ meta.isTab !== false &&
+ !validatenull(value) &&
+ !validatenull(label)
+ ) {
store.commit('ADD_TAG', {
label: label,
value: value,
params: to.params,
query: to.query,
group: router.$avueRouter.group || []
- });
+ })
}
- next();
+ next()
}
} else {
// 椤甸潰澶氬紑锛氳浇鍏ocalStorage鐨刟uth鍙傛暟 By Luxn
- let auth = JSON.parse(localStorage.getItem("authorization") || "{}");
- if ( meta.isAuth === false) {
+ let auth = JSON.parse(localStorage.getItem('authorization') || '{}')
+ if (meta.isAuth === false) {
//娌℃湁token鐨勬儏鍐�
- if (whiteList.indexOf(to.path) !== -1) {
- // 濡傛灉鍦ㄧ櫧鍚嶅崟鍐呭垯鐩存帴璺宠浆
- next()
- } else {
- // 鍏朵綑椤甸潰閲嶅畾鍚戝埌鐧诲綍椤�
- next('/login')
- }
+ if (whiteList.indexOf(to.path) !== -1) {
+ // 濡傛灉鍦ㄧ櫧鍚嶅崟鍐呭垯鐩存帴璺宠浆
+ next()
+ } else {
+ // 鍏朵綑椤甸潰閲嶅畾鍚戝埌鐧诲綍椤�
+ next('/login')
+ }
// next();
- }else{
+ } else {
if (auth.date_time) {
- let key = ["access_token", "refresh_token", "expires_in", "user_info", "language"];
+ let key = [
+ 'access_token',
+ 'refresh_token',
+ 'expires_in',
+ 'user_info',
+ 'language'
+ ]
key.forEach((item, i) => {
- store.commit("SET_" + item.toUpperCase(), auth[item]);
- store.commit("SET_PERMISSIONS", auth.user_info.authorities || []);
- });
+ store.commit('SET_' + item.toUpperCase(), auth[item])
+ store.commit('SET_PERMISSIONS', auth.user_info.authorities || [])
+ })
// 鑾峰彇宸︿晶瀵艰埅锛屾墦寮�Path椤甸潰 By Luxn
- store.dispatch("GetMenu", { language: auth.language, type: true }).then((data) => {
- let path = window.location.hash.substr(1);
- if (data.length > 0 && path.length > 1) {
- router.$avueRouter.formatRoutes(data, true);
- next({ path: path });
- }
- else {
- next();
- }
- });
- }else{
- next('/login');
+ store
+ .dispatch('GetMenu', { language: auth.language, type: true })
+ .then((data) => {
+ let path = window.location.hash.substr(1)
+ if (data.length > 0 && path.length > 1) {
+ router.$avueRouter.formatRoutes(data, true)
+ next({ path: path })
+ } else {
+ next()
+ }
+ })
+ } else {
+ next('/login')
}
}
}
})
-router.afterEach((to,from) => {
- NProgress.done();
- const title = store.getters.tag.label;
- router.$avueRouter.setTitle(title);
+router.afterEach((to, from) => {
+ NProgress.done()
+ const title = store.getters.tag.label
+ router.$avueRouter.setTitle(title)
// 鎵撳紑鏂伴〉闈㈡爣棰樹笉瀵癸紝鏍规嵁router閰嶇疆鐨則itle杩涜鏇挎崲
- if(to.meta.title){
- router.$avueRouter.setTitle( to.meta.title)
+ if (to.meta.title) {
+ router.$avueRouter.setTitle(to.meta.title)
}
})
diff --git a/src/views/technology/routing/routing-form.vue b/src/views/technology/routing/routing-form.vue
index 6b5702b..b8b272c 100644
--- a/src/views/technology/routing/routing-form.vue
+++ b/src/views/technology/routing/routing-form.vue
@@ -531,8 +531,8 @@
},
computed: {
- editable: function () {
- if (!this.dataForm.id) {
+ editable() {
+ if (!this.dataForm.id && this.itemKey) {
return true
}
if (this.dataForm.id && this.dataForm.state == '01draft') {
@@ -584,14 +584,48 @@
'$route.query.id': {
immediate: true,
handler(newVal, oldVal) {
- this.dataForm.id = this.$route.query.id
- this.getParamType()
- this.init()
- this.itemKey = Math.random()
- this.getBomTypeDbOptions()
- this.getWorkCenterOptions()
- this.getRunTimeCodeDbOptions()
- this.getLaborClassNo()
+ if (newVal) {
+ this.dataForm.id = this.$route.query.id
+ this.getParamType()
+ this.init()
+ this.itemKey = Math.random()
+ this.getBomTypeDbOptions()
+ this.getWorkCenterOptions()
+ this.getRunTimeCodeDbOptions()
+ this.getLaborClassNo()
+ } else {
+ this.dataForm.id = null
+ this.getParamType()
+ this.init()
+ this.dataForm = {
+ id: null,
+ routingNo: null,
+ name: null,
+ partId: null,
+ partNo: null,
+ partName: null,
+ description: null,
+ state: null,
+ master: false,
+ bomId: null,
+ operations: [],
+ refs: [],
+ bomTypeDb: 'M',
+ alternativeNo: '*',
+ alternativeDesc: null,
+ ifsSync: false,
+ phaseInDate: null,
+ phaseOutDate: null,
+ version: null,
+ wireCore: null
+ }
+ this.operationPart = {}
+ this.itemKey = Math.random()
+ this.getBomTypeDbOptions()
+ this.getWorkCenterOptions()
+ this.getRunTimeCodeDbOptions()
+ this.getLaborClassNo()
+ }
},
},
},
--
Gitblit v1.9.3