页面跳转传值

79 阅读1分钟

当前页面

<template>
	<view>
		<ps-application-header title="工序验收" :isRight="true" :isBack="true" @back="goBack">
			<template v-slot:right>
				<u--text size="32rpx" :block="false" text="筛选" color="#ffffff" :bold="true" @click="filterClick"></u--text>
			</template>
		</ps-application-header>
		<u-sticky bgColor="#fff">
			<!-- 	<u-tabs :current="current" :list="tabs" lineWidth="70" lineHeight="2" :scrollable="false" @click="tabClick"
				itemStyle="height:70rpx;" style="min-width: 100%; align-items: center;">
			</u-tabs> -->
			<wly-tabs v-model="current" :pills="true" :scroll="false" field="name" :lineAnimation="true" :tabs="tabs"
				lineHeight="2rpx" @change="changeTab"></wly-tabs>

		</u-sticky>
		<!-- <view v-for="(item, index) in paramsData">
			{{item}} {{index}}
		</view> -->
		<view class="box-list-card">
			<view class="card-background margin-top" v-for="(item,index) in listData" :key="index">
				<view class="card-header">
					<u--text prefixIcon="/static/flag_ico.png" iconStyle="margin-right: 15rpx; width:40rpx;height:40rpx"
						:bold="true" size="24rpx" :text="item.projectName"></u--text>
					<u-tag class="header-tag" v-if="item.status == 1" type="error" text="待处理" size="mini" plain> </u-tag>
					<u-tag class="header-tag" v-if="item.status == 2" type="success" text="验收通过" size="mini" plain> </u-tag>
					<u-tag class="header-tag" v-if="item.status == 3" type="error" text="驳回" size="mini" plain> </u-tag>
				</view>
				<u-line class="card-line" margin="10rpx 0" color="#e4e7ed"></u-line>
				<view class="card-body">
					<view class="card-tag margin-top">
						<u-tag class="card-item-tag" :text="item.examineType" size="mini" bgColor="#c0c0c0" color="#000000"
							borderColor="#c0c0c0"> </u-tag>
						<u-tag class="card-item-tag" :text="item.examineStage" size="mini" bgColor="#c0c0c0" color="#000000"
							borderColor="#c0c0c0"> </u-tag>
					</view>
					<view class="padding-top">
						<u--text prefixIcon="map-fill" iconStyle="color:#cccccc;margin-right:15rpx" size="26rpx"
							:text="item.address" color="#000000" :bold="true"></u--text>
					</view>
					<view class="padding-top flex-layout">
						<text style="margin-right:10rpx;color: #000000;font-size: 26rpx; font-weight: bolder;">验收结果:</text>
						<u--text size="26rpx" :block="false" :text="item.examineResult" color="#000000" :bold="true"></u--text>
					</view>
					<view class="card-img padding-top">
						<u--image class="card-item-img" radius="4" width="140rpx" height="140rpx" shape="square" :showLoading="true"
							src="https://cdn.uviewui.com/uview/album/1.jpg" mode="scaleToFill"></u--image>
						<u--image class="card-item-img" radius="4" width="140rpx" height="140rpx" shape="square" :showLoading="true"
							src="https://cdn.uviewui.com/uview/album/1.jpg" mode="scaleToFill"></u--image>
						<u--image class="card-item-img" radius="4" width="140rpx" height="140rpx" shape="square" :showLoading="true"
							src="https://cdn.uviewui.com/uview/album/1.jpg" mode="scaleToFill"></u--image>
						<u--image class="card-item-img" radius="4" width="140rpx" height="140rpx" shape="square" :showLoading="true"
							src="https://cdn.uviewui.com/uview/album/1.jpg" mode="scaleToFill"></u--image>
					</view>
					<view class="padding-top flex-layout">
						<text style="margin-right:10rpx;color: #000000;font-size: 26rpx;">验收人:</text>
						<u--text size="26rpx" :block="false" :text="item.examineMan" color="#000000" :bold="false"></u--text>
					</view>
					<view class="padding-top flex-layout">
						<text style="margin-right:10rpx;color: #000000;font-size: 26rpx;">验收时间:</text>
						<u--text size="26rpx" :block="false" :text="item.examineTime" color="#000000" :bold="false"></u--text>
					</view>
					<view class="padding-top flex-layout">
						<text style="margin-right:10rpx;color: #000000;font-size: 26rpx;">验收人所属单位:</text>
						<u--text size="26rpx" :block="false" :text="item.unit" color="#000000" :bold="false"></u--text>
					</view>
				</view>

			</view>
		</view>
		<view class="foot-button">
			<u-button class="submit-button" type="primary" @click="startClick" text="发起验收"></u-button>
		</view>
	</view>
