Commit 7b2ebac9 by cwq0219

修改

1 parent 988d887f
...@@ -5,7 +5,13 @@ ...@@ -5,7 +5,13 @@
:loading="loading" :loading="loading"
v-if="isInRole" v-if="isInRole"
@click="handleClick" @click="handleClick"
>{{label}}</el-button> >{{label}}
<input v-if="label == '导入'"
type="file"
class="import-input"
:accept="accept"
@change="handleImport" />
</el-button>
</template> </template>
<script> <script>
...@@ -36,6 +42,10 @@ export default { ...@@ -36,6 +42,10 @@ export default {
id: { id: {
type: String, type: String,
default: null default: null
},
accept: {
type: String,
default: null
} }
}, },
computed: { computed: {
...@@ -54,10 +64,23 @@ export default { ...@@ -54,10 +64,23 @@ export default {
methods: { methods: {
handleClick: function () { handleClick: function () {
this.$emit('e-auth-click', {}) this.$emit('e-auth-click', {})
},
handleImport(e) {
this.$emit('import-file', e)
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.import-input {
opacity: 0;
position: absolute;
left: 0;
top: 0;
width: 70px;
height: 100%;
cursor: pointer;
font-size:0
}
</style> </style>
...@@ -28,12 +28,18 @@ ...@@ -28,12 +28,18 @@
<el-row style="height: 40px; line-height: 40px"> <el-row style="height: 40px; line-height: 40px">
<el-col :span="12">物料列表</el-col> <el-col :span="12">物料列表</el-col>
<el-col :span="12" style="text-align: right"> <el-col :span="12" style="text-align: right">
<auth-button label="导入" class="import-button" type=""> <auth-button
<input label="导入"
class="import-button"
type=""
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@import-file="importFile"
>
<!-- <input
type="file" type="file"
class="import-input" class="import-input"
accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" accept=".csv, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
@change="importFile($event)" /> @change="importFile($event)" /> -->
</auth-button> </auth-button>
<auth-button label="导出" type=""></auth-button> <auth-button label="导出" type=""></auth-button>
</el-col> </el-col>
...@@ -290,7 +296,7 @@ export default { ...@@ -290,7 +296,7 @@ export default {
position: relative; position: relative;
cursor: pointer; cursor: pointer;
} }
.import-input { /* .import-input {
opacity: 0; opacity: 0;
position: absolute; position: absolute;
left: 0; left: 0;
...@@ -299,5 +305,5 @@ export default { ...@@ -299,5 +305,5 @@ export default {
height: 100%; height: 100%;
cursor: pointer; cursor: pointer;
font-size:0 font-size:0
} } */
</style> </style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!