<template>
	<!-- 危险作业工程 -->
	<view>
		<view class="view-bg">
			<view>
				<view class="uni-list-cell">
					<view class="uni-list-cell-left">
						工程名称
					</view>
					<view class="uni-list-cell-db">
						<view v-if="isEmpty(projectObj.enginName)" style="margin-top: 10;" @click="pickerShow('name')">
							<span style="color: darkgray;">请选择工程</span>
						</view>
						<view v-else style="margin-top: 10;" @click="pickerShow('name')">
							<span style="color: black;">{{projectObj.enginName}}</span>
						</view>
					</view>

				</view>

			</view>

			<view>
				<view class="uni-list-cell">
					<view class="uni-list-cell-left">
						工程地点
					</view>
					<view class="uni-list-cell-db">

						<view style="margin-top: 10;">
							<span style="color: black;">{{projectObj.enginAddre}}</span>
						</view>
					</view>

				</view>
			</view>

			<view>
				<view class="uni-list-cell">
					<view class="uni-list-cell-left">
						作业基本信息
					</view>
					<view class="uni-list-cell-db">
						<view style="margin-top: 10;">
							<span style="color: black;">{{projectObj.basicInformation}}</span>
						</view>
					</view>

				</view>
			</view>
		</view>
		<view class="view-bg">

			<view>
				<view class="uni-list-cell">
					<view class="uni-list-cell-left">
						工程时间
					</view>
					<view class="uni-list-cell-db">
						<view v-if="isEmpty(projectObj.enginTime)" style="margin-top: 10;" @click="pickerShow('time')">
							<span style="color: darkgray;">请选择工程时间</span>
						</view>
						<view v-else style="margin-top: 10;" @click="pickerShow('time')">
							<span style="color: black;">{{projectObj.enginTime}}</span>
						</view>
					</view>

				</view>

			</view>
			<view>

				<view class="uni-list">
					<view class="container">

						<text>管径</text>
						<input class="uni-input" type="text" v-model="projectObj.pipeDiameter" placeholder="请输入管径"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">

						<text>管材</text>
						<input class="uni-input" type="text" v-model="projectObj.tubularProduct" placeholder="请输入管材"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>


				<view class="uni-list-cell">

					<view class="uni-list-cell-left">是否存在套管</view>
					<view class="uni-list-cell-db">
						<span style="color: black;">{{bushingText}}</span>
						<switch style="transform: scale(0.6,0.6);" @change="switchChangePipe" />
					</view>

				</view>

				<view class="uni-list">
					<view class="container">

						<text>管道压力</text>
						<input class="uni-input" type="text" v-model="projectObj.pipePressure" placeholder="请输入管道压力"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">

						<text>气源方向</text>
						<input class="uni-input" type="text" v-model="projectObj.gasSourceDirection"
							placeholder="请输入气源方向" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">

						<text>作业位置</text>
						<input class="uni-input" type="text" v-model="projectObj.taskPosition" placeholder="请输入作业位置"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">

						<text>作业相关阀门位置</text>
						<input class="uni-input" type="text" v-model="projectObj.valvePosition"
							placeholder="请输入作业相关阀门位置" maxlength="100"
							style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">

						<text>压力报告</text>
						<input class="uni-input" type="text" v-model="projectObj.stressReport" placeholder="请输入压力报告"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>


				<view class="uni-list">
					<view class="container">

						<text>监理旁站记录</text>
						<input class="uni-input" type="text" v-model="projectObj.supervisionRecord"
							placeholder="请输入监理旁站记录" maxlength="100"
							style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>


				<view class="uni-list">
					<view class="container">

						<text>工作联系单</text>
						<input class="uni-input" type="text" v-model="projectObj.workContactForm" placeholder="请输入工作联系单"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">

						<text>巡线确认单</text>
						<input class="uni-input" type="text" v-model="projectObj.linePatrolConfirmationForm"
							placeholder="请输入巡线确认单" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">

						<text>危险作业坑大小(长，宽，深)</text>
						<input class="uni-input" type="text" v-model="projectObj.hazardousWorkPitsLong"
							placeholder="请输入长" maxlength="100" style="margin-left: 10px;text-align: right;"></input>

						<input class="uni-input" type="text" v-model="projectObj.hazardousWorkPitsWide"
							placeholder="请输入宽" maxlength="100" style="margin-left: 10px;text-align: right;"></input>

						<input class="uni-input" type="text" v-model="projectObj.hazardousWorkPitsDeep"
							placeholder="请输入深" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list-cell">

					<view class="uni-list-cell-left">是否需要支护</view>
					<view class="uni-list-cell-db">
						<span style="color: black;">{{needSupportText}}</span>
						<switch style="transform: scale(0.6,0.6);" @change="switchChangeSupport" />
					</view>

				</view>

				<view class="uni-list">
					<view class="container">
						<text>作业坑内其他管道情况</text>
						<input class="uni-input" type="text" v-model="projectObj.otherPipelineConditionsWorkPit"
							placeholder="请输入作业坑内其他管道情况" maxlength="100"
							style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>


				<view class="uni-list">
					<view class="container">
						<text>现场负责人</text>
						<input class="uni-input" type="text" v-model="projectObj.siteHead" placeholder="请输入现场负责人"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>现场负责人联系方式</text>
						<input class="uni-input" type="text" v-model="projectObj.siteHeadPhone"
							placeholder="请输入现场负责人联系方式" maxlength="11"
							style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>作业人员信息</text>
						<input class="uni-input" type="text" v-model="projectObj.operatorInformation"
							placeholder="请输入作业人员信息" maxlength="100"
							style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>检口</text>
						<input class="uni-input" type="text" v-model="projectObj.inspectionPort" placeholder="请输入检口"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>管道刷油</text>
						<input class="uni-input" type="text" v-model="projectObj.pipelinePainting" placeholder="请输入管道刷油"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>管道防腐</text>
						<input class="uni-input" type="text" v-model="projectObj.pipelineCorrosionProtection"
							placeholder="请输入管道防腐" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>管道支护</text>
						<input class="uni-input" type="text" v-model="projectObj.pipelineSupport" placeholder="请输入管道支护"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>砌筑阀门井</text>
						<input class="uni-input" type="text" v-model="projectObj.masonryValveWell"
							placeholder="请输入砌筑阀门井" maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>保护井</text>
						<input class="uni-input" type="text" v-model="projectObj.protectionWell" placeholder="请输入保护井"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>管件保护井砌筑</text>
						<input class="uni-input" type="text" v-model="projectObj.pipeProtectionWelMasonry"
							placeholder="请输入管件保护井砌筑" maxlength="100"
							style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>回填</text>
						<input class="uni-input" type="text" v-model="projectObj.backfill" placeholder="请输入回填"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>夯实</text>
						<input class="uni-input" type="text" v-model="projectObj.tamp" placeholder="请输入夯实"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>平整场地</text>
						<input class="uni-input" type="text" v-model="projectObj.levelingTheSite" placeholder="请输入平整场地"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<view class="uni-list">
					<view class="container">
						<text>备注</text>
						<input class="uni-input" type="text" v-model="projectObj.remark" placeholder="请输入备注"
							maxlength="100" style="margin-left: 10px;text-align: right;"></input>
					</view>
				</view>

				<SelectPicker :list="rows" @change="projectListSelect" v-if="open" @close="close" titleKey="enginName"
					subtitleKey="id" v-model="enginName"></SelectPicker>
			</view>
		</view>
	</view>
