From 964faa1077a89713910063c39ebe08fac4e4c56e Mon Sep 17 00:00:00 2001
From: Houjie <714924425@qq.com>
Date: 星期四, 24 七月 2025 17:44:18 +0800
Subject: [PATCH] 企业维修适配修改

---
 pages/reportRepair/reportRepair.vue |  107 ++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 80 insertions(+), 27 deletions(-)

diff --git a/pages/reportRepair/reportRepair.vue b/pages/reportRepair/reportRepair.vue
index 4141107..f86e6a8 100644
--- a/pages/reportRepair/reportRepair.vue
+++ b/pages/reportRepair/reportRepair.vue
@@ -1,5 +1,5 @@
 <template>
-	<view class="container">
+	<view v-if="authIncludes('eam:reportRepair:add')" class="container">
 		<cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
 			<block slot="backText">杩斿洖</block>
 			<block slot="content">鏂板-鎶ヤ慨</block>
@@ -7,12 +7,9 @@
 
 		<uni-forms ref="form" :modelValue="formData" validate-trigger="bind" err-show-type="undertext">
 			<uni-group top="1">
-				<!-- <uni-forms-item required name="num" label="璁惧缂栧彿:">
-					<uni-data-select v-model="formData.num" :localdata="equipmentList" @change="changeEquipmentList"
-						placeholder="璇烽�夋嫨" />
-				</uni-forms-item> -->
+
 				<uni-forms-item required :label-width="100" name="num" label="璁惧缂栧彿:">
-					<uni-easyinput v-model=" formData.numSear" placeholder="璇烽�夋嫨" :disabled="true" suffixIcon="search"
+					<uni-easyinput v-model="formData.numSear" placeholder="璇烽�夋嫨" :disabled="true" suffixIcon="search"
 						@iconClick="OnenterpriseId()" />
 				</uni-forms-item>
 				<uni-forms-item required :label-width="100" name="name" label="鏁呴殰绠�绉�:">
@@ -23,7 +20,11 @@
 					<uni-easyinput v-model="formData.faultType" :disabled='true' />
 				</uni-forms-item>
 				<uni-forms-item required :label-width="100" name="faultDescription" label="鏁呴殰鎻忚堪:">
-					<uni-easyinput v-model="formData.faultDescription" :disabled='true' />
+					<uni-easyinput v-model="formData.faultDescription" />
+				</uni-forms-item>
+				<uni-forms-item name="outNum" label="鎶ヤ慨鍥剧墖:">
+					<uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" :sourceType="sourceType"
+						@select="select" @progress="progress" @success="success" @fail="fail" @delete="deletea" />
 				</uni-forms-item>
 				<uni-forms-item required name="name" :label-width="100" label="鏄惁鍋滄満:">
 					<uni-data-select v-model="formData.breakdownFlag" :localdata="isTrueList" @change="changeisTrueList"
@@ -33,14 +34,10 @@
 					<uni-datetime-picker type="datetime" v-model="formData.loadTime" />
 				</uni-forms-item>
 
-				<uni-forms-item name="outNum" label="鎶ヤ慨鍥剧墖:">
-					<uni-file-picker limit="9" :value="fileLists" :image-styles="imageStyles" :sourceType="sourceType"
-						@select="select" @progress="progress" @success="success" @fail="fail" @delete="deletea" />
-				</uni-forms-item>
 
-				<uni-forms-item name="faultDescription" label="澶囨敞:">
+<!-- 				<uni-forms-item name="faultDescription" label="澶囨敞:">
 					<uni-easyinput type="textarea" v-model="formData.remark" />
-				</uni-forms-item>
+				</uni-forms-item> -->
 			</uni-group>
 		</uni-forms>
 
@@ -51,12 +48,23 @@
 
 
 	</view>
+	<view v-else class="container">
+		<cu-custom :bgColor="NavBarColor" :isBack="true" backRouterName="productionTask">
+			<block slot="backText">杩斿洖</block>
+			<block slot="content">鏂板-鎶ヤ慨</block>
+		</cu-custom>
+
+		<view class="padding flex flex-direction">
+			褰撳墠鐢ㄦ埛娌℃湁鎿嶄綔鏉冮檺
+		</view>
+	</view>
 </template>
 
 <script>
 	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
 	export default {
 		mixins: [MescrollMixin], // 浣跨敤mixin
+
 		data() {
 			return {
 				// 鍥剧墖鍥炴樉
@@ -72,11 +80,11 @@
 				equipmentList: [],
 				isTrueList: [{
 						text: "鏄�",
-						value: "0"
+						value: 0
 					},
 					{
 						text: "鍚�",
-						value: "1"
+						value: 1
 					}
 				],
 				type: 'top',
@@ -90,7 +98,7 @@
 					faultNameList: [],
 					faultName: '',
 					faultType: '',
-					breakdownFlag: '',
+					breakdownFlag: 1,
 					loadTime: Date.now(),
 					faultDescription: ''
 				},
@@ -126,10 +134,18 @@
 				announcement1: [],
 				msg1Count: 0,
 				msg2Count: 0,
-				msg1Title: ""
+				msg1Title: "",
+				equipmentId: '',
+				AuthLsit: []
 			}
 		},
