Commit ff067f71d713d5f0de474241dd050c6d5e3ea3c3

Authored by loveumiko
1 parent e31c2323

fix: 产品物模型导入添加注释和模板

@@ -24,6 +24,7 @@ enum ModelOfMatter { @@ -24,6 +24,7 @@ enum ModelOfMatter {
24 CATEGORY_EXPORT = '/things_model/categoryGetExport', 24 CATEGORY_EXPORT = '/things_model/categoryGetExport',
25 25
26 IMPORT_CSV = '/things_model/csvImport', 26 IMPORT_CSV = '/things_model/csvImport',
  27 + EXCEL_EXPORT = '/things_model/downloadTemplate',
27 } 28 }
28 29
29 export const getModelList = ( 30 export const getModelList = (
@@ -169,3 +170,12 @@ export const importCsvDeviceProfileId = (params: { @@ -169,3 +170,12 @@ export const importCsvDeviceProfileId = (params: {
169 params: params.file, 170 params: params.file,
170 }); 171 });
171 }; 172 };
  173 +
  174 +/**
  175 + * 物模型excel导出模板
  176 + */
  177 +export const excelExport = () => {
  178 + return defHttp.get({
  179 + url: `${ModelOfMatter.EXCEL_EXPORT}`,
  180 + });
  181 +};
@@ -10,9 +10,9 @@ @@ -10,9 +10,9 @@
10 :showOkBtn="false" 10 :showOkBtn="false"
11 > 11 >
12 <div class="w-full h-full" ref="loadingRef"> 12 <div class="w-full h-full" ref="loadingRef">
13 - <!-- <div class="flex justify-end"> 13 + <div class="flex justify-end">
14 <Button @click="handleTemplateDownload" type="link">EXCEL模板下载</Button> 14 <Button @click="handleTemplateDownload" type="link">EXCEL模板下载</Button>
15 - </div> --> 15 + </div>
16 <div class="flex justify-evenly items-center h-50 !w-full"> 16 <div class="flex justify-evenly items-center h-50 !w-full">
17 <Upload 17 <Upload
18 accept=".json," 18 accept=".json,"
@@ -56,6 +56,7 @@ @@ -56,6 +56,7 @@
56 importModelCategory, 56 importModelCategory,
57 importModelOfMatter, 57 importModelOfMatter,
58 importCsvDeviceProfileId, 58 importCsvDeviceProfileId,
  59 + excelExport,
59 } from '/@/api/device/modelOfMatter'; 60 } from '/@/api/device/modelOfMatter';
60 // import XLSX, { CellObject } from 'xlsx'; 61 // import XLSX, { CellObject } from 'xlsx';
61 import { useLoading } from '/@/components/Loading'; 62 import { useLoading } from '/@/components/Loading';
@@ -191,9 +192,11 @@ @@ -191,9 +192,11 @@
191 // }; 192 // };
192 193
193 // 模板下载 194 // 模板下载
194 - // const handleTemplateDownload = () => {  
195 -  
196 - // }; 195 + const handleTemplateDownload = () => {
  196 + const res = excelExport();
  197 + // eslint-disable-next-line no-console
  198 + console.log(res, 'res');
  199 + };
197 200
198 const handleCancel = () => { 201 const handleCancel = () => {
199 closeModal(); 202 closeModal();