import.vue
1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<template>
<el-dialog v-model="show" :title="title" width="500px" append-to-body :close-on-click-modal="false">
<el-form ref="dialogRef" label-width="100px">
<el-form-item label="下载模板">
<el-link href="/file/sportsmanTemplate.xlsx" type="primary" target="_blank">人员模板</el-link>
</el-form-item>
<el-form-item label="上传模板" prop="discount">
<fileUpload ref="upload" name="excel" :action="action" :accept="accept" @uploadSuccess="uploadSuccess" />
</el-form-item>
</el-form>
</el-dialog>
</template>
<script setup>
import { getCurrentInstance } from '@vue/runtime-core'
import { reactive, ref, watch } from 'vue'
import { toRefs } from '@vueuse/shared'
import * as match from '@/apiPc/match'
import { ElMessage, ElMessageBox } from 'element-plus'
const { proxy } = getCurrentInstance()
const emit = defineEmits(['submitForm'])
const action = ref('')
const accept = ref('.xlsx')
const title = ref('')
const show = ref(false)
function uploadSuccess(res) {
console.log(res)
cancel()
if (res.code == 500) {
ElMessageBox.alert(res.data, '提示', {
confirmButtonText: '好的'
})
} else {
proxy.$modal.msgSuccess(`${res.msg}`)
}
emit('uploadSuccess')
proxy.$refs['upload'].handleClear()
}
const open = (params) => {
show.value = true
title.value = params.title
action.value = `/systemj/personInfo/importPerson/${params.groupId}`
}
defineExpose({
open
})
function cancel() {
show.value = false
}
</script>
<style scoped>
:deep(.el-upload__tip) {
display: none
}
</style>