jinlin
2023-11-03 35435e8b1995e6775c82b86652381e07e3faff54
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
<template>
  <zt-uploader class="excel-import" :action="action" :data="data" :button-text="buttonText" accept=".xlsx,.xls" v-show="!uploadDisabled" @input="onSuccess"/>
</template>
 
<script>
  export default {
    name: 'ZtExcelImport',
    props: {
      action: {
        type: String,
        required: true
      },
      // 上传时附带的额外参数
      data: Object,
      buttonText: {
        type: String,
        default: '导入'
      },
      disabled: {
        type: Boolean,
        default: false
      }
    },
    components: {
    },
    inject: {
      elForm: {
        default: ''
      }
    },
    data() {
      return {
      }
    },
    computed: {
      uploadDisabled() {
        return this.disabled || (this.elForm || {}).disabled
      }
    },
    watch: {
    },
    methods: {
      onSuccess(data) {
        this.$emit('success', data)
      }
    }
  }
</script>
 
<style>
 
  .zt .excel-import .upload-input .upload-btn {
    font-size: 14px;
    border-radius: 4px;
    padding: 9px 18px;
  }
 
</style>