</template>

<script>
	import SelectPicker from '../../components/selectPicker/select_picker.vue'

	import {
		getDangerousWorkProjectList,
		getDangerousWorkProjectDetails
	} from '@/api/common'
	export default {
		components: {
			SelectPicker
		},
		data() {
			return {
				projectValue: {},
				projectId: "",
				projectName: "",
				projectPosition: "",
				projectInfoContent: "",

				projectTime: "",
				pipeSize: "",
				pipeMaterial: "",
				isBushing: false,
				bushingText: "否",
				pipePressure: "",
				direction: "",
				workPosition: "",
				valvePosition: "",
				stressReport: "",
				supervisionSiteRecord: "",
				workContactForm: "",
				linePatrolForm: "",
				workHoleLong: "",
				workHoleWide: "",
				workHoleHeight: "",
				isNeedSupport: false,
				needSupportText: "否",
				otherPipelineCondition: "",
				siteLeaderName: "",
				siteLeaderPhone: "",
				workPersonInfo: "",
				inspectionPort: "",
				pipelineOil: "", //管道刷油
				pipelineCorrosion: "", //管道腐蚀
				masonryValveWell: "", //砌筑阀门井
				protectionWell: "", //保护井
				pipeProtectionwellMasonry: "", //管件保护井砌筑
				backfill: "", //回填
				tamp: "", //夯实
				levelSite: "", //平整场地
				file: [], // 附件
				pics: [], // 附件返回
				rows: [],
				open: false,
				projectObj: {},


			}
		},
		created() {},
		methods: {
			isEmpty(str) {
				return (!str || 0 === str.length);
			},
			pickerShow(e) {
				if (e == 'name') {
					this.open = true;
					let param = {};
					getDangerousWorkProjectList(param).then(res => {
						this.rows = res.rows;
					})
				}
			},
			changeSelect(e) {

			},
			open() {
				this.open = true;
			},
			close() {
				this.open = false;
			},
			projectListSelect(item, index) {
				this.open = false;
				getDangerousWorkProjectDetails(item.id).then(res => {
					debugger
					this.projectObj = res.data;
				})
			},
			switchChangePipe(e) {
				this.isBushing = e.detail.value;
				if (this.isBushing) {
					this.bushingText = "是";
				} else {
					this.bushingText = "否";
				}
				console.log("bush:" + this.isBushing + this.bushingText)
			},
			switchChangeSupport(e) {
				this.isNeedSupport = e.detail.value;
				if (this.isNeedSupport) {
					this.needSupportText = "是";
				} else {
					this.needSupportText = "否";
				}
				console.log("bush:" + this.isNeedSupport + this.needSupportText)
			},
		}
	}
