b8917a94 by renchao@pashanhoo.com

style:上传

1 parent e4ec2bfe
1 <!-- 1 <!--
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-07-31 15:12:08 4 * @LastEditTime: 2023-07-31 15:43:30
5 --> 5 -->
6 <template> 6 <template>
7 <div class="rlPopup"> 7 <div class="rlPopup">
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
23 <div class="thumb-wrap"> 23 <div class="thumb-wrap">
24 <div class="thumb-wrap-button"> 24 <div class="thumb-wrap-button">
25 <el-button type="primary" @click="clickImage" v-if="previewImg.imgList.length>0">(放大) 显示(缩小)</el-button> 25 <el-button type="primary" @click="clickImage" v-if="previewImg.imgList.length>0">(放大) 显示(缩小)</el-button>
26 <el-upload class="fileUpdate" ref="upload" action="" :show-file-list="false" :multiple="true" :auto-upload="false" 26 <el-upload class="fileUpdate" ref="upload" :key="key" action="" :show-file-list="false" :multiple="true" :auto-upload="false"
27 :on-change="handleChange" 27 :on-change="handleChange"
28 accept=".JPG, .PNG, .JPEG,.jpg, .png, .jpeg" :before-upload="beforeUpload"> 28 accept=".JPG, .PNG, .JPEG,.jpg, .png, .jpeg" :before-upload="beforeUpload">
29 <el-button icon="el-icon-upload" type="primary" v-if="ableOperation">上传</el-button> 29 <el-button icon="el-icon-upload" type="primary" v-if="ableOperation">上传</el-button>
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
70 }, 70 },
71 data () { 71 data () {
72 return { 72 return {
73 key: 0,
73 isScan: false, 74 isScan: false,
74 // 打开高拍仪 75 // 打开高拍仪
75 scanTitle: '打开高拍仪', 76 scanTitle: '打开高拍仪',
...@@ -249,20 +250,23 @@ ...@@ -249,20 +250,23 @@
249 let length = fileList.length; 250 let length = fileList.length;
250 this.maxFileLength = Math.max(length, this.maxFileLength) 251 this.maxFileLength = Math.max(length, this.maxFileLength)
251 var formData = new FormData(); 252 var formData = new FormData();
252 let num = 0
253 setTimeout(() => { 253 setTimeout(() => {
254 if (this.maxFileLength !== length) { 254 if (this.maxFileLength !== length) {
255 return 255 return
256 } 256 }
257 let num = 0
257 fileList.forEach(item => { 258 fileList.forEach(item => {
258 if (!['image/jpeg', 'image/png', 'image/jpg', 'image/gif'].includes(item.raw.type)) { 259 if (!['image/jpeg', 'image/png', 'image/jpg', 'image/gif'].includes(item.raw.type)) {
259 num++ 260 num++
261 } else {
262 formData.append('file', item.raw)
260 } 263 }
261 formData.append('file', item.raw)
262 }) 264 })
263 if (num >= 1) { 265 if (num >= 1) {
264 this.$message.error("请选择jpeg/png/jpg/bmp/gif格式的图片后重试") 266 this.$message.error("请选择jpeg/png/jpg/bmp/gif格式的图片后重试")
265 return 267 // 移除不支持的文件类型
268 this.key++
269 return;
266 } 270 }
267 formData.append("bsmSj", this.previewImg.bsmSj); 271 formData.append("bsmSj", this.previewImg.bsmSj);
268 formData.append("bsmSlsq", this.previewImg.bsmSlsq); 272 formData.append("bsmSlsq", this.previewImg.bsmSlsq);
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
161 watch: { 161 watch: {
162 'formData.data': { 162 'formData.data': {
163 handler: function (val, oldVal) { 163 handler: function (val, oldVal) {
164 this.tableData = val 164 this.tableData = _.cloneDeep(val)
165 }, 165 },
166 immediate: true, 166 immediate: true,
167 deep: true 167 deep: true
......