xwt
2025-08-07 27294f1626cdb785fe4c7401dde3266db188ccf4
来料检修改,附件图片放大
已修改5个文件
327 ■■■■ 文件已修改
manifest.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/LLJ/Add.vue 129 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/fileView/imageView.vue 97 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/fileView/jpgView.vue 95 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
store/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json
@@ -2,7 +2,7 @@
    "name" : "GS-MES-AP",
    "appid" : "__UNI__F08FAE3",
    "description" : "",
    "versionName" : "1.1.2.9",
    "versionName" : "1.1.3.0",
    "versionCode" : 1,
    "transformPx" : false,
    /* 5+App特有相关 */
pages/QC/LLJ/Add.vue
@@ -284,7 +284,14 @@
                    
                    <!-- 图片内容预览 -->
                    <view v-else-if="previewType === 'image'" class="image-preview-container">
                        <image :src="previewContent" mode="widthFix" style="width: 100%; max-height: 400px;"></image>
                        <image
                            :src="previewContent"
                            mode="aspectFit"
                            class="preview-image-clickable"
                            @click="previewImageInPopup"
                            style="width: 100%; max-height: 400px; cursor: pointer;"
                        />
                        <div class="image-zoom-hint">点击图片可放大查看</div>
                    </view>
                    
                    <!-- Excel 等 Office 文件提示 -->
