From d2c276d37c5ad5eefa00eeebe6b30186bcce2d19 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期五, 14 二月 2025 10:09:01 +0800 Subject: [PATCH] 流程推进详情表头调整 --- src/components/FileUpload/index.vue | 27 ++++++++++++++++----------- 1 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue index 12ad4ea..2cb9b1b 100644 --- a/src/components/FileUpload/index.vue +++ b/src/components/FileUpload/index.vue @@ -2,6 +2,7 @@ <div class="upload-file"> <el-upload multiple + :accept="acceptList" :action="uploadFileUrl" :before-upload="handleBeforeUpload" :file-list="fileList" @@ -15,7 +16,7 @@ ref="fileUpload" > <!-- 涓婁紶鎸夐挳 --> - <el-button size="mini" type="primary">閫夊彇鏂囦欢</el-button> + <el-button icon="el-icon-upload2" size="small" type="primary">涓婁紶</el-button> <!-- 涓婁紶鎻愮ず --> <div class="el-upload__tip" slot="tip" v-if="showTip"> 璇蜂笂浼� @@ -55,7 +56,7 @@ // 澶у皬闄愬埗(MB) fileSize: { type: Number, - default: 5, + default: 20, }, // 鏂囦欢绫诲瀷, 渚嬪['png', 'jpg', 'jpeg'] fileType: { @@ -109,6 +110,11 @@ showTip() { return this.isShowTip && (this.fileType || this.fileSize); }, + acceptList () { + let temp = '.*' + temp = this.fileType.map(item => '.' + item).join(',') + return temp + } }, methods: { // 涓婁紶鍓嶆牎妫�鏍煎紡鍜屽ぇ灏� @@ -119,14 +125,9 @@ const fileExt = fileName[fileName.length - 1]; const isTypeOk = this.fileType.indexOf(fileExt) >= 0; if (!isTypeOk) { - this.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭紝璇蜂笂浼�${this.fileType.join("/")}鏍煎紡鏂囦欢!`); + this.$modal.msgError(`鏂囦欢鏍煎紡涓嶆纭�, 璇蜂笂浼�${this.fileType.join("/")}鏍煎紡鏂囦欢!`); return false; } - } - // 鏍℃鏂囦欢鍚嶆槸鍚﹀寘鍚壒娈婂瓧绗� - if (file.name.includes(',')) { - this.$modal.msgError('鏂囦欢鍚嶄笉姝g‘锛屼笉鑳藉寘鍚嫳鏂囬�楀彿!'); - return false; } // 鏍℃鏂囦欢澶у皬 if (this.fileSize) { @@ -152,7 +153,7 @@ // 涓婁紶鎴愬姛鍥炶皟 handleUploadSuccess(res, file) { if (res.code === 200) { - this.uploadList.push({ name: res.fileName, url: res.fileName }); + this.uploadList.push({ name: res.newFileName, originalName: res.originalFilename , url: res.fileName }); this.uploadedSuccessfully(); } else { this.number--; @@ -165,7 +166,9 @@ // 鍒犻櫎鏂囦欢 handleDelete(index) { this.fileList.splice(index, 1); - this.$emit("input", this.listToString(this.fileList)); + // this.$emit("input", this.listToString(this.fileList)); + //淇敼涓鸿繑鍥炴暟缁� + this.$emit("input", this.fileList); }, // 涓婁紶缁撴潫澶勭悊 uploadedSuccessfully() { @@ -173,7 +176,9 @@ this.fileList = this.fileList.concat(this.uploadList); this.uploadList = []; this.number = 0; - this.$emit("input", this.listToString(this.fileList)); + // this.$emit("input", this.listToString(this.fileList)); + //淇敼涓鸿繑鍥炴暟缁� + this.$emit("input", this.fileList); this.$modal.closeLoading(); } }, -- Gitblit v1.8.0