hao
2025-05-30 11f614080f28818e6627794b9f802d6a399579f4
退换料确认
已修改2个文件
已添加1个文件
264 ■■■■■ 文件已修改
pages.json 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages/QC/THL/THLQR.vue 252 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
store/index.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pages.json
@@ -479,6 +479,14 @@
                "navigationBarTitleText": "图片文件预览",
                "enablePullDownRefresh": false
            }
        },
        {
            "path" : "pages/QC/THL/THLQR",
            "style" :
            {
                "navigationBarTitleText" : "退换料确认",
                "enablePullDownRefresh": false
            }
        }
         
         
pages/QC/THL/THLQR.vue
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,252 @@
<template>
  <view class="page">
    <!-- è¡¨å•区域 -->
    <view class="form-container">
      <form :modelValue="formData">
        <view class="form-group">
          <label class="form-label">退换料单号:</label>
          <superwei-combox
            :candidates="docList"
            placeholder="请选择"
            v-model="formData.docNo"
            @select="onDocChange"
            class="form-input"
          />
        </view>
        <view class="form-group">
          <label class="form-label">生产工单:</label>
          <input class="form-input" type="text" v-model="formData.moNo" disabled />
        </view>
        <view class="form-group">
          <label class="form-label">退补料类型:</label>
          <input class="form-input" type="text" v-model="formData.type" disabled />
        </view>
        <view class="form-group">
          <label class="form-label">产品编码:</label>
          <input class="form-input" type="text" v-model="formData.productCode" disabled />
        </view>
        <view class="form-group">
          <label class="form-label">部门名称:</label>
          <input class="form-input" type="text" v-model="formData.deptName" disabled />
        </view>
        <view class="form-group">
          <label class="form-label">创建时间:</label>
          <input class="form-input" type="text" v-model="formData.createTime" disabled />
        </view>
      </form>
    </view>
    <!-- æ˜Žç»†è¡¨æ ¼ -->
   <view class="list-container">
     <uni-table border stripe emptyText="暂无明细数据">
       <uni-tr>
         <uni-th align="center">序号</uni-th>
         <uni-th align="center">物料</uni-th>
         <uni-th align="center">规格</uni-th>
         <uni-th align="center">申请数量</uni-th>
         <uni-th align="center">退料原因</uni-th>
       </uni-tr>
       <uni-tr v-for="(item, index) in detailList" :key="index">
         <uni-td align="center">{{ index + 1 }}</uni-td>
         <uni-td align="center">{{ item.material }}</uni-td>
         <uni-td align="center">{{ item.spec }}</uni-td>
         <uni-td align="center">{{ item.qty }}</uni-td>
         <uni-td align="center">
           <input class="form-input" type="text" v-model="item.reason" />
         </uni-td>
       </uni-tr>
     </uni-table>
   </view>
    <!-- å®¡æ ¸æŒ‰é’® -->
 <view class="plus-button">
   <button type="warn" @click="confirmReview">确认审核</button>
   <button type="default" @click="rejectReview" style="margin-left: 10px;">驳回</button>
 </view>
  </view>
</template>
<script>
export default {
  data() {
    return {
      docList: [],
      formData: {
        docNo: '',
        moNo: '',
        type: '',
        productCode: '',
        deptName: '',
        createTime: ''
      },
      detailList: [],
      readonlyFields: [
        { label: '生产工单:', field: 'moNo' },
        { label: '退补料类型:', field: 'type' },
        { label: '产品编码:', field: 'productCode' },
        { label: '部门名称:', field: 'deptName' },
        { label: '创建时间:', field: 'createTime' }
      ]
    };
  },
  methods: {
  onDocChange(selectedDoc) {
    this.formData.docNo = selectedDoc;
    // æ ¹æ® docNo èŽ·å–è¡¨å¤´æ•°æ®
    this.$post({
      url: "/RetMat/GetHeader",
      data: { docNo: selectedDoc }
    }).then(res => {
      if (res.status === 0) {
        this.formData = {
          ...this.formData,
          moNo: res.data.mono,
          type: res.data.type,
          productCode: res.data.productcode,
          deptName: res.data.deptname,
          createTime: res.data.createtime
        };
      } else {
        uni.showToast({ title: '获取表头失败', icon: 'none' });
      }
    });
    // èŽ·å–æ˜Žç»†æ•°æ®
    this.$post({
      url: "/RetMat/GetList",
      data: { docNo: selectedDoc }
    }).then(res => {
      if (res.status === 0) {
        this.detailList = res.data.map(item => ({
          material: item.material,
          spec: item.spec,
          qty: item.qty,
          reason: item.reason || '',
          ItemId: item.itemid
        }));
      } else {
        uni.showToast({ title: '获取明细失败', icon: 'none' });
      }
    });
  }
,
    confirmReview() {
        if (!this.formData.docNo) {
          uni.showToast({ title: '请先选择退换料单号', icon: 'none' });
          return;
        }
  const dataToSave = {
    docNo: this.formData.docNo,
    user: this.$loginInfo.account,
    items: this.detailList.map(item => ({
         material: "",
      ItemId: item.ItemId,
      Reason: item.reason
    }))
  };
console.log(dataToSave);
  this.$post({
    url: "/RetMat/SaveReview",
    data: dataToSave
  }).then(res => {
    if (res.status === 0) {
      uni.showToast({ title: '审核成功', icon: 'success' });
    } else {
      uni.showToast({ title: res.message, icon: 'none' });
    }
  });
},
 rejectReview() {
   if (!this.formData.docNo) {
     uni.showToast({ title: '请先选择退换料单号', icon: 'none' });
     return;
   }
   uni.showModal({
     title: '确认驳回',
     content: '是否确认驳回该退换料申请?',
     success: res => {
       if (res.confirm) {
         const dataToReject = {
           docNo: this.formData.docNo,
           user: this.$loginInfo.account,
           items: this.detailList.map(item => ({
             material: item.material,
             reason: item.reason,
             itemId: item.ItemId
           }))
         };
         this.$post({
           url: "/RetMat/Reject",
           data: dataToReject
         }).then(res => {
           if (res.status === 0) {
             uni.showToast({ title: '驳回成功', icon: 'success' });
             this.formData = {};
             this.detailList = [];
           } else {
             uni.showToast({ title: res.message, icon: 'none' });
           }
         });
       }
     }
   });
 }
  },
  onLoad() {
    this.$post({ url: "/RetMat/GetAllDocs" }).then(res => {
      //this.docList = res.data;
       this.docList = res.data.map(item => item.thL_NO);
    });
  }
};
</script>
<style>
.page {
  padding: 10px;
}
.form-container {
  padding: 12px;
}
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.form-group {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #c9c9c9;
}
.form-label {
  margin-bottom: 0;
  padding: 5px;
}
.form-input {
  flex: 1;
  margin-bottom: 0;
  padding: 5px;
}
.list-container {
  padding: 10px;
  height: 60vh;
  overflow-y: auto;
}
.plus-button {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}
</style>
store/index.js
@@ -10,8 +10,8 @@
            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://192.168.1.22:10055/api',//当前正在使用的服务器,默认为外网  10054为正式API
            // serverAPI:'http://localhost:5184/api',//当前正在使用的服务器,默认为外网  localhost
            serverAPI:'http://192.168.1.22:10054/api',//当前正在使用的服务器,默认为外网  10054为正式API
            //serverAPI:'http://192.168.1.104:10055/api',//当前正在使用的服务器,默认为外网  10055为测试API
        }
    },