This commit is contained in:
dhr
2025-08-29 19:54:27 +08:00
parent 8682b0d8b8
commit 2815b7d6b0
8 changed files with 39 additions and 30 deletions

View File

@ -31,11 +31,17 @@
<el-button type="success" plain icon="Plus" @click="downloadTemplate" v-hasPermi="['land:enterRoad:import']">模板下载</el-button>
</el-col>
<el-col :span="1.5">
<el-upload ref="uploadRef" class="upload-demo" :http-request="handleImport" :show-file-list="false">
<template #trigger>
<el-button plain type="primary">导入excel</el-button>
</template>
</el-upload>
<el-upload
ref="uploadRef"
v-hasPermi="['land:enterRoad:upload']"
class="upload-demo"
:http-request="handleImport"
:show-file-list="false"
>
<template #trigger>
<el-button plain type="primary">导入excel</el-button>
</template>
</el-upload>
</el-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['land:enterRoad:remove']"
@ -93,7 +99,7 @@
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button :loading="buttonLoading" type="primary" @click="submitForm"> </el-button>
<el-button :loading="buttonLoading" type="primary" v-hasPermi="['land:enterRoad:add']" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</template>
@ -102,7 +108,7 @@
</template>
<script setup name="EnterRoad" lang="ts">
import { listEnterRoad, getEnterRoad, delEnterRoad, addEnterRoad, updateEnterRoad ,importEnterRoad} from '@/api/system/landTransfer/enterRoad';
import { listEnterRoad, getEnterRoad, delEnterRoad, addEnterRoad, updateEnterRoad, importEnterRoad } from '@/api/system/landTransfer/enterRoad';
import { EnterRoadVO, EnterRoadQuery, EnterRoadForm } from '@/api/system/landTransfer/enterRoad/types';
import { listLandBlock } from '@/api/system/landTransfer/landBlock';
import { useUserStoreHook } from '@/store/modules/user';
@ -267,20 +273,23 @@ const listeningProject = watch(
// 导入文件
const handleImport = (options: any) => {
loading.value = true;
loading.value = true;
let formData = new FormData();
formData.append('file', options.file);
importEnterRoad(currentProject.value?.id,formData).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess(res.msg || '导入成功');
getListLand();
getList();
}
}).catch((err) => {
proxy.$modal.msgError(err.msg || '导入失败');
}).finally(() => {
loading.value = false;
});
importEnterRoad(currentProject.value?.id, formData)
.then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess(res.msg || '导入成功');
getListLand();
getList();
}
})
.catch((err) => {
proxy.$modal.msgError(err.msg || '导入失败');
})
.finally(() => {
loading.value = false;
});
};
// 下载模板
const downloadTemplate = () => {