浏览代码

fix:修改模板导入时模板名称不对

zcuishan 1 周之前
父节点
当前提交
caa332b515

+ 1 - 1
src/components/CreateCodeStep/src/ViewDesignStep.vue

@@ -1153,7 +1153,7 @@
         key: component.key, //数据优先存在编辑时 绑定字段相同的情况 所以需要唯一标识
         columnName: component.value,
         label: component.label,
-        width: 100,
+        width: 0,
         alignType: '',
         autoWidth: true,
         isNumber: component.isNumber,

+ 4 - 2
src/components/Import/src/ImportModal.vue

@@ -28,6 +28,7 @@
   import { useMessage } from '/@/hooks/web/useMessage';
   import { downloadFile } from '/@/api/sys/download';
   import { downloadByData } from '/@/utils/file/download';
+  import { formatToDateTime } from '/@/utils/dateUtil';
 
   const props = defineProps({
     importUrl: String,
@@ -45,11 +46,12 @@
   let templateTitle;
 
   const [registerModal, { setModalProps }] = useModalInner(async (data) => {
+    console.log(data);
     title.value = data.title;
     downLoadUrl = data.downLoadUrl;
     importType.value = data.type;
     templateApi = data.api;
-    templateTitle = data.templateTitle;
+    templateTitle = data.templateTitle || data.templateName;
     fileList.value = [];
     setModalProps({
       destroyOnClose: true,
@@ -100,7 +102,7 @@
     }
     downloadByData(
       res.data,
-      `${templateTitle || '模板'}.xlsx`,
+      `${templateTitle || '模板'}${formatToDateTime(new Date(), 'YYYY-MM-DD')}.xlsx`,
       'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
     );
   };

+ 3 - 0
src/views/form/template/index.vue

@@ -193,6 +193,7 @@
   const { path } = unref(currentRoute);
   const printMenuId = computed(() => currentRoute.value.meta.menuId as string);
   const { filterColumnAuth, filterButtonAuth } = usePermission();
+  const templateName = ref('');
   const expandedKeys: Ref<UnwrapRef<any[]>> = ref([]);
   let columns: BasicColumn[] = [], //列表配置
     searchFormSchema: FormSchema[] = [], //搜索框配置
@@ -675,6 +676,7 @@
       title: t('快速导入'),
       downLoadUrl: redirectUrl || '/form/execute/export',
       type: 'POST',
+      templateName: templateName.value,
     });
   }
 
@@ -750,6 +752,7 @@
     useTitle(` ${configJson.menuConfig.name} - ${title} `);
     //设置是否需要左侧菜单
     listConfig.value = configJson.listConfig!;
+    templateName.value = listConfig.value.importTemplateName;
     listTitle.value = listConfig.value.listTitle || configJson.menuConfig.name;
     const { queryConfigs, columnConfigs } = configJson.listConfig!;
     //如果设置了左侧菜单  需要请求菜单数据