From 11f614080f28818e6627794b9f802d6a399579f4 Mon Sep 17 00:00:00 2001
From: hao <1836460075@qq.com>
Date: 星期五, 30 五月 2025 16:23:03 +0800
Subject: [PATCH] 退换料确认

---
 pages/QC/THL/THLQR.vue |  252 ++++++++++++++++++++++++++++++++++++++++++++++++++
 pages.json             |    8 +
 store/index.js         |    4 
 3 files changed, 262 insertions(+), 2 deletions(-)

diff --git a/pages.json b/pages.json
index 22a0dea..7c19216 100644
--- a/pages.json
+++ b/pages.json
@@ -479,6 +479,14 @@
 				"navigationBarTitleText": "鍥剧墖鏂囦欢棰勮",
 				"enablePullDownRefresh": false
 			}
+		},
+		{
+			"path" : "pages/QC/THL/THLQR",
+			"style" : 
+			{
+				"navigationBarTitleText" : "閫�鎹㈡枡纭",
+				"enablePullDownRefresh": false
+			}
 		}
 		 
 		 
diff --git a/pages/QC/THL/THLQR.vue b/pages/QC/THL/THLQR.vue
new file mode 100644
index 0000000..ec0d077
--- /dev/null
+++ b/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>
diff --git a/store/index.js b/store/index.js
index 933e405..9f9ed02 100644
--- a/store/index.js
+++ b/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',//褰撳墠姝e湪浣跨敤鐨勬湇鍔″櫒,榛樿涓哄缃�  localhost
-			serverAPI:'http://192.168.1.22:10055/api',//褰撳墠姝e湪浣跨敤鐨勬湇鍔″櫒,榛樿涓哄缃�  10054涓烘寮廇PI
+			// serverAPI:'http://localhost:5184/api',//褰撳墠姝e湪浣跨敤鐨勬湇鍔″櫒,榛樿涓哄缃�  localhost
+			serverAPI:'http://192.168.1.22:10054/api',//褰撳墠姝e湪浣跨敤鐨勬湇鍔″櫒,榛樿涓哄缃�  10054涓烘寮廇PI
 			//serverAPI:'http://192.168.1.104:10055/api',//褰撳墠姝e湪浣跨敤鐨勬湇鍔″櫒,榛樿涓哄缃�  10055涓烘祴璇旳PI
 		}
 	},

--
Gitblit v1.9.3