董国庆
2026-04-28 cc21c92994066a5d58f87e7fbf7c04813de4ca4b
feat(router): 重构表单关闭逻辑并添加全局方法

- 在 Vue 原型上添加 $closeCurrentTagAndGo 方法,统一处理关闭当前标签页并跳转的逻辑
- 修改 HeaderNav 组件,使用 meta.needCloseConfirm 替代路径包含 'add' 的判断条件
- 在路由配置中为所有表单页面添加 needCloseConfirm 和 listPath 元数据
- 在路由后置钩子中自动清理已关闭表单页面的标签和 keep-alive 缓存
- 更新多个表单页面的返回逻辑,调用新方法替代重复代码
29个文件已修改
366 ■■■■■ 已修改文件
laboratory/src/layouts/components/HeaderNav.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/main.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/router/index.js 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/chemistQa/pilotAndProduction/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/chemistQa/productApproval/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/chemistQa/projectTesting/add.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/chemistQa/projectTesting/addDetectionReport.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/chemistQa/rawMaterials/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/approvalPlan/addPlan.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/dispatching/addDispatch.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/inspectionReport/detail.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/originalRecordTest/detail.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/sampleManage/addSample.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/sampleRecordList/changeRecord.vue 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/schemeManagement/addPlan.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/schemeManagement/stop-experiment.vue 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/dataManagement/testResultReport/detail.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/deliveryAssessment/chemistEvaluate/add.vue 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/deliveryAssessment/testerWorkerEvaluate/add.vue 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/projectList/addProject.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/projectList/editProject.vue 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/reportLibrary/feasibilityReport/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/reportLibrary/feasibilityStudy/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/reportLibrary/processDevelopment/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/reportLibrary/projectProposalLibrary/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/reportLibrary/verificationRelease/add.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/system/role/add.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/views/system/role/edit.vue 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
laboratory/src/layouts/components/HeaderNav.vue
@@ -106,7 +106,7 @@
    },
    // 关闭标签
    closeTag(tag) {
      if (tag.path && tag.path.includes('add')) {
      if (tag.meta && tag.meta.needCloseConfirm) {
        this.pendingCloseTag = tag;
        this.show = true;
        return;
@@ -360,4 +360,4 @@
    justify-content: end;
    gap: 10px;
}
</style>
</style>
laboratory/src/main.js
@@ -75,6 +75,24 @@
  return height
}
Vue.prototype.$closeCurrentTagAndGo = function (listPath) {
  const targetPath = listPath || this.$route.meta.listPath;
  if (!targetPath) {
    this.$router.back();
    this.$store.commit(
    "SET_TAGLIST",
    (this.$store.state.tagList || []).filter((item) => item.path !== currentPath)
  );
    return;
  }
  const currentPath = this.$route.path;
  this.$router.push(targetPath);
  this.$store.commit(
    "SET_TAGLIST",
    (this.$store.state.tagList || []).filter((item) => item.path !== currentPath)
  );
}
new Vue({
  router,
  store,
laboratory/src/router/index.js
@@ -79,6 +79,8 @@
                    title: "新增角色",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/system/role",
                },
                component: () => import("../views/system/role/add"),
            },
@@ -89,6 +91,8 @@
                    title: "编辑角色",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/system/role",
                },
                component: () => import("../views/system/role/edit"),
            },
@@ -134,6 +138,8 @@
                    title: "新增项目组",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/projectList/list",
                },
                component: () => import("../views/projectList/addProject"),
            },
@@ -144,6 +150,8 @@
                    title: "编辑项目组",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/projectList/list",
                },
                component: () => import("../views/projectList/editProject"),
            },
@@ -181,6 +189,8 @@
                    title: "新增项目课题方案",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/approvalPlan",
                },
                component: () => import("../views/dataManagement/approvalPlan/addPlan"),
            },
@@ -191,6 +201,8 @@
                    title: "编辑项目课题方案",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/approvalPlan",
                },
                component: () => import("../views/dataManagement/approvalPlan/addPlan"),
            },
@@ -209,6 +221,8 @@
                    title: "新增实验调度",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/dispatching",
                },
                component: () => import("../views/dataManagement/dispatching/addDispatch"),
            },
@@ -219,6 +233,8 @@
                    title: "编辑实验调度",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/dispatching",
                },
                component: () => import("../views/dataManagement/dispatching/addDispatch"),
            },
