From f2ac76666299407545fb733f0d21f6e8cfe538a3 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 19 八月 2025 09:27:40 +0800
Subject: [PATCH] 优化

---
 h5/pages/reporting_she/reporting_she.vue |  135 ++++++++++++++++++++++++++------------------
 1 files changed, 80 insertions(+), 55 deletions(-)

diff --git a/h5/pages/reporting_she/reporting_she.vue b/h5/pages/reporting_she/reporting_she.vue
index a842b81..87fcdc9 100644
--- a/h5/pages/reporting_she/reporting_she.vue
+++ b/h5/pages/reporting_she/reporting_she.vue
@@ -7,12 +7,12 @@
 			<u-form-item label="閮ㄩ棬" labelWidth="120" prop="companyName" borderBottom required>
 				<u--input v-model="model.companyName" border="none" placeholder="璇烽�夋嫨閮ㄩ棬" disabledColor="#ffffff"
 					disabled></u--input>
-				<u-icon slot="right" name="arrow-right"></u-icon>
+				<!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
 			</u-form-item>
 			<u-form-item label="涓婃姤鏃堕棿" labelWidth="120" prop="submitDate" borderBottom required>
 				<u--input v-model="model.submitDate" border="none" placeholder="璇烽�夋嫨涓婃姤鏃堕棿" disabledColor="#ffffff"
 					disabled></u--input>
-				<u-icon slot="right" name="arrow-right"></u-icon>
+				<!-- <u-icon slot="right" name="arrow-right"></u-icon> -->
 			</u-form-item>
 			<u-form-item label="鍙戠敓鏃堕棿" labelWidth="120" prop="happenTime" borderBottom @click="openTime" required>
 				<u--input v-model="model.happenTime" border="none" placeholder="璇烽�夋嫨鍙戠敓鏃堕棿" disabledColor="#ffffff"
@@ -48,18 +48,18 @@
 				<u--input v-model="model.remark" border="none" placeholder="濡傞�夋嫨鍏跺畠鍖哄煙璇峰姟蹇呭~鍐欏叿浣撲綅缃�"></u--input>
 			</u-form-item>
 			<u-form-item label="鏄惁澶栭儴灏卞尰" labelWidth="120" prop="outJiuyi" borderBottom required>
-				<u-radio-group v-model="model.outJiuyi" placement="row">
+				<u-radio-group v-model="model.outJiuyi" placement="row" @change="model.isYiwushi = ''; model.isHurted = ''">
 					<u-radio label="鍚�" name="0"></u-radio>
 					<u-radio label="鏄�" name="1"></u-radio>
 				</u-radio-group>
 			</u-form-item>
-			<u-form-item label="鏄惁鍖诲姟瀹�" labelWidth="120" prop="isYiwushi" borderBottom required>
-				<u-radio-group v-model="model.isYiwushi" placement="row">
+			<u-form-item label="鏄惁鍖诲姟瀹�" labelWidth="120" prop="isYiwushi" borderBottom required v-if="model.outJiuyi === '0'">
+				<u-radio-group v-model="model.isYiwushi" placement="row" @change="model.isHurted = ''">
 					<u-radio label="鍚�" name="0"></u-radio>
 					<u-radio label="鏄�" name="1"></u-radio>
 				</u-radio-group>
 			</u-form-item>
-			<u-form-item label="鏄惁鍙椾激" labelWidth="120" prop="isHurted" borderBottom required>
+			<u-form-item label="鏄惁鍙椾激" labelWidth="120" prop="isHurted" borderBottom required v-if="model.isYiwushi === '0'">
 				<u-radio-group v-model="model.isHurted" placement="row">
 					<u-radio label="鍚�" name="0"></u-radio>
 					<u-radio label="鏄�" name="1"></u-radio>
@@ -80,13 +80,13 @@
 				<u--textarea v-model="model.eventInfo" placeholder="璇疯緭鍏ヤ簨浠惰鏄�" style="margin-top: 15rpx;" maxlength="200" count></u--textarea>
 			</u-form-item>
 			<u-form-item label="涓婁紶鍥剧墖" labelWidth="120" prop="multifileList" labelPosition="top" borderBottom>
-				<u-upload
+				<UploadImage 
 					:fileList="model.multifileList"
-					@afterRead="afterRead"
-					@delete="deletePic"
-					accept="image"
-					name="1"
-					style="margin-top: 15rpx;"></u-upload>
+					folder="WORKORDER_FILE_PATH"
+					@dele="deletePic"
+					@getFileList="afterRead"
+					style="margin-top: 15rpx;"
+				/>
 			</u-form-item>
 		</u--form>
 		<u-button type="primary" text="鎻愪氦" @click="submit" style="margin-top: 60rpx;"></u-button>
@@ -105,7 +105,7 @@
 			<view class="slot-content">
 				<u-icon name="checkmark-circle-fill" color="#3875C5" size="70"></u-icon>
 				<text>鎻愪氦鎴愬姛</text>
