From ba00da66be8f9010402974aab55b6f4dff3202d4 Mon Sep 17 00:00:00 2001 From: yedejiamingshi <540057894@qq.com> Date: Wed, 19 Feb 2025 11:46:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=90=8C=E6=AD=A5=2002.19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configure/inspectionTemplate/index.vue | 59 +++++++++++-------- 1 file changed, 34 insertions(+), 25 deletions(-) diff --git a/src/views/configure/inspectionTemplate/index.vue b/src/views/configure/inspectionTemplate/index.vue index 76a2596..b8d5698 100644 --- a/src/views/configure/inspectionTemplate/index.vue +++ b/src/views/configure/inspectionTemplate/index.vue @@ -63,7 +63,7 @@ - + @@ -71,33 +71,34 @@
+ v-for="(item,index) in tempList" + :key="index" + :label="item.templateName" + :value="item.id" + /> - 导入模板 + 导入模板
{}); }, - /** 导出按钮操作 */ - handleExport() { - // 处理查询参数 - let params = {...this.queryParams}; - params.pageNo = undefined; - params.pageSize = undefined; - this.$modal.confirm('是否确认导出所有检测报告模板数据项?').then(() => { - this.exportLoading = true; - return exportInspectionTemplateExcel(params); - }).then(response => { - this.$download.excel(response, '检测报告模板.xls'); - this.exportLoading = false; - }).catch(() => {}); - }, changeBusiness(e){ this.$nextTick(async () => { let label = this.$refs.businessName.selected.label; this.form.belongBusinessName = label; - let res = await getByBusinessId({businessId:e}); - if(res.data) this.tempList = res.data; + this.getTemplateList(e); + }); + }, + getTemplateList(businessId) { + getByBusinessId({ businessId }).then(({ data }) => { + this.tempList = data; }); }, + importTemplate() { + if (this.tempId === undefined) { + this.$message.error("请先选择模板"); + return; + } + const template = this.tempList.find(item => item.id == this.tempId); + if (template) { + this.form.inspectionItems = template.inspectionItems.map(item => { + return { + ...item, + id: undefined, + } + }); + } + }, } };