From e144b1e91c4926efd99ef4d62029e3eda67fd72d Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Sat, 11 Nov 2023 18:15:45 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 subPackage/workbench/views/editExamine.vue |   92 +++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 78 insertions(+), 14 deletions(-)

diff --git a/subPackage/workbench/views/editExamine.vue b/subPackage/workbench/views/editExamine.vue
index 1e36b43..408d4da 100644
--- a/subPackage/workbench/views/editExamine.vue
+++ b/subPackage/workbench/views/editExamine.vue
@@ -6,10 +6,10 @@
 				<u-form-item label="场所位置" required class="form-item" prop="localtion">
 					<u--input border="none" v-model="form.localtion"></u--input>
 				</u-form-item>
-				<u-form-item label="场所名称" required class="form-item"  prop="placeName">
+				<u-form-item label="场所名称" required class="form-item" prop="placeName">
 					<u--input border="none" v-model="form.placeName"></u--input>
 				</u-form-item>
-				<u-form-item label="法人信息" required class="form-item"  prop="legalPerson">
+				<u-form-item label="法人信息" required class="form-item" prop="legalPerson">
 					<u--input border="none" v-model="form.legalPerson"></u--input>
 				</u-form-item>
 				<u-form-item label="法人电话" class="form-item">
@@ -20,7 +20,7 @@
 		<view class="">
 			<box-title title="营业执照"></box-title>
 			<view class="upload-img">
-				<u-upload :fileList="form.images" :previewFullImage="uploadConfig.previewFullImage"
+				<u-upload :fileList="form.imageUrls" :previewFullImage="uploadConfig.previewFullImage"
 					:accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple" :maxCount="uploadConfig.maxCount"
 					:capture="uploadConfig.capture" @afterRead="afterReadImg" @delete="deletePic">
 				</u-upload>
@@ -29,7 +29,7 @@
 		<view class="">
 			<box-title title="场所平面图"></box-title>
 			<view class="upload-img">
-				<u-upload :fileList="form.images" :previewFullImage="uploadConfig.previewFullImage"
+				<u-upload :fileList="form.planImageUrls" :previewFullImage="uploadConfig.previewFullImage"
 					:accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple" :maxCount="uploadConfig.maxCount"
 					:capture="uploadConfig.capture" @afterRead="afterReadImg" @delete="deletePic">
 				</u-upload>
@@ -45,13 +45,16 @@
 		<u-button type="success" plain class="add-person" @click="addPerson">在加一人</u-button>
 		<view class="btn-group">
 			<u-button class="btn-item" type="primary" @click="submit">提交</u-button>
-			<u-button class="btn-item">我上报的事件</u-button>
+			<u-button class="btn-item" @click="pushPage">我上报的事件</u-button>
 		</view>
 	</div>
 </template>
 
-<script>
-	import { updatePlaceExtData } from '@/api/placeExp/placeExp.js'
+<script>
+	import {
+		updatePlaceExtData,
+		getPlaceDetail
+	} from '@/api/placeExp/placeExp.js'
 	import uploadMixin from "@/mixin/uploadMixin";
 	import boxTtitle from '@/components/boxTitle/index.vue'
 	import formItem from '../components/formItem.vue'
@@ -63,6 +66,8 @@
 		data() {
 			return {
 				form: {
+					id: '',
+					placeId: '',
 					localtion: '',
 					placeName: '',
 					legalPerson: '',
@@ -87,22 +92,81 @@
 						trigger: ['blur', 'change']
 					}
 				},
-				personNum: 1
+				personNum: 1,
+				curSelectSite: {},
 			}
 		},
-		methods: {
-			updatePlaceExt() {
-				
+		onShow() {
+			this.curSelectSite = uni.getStorageSync('siteInfo')
+			this.getCsDetails()
+		},
+		methods: {
+			getCsDetails() {
+				getPlaceDetail({
+					placeId: this.curSelectSite.id
+				}).then(detailRes => {
+					const { code, data } = detailRes
+					if (code !== 200) {
+						uni.showToast({
+							title: '数据请求失败',
+							icon: 'error'
+						})
+						return
+					}
+					const placePractitioner = data?.placePractitioner || []
+					Object.keys(this.form).forEach(key => {
+						this.form[key] = data[key]
+						if(key === 'imageUrls' || key === 'planImageUrls') {
+							this.form[key] = []
+							!!data[key] && this.form[key].push()
+						}
+					})
+					this.personNum = placePractitioner.length
+					this.$nextTick(() => {
+						console.log(placePractitioner);
+						this.$refs.formItemRef.forEach((item, index) => {
+							item.form = placePractitioner[index]
+						})
+					})
+				})
+			},
+			updatePlaceExt(data) {
+				data['imageUrls'] = JSON.stringify(data['imageUrls'])
+				data['planImageUrls'] = JSON.stringify(data['planImageUrls'])
+				updatePlaceExtData({...data}).then(res => {
+					const { code } = res
+					if (code !== 200) {
+						uni.showToast({
+							title: '提交失败',
+							icon: 'error'
+						})
+						return
+					}
+					uni.showToast({
+						title: '提交成功',
+						icon: 'success',
+						complete() {
+							setTimeout(() => {
+								uni.navigateBack()
+							}, 1500)
+						}
+					})
+				})
 			},
 			addPerson() {
 				this.personNum++
 			},
 			submit() {
-				const personList = []
+				const placePractitioner = []
 				this.$refs.formItemRef.forEach(item => {
-					personList.push(item.form)
+					item.form.placeId = this.form.placeId
+					placePractitioner.push(item.form)
 				})
-				console.log(personList);
+				this.form.placePractitioner = placePractitioner
+				this.updatePlaceExt(this.form)
+			},
+			pushPage() {
+				this.$u.func.globalNavigator('/subPackage/workbench/views/cshw')
 			}
 		}
 	}

--
Gitblit v1.9.3