From 7ff7ec7b6fa80dba1175cd7c156700e503a1c803 Mon Sep 17 00:00:00 2001
From: yz <yz_0812@outlook.com>
Date: 星期二, 23 二月 2021 02:21:33 +0800
Subject: [PATCH] 增加附件删除标签判断
---
src/views/user/Informationinput.vue | 30 +++++++++++++++++++++---------
1 files changed, 21 insertions(+), 9 deletions(-)
diff --git a/src/views/user/Informationinput.vue b/src/views/user/Informationinput.vue
index a12de88..e7b1ed3 100644
--- a/src/views/user/Informationinput.vue
+++ b/src/views/user/Informationinput.vue
@@ -438,16 +438,18 @@
<el-dialog title="基本信息" :visible.sync="dialogshowArr[0].show" width="50%" class="baseinfo">
<el-container>
<el-aside width="200px">
+ <el-input v-if="false" v-model="empBaseInfoForm.file" />
<el-upload
class="avatar-uploader"
action="#"
- accept=".jpg, .jpeg, .png"
:show-file-list="false"
- auto-upload="false"
- :on-success="handleAvatarSuccess"
+ :on-change="handlePictureCardPreview"
+ :auto-upload="false"
>
- <img v-if="empBaseInfoForm.mageUrl" :src="empBaseInfoForm.imageUrl" class="avatar">
- <i v-else class="el-icon-plus avatar-uploader-icon" /></el-upload></el-aside>
+ <img v-if="empBaseInfoImageUrl" :src="empBaseInfoImageUrl" class="avatar">
+ <i v-else class="el-icon-plus avatar-uploader-icon" />
+ </el-upload>
+ </el-aside>
<el-main> <el-form ref="empBaseInfoForm" :model="empBaseInfoForm" :rules="rules" label-position="right" label-width="120px">
<el-row>
<el-col :span="12">
@@ -1841,6 +1843,7 @@
components: { Treeselect, Pagination },
data() {
return {
+ empBaseInfoImageUrl: '',
total: 0, // 总数量
queryParams: {}, // 查询参数
sort: {}, // 排序
@@ -2526,7 +2529,7 @@
version: ''
},
empBaseInfoForm: {
- imageUrl: '',
+ file: null,
empId: '',
customerId: '',
archivesNumb: '',
@@ -2607,6 +2610,18 @@
this.isShow(false, 0)
},
methods: {
+ // 图片预览
+ handlePictureCardPreview(file) {
+ const fileName = file.name
+ const regex = /(.jpg|.jpeg|.gif|.png|.bmp)$/
+ if (regex.test(fileName.toLowerCase())) {
+ var reader = new FileReader()
+ reader.readAsDataURL(file)
+ this.empBaseInfoImageUrl = URL.createObjectURL(file.raw) // 获取URL
+ } else {
+ this.$message.error('请选择图片文件')
+ }
+ },
// 翻页插件翻页方法
search() {
this.fetch({
@@ -4976,9 +4991,6 @@
},
calculateSeniority(val) {
this.empBaseInfoForm.seniority = calculateSeniority(val)
- },
- handleAvatarSuccess(res, file) {
- this.empBaseInfoForm.imageUrl = URL.createObjectURL(file.raw)
}
}
}
--
Gitblit v1.8.0