wwl
2025-04-23 a46d77b67903398df1ebf91005385892ff91902a
回显
1个文件已修改
21 ■■■■ 已修改文件
src/views/picture/picture/index.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/picture/picture/index.vue
@@ -139,7 +139,6 @@
    </el-dialog>
  </div>
</template>
<script>
import {
  getListPicture,
@@ -310,12 +309,19 @@
      tupian(formData)
        .then(response => {
          console.log('成功了', response);
          if (response.code === 200 && response.base64) {
          if (response.code === 200) {
            this.$message.success('图片上传成功!');
            const index = this.tableList.findIndex(item => item.proId === proId);
            if (index !== -1) {
              // 保存 base64 图像用于显示
              if (response.base64) {
              const base64Image = `data:image/${fileExtension};base64,${response.base64}`;
              this.$set(this.tableList[index], 'imageUrl', base64Image);
              }
              // 保存返回的 url
              if (response.url) {
                this.$set(this.tableList[index], 'url', response.url);
              }
            }
          } else {
            this.$message.error('图片上传失败!');
@@ -537,7 +543,14 @@
      let tjNumber = val;
      this.loading = true;
      getYxJcXx(tjNumber).then((res) => {
        this.tableList = res.data;
        this.tableList = res.data.map(item => {
          // 如果 imageUrl 存在且是纯 Base64 字符串,添加 data:image 前缀
          if (item.imageUrl && !item.imageUrl.startsWith('data:image')) {
            // 假设图片类型为 png,如果接口提供类型,可以替换为动态值
            item.imageUrl = `data:image/png;base64,${item.imageUrl}`;
          }
          return item;
        });
        this.loading = false;
        this.$nextTick(() => {
          const headerCheckbox = this.$refs.mu.$el.querySelector(
@@ -678,12 +691,14 @@
      const proId = this.selectedRow.proId;
      const jcsj = this.form.proResult || " ";
      const jcjl = this.form.conclusion || " ";
      const url = this.selectedRow.url || ""; // 获取 url,如果不存在则为空字符串
      addYxJcXx({
        proId: proId,
        tjNumber: this.selectedTjNumber,
        jcsj: jcsj,
        jcjl: jcjl,
        url: url // 添加 url 参数
      })
        .then((response) => {
          this.form.proResult = "";