@@ -484,7 +491,8 @@
            addDefectDescription() {
                // 添加不良描述的逻辑
                this.remarksPopup = !this.remarksPopup;
                this.remarks = this.formData.remarks;
                this.remarks = this.formData.remarks || this.remarks || '';
                console.log('打开弹窗时的remarks值:', this.remarks);
            },
            submitInspection() {
                if (this.PSTYPE == '') {
@@ -684,10 +692,12 @@
                        this.badreason = data.blyy || '';
                        this.PSTYPE = data.pszt || '';
                        this.WORKSHOP = data.sscj || '';
                        console.log('赋值后', this.badreason, this.PSTYPE, this.WORKSHOP);
                        this.remarks = data.remarks || ''; // 设置remarks变量
                        
                        // 确保PHSY字段被正确设置
                        this.formData.PHSY = data.PHSY;
                        this.PHSY = data.PHSY || ''; // 同时设置页面绑定的PHSY变量
                        
                        console.log("加载的紧急放行状态:", this.formData.emergencyStatus);
                        this.$post({
@@ -741,27 +751,7 @@
                    url: 'SysSubmitFrom?releaseNo=' + releaseNo + '&userID=' + this.$loginInfo.account
                });
            },
            editRemarks() {
                // 保存不良描述
                this.$post({
                    url: "/LLJ/saveRemarksGid",
                    data: {
                        gid: this.formData.id,
                        remarks: this.remarks || '',
                        releaseNo: this.formData.releaseNo
                        // 不再包含PHSY字段
                    }
                }).then(res => {
                    if (res.data.tbBillList > 0) {
                        this.formData.remarks = this.remarks;
                        this.remarksPopup = !this.remarksPopup;
                        this.$showMessage("保存成功");
                        setTimeout(() => {
                            this.init();
                        }, 2000);
                    }
                })
            },
            drawingConfirm() {
                this.drawingShow = false
@@ -1244,14 +1234,12 @@
                        });
                    },
                    editRemarks() {
                        // 保存不良描述
                        this.$post({
                            url: "/LLJ/saveRemarksGid",
                            data: {
                                gid: this.formData.id,
                                remarks: this.remarks || '',
                                releaseNo: this.formData.releaseNo
                                // 不再包含PHSY字段
                            }
                        }).then(res => {
                            if (res.data.tbBillList > 0) {
@@ -1271,10 +1259,8 @@
                this.isInteger = true;
            },
            editDestruction() {
                // 验证输入是否为整数
                if(this.PHSY === '') {
                    this.isInteger = true;
                    // 如果为空,传递空字符串,后端会处理为null
                } else {
                    const isInteger = /^-?\d+$/.test(this.PHSY);
                    this.isInteger = isInteger;
@@ -1282,21 +1268,16 @@
                        return;
                    }
                }
                // 保存破坏实验数量,并带上不良原因、所属车间、评审状态
                this.$post({
                    url: "/LLJ/saveRemarksGid",
                    url: "/LLJ/savePhsyGid",
                    data: {
                        gid: this.formData.id,
                        releaseNo: this.formData.releaseNo,
                        PHSY: this.PHSY, // 可以是空字符串或有效整数
                        BLYY: this.badreason,
                        SSCJ: this.WORKSHOP,
                        PSZT: this.PSTYPE
                        PHSY: this.PHSY
                    }
                }).then(res => {
                    if (res.data.tbBillList > 0) {
                        // 如果输入为空,设置为null以便不显示
                        this.formData.PHSY = this.PHSY === '' ? null : this.PHSY;
                        this.destructionPopup = false;
                        this.$showMessage("保存成功");
@@ -1307,21 +1288,17 @@
                })
            },
            clearDestruction() {
                // 清除破坏实验数量
                this.PHSY = '';
                this.$post({
                    url: "/LLJ/saveRemarksGid",
                    url: "/LLJ/savePhsyGid",
                    data: {
                        gid: this.formData.id,
                        releaseNo: this.formData.releaseNo,
                        PHSY: '', // 空字符串,后端会处理为null
                        BLYY: this.badreason,
                        SSCJ: this.WORKSHOP,
                        PSZT: this.PSTYPE
                        PHSY: ''
                    }
                }).then(res => {
                    if (res.data.tbBillList > 0) {
                        this.formData.PHSY = null; // 确保前端也为null,不显示
                        this.formData.PHSY = null;
                        this.destructionPopup = false;
                        this.$showMessage("清除成功");
                        setTimeout(() => {
@@ -1557,6 +1534,36 @@
                const item = { fattach: this.previewTitle, itemNo: this.previewItemNo };
                this.downloadAttachment(item);
                this.closeFilePreview();
            },
            // 在弹窗中预览图片(放大功能)
            previewImageInPopup() {
                // 使用uni.previewImage API实现图片放大预览
                uni.previewImage({
                    current: this.previewContent, // 当前显示图片的链接
                    urls: [this.previewContent], // 需要预览的图片链接列表
                    loop: false, // 是否开启图片轮播
                    indicator: 'default', // 图片指示器类型
                    longPressActions: {
                        itemList: ['发送给朋友', '保存图片', '收藏'],
                        success: function (data) {
                            console.log('选中了第' + (data.tapIndex + 1) + '个按钮');
                        },
                        fail: function (err) {
                            console.log(err.errMsg);
                        }
                    },
                    success: () => {
                        console.log('图片预览成功');
                    },
                    fail: (err) => {
                        console.error('图片预览失败:', err);
                        uni.showToast({
                            title: '图片预览失败',
                            icon: 'none'
                        });
                    }
                });
            },
            
            // 预览Office文件
@@ -1867,14 +1874,13 @@
            },
            saveRemarksGid() {
              this.$post({
                url: "/LLJ/saveRemarksGid",
                url: "/LLJ/saveDropdownFields",
                data: {
                  gid: this.formData.id,
                  releaseNo: this.formData.releaseNo,
                  BLYY: this.badreason,
                  SSCJ: this.WORKSHOP,
                  PSZT: this.PSTYPE,
                  PHSY: this.PHSY // 新增,保证破坏实验数不会被刷掉
                  BLYY: this.badreason || '',
                  SSCJ: this.WORKSHOP || '',
                  PSZT: this.PSTYPE || ''
                }
              }).then(res => {
                if (res.data.tbBillList > 0) {
@@ -2578,4 +2584,31 @@
            overflow-x: auto;
        }
    }
    /* 图片放大预览相关样式 */
    .preview-image-clickable {
        transition: transform 0.2s ease;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    .preview-image-clickable:hover {
        transform: scale(1.02);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    .image-zoom-hint {
        text-align: center;
        margin-top: 8px;
        font-size: 12px;
        color: #666;
        font-style: italic;
    }
    .image-preview-container {
        position: relative;
        display: flex;
        flex-direction: column;
        align-items: center;
    }
</style>
pages/fileView/imageView.vue
@@ -1,7 +1,18 @@
<template>
  <view class="container">
    <!-- 使用 <image> 组件显示图片 -->
    <image :src="imageUrl" mode="widthFix" style="width: 100%;"></image>
    <!-- 使用 <image> 组件显示图片,添加点击事件 -->
    <image
      :src="imageUrl"
      mode="aspectFit"
      class="preview-image"
      @click="previewImage"
      :style="{ width: '100%', height: '100%' }"
    />
    <!-- 放大提示 -->
    <view class="zoom-hint">
      <text class="hint-text">点击图片可放大查看</text>
    </view>
  </view>
</template>
@@ -9,13 +20,44 @@
export default {
  data() {
    return {
      imageUrl: "" ,// 用于存储图片的 URL
      imageUrl: "", // 用于存储图片的 URL
    };
  },
  onLoad(options) {
    // 从页面跳转的参数中获取图片 URL
    if (options.url) {
      this.imageUrl = decodeURIComponent(options.url);
    }
  },
  methods: {
    // 图片放大预览
    previewImage() {
      // 使用uni.previewImage API实现图片放大预览
      uni.previewImage({
        current: this.imageUrl, // 当前显示图片的链接
        urls: [this.imageUrl], // 需要预览的图片链接列表
        loop: false, // 是否开启图片轮播
        indicator: 'default', // 图片指示器类型
        longPressActions: {
          itemList: ['发送给朋友', '保存图片', '收藏'],
          success: function (data) {
            console.log('选中了第' + (data.tapIndex + 1) + '个按钮');
          },
          fail: function (err) {
            console.log(err.errMsg);
          }
        },
        success: () => {
          console.log('图片预览成功');
        },
        fail: (err) => {
          console.error('图片预览失败:', err);
          uni.showToast({
            title: '图片预览失败',
            icon: 'none'
          });
        }
      });
    }
  }
};
@@ -24,8 +66,57 @@
<style scoped>
.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #000;
  position: relative;
}
.preview-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.preview-image:hover {
  transform: scale(1.02);
}
.zoom-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10;
}
.hint-text {
  color: #fff;
  font-size: 12px;
}
/* 响应式设计 */
@media (max-width: 768px) {
  .preview-image {
    max-height: 70vh;
  }
  .zoom-hint {
    bottom: 10px;
    padding: 6px 12px;
  }
  .hint-text {
    font-size: 11px;
  }
}
</style>
pages/fileView/jpgView.vue
@@ -1,7 +1,18 @@
<template>
  <view class="container">
    <!-- 使用 <image> 组件显示图片 -->
    <image :src="imageUrl" mode="widthFix" style="width: 100%;"></image>
    <!-- 使用 <image> 组件显示图片,添加点击事件 -->
    <image
      :src="imageUrl"
      mode="aspectFit"
      class="preview-image"
      @click="previewImage"
      :style="{ width: '100%', height: '100%' }"
    />
    <!-- 放大提示 -->
    <view class="zoom-hint">
      <text class="hint-text">点击图片可放大查看</text>
    </view>
  </view>
</template>
@@ -17,6 +28,37 @@
    if (options.url) {
      this.imageUrl = decodeURIComponent(options.url);
    }
  },
  methods: {
    // 图片放大预览
    previewImage() {
      // 使用uni.previewImage API实现图片放大预览
      uni.previewImage({
        current: this.imageUrl, // 当前显示图片的链接
        urls: [this.imageUrl], // 需要预览的图片链接列表
        loop: false, // 是否开启图片轮播
        indicator: 'default', // 图片指示器类型
        longPressActions: {
          itemList: ['发送给朋友', '保存图片', '收藏'],
          success: function (data) {
            console.log('选中了第' + (data.tapIndex + 1) + '个按钮');
          },
          fail: function (err) {
            console.log(err.errMsg);
          }
        },
        success: () => {
          console.log('图片预览成功');
        },
        fail: (err) => {
          console.error('图片预览失败:', err);
          uni.showToast({
            title: '图片预览失败',
            icon: 'none'
          });
        }
      });
    }
  }
};
</script>
@@ -24,8 +66,57 @@
<style scoped>
.container {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: #000;
  position: relative;
}
.preview-image {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  cursor: pointer;
  transition: transform 0.2s ease;
}
.preview-image:hover {
  transform: scale(1.02);
}
.zoom-hint {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: white;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 10;
}
.hint-text {
  color: #fff;
  font-size: 12px;
}
/* 响应式设计 */
@media (max-width: 768px) {
  .preview-image {
    max-height: 70vh;
  }
  .zoom-hint {
    bottom: 10px;
    padding: 6px 12px;
  }
  .hint-text {
    font-size: 11px;
  }
}
</style>
store/index.js
@@ -10,9 +10,9 @@
            networkFlag:'内网', 
            serverURLInt:'http://192.168.11.251:10055',//服务器体检 10.0.1.104:10054
            serverURL:'http://localhost:10055',//本地调试地址
            //serverAPI:'http://localhost:5184/api',//当前正在使用的服务器,默认为外网  localhost
            serverAPI:'http://localhost:5184/api',//当前正在使用的服务器,默认为外网  localhost
            //serverAPI:'http://192.168.1.22:10054/api',//内网 
            serverAPI:'http://36.26.21.214:10055/api',
            //serverAPI:'http://36.26.21.214:10055/api',
            ftpServer:'ftp://36.26.21.214',//FTP服务器地址
        }
    },