spring
2025-04-27 2a2d753357f4d3c26b3622513ffb6e647f64704a
工艺路线修改
已修改2个文件
169 ■■■■■ 文件已修改
src/permission.js 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/technology/routing/routing-form.vue 54 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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 {
    // 页面多开:载入localStorage的auth参数 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配置的title进行替换
  if(to.meta.title){
    router.$avueRouter.setTitle( to.meta.title)
  if (to.meta.title) {
    router.$avueRouter.setTitle(to.meta.title)
  }
})
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()
        }
      },
    },
  },