</script>

<style>
	.container {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
	}

	.marginLeft5 {
		margin-left: 5px;
	}

	.title-txt {
		font-size: 15px;
		font-weight: bold;
		color: black;
	}

	.content-txt {
		font-size: 10px;
		font-weight: bold;
		color: black;
	}

	.view-bg {
		margin-left: 8px;
		margin-right: 8px;
		margin-top: 8px;
		padding: 10px;
		background-color: #fff;
		border-radius: 5px;
	}

	.uni-list
	/* {
		background-color: #FFFFFF;
		position: relative;
		width: 100%;
		display: flex;
		flex-direction: column;
	} */

	.uni-list-cell-db,
	.uni-list-cell {
		position: relative;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.uni-list-cell-left {
		white-space: nowrap;
		font-size: 28rpx;
	}

	.centered {
		text-align: center;
		background-color: #e2f4ff;

	}

	.text {
		background-color: #e2f4ff;
		height: 20rpx;
	}

	.view_bg_build {
		background-color: #e2f4ff;
		padding: 10rpx;
		margin: 20rpx;
	}

	.grid-text {
		font-size: 14px;
		color: #000000;
		text-align: center;
		padding-left: 30rpx;
		padding-right: 30rpx;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
	}

	.name {
		flex: 0;
		font-size: 14px;
		color: #000000;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.table-item {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.block-iv {
		width: 10px;
		height: 10px;
	}

	.btn {
		margin-top: 40px;
		margin-right: 20px;
		margin-bottom: 120px;
		margin-left: 20px;
		height: 45px;
	}

	.number {
		display: flex;
		/* 水平居中显示子元素 */
		align-items: flex-start;
		/* 垂直居中显示子元素 */
		justify-content: space-between;
		/* 左右间距等于间距大小 */
		padding: 10px;
		/* 设置padding以提高视觉效果 */
	}

	.textarea {
		margin-top: 10upx;
		width: 100%;
		border: 1rpx solid red;
		min-height: 100upx;
		line-height: 20px;
	}

	.text {
		font-size: 16px;
		color: #333;
	}


	input {
		flex-grow: 1;
		font-size: 28rpx;
		color: #808080;
	}
</style>