From 830ce15ad9894bdfd442ecd3e8051bd0cd79836b Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Sat, 08 Oct 2022 14:34:57 +0800
Subject: [PATCH] 维修工单增加开始维修和完成维修功能,添加维修材料申请功能

---
 pages/repairsorder/list.vue |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 5 deletions(-)

diff --git a/pages/repairsorder/list.vue b/pages/repairsorder/list.vue
index de7ddf1..02fca27 100644
--- a/pages/repairsorder/list.vue
+++ b/pages/repairsorder/list.vue
@@ -29,11 +29,12 @@
 							</view>
 						</view>
 						<view class="onve-right">
-							<u-button class='greens' size="mini" v-if="current == 0">开始维修
+							<u-button class='greens' size="mini" v-if="current == 0" @click="startRepair(item)">开始维修
 							</u-button>
-							<u-button class='greens' size="mini" v-if="current == 1">完成维修
+							<u-button class='greens' size="mini" v-if="current == 1" @click="finishRepair(item)">完成维修
 							</u-button>
-
+							<u-button class='o-r-down' plain type="error" size="mini" v-if="current != 2" @click="materialRequire">材料申请
+							</u-button>
 						</view>
 					</view>
 
@@ -47,7 +48,7 @@
 
 <script>
 	import {
-		getList
+		getList,update
 	} from "@/api/repairsorder/repairsorder";
 	export default {
 		data() {
@@ -76,6 +77,9 @@
 				repairsorderList: null
 			}
 		},
+		onShow() {
+			this.getList()
+		},
 		created() {
 			this.getList()
 		},
@@ -92,6 +96,11 @@
 				getList(this.page.currentPage, this.page.pageSize, this.query).then(res => {
 					const data = res.data;
 					this.page.total = data.total;
+					data.records.forEach(e=>{
+						if(e.picUrls.length==0){
+							e.picUrls = null
+						}
+					})
 					this.repairsorderList = data.records;
 				})
 			},
@@ -110,8 +119,49 @@
 				uni.navigateTo({
 					url: '/pages/repairsorder/detail?id=' + id
 				})
+			},
+			//开始维修
+			startRepair(item){
+				uni.showModal({
+					title:"提示",
+					content:"是否开始维修?",
+					success:(res)=> {
+						if(res.confirm){
+							item.state = '2'
+							update(item).then(res=>{
+								if(res.code == 200){
+									this.page.currentPage = 1
+									this.getList()
+								}
+							})
+						}
+					}
+				})
+			},
+			//维修完成
+			finishRepair(item){
+				uni.showModal({
+					title:"提示",
+					content:"是否结束任务?",
+					success:(res)=> {
+						if(res.confirm){
+							item.state = '3'
+							update(item).then(res=>{
+								if(res.code == 200){
+									this.page.currentPage = 1
+									this.getList()
+								}
+							})
+						}
+					}
+				})
+			},
+			//维修材料申请
+			materialRequire(){
+				uni.navigateTo({
+					url: '/pages/inventory/materialRequire'
+				})
 			}
-
 		}
 	}
 </script>

--
Gitblit v1.9.3