You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
116 lines
3.1 KiB
116 lines
3.1 KiB
<script setup> |
|
import { BASE_PATH } from "@/api/request"; |
|
import {replenishExcelGab,replenishLedaoExcelGab} from "@/api/data/petitionComplaint"; |
|
import feedback from "@/utils/feedback"; |
|
let fileList = ref([]) |
|
let loading =ref(false) |
|
const dialogTitle = ref("公安部信访集访导入") |
|
|
|
const {replenishType} = defineProps({ |
|
replenishType:{ |
|
type: String, |
|
defalut: '1' |
|
} |
|
}) |
|
const emit=defineEmits(['success','close']) |
|
//监听导入类型 |
|
watch(()=>replenishType,()=>{ |
|
fileList.value=[] |
|
if (replenishType == 1){ |
|
dialogTitle.value='公安部信访集访导入' |
|
}else{ |
|
dialogTitle.value='公安部信访领导接访导入' |
|
} |
|
console.log('replenishType',replenishType) |
|
},{deep:true,immediate:true}) |
|
|
|
/** |
|
* 上传文件 |
|
* */ |
|
const handleNext = async ()=>{ |
|
//body上传 |
|
const formData = new FormData(); |
|
formData.append("file", fileList.value[fileList.value.length - 1].raw); |
|
loading.value = true; |
|
try { |
|
if (replenishType == 1){ |
|
await replenishExcelGab(formData); |
|
}else{ |
|
await replenishLedaoExcelGab(formData); |
|
} |
|
feedback.msgSuccess("操作成功"); |
|
emit("success") |
|
} catch (e) { |
|
loading.value = false; |
|
throw e; |
|
} |
|
loading.value = false; |
|
|
|
} |
|
</script> |
|
|
|
<template> |
|
<!--公安部数据补充--> |
|
<el-dialog :title="dialogTitle" width="80vw" ref="dialogRef" top="8vh"> |
|
<div v-loading="loading"> |
|
<el-upload |
|
drag |
|
:multiple="false" |
|
:auto-upload="false" |
|
:show-file-list="false" |
|
v-model:file-list="fileList" |
|
accept="application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" |
|
class="mt-20" |
|
> |
|
<template v-if="fileList.length === 0"> |
|
<el-icon class="el-icon--upload"> |
|
<upload-filled/> |
|
</el-icon> |
|
<div class="el-upload__text"> |
|
<p>点击或拖拽文件到此区域上传</p> |
|
</div> |
|
</template> |
|
<template v-else> |
|
<el-icon class="el-icon--upload" |
|
><Select |
|
/></el-icon> |
|
<div class="el-upload__text"> |
|
已选择文件:{{ |
|
fileList[fileList.length - 1].name |
|
}} |
|
</div> |
|
</template> |
|
</el-upload> |
|
<div class="mt-20"> |
|
<span>文件模板</span> |
|
|
|
<a |
|
v-if="replenishType==1" |
|
class="link" |
|
:href="`${BASE_PATH}/templates/公安部信访集访导入模板.xlsx`" |
|
target="__blank" |
|
>公安部信访集访导入模板.xlsx 下载</a |
|
> |
|
<a |
|
v-else |
|
class="link" |
|
:href="`${BASE_PATH}/templates/公安部信访领导接访导入模板.xlsx`" |
|
target="__blank" |
|
>公安部信访领导接访模板.xlsx 下载</a |
|
> |
|
</div> |
|
<footer class="flex end mt-20 v-center"> |
|
<el-button type="primary" |
|
size="large" |
|
@click="handleNext" |
|
:disabled="loading"> |
|
确认 |
|
</el-button> |
|
</footer> |
|
</div> |
|
</el-dialog> |
|
</template> |
|
|
|
<style scoped lang="scss"> |
|
|
|
</style>
|
|
|