From a89fe32c353040bbb95d7519cf7bafc4b5934f10 Mon Sep 17 00:00:00 2001
From: Mr.Zhang <710666463@qq.com>
Date: 星期三, 06 九月 2023 09:54:14 +0800
Subject: [PATCH] 小程序

---
 minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue |  299 ++++++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 210 insertions(+), 89 deletions(-)

diff --git a/minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue b/minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue
index 35ea422..50dc001 100644
--- a/minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue
+++ b/minipro_standard/pages_adjust/pages/OrderDetail/OrderDetail.vue
@@ -180,8 +180,18 @@
 		</div>
 		<div class="details_dj" v-if="typeView === 1">
 
-			<div class="details_dj_list">
-				<u-swipe-action>
+			<div class="details_dj_list">
+				<scroll-view scroll-y="true" refresher-enabled="true" @scrolltolower="getLists">
+					<u-swipe-action v-for="(item, index) in djData" :key="index">
+						<u-swipe-action-item :options="options" @click="dele(item.id)">
+							<div class="details_dj_list_item">
+								<span>{{ item.attrName }}锛歿{ item.val }}</span>
+								<span>{{ item.userName }} {{ item.createTime }}</span>
+							</div>
+						</u-swipe-action-item>
+					</u-swipe-action>
+				</scroll-view>
+				<!-- <u-swipe-action>
 					<u-swipe-action-item v-for="(item, index) in djData" :key="index" :options="options"
 						@click="dele(item.id)">
 						<div class="details_dj_list_item">
@@ -189,7 +199,7 @@
 							<span>{{ item.userName }} {{ item.createTime }}</span>
 						</div>
 					</u-swipe-action-item>
-				</u-swipe-action>
+				</u-swipe-action> -->
 			</div>
 		</div>
 		<!-- v-if="info.status === 2 || info.procedureNeedcheck === 1" -->
@@ -234,23 +244,41 @@
 <script>
 	import workOrderInfo from '@/components/workOrderInfo.vue'
 	import {
+		getBarcodeContent,
 		queryById,
+		getOrocessRecord,
+		deleteCT,
+		updateById,
+		comfirmDone,
+		comfirmDoneStandard,
+		getListByCondition,
+		allForStandard,
+		pageDJ,
+		deletedj,
+		dealWorkorderRecordStandard,
+		getWorkorderRecordListStandard,
 		createMaterial,
 		createMaterialStandard
-	} from '@/util/api/WorkOrderAPI'
+	} from '@/util/api/WorkOrderAPI'
+	import {
+		categoryExtList,
+		queryOne,
+		queryList
+	} from '@/util/api/PlanningAPI'
+	import { REGULAR } from '@/util/utils'
 	export default {
 		components: {
 			workOrderInfo
 		},
 		data() {
-			return {
+			return {
+				workorderId: '',
 				cate: [{
 						name: '鐢熶骇'
 					},
 					{
 						name: '鐐规'
-					}
-				],
+					}],
 				form: {
 					time: '',
 					efective: [],
@@ -264,35 +292,14 @@
 				TimeShow: false,
 				badShow: false,
 				typeView: 0,
-				feedingData: [{
-					id: 0,
-					materialName: '澧欎綋鐮�',
-					procedureName: '鍘嬪埗',
-					qualityType: 1,
-					locationName: 'CP-01',
-					batch: '20230713',
-					num: 2,
-					maxNum: 10,
-					unitAttribute: 1,
-					unitName: '鍧�'
-				}],
+				feedingData: [],
 				options: [{
 					text: '鍒犻櫎',
 					style: {
 						backgroundColor: 'red',
 					}
 				}],
-				arrType: [{
-						name: '璁℃椂',
-						type: 1,
-						salary: 1000,
-					},
-					{
-						name: '璁′欢',
-						type: 0,
-						salary: 100
-					},
-				],
+				arrType: [],
 				// 浜у嚭鍚堟牸/涓嶈壇
 				produceFrom: {
 					qualifiedId: '',
@@ -300,18 +307,22 @@
 					undesirableId: '',
 					undesirable: 5 // 涓嶈壇
 				},
-				djData: [{
-					attrName: '鍑烘按鏃堕棿',
-					val: '2022-05-28 16:3',
-					userName: '寮犱笁 ',
-					createTime: '2022-05-28 16:32:'
-				}],
-				cateList: [{
-					active: false,
-					name: '姣涘埡',
-					num: 0
-				}]
+				djData: [],
+				cateList: [],
+				finished: true,
 			};
+		},
+		onLoad(obj) {
+			this.workorderId = obj.id
+			this.queryByIds()
+			this.getOrocessRecords()
+			this.getData()
+			uni.$on('spotAdd', () => {
+				if (this.typeView == 1) {
+					this.pages.page = 1
+					this.pageDJs()
+				}
+			})
 		},
 		computed: {
 			expectedSalary() {
@@ -354,22 +365,35 @@
 				}
 			}
 		},
