From e0673329aafe8fc5e17daa75f940807566813290 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期四, 07 九月 2023 15:34:55 +0800
Subject: [PATCH] 小程序

---
 minipro_standard/pages_inspect/pages/InspectionRecords/InspectionRecords.vue |  394 ++++++++++++++++++-------------------------------------
 1 files changed, 131 insertions(+), 263 deletions(-)

diff --git a/minipro_standard/pages_inspect/pages/InspectionRecords/InspectionRecords.vue b/minipro_standard/pages_inspect/pages/InspectionRecords/InspectionRecords.vue
index a2dbb0c..39f2295 100644
--- a/minipro_standard/pages_inspect/pages/InspectionRecords/InspectionRecords.vue
+++ b/minipro_standard/pages_inspect/pages/InspectionRecords/InspectionRecords.vue
@@ -1,7 +1,7 @@
 <template>
 	<view class="content">
 		<view class="content_search">
-			<Search @searchInput="searchInput" @submit="submit" @reset="reset" :isShow="true" placeholder="鎼滅储宸ュ崟缂栫爜/鐗╂枡缂栫爜2">
+			<Search @searchInput="searchInput" @submit="submit" @reset="reset" :isShow="true" placeholder="鎼滅储宸ュ崟缂栫爜/鐗╂枡缂栫爜">
 				<template v-slot:content>
 					<view class="Search_item">
 						<view class="Search_item_label">妫�楠屾棩鏈�</view>
@@ -36,10 +36,17 @@
 				</template>
 			</Search>
 		</view>
-		<view class="content_total" :style="{top: top}">鍏眥{listData.total}}鏉℃暟鎹�</view>
+		<view class="content_total" :style="{top: top}">鍏眥{pageData.total}}鏉℃暟鎹�</view>
 		<view class="content_list">
-			<scroll-view @scrolltolower="getLists" scroll-y :style="{height: height}">
-				<view class="content_list_item" v-for="item in lists" :key="item.id" @click="jump(item)">
+			<scroll-view
+			:refresher-enabled="true"
+			:refresher-triggered="isLoading"
+			@refresherrefresh="onRefresh"
+			refresher-background="#fff"
+			@scrolltolower="onLoads"
+			scroll-y
+			:style="{height: height}">
+				<view class="content_list_item" v-for="item in listData" :key="item.id" @click="jumpDesc(item)">
 					<view class="content_list_item_title">
 						<text>{{item.code}}</text>
 						<text class="warning" v-if="item.checkType === 0">宸$嚎</text>
@@ -92,156 +99,48 @@
 			</scroll-view>
 		</view>
 		<!-- 閫夋嫨鏃ユ湡 -->
-		<u-calendar :show="timeShow" mode="range" @confirm="timeConfirm"></u-calendar>
+		<u-calendar :show="timeShow" mode="range" @confirm="timeConfirm" @close="timeShow = false"></u-calendar>
 	</view>
 </template>
 
 <script>
 	import Search from '@/components/Search.vue'
