南骏 池
2025-03-22 85c83ac4dff8c054d31d50cd0ab8803c202b55ce
H5/Js/LLJ/Add.js
@@ -280,7 +280,7 @@
                                }
                            });
                            that.tableData = tableData;
                            that.GetImageFileByGid();
                            //if (that.tableData.length === 0) {
                            //    that.isShowTable = true;
                            //}
@@ -405,6 +405,7 @@
        async afterRead(file) {
            try {
                //alert(APIURL_IMAGE);
                // 1. 显示上传中状态
                file.status = 'uploading';
                file.message = '上传中...';
@@ -456,6 +457,30 @@
                // 8. 强制更新视图(Vant 3+ 可能需要)
                this.$nextTick();
            }
        }
        },
        //获取图片信息
        GetImageFileByGid() {
            const that = this;
            that.AxiosHttp("post", 'Llj/getImage', {
                gid: that.formData.guid,
                Remarks: that.remarks
            }, true, 0).then(res1 => {
                if (res1.status === 0) {
                    // 关键转换:将后端数据转换为 van-uploader 需要的格式
                    that.fileList = res1.data.tbBillList.map(item => ({
                        url: `${APIURL_IMAGE}/${item.urlPath}`,  // 拼接完整访问路径
                        status: 'done',          // 标记为已上传成功
                        name: item.fileTitle,    // 可选显示文件名
                        message: '已上传',        // 可选状态文字
                        // 保留原始数据(按需)
                        id: item.guid
                    }));
                } else {
                    that.$toast.fail(res1.rtnMsg);
                }
            }).catch(error => {
                that.$toast.fail("网络错误,请重试!");
            });
        },
    }
})