-		onLoad(obj) {
-			this.workorderId = obj.id
-			queryById(this.workorderId)
-				.then(res => {
+		methods: {
+			getData() {
+				categoryExtList({
+					cateType: "3"
+				}).then(res => {
 					if (res.code === 200) {
-						this.info = res.data
-						this.deviceId = res.data.pgmodel.id
+						res.data.forEach(item => {
+							item.active = false
+							item.num = ''
+						})
+						this.cateList = res.data
 					}
 				})
-		},
-		methods: {
-			click() {
-
 			},
 			clickIten(index) {
-				this.typeView = index
+				this.typeView = index
+				if (this.typeView == 1) {
+					this.pages.page = 1
+					this.finished = true
+					this.pageDJs()
+				}
+			},
+			getLists() {
+				if (!this.finished) {
+					return
+				}
+				this.finished = false
+				this.pages.page += 1
+				this.pageDJs()
 			},
 			timeConfirm({
 				value
@@ -394,69 +418,166 @@
 				if (type === 'T') {
 					if (unitAttribute == 0 && num != '') {
 						if (!REGULAR.positiveInteger.test(num)) {
-							obj.num = obj.ynum
-							Toast({
-								message: '鍙兘杈撳叆姝f暣鏁�'
-							})
+							obj.num = obj.ynum
+							uni.$u.toast('鍙兘杈撳叆姝f暣鏁�')
 							return
 						}
 					}
 					if (unitAttribute == 1 && num != '') {
-						if (!REGULAR.number.test(num)) {
-							Toast({
-								message: '鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級'
-							})
+						if (!REGULAR.number.test(num)) {
+							uni.$u.toast('鍙兘杈撳叆姝f暣鏁版垨灏忔暟锛堟渶澶氬洓浣嶏級')
+							
 							obj.num = obj.ynum
 							return
 						}
 					}
 					if (num > maxNum) {
-						obj.num = obj.ynum
-						Toast.fail({
-							message: '瓒呭嚭宸ヨ鎬绘暟'
-						})
+						obj.num = obj.ynum
+						uni.$u.toast('瓒呭嚭宸ヨ鎬绘暟')
+						
 						return
 					}
 				} else if (type === 'C' && num > info.value.planNum) {
-					obj.num = obj.ynum
-					Toast.fail({
-						message: '浜у嚭鏁伴噺涓嶈兘瓒呰繃璁″垝鏁伴噺'
-					})
+					obj.num = obj.ynum
+					uni.$u.toast('浜у嚭鏁伴噺涓嶈兘瓒呰繃璁″垝鏁伴噺')
+					
 					return
 				}
-				// updateById({ id, num }).then(res => {
-				//   if (res.code === 200 && type === 'T') {
-				//     getOrocessRecords()
-				//   } else if (res.code === 200 && type === 'C') {
-				//     // getOrocessRecordCC()
-				//   }
-				// })
+				
 			},
 			clickPerformanceType(item, index) {
 				this.form.index = index
 				this.form.type = item.type
 			},
-			submit() {},
-			jumpdj() {},
-			pageDJs() {},
+			submit() {
+				
+			},
+			jumpdj() {
+				uni.navigateTo({
+					url: `/pages_adjust/pages/spotCheck/spotCheck?id=${this.workorderId}`
+				})
+			},
+			pageDJs() {
+				pageDJ({
+					capacity: this.pages.capacity,
+					page: this.pages.page,
+					model: {
+						workorderId: this.workorderId
+					}
+				}).then(res => {
+					let {data} = res
+					if (data.page == 1) {
+						this.djData = []
+					}
+					this.djData.push(...data.records)
+					// loading.value = false
+				}).catch(err => {
+					// loading.value = false
+					// finished.value = true
+				})
+				.finally(() => {
+					this.finished = true
+				})
+			},
 			dele(id) {
-				// deletedj(id)
-				//     .then(res => {
-				//       if (res.code === 200) {
-				//         djData.value = []
-				//         finished.value = false
-				//         page.page = 1
-				//         djData.value = []
-				//         pageDJs()
-				//       }
-				//     })
+				deletedj(id)
+				    .then(res => {
+				      if (res.code === 200) {
+				        this.finished = false
+				        this.pages.page = 1
+				        this.pageDJs()
+				      }
+				    })
 			},
 			confirm() {
-				// console.log('confirm');
+				let isOpen = false
+				this.cateList.forEach((item, index) => {
+					if (item.active) {
+						isOpen = true
+					}
+				})
+				if (!isOpen) {
+					uni.showToast({
+						title: '璇烽�夋嫨涓嶈壇椤�',
+						duration: 2000,
+						icon: 'none'
+					})
+					return
+				}
+				let arr = []
+				let total = 0
+				let name = ''
+				this.cateList.forEach((item, index) => {
+					if (item.active) {
+						if (item.num <= 0) {
+							uni.showToast({
+								title: '涓嶈壇鏁伴噺蹇呴』澶т簬0',
+								duration: 2000,
+								icon: 'none'
+							})
+							return
+						}
+						total = total += item.num
+						arr.push(item)
+						name += item.name + item.num + '锛�'
+					}
+				})
+				if (total != Number(this.produceFrom.undesirable)) {
+					uni.showToast({
+						title: '涓嶈壇鏁板繀椤荤瓑浜庝骇鍑轰笉鑹暟',
+						duration: 2000,
+						icon: 'none'
+					})
+					return
+				}
+				this.form.defective = arr
+				this.form.defectiveName = name
 				this.badShow = false
 			},
 			changeChecked(i) {
 				this.cateList[i].active = !this.cateList[i].active
+			},
+			queryByIds() {
+				queryById(this.workorderId)
+					.then(res => {
+						this.info = res.data
+						queryList({
+							deleted: 0,
+							departId: res.data.factoryId,
+							materialId: res.data.materialId,
+							procedureId: res.data.procedureId
+						}).then(result => {
+							if (result.code === 200) {
+								if (result.data && result.data.length > 0) {
+									result.data.forEach((item, index) => {
+										item.name = item.type == 0 ? '璁′欢' : '璁℃椂'
+										item.id = item.type
+										item.active = index == 0
+									})
+									this.arrType = result.data
+								} else {
+									this.arrType = []
+								}
+							}
+						})
+					})
+			},
+			getOrocessRecords() {
+				this.feedingData = []
+				allForStandard({
+					workorderId: this.workorderId,
+					type: 0
+				}).then(res => {
+					if (res.code === 200) {
+						this.feedingData = res.data
+					}
+				})
+			},
+			jumpTL() {
+				uni.navigateTo({
+					// url: ''
+					url: `/pages_adjust/pages/manualFeed/manualFeed?id=${this.workorderId}`
+				})
 			}
 		}
 	}

--
Gitblit v1.9.3