+	import { page } from '@/util/api/QualityAPI'
+	import { getWorkingProcedure, deletejy } from "@/util/api/PlanningAPI"
+	import { mapState } from 'vuex'
+	
 	export default {
 		components: { Search },
 		data() {
 			return {
 				height: '',
 				top: '',
-				listData: {
+				isLoading: false,
+				pageData: {
 					capacity: 10,
 					page: 0,
 					total: 0,
-					startDate: '',
-					endDate: '',
-					procedureIds: [],
-					departIds: '',
-					mixParam: '',
-					cateIds: []
+					checkStartDate: '',
+					checkEndDate: '',
+					minParam: '',
+					batch: '',
+					checkType: '',
+					procedureId: '',
+					workorderId: ''
 				},
 				data: [		// 妫�楠岀被鍨�
 					{ id: '0', name: '宸$嚎', isActive: false },
 					{ id: '1', name: '宸℃', isActive: false },
 					{ id: '2', name: '瀹屽伐妫�', isActive: false }
 				],
+				minDate: new Date(2021, 0, 1),
+				maxDate: new Date(new Date().getFullYear() + 1, 12, 30),
+				listData: [],
 				workingProcedure: [],	// 宸ュ簭
-				finished: true,
 				loading: false,
+				finished: false,
 				refreshing: false,
-				timeShow: false,
-				lists: [
-					{
-						id: 1,
-						checkType: 0,
-						status: 0,
-						code: '1234543223',
-						urgent: 1,
-						num: 100,
-						batch: '11111',
-						planDate: '2023-08-29',
-						mmodel: {
-							name: '宸ュ簭璁″垝',
-							code: 'fbdseasafghb'
-						},
-						usermodel: {
-							realname: '璁″垝浜哄憳'
-						},
-						pmodel: {
-							name: '宸ュ簭璁″垝'
-						},
-						fmodel: {
-							name: '宸ュ巶'
-						}
-					},
-					{
-						id: 2,
-						checkType: 1,
-						code: '1234543223',
-						status: 0,
-						urgent: 1,
-						num: 100,
-						batch: '11111',
-						planDate: '2023-08-29',
-						mmodel: {
-							name: '宸ュ簭璁″垝',
-							code: 'fbdseasafghb'
-						},
-						usermodel: {
-							realname: '璁″垝浜哄憳'
-						},
-						pmodel: {
-							name: '宸ュ簭璁″垝'
-						},
-						fmodel: {
-							name: '宸ュ巶'
-						}
-					},
-					{
-						id: 3,
-						checkType: 2,
-						code: '1234543223',
-						status: 0,
-						urgent: 1,
-						num: 100,
-						batch: '11111',
-						planDate: '2023-08-29',
-						mmodel: {
-							name: '宸ュ簭璁″垝',
-							code: 'fbdseasafghb'
-						},
-						usermodel: {
-							realname: '璁″垝浜哄憳'
-						},
-						pmodel: {
-							name: '宸ュ簭璁″垝'
-						},
-						fmodel: {
-							name: '宸ュ巶'
-						}
-					},
-					{
-						checkType: 2,
-						id: 4,
-						status: 0,
-						urgent: 1,
-						code: '1234543223',
-						num: 100,
-						batch: '11111',
-						planDate: '2023-08-29',
-						mmodel: {
-							name: '宸ュ簭璁″垝',
-							code: 'fbdseasafghb'
-						},
-						usermodel: {
-							realname: '璁″垝浜哄憳'
-						},
-						pmodel: {
-							name: '宸ュ簭璁″垝'
-						},
-						fmodel: {
-							name: '宸ュ巶'
-						}
-					},
-					{
-						checkType: 1,
-						id: 5,
-						status: 0,
-						code: '1234543223',
-						urgent: 1,
-						num: 100,
-						batch: '11111',
-						planDate: '2023-08-29',
-						mmodel: {
-							name: '宸ュ簭璁″垝',
-							code: 'fbdseasafghb'
-						},
-						usermodel: {
-							realname: '璁″垝浜哄憳'
-						},
-						pmodel: {
-							name: '宸ュ簭璁″垝'
-						},
-						fmodel: {
-							name: '宸ュ巶'
-						}
-					}
-				]
+				timeShow: false
 			};
 		},
 		onReady() {
@@ -253,51 +152,65 @@
 				}).exec()
 			})
 		},
