<template>
	<view class="detail-container">

		<uni-section title="设备基本信息" type="line">
			<view style="background: white;padding: 0px 20px 20px 20px;">
				<u--form labelPosition="left" :model="equipInfo" label-width="100px">
					<u-form-item label="设备名称:" prop="" borderBottom>
						{{equipInfo.equipName}}
					</u-form-item>
					<u-form-item label="设备编号:" prop="" borderBottom>
						{{equipInfo.equipNum}}
					</u-form-item>
					<u-form-item label="生产厂商:" prop="" borderBottom>
						{{equipInfo.equipManufacturer}}
					</u-form-item>
					<u-form-item label="序列号:" prop="" borderBottom>
						{{equipInfo.equipSerialNum}}
					</u-form-item>
					<u-form-item label="出厂日期:" prop="" borderBottom>
						{{equipInfo.equipProductionDate}}
					</u-form-item>
					<u-form-item label="设备类别:" prop="" borderBottom>
						{{equipInfo.equipCategoryName}}
					</u-form-item>
					<u-form-item label="设备部门名称:" prop="" borderBottom>
						{{equipInfo.deptName}}
					</u-form-item>
					<u-form-item label="安装位置:" prop="" borderBottom>
						{{equipInfo.equipInstallationLocation}}
					</u-form-item>
					<u-form-item label="采购日期:" prop="" borderBottom>
						{{equipInfo.equipPurchaseDate}}
					</u-form-item>
					<u-form-item label="设备价格:" prop="" borderBottom>
						{{equipInfo.equipPrice}}
					</u-form-item>
					<u-form-item label="技术参数:" prop="" borderBottom>
						{{equipInfo.equipTechnicalSpecifications}}
					</u-form-item>
					<u-form-item label="备注:" prop="" borderBottom>
						{{equipInfo.remark}}
					</u-form-item>
				</u--form>
			</view>
		</uni-section>
		<uni-section style="margin-top: -20px;" title="设备相关信息" type="line">
			<view class="grid-body">
				<uni-grid :column="3" :showBorder="false">
					<uni-grid-item>
						<view class="grid-item-box" @click="clickMaintenance">
							<uni-icons type="shop-filled" size="30"></uni-icons>
							<text class="text">保养记录</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box" @click="clickService">
							<uni-icons type="gear-filled" size="30"></uni-icons>
							<text class="text">维修记录</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box" @click="clickEquipCancel">
							<uni-icons type="clear" size="30"></uni-icons>
							<text class="text">报废记录</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box" @click="clickParts">
							<uni-icons type="paperclip" size="30"></uni-icons>
							<text class="text">相关备件</text>
						</view>
					</uni-grid-item>
					<uni-grid-item>
						<view class="grid-item-box" @click="clickDrawing">
							<uni-icons type="images" size="30"></uni-icons>
							<text class="text">设备图纸</text>
						</view>
					</uni-grid-item>
				</uni-grid>
			</view>
		</uni-section>
	</view>
</template>

<script>
	import {
		getEquipInfoById
	} from "@/api/equip/equip.js"

	export default {
		data() {
			return {
				equipInfo: {},
				equipId: null
			}
		},
		created() {
			this.getEquipInfo();
		},
		onLoad(opts) {
			this.equipId = opts.equipId;
		},
		methods: {
			getEquipInfo() {
				getEquipInfoById(this.equipId).then((res) => {
					this.equipInfo = res.data;
				})
			},
			clickDrawing() {
				this.$tab.navigateTo("/pages/work/drawing/listDrawing?equipId=" + this.equipId + "&equipName=" + this
					.equipInfo.equipName)
			},
			clickParts() {
				this.$tab.navigateTo("/pages/work/parts/listParts?equipId=" + this.equipId + "&equipName=" + this.equipInfo
					.equipName)
			},
			clickMaintenance() {
				this.$tab.navigateTo("/pages/work/maintenance/listMaintenance?equipId=" + this.equipId + "&equipName=" +
					this.equipInfo.equipName)
			},
			clickService() {
				this.$tab.navigateTo("/pages/work/service/listService?equipId=" + this.equipId + "&equipName=" + this
					.equipInfo.equipName)
			},
			clickEquipCancel() {
				this.$tab.navigateTo("/pages/work/equipCancel/listEquipCancel?equipId=" + this.equipId + "&equipName=" +
					this.equipInfo.equipName)
			},
		}
	}
</script>

<style>
	/* #ifndef APP-NVUE */
	page {
		display: flex;
		flex-direction: column;
		box-sizing: border-box;
		background-color: #fff;
		min-height: 100%;
		height: auto;
	}

	view {
		font-size: 14px;
		line-height: inherit;
	}

	/* #endif */

	.text {
		text-align: center;
		font-size: 26rpx;
		margin-top: 10rpx;
	}

	.grid-item-box {
		flex: 1;
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px 0;
	}

	.uni-margin-wrap {
		width: 690rpx;
		width: 100%;
		;
	}

	.swiper {
		height: 300rpx;
	}

	.swiper-box {
		height: 150px;
	}

	.swiper-item {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: column;
		justify-content: center;
		align-items: center;
		color: #fff;
		height: 300rpx;
		line-height: 300rpx;
	}

	@media screen and (min-width: 500px) {
		.uni-swiper-dot-box {
			width: 400px;
			/* #ifndef APP-NVUE */
			margin: 0 auto;
			/* #endif */
			margin-top: 8px;
		}

		.image {
			width: 100%;
		}
	}

	.detail-container {
		padding: 12px;
		background: #f1f1f1;

		//设置按钮的样式，靠右
		.worker-button {
			float: right;
			/* margin-right: 24px; */
			margin-top: 10px;
		}
	}
</style>