zjh
2025-08-19 0293d4f776f88ebc307a750f38a16454f4553701
首检、巡检一致性前端代码提交
已修改6个文件
已添加3个文件
703 ■■■■■ 文件已修改
manifest.json 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/Add.vue 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/List.vue 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/SJ/yzxFrom.vue 309 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/XJ/Add.vue 19 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/XJ/List.vue 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/XJ/yzxFrom.vue 309 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
static/img/bj/1738973218634.png 补丁 | 查看 | 原始文档 | blame | 历史
manifest.json
@@ -2,7 +2,7 @@
    "name" : "GS-MES-AP",
    "appid" : "__UNI__B38B152",
    "description" : "",
    "versionName" : "1.1.2.0001",
    "versionName" : "1.1.2.0002",
    "versionCode" : 1,
    "transformPx" : false,
    /* 5+App特有相关 */
pages.json
@@ -9,12 +9,12 @@
                "iconPath": "static/img/home.png",
                "selectedIconPath": "static/img/homeHL.png"
            },
            {
                "pagePath": "pages/BasePages/message",
                "text": "消息中心",
                "iconPath": "static/img/user.png",
                "selectedIconPath": "static/img/userHL.png"
            },
            // {
            //     "pagePath": "pages/BasePages/message",
            //     "text": "消息中心",
            //     "iconPath": "static/img/user.png",
            //     "selectedIconPath": "static/img/userHL.png"
            // },
            {
                "pagePath": "pages/BasePages/user",
                "text": "我的",
@@ -161,6 +161,20 @@
            }
        },
        {
            "path": "pages/QC/SJ/yzxFrom",
            "style": {
                "navigationBarTitleText": "一致性核对",
                "enablePullDownRefresh": false
            }
        },
        {
            "path": "pages/QC/XJ/yzxFrom",
            "style": {
                "navigationBarTitleText": "一致性核对",
                "enablePullDownRefresh": false
            }
        },
        {
            "path": "pages/QC/LLJ/Blms",
            "style": {
                "navigationBarTitleText": "不良描述",
pages/QC/SJ/Add.vue
@@ -130,6 +130,7 @@
    <view class="action-buttons">
      <button v-if="isUpdate && !isShowTable" class="secondary-btn" @click="save">创建检验单并生成部分默认值</button>
      <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="toImage">上传/查看图片</button>
        <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="toYzxSubmitFrom(formData.releaseNo)">一致性核对</button>
      <button v-if="!isUpdate && !formData.statusUser && !isShowTable" class="secondary-btn" @click="removeXJ">
        åˆ é™¤å•据
      </button>
@@ -207,7 +208,12 @@
    //options中包含了url附带的参数
    let params = options;
    if(params["current"]==='A')
        {
            this.current=true;
        }else if(params["current"]==='B'){
            this.current=false;
        }
    if (params["id"]) {
      this.isUpdate = false;
      this.formData.id = params["id"];
@@ -483,6 +489,11 @@
        this.isUpdate = false;
      })
    },
        toYzxSubmitFrom(releaseNo){
            uni.navigateTo({
                url: 'yzxFrom?id=' +this.formData.id+'&current='+this.current
            });
        },
    save() {
      // if (this.tableData.length === 0) {
pages/QC/SJ/List.vue
@@ -195,9 +195,18 @@
      this.init();
    },
    navigateToDetail(item) {
      uni.navigateTo({
        url: 'Add?id=' + item.id + '&billNo=' + item.billNo
      });
        if (this.current === 1) {
         uni.navigateTo({
           url: 'Add?id=' + item.id + '&billNo=' + item.billNo+
                            '&current=B'
         });
        }else{
            uni.navigateTo({
              url: 'Add?id=' + item.id + '&billNo=' + item.billNo+
                                        '&current=A'
            });
        }
    }
  },
  /**
pages/QC/SJ/yzxFrom.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,309 @@
<template>
  <view class="container">
    <!-- è¡¨æ ¼å¤´éƒ¨ -->
    <view class="table-header" v-if="components.length>0">
      <view class="th name">元器件名称</view>
      <view class="th spec">规格</view>
      <view class="th manufacturer">制造商</view>
      <view class="th operation">上传图片</view>
    </view>
    <!-- è¡¨æ ¼å†…容 -->
    <view class="table-body" v-if="components.length>0">
      <!-- å¾ªçŽ¯æ¸²æŸ“å…ƒå™¨ä»¶ -->
      <view class="tr" v-for="(item, index) in components" :key="index">
        <view class="td name">{{ item.name }}</view>
        <!-- è§„格列 -->
       <view class="td spec"v-if="current=='true'">
          <view v-for="(spec, sIndex) in item.specs" :key="sIndex"
                class="option-item" @click="selectSpec(item, sIndex)">
            <radio :value="String(sIndex)"
                   :checked="item.selectedSpec === sIndex"/>
            <text class="option-text">{{ spec }}</text>
          </view>
        </view>
        <!-- åˆ¶é€ å•†åˆ— -->
       <view class="td manufacturer" v-if="current=='true'">
          <view v-for="(mfg, mIndex) in item.manufacturers" :key="mIndex"
                class="option-item" @click="selectMfg(item, mIndex)">
            <radio :value="String(mIndex)"
                   :checked="item.selectedMfg === mIndex"/>
            <text class="option-text">{{ mfg }}</text>
          </view>
        </view>
        <view class="td operation" v-if="current=='true'">
           <button class="secondary-btn" @click="uploadImages(item.id)">上传/查看图片</button>
        </view>
 <!-- è§„格列 -->
 <view class="td spec" v-if="current!='true'">
   <view v-for="(spec, sIndex) in item.specs" :key="sIndex"
         class="option-item">
     <radio :value="String(sIndex)"
            :checked="item.selectedSpec === sIndex"
            :disabled="true"/>
     <text class="option-text">{{ spec }}</text>
   </view>
 </view>
 <!-- åˆ¶é€ å•†åˆ— -->
 <view class="td manufacturer" v-if="current!='true'">
   <view v-for="(mfg, mIndex) in item.manufacturers" :key="mIndex"
         class="option-item">
     <radio :value="String(mIndex)"
            :checked="item.selectedMfg === mIndex"
            :disabled="true"/>
     <text class="option-text">{{ mfg }}</text>
   </view>
 </view>
 <view class="td operation" v-if="current!='true'">
    <button class="secondary-btn" @click="uploadImages(item.id)">上传/查看图片</button>
 </view>
      </view>
    </view>
    <!-- æäº¤æŒ‰é’® -->
    <view class="submit-container" v-if="components.length>0">
      <button v-if="this.current=='true'" class="primary-btn"
              :disabled="isSubmitting"
              @tap="handleSubmit">
        {{ isSubmitting ? '提交中...' : '保存清单' }}
      </button>
      <!-- <button class="secondary-btn" @click="uploadImages">上传/查看图片</button> -->
    </view>
    <view class="submit-container" v-if="components.length==0">
      <h1>温馨提示:</h1>
       <h1>该物料没有维护一致性核对项目,请先维护!</h1>
    </view>
  </view>
</template>
<script>
export default {
  data() {
    return {
      isSubmitting: false,
      formid:0,
      components: [],
      current:'false'
    }
  },
  methods: {
    selectSpec(item, index) {
      if (this.isSubmitting) return
      item.selectedSpec = index
      if (index < item.manufacturers.length) {
        item.selectedMfg = index
      }
    },
    selectMfg(item, index) {
      if (this.isSubmitting) return
      item.selectedMfg = index
      if (index < item.specs.length) {
        item.selectedSpec = index
      }
    },
    uploadImages(id) {
      // ä¸Šä¼ /查看图片的逻辑
     uni.navigateTo({
         url: 'ImageItem?id=999' + id.sort()[0]
     });
    },
    async handleSubmit() {
      if (this.isSubmitting) return
      try {
        this.isSubmitting = true
        // è¡¨å•验证
        const validation = this.validateForm()
        if (!validation.valid) {
          uni.showToast({
            title: validation.msg,
            icon: 'none',
            duration: 2000
          })
          return
        }
        // èŽ·å–æäº¤æ•°æ®
        const submitData = this.components.map(item => ({
          name: item.name,
          spec: item.specs[item.selectedSpec],
          manufacturer: item.manufacturers[item.selectedMfg],
          id: item.id[item.selectedMfg]
        }))
        // å®žé™…提交时可取消注释以下代码
        // const res = await uni.request({
        //   url: 'your_api_url',
        //   method: 'POST',
        //   data: submitData
        // })
        this.$post({
            url: "/SJ/saveYzxItem",
            data: {
                id:this.formid,
                data: submitData
            }
        }).then(res => {
            if(res.status==0){
                uni.showToast({
                  title: '保存成功',
                  icon: 'success',
                  duration: 2000
                })
            }else{
                uni.showModal({
                    title: "提示",
                    content: res.message,
                    confirmText: "确定",
                    showCancel: false,
                    success: (res) => {
                    }
                })
            }
        }).catch(() => {
            this.isLoading = false; // å‡ºçŽ°é”™è¯¯æ—¶ç»“æŸåŠ è½½
        });
      } finally {
        this.isSubmitting = false
      }
    },
    validateForm() {
      // for (const item of this.components) {
      //   if (item.selectedSpec === -1 || item.selectedMfg === -1) {
      //     return {
      //       valid: false,
      //       msg: `${item.name} æœªå®Œæˆé€‰æ‹©`
      //     }
      //   }
      // }
      return { valid: true }
    },
            onLoad(options) {
                //options中包含了url附带的参数
                let params = options;
                this.formid = params["id"];
                this.current=params["current"];
                //页面加载时调用的事件
                this.$post({
                    url: "/SJ/getYzxItem",
                    data: {
                        id:this.formid
                    }
                }).then(res => {
                    console.log(res);
                    this.components=res.data
                }).catch(() => {
                    this.isLoading = false; // å‡ºçŽ°é”™è¯¯æ—¶ç»“æŸåŠ è½½
                });
            },
  }
}
</script>
<style scoped>
.container {
  padding: 20rpx;
  background-color: #f5f5f5;
  min-height: 100vh;
}
/* è¡¨æ ¼æ ·å¼ */
.table-header, .tr {
  display: flex;
  border-bottom: 1rpx solid #eee;
  background-color: #fff;
}
.th, .td {
  padding: 20rpx;
  border-right: 1rpx solid #eee;
}
.th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #333;
}
.name { width: 20%; }
.spec { width: 30%; }
.manufacturer { width: 30%; }
.operation { width: 20%; }
/* é€‰é¡¹æ ·å¼ */
.option-item {
  display: flex;
  align-items: center;
  padding: 20rpx 0;
  min-height: 80rpx;
}
radio {
  transform: scale(0.9);
  margin-right: 15rpx;
}
.option-text {
  flex: 1;
  font-size: 28rpx;
  color: #444;
}
.primary-btn, .secondary-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}
.primary-btn {
  background-color: #3498db;
  color: white;
}
.primary-btn:hover {
  background-color: #2980b9;
}
/* æäº¤æŒ‰é’®æ ·å¼ */
.submit-container {
  /* margin: 40rpx 20rpx; */
  padding: 20rpx 0;
  background-color: #fff;
  /* border-radius: 16rpx; */
}
/* å“åº”式适配 */
@media (max-width: 768px) {
  .th, .td {
    padding: 16rpx;
    font-size: 26rpx;
  }
  .option-text {
    font-size: 26rpx;
  }
  .submit-btn {
    width: 95%;
    font-size: 28rpx;
  }
}
</style>
pages/QC/XJ/Add.vue
@@ -137,6 +137,10 @@
    <!-- æ“ä½œæŒ‰é’®åŒº -->
    <view class="action-buttons">
      <button v-if="isUpdate && !isShowTable" class="secondary-btn" @click="getItem">创建检验单并生成部分默认值</button>
        <!-- <button class="secondary-btn" @click="toYzxSubmitFrom(formData.releaseNo)">一致性核对</button> -->
       <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="toYzxSubmitFrom(formData.releaseNo)">一致性核对</button>
      <button v-if="!isUpdate && !isShowTable" class="secondary-btn" @click="toImage">上传/查看图片</button>
      <button v-if="!isUpdate && !formData.fsubmit && !isShowTable" class="secondary-btn" @click="removeXJ">
        åˆ é™¤å•据
