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