@@ -238,6 +254,8 @@
                    title: "检验方法确认单",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/confirmation-sheet",
                },
                component: () => import("../views/dataManagement/confirmation-sheet/components/add.vue"),
            },
@@ -257,6 +275,8 @@
                    title: "添加实验方案",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/scheme-management",
                },
                component: () => import("../views/dataManagement/schemeManagement/addPlan.vue"),
            },
@@ -267,6 +287,8 @@
                    title: "编辑实验方案",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/scheme-management",
                },
                component: () => import("../views/dataManagement/schemeManagement/addPlan.vue"),
            }, {
@@ -276,6 +298,8 @@
                    title: "终止实验方案",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/scheme-management",
                },
                component: () => import("../views/dataManagement/schemeManagement/stop-experiment.vue"),
            },
@@ -305,6 +329,8 @@
                            title: "新增样品",
                            hide: true,
                            keepAlive: true,
                            needCloseConfirm: true,
                            listPath: "/sampleManage/manage",
                        },
                        component: () => import("../views/dataManagement/sampleManage/addSample"),
                    },
@@ -315,6 +341,8 @@
                            title: "编辑样品",
                            hide: true,
                            keepAlive: true,
                            needCloseConfirm: true,
                            listPath: "/sampleManage/manage",
                        },
                        component: () => import("../views/dataManagement/sampleManage/addSample"),
                    },
@@ -344,6 +372,8 @@
                            title: "填写取样操作记录",
                            hide: true,
                            keepAlive: true,
                            needCloseConfirm: true,
                            listPath: "/sampleManage/record",
                        },
                        component: () => import("../views/dataManagement/sampleRecordList/changeRecord"),
                    }, {
@@ -404,6 +434,8 @@
                    title: "原始检验记录详情",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/originalRecordTest",
                },
                component: () => import("../views/dataManagement/originalRecordTest/detail.vue"),
            },
@@ -433,6 +465,8 @@
                    title: "新增检验报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/inspectionReport",
                },
                component: () => import("../views/dataManagement/inspectionReport/detail.vue"),
            },
@@ -462,6 +496,8 @@
                    title: "新增实验结果汇报",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/dataManagement/testResultReport",
                },
                component: () => import("../views/dataManagement/testResultReport/detail.vue"),
            },
@@ -499,6 +535,8 @@
                    title: "新增可研报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/feasibilityStudy",
                },
                component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"),
            },
@@ -509,6 +547,8 @@
                    title: "编辑可研报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/feasibilityStudy",
                },
                component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"),
            },
@@ -528,6 +568,8 @@
                    title: "新增可行报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/feasibilityReport",
                },
                component: () => import("../views/reportLibrary/feasibilityReport/add.vue"),
            },
@@ -538,6 +580,8 @@
                    title: "编辑可行报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/feasibilityReport",
                },
                component: () => import("../views/reportLibrary/feasibilityReport/add.vue"),
            },
@@ -560,6 +604,8 @@
                    title: "新增工艺开发工具",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/processDevelopment",
                },
                component: () => import("../views/reportLibrary/processDevelopment/add.vue"),
            },
@@ -570,6 +616,8 @@
                    title: "编辑工艺开发工具",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/processDevelopment",
                },
                component: () => import("../views/reportLibrary/processDevelopment/add.vue"),
            },
@@ -589,6 +637,8 @@
                    title: "新增验证与发布",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/verificationRelease",
                },
                component: () => import("../views/reportLibrary/verificationRelease/add.vue"),
            },
@@ -599,6 +649,8 @@
                    title: "编辑验证与发布",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/verificationRelease",
                },
                component: () => import("../views/reportLibrary/verificationRelease/add.vue"),
            },
@@ -618,6 +670,8 @@
                    title: "新增立项报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/projectProposalLibrary",
                },
                component: () => import("../views/reportLibrary/projectProposalLibrary/add.vue"),
            },
@@ -628,6 +682,8 @@
                    title: "编辑立项报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/reportLibrary/projectProposalLibrary",
                },
                component: () => import("../views/reportLibrary/projectProposalLibrary/add.vue"),
            },
@@ -656,6 +712,8 @@
                    title: "新增检测项",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/projectTesting",
                },
                component: () => import("../views/chemistQa/projectTesting/add.vue"),
            },
@@ -666,6 +724,8 @@
                    title: "编辑检测项",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/projectTesting",
                },
                component: () => import("../views/chemistQa/projectTesting/add.vue"),
            },
