<template>
	<view style="padding-bottom: 80px;">
		<view class="card">
			<view class="background"></view>
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" class="demo-ruleForm">
				<view style="position: relative;">
					<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
				</view>

				<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">基本信息</view>
				<u-form-item label="公司：" prop="Product_Unit"  borderBottom>
					<u--input v-model="(model.Nav_Company||{}).NAME" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item label="生产单元：" prop="Product_Unit"  borderBottom>
					<u--input v-model="(model.Nav_ProductionUnit||{}).NAME" disabled disabledColor="#ffffff" border="none" inputAlign="right" fontSize="14px">
					</u--input>
				</u-form-item>
				<u-form-item  label="发起时间：" prop="Nav_User.NAME"  borderBottom>
					<u--input disabledColor="#fff" v-model="model.CREATE_TIME" disabled fontSize="14px"
						customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item  label="发起部门：" prop="Nav_User.NAME"  borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_ApplyDepartment||{}).NAME" disabled fontSize="14px"
						customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item  label="发起人：" prop="Nav_User.NAME"  borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_ApplyUser||{}).NAME" disabled   fontSize="14px"
						customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item  label="值班领导" >
				</u-form-item>
				<view class="tag-view" v-if="model.Nav_Users">
					<uni-tag class="tag" v-for="(i, k) in model.Nav_Users.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.Nav_User.NAME" type="primary" />
				</view>
				
				<u-form-item label="值班开始时间" prop="CHECKDATETIME" borderBottom >
					<u--input disabled disabledColor="#fff" v-model="model.JOB_START_DATE"  border="none" inputAlign="right" fontSize="14px"></u--input>
				
				</u-form-item>
				<u-form-item label="值班结束时间" prop="ENDTIME" borderBottom >
					<u--input disabled disabledColor="#fff" v-model="model.JOB_END_DATE"  border="none" inputAlign="right" fontSize="14px"></u--input>
					
				</u-form-item>
				<u-form-item  label="班次：" prop="Nav_Class.NAME"  borderBottom>
					<u--input disabledColor="#fff" v-model="(model.Nav_Class||{}).NAME" disabled  fontSize="14px"
						customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
					</u--input>
				</u-form-item>
				<u-form-item label="交接班地点" prop="LOCATION" borderBottom>
					<u--input disabledColor="#ffffff" v-model="model.PLACE" border="none" inputAlign="right" fontSize="14px" ></u--input>
				</u-form-item>
				<u-form-item  label="交班人" >
				</u-form-item>
				<view class="tag-view" v-if="model.Nav_Users">
					<uni-tag class="tag" v-for="(i, k) in model.Nav_Users.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.Nav_User.NAME" type="primary" />
				</view>
				<u-form-item  label="接班人" >
				</u-form-item>
				<view class="tag-view" v-if="model.Nav_AfterUsers">
					<uni-tag class="tag" v-for="(i, k) in model.Nav_AfterUsers.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.Nav_AfterUser.NAME" type="primary" />
				</view>
				<u-form-item label="交班人签字" borderBottom>
				</u-form-item>
				<view v-for="item of model.Nav_Users">
					<imageSign slot="right" v-if='item.DEAL_STATUS== 1'
						:user='item.Nav_User'>
					</imageSign>
				</view>
				<u-form-item label="接班人签字" borderBottom>
				</u-form-item>
				<view v-for="item of model.Nav_AfterUsers">
					<imageSign slot="right" v-if='item.AFTER_USER_DEAL_STATUS== 1'
						:user='item.Nav_AfterUser'>
					</imageSign>
				</view>
				
				<view class="upload-title">附件：</view>
				<full-upload v-model="model.Nav_Files" :isShowBtn='false'></full-upload>
			

			</u--form>
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" errorType="border-bottom" ref="sForm" class="sub-form" style="margin-top: 20px;" v-if="model.Nav_Details.length>0">
				<view style="position: relative;">
					<view style="position: absolute;left: -10px;color: #3d4b70;top: -3px;">*</view>
				</view>

				<view style="font-size: 15px; font-weight: bold;color: #3d4b70;margin-bottom: 10px;">基本信息</view>
				<uni-collapse :border="false" accordion>
					<view v-for="(item, index) in model.Nav_Details" :key="index">
						<uni-collapse-item title-border="none" :border="false">
							<template v-slot:title>
								<view class="uni-collapse-item__title-box">
									<view class="uni-collapse-item__title-text">
										{{item.QUOTA?index+1+'.'+item.QUOTA:index+1+'.'}}
									</view>
									<view @click.stop style="margin-right: 10px;">
										<!-- <u-icon @click="handleDelRowBefore(index)" name="trash" color="#ff4d4f" size="21" style="margin-right: 10px;"></u-icon> -->
										<!-- <u-icon name="arrow-down" size="12"></u-icon> -->
									</view>
								</view>
							</template>
							<view class="content">
							<u-form-item label="开始时间" prop="CHECKDATETIME" borderBottom >
								<u--input disabled disabledColor="#fff" v-model="item.START_DATE"  border="none" inputAlign="right" fontSize="14px"></u--input>
							
							</u-form-item>
							<u-form-item label="结束时间" prop="ENDTIME" borderBottom>
								<u--input disabled disabledColor="#fff" v-model="item.END_DATE" border="none" inputAlign="right" fontSize="14px"></u--input>
							
							</u-form-item>
							<u-form-item  label="巡视区域">
							</u-form-item>
							<view class="tag-view" v-if="item.Nav_DetailAreas">
								<uni-tag class="tag" v-for="(i, k) in item.Nav_DetailAreas.filter(i => !i.IS_DELETED)" :key="k" :inverted="true" :text="i.Nav_Area.NAME" type="primary" />
							</view>
							<u-form-item label="现场情况描述：">
							
							</u-form-item>
							<u--textarea autoHeight disabled v-model="item.DESCRIPTION"  border="surround"></u--textarea>
							<u-form-item label="发现问题：">
							
							</u-form-item>
							<u--textarea autoHeight disabled v-model="item.QUESTION"  border="surround"></u--textarea>
							<u-form-item label="处置措施：">
							
							</u-form-item>
							<u--textarea autoHeight  disabled v-model="item.MEASURE"  border="surround"></u--textarea>
							<u-form-item  label="现场责任人：" prop="Nav_User.NAME" borderBottom>
								<u--input disabledColor="#fff" v-model="(item.Nav_User||{}).NAME" disabled   fontSize="14px"
									customStyle="margin:0px;display:flex;padding:3px 0px" border="none" inputAlign="right">
								</u--input>
							</u-form-item>
							<u-form-item label="现场责任人签名" borderBottom>
								<imageSign slot="right" v-if='item.USER_DEAL_STATUS== 1'
									:user='item.Nav_User'>
								</imageSign>
							</u-form-item>
							<u-form-item label="交接事项：">
							
							</u-form-item>
							<u--textarea autoHeight disabled v-model="item.ITEM" border="surround"></u--textarea>
							
							<u-form-item label="附件" prop="CHECKSTANDARD">
							</u-form-item>
							<full-upload v-model="item.Nav_DetailFiles" :isShowBtn='false' :listProp='listPropUpload' :listPropVal='listPropValUpload'></full-upload>

							</view>


						</uni-collapse-item>
					</view>
				</uni-collapse>
			</u--form>
		</view>
		<view class="bottom-button" style="padding: 10px 16px;" v-if="isLoadOK&&tableKey==1">
			<u-button type="primary" @click="onTableBtnAgree" color="#3d4b70">签到</u-button>
		</view>
	</view>