-				<text>鎰熻阿鎮ㄧ殑鍙嶉</text>
+				<text>宸叉敹鍒版偍鐨勪笂鎶ワ紝绋嶅悗浼氭湁鐩稿叧鍚屼簨鍜屾偍鑱旂郴</text>
 			</view>
 		</u-modal>
 		<!-- 鍙戠敓鍦扮偣 -->
@@ -137,9 +137,10 @@
 
 <script>
 	import { mapState } from 'vuex'
+	import UploadImage from '@/components/uploadImage/uploadImage.vue'
 	import pengTree from '@/uni_modules/peng-tree/peng-tree/peng-tree.vue'
 	export default {
-		components: { pengTree },
+		components: { pengTree, UploadImage },
 		computed: {
 			...mapState(['userInfo'])
 		},
@@ -257,6 +258,39 @@
 			this.getType()
 		},
 		methods: {
+			selectImage() {
+				var that = this
+				that.$ww.chooseImage({
+					count: 1,
+					sizeType: ['original', 'compressed'],
+					sourceType: ['album', 'camera'],
+					success(res) {
+						let serverIds = that.getUploadImage(res.localIds)
+						console.log(serverIds)
+					},
+					fail(err) {
+						console.log(err)
+					}
+				})
+			},
+			// 鑾峰彇鏈嶅姟鍣ㄥ浘鐗噄d
+			getUploadImage(localIds) {
+				var that = this
+				let serverIds = []
+				localIds.forEach(localId => {
+					that.$ww.uploadImage({
+						localId,
+						success(res) {
+							console.log(res.serverId)
+							serverIds.push(res.serverId)
+						},
+						fail(err) {
+							console.log(err)
+						}
+					})
+				})
+				return serverIds;
+			},
 			closeTime() {
 				this.show1 = false
 				this.canScroll()
@@ -320,6 +354,29 @@
 				this.canScroll()
 				this.show4 = false
 			},
+			next1() {
+				this.model.name = ''
+				this.model.submitDate = uni.$u.timeFormat(new Date().getTime(), 'yyyy-mm-dd hh:MM')
+				this.model.companyName = ''
+				this.model.happenTime = ''
+				this.model.memberType = ''
+				this.model.memberTypeName = ''
+				this.model.memberNames = ''
+				this.model.memberQwids = ''
+				this.model.localtionId = ''
+				this.model.localtionName = ''
+				this.model.remark = ''
+				this.model.outJiuyi = ''
+				this.model.isYiwushi = ''
+				this.model.isHurted = ''
+				this.model.typeId = ''
+				this.model.typeName = ''
+				this.model.workRelated = ''
+				this.model.eventInfo = ''
+				this.model.multifileList = []
+				this.model.fileList = []
+				this.model.type = 0
+			},
 			toDesc() {
 				uni.navigateTo({
 					url: `/pages/details_she/details_she?id=${this.id}`
@@ -328,55 +385,23 @@
 				this.show4 = false
 			},
 			// 鍒犻櫎鍥剧墖
-			deletePic(event) {
-				this.model.multifileList.forEach((item, index) => {
-					if (item.imgaddr === event.file.imgaddr) {
-						this.model.multifileList.splice(index, 1)
-					}
-				})
+			deletePic(index) {
+				this.model.multifileList.splice(index, 1)
 			},
 			// 鏂板鍥剧墖
-			async afterRead(event) {
-				// event.file.forEach(async (item) => {
-				// 	const filePath = item.url
-				// 	uni.uploadFile({
-				// 		url: this.$baseUrl + '/web/public/upload',
-				// 		filePath,
-				// 		name: "file",
-				// 		formData: {
-				// 			folder: "WORKORDER_FILE_PATH"
-				// 		},	
-				// 		success: (res) => {
-				// 			let obj = JSON.parse(res.data)
-				// 			if (obj.code === 200) {
-				// 				obj.data.fileurl = obj.data.imgaddr
-				// 				this.model.multifileList.push(obj.data)
-				// 			}
-				// 		}
-				// 	});
-				// })
-				uni.uploadFile({
-					url: this.$baseUrl + '/web/public/upload',
-					filePath: event.file.url,
-					name: "file",
-					formData: {
-						folder: "WORKORDER_FILE_PATH"
-					},	
-					success: (res) => {
-						let obj = JSON.parse(res.data)
-						if (obj.code === 200) {
-							obj.data.fileurl = obj.data.imgaddr
-							this.model.multifileList.push(obj.data)
-						}
-					}
-				});
+			async afterRead(arr) {
+				this.model.multifileList = [...this.model.multifileList, ...arr]
 			},
 			// 鎻愪氦
 			submit() {
 				var that = this
 				that.$refs.uForm.validate().then(async () => {
-					let res = await that.$u.api.workOrderCreate(that.model)
+					let form = JSON.parse(JSON.stringify(that.model))
+					form.submitDate = form.submitDate + ':00'
+					form.happenTime = form.happenTime + ':00'
+					let res = await that.$u.api.workOrderCreate(form)
 					if (res.code === 200) {
+						that.next1()
 						that.id = res.data
 						this.stopScroll()
 						that.show4 = true

--
Gitblit v1.9.3