From 313a58d5dd241ab3a73da4ba3bcdc9c1a03b014b Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期三, 15 十月 2025 16:26:54 +0800
Subject: [PATCH] bug修改,新增用户取消销售人员必填校验,新增学员取消体测表必填校验

---
 cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit.html |   50 +++++++++++++++++++++++++++++++-------------------
 1 files changed, 31 insertions(+), 19 deletions(-)

diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit.html
index 4e76b09..c9fd3c0 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_edit.html
@@ -125,7 +125,8 @@
                                     accept="."
                                     :file-list="imageUrl2"
                                     :on-success="handleAvatarSuccess"
-                                    :on-remove="handleRemove">
+                                    :on-remove="handleRemove"
+                                    :before-upload="beforeAvatarUpload">
                                 <i class="el-icon-plus"></i>
                             </el-upload>
                             <el-dialog :visible.sync="dialogVisible">
@@ -136,7 +137,7 @@
 
                 </div>
             </div>
-            <#input id="ids" name="添加入园闸机" type="text" value="${item.ids}"/>
+            <!--<#input id="ids" name="添加入园闸机" type="text" value="${item.ids}"/>-->
 
         </div>
         <div class="row btn-group-m-t">
@@ -211,24 +212,14 @@
         },
         methods: {
             handleAvatarSuccess(res, file) {
-                file.url =file.response
-                TCarInfoDlg.goodsPicArray.push(file);
-                console.log(TCarInfoDlg.goodsPicArray)
-            },
-            changeImg(){
-               var i = id.split(",")
-                for (let j = 0; j <i.length; j++) {
-                    let obj={
-                        fileName:i[j],
-                        uuid:i[j],
-                        url:i[j],
-                        response:i[j],
-                    }
-                    this.imageUrl2.push(obj)
-
+                // 确保文件对象有完整的结构
+                if (file && file.response) {
+                    file.url = file.response;
                 }
-                console.log( this.imageUrl2,111)
+                TCarInfoDlg.goodsPicArray.push(file.url);
+                console.log(TCarInfoDlg.goodsPicArray);
             },
+            // 添加 beforeUpload 钩子到 el-upload 组件
             beforeAvatarUpload(file) {
                 const isLt2M = file.size / 1024 / 1024 < 10;
                 if (!isLt2M) {
@@ -236,11 +227,32 @@
                 }
                 return isLt2M;
             },
+            // 修改 handleRemove 方法
             handleRemove(file, fileList) {
+                // 使用更安全的方式过滤
                 TCarInfoDlg.goodsPicArray = TCarInfoDlg.goodsPicArray.filter(item => {
-                    return item.uid != file.uid;
+                    // 如果是文件对象,比较 uid;如果是字符串,比较值
+                    if (typeof item === 'object' && item !== null) {
+                        return item.uid !== file.uid;
+                    } else {
+                        return item !== file.url;
+                    }
                 });
+            },
+            changeImg(){
+                if (!id) return; // 如果没有图片数据则返回
 
+                var i = id.split(",").filter(url => url.trim() !== ''); // 过滤空字符串
+                for (let j = 0; j < i.length; j++) {
+                    let obj = {
+                        uid: 'existing-' + j + '-' + Date.now(), // 确保 uid 是唯一的字符串
+                        name: 'image-' + j + '.jpg', // 添加 name 属性
+                        url: i[j],
+                        status: 'success' // 标记为已上传状态
+                    };
+                    this.imageUrl2.push(obj);
+                }
+                console.log(this.imageUrl2, 111);
             },
         },
         created() {

--
Gitblit v1.7.1