|
@@ -1,92 +1,113 @@
|
|
|
<template>
|
|
|
<div class="ws-upload">
|
|
|
<div v-if="!remarkWord">
|
|
|
- <el-button class="upload-btn"
|
|
|
- size="small"
|
|
|
- :disabled="disabled"
|
|
|
- type="primary"
|
|
|
- @click="_handleUploadClick">{{ buttonName?buttonName:$t('upload.uploadButton') }}</el-button>
|
|
|
+ <el-button
|
|
|
+ class="upload-btn"
|
|
|
+ size="small"
|
|
|
+ :disabled="disabled"
|
|
|
+ type="primary"
|
|
|
+ @click="_handleUploadClick"
|
|
|
+ >{{ buttonName ? buttonName : $t('upload.uploadButton') }}</el-button
|
|
|
+ >
|
|
|
</div>
|
|
|
- <div class="trigger-group"
|
|
|
- v-if="editable && remarkWord">
|
|
|
- <el-button class="upload-btn"
|
|
|
- size="small"
|
|
|
- :disabled="disabled"
|
|
|
- type="primary"
|
|
|
- @click="_handleUploadClick">{{ buttonName?buttonName:$t('upload.uploadButton') }}</el-button>
|
|
|
+ <div class="trigger-group" v-if="editable && remarkWord">
|
|
|
+ <el-button
|
|
|
+ class="upload-btn"
|
|
|
+ size="small"
|
|
|
+ :disabled="disabled"
|
|
|
+ type="primary"
|
|
|
+ @click="_handleUploadClick"
|
|
|
+ >{{ buttonName ? buttonName : $t('upload.uploadButton') }}</el-button
|
|
|
+ >
|
|
|
<div class="tip">
|
|
|
{{ $t('upload.uploadText01') }}{{ formatTxt }}
|
|
|
- {{ $t('upload.uploadText02') }}
|
|
|
+ 格式的文件,单个文件大小不能超过10M
|
|
|
</div>
|
|
|
</div>
|
|
|
- <el-upload action="#"
|
|
|
- list-type="picture-card"
|
|
|
- :http-request="_handleRequest"
|
|
|
- :file-list="fileList"
|
|
|
- :before-upload="_handleBeforeUpload"
|
|
|
- :accept="accept"
|
|
|
- :multiple="!limit || parseInt(limit) > 1"
|
|
|
- ref="elUpload">
|
|
|
+ <el-upload
|
|
|
+ action="#"
|
|
|
+ list-type="picture-card"
|
|
|
+ :http-request="_handleRequest"
|
|
|
+ :file-list="fileList"
|
|
|
+ :before-upload="_handleBeforeUpload"
|
|
|
+ :accept="accept"
|
|
|
+ :multiple="!limit || parseInt(limit) > 1"
|
|
|
+ ref="elUpload"
|
|
|
+ >
|
|
|
<template v-slot:trigger>
|
|
|
<div ref="triggerDiv">-</div>
|
|
|
</template>
|
|
|
<template v-slot:file="{ file }">
|
|
|
<div class="thumbnail-group">
|
|
|
- <winsea-picture-view v-if="isPictureFile(file)"
|
|
|
- class="el-upload-list__item-thumbnail"
|
|
|
- picturesShowType="fold"
|
|
|
- :pic-small-list="_getFileImg(file)"
|
|
|
- :pic-list="_getFileImgs"
|
|
|
- :width="110"
|
|
|
- :height="110" />
|
|
|
- <img v-else
|
|
|
- class="el-upload-list__item-thumbnail"
|
|
|
- :class="getFileClass(file)" />
|
|
|
+ <winsea-picture-view
|
|
|
+ v-if="isPictureFile(file)"
|
|
|
+ class="el-upload-list__item-thumbnail"
|
|
|
+ picturesShowType="fold"
|
|
|
+ :pic-small-list="_getFileImg(file)"
|
|
|
+ :pic-list="_getFileImgs"
|
|
|
+ :width="110"
|
|
|
+ :height="110"
|
|
|
+ />
|
|
|
+ <img
|
|
|
+ v-else
|
|
|
+ class="el-upload-list__item-thumbnail"
|
|
|
+ :class="getFileClass(file)"
|
|
|
+ />
|
|
|
</div>
|
|
|
- <div class="fileName"
|
|
|
- v-if="showName"
|
|
|
- :title="file.name">
|
|
|
+ <div class="fileName" v-if="showName" :title="file.name">
|
|
|
{{ file.name }}
|
|
|
</div>
|
|
|
- <span class="el-upload-list__item-actions"
|
|
|
- :class="!(file.status == 'success') ? 'operate-bg' : ''"
|
|
|
- v-if="file.status == 'success' && (editable || download)">
|
|
|
+ <span
|
|
|
+ class="el-upload-list__item-actions"
|
|
|
+ :class="!(file.status == 'success') ? 'operate-bg' : ''"
|
|
|
+ v-if="file.status == 'success' && (editable || download)"
|
|
|
+ >
|
|
|
<span class="el-upload-list__item-delete">
|
|
|
- <i class="el-icon-view"
|
|
|
- v-if="
|
|
|
+ <i
|
|
|
+ class="el-icon-view"
|
|
|
+ v-if="
|
|
|
isOnlineFile(file) &&
|
|
|
- download &&
|
|
|
- !isPictureFile(file) &&
|
|
|
- !onlineEdit
|
|
|
+ download &&
|
|
|
+ !isPictureFile(file) &&
|
|
|
+ !onlineEdit
|
|
|
"
|
|
|
- @click="_handleDownload(file, 'view')"></i>
|
|
|
- <i class="el-icon-edit"
|
|
|
- v-if="onlineEdit"
|
|
|
- @click="_handleOnline(file)"></i>
|
|
|
- <i class="el-icon-download"
|
|
|
- @click.stop="_handleDownload(file, 'down')"></i>
|
|
|
- <i v-if="editable"
|
|
|
- class="el-icon-delete"
|
|
|
- @click.stop="_handleRemove(file)"></i>
|
|
|
+ @click="_handleDownload(file, 'view')"
|
|
|
+ ></i>
|
|
|
+ <i
|
|
|
+ class="el-icon-edit"
|
|
|
+ v-if="onlineEdit"
|
|
|
+ @click="_handleOnline(file)"
|
|
|
+ ></i>
|
|
|
+ <i
|
|
|
+ class="el-icon-download"
|
|
|
+ @click.stop="_handleDownload(file, 'down')"
|
|
|
+ ></i>
|
|
|
+ <i
|
|
|
+ v-if="editable"
|
|
|
+ class="el-icon-delete"
|
|
|
+ @click.stop="_handleRemove(file)"
|
|
|
+ ></i>
|
|
|
</span>
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-upload>
|
|
|
- <BaseDialog v-drag
|
|
|
- :modal="false"
|
|
|
- :visible.sync="dialogVisible"
|
|
|
- @closed="_handlePreviewClosed"
|
|
|
- :title="downloadName"
|
|
|
- append-to-body>
|
|
|
- <img v-lazy="dialogImageUrl"
|
|
|
- width="100%" />
|
|
|
+ <BaseDialog
|
|
|
+ v-drag
|
|
|
+ :modal="false"
|
|
|
+ :visible.sync="dialogVisible"
|
|
|
+ @closed="_handlePreviewClosed"
|
|
|
+ :title="downloadName"
|
|
|
+ append-to-body
|
|
|
+ >
|
|
|
+ <img v-lazy="dialogImageUrl" width="100%" />
|
|
|
</BaseDialog>
|
|
|
- <BaseDialog width="70%"
|
|
|
- :title="pdfFileName"
|
|
|
- :visible.sync="isShowPdf"
|
|
|
- :appendToBody="true">
|
|
|
- <pdf :loadUrl="pdfUrl"
|
|
|
- v-if="isShowPdf" />
|
|
|
+ <BaseDialog
|
|
|
+ width="70%"
|
|
|
+ :title="pdfFileName"
|
|
|
+ :visible.sync="isShowPdf"
|
|
|
+ :appendToBody="true"
|
|
|
+ >
|
|
|
+ <pdf :loadUrl="pdfUrl" v-if="isShowPdf" />
|
|
|
</BaseDialog>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -102,70 +123,70 @@ import { mapActions } from 'vuex'
|
|
|
export default {
|
|
|
name: 'WsUpload',
|
|
|
components: {
|
|
|
- pdf
|
|
|
+ pdf,
|
|
|
},
|
|
|
props: {
|
|
|
appendixIds: String,
|
|
|
editable: {
|
|
|
// 是否为编辑模式
|
|
|
type: Boolean,
|
|
|
- default: true
|
|
|
+ default: true,
|
|
|
},
|
|
|
remarkWord: {
|
|
|
// 是否有备注要求
|
|
|
type: Boolean,
|
|
|
- default: true
|
|
|
+ default: true,
|
|
|
},
|
|
|
preview: {
|
|
|
// 是否允许预览
|
|
|
type: Boolean,
|
|
|
- default: true
|
|
|
+ default: true,
|
|
|
},
|
|
|
download: {
|
|
|
// 是否允许下载
|
|
|
type: Boolean,
|
|
|
- default: true
|
|
|
+ default: true,
|
|
|
},
|
|
|
showName: {
|
|
|
// 是否显示文件名
|
|
|
type: Boolean,
|
|
|
- default: true
|
|
|
+ default: true,
|
|
|
},
|
|
|
limit: {
|
|
|
// 文件总数量限制
|
|
|
type: Number,
|
|
|
- default: 10
|
|
|
+ default: 10,
|
|
|
},
|
|
|
sizeLimit: {
|
|
|
// 文件大小限制
|
|
|
type: Number,
|
|
|
- default: undefined
|
|
|
+ default: undefined,
|
|
|
},
|
|
|
accept: {
|
|
|
// 限制文件类型
|
|
|
type: String,
|
|
|
default:
|
|
|
- '.jpg, .jpeg, .png, .gif, .pdf, .doc, .docx, .xls, .xlsx, .zip, .rar, .eml, .mpeg, .avi, .asf, .wmv, .mpv, .rmvb, .rm, .flv, .mp4, .3pg, .ppt, .pptx, .txt'
|
|
|
+ '.jpg, .jpeg, .png, .gif, .pdf, .doc, .docx, .xls, .xlsx, .zip, .rar, .eml, .mpeg, .avi, .asf, .wmv, .mpv, .rmvb, .rm, .flv, .mp4, .3pg, .ppt, .pptx, .txt',
|
|
|
},
|
|
|
ossKey: {
|
|
|
type: String,
|
|
|
- required: true
|
|
|
+ required: true,
|
|
|
},
|
|
|
compId: {
|
|
|
// 公司ID
|
|
|
type: String,
|
|
|
- required: true
|
|
|
+ required: true,
|
|
|
},
|
|
|
vesselId: {
|
|
|
// 船舶ID
|
|
|
type: String,
|
|
|
default: '',
|
|
|
- required: false
|
|
|
+ required: false,
|
|
|
},
|
|
|
tableName: {
|
|
|
// 要保存的表的名字
|
|
|
type: String,
|
|
|
- required: true
|
|
|
+ required: true,
|
|
|
},
|
|
|
onlineEdit: false,
|
|
|
disabled: false,
|
|
@@ -174,7 +195,7 @@ export default {
|
|
|
type: String,
|
|
|
},
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
pdfUrl: '',
|
|
|
pdfFileName: '',
|
|
@@ -193,22 +214,22 @@ export default {
|
|
|
loadingView: '', // loading弹出层
|
|
|
uploadParams: {
|
|
|
companyId: this.compId,
|
|
|
- basePath: '' //config.getUploadPath(this.ossKey, this.compId)
|
|
|
+ basePath: '', //config.getUploadPath(this.ossKey, this.compId)
|
|
|
},
|
|
|
- clientFag: sessionStorage.getItem('ws-pf_clientFag')
|
|
|
+ clientFag: sessionStorage.getItem('ws-pf_clientFag'),
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
|
- formatTxt () {
|
|
|
+ formatTxt() {
|
|
|
return this.accept
|
|
|
.replace(/\./g, '')
|
|
|
.replace(/ /g, '')
|
|
|
.replace(/,/g, '、')
|
|
|
},
|
|
|
- thisAppendixIds () {
|
|
|
+ thisAppendixIds() {
|
|
|
return this.appendixIds
|
|
|
},
|
|
|
- _getFileImgs () {
|
|
|
+ _getFileImgs() {
|
|
|
let arr = []
|
|
|
for (let i of this.fileList) {
|
|
|
if (this.isPictureFile(i)) {
|
|
@@ -216,19 +237,19 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
return arr
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
watch: {
|
|
|
// 监听props.appendixIds, 变化时向服务器请求
|
|
|
- async thisAppendixIds (newV, oldV) {
|
|
|
+ async thisAppendixIds(newV, oldV) {
|
|
|
this.getDefaultFiles(newV)
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
this.getDefaultFiles(this.appendixIds)
|
|
|
|
|
|
const handleChange = this.$refs.elUpload.$refs['upload-inner'].handleChange
|
|
|
- this.$refs.elUpload.$refs['upload-inner'].handleChange = ev => {
|
|
|
+ this.$refs.elUpload.$refs['upload-inner'].handleChange = (ev) => {
|
|
|
this.initFileList = []
|
|
|
this.curFileNum = ev.target.files.length
|
|
|
for (let i = 0; i < this.curFileNum; i++) {
|
|
@@ -242,8 +263,10 @@ export default {
|
|
|
methods: {
|
|
|
...mapActions('common', ['uploadShipFiles']),
|
|
|
//pdf预览
|
|
|
- async toOpen (scope) {
|
|
|
- const data = await this.getFileList({ appendixIds: scope.row.filePathId }).toPromise()
|
|
|
+ async toOpen(scope) {
|
|
|
+ const data = await this.getFileList({
|
|
|
+ appendixIds: scope.row.filePathId,
|
|
|
+ }).toPromise()
|
|
|
let path = data[0] ? data[0].appendixPath : ''
|
|
|
let filePath = this.$store.getters.baseInfo.fileUrl + '/' + path
|
|
|
this.pdfUrl = filePath
|
|
@@ -256,7 +279,7 @@ export default {
|
|
|
// this.tempFileList = fileList
|
|
|
// },
|
|
|
// 获取图片文件
|
|
|
- _getFileImg (file) {
|
|
|
+ _getFileImg(file) {
|
|
|
if (!file) {
|
|
|
return ''
|
|
|
}
|
|
@@ -269,7 +292,7 @@ export default {
|
|
|
return ''
|
|
|
},
|
|
|
|
|
|
- async getDefaultFiles (appendixIds) {
|
|
|
+ async getDefaultFiles(appendixIds) {
|
|
|
this.fileList = []
|
|
|
if (appendixIds) {
|
|
|
this.loading = true
|
|
@@ -282,7 +305,7 @@ export default {
|
|
|
appendixId: item.appendixId,
|
|
|
name: item.appendixName,
|
|
|
url: this.getFilePath(item.appendixPath),
|
|
|
- uid: uuid()
|
|
|
+ uid: uuid(),
|
|
|
}
|
|
|
})
|
|
|
}
|
|
@@ -290,49 +313,47 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 处理上传按钮点击
|
|
|
- _handleUploadClick () {
|
|
|
+ _handleUploadClick() {
|
|
|
this.$refs.triggerDiv.click()
|
|
|
},
|
|
|
// 处理预览
|
|
|
- _handlePreview (file) {
|
|
|
+ _handlePreview(file) {
|
|
|
this.dialogImageUrl = file.url
|
|
|
this.downloadName = file.name
|
|
|
this.dialogVisible = true
|
|
|
},
|
|
|
// 处理预览关闭
|
|
|
- _handlePreviewClosed () {
|
|
|
+ _handlePreviewClosed() {
|
|
|
this.dialogImageUrl = ''
|
|
|
this.downloadName = ''
|
|
|
},
|
|
|
|
|
|
// 处理删除
|
|
|
- _handleRemove (file) {
|
|
|
+ _handleRemove(file) {
|
|
|
if (file.appendixId) {
|
|
|
// 这是要删除已经存在的附件
|
|
|
const index = this.fileList.findIndex(
|
|
|
- itm => itm.appendixId === file.appendixId
|
|
|
+ (itm) => itm.appendixId === file.appendixId
|
|
|
)
|
|
|
this.fileList.splice(index, 1)
|
|
|
this.removeList.push(file.appendixId)
|
|
|
} else {
|
|
|
// 这是删除已上传但还未保存的附件
|
|
|
- const index = this.fileList.findIndex(itm => itm.uid === file.uid)
|
|
|
+ const index = this.fileList.findIndex((itm) => itm.uid === file.uid)
|
|
|
this.fileList.splice(index, 1)
|
|
|
}
|
|
|
this.$emit('onChange', this.fileList.length)
|
|
|
},
|
|
|
|
|
|
// 自定义上传过程
|
|
|
- _handleRequest (param) {
|
|
|
+ _handleRequest(param) {
|
|
|
if (this.vesselBankFlag === 'V') {
|
|
|
//船端
|
|
|
this._uploadFilesShip(param)
|
|
|
}
|
|
|
},
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- async _uploadFilesShip (param) {
|
|
|
+ async _uploadFilesShip(param) {
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
this.showLoading()
|
|
|
const file = param.file
|
|
@@ -343,7 +364,7 @@ export default {
|
|
|
modelId: this.isNull(this.tableName)
|
|
|
? ''
|
|
|
: this.tableName.split('_')[0],
|
|
|
- vesselId: this.vesselId || ''
|
|
|
+ vesselId: this.vesselId || '',
|
|
|
})
|
|
|
this.$emit('uploadSuccess', data, file)
|
|
|
const item = {
|
|
@@ -359,7 +380,7 @@ export default {
|
|
|
vesselId: this.vesselId || '',
|
|
|
uid: file.uid,
|
|
|
url: this.getFilePath(data.appendixPath),
|
|
|
- name: file.name
|
|
|
+ name: file.name,
|
|
|
}
|
|
|
let fileIndex = this.getFileIndex(item.uid)
|
|
|
if (fileIndex >= 0) {
|
|
@@ -375,12 +396,12 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 处理单个文件上传成功
|
|
|
- _handleSuccessOnce () {
|
|
|
+ _handleSuccessOnce() {
|
|
|
this.curFileNum--
|
|
|
if (this.curFileNum === 0) {
|
|
|
this.fileList.push.apply(
|
|
|
this.fileList,
|
|
|
- this.tempFileList.filter(item => {
|
|
|
+ this.tempFileList.filter((item) => {
|
|
|
return !this.isNull(item.uid)
|
|
|
})
|
|
|
)
|
|
@@ -390,19 +411,20 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
// 处理在线编辑
|
|
|
- _handleOnline (file) {
|
|
|
+ _handleOnline(file) {
|
|
|
window.open(
|
|
|
process.env.VUE_APP_BASE_API +
|
|
|
- '/office/file?fileId=' +
|
|
|
- file.appendixId +
|
|
|
- '&showSaveFlag=1'
|
|
|
+ '/office/file?fileId=' +
|
|
|
+ file.appendixId +
|
|
|
+ '&showSaveFlag=1'
|
|
|
)
|
|
|
},
|
|
|
|
|
|
// 处理下载
|
|
|
- _handleDownload (file, type) {
|
|
|
+ _handleDownload(file, type) {
|
|
|
if (this.isOnlineFile(file) && type === 'view') {
|
|
|
- this.pdfUrl = file.url || (this.$store.getters.baseInfo.fileUrl + file.appendixPath)
|
|
|
+ this.pdfUrl =
|
|
|
+ file.url || this.$store.getters.baseInfo.fileUrl + file.appendixPath
|
|
|
this.pdfFileName = file.appendixName || file.name
|
|
|
this.isShowPdf = true
|
|
|
return
|
|
@@ -410,7 +432,7 @@ export default {
|
|
|
downloadNow(file.url, file.name, this.vesselBankFlag, type)
|
|
|
},
|
|
|
|
|
|
- _handleBeforeUpload (file) {
|
|
|
+ _handleBeforeUpload(file) {
|
|
|
let size = this.sizeLimit ? this.sizeLimit : 50
|
|
|
if (file.size > size * 1024 * 1024) {
|
|
|
EventBus.$emit('error', this.$t('showMessage.filesCannot') + size + 'M')
|
|
@@ -430,27 +452,27 @@ export default {
|
|
|
return true
|
|
|
},
|
|
|
//处理文件上传失败
|
|
|
- _handleError () {
|
|
|
+ _handleError() {
|
|
|
this.curFileNum--
|
|
|
this.hideLoading()
|
|
|
},
|
|
|
|
|
|
- _handleExceed () {
|
|
|
+ _handleExceed() {
|
|
|
EventBus.$emit('warning', `最多只能上传${this.limit}个文件`)
|
|
|
},
|
|
|
|
|
|
// 传入appendixIds 从服务器获取文件列表信息
|
|
|
- _getFileList (appendixIds) {
|
|
|
- return new Promise(async next => {
|
|
|
+ _getFileList(appendixIds) {
|
|
|
+ return new Promise(async (next) => {
|
|
|
try {
|
|
|
- next(await getFileList({ appendixIds }).toPromise() || [])
|
|
|
+ next((await getFileList({ appendixIds }).toPromise()) || [])
|
|
|
} catch (error) {
|
|
|
next()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- handleSaveBill () {
|
|
|
+ handleSaveBill() {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
if (!this.removeList && this.fileList.length == 0) {
|
|
|
resolve('')
|
|
@@ -462,10 +484,10 @@ export default {
|
|
|
// if (newAppendixs)
|
|
|
saveFiles(params)
|
|
|
.toPromise()
|
|
|
- .then(res => {
|
|
|
+ .then((res) => {
|
|
|
resolve(res.join())
|
|
|
})
|
|
|
- .catch(err => {
|
|
|
+ .catch((err) => {
|
|
|
EventBus.$emit('error', this.$t('showMessage.saveFilesError'))
|
|
|
reject()
|
|
|
})
|
|
@@ -473,12 +495,12 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 获取文件样式
|
|
|
- getFileClass (file) {
|
|
|
+ getFileClass(file) {
|
|
|
const ext = this.getExtName(file.name)
|
|
|
return 'ext ' + ext
|
|
|
},
|
|
|
// 是否为图片
|
|
|
- isPictureFile (file) {
|
|
|
+ isPictureFile(file) {
|
|
|
if (file && file.name) {
|
|
|
const name = this.getExtName(file.name)
|
|
|
return (
|
|
@@ -499,7 +521,7 @@ export default {
|
|
|
return false
|
|
|
},
|
|
|
// 是否为在线打开文件
|
|
|
- isOnlineFile (file) {
|
|
|
+ isOnlineFile(file) {
|
|
|
if (file && file.name) {
|
|
|
const name = this.getExtName(file.name)
|
|
|
return name === 'pdf' || name === 'tet'
|
|
@@ -507,8 +529,8 @@ export default {
|
|
|
return false
|
|
|
},
|
|
|
|
|
|
- getOssInter () {
|
|
|
- return new Promise(async next => {
|
|
|
+ getOssInter() {
|
|
|
+ return new Promise(async (next) => {
|
|
|
try {
|
|
|
next(await getOssInterimCredentials().toPromise())
|
|
|
} catch (error) {
|
|
@@ -517,7 +539,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
|
|
|
- getFileIndex (uid) {
|
|
|
+ getFileIndex(uid) {
|
|
|
for (let i = 0; i < this.initFileList.length; i++) {
|
|
|
if (this.initFileList[i].uid === uid) {
|
|
|
return i
|
|
@@ -527,21 +549,21 @@ export default {
|
|
|
},
|
|
|
|
|
|
// 显示loading
|
|
|
- showLoading () {
|
|
|
+ showLoading() {
|
|
|
this.loadingView = this.$loading({
|
|
|
lock: true,
|
|
|
text: 'Loading',
|
|
|
spinner: 'el-icon-loading',
|
|
|
background: 'rgba(0, 0, 0, 0.7)',
|
|
|
- target: document.querySelector('.div1')
|
|
|
+ target: document.querySelector('.div1'),
|
|
|
})
|
|
|
},
|
|
|
// 隐藏loading
|
|
|
- hideLoading () {
|
|
|
+ hideLoading() {
|
|
|
this.loadingView.close()
|
|
|
},
|
|
|
// 获取后缀名
|
|
|
- getExtName (url) {
|
|
|
+ getExtName(url) {
|
|
|
if (!url) {
|
|
|
return url
|
|
|
}
|
|
@@ -551,7 +573,7 @@ export default {
|
|
|
}
|
|
|
return url
|
|
|
},
|
|
|
- checkUrl (path) {
|
|
|
+ checkUrl(path) {
|
|
|
if (path.indexOf('http://') > -1 || path.indexOf('https://') > -1) {
|
|
|
let pathSplit = path.split('.com/')
|
|
|
if (pathSplit) {
|
|
@@ -560,7 +582,7 @@ export default {
|
|
|
}
|
|
|
return path
|
|
|
},
|
|
|
- getFilePath (path) {
|
|
|
+ getFilePath(path) {
|
|
|
// let sysUrl = process.env.NODE_ENV === "production"?"http://" + window.location.host+"/":"http://product-dev.winsea.com/";
|
|
|
let sysUrl = this.$store.getters.baseInfo.fileUrl
|
|
|
path = this.checkUrl(path)
|
|
@@ -570,19 +592,19 @@ export default {
|
|
|
return sysUrl + this.slash(path)
|
|
|
},
|
|
|
// 字节转KB
|
|
|
- toKB (bt) {
|
|
|
+ toKB(bt) {
|
|
|
return (bt / 1024).toFixed(2) + 'KB'
|
|
|
},
|
|
|
|
|
|
- clearFiles () {
|
|
|
+ clearFiles() {
|
|
|
// debugger
|
|
|
this.fileList = []
|
|
|
},
|
|
|
// 反斜杠转斜杠
|
|
|
- slash (str) {
|
|
|
+ slash(str) {
|
|
|
return str.replace(/\\/g, '/')
|
|
|
- }
|
|
|
- }
|
|
|
+ },
|
|
|
+ },
|
|
|
}
|
|
|
</script>
|
|
|
|