Browse Source

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

zcuishan 1 week ago
parent
commit
caa332b515

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

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

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

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

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

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