土地流转(地块信息、进场道路(下载模板、)

This commit is contained in:
2025-08-25 19:58:42 +08:00
parent 369ba1ad20
commit 70db0367e1
9 changed files with 118 additions and 239 deletions

View File

@ -6,7 +6,7 @@ VITE_APP_ENV = 'development'
# 开发环境
# 李陈杰 209
VITE_APP_BASE_API = 'http://192.168.110.209:8899'
VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 曾涛
# VITE_APP_BASE_API = 'http://192.168.110.180:8899'
# 罗成

BIN
public/enterRoad.xlsx Normal file

Binary file not shown.

BIN
public/landBlock.xlsx Normal file

Binary file not shown.

View File

@ -61,3 +61,12 @@ export const delEnterRoad = (id: string | number | Array<string | number>) => {
method: 'delete'
});
};
// 道路信息导入
export const importEnterRoad = (projectId: any, data: any) => {
return request({
url: '/land/enterRoad/upload/' + projectId,
method: 'post',
data: data
});
};

View File

@ -76,3 +76,12 @@ export const delLandBlock = (id: string | number | Array<string | number>) => {
method: 'delete'
});
};
// 地块信息导入
export const importLandBlock = (projectId:any,data: any) => {
return request({
url: '/land/landBlock/upload/'+projectId,
method: 'post',
data: data
});
};

View File

@ -76,12 +76,8 @@
</div>
<template #footer>
<div class="dialog-footer p-4 border-t border-gray-100 flex justify-end space-x-3">
<el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors"
>取消</el-button
>
<el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors"
>确认</el-button
>
<el-button @click="handleClose" class="px-4 py-2 border border-gray-300 rounded-md text-gray-700 hover:bg-gray-50 transition-colors">取消</el-button>
<el-button type="primary" @click="submitFlow()" class="px-4 py-2 bg-primary text-white rounded-md hover:bg-primary/90 transition-colors">确认</el-button>
</div>
</template>
</el-dialog>

View File

@ -27,6 +27,16 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['land:enterRoad:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<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-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['land:enterRoad:remove']"
>删除</el-button
@ -92,7 +102,7 @@
</template>
<script setup name="EnterRoad" lang="ts">
import { listEnterRoad, getEnterRoad, delEnterRoad, addEnterRoad, updateEnterRoad } 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';
@ -255,6 +265,43 @@ const listeningProject = watch(
}
);
// 导入文件
const handleImport = (options: any) => {
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;
});
};
// 下载模板
const downloadTemplate = () => {
// 导出模版文件
try {
// 创建a标签
const link = document.createElement('a');
// 设置PDF文件路径 - 相对于public目录
link.href = '/enterRoad.xlsx';
// 设置下载后的文件名
link.download = '道路信息导入模板.xlsx';
// 触发点击
document.body.appendChild(link);
link.click();
// 清理
document.body.removeChild(link);
} catch (error) {
alert('下载失败,请重试');
}
};
onUnmounted(() => {
listeningProject();
});

View File

@ -36,6 +36,16 @@
<el-col :span="1.5">
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['land:landBlock:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<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-col>
<el-col :span="1.5">
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['land:landBlock:remove']"
>删除</el-button
@ -143,7 +153,7 @@
</template>
<script setup name="LandBlock" lang="ts">
import { listLandBlock, getLandBlock, delLandBlock, LandUnit, addLandBlock, updateLandBlock, subMatrix } from '@/api/system/landTransfer/landBlock';
import { listLandBlock, getLandBlock, delLandBlock, LandUnit, addLandBlock, updateLandBlock, subMatrix,importLandBlock } from '@/api/system/landTransfer/landBlock';
import { LandBlockVO, LandBlockQuery, LandBlockForm } from '@/api/system/landTransfer/landBlock/types';
import { useUserStoreHook } from '@/store/modules/user';
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
@ -388,6 +398,44 @@ const listeningProject = watch(
}
);
// 导入文件
const handleImport = (options:any) => {
loading.value = true;
let formData = new FormData();
formData.append('file', options.file);
importLandBlock(currentProject.value?.id,formData).then((res) => {
if (res.code == 200) {
proxy.$modal.msgSuccess(res.msg || '导入成功');
getList();
getfangzhenList();
}
}).catch((err) => {
proxy.$modal.msgError(err.msg || '导入失败');
}).finally(() => {
loading.value = false;
});
};
// 下载模板
const downloadTemplate = () => {
// 导出模版文件
try {
// 创建a标签
const link = document.createElement('a');
// 设置PDF文件路径 - 相对于public目录
link.href = '/landBlock.xlsx';
// 设置下载后的文件名
link.download = '地块信息导入模板.xlsx';
// 触发点击
document.body.appendChild(link);
link.click();
// 清理
document.body.removeChild(link);
} catch (error) {
alert('下载失败,请重试');
}
};
onUnmounted(() => {
listeningProject();
});

File diff suppressed because one or more lines are too long