“体系文件”中上传的文件目前只能是pdf,其他格式的上传不了,建议能将word、excel及照片的格式上传。
“事件起因”建议去掉,与“原因分析及责任认定”中部分重合。“报出日期”的时间填写意义不大,建议去除。 事故事件中照片只能上传一张,多了就不让上传了,应该能上传多张,限制一下数量即可。附件也是只能上传pdf,其他格式上传不了,应能上传其他格式的文件。pet
parent
1ac52ed70d
commit
4e8847f93f
|
@ -1,7 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="app-container">
|
<div class="app-container">
|
||||||
<el-form
|
<el-form
|
||||||
ref="form"
|
ref="infoForm"
|
||||||
:model="infoForm"
|
:model="infoForm"
|
||||||
:rules="rules"
|
:rules="rules"
|
||||||
label-width="180px"
|
label-width="180px"
|
||||||
|
@ -18,11 +18,6 @@
|
||||||
<el-option v-for="item in incidentTypes" :key="item.id" :label="item.name" :value="item.id"/>
|
<el-option v-for="item in incidentTypes" :key="item.id" :label="item.name" :value="item.id"/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item :label-width="formLabelWidth" label="事件级别" prop="incidentLevel">-->
|
|
||||||
<!-- <el-select v-model="infoForm.incidentLevel" :disabled="isDisabled" placeholder="请选择">-->
|
|
||||||
<!-- <el-option v-for="item in incidentLevels" :key="item.id" :label="item.name" :value="item.id"/>-->
|
|
||||||
<!-- </el-select>-->
|
|
||||||
<!-- </el-form-item>-->
|
|
||||||
<el-form-item :label-width="formLabelWidth" label="事件发生地点" prop="location">
|
<el-form-item :label-width="formLabelWidth" label="事件发生地点" prop="location">
|
||||||
<el-input v-model="infoForm.location" :disabled="isDisabled" autocomplete="off"/>
|
<el-input v-model="infoForm.location" :disabled="isDisabled" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -49,9 +44,6 @@
|
||||||
<el-form-item :label-width="formLabelWidth" label="重伤人数" prop="seriouslyInjured">
|
<el-form-item :label-width="formLabelWidth" label="重伤人数" prop="seriouslyInjured">
|
||||||
<el-input v-model="infoForm.seriouslyInjured" :disabled="isDisabled" type="number" autocomplete="off"/>
|
<el-input v-model="infoForm.seriouslyInjured" :disabled="isDisabled" type="number" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label-width="formLabelWidth" label="事件起因" prop="cause">
|
|
||||||
<el-input v-model="infoForm.cause" :disabled="isDisabled" autocomplete="off"/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label-width="formLabelWidth" label="事件概述" prop="summary">
|
<el-form-item :label-width="formLabelWidth" label="事件概述" prop="summary">
|
||||||
<el-input v-model="infoForm.summary" :disabled="isDisabled" autocomplete="off"/>
|
<el-input v-model="infoForm.summary" :disabled="isDisabled" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
@ -67,17 +59,6 @@
|
||||||
<el-form-item :label-width="formLabelWidth" label="填表人" prop="creator">
|
<el-form-item :label-width="formLabelWidth" label="填表人" prop="creator">
|
||||||
<el-input v-model="infoForm.creator" :disabled="isDisabled" autocomplete="off"/>
|
<el-input v-model="infoForm.creator" :disabled="isDisabled" autocomplete="off"/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label-width="formLabelWidth" label="报出日期" prop="reportDate">
|
|
||||||
<el-date-picker
|
|
||||||
v-model="infoForm.reportDate"
|
|
||||||
:disabled="isDisabled"
|
|
||||||
type="datetime"
|
|
||||||
placeholder="请选择报出日期"
|
|
||||||
style="width: 100%;"
|
|
||||||
format="yyyy-MM-dd HH:mm:ss"
|
|
||||||
value-format="yyyy-MM-dd HH:mm:ss"
|
|
||||||
/>
|
|
||||||
</el-form-item>
|
|
||||||
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
<el-form-item :label-width="formLabelWidth" label="事故照片" prop="fileList">
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="upload"
|
ref="upload"
|
||||||
|
@ -98,7 +79,7 @@
|
||||||
<i class="el-icon-plus"/>
|
<i class="el-icon-plus"/>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="!isDisabled" :label-width="formLabelWidth" label="附件" prop="fileAddressList">
|
<el-form-item :label-width="formLabelWidth" label="附件" prop="fileAddressList">
|
||||||
<el-upload
|
<el-upload
|
||||||
ref="upload"
|
ref="upload"
|
||||||
:disabled="isDisabled"
|
:disabled="isDisabled"
|
||||||
|
@ -108,6 +89,7 @@
|
||||||
:limit="limitNum"
|
:limit="limitNum"
|
||||||
:on-remove="handleRemoveAnnex"
|
:on-remove="handleRemoveAnnex"
|
||||||
:before-upload="beforeEventUpload"
|
:before-upload="beforeEventUpload"
|
||||||
|
:on-preview="handleDownloadAnnex"
|
||||||
:on-error="handleError"
|
:on-error="handleError"
|
||||||
:on-exceed="handleExceed"
|
:on-exceed="handleExceed"
|
||||||
name="file"
|
name="file"
|
||||||
|
@ -116,14 +98,6 @@
|
||||||
<el-button :disabled="isDisabled" size="small" type="primary">点击上传</el-button>
|
<el-button :disabled="isDisabled" size="small" type="primary">点击上传</el-button>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item v-if="isDisabled" :label-width="formLabelWidth" label="附件" prop="fileAddressList">
|
|
||||||
<a
|
|
||||||
v-if="infoForm.fileAddressList != null && infoForm.fileAddressList.length !== 0"
|
|
||||||
:href="infoForm.fileAddressList[0].url"
|
|
||||||
style="display: flex;flex-wrap: wrap;gap: 10px;"
|
|
||||||
|
|
||||||
>{{ infoForm.fileAddressList[0].name }}</a>
|
|
||||||
</el-form-item>
|
|
||||||
</el-form>
|
</el-form>
|
||||||
|
|
||||||
<el-dialog :visible.sync="dialogImgVisible">
|
<el-dialog :visible.sync="dialogImgVisible">
|
||||||
|
@ -168,15 +142,13 @@ export default {
|
||||||
injured: null, // 受伤人数
|
injured: null, // 受伤人数
|
||||||
fatalities: null, // 死亡人数
|
fatalities: null, // 死亡人数
|
||||||
seriouslyInjured: null, // 重伤人数
|
seriouslyInjured: null, // 重伤人数
|
||||||
cause: '', // 事件起因
|
|
||||||
summary: '', // 事件概述
|
summary: '', // 事件概述
|
||||||
fileList: [], // 事件照片
|
fileList: [], // 事件照片
|
||||||
fileAddressList: [], // 附件地址
|
fileAddressList: [], // 附件地址
|
||||||
analysis: '', // 原因分析及责任认定
|
analysis: '', // 原因分析及责任认定
|
||||||
suggestions: '', // 考核建议
|
suggestions: '', // 考核建议
|
||||||
measures: '', // 整改措施
|
measures: '', // 整改措施
|
||||||
creator: '', // 填表人
|
creator: '' // 填表人
|
||||||
reportDate: null // 报出日期
|
|
||||||
},
|
},
|
||||||
formLabelWidth: '140px',
|
formLabelWidth: '140px',
|
||||||
/** 事件类型 */
|
/** 事件类型 */
|
||||||
|
@ -185,7 +157,7 @@ export default {
|
||||||
incidentLevels: [],
|
incidentLevels: [],
|
||||||
tableName: '',
|
tableName: '',
|
||||||
/** 图片上传限制个数 */
|
/** 图片上传限制个数 */
|
||||||
limitNum: 1,
|
limitNum: 6,
|
||||||
/** 预览弹窗 */
|
/** 预览弹窗 */
|
||||||
dialogImgVisible: false,
|
dialogImgVisible: false,
|
||||||
rules: {
|
rules: {
|
||||||
|
@ -195,14 +167,12 @@ export default {
|
||||||
incidentNature: [{ required: true, message: '事件性质不能为空', trigger: 'blur' }],
|
incidentNature: [{ required: true, message: '事件性质不能为空', trigger: 'blur' }],
|
||||||
location: [{ required: true, message: '事件发生地点不能为空', trigger: 'blur' }],
|
location: [{ required: true, message: '事件发生地点不能为空', trigger: 'blur' }],
|
||||||
incidentDate: [{ required: true, message: '事件发生时间不能为空', trigger: 'blur' }],
|
incidentDate: [{ required: true, message: '事件发生时间不能为空', trigger: 'blur' }],
|
||||||
cause: [{ required: true, message: '事件起因不能为空', trigger: 'blur' }],
|
|
||||||
summary: [{ required: true, message: '事件概述不能为空', trigger: 'blur' }],
|
summary: [{ required: true, message: '事件概述不能为空', trigger: 'blur' }],
|
||||||
fileList: [{ required: true, message: '事件照片不能为空', trigger: 'blur' }],
|
fileList: [{ required: true, message: '事件照片不能为空', trigger: 'blur' }],
|
||||||
analysis: [{ required: true, message: '原因分析及责任认定不能为空', trigger: 'blur' }],
|
analysis: [{ required: true, message: '原因分析及责任认定不能为空', trigger: 'blur' }],
|
||||||
suggestions: [{ required: true, message: '考核建议不能为空', trigger: 'blur' }],
|
suggestions: [{ required: true, message: '考核建议不能为空', trigger: 'blur' }],
|
||||||
measures: [{ required: true, message: '整改措施不能为空', trigger: 'blur' }],
|
measures: [{ required: true, message: '整改措施不能为空', trigger: 'blur' }],
|
||||||
creator: [{ required: true, message: '填表人不能为空', trigger: 'blur' }],
|
creator: [{ required: true, message: '填表人不能为空', trigger: 'blur' }]
|
||||||
reportDate: [{ required: true, message: '报出日期不能为空', trigger: 'blur' }]
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -220,32 +190,36 @@ export default {
|
||||||
if (id == null || id === '') {
|
if (id == null || id === '') {
|
||||||
this.infoForm = this.$options.data().infoForm
|
this.infoForm = this.$options.data().infoForm
|
||||||
} else {
|
} else {
|
||||||
// 若有数据项的ID, 则请求接口并回显表单
|
|
||||||
requestFN('/accident/' + id, {}).then((data) => {
|
requestFN('/accident/' + id, {}).then((data) => {
|
||||||
|
const fileList = []
|
||||||
|
if (data.info.photos != null && data.info.photos !== '') {
|
||||||
|
JSON.parse(data.info.photos).map((item) => {
|
||||||
|
fileList.push({
|
||||||
|
name: 'photo',
|
||||||
|
url: config.fileUrl + item,
|
||||||
|
remotePathName: item
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const fileAddressList = []
|
||||||
|
if (data.info.attachmentAddress != null && data.info.attachmentAddress !== '') {
|
||||||
|
const names = data.info.attachmentNames == null ? [] : JSON.parse(data.info.attachmentNames)
|
||||||
|
const address = data.info.attachmentAddress == null ? [] : JSON.parse(data.info.attachmentAddress)
|
||||||
|
for (let i = 0; i < address.length; i++) {
|
||||||
|
fileAddressList.push({
|
||||||
|
name: names[i] || '附件',
|
||||||
|
url: config.fileUrl + address[i],
|
||||||
|
remotePathName: address[i]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
this.infoForm = {
|
this.infoForm = {
|
||||||
...data.info,
|
...data.info,
|
||||||
fileList: [
|
fileList: fileList,
|
||||||
{
|
fileAddressList: fileAddressList
|
||||||
name: 'photo',
|
|
||||||
url: config.fileUrl + data.info.photos,
|
|
||||||
remotePathName: data.info.photos
|
|
||||||
}
|
|
||||||
],
|
|
||||||
fileAddressList: [
|
|
||||||
{
|
|
||||||
name: '附件',
|
|
||||||
url: config.fileUrl + data.info.attachmentAddress,
|
|
||||||
remotePathName: data.info.attachmentAddress
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
const fileAddress = this.infoForm.fileAddressList[0].remotePathName
|
|
||||||
if (fileAddress == null || fileAddress === '') {
|
|
||||||
this.infoForm.fileAddressList = []
|
|
||||||
}
|
}
|
||||||
this.infoForm.incidentDate = new Date(data.info.incidentDate)
|
this.infoForm.incidentDate = new Date(data.info.incidentDate)
|
||||||
this.infoForm.reportDate = new Date(data.info.reportDate)
|
this.infoForm.reportDate = new Date(data.info.reportDate)
|
||||||
}).catch((e) => {
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -254,13 +228,13 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 文件列表移除文件时的钩子
|
* 文件列表移除文件时的钩子
|
||||||
*/
|
*/
|
||||||
handleRemovePicture(file) {
|
handleRemovePicture(file, fileList) {
|
||||||
if (file.remotePathName) {
|
if (file.remotePathName) {
|
||||||
requestFN(`/accident/delete/photos`, {
|
requestFN(`/accident/delete/photos`, {
|
||||||
path: file.remotePathName
|
path: file.remotePathName
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.result === 'success') {
|
if (res.result === 'success') {
|
||||||
this.infoForm.fileList = []
|
this.infoForm.fileList = fileList
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '文件删除成功',
|
message: '文件删除成功',
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -274,13 +248,13 @@ export default {
|
||||||
/**
|
/**
|
||||||
* 文件列表移除文件时的钩子
|
* 文件列表移除文件时的钩子
|
||||||
*/
|
*/
|
||||||
handleRemoveAnnex(file) {
|
handleRemoveAnnex(file, fileList) {
|
||||||
if (file.remotePathName) {
|
if (file.remotePathName) {
|
||||||
requestFN(`/accident/delete/photos`, {
|
requestFN(`/accident/delete/photos`, {
|
||||||
path: file.remotePathName
|
path: file.remotePathName
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.result === 'success') {
|
if (res.result === 'success') {
|
||||||
this.infoForm.fileAddressList = []
|
this.infoForm.fileAddressList = fileList
|
||||||
this.$message({
|
this.$message({
|
||||||
message: '文件删除成功',
|
message: '文件删除成功',
|
||||||
type: 'info',
|
type: 'info',
|
||||||
|
@ -299,6 +273,17 @@ export default {
|
||||||
this.dialogImageUrl = file.url
|
this.dialogImageUrl = file.url
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点击文件列表中已上传的文件时的钩子
|
||||||
|
*/
|
||||||
|
handleDownloadAnnex(file) {
|
||||||
|
var a = document.createElement('a')
|
||||||
|
var event = new MouseEvent('click')
|
||||||
|
a.download = file.name
|
||||||
|
a.href = file.url
|
||||||
|
a.dispatchEvent(event)
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传失败时的钩子处理
|
* 文件上传失败时的钩子处理
|
||||||
*/
|
*/
|
||||||
|
@ -339,14 +324,11 @@ export default {
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
upload('/accident/import/photos', formData).then((data) => {
|
upload('/accident/import/photos', formData).then((data) => {
|
||||||
if (data.result === 'success') {
|
if (data.result === 'success') {
|
||||||
this.infoForm = {
|
this.infoForm.fileList.push({
|
||||||
...this.infoForm,
|
|
||||||
fileList: [{
|
|
||||||
name: file.name,
|
name: file.name,
|
||||||
url: config.fileUrl + data.path,
|
url: config.fileUrl + data.path,
|
||||||
remotePathName: data.path
|
remotePathName: data.path
|
||||||
}]
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
|
@ -368,14 +350,11 @@ export default {
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
upload('/accident/import/photos', formData).then((data) => {
|
upload('/accident/import/photos', formData).then((data) => {
|
||||||
if (data.result === 'success') {
|
if (data.result === 'success') {
|
||||||
this.infoForm = {
|
this.infoForm.fileAddressList.push({
|
||||||
...this.infoForm,
|
|
||||||
fileAddressList: [{
|
|
||||||
name: file.name,
|
name: file.name,
|
||||||
url: config.fileUrl + data.path,
|
url: config.fileUrl + data.path,
|
||||||
remotePathName: data.path
|
remotePathName: data.path
|
||||||
}]
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
|
@ -425,29 +404,28 @@ export default {
|
||||||
* 表单确认按钮
|
* 表单确认按钮
|
||||||
*/
|
*/
|
||||||
confirm() {
|
confirm() {
|
||||||
this.$refs.form.validate(valid => {
|
this.$refs.infoForm.validate(valid => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
|
this.infoForm.incidentDate = formatDate(this.infoForm.incidentDate, 'YYYY-MM-DD HH:mm:ss')
|
||||||
this.infoForm.reportDate = formatDate(this.infoForm.reportDate, 'YYYY-MM-DD HH:mm:ss')
|
this.infoForm.reportDate = formatDate(this.infoForm.reportDate, 'YYYY-MM-DD HH:mm:ss')
|
||||||
const address = this.infoForm.fileAddressList[0]
|
|
||||||
console.log(address)
|
|
||||||
const params = {
|
const params = {
|
||||||
...this.infoForm,
|
...this.infoForm,
|
||||||
photos: this.infoForm.fileList[0].remotePathName,
|
photos: this.infoForm.fileList.map(item => item.remotePathName),
|
||||||
attachmentAddress: address == null ? '' : address.remotePathName,
|
attachmentAddress: this.infoForm.fileAddressList.map(item => item.remotePathName),
|
||||||
|
attachmentNames: this.infoForm.fileAddressList.map(item => item.name),
|
||||||
type: 1
|
type: 1
|
||||||
}
|
}
|
||||||
delete params.fileList
|
delete params.fileList
|
||||||
|
delete params.fileAddressList
|
||||||
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
requestFN('/accident' + (this.tableName === '修改' ? '/update' : '/save'), params)
|
||||||
.then((response) => {
|
.then(() => {
|
||||||
// 删除成功后的处理
|
// 删除成功后的处理
|
||||||
this.$message.success(this.tableName + '成功')
|
this.$message.success(this.tableName + '成功')
|
||||||
this.infoForm = this.$options.data().infoForm
|
this.infoForm = this.$options.data().infoForm
|
||||||
this.$parent.activeName = 'List'
|
this.$parent.activeName = 'List'
|
||||||
// eslint-disable-next-line handle-callback-err
|
}).catch(() => {
|
||||||
}).catch((error) => {
|
|
||||||
this.$message.error(this.tableName + '失败')
|
this.$message.error(this.tableName + '失败')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<a v-show="row.extension_name == '.txt'" style="color: #1e9fff" @click="goViewTxt(row.FILEPATH)">[预览]</a>
|
<a v-show="row.extension_name == '.txt'" style="color: #1e9fff" @click="goViewTxt(row.FILEPATH)">[预览]</a>
|
||||||
<a v-show="row.extension_name == '.pdf'" style="color: #1e9fff" @click="goViewPdf(row.FILEPATH)">[预览]</a>
|
<a v-show="row.extension_name == '.pdf'" style="color: #1e9fff" @click="goViewPdf(row.FILEPATH)">[预览]</a>
|
||||||
<a v-show="row.extension_name == '.mp4'" style="color: #1e9fff" @click="goViewVideo(row.FILEPATH)">[预览]</a>
|
<a v-show="row.extension_name == '.mp4'" style="color: #1e9fff" @click="goViewVideo(row.FILEPATH)">[预览]</a>
|
||||||
|
<a v-show="row.extension_name == '.jpg' || row.extension_name == '.jpeg' || row.extension_name == '.png'" style="color: #1e9fff" @click="goViewImg(row.FILEPATH)">[预览]</a>
|
||||||
<a v-show="row.extension_name == '.doc' || row.extension_name == '.xls' || row.extension_name == '.ppt' || row.extension_name == '.docx' || row.extension_name == '.xlsx' || row.extension_name == '.pptx'" style="color: #1e9fff" @click="goOffice(row.FILEPATH)">[下載]</a>
|
<a v-show="row.extension_name == '.doc' || row.extension_name == '.xls' || row.extension_name == '.ppt' || row.extension_name == '.docx' || row.extension_name == '.xlsx' || row.extension_name == '.pptx'" style="color: #1e9fff" @click="goOffice(row.FILEPATH)">[下載]</a>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
@ -82,12 +83,12 @@
|
||||||
<el-input v-model="form.NAME" placeholder="这里输入名称..." />
|
<el-input v-model="form.NAME" placeholder="这里输入名称..." />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="附件">
|
<el-form-item label="附件">
|
||||||
<span v-if="form.FFILE">{{ form.FFILE.name }}</span>
|
|
||||||
<el-upload
|
<el-upload
|
||||||
:before-upload="beforeFileUpload"
|
:before-upload="beforeFileUpload"
|
||||||
:on-change="handleChangePDF"
|
:on-change="handleChangePDF"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
accept=".pdf"
|
:limit="1"
|
||||||
|
accept=".pdf, .doc, .xls, .jpg, .png, .jpeg"
|
||||||
class="avatar-uploader"
|
class="avatar-uploader"
|
||||||
action="#">
|
action="#">
|
||||||
<el-button type="primary">上传</el-button>
|
<el-button type="primary">上传</el-button>
|
||||||
|
@ -115,7 +116,7 @@
|
||||||
:on-change="handleChangePDF2"
|
:on-change="handleChangePDF2"
|
||||||
:before-upload = "beforeFileUpload2"
|
:before-upload = "beforeFileUpload2"
|
||||||
:auto-upload="false"
|
:auto-upload="false"
|
||||||
accept=".pdf"
|
accept=".pdf, .doc, .xls, .jpg, .png, .jpeg"
|
||||||
class="upload-demo"
|
class="upload-demo"
|
||||||
action="#">
|
action="#">
|
||||||
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
|
||||||
|
@ -162,7 +163,16 @@
|
||||||
class="video-player vjs-custom-skin"/>
|
class="video-player vjs-custom-skin"/>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
<el-dialog :visible.sync="dialogViewImg" title="图片" width="600px">
|
||||||
|
<el-image
|
||||||
|
:src="imgUrl"
|
||||||
|
:preview-src-list="[imgUrl]"
|
||||||
|
style="width: 100px; height: 100px">
|
||||||
|
<div slot="error" class="image-slot">
|
||||||
|
<i class="el-icon-picture-outline"/>
|
||||||
|
</div>
|
||||||
|
</el-image>
|
||||||
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
@ -180,11 +190,14 @@ export default {
|
||||||
directives: { waves },
|
directives: { waves },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
config: config,
|
||||||
txtPre: '',
|
txtPre: '',
|
||||||
|
imgUrl: '',
|
||||||
dialogFormUpload: false,
|
dialogFormUpload: false,
|
||||||
dialogForm: false,
|
dialogForm: false,
|
||||||
listLoading: true,
|
listLoading: true,
|
||||||
treeLoading: false,
|
treeLoading: false,
|
||||||
|
dialogViewImg: false,
|
||||||
dialogBatchUpload: false,
|
dialogBatchUpload: false,
|
||||||
add: false,
|
add: false,
|
||||||
del: false,
|
del: false,
|
||||||
|
@ -259,7 +272,10 @@ export default {
|
||||||
this.urlToBlob()
|
this.urlToBlob()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
goViewImg(filePath) {
|
||||||
|
this.imgUrl = this.config.fileUrl + filePath
|
||||||
|
this.dialogViewImg = true
|
||||||
|
},
|
||||||
urlToBlob() {},
|
urlToBlob() {},
|
||||||
// 上一页
|
// 上一页
|
||||||
prePage() {
|
prePage() {
|
||||||
|
@ -321,20 +337,18 @@ export default {
|
||||||
console.log(file)
|
console.log(file)
|
||||||
},
|
},
|
||||||
handleChangePDF(file, fileList) {
|
handleChangePDF(file, fileList) {
|
||||||
const types = ['application/pdf']
|
const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg']
|
||||||
const isImage = types.includes(file.raw.type)
|
if (!types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) {
|
||||||
if (!isImage) {
|
this.$message.error('上传文件只支持【' + types + '】格式!')
|
||||||
this.$message.error('上传文件只能是 PDF 格式!')
|
|
||||||
fileList.pop()
|
fileList.pop()
|
||||||
} else {
|
} else {
|
||||||
this.form.FFILE = file.raw
|
this.form.FFILE = file.raw
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleChangePDF2(file, fileList) {
|
handleChangePDF2(file, fileList) {
|
||||||
const types = ['application/pdf']
|
const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg']
|
||||||
const isImage = types.includes(file.raw.type)
|
if (!types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) {
|
||||||
if (!isImage) {
|
this.$message.error('上传文件只支持【' + types + '】格式!')
|
||||||
this.$message.error('上传文件只能是 PDF 格式!')
|
|
||||||
fileList.pop()
|
fileList.pop()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -355,23 +369,21 @@ export default {
|
||||||
// return false
|
// return false
|
||||||
// },
|
// },
|
||||||
beforeFileUpload2(file) {
|
beforeFileUpload2(file) {
|
||||||
var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
|
const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg']
|
||||||
const extension = testmsg === 'pdf'
|
if (types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) {
|
||||||
if (!extension) {
|
|
||||||
this.$confirm(`上传文件只能是pdf格式!`)
|
|
||||||
} else {
|
|
||||||
this.fileList.push(file)
|
this.fileList.push(file)
|
||||||
|
} else {
|
||||||
|
this.$confirm('上传文件只支持【' + types + '】格式!')
|
||||||
}
|
}
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
beforeFileUpload(file) {
|
beforeFileUpload(file) {
|
||||||
var testmsg = file.name.substring(file.name.lastIndexOf('.') + 1)
|
const types = ['pdf', 'doc', 'xls', 'jpg', 'png', 'jpeg']
|
||||||
const extension = testmsg === 'pdf'
|
if (types.includes(file.name.substring(file.name.lastIndexOf('.') + 1))) {
|
||||||
if (!extension) {
|
|
||||||
this.$confirm(`上传文件只能是pdf格式!`)
|
|
||||||
} else {
|
|
||||||
this.form.FFILE = file
|
this.form.FFILE = file
|
||||||
|
} else {
|
||||||
|
this.$confirm('上传文件只支持【' + types + '】格式!')
|
||||||
}
|
}
|
||||||
this.$forceUpdate()
|
this.$forceUpdate()
|
||||||
return false
|
return false
|
||||||
|
|
Loading…
Reference in New Issue