1
This commit is contained in:
@ -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 = () => {
|
||||
|
Reference in New Issue
Block a user