Commit ff067f71d713d5f0de474241dd050c6d5e3ea3c3

Authored by loveumiko
1 parent e31c2323

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

... ... @@ -24,6 +24,7 @@ enum ModelOfMatter {
24 24 CATEGORY_EXPORT = '/things_model/categoryGetExport',
25 25
26 26 IMPORT_CSV = '/things_model/csvImport',
  27 + EXCEL_EXPORT = '/things_model/downloadTemplate',
27 28 }
28 29
29 30 export const getModelList = (
... ... @@ -169,3 +170,12 @@ export const importCsvDeviceProfileId = (params: {
169 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 10 :showOkBtn="false"
11 11 >
12 12 <div class="w-full h-full" ref="loadingRef">
13   - <!-- <div class="flex justify-end">
  13 + <div class="flex justify-end">
14 14 <Button @click="handleTemplateDownload" type="link">EXCEL模板下载</Button>
15   - </div> -->
  15 + </div>
16 16 <div class="flex justify-evenly items-center h-50 !w-full">
17 17 <Upload
18 18 accept=".json,"
... ... @@ -56,6 +56,7 @@
56 56 importModelCategory,
57 57 importModelOfMatter,
58 58 importCsvDeviceProfileId,
  59 + excelExport,
59 60 } from '/@/api/device/modelOfMatter';
60 61 // import XLSX, { CellObject } from 'xlsx';
61 62 import { useLoading } from '/@/components/Loading';
... ... @@ -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 201 const handleCancel = () => {
199 202 closeModal();
... ...