feat(router): 重构表单关闭逻辑并添加全局方法
- 在 Vue 原型上添加 $closeCurrentTagAndGo 方法,统一处理关闭当前标签页并跳转的逻辑
- 修改 HeaderNav 组件,使用 meta.needCloseConfirm 替代路径包含 'add' 的判断条件
- 在路由配置中为所有表单页面添加 needCloseConfirm 和 listPath 元数据
- 在路由后置钩子中自动清理已关闭表单页面的标签和 keep-alive 缓存
- 更新多个表单页面的返回逻辑,调用新方法替代重复代码
| | |
| | | }, |
| | | // 关闭标签 |
| | | closeTag(tag) { |
| | | if (tag.path && tag.path.includes('add')) { |
| | | if (tag.meta && tag.meta.needCloseConfirm) { |
| | | this.pendingCloseTag = tag; |
| | | this.show = true; |
| | | return; |
| | |
| | | justify-content: end; |
| | | gap: 10px; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | 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, |
| | |
| | | title: "新增角色", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/system/role", |
| | | }, |
| | | component: () => import("../views/system/role/add"), |
| | | }, |
| | |
| | | title: "编辑角色", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/system/role", |
| | | }, |
| | | component: () => import("../views/system/role/edit"), |
| | | }, |
| | |
| | | title: "新增项目组", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/projectList/list", |
| | | }, |
| | | component: () => import("../views/projectList/addProject"), |
| | | }, |
| | |
| | | title: "编辑项目组", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/projectList/list", |
| | | }, |
| | | component: () => import("../views/projectList/editProject"), |
| | | }, |
| | |
| | | title: "新增项目课题方案", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/approvalPlan", |
| | | }, |
| | | component: () => import("../views/dataManagement/approvalPlan/addPlan"), |
| | | }, |
| | |
| | | title: "编辑项目课题方案", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/approvalPlan", |
| | | }, |
| | | component: () => import("../views/dataManagement/approvalPlan/addPlan"), |
| | | }, |
| | |
| | | title: "新增实验调度", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/dispatching", |
| | | }, |
| | | component: () => import("../views/dataManagement/dispatching/addDispatch"), |
| | | }, |
| | |
| | | title: "编辑实验调度", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/dispatching", |
| | | }, |
| | | component: () => import("../views/dataManagement/dispatching/addDispatch"), |
| | | }, |
| | |
| | | title: "检验方法确认单", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/confirmation-sheet", |
| | | }, |
| | | component: () => import("../views/dataManagement/confirmation-sheet/components/add.vue"), |
| | | }, |
| | |
| | | title: "添加实验方案", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/scheme-management", |
| | | }, |
| | | component: () => import("../views/dataManagement/schemeManagement/addPlan.vue"), |
| | | }, |
| | |
| | | title: "编辑实验方案", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/scheme-management", |
| | | }, |
| | | component: () => import("../views/dataManagement/schemeManagement/addPlan.vue"), |
| | | }, { |
| | |
| | | title: "终止实验方案", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/scheme-management", |
| | | }, |
| | | component: () => import("../views/dataManagement/schemeManagement/stop-experiment.vue"), |
| | | }, |
| | |
| | | title: "新增样品", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/sampleManage/manage", |
| | | }, |
| | | component: () => import("../views/dataManagement/sampleManage/addSample"), |
| | | }, |
| | |
| | | title: "编辑样品", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/sampleManage/manage", |
| | | }, |
| | | component: () => import("../views/dataManagement/sampleManage/addSample"), |
| | | }, |
| | |
| | | title: "填写取样操作记录", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/sampleManage/record", |
| | | }, |
| | | component: () => import("../views/dataManagement/sampleRecordList/changeRecord"), |
| | | }, { |
| | |
| | | title: "原始检验记录详情", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/originalRecordTest", |
| | | }, |
| | | component: () => import("../views/dataManagement/originalRecordTest/detail.vue"), |
| | | }, |
| | |
| | | title: "新增检验报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/inspectionReport", |
| | | }, |
| | | component: () => import("../views/dataManagement/inspectionReport/detail.vue"), |
| | | }, |
| | |
| | | title: "新增实验结果汇报", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/dataManagement/testResultReport", |
| | | }, |
| | | component: () => import("../views/dataManagement/testResultReport/detail.vue"), |
| | | }, |
| | |
| | | title: "新增可研报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/feasibilityStudy", |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"), |
| | | }, |
| | |
| | | title: "编辑可研报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/feasibilityStudy", |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityStudy/add.vue"), |
| | | }, |
| | |
| | | title: "新增可行报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/feasibilityReport", |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityReport/add.vue"), |
| | | }, |
| | |
| | | title: "编辑可行报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/feasibilityReport", |
| | | }, |
| | | component: () => import("../views/reportLibrary/feasibilityReport/add.vue"), |
| | | }, |
| | |
| | | title: "新增工艺开发工具", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/processDevelopment", |
| | | }, |
| | | component: () => import("../views/reportLibrary/processDevelopment/add.vue"), |
| | | }, |
| | |
| | | title: "编辑工艺开发工具", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/processDevelopment", |
| | | }, |
| | | component: () => import("../views/reportLibrary/processDevelopment/add.vue"), |
| | | }, |
| | |
| | | title: "新增验证与发布", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/verificationRelease", |
| | | }, |
| | | component: () => import("../views/reportLibrary/verificationRelease/add.vue"), |
| | | }, |
| | |
| | | title: "编辑验证与发布", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/verificationRelease", |
| | | }, |
| | | component: () => import("../views/reportLibrary/verificationRelease/add.vue"), |
| | | }, |
| | |
| | | title: "新增立项报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/projectProposalLibrary", |
| | | }, |
| | | component: () => import("../views/reportLibrary/projectProposalLibrary/add.vue"), |
| | | }, |
| | |
| | | title: "编辑立项报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/reportLibrary/projectProposalLibrary", |
| | | }, |
| | | component: () => import("../views/reportLibrary/projectProposalLibrary/add.vue"), |
| | | }, |
| | |
| | | title: "新增检测项", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/projectTesting", |
| | | }, |
| | | component: () => import("../views/chemistQa/projectTesting/add.vue"), |
| | | }, |
| | |
| | | title: "编辑检测项", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/projectTesting", |
| | | }, |
| | | component: () => import("../views/chemistQa/projectTesting/add.vue"), |
| | | }, |
| | |
| | | title: "新增报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/projectTesting", |
| | | }, |
| | | component: () => import("../views/chemistQa/projectTesting/addDetectionReport.vue"), |
| | | }, |
| | |
| | | title: "新增实验、中试、生产验证试验检验分析报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/pilotAndProduction", |
| | | }, |
| | | component: () => import("../views/chemistQa/pilotAndProduction/add.vue"), |
| | | }, |
| | |
| | | title: "编辑实验、中试、生产验证试验检验分析报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/pilotAndProduction", |
| | | }, |
| | | component: () => import("../views/chemistQa/pilotAndProduction/add.vue"), |
| | | }, |
| | |
| | | title: "新增原辅料、包材、竞品检验分析报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/rawMaterials", |
| | | }, |
| | | component: () => import("../views/chemistQa/rawMaterials/add.vue"), |
| | | }, |
| | |
| | | title: "编辑原辅料、包材、竞品检验分析报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/rawMaterials", |
| | | }, |
| | | component: () => import("../views/chemistQa/rawMaterials/add.vue"), |
| | | }, |
| | |
| | | title: "新增产品报批及项目工作总计报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/productApproval", |
| | | }, |
| | | component: () => import("../views/chemistQa/productApproval/add.vue"), |
| | | }, |
| | |
| | | title: "编辑产品报批及项目工作总计报告", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/chemistQa/productApproval", |
| | | }, |
| | | component: () => import("../views/chemistQa/productApproval/add.vue"), |
| | | }, |
| | |
| | | title: "新增实验员工作评定", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/deliveryAssessment/testerWorkerEvaluate", |
| | | }, |
| | | component: () => import("../views/deliveryAssessment/testerWorkerEvaluate/add"), |
| | | }, |
| | |
| | | title: "编辑实验员工作评定", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/deliveryAssessment/testerWorkerEvaluate", |
| | | }, |
| | | component: () => import("../views/deliveryAssessment/testerWorkerEvaluate/add"), |
| | | }, |
| | |
| | | title: "新增化验师工作评定", |
| | | hide: true, |
| | | keepAlive: true, |
| | | needCloseConfirm: true, |
| | | listPath: "/deliveryAssessment/chemistEvaluate", |
| | | }, |
| | | component: () => import("../views/deliveryAssessment/chemistEvaluate/add"), |
| | | }, |
| | |
| | | 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) => { |
| | |
| | | next() |
| | | }); |
| | | |
| | | router.afterEach((to, from) => { |
| | | if ( |
| | | from.meta && |
| | | from.meta.needCloseConfirm && |
| | | from.meta.listPath && |
| | | to.path === from.meta.listPath |
| | | ) { |
| | | cleanupClosedFormRoute(from) |
| | | } |
| | | }) |
| | | |
| | | export default router; |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%"> |
| | |
| | | }); |
| | | }, |
| | | 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) => { |
| | |
| | | height: 36px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%"> |
| | |
| | | }); |
| | | }, |
| | | 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) => { |
| | |
| | | height: 36px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | 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('请选择项目组') |
| | |
| | | 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 ? '修改失败' : '提交失败')) |
| | | } |
| | |
| | | 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 ? '修改失败' : '保存失败')) |
| | | } |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%;"> |
| | |
| | | }) |
| | | }, |
| | | back() { |
| | | this.$router.back(); |
| | | this.$store.commit( |
| | | "SET_TAGLIST", |
| | | this.tagList.filter((item) => item.path !== this.$route.path) |
| | | ); |
| | | this.$closeCurrentTagAndGo(); |
| | | }, |
| | | // 上传前校验 |
| | | beforeUpload(file) { |
| | |
| | | // background: #409EFF; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%"> |
| | |
| | | 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) { |
| | |
| | | // background: #409EFF; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <Card> |
| | | <template style="position: relative"> |
| | | <div class="header-title"> |
| | |
| | | ? "更新成功" |
| | | : "保存成功"; |
| | | 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" |
| | |
| | | border-radius: 4px; |
| | | background: #fff; |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <Card> |
| | | <div class="header-title-left"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | |
| | | } |
| | | }, |
| | | back() { |
| | | this.$router.back(); |
| | | this.$store.commit( |
| | | "SET_TAGLIST", |
| | | this.tagList.filter((item) => item.path !== this.$route.path) |
| | | ); |
| | | this.$closeCurrentTagAndGo(); |
| | | }, |
| | | async handleSaveDraft() { |
| | | try { |
| | |
| | | font-size: 15px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <Card> |
| | | <template style="position: relative"> |
| | | <el-form |
| | |
| | | ? "更新成功" |
| | | : "保存成功"; |
| | | 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" |
| | |
| | | margin-right: 20px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <Card> |
| | | <el-form |
| | | ref="form" |
| | |
| | | ? "更新成功" |
| | | : "保存成功"; |
| | | 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" |
| | |
| | | margin-bottom: 0; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | } 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 || '提交失败'); |
| | | } |
| | |
| | | }); |
| | | }, |
| | | 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() { |
| | |
| | | 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 || '草稿保存失败'); |
| | | } |
| | |
| | | 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); |
| | | } |
| | |
| | | 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 ? "保存失败" : "草稿保存失败") |
| | |
| | | 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 { |
| | |
| | | margin: 0 10px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | } |
| | | |
| | | 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("提交失败,请重试"); |
| | | } |
| | |
| | | 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 || "编辑失败"); |
| | | } |
| | |
| | | add(evaluateData).then(res=>{ |
| | | if(res.code==200){ |
| | | this.$message.success("保存成功"); |
| | | this.$router.back(); |
| | | this.$closeCurrentTagAndGo(); |
| | | }else{ |
| | | this.$message.error(res.msg||"保存失败"); |
| | | } |
| | |
| | | width: 220px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | 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; |
| | |
| | | addProject(data).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('添加成功') |
| | | this.$router.push({ name: 'ProjectList' }) |
| | | this.$closeCurrentTagAndGo() |
| | | } |
| | | }) |
| | | } |
| | |
| | | width: 220px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | editProject(data).then(res => { |
| | | if (res.code == 200) { |
| | | this.$message.success('修改成功') |
| | | this.$router.push({ name: 'ProjectList' }) |
| | | this.$closeCurrentTagAndGo() |
| | | } |
| | | }) |
| | | } |
| | |
| | | width: 220px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%"> |
| | |
| | | }); |
| | | }, |
| | | 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) => { |
| | |
| | | height: 36px; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%;"> |
| | |
| | | }) |
| | | }, |
| | | 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) => { |
| | |
| | | // background: #409EFF; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%;"> |
| | |
| | | }) |
| | | }, |
| | | 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) => { |
| | |
| | | // background: #409EFF; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%;"> |
| | |
| | | }) |
| | | }, |
| | | 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) => { |
| | |
| | | // background: #409EFF; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <div class="add-container" :loading="loading"> |
| | | <Card v-loading="loading"> |
| | | <div class="header-title" style="width: 100%;"> |
| | |
| | | }) |
| | | }, |
| | | 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) => { |
| | |
| | | // background: #409EFF; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <Card> |
| | | <div class="header-title-left"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | |
| | | 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(() => { |
| | |
| | | remark: "", |
| | | } |
| | | this.menu = [] |
| | | this.$router.back(); |
| | | this.$store.commit( |
| | | "SET_TAGLIST", |
| | | this.tagList.filter((item) => item.path !== this.$route.path) |
| | | ); |
| | | this.$closeCurrentTagAndGo(); |
| | | }) |
| | | } |
| | | } |
| | |
| | | font-family: 'Source Han Sans CN Bold Bold'; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |
| | |
| | | <template> |
| | | <template> |
| | | <Card> |
| | | <div class="header-title-left"> |
| | | <img src="@/assets/public/headercard.png" /> |
| | |
| | | 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(); |
| | | }) |
| | | } |
| | | } |
| | |
| | | font-family: 'Source Han Sans CN Bold Bold'; |
| | | } |
| | | } |
| | | </style> |
| | | </style> |