数据库字段id更改为code
This commit is contained in:
parent
87daede414
commit
03ad85478f
|
@ -1,24 +1,24 @@
|
||||||
import {BasicColumn} from '/@/components/Table';
|
import { BasicColumn } from '/@/components/Table';
|
||||||
import {FormSchema} from '/@/components/Table';
|
import { FormSchema } from '/@/components/Table';
|
||||||
import { rules} from '/@/utils/helper/validator';
|
import { rules } from '/@/utils/helper/validator';
|
||||||
import { render } from '/@/utils/common/renderUtils';
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
//列表数据
|
//列表数据
|
||||||
export const columns: BasicColumn[] = [
|
export const columns: BasicColumn[] = [
|
||||||
{
|
{
|
||||||
title: '考场名称',
|
title: '考场名称',
|
||||||
align:"center",
|
align: 'center',
|
||||||
dataIndex: 'locationName'
|
dataIndex: 'locationName',
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: '父节点id',
|
// title: '父节点id',
|
||||||
// align:"center",
|
// align:"center",
|
||||||
// dataIndex: 'parentLocationId'
|
// dataIndex: 'parentLocationId'
|
||||||
// },
|
// },
|
||||||
{
|
{
|
||||||
title: '考场人数',
|
title: '考场人数',
|
||||||
align:"center",
|
align: 'center',
|
||||||
dataIndex: 'personNumber'
|
dataIndex: 'personNumber',
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// title: '排序号',
|
// title: '排序号',
|
||||||
// align:"center",
|
// align:"center",
|
||||||
|
@ -47,37 +47,36 @@ export const formSchema: FormSchema[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '考场人数',
|
label: '考场人数',
|
||||||
field: 'personNumber',
|
field: 'personNumber',
|
||||||
component: 'Input',
|
component: 'Input',
|
||||||
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '排序号',
|
label: '排序号',
|
||||||
field: 'sortNumber',
|
field: 'sortNumber',
|
||||||
component: 'InputNumber',
|
component: 'InputNumber',
|
||||||
show: false
|
show: false,
|
||||||
|
},
|
||||||
|
// TODO 主键隐藏字段,目前写死为ID
|
||||||
|
{
|
||||||
|
label: '',
|
||||||
|
field: 'id',
|
||||||
|
component: 'Input',
|
||||||
|
show: false,
|
||||||
},
|
},
|
||||||
// TODO 主键隐藏字段,目前写死为ID
|
|
||||||
{
|
|
||||||
label: '',
|
|
||||||
field: 'id',
|
|
||||||
component: 'Input',
|
|
||||||
show: false
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
// 高级查询数据
|
// 高级查询数据
|
||||||
export const superQuerySchema = {
|
export const superQuerySchema = {
|
||||||
locationName: {title: '存放地名称',order: 0,view: 'text', type: 'string',},
|
locationName: { title: '存放地名称', order: 0, view: 'text', type: 'string' },
|
||||||
parentLocationId: {title: '父节点id',order: 1,view: 'text', type: 'string',},
|
parentLocationId: { title: '父节点id', order: 1, view: 'text', type: 'string' },
|
||||||
sortNumber: {title: '排序号',order: 2,view: 'number', type: 'number',},
|
sortNumber: { title: '排序号', order: 2, view: 'number', type: 'number' },
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 流程表单调用这个方法获取formSchema
|
* 流程表单调用这个方法获取formSchema
|
||||||
* @param param
|
* @param param
|
||||||
*/
|
*/
|
||||||
export function getBpmFormSchema(_formData): FormSchema[]{
|
export function getBpmFormSchema(_formData): FormSchema[] {
|
||||||
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
// 默认和原始表单保持一致 如果流程中配置了权限数据,这里需要单独处理formSchema
|
||||||
return formSchema;
|
return formSchema;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@
|
||||||
//将其切分为字符串
|
//将其切分为字符串
|
||||||
selectedRowKeys = selectedRowKeys.join(',');
|
selectedRowKeys = selectedRowKeys.join(',');
|
||||||
console.log(selectedRowKeys);
|
console.log(selectedRowKeys);
|
||||||
queryParam.id = selectedRowKeys;
|
queryParam.code = selectedRowKeys;
|
||||||
reload();
|
reload();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -154,13 +154,13 @@
|
||||||
* 删除事件
|
* 删除事件
|
||||||
*/
|
*/
|
||||||
async function handleDelete(record) {
|
async function handleDelete(record) {
|
||||||
await deleteOne({ id: record.id }, handleSuccess);
|
await deleteOne({ code: record.code }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 批量删除事件
|
* 批量删除事件
|
||||||
*/
|
*/
|
||||||
async function batchHandleDelete() {
|
async function batchHandleDelete() {
|
||||||
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
await batchDelete({ codes: selectedRowKeys.value }, handleSuccess);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 成功回调
|
* 成功回调
|
||||||
|
|
|
@ -1,70 +1,70 @@
|
||||||
<template>
|
<template>
|
||||||
<div style="min-height: 400px">
|
<div style="min-height: 400px">
|
||||||
<BasicForm @register="registerForm"></BasicForm>
|
<BasicForm @register="registerForm" />
|
||||||
<div style="width: 100%;text-align: center" v-if="!formDisabled">
|
<div style="width: 100%; text-align: center" v-if="!formDisabled">
|
||||||
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
<a-button @click="submitForm" pre-icon="ant-design:check" type="primary">提 交</a-button>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {BasicForm, useForm} from '/@/components/Form/index';
|
import { BasicForm, useForm } from '/@/components/Form/index';
|
||||||
import {computed, defineComponent} from 'vue';
|
import { computed, defineComponent } from 'vue';
|
||||||
import {defHttp} from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
import {getBpmFormSchema} from '../CetLocation.data';
|
import { getBpmFormSchema } from '../CetLocation.data';
|
||||||
import {saveOrUpdate} from '../CetLocation.api';
|
import { saveOrUpdate } from '../CetLocation.api';
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
name: "CetLocationForm",
|
|
||||||
components:{
|
|
||||||
BasicForm
|
|
||||||
},
|
|
||||||
props:{
|
|
||||||
formData: propTypes.object.def({}),
|
|
||||||
formBpm: propTypes.bool.def(true),
|
|
||||||
},
|
|
||||||
setup(props){
|
|
||||||
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
|
||||||
labelWidth: 150,
|
|
||||||
schemas: getBpmFormSchema(props.formData),
|
|
||||||
showActionButtonGroup: false,
|
|
||||||
baseColProps: {span: 24}
|
|
||||||
});
|
|
||||||
|
|
||||||
const formDisabled = computed(()=>{
|
export default defineComponent({
|
||||||
if(props.formData.disabled === false){
|
name: 'CetLocationForm',
|
||||||
return false;
|
components: {
|
||||||
}
|
BasicForm,
|
||||||
return true;
|
},
|
||||||
});
|
props: {
|
||||||
|
formData: propTypes.object.def({}),
|
||||||
|
formBpm: propTypes.bool.def(true),
|
||||||
|
},
|
||||||
|
setup(props) {
|
||||||
|
const [registerForm, { setFieldsValue, setProps, getFieldsValue }] = useForm({
|
||||||
|
labelWidth: 150,
|
||||||
|
schemas: getBpmFormSchema(props.formData),
|
||||||
|
showActionButtonGroup: false,
|
||||||
|
baseColProps: { span: 24 },
|
||||||
|
});
|
||||||
|
|
||||||
let formData = {};
|
const formDisabled = computed(() => {
|
||||||
const queryByIdUrl = '/CET/cetLocation/queryById';
|
if (props.formData.disabled === false) {
|
||||||
async function initFormData(){
|
return false;
|
||||||
let params = {id: props.formData.dataId};
|
|
||||||
const data = await defHttp.get({url: queryByIdUrl, params});
|
|
||||||
formData = {...data}
|
|
||||||
//设置表单的值
|
|
||||||
await setFieldsValue(formData);
|
|
||||||
//默认是禁用
|
|
||||||
await setProps({disabled: formDisabled.value})
|
|
||||||
}
|
|
||||||
|
|
||||||
async function submitForm() {
|
|
||||||
let data = getFieldsValue();
|
|
||||||
let params = Object.assign({}, formData, data);
|
|
||||||
console.log('表单数据', params)
|
|
||||||
await saveOrUpdate(params, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
initFormData();
|
|
||||||
|
|
||||||
return {
|
|
||||||
registerForm,
|
|
||||||
formDisabled,
|
|
||||||
submitForm,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
return true;
|
||||||
</script>
|
});
|
||||||
|
|
||||||
|
let formData = {};
|
||||||
|
const queryByIdUrl = '/CET/cetLocation/queryById';
|
||||||
|
async function initFormData() {
|
||||||
|
let params = { code: props.formData.dataId };
|
||||||
|
const data = await defHttp.get({ url: queryByIdUrl, params });
|
||||||
|
formData = { ...data };
|
||||||
|
//设置表单的值
|
||||||
|
await setFieldsValue(formData);
|
||||||
|
//默认是禁用
|
||||||
|
await setProps({ disabled: formDisabled.value });
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitForm() {
|
||||||
|
let data = getFieldsValue();
|
||||||
|
let params = Object.assign({}, formData, data);
|
||||||
|
console.log('表单数据', params);
|
||||||
|
await saveOrUpdate(params, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
initFormData();
|
||||||
|
|
||||||
|
return {
|
||||||
|
registerForm,
|
||||||
|
formDisabled,
|
||||||
|
submitForm,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<a-form-item label="姓名" name="name">
|
<a-form-item label="姓名" name="name">
|
||||||
<a-input v-model:value="search.name" placeholder="请输入学生姓名" />
|
<a-input v-model:value="search.name" placeholder="请输入学生姓名" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item label="学号" name="id">
|
<a-form-item label="学号" name="code">
|
||||||
<a-input-number :controls="false" v-model:value="search.id" placeholder="请输入学生学号" />
|
<a-input-number :controls="false" v-model:value="search.code" placeholder="请输入学生学号" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
<a-form-item>
|
<a-form-item>
|
||||||
<a-button type="primary" @click="handleSearch">查询</a-button>
|
<a-button type="primary" @click="handleSearch">查询</a-button>
|
||||||
|
@ -23,7 +23,7 @@
|
||||||
<span>学生姓名:{{ tableData[tableData.length - 1]?.name }}</span>
|
<span>学生姓名:{{ tableData[tableData.length - 1]?.name }}</span>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
<span>学生学号:{{ tableData[tableData.length - 1]?.id }}</span>
|
<span>学生学号:{{ tableData[tableData.length - 1]?.code }}</span>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
<span>所在学院:{{ tableData[tableData.length - 1]?.college }}</span>
|
<span>所在学院:{{ tableData[tableData.length - 1]?.college }}</span>
|
||||||
|
@ -46,12 +46,12 @@
|
||||||
import type { Rule } from 'ant-design-vue/es/form';
|
import type { Rule } from 'ant-design-vue/es/form';
|
||||||
interface FormState {
|
interface FormState {
|
||||||
name: string;
|
name: string;
|
||||||
id: string;
|
code: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const search: UnwrapRef<FormState> = reactive({
|
const search: UnwrapRef<FormState> = reactive({
|
||||||
name: '',
|
name: '',
|
||||||
id: '',
|
code: '',
|
||||||
});
|
});
|
||||||
const isShow = ref(false);
|
const isShow = ref(false);
|
||||||
const loading = ref(false);
|
const loading = ref(false);
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
]);
|
]);
|
||||||
const rules: Record<string, Rule[]> = {
|
const rules: Record<string, Rule[]> = {
|
||||||
name: [{ required: true, message: '请输入学生姓名', trigger: 'change' }],
|
name: [{ required: true, message: '请输入学生姓名', trigger: 'change' }],
|
||||||
id: [{ required: true, message: '请输入学生学号', trigger: 'change' }],
|
code: [{ required: true, message: '请输入学生学号', trigger: 'change' }],
|
||||||
};
|
};
|
||||||
const url = ref({
|
const url = ref({
|
||||||
getData: '/cet_4/getDataByStudent',
|
getData: '/cet_4/getDataByStudent',
|
||||||
|
@ -116,7 +116,7 @@
|
||||||
};
|
};
|
||||||
const handleClear = () => {
|
const handleClear = () => {
|
||||||
search.name = '';
|
search.name = '';
|
||||||
search.id = '';
|
search.code = '';
|
||||||
isShow.value = false;
|
isShow.value = false;
|
||||||
tableData.value = [];
|
tableData.value = [];
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="p-2">
|
<div class="p-2">
|
||||||
<a-card title="英语四级数据导入" :bordered="false">
|
<a-card title="学生信息导入" :bordered="false">
|
||||||
<a-row :gutter="2">
|
<a-row :gutter="2">
|
||||||
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
||||||
<div class="clearfix">
|
<div class="clearfix">
|
||||||
|
|
|
@ -0,0 +1,233 @@
|
||||||
|
<template>
|
||||||
|
<div style="background: #ececec; padding-top: 0px; padding-left: 20px; padding-right: 20px; padding-bottom: 20px">
|
||||||
|
<a-card title="英语六级数据导入" :bordered="false">
|
||||||
|
<a-row :gutter="2">
|
||||||
|
<a-col :xl="24" :style="{ marginBottom: '24px' }">
|
||||||
|
<div class="clearfix">
|
||||||
|
<span style="padding-top: 5px">考试批次:</span>
|
||||||
|
<a-space direction="vertical" :size="12">
|
||||||
|
<a-date-picker v-model:value="month" picker="month" />
|
||||||
|
</a-space>
|
||||||
|
<div class="clearfix">
|
||||||
|
<!-- accept=".dbf" 属性限制文件类型 -->
|
||||||
|
<a-upload
|
||||||
|
:file-list="fileList"
|
||||||
|
accept=".dbf"
|
||||||
|
:max-count="1"
|
||||||
|
:customRequest="handleUpload"
|
||||||
|
:before-upload="beforeUpload"
|
||||||
|
@remove="handleRemove"
|
||||||
|
>
|
||||||
|
<a-button type="primary">
|
||||||
|
<upload-outlined />
|
||||||
|
导入文件
|
||||||
|
</a-button>
|
||||||
|
</a-upload>
|
||||||
|
</div>
|
||||||
|
<!--<div class="clearfix">
|
||||||
|
<a-button preIcon="ant-design:export-outlined" @click="downloadTemplate"> 下载模板</a-button>
|
||||||
|
</div>-->
|
||||||
|
<div class="clearfix">
|
||||||
|
<a-button type="primary" :disabled="!canUpload" :loading="uploading" @click="handleUpload">
|
||||||
|
{{ uploading ? 'Uploading' : '确认上传文件' }}
|
||||||
|
</a-button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
<a-row :gutter="10">
|
||||||
|
<a-col :xl="24">
|
||||||
|
<a-table :dataSource="dataSourceCet4" :columns="columns" :pagination="false" :loading="loading" bordered class="custom-table" />
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref, computed, onMounted } from 'vue';
|
||||||
|
import { message } from 'ant-design-vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { downloadTemplateExcel } from './dataImportApi';
|
||||||
|
import { conversionFileDownload } from '@/utils/download';
|
||||||
|
const loading = ref(false);
|
||||||
|
// 批次选择(月份选择器)
|
||||||
|
const month = ref(null);
|
||||||
|
const url = {
|
||||||
|
downLoadTemplate: '/cetDataImport/downloadTemplate',
|
||||||
|
importCet4Data: '/cetDataImport/dbfImport',
|
||||||
|
loadImportData: '/cet_6/loadImportDataList',
|
||||||
|
};
|
||||||
|
// 文件上传部分
|
||||||
|
const fileList: any = ref([]);
|
||||||
|
const uploading = ref(false);
|
||||||
|
|
||||||
|
// 计算属性:控制上传按钮的可用性
|
||||||
|
const canUpload = computed(() => fileList.value.length > 0 && month.value !== null);
|
||||||
|
|
||||||
|
// 移除文件
|
||||||
|
const handleRemove = (file) => {
|
||||||
|
const index = fileList.value.indexOf(file);
|
||||||
|
const newFileList = fileList.value.slice();
|
||||||
|
newFileList.splice(index, 1);
|
||||||
|
fileList.value = newFileList;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 文件选择前的校验处理
|
||||||
|
const beforeUpload = (file) => {
|
||||||
|
console.log(file);
|
||||||
|
fileList.value = [];
|
||||||
|
fileList.value = [...fileList.value, file];
|
||||||
|
let fileType = file.name.split('.').pop().toLowerCase();
|
||||||
|
if (fileType !== 'dbf') {
|
||||||
|
message.error('请上传.dbf文件');
|
||||||
|
fileList.value = fileList.value.filter((item) => item.uid !== file.uid);
|
||||||
|
}
|
||||||
|
return false; // 阻止自动上传
|
||||||
|
};
|
||||||
|
// 处理上传逻辑
|
||||||
|
const handleUpload = async () => {
|
||||||
|
// 检查是否选择了文件
|
||||||
|
if (!fileList.value || fileList.value.length === 0) {
|
||||||
|
message.error('没有选择文件');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const file = fileList.value[0];
|
||||||
|
if (!file) {
|
||||||
|
message.error('没有选择文件');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 读取文件为 Base64 编码
|
||||||
|
const reader = new FileReader();
|
||||||
|
reader.readAsDataURL(file);
|
||||||
|
reader.onload = async () => {
|
||||||
|
const base64File = reader.result as string;
|
||||||
|
|
||||||
|
// 构建请求体
|
||||||
|
const payload = {
|
||||||
|
fileName: file.name,
|
||||||
|
fileContent: base64File,
|
||||||
|
batch: '',
|
||||||
|
level: 'cet6',
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理 batch 参数
|
||||||
|
let batch: any = month.value;
|
||||||
|
if (batch) {
|
||||||
|
batch = batch.format('YYYY-MM-DD');
|
||||||
|
batch = setDayToFirst(batch); // 将日期的天改为当月第一天
|
||||||
|
payload.batch = batch;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
uploading.value = true;
|
||||||
|
|
||||||
|
// 发送 POST 请求
|
||||||
|
const response: any = await defHttp.post(
|
||||||
|
{
|
||||||
|
url: url.importCet4Data,
|
||||||
|
data: payload,
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
isTransformResponse: false,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// 清空文件列表和日期选择(根据需要)
|
||||||
|
fileList.value = [];
|
||||||
|
|
||||||
|
// 处理响应
|
||||||
|
if (response.success) {
|
||||||
|
message.success('上传成功');
|
||||||
|
} else {
|
||||||
|
message.error(response.message || '上传失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error('上传失败:', error);
|
||||||
|
message.error('上传失败');
|
||||||
|
} finally {
|
||||||
|
uploading.value = false;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
reader.onerror = (error) => {
|
||||||
|
console.error('文件读取错误:', error);
|
||||||
|
message.error('文件读取失败');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将 'yyyy-MM-dd' 格式的日期字符串的天部分设置为 '01'
|
||||||
|
* @param {string} dateStr - 原始日期字符串,格式为 'yyyy-MM-dd'
|
||||||
|
* @returns {string} 修改后的日期字符串,格式为 'yyyy-MM-01'
|
||||||
|
*/
|
||||||
|
const setDayToFirst = (dateStr) => {
|
||||||
|
// 使用正则表达式验证日期格式
|
||||||
|
const regex = /^(\d{4})-(\d{2})-(\d{2})$/;
|
||||||
|
const match = dateStr.match(regex);
|
||||||
|
|
||||||
|
if (!match) {
|
||||||
|
throw new Error("日期格式不正确,应为 'yyyy-MM-dd'");
|
||||||
|
}
|
||||||
|
|
||||||
|
const year = match[1];
|
||||||
|
const month = match[2];
|
||||||
|
|
||||||
|
// 构造新的日期字符串,天部分设置为 '01'
|
||||||
|
return `${year}-${month}-01`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 定义表格的数据源
|
||||||
|
const dataSourceCet4 = ref([]);
|
||||||
|
// 定义表格的列配置
|
||||||
|
const columns = [
|
||||||
|
{
|
||||||
|
title: '考试批次',
|
||||||
|
dataIndex: 'batch',
|
||||||
|
key: 'batch',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '参加人数',
|
||||||
|
dataIndex: 'attendNumber',
|
||||||
|
key: 'attendNumber',
|
||||||
|
align: 'center',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
//处理表格数据源
|
||||||
|
const fetchData = async () => {
|
||||||
|
loading.value = true; // 开始加载
|
||||||
|
try {
|
||||||
|
const response = await defHttp.post({ url: url.loadImportData });
|
||||||
|
console.log(response, 'response');
|
||||||
|
dataSourceCet4.value = response.data; // 将数据绑定到表格
|
||||||
|
} catch (error) {
|
||||||
|
message.error('Failed to load data.');
|
||||||
|
} finally {
|
||||||
|
loading.value = false; // 加载结束
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
//const downloadTemplate = async () => {
|
||||||
|
// downloadTemplateExcel()
|
||||||
|
// .then((response: any) => {
|
||||||
|
// console.log(response, '123');
|
||||||
|
// conversionFileDownload(response);
|
||||||
|
// })
|
||||||
|
// .catch((error) => {
|
||||||
|
// console.error(error);
|
||||||
|
// });
|
||||||
|
//};
|
||||||
|
|
||||||
|
// 在组件挂载时调用 fetchData
|
||||||
|
onMounted(fetchData);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
.clearfix {
|
||||||
|
display: flex;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
</style>
|
Loading…
Reference in New Issue