</template>

<script>
	import {
		initFilter,
		extendRule,
		extendInclude
	} from '../../../../utils/common'

	import {
		getRequest,
	} from '../../../../services/apply/FOServices/FOServices'

	import '../../../../utils/showMsg.js'
	import color from '../../../../uni_modules/uview-ui/libs/config/color'
	import config from '../../../../config/common'
	import imageSign from '@/components/custom/imageSign.vue'

	export default {
		components: {
			imageSign
		},
		data() {
			return {
				model: {
					Nav_Team: "",
					Nav_Class: "",
					Nav_User: "",
					NavUsersName: '',
					Nav_Users: [],
					ORG_ID: "",
					Nav_User: {
						NAME: ''
					},
					Nav_Team: {
						NAME: ''
					},
					Nav_Monitor: {
						NAME: ''
					},
					Nav_Class: {
						NAME: ''
					},
					Nav_Record: {
						NAME: ''
					},
					Nav_Details: [{}],
				},
				listPropUpload: ['PRE_SHIFT_MEETING_RECORD_ID'],
				listPropValUpload: [],
				TaskID: "",
				tableKey: '0',
				isLoadOK: false,
				ID: '',
			}
		},
		onLoad(option) {
			this.ID = option.ID;
			this.TaskID = option.taskID;
			this.tableKey = option.tableKey ? option.tableKey : '0'
			this.loadData()
		},
		methods: {
			loadData() {
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, "", "CODE", 1)
				extendRule(json, 'ID', 1, this.ID);
				getRequest(json, "/FO/FOLeaderWellRecord/GetEdit").then(res => {
					this.model = res
					this.isLoadOK = true;
				})
			},
			onTableBtnAgree() {
				let json = {};
				json.ID = this.ID;
				json.TaskID = this.TaskID;
				getRequest(json, "/FO/FOLeaderWellRecord/PersonalAgree").then(res => {
					if (res) {
						uni.$showMsgFunc('操作成功!', () => {
							uni.navigateBack()
						}, 'success', 1000)
					}
				})

			}
		},
		computed: {

		}
	}
</script>

<style>
	@import url("../../../../style/css/newTemplate.css");
</style>