董国庆
2025-06-26 dae39dea7e2874ebe2f17438949255ce8331ecef
修改权限
6个文件已修改
87 ■■■■■ 已修改文件
culture/src/layouts/components/ElMenu/index.vue 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/components/DynamicComponent/index.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/utils/utils.js 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/inspectionReport/detail.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/reportLibrary/verificationRelease/components/approval/index.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
culture/src/layouts/components/ElMenu/index.vue
@@ -18,9 +18,42 @@
<script>
import routers from "../../../router";
import MenuItem from "./MenuItem.vue";
import { mapState } from "vuex";
// 递归过滤菜单
function filterMenusByPrivilege(menus, flatMenus) {
  return menus
    .filter(menu => {
      // 没有 privilege 字段的菜单默认显示,有 privilege 字段的要判断权限
      if (menu.meta && menu.meta.privilege) {
        return flatMenus.includes(menu.meta.privilege);
      }
      return true;
    })
    .map(menu => {
      // 递归处理 children
      if (menu.children && menu.children.length > 0) {
        return {
          ...menu,
          children: filterMenusByPrivilege(menu.children, flatMenus)
        };
      }
      return menu;
    })
    .filter(menu => {
      // 过滤掉 children 为空的父级菜单
      if (menu.children && menu.children.length === 0) {
        return false;
      }
      return true;
    });
}
export default {
  components: {
    MenuItem,
  },
  computed: {
    ...mapState(["flatMenus"]),
  },
  data() {
    return {
@@ -30,11 +63,13 @@
  mounted() {
    // 获取所有定义的一级菜单和多级菜单
    // 过滤掉登录路由和重定向路由,只获取主布局下的路由
    this.routersList = routers.options.routes.filter(route =>
    const allMenus = routers.options.routes.filter(route =>
      route.path !== '/login' && 
      route.path !== '/' && 
      !route.meta?.hide
    );
    // 权限过滤
    this.routersList = filterMenusByPrivilege(allMenus, this.flatMenus);
  },
};
</script>
laboratory/src/components/DynamicComponent/index.vue
@@ -64,7 +64,7 @@
          </el-upload>
          <div v-else>
            <div v-for="file in item.data.fileList" :key="file.uid" class="file-list-item">
              {{ file.name }}
              <span style="color: #409EFF; cursor: pointer;" @click="downloadFileByUrl(file.url, file.name)">{{ file.name }}</span>
            </div>
          </div>
        </div>
@@ -116,6 +116,7 @@
import addTableData from "./addTableData.vue";
import apiConfig from '../../utils/baseurl'
import { getFullUrl } from '@/utils/utils'
import { downloadFileByUrl } from '@/utils/utils'
export default {
  name: "DynamicComponent",
@@ -195,6 +196,7 @@
                break;
              case 'fileUpload':
                componentData = { fileList: component.data };
                console.log('component.data component.data',component.data)
                break;
              case 'imageUpload':
                componentData = { imageList: component.data.map(item=>{
@@ -219,6 +221,8 @@
    }
  },
  methods: {
    getFullUrl,
    downloadFileByUrl,
    getUserDisplayText(fieldName, rowData) {
      // 检查是否有对应的userInfo数据
      const userInfoKey = `${fieldName}_userInfo`;
@@ -304,6 +308,7 @@
            break;
          case 'fileUpload':
            componentData = component.data.fileList.map(file => {
              console.log('fileUpload fileUpload fileUpload',file)
              if (file.url && file.url.startsWith(prefix)) {
                return { ...file, url: file.url.substring(prefix.length) };
              }
@@ -507,7 +512,6 @@
      const updatedComponents = JSON.parse(JSON.stringify(this.components));
      this.$emit('update:dataSource', updatedComponents);
    },
    getFullUrl,
  },
  computed: {
  },
laboratory/src/utils/utils.js
@@ -37,3 +37,37 @@
  if (/^https?:\/\//.test(url)) return url;
  return apiConfig.showImgUrl + url;
}
/**
 * 通用文件下载方法
 * @param {string} url 文件的下载地址(支持相对和绝对路径)
 * @param {string} name 下载保存的文件名(可选)
 */
export function downloadFileByUrl(url, name) {
  console.log('22222222222222222222',url)
  if (!url) return;
  // 处理相对路径
  const fullUrl = getFullUrl(url);
  console.log('fullUrl fullUrl',fullUrl)
  const a = document.createElement('a');
  a.href = fullUrl;
  if (name) {
    a.download = name;
  } else {
    a.download = '';
  }
  a.style.display = 'none';
  document.body.appendChild(a);
  a.click();
  document.body.removeChild(a);
}
/**
 * 在新标签页打开文件(预览或下载)
 * @param {string} url 文件地址(支持相对和绝对路径)
 */
export function openFileInNewTab(url) {
  if (!url) return;
  const fullUrl = getFullUrl(url);
  window.open(fullUrl, '_blank');
}
laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
@@ -361,7 +361,7 @@
          confirmSign: signatureImage, // 签字图片
          signTime: new Date().toISOString(), // 签字时间
          testMethodConfirmSheetTerms: this.testItems.map(item => ({
            id: item.id, // 保留原有ID(编辑时使用)
            id: this.formData.id?item.id:'', // 保留原有ID(编辑时使用)
            termCode: item.termCode,
            termName: item.termName,
            termType: item.termType,
laboratory/src/views/dataManagement/inspectionReport/detail.vue
@@ -400,7 +400,7 @@
              ? "更新成功"
              : "保存成功";
          this.$message.success(successMsg);
this.$router.back();
          this.$store.commit(
            "SET_TAGLIST",
            this.tagList.filter((item) => item.path !== this.$route.path)
laboratory/src/views/reportLibrary/verificationRelease/components/approval/index.vue
@@ -65,7 +65,7 @@
                            <el-form-item prop="feasibilityReportFiles" style="margin-top: -18px">
                                <el-upload
                                disabled
                                    :file-list="form.feasibilityReportFiles"
                                    :file-list="fileList"
                                />
                            </el-form-item>
@@ -203,7 +203,7 @@
                  uid: file.id,
                };
              });
            this.form.feasibilityReportFiles =data.feasibilityReportFiles;
            this.form.feasibilityReportFiles =data.feasibilityReportFiles
          } else {
            this.fileList = [];
            this.form.feasibilityReportFiles = [];