@@ -685,6 +745,8 @@
                    title: "新增报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/projectTesting",
                },
                component: () => import("../views/chemistQa/projectTesting/addDetectionReport.vue"),
            },
@@ -704,6 +766,8 @@
                    title: "新增实验、中试、生产验证试验检验分析报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/pilotAndProduction",
                },
                component: () => import("../views/chemistQa/pilotAndProduction/add.vue"),
            },
@@ -714,6 +778,8 @@
                    title: "编辑实验、中试、生产验证试验检验分析报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/pilotAndProduction",
                },
                component: () => import("../views/chemistQa/pilotAndProduction/add.vue"),
            },
@@ -733,6 +799,8 @@
                    title: "新增原辅料、包材、竞品检验分析报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/rawMaterials",
                },
                component: () => import("../views/chemistQa/rawMaterials/add.vue"),
            },
@@ -743,6 +811,8 @@
                    title: "编辑原辅料、包材、竞品检验分析报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/rawMaterials",
                },
                component: () => import("../views/chemistQa/rawMaterials/add.vue"),
            },
@@ -762,6 +832,8 @@
                    title: "新增产品报批及项目工作总计报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/productApproval",
                },
                component: () => import("../views/chemistQa/productApproval/add.vue"),
            },
@@ -772,6 +844,8 @@
                    title: "编辑产品报批及项目工作总计报告",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/chemistQa/productApproval",
                },
                component: () => import("../views/chemistQa/productApproval/add.vue"),
            },
@@ -903,6 +977,8 @@
                    title: "新增实验员工作评定",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/deliveryAssessment/testerWorkerEvaluate",
                },
                component: () => import("../views/deliveryAssessment/testerWorkerEvaluate/add"),
            },
@@ -914,6 +990,8 @@
                    title: "编辑实验员工作评定",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/deliveryAssessment/testerWorkerEvaluate",
                },
                component: () => import("../views/deliveryAssessment/testerWorkerEvaluate/add"),
            },
@@ -945,6 +1023,8 @@
                    title: "新增化验师工作评定",
                    hide: true,
                    keepAlive: true,
                    needCloseConfirm: true,
                    listPath: "/deliveryAssessment/chemistEvaluate",
                },
                component: () => import("../views/deliveryAssessment/chemistEvaluate/add"),
            },
@@ -981,6 +1061,18 @@
    base: process.env.BASE_URL,
    routes,
});
function cleanupClosedFormRoute(route) {
    const tagList = JSON.parse(sessionStorage.getItem('tagList') || '[]')
        .filter(item => item.path !== route.path)
    store.commit('SET_TAGLIST', tagList)
    if (route.name) {
        const keepAliveList = JSON.parse(sessionStorage.getItem('keepAliveList') || '[]')
            .filter(name => name !== route.name)
        store.commit('SET_KEEPALIVELIST', keepAliveList)
    }
}
// 前置路由拦截器
router.beforeEach((to, from, next) => {
@@ -1056,4 +1148,15 @@
    next()
});
router.afterEach((to, from) => {
    if (
        from.meta &&
        from.meta.needCloseConfirm &&
        from.meta.listPath &&
        to.path === from.meta.listPath
    ) {
        cleanupClosedFormRoute(from)
    }
})
export default router;
laboratory/src/views/chemistQa/pilotAndProduction/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <div class="add-container" :loading="loading">
    <Card v-loading="loading">
      <div class="header-title" style="width: 100%">
