田源
2024-04-07 5426194b8651c9b2e13669940535e32e563964e5
Source/ProjectWeb/src/store/modules/user.js
@@ -14,7 +14,7 @@
  const propsConfig = menu.props;
  const propsDefault = {
    label: propsConfig.label || 'name',
    path: 'code',
    path: propsConfig.path || 'path',
    icon: propsConfig.icon || 'icon',
    children: propsConfig.children || 'children'
  }
@@ -27,9 +27,19 @@
  } else {
    ele[propsDefault.children].forEach(child => {
      addPath(child);
    })
  }
    });
  }
}
function updateCode(items) {
  items.forEach(item => {
    item.pathValue = item.path;
    item.path = '/' + item.code;
    if (item.children && item.children.length > 0) {
      updateCode(item.children);
    }
  });
}
@@ -356,7 +366,7 @@
                      "name": "典型规程",
                      "parentId": "BDBD6CFA-2F4C-EEF7-C380-5E9BBF6A37B3",
                      "parentName": null,
                      "path": "bs=?image=typical&type=workorder&context=TypicalProcessLib",
                      "path": "bs=test?image=typical&type=workorder&context=TypicalProcessLib",
                      "remark": null,
                      "sort": 1,
                      "source": ""
@@ -400,24 +410,9 @@
          let menu = deepClone(list);
          menu.forEach(ele => {
            addPath(ele, true);
            updateCode([ele]);
          });
          updateCode(menu)
          function updateCode(items) {
            items.forEach(item => {
              // 将字符串分割成数组,以'?'作为分隔符
              let parts = item.path.split("?");
              // 如果数组的长度大于1,表示有'?',则取第一个元素的第一个部分,否则直接取整个字符串
              let bsValue = parts.length > 1 ? parts[0].split("=")[1] : item.path.split("=")[1];
              if (bsValue ===''  || bsValue === undefined || bsValue === null) {
                bsValue = "UI";
              }
              item.path = bsValue === 'UI' ? '/base/UIContentViewer' :  `/custom-ui/${bsValue}`;
              // 如果children不为空,递归调用这个函数
              if (item.children && item.children.length > 0) {
                updateCode(item.children);
              }
            });
          }
          commit('SET_MENU_ALL', menu)
          commit('SET_MENU', menu)
          //dispatch('GetButtons');s