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, + } + }); + } + }, } };