| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <el-dialog |
| | | class="center-title" |
| | | :title="title" |
| | | width="500px" |
| | | top="30vh" |
| | | :visible.sync="visible" |
| | | :confirm-working="isWorking" |
| | | @confirm="confirm" |
| | | > |
| | | <p class="tip-warn"><i class="el-icon-warning"></i>导å
¥è¯´æï¼<br> |
| | | 1.请å
ä¸è½½æä»¶æ¨¡æ¿ï¼å¹¶æç
§æ¨¡æ¿è¦å»å¡«åè¡¨æ ¼å
容;<br> |
| | | </p> |
| | | <el-form class="demo-form-inline" > |
| | | <el-form-item label="车è¾ä¿¡æ¯" required> |
| | | <div style="width: 100%;display: flex;align-items: center;"> |
| | | <el-button type="primary" @click="clickRef">ç¹å»ä¸ä¼ </el-button> |
| | | <el-button type="text" @click="exportTemplate">ç¹å»ä¸è½½æ¨¡ç.EXCEL</el-button> |
| | | </div> |
| | | <div style="font-size: 14px; color: black;" v-if="fileName">{{fileName}}</div> |
| | | </el-form-item> |
| | | </el-form> |
| | | <input type="file" style="position: fixed; left: 0; top: -50px;" accept=".xlsx" ref="fileExcel" @change="result" /> |
| | | <template v-slot:footer> |
| | | <el-button @click="visible=false">è¿å</el-button> |
| | | </template> |
| | | </el-dialog> |
| | | </template> |
| | | |
| | | <script> |
| | | import BaseOpera from '@/components/base/BaseOpera' |
| | | import GlobalWindow from '@/components/common/GlobalWindow' |
| | | import { importExcel } from '@/api/business/cars' |
| | | export default { |
| | | extends: BaseOpera, |
| | | // eslint-disable-next-line vue/no-unused-components |
| | | components: { GlobalWindow }, |
| | | data () { |
| | | return { |
| | | importing:false, |
| | | fileName: '', |
| | | companyType: 0 |
| | | } |
| | | }, |
| | | methods: { |
| | | open (title, companyType) { |
| | | this.title = title |
| | | this.fileName = '' |
| | | this.visible = true |
| | | this.companyType = companyType |
| | | }, |
| | | // å¯¼åºæ¨¡æ¿ |
| | | exportTemplate () { |
| | | // æä¿ç³è¯· |
| | | window.open('/template/cars.xlsx') |
| | | }, |
| | | clickRef () { |
| | | this.$refs.fileExcel.click() |
| | | }, |
| | | result (e) { |
| | | const data = new FormData() |
| | | data.append('file', e.target.files[0]) |
| | | // data.append('companyType', this.companyType) |
| | | importExcel(data) |
| | | .then(res => { |
| | | this.$message.success('导å
¥æå') |
| | | this.$emit('success') |
| | | this.visible = false |
| | | }) |
| | | .catch(err => { |
| | | // this.$message.error(err) |
| | | this.fileName = '' |
| | | }) |
| | | .finally(() => { |
| | | this.$refs.fileExcel.value = null |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |
| | | <style lang="scss" scoped> |
| | | |
| | | </style> |