@@ -298,11 +298,7 @@
      });
    },
    back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
    save() {
      this.$refs.form.validate((valid) => {
@@ -473,4 +469,4 @@
    height: 36px;
  }
}
</style>
</style>
laboratory/src/views/chemistQa/productApproval/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <div class="add-container" :loading="loading">
    <Card v-loading="loading">
      <div class="header-title" style="width: 100%">
@@ -250,11 +250,7 @@
      });
    },
    back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
    save() {
      this.$refs.form.validate((valid) => {
@@ -422,4 +418,4 @@
    height: 36px;
  }
}
</style>
</style>
laboratory/src/views/chemistQa/projectTesting/add.vue
@@ -220,14 +220,6 @@
            this.$forceUpdate()
            this.showChoose = false
        },
        backToListAndCloseTag() {
            const currentPath = this.$route.path;
            this.$router.push('/chemistQa/projectTesting');
            this.$store.commit(
                "SET_TAGLIST",
                this.tagList.filter((item) => item.path !== currentPath)
            );
        },
        submit() {
            if (this.tableData.length === 0) {
                this.$message.error('请选择项目组')
@@ -244,7 +236,7 @@
                    request.then(res => {
                        if (res.code === 200) {
                            this.$message.success(this.isEdit ? '修改成功' : '提交成功')
                            this.backToListAndCloseTag()
                            this.$closeCurrentTagAndGo('/chemistQa/projectTesting')
                        } else {
                            this.$message.error(res.msg || (this.isEdit ? '修改失败' : '提交失败'))
                        }
@@ -271,7 +263,7 @@
                    request.then(res => {
                        if (res.code === 200) {
                            this.$message.success(this.isEdit ? '修改成功' : '保存成功')
                            this.backToListAndCloseTag()
                            this.$closeCurrentTagAndGo('/chemistQa/projectTesting')
                        } else {
                            this.$message.error(res.msg || (this.isEdit ? '修改失败' : '保存失败'))
                        }
laboratory/src/views/chemistQa/projectTesting/addDetectionReport.vue
@@ -1,4 +1,4 @@
<template>
<template>
    <div class="add-container" :loading="loading">
        <Card v-loading="loading">
            <div class="header-title" style="width: 100%;">
@@ -276,11 +276,7 @@
            })
        },
        back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
                 // 上传前校验
                 beforeUpload(file) {
@@ -403,4 +399,4 @@
        // background: #409EFF; 
    }
}
</style>
</style>
laboratory/src/views/chemistQa/rawMaterials/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <div class="add-container" :loading="loading">
    <Card v-loading="loading">
      <div class="header-title" style="width: 100%">
@@ -233,11 +233,7 @@
      this.showChoose = false;
    },
    back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
    submit() {
      if (this.tableData.length == 0) {
@@ -458,4 +454,4 @@
    // background: #409EFF;
  }
}
</style>
</style>
laboratory/src/views/dataManagement/approvalPlan/addPlan.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <Card>
    <template style="position: relative">
      <div class="header-title">
@@ -285,11 +285,7 @@
                    ? "更新成功"
                    : "保存成功";
                this.$message.success(successMsg);
                this.$router.back();
                this.$store.commit(
                  "SET_TAGLIST",
                  this.tagList.filter((item) => item.path !== this.$route.path)
                );
                this.$closeCurrentTagAndGo();
              } else {
                const errorMsg =
                  type === "draft"
@@ -506,4 +502,4 @@
  border-radius: 4px;
  background: #fff;
}
</style>
</style>
laboratory/src/views/dataManagement/confirmation-sheet/components/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <Card>
    <div class="header-title-left">
      <img src="@/assets/public/headercard.png" />
@@ -388,11 +388,7 @@
      }
    },
    back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
    async handleSaveDraft() {
      try {
@@ -624,4 +620,4 @@
    font-size: 15px;
  }
}
</style>
</style>
laboratory/src/views/dataManagement/dispatching/addDispatch.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <Card>
    <template style="position: relative">
      <el-form
@@ -714,11 +714,7 @@
                    ? "更新成功"
                    : "保存成功";
                this.$message.success(successMsg);
                this.$router.back();
                this.$store.commit(
                  "SET_TAGLIST",
                  this.tagList.filter((item) => item.path !== this.$route.path)
                );
                this.$closeCurrentTagAndGo();
              } else {
                const errorMsg =
                  type === "draft"
@@ -1221,4 +1217,4 @@
    margin-right: 20px;
  }
}
</style>
</style>
laboratory/src/views/dataManagement/inspectionReport/detail.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <Card>
    <el-form
      ref="form"
@@ -416,11 +416,7 @@
              ? "更新成功"
              : "保存成功";
          this.$message.success(successMsg);
this.$router.back();
          this.$store.commit(
            "SET_TAGLIST",
            this.tagList.filter((item) => item.path !== this.$route.path)
          );
this.$closeCurrentTagAndGo();
        } else {
          const errorMsg =
            type === "draft"
@@ -579,4 +575,4 @@
    margin-bottom: 0;
  }
}
</style>
</style>
laboratory/src/views/dataManagement/originalRecordTest/detail.vue
@@ -486,12 +486,7 @@
          } else {
            this.$message.success('填写完毕');
          }
          // 返回上一页
          this.$router.back();
          this.$store.commit(
                  "SET_TAGLIST",
                  this.tagList.filter((item) => item.path !== this.$route.path)
                );
          this.$closeCurrentTagAndGo();
        } else {
          this.$message.error(res.msg || '提交失败');
        }