</template>


<script>
	export default {
		data() {
			return {
				iconImg: '/static/me/green_buctet.png',
				iconImg1: '/static/flag_ico.png',
				tabs: [{
						id: 1,
						name: '全部',
						disabled: false
					},
					{
						id: 2,
						name: '待处理',
						disabled: false
					},
					{
						id: 3,
						name: '与我相关',
						disabled: false
					},
				],
				listData: [{
						projectName: '老城区改造二项目',
						status: 1,
						examineSort: '工程验收',
						examineType: '工序验收',
						examineStage: '自检',
						subentry: '1#楼地基与基础',
						address: '8#楼-地基与基础-2层-钢筋绑扎',
						examineResult: '符合要求',
						examineMan: '安培江',
						examineTime: '2023-08-29 15:23:27',
						unit: '北京北控生态建设集团有限公司-施工部',
					},
					{
						projectName: '老城区改造二项目',
						status: 2,
						examineSort: '检验批验收',
						examineType: '工序验收',
						examineStage: '自检',
						subentry: '1#楼地基与基础',
						address: '8#楼-地基与基础-2层-钢筋绑扎',
						examineResult: '合格',
						examineMan: '李容俊',
						examineTime: '2023-08-29 15:23:27',
						unit: '北京北控生态建设集团有限公司-施工部',
					},
					{
						projectName: '老城区改造二项目',
						status: 1,
						examineSort: '工程验收',
						examineType: '工序验收',
						examineStage: '自检',
						subentry: '1#楼地基与基础',
						address: '8#楼-地基与基础-2层-钢筋绑扎',
						examineResult: '符合要求',
						examineMan: '安培江',
						examineTime: '2023-08-29 15:23:27',
						unit: '北京北控生态建设集团有限公司-施工部',
					},
					{
						projectName: '老城区改造二项目',
						status: 2,
						examineSort: '检验批验收',
						examineType: '工序验收',
						examineStage: '自检',
						subentry: '1#楼地基与基础',
						address: '8#楼-地基与基础-2层-钢筋绑扎',
						examineResult: '合格',
						examineMan: '李容俊',
						examineTime: '2023-08-29 15:23:27',
						unit: '北京北控生态建设集团有限公司-施工部',
					}
				],
				current: 0,
				paramsData: {
					// aaa:'111'
				}
			}
		},
		onLoad(para) {
			let _this = this
			uni.$on('filterParams', function(data) {
				_this.paramsData = data.paramsData
				// debugger
				this.$forceUpdate();
			})
		},
		onShow() {},
		methods: {
			changeTab() {},
			// 筛选
			filterClick() {
				let _this = this
				uni.navigateTo({
					url: '/pages/tabBar/me/qualityAcceptance/filterSearch',
					success: function(res) {
						// 通过eventChannel向被打开页面传送数据
						res.eventChannel.emit('acceptDataPage', _this.paramsData)
					}
				})

			},
			getData(data) {
				// this.paramsData = data
			},
			// 返回
			goBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			startClick() {},
		}
	}
</script>

<style lang="scss" scoped>
	.box-list-card {
		margin-bottom: 120rpx;
	}

	.foot-button {
		display: flex;
		height: 80rpx;
		padding: 16rpx;
		background-color: #fff;
		position: fixed;
		width: calc(100% - 32rpx);
		bottom: 0;
	}
</style>

跳转 页面 方法

onLoad(option) {
			let _this = this
			const eventChannel = this.getOpenerEventChannel();
			// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
			eventChannel.on('acceptDataPage', function(data) {

				_this.defaultSelectedId = []
				if (!uni.$u.test.isEmpty(data)) {
					if (data.status != null) {
						_this.defaultSelectedId[0] = []
						_this.defaultSelectedId[0][0] = data.status
					} else {
						_this.defaultSelectedId[0] = []
					}
					if (data.category != null) {
						_this.defaultSelectedId[1] = []
						_this.defaultSelectedId[1][0] = data.category
					} else {
						_this.defaultSelectedId[1] = []
					}
					_this.formData = data
					if (_this.formData.startDate != null) {
						_this.checkDate.startDate = _this.formData.startDate
					}
					if (_this.formData.endDate != null) {
						_this.checkDate.endDate = _this.formData.endDate
					}
					console.log(_this.defaultSelectedId,_this.formData, '_this.formData')
				}
			})
		},