+		computed: {
+			...mapState(['userInfo'])
+		},
+		onLoad(option) {
+			if (option.id) {
+				this.pageData.workorderId = option.id
+			}
+			this.onLoads()
+			this.getWorkingProcedures()
+		},
 		methods: {
 			// 璺宠浆
-			jump(item) {
+			jumpDesc(item) {
 				uni.navigateTo({
-					url: `/pages/InspectionDetails/InspectionDetails?id=${item.id}`
+					url: `/pages_inspect/pages/InspectionDetails/InspectionDetails?id=${item.id}`
 				})
 			},
 			// 鑾峰彇澶撮儴缁勪欢楂樺害
 			getHeight(height) {
 				this.height = height
 			},
+			onRefresh() {
+				if (this.isLoading) return
+				this.isLoading = true
+				this.listData = []
+				this.pageData.page = 0
+				this.onLoads()
+			},
 			// 閲嶇疆
 			reset() {
-				this.listData.page = 0
+				this.pageData.checkStartDate = ''
+				this.pageData.checkEndDate = ''
+				this.pageData.minParam = ''
+				this.pageData.checkType = ''
+				this.pageData.procedureId = ''
+				this.pageData.batch = ''
+				this.pageData.page = 0
+				this.listData = []
 				this.finished = false
-				this.lists = []
-				this.listData.mixParam = ''
-				this.listData.startDate = ''
-				this.listData.endDate = ''
-				this.listData.procedureIds = []
-				if (this.factoryList.length > 0) {
-					this.listData.departIds = this.factoryList[0].id
-				}
-				if (this.data.length > 0) {
-					this.data.forEach(item => { item.isActive = false })
-				}
-				// this.getLists()
-				// this.pageCounts()
+				this.data.forEach(item => { item.isActive = false })
+				this.workingProcedure.forEach(item => { item.isActive = false })
+				this.onLoads()
 			},
 			// 鏃ユ湡纭畾
 			timeConfirm(val) {
-				this.listData.startDate = val[0]
-				this.listData.endDate = val[val.length - 1]
+				this.pageData.checkStartDate = val[0]
+				this.pageData.checkEndDate = val[val.length - 1]
 				this.timeShow = false
 			},
-			// 鍒囨崲宸ュ巶
-			changeTags(i, id) {
-				this.listData.departIds = id
-				this.getWorkingProcedures(id)
-				this.factoryList.forEach((item, index) => {
-					if (index === i) {
-						item.isActive = true
-					} else {
-						item.isActive = false
-					}
+			// 鍒囨崲妫�绫诲瀷
+			changeTag(i) {
+				this.data.forEach((item, index) => {
+					item.isActive = index === i;
+				})
+			},
+			// 鍒囨崲妫�宸ュ簭
+			changeTag1(i) {
+				this.workingProcedure.forEach((item, index) => {
+					item.isActive = index === i;
 				})
 			},
 			// 鎵撳紑鏃ユ湡鎻掍欢
@@ -306,130 +219,85 @@
 			},
 			// 鎼滅储
 			searchInput(val) {
-				this.listData.mixParam = val
-				this.listData.page = 0
+				this.pageData.minParam = val
+				this.pageData.page = 0
+				this.listData = []
 				this.finished = false
-				this.lists = []
-				this.getLists()
-			},
-			// 鐐瑰嚮鏍囩鎼滅储
-			clickTag(ids) {
-				this.listData.cateIds = ids
-				this.listData.page = 0
-				this.finished = false
-				this.lists = []
-				// this.getLists()
-			},
-			// 鑾峰彇鍒楄〃缁熻
-			pageCounts() {
-				pageCount({
-					factoryId: this.listData.departIds,
-					procedureIdList: this.listData.procedureIds ? this.listData.procedureIds : [],
-					startDate: this.listData.startDate,
-					endDate: this.listData.endDate,
-					statusList: this.listData.cateIds
-				}).then(res => {
-					if (res.code === 200 && res.data) {
-						this.tagList[0].num = res.data.allNum.toString()
-						this.tagList[1].num = res.data.startNum.toString()
-						this.tagList[2].num = res.data.ingNum.toString()
-						this.tagList[3].num = res.data.endNum.toString()
-					}
-				})
-			},
-			// 鑾峰彇宸ュ巶鏁版嵁
-			getOrganizations() {
-				getOrganization({
-					type: 1
-				}).then(res => {
-					if (res.code === 200 && res.data && res.data.length !== 0) {
-						res.data.forEach((item, i) => {
-							item.isActive = i === 0;
-						})
-						if (res.data.length > 0) {
-							this.factoryList = res.data
-							this.listData.departIds = this.factoryList[0].id
-							this.listData.procedureIds = ''
-							this.finished = false
-							this.getWorkingProcedures(this.factoryList[0].id)
-							this.getLists()
-							this.pageCounts()
-						}
-					}
-				})
+				this.onLoads()
 			},
 			// 鑾峰彇宸ュ簭鏁版嵁
-			getWorkingProcedures(orgId) {
-				this.data = []
-				getWorkingProcedure({ orgId })
-					.then(res => {
-						if (res.code === 200 && res.data && res.data.length !== 0) {
-							res.data.forEach((item, i) => {
-								item.isActive = false;
-							})
-							this.data = res.data
-						}
-					})
-			},
-			// 鎼滅储寮规鎻愪氦
-			submit()  {
-				let pmodelOrgId = []
-				this.data.forEach((item) => {
-					if (item.isActive) {
-						pmodelOrgId.push(item.id)
+			getWorkingProcedures() {
+				getWorkingProcedure({
+					capacity: 100,
+					page: 1,
+					model: {
+						userId: this.userInfo.id
+					}
+				}).then(res => {
+					if (res.code === 200 && res.data.records.length !== 0) {
+						res.data.records.forEach((item, index) => {
+							// if (index === 0) {
+							//     workingProcedure.push({ id: item.id, name: item.name, isActive: true })
+							// } else {
+								this.workingProcedure.push({ id: item.id, name: item.name, isActive: false })
+							// }
+						})
 					}
 				})
-				this.listData.procedureIds = pmodelOrgId
-				this.listData.page = 0
-				this.finished = false
-				this.lists = []
-				// this.getLists()
-				// this.pageCounts()
 			},
-			// 鑾峰彇璁″垝鍒楄〃鏁版嵁
-			getLists() {
-				console.log('getLists')
+			// 鎼滅储寮规鎻愪氦
+			submit() {
+				this.data.forEach(item => {
+					if (item.isActive) {
+						this.pageData.checkType = item.id
+					}
+				})
+				this.workingProcedure.forEach(item => {
+					if (item.isActive) {
+						this.pageData.procedureId = item.id
+					}
+				})
+				this.pageData.page = 0
+				this.listData = []
+				this.finished = false
+				this.onLoads()
+			},
+			// 鍒楄〃
+			onLoads() {
 				if (!this.finished) {
+					this.pageData.page = this.pageData.page += 1
 					this.loading = true
-					this.listData.page = this.listData.page++
-					getList({
-						capacity: this.listData.capacity,
+					page({
+						capacity: this.pageData.capacity,
+						page: this.pageData.page,
 						model: {
-							mixParam: this.listData.mixParam,
-							startDate: this.listData.startDate,
-							endDate: this.listData.endDate,
-							procedureIdList: this.listData.procedureIds ? this.listData.procedureIds : [],
-							factoryId: this.listData.departIds,
-							statusList: this.listData.cateIds
-						},
-						page: this.listData.page,
-						sorts: [
-							{
-								direction: 'ASC',
-								property: 'publishDate'
-							}
-						]
+							minParam: this.pageData.minParam,
+							checkStartDate: this.pageData.checkStartDate,
+							checkEndDate: this.pageData.checkEndDate,
+							checkType: this.pageData.checkType,
+							procedureId: this.pageData.procedureId,
+							workorderId: this.pageData.workorderId,
+							batch: this.pageData.batch
+						}
 					}).then(res => {
-						this.loading = false
-						this.listData.total = res.data.total
+						this.isLoading = false
 						if (this.refreshing) {
-							this.lists = []
+							this.listData = []
 							this.refreshing = false;
 						}
-						if (res.code === 200 && res.data.records.length !== 0) {
-							if (this.lists.length === 0) {
-								this.lists = res.data.records
-							} else {
-								this.lists.push(...res.data.records)
-							}
+						this.loading = false
+						if (res.code === 200 && res.data.records && res.data.records.length !== 0) {
+							this.pageData.total = res.data.total
+							this.listData.push(...res.data.records)
 						} else {
 							this.finished = true
 						}
 					}).catch(err => {
+						this.isLoading = false
 						this.loading = false
 						this.finished = true
 						if (this.refreshing) {
-							this.lists = []
+							this.listData = []
 							this.refreshing = false;
 						}
 					})

--
Gitblit v1.9.3