laboratory/src/views/dataManagement/sampleManage/addSample.vue
@@ -500,12 +500,7 @@
      });
    },
    back() {
      const currentPath = this.$route.path;
      this.$router.push('/sampleManage/manage');
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== currentPath)
      );
      this.$closeCurrentTagAndGo('/sampleManage/manage');
    },
    // 添加存草稿方法
    async handleSaveDraft() {
laboratory/src/views/dataManagement/sampleRecordList/changeRecord.vue
@@ -250,11 +250,7 @@
        const res = await updateSampleDraft(params);
        if (res.code === 200) {
          this.$message.success('草稿保存成功');
          this.$router.back();
          this.$store.commit(
            "SET_TAGLIST",
            this.tagList.filter((item) => item.path !== this.$route.path)
          );
          this.$closeCurrentTagAndGo();
        } else {
          this.$message.error(res.msg || '草稿保存失败');
        }
@@ -269,11 +265,7 @@
        if (res.code === 200) {
          this.$message.success(successMessage);
          this.showConfirmDialog = false;
          this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
          this.$closeCurrentTagAndGo();
        } else {
          this.$message.error(res.msg || errorMessage);
        }
laboratory/src/views/dataManagement/schemeManagement/addPlan.vue
@@ -536,11 +536,7 @@
                this.$message.success(
                  status === 1 ? "保存成功" : "草稿保存成功"
                );
                this.$router.back();
                this.$store.commit(
                  "SET_TAGLIST",
                  this.tagList.filter((item) => item.path !== this.$route.path)
                );
                this.$closeCurrentTagAndGo();
              } else {
                this.$message.error(
                  res.msg || (status === 1 ? "保存失败" : "草稿保存失败")
laboratory/src/views/dataManagement/schemeManagement/stop-experiment.vue
@@ -249,11 +249,7 @@
          this.$message.success('提交成功')
          this.handleDialogClose()
          // 提交成功后返回列表页
          this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
          this.$closeCurrentTagAndGo();
        } catch (error) {
          this.$message.error('提交失败')
        } finally {
@@ -418,4 +414,4 @@
    margin: 0 10px;
  }
}
</style>
</style>
laboratory/src/views/dataManagement/testResultReport/detail.vue
@@ -1014,11 +1014,7 @@
        }
        this.$message.success(status == 1 ? "保存成功,请在列表页内点击提交" : "保存草稿成功");
        this.$router.back();
        this.$store.commit(
          "SET_TAGLIST",
          this.tagList.filter((item) => item.path !== this.$route.path)
        );
        this.$closeCurrentTagAndGo();
      } catch (error) {
        // this.$message.error("提交失败,请重试");
      }
laboratory/src/views/deliveryAssessment/chemistEvaluate/add.vue
@@ -268,7 +268,7 @@
        update({...evaluateData,id:this.editId}).then((res) => { 
          if (res.code == 200) {
          this.$message.success("编辑成功");
          this.$router.back();
          this.$closeCurrentTagAndGo();
        } else {
          this.$message.error(res.msg || "编辑失败");
        }
@@ -278,7 +278,7 @@
      add(evaluateData).then(res=>{
        if(res.code==200){
          this.$message.success("保存成功");
          this.$router.back();
          this.$closeCurrentTagAndGo();
        }else{
          this.$message.error(res.msg||"保存失败");
        }
@@ -412,4 +412,4 @@
    width: 220px;
  }
}
</style>
</style>
laboratory/src/views/deliveryAssessment/testerWorkerEvaluate/add.vue
@@ -274,12 +274,7 @@
      return scoreMap[score] || 0; // 默认返回失误
    },
    backToListAndCloseTag() {
      const currentPath = this.$route.path;
      this.$router.push("/deliveryAssessment/testerWorkerEvaluate");
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== currentPath)
      );
      this.$closeCurrentTagAndGo("/deliveryAssessment/testerWorkerEvaluate");
    },
    submitForm() {
      const evaluateTable = this.$refs.evaluateTable;
laboratory/src/views/projectList/addProject.vue
@@ -91,7 +91,7 @@
                    addProject(data).then(res => {
                        if (res.code == 200) {
                            this.$message.success('添加成功')
                            this.$router.push({ name: 'ProjectList' })
                            this.$closeCurrentTagAndGo()
                        }
                    })
                }