+		mounted() {
+			console.log('浠� store 鑾峰彇鐨� auth:', this.$store.getters.getAuth)
+		},
 		computed: {
+			authList() {
+				return this.$store.getters.getAuth || []
+			},
 			top() {
 				return this.CustomBar * 2 + 130
 			},
@@ -164,10 +180,13 @@
 			this.getSera()
 		},
 		created() {
-			// this.getEquipment();
+
 			this.getfaultReasonList();
 		},
 		methods: {
+			authIncludes(code) {
+				return this.authList.some(auth => auth.action === code)
+			},
 			getSera() {
 				//鑱旂綉鍔犺浇鏁版嵁
 				this.$http.get(this.url.part, {
@@ -184,6 +203,7 @@
 					console.log(this.announcement1);
 					//璁剧疆鍒楄〃鏁版嵁
 					if (res.data.success) {
+						this.equipmentId = this.announcement1.id
 						this.formData.numSear = this.announcement1.equipmentCode + '[' + this.announcement1
 							.equipmentName +
 							']'
@@ -213,7 +233,7 @@
 				for (let i = 0; i < this.formData.faultNameList.length; i++) {
 					if (this.formData.faultNameList[i].id === value) {
 						this.formData.faultType = this.formData.faultNameList[i].faultCategory_dictText
-						this.formData.faultDescription = this.formData.faultNameList[i].faultDescription
+						// this.formData.faultDescription = this.formData.faultNameList[i].faultDescription
 					}
 
 				}
@@ -239,6 +259,7 @@
 			},
 
 			changeisTrueList(e) {
+				console.log(e)
 				this.formData.breakdownFlag = e;
 			},
 			select(e) {
@@ -299,14 +320,19 @@
 				console.log('鍒犻櫎鍥剧墖', e);
 			},
 			ProductionTask() {
-				if (this.formData.num == 0 || this.formData.num == undefined) {
+				console.log(this.formData.num)
+
+
+				if (this.formData.num === undefined || this.formData.num === null || this.formData.num === '') {
 					uni.showToast({
 						icon: "none",
 						title: '璁惧缂栧彿涓虹┖!',
 						duration: 2000
 					});
-					return false
+					return false;
 				}
+
+
 				if (this.formData.faultName == 0 || this.formData.faultName == undefined) {
 					uni.showToast({
 						icon: "none",
@@ -315,6 +341,24 @@
 					});
 					return false
 				}
+				if (this.formData.faultDescription == 0 || this.formData.faultDescription == undefined) {
+					uni.showToast({
+						icon: "none",
+						title: '鏁呴殰鎻忚堪涓虹┖!',
+						duration: 2000
+					});
+					return false
+				}
+
+				if (this.formData.breakdownFlag === undefined || this.formData.breakdownFlag === null) {
+					uni.showToast({
+						icon: "none",
+						title: '鏄惁鍋滄満涓虹┖!',
+						duration: 2000
+					});
+					return false;
+				}
+
 				// 璇锋眰寮�濮� 澧炲姞閬僵灞�
 				uni.showLoading({
 					mask: true,
@@ -338,16 +382,25 @@
 							title: '鎻愪氦鎴愬姛',
 							duration: 2000
 						});
-						this.$Router.replaceAll({
-							name: 'index'
+						console.log(this.equipmentId)
+						// uni.reLaunch({
+						// 	url: `/pages/reportRepair/reportRepairList/reportRepairList?equipmentId=${this.equipmentId}`
+						// })
+						uni.reLaunch({
+							url: '/pages/index/index'
 						})
-
+					} else {
+						uni.showToast({
+							icon: "error",
+							title: res.data.message,
+							duration: 2000
+						});
 					}
 				}).catch(() => {
-					this.$tip.loaded();
+					uni.hideLoading();
 					uni.showToast({
 						icon: "error",
-						title: '鎻愪氦澶辫触',
+						title: '缃戠粶杩炴帴澶辫触',
 						duration: 2000
 					});
 				});
@@ -378,7 +431,7 @@
 	}
 
 	.popupView {
-		margin-top: 85px;
+		margin-top: 45px;
 		height: auto;
 	}
 </style>
\ No newline at end of file

--
Gitblit v1.9.3