style: 格式化代码
This commit is contained in:
@@ -1,27 +1,29 @@
|
||||
<template>
|
||||
<div>
|
||||
<!-- 导入模态窗 -->
|
||||
<el-dialog width='400px'
|
||||
v-if="visible"
|
||||
:visible="visible"
|
||||
@close="onClose"
|
||||
title="导入文件"
|
||||
v-dragDialogWidth
|
||||
:close-on-click-modal="false"
|
||||
append-to-body>
|
||||
<el-dialog
|
||||
v-if="visible"
|
||||
v-dragDialogWidth
|
||||
width="400px"
|
||||
:visible="visible"
|
||||
title="导入文件"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
@close="onClose"
|
||||
>
|
||||
<el-upload
|
||||
multiple
|
||||
drag
|
||||
:action="action"
|
||||
ref="importfile"
|
||||
:headers="headers"
|
||||
name="file"
|
||||
:accept="accept"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="onSuccess"
|
||||
:show-file-list="true"
|
||||
ref="importfile"
|
||||
multiple
|
||||
drag
|
||||
:action="action"
|
||||
:headers="headers"
|
||||
name="file"
|
||||
:accept="accept"
|
||||
:before-upload="beforeUpload"
|
||||
:on-success="onSuccess"
|
||||
:show-file-list="true"
|
||||
>
|
||||
<i class="el-icon-upload" style="color: #3399ff"></i>
|
||||
<i class="el-icon-upload" style="color: #3399ff" />
|
||||
<div class="el-upload__text">点击或拖拽上传文件</div>
|
||||
</el-upload>
|
||||
</el-dialog>
|
||||
@@ -31,10 +33,16 @@
|
||||
<span>导入失败</span>
|
||||
</p>
|
||||
<div style="max-height: 300px;overflow: auto;padding: 10px 0;">
|
||||
<p v-html="importForm.content"></p>
|
||||
<p v-html="importForm.content" />
|
||||
</div>
|
||||
<div slot="footer" class="demo-drawer-footer">
|
||||
<el-button type="primary" round class="common-button-default" icon="el-icon-check" @click="importFailed = false">
|
||||
<el-button
|
||||
type="primary"
|
||||
round
|
||||
class="common-button-default"
|
||||
icon="el-icon-check"
|
||||
@click="importFailed = false"
|
||||
>
|
||||
确认
|
||||
</el-button>
|
||||
</div>
|
||||
@@ -44,16 +52,7 @@
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "import",
|
||||
data () {
|
||||
return {
|
||||
headers:{
|
||||
token: JSON.parse(localStorage.getItem('userInfo')).token
|
||||
},
|
||||
importFailed: false,
|
||||
importForm: {}
|
||||
}
|
||||
},
|
||||
name: 'Import',
|
||||
props: {
|
||||
accept: {
|
||||
type: String,
|
||||
@@ -72,6 +71,15 @@ export default {
|
||||
default: 200
|
||||
},
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
headers: {
|
||||
token: JSON.parse(localStorage.getItem('userInfo')).token
|
||||
},
|
||||
importFailed: false,
|
||||
importForm: {}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onClose () {
|
||||
this.$emit('update:visible', false)
|
||||
@@ -93,13 +101,13 @@ export default {
|
||||
}
|
||||
// 判断文件上传大小
|
||||
if (file.size / 1024 / 1024 > this.size) {// eslint-disable-line
|
||||
this.$message.error('文件' + file.name + `超过${ this.size }M`)
|
||||
this.$message.error('文件' + file.name + `超过${this.size}M`)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
},
|
||||
// 导入标准数据成功后执行
|
||||
onSuccess(response, file) {
|
||||
onSuccess (response, file) {
|
||||
if (response.ok) {
|
||||
this.$emit('update:visible', false)
|
||||
this.$emit('onSuccess')
|
||||
|
||||
Reference in New Issue
Block a user