@@ -288,4 +288,4 @@
        width: 220px;
    }
}
</style>
</style>
laboratory/src/views/projectList/editProject.vue
@@ -110,7 +110,7 @@
                    editProject(data).then(res => {
                        if (res.code == 200) {
                            this.$message.success('修改成功')
                            this.$router.push({ name: 'ProjectList' })
                            this.$closeCurrentTagAndGo()
                        }
                    })
                }
@@ -303,4 +303,4 @@
        width: 220px;
    }
}
</style>
</style>
laboratory/src/views/reportLibrary/feasibilityReport/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <div class="add-container" :loading="loading">
    <Card v-loading="loading">
      <div class="header-title" style="width: 100%">
@@ -304,11 +304,7 @@
      });
    },
    back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
    save() {
      this.$refs.form.validate((valid) => {
@@ -423,4 +419,4 @@
    height: 36px;
  }
}
</style>
</style>
laboratory/src/views/reportLibrary/feasibilityStudy/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
    <div class="add-container" :loading="loading">
        <Card v-loading="loading">
            <div class="header-title" style="width: 100%;">
@@ -265,11 +265,7 @@
            })
        },
        back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
        save() {
            this.$refs.form.validate((valid) => {
@@ -387,4 +383,4 @@
        // background: #409EFF; 
    }
}
</style>
</style>
laboratory/src/views/reportLibrary/processDevelopment/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
    <div class="add-container" :loading="loading">
        <Card v-loading="loading">
            <div class="header-title" style="width: 100%;">
@@ -262,11 +262,7 @@
            })
        },
        back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
        save() {
            this.$refs.form.validate((valid) => {
@@ -384,4 +380,4 @@
        // background: #409EFF; 
    }
}
</style>
</style>
laboratory/src/views/reportLibrary/projectProposalLibrary/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
    <div class="add-container" :loading="loading">
        <Card v-loading="loading">
            <div class="header-title" style="width: 100%;">
@@ -262,11 +262,7 @@
            })
        },
        back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
        save() {
            this.$refs.form.validate((valid) => {
@@ -383,4 +379,4 @@
        // background: #409EFF; 
    }
}
</style>
</style>
laboratory/src/views/reportLibrary/verificationRelease/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
    <div class="add-container" :loading="loading">
        <Card v-loading="loading">
            <div class="header-title" style="width: 100%;">
@@ -264,11 +264,7 @@
            })
        },
        back() {
      this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
      this.$closeCurrentTagAndGo();
    },
        save() {
            this.$refs.form.validate((valid) => {
@@ -386,4 +382,4 @@
        // background: #409EFF; 
    }
}
</style>
</style>
laboratory/src/views/system/role/add.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <Card>
    <div class="header-title-left">
      <img src="@/assets/public/headercard.png" />
@@ -160,11 +160,7 @@
            obj.roleId = this.$route.query.roleId
            edit(obj).then(() => {
              this.msgsuccess('保存成功')
              this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
              this.$closeCurrentTagAndGo();
            })
          } else {
            add(obj).then(() => {
@@ -174,11 +170,7 @@
                remark: "",
              }
              this.menu = []
              this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
              this.$closeCurrentTagAndGo();
            })
          }
        }
@@ -410,4 +402,4 @@
    font-family: 'Source Han Sans CN Bold Bold';
  }
}
</style>
</style>
laboratory/src/views/system/role/edit.vue
@@ -1,4 +1,4 @@
<template>
<template>
  <Card>
    <div class="header-title-left">
      <img src="@/assets/public/headercard.png" />
@@ -171,20 +171,12 @@
            obj.roleId = this.$route.query.roleId
            edit(obj).then(() => {
              this.msgsuccess('保存成功')
              this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
              this.$closeCurrentTagAndGo();
            })
          } else {
            add(obj).then(() => {
              this.msgsuccess('保存成功')
              this.$router.back();
      this.$store.commit(
        "SET_TAGLIST",
        this.tagList.filter((item) => item.path !== this.$route.path)
      );
              this.$closeCurrentTagAndGo();
            })
          }
        }
@@ -416,4 +408,4 @@
    font-family: 'Source Han Sans CN Bold Bold';
  }
}
</style>
</style>