|
@@ -199,6 +199,7 @@
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref } from 'vue'
|
|
|
+import axios from 'axios';
|
|
|
import { dateFormatter } from '@/utils/formatTime'
|
|
|
import download from '@/utils/download'
|
|
|
import { supervisorSelectionSettingApi, supervisorSelectionSettingVO } from '@/api/system/supervisorSelectionSetting'
|
|
@@ -287,7 +288,7 @@ const onRowSelectChange = (selected) => {
|
|
|
selectedRows.value = selected; // 直接将选中的行数组赋值给 selectedRows
|
|
|
// console.log('选中的行:', selectedRows.value);
|
|
|
}
|
|
|
-// 处理选择变化的事件
|
|
|
+
|
|
|
watch(selectedRows, (newSelection) => {
|
|
|
console.log('选中的行数据:', newSelection);
|
|
|
});
|
|
@@ -306,10 +307,18 @@ const ibj = ref({
|
|
|
}
|
|
|
]
|
|
|
});
|
|
|
-const tempDocxPath = ref('/templates/template.docx');
|
|
|
-const exportWordTemplate = () => {
|
|
|
- const fileName = '导出文档.docx'; // 导出文件的名称
|
|
|
- exportDocx(tempDocxPath.value, ibj.value, fileName);
|
|
|
+const exportWordTemplate = async () => {
|
|
|
+ const fileName = '导出文档.docx';
|
|
|
+ try {
|
|
|
+ const response = await axios.get('/templates/templete.docx', {
|
|
|
+ responseType: 'blob' // 确保以 blob 形式获取文件
|
|
|
+ });
|
|
|
+
|
|
|
+ // 使用你之前的 exportDocx 方法处理文件
|
|
|
+ exportDocx(URL.createObjectURL(response.data), ibj.value, fileName);
|
|
|
+ } catch (error) {
|
|
|
+ console.error('导出文档失败:', error);
|
|
|
+ }
|
|
|
};
|
|
|
// const exportWordTemplate = async () => {
|
|
|
// if (selectedRows.value.length === 0) {
|