@@ -216,9 +220,14 @@
  },
  onLoad(options) {
    //options中包含了url附带的参数
    let params = options;
if(params["current"]==='A')
        {
            this.current=true;
        }else if(params["current"]==='B'){
            this.current=false;
        }
    if (params["id"]) {
      this.isUpdate = false;
      this.formData.id = params["id"];
@@ -427,7 +436,11 @@
          }
        });
      });
    },
    },    toYzxSubmitFrom(releaseNo){
        uni.navigateTo({
            url: 'yzxFrom?id=' +this.formData.id+'&current='+this.current
        });
    },
    init() {
      this.$post({
        url: "/XJ/getPage",
pages/QC/XJ/List.vue
@@ -181,9 +181,17 @@
      }
    },
    navigateToDetail(item) {
        if (this.current === 1) {
      uni.navigateTo({
        url: 'Add?id=' + item.id + '&releaseNo=' + item.releaseNo
        url: 'Add?id=' + item.id + '&releaseNo=' + item.releaseNo+
                            '&current=B'
      });
      }else{
          uni.navigateTo({
            url: 'Add?id=' + item.id + '&releaseNo=' + item.releaseNo+
                                      '&current=A'
          });
      }
    }
  },
  /**
pages/QC/XJ/yzxFrom.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,309 @@
<template>
  <view class="container">
    <!-- è¡¨æ ¼å¤´éƒ¨ -->
    <view class="table-header" v-if="components.length>0">
      <view class="th name">元器件名称</view>
      <view class="th spec">规格</view>
      <view class="th manufacturer">制造商</view>
      <view class="th operation">上传图片</view>
    </view>
    <!-- è¡¨æ ¼å†…容 -->
    <view class="table-body" v-if="components.length>0">
      <!-- å¾ªçŽ¯æ¸²æŸ“å…ƒå™¨ä»¶ -->
      <view class="tr" v-for="(item, index) in components" :key="index">
        <view class="td name">{{ item.name }}</view>
        <!-- è§„格列 -->
       <view class="td spec"v-if="current=='true'">
          <view v-for="(spec, sIndex) in item.specs" :key="sIndex"
                class="option-item" @click="selectSpec(item, sIndex)">
            <radio :value="String(sIndex)"
                   :checked="item.selectedSpec === sIndex"/>
            <text class="option-text">{{ spec }}</text>
          </view>
        </view>
        <!-- åˆ¶é€ å•†åˆ— -->
       <view class="td manufacturer" v-if="current=='true'">
          <view v-for="(mfg, mIndex) in item.manufacturers" :key="mIndex"
                class="option-item" @click="selectMfg(item, mIndex)">
            <radio :value="String(mIndex)"
                   :checked="item.selectedMfg === mIndex"/>
            <text class="option-text">{{ mfg }}</text>
          </view>
        </view>
        <view class="td operation" v-if="current=='true'">
           <button class="secondary-btn" @click="uploadImages(item.id)">上传/查看图片</button>
        </view>
 <!-- è§„格列 -->
 <view class="td spec" v-if="current!='true'">
   <view v-for="(spec, sIndex) in item.specs" :key="sIndex"
         class="option-item">
     <radio :value="String(sIndex)"
            :checked="item.selectedSpec === sIndex"
            :disabled="true"/>
     <text class="option-text">{{ spec }}</text>
   </view>
 </view>
 <!-- åˆ¶é€ å•†åˆ— -->
 <view class="td manufacturer" v-if="current!='true'">
   <view v-for="(mfg, mIndex) in item.manufacturers" :key="mIndex"
         class="option-item">
     <radio :value="String(mIndex)"
            :checked="item.selectedMfg === mIndex"
            :disabled="true"/>
     <text class="option-text">{{ mfg }}</text>
   </view>
 </view>
 <view class="td operation" v-if="current!='true'">
    <button class="secondary-btn" @click="uploadImages(item.id)">上传/查看图片</button>
 </view>
      </view>
    </view>
    <!-- æäº¤æŒ‰é’® -->
    <view class="submit-container" v-if="components.length>0">
      <button v-if="this.current=='true'" class="primary-btn"
              :disabled="isSubmitting"
              @tap="handleSubmit">
        {{ isSubmitting ? '提交中...' : '保存清单' }}
      </button>
      <!-- <button class="secondary-btn" @click="uploadImages">上传/查看图片</button> -->
    </view>
    <view class="submit-container" v-if="components.length==0">
      <h1>温馨提示:</h1>
       <h1>该物料没有维护一致性核对项目,请先维护!</h1>
    </view>
  </view>
</template>
<script>
export default {
  data() {
    return {
      isSubmitting: false,
      formid:0,
      components: [],
      current:'false'
    }
  },
  methods: {
    selectSpec(item, index) {
      if (this.isSubmitting) return
      item.selectedSpec = index
      if (index < item.manufacturers.length) {
        item.selectedMfg = index
      }
    },
    selectMfg(item, index) {
      if (this.isSubmitting) return
      item.selectedMfg = index
      if (index < item.specs.length) {
        item.selectedSpec = index
      }
    },
    uploadImages(id) {
      // ä¸Šä¼ /查看图片的逻辑
     uni.navigateTo({
         url: 'ImageItem?id=777' + id.sort()[0]
     });
    },
    async handleSubmit() {
      if (this.isSubmitting) return
      try {
        this.isSubmitting = true
        // è¡¨å•验证
        const validation = this.validateForm()
        if (!validation.valid) {
          uni.showToast({
            title: validation.msg,
            icon: 'none',
            duration: 2000
          })
          return
        }
        // èŽ·å–æäº¤æ•°æ®
        const submitData = this.components.map(item => ({
          name: item.name,
          spec: item.specs[item.selectedSpec],
          manufacturer: item.manufacturers[item.selectedMfg],
          id: item.id[item.selectedMfg]
        }))
        // å®žé™…提交时可取消注释以下代码
        // const res = await uni.request({
        //   url: 'your_api_url',
        //   method: 'POST',
        //   data: submitData
        // })
        this.$post({
            url: "/XJ/saveYzxItem",
            data: {
                id:this.formid,
                data: submitData
            }
        }).then(res => {
            if(res.status==0){
                uni.showToast({
                  title: '保存成功',
                  icon: 'success',
                  duration: 2000
                })
            }else{
                uni.showModal({
                    title: "提示",
                    content: res.message,
                    confirmText: "确定",
                    showCancel: false,
                    success: (res) => {
                    }
                })
            }
        }).catch(() => {
            this.isLoading = false; // å‡ºçŽ°é”™è¯¯æ—¶ç»“æŸåŠ è½½
        });
      } finally {
        this.isSubmitting = false
      }
    },
    validateForm() {
      // for (const item of this.components) {
      //   if (item.selectedSpec === -1 || item.selectedMfg === -1) {
      //     return {
      //       valid: false,
      //       msg: `${item.name} æœªå®Œæˆé€‰æ‹©`
      //     }
      //   }
      // }
      return { valid: true }
    },
            onLoad(options) {
                //options中包含了url附带的参数
                let params = options;
                this.formid = params["id"];
                this.current=params["current"];
                //页面加载时调用的事件
                this.$post({
                    url: "/XJ/getYzxItem",
                    data: {
                        id:this.formid
                    }
                }).then(res => {
                    console.log(res);
                    this.components=res.data
                }).catch(() => {
                    this.isLoading = false; // å‡ºçŽ°é”™è¯¯æ—¶ç»“æŸåŠ è½½
                });
            },
  }
}
</script>
<style scoped>
.container {
  padding: 20rpx;
  background-color: #f5f5f5;
  min-height: 100vh;
}
/* è¡¨æ ¼æ ·å¼ */
.table-header, .tr {
  display: flex;
  border-bottom: 1rpx solid #eee;
  background-color: #fff;
}
.th, .td {
  padding: 20rpx;
  border-right: 1rpx solid #eee;
}
.th {
  background-color: #f8f9fa;
  font-weight: bold;
  color: #333;
}
.name { width: 20%; }
.spec { width: 30%; }
.manufacturer { width: 30%; }
.operation { width: 20%; }
/* é€‰é¡¹æ ·å¼ */
.option-item {
  display: flex;
  align-items: center;
  padding: 20rpx 0;
  min-height: 80rpx;
}
radio {
  transform: scale(0.9);
  margin-right: 15rpx;
}
.option-text {
  flex: 1;
  font-size: 28rpx;
  color: #444;
}
.primary-btn, .secondary-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.3s;
}
.primary-btn {
  background-color: #3498db;
  color: white;
}
.primary-btn:hover {
  background-color: #2980b9;
}
/* æäº¤æŒ‰é’®æ ·å¼ */
.submit-container {
  /* margin: 40rpx 20rpx; */
  padding: 20rpx 0;
  background-color: #fff;
  /* border-radius: 16rpx; */
}
/* å“åº”式适配 */
@media (max-width: 768px) {
  .th, .td {
    padding: 16rpx;
    font-size: 26rpx;
  }
  .option-text {
    font-size: 26rpx;
  }
  .submit-btn {
    width: 95%;
    font-size: 28rpx;
  }
}
</style>
static/img/bj/1738973218634.png