<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="Nav_Team.NAME" borderBottom>
					<u--input v-if="model.Nav_Team" disabledColor="#fff" v-model="model.Nav_Team.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_Monitor.NAME" borderBottom>
					<u--input v-if="model.Nav_Monitor" disabledColor="#fff" v-model="model.Nav_Monitor.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="MEETING_TIME" borderBottom>
					<u--input v-model="model.MEETING_TIME" border="none"  inputAlign="right" disabled disabledColor="#ffffff" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="班次：" prop="Nav_Class.NAME" borderBottom>
					<u--input v-if="model.Nav_Class" 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="CHECKDATETIME" borderBottom>
					<u--input disabled disabledColor="#fff" v-model="model.START_TIME" 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.END_TIME"  border="none" inputAlign="right" fontSize="14px"></u--input>
					
				</u-form-item>
				<u-form-item label="地点" prop="LOCATION" borderBottom> <u--input disabledColor="#ffffff" v-model="model.LOCATION" disabled border="none"  inputAlign="right" fontSize="14px"></u--input>
				</u-form-item>
				<u-form-item label="主持人：" prop="Nav_User.NAME" borderBottom>
					<u--input v-if="model.Nav_User" disabledColor="#fff" v-model="model.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="记录人：" prop="Nav_Record.NAME" borderBottom>
					<u--input v-if="model.Nav_Record" disabledColor="#fff" v-model="model.Nav_Record.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="UserNames">

				</u-form-item>
				<rich-text autoHeight v-html="model.UserNames" border="none" disabled class="richtext"></rich-text>
				<u-form-item label="应出勤人数:" prop="SHOULD_QTY" borderBottom> <u--input disabledColor="#ffffff" v-model="model.SHOULD_QTY" border="none"  inputAlign="right" fontSize="14px" disabled></u--input>
				</u-form-item>
				<u-form-item label="实际出勤人数:" prop="ACTUAL_QTY" borderBottom> <u--input disabledColor="#ffffff" v-model="model.ACTUAL_QTY" border="none"  inputAlign="right" fontSize="14px" disabled></u--input>
				</u-form-item>
				<u-form-item label="迟到人数:" prop="LATE_QTY" borderBottom> <u--input disabledColor="#ffffff" v-model="model.LATE_QTY" border="none"  inputAlign="right" fontSize="14px" disabled></u--input>
				</u-form-item>
				<u-form-item label="请假人数:" prop="LEAVE_QTY" borderBottom> <u--input disabledColor="#ffffff" v-model="model.LEAVE_QTY" border="none"  inputAlign="right" fontSize="14px" disabled></u--input>
				</u-form-item>
				<view class="upload-title">附件</view>
				<full-upload v-model="model.Nav_Files" :isShowBtn="false" :listProp="listPropUpload" :listPropVal="listPropValUpload"></full-upload>


				<u-form-item label="异常原因" prop="ABNORMAL_CAUSE"></u-form-item>
				<u--textarea autoHeight disabled v-model="model.ABNORMAL_CAUSE" border="surround"></u--textarea>
				<u-form-item label="问候语" prop="GREETING"></u-form-item> <u--textarea disabled autoHeight v-model="model.GREETING" border="surround"></u--textarea>
				<u-form-item label="班组口号" prop="SLOGAN"></u-form-item> <u--textarea disabled autoHeight v-model="model.SLOGAN" border="surround"></u--textarea>
				<u-form-item label="欢迎新同事" prop="WELCOME"></u-form-item> <u--textarea disabled autoHeight v-model="model.WELCOME" border="surround"></u--textarea>
				<u-form-item label="今日计划及关注点" prop="TODAY_PLAN"></u-form-item> <u--textarea disabled autoHeight v-model="model.TODAY_PLAN" border="surround"></u--textarea>
				<u-form-item label="信息传递及学习内容" prop="LEARNING"></u-form-item> <u--textarea disabled autoHeight v-model="model.LEARNING" border="surround"></u--textarea>
				<u-form-item label="其他事项" prop="OTHER_CONTENT"></u-form-item> <u--textarea disabled autoHeight v-model="model.OTHER_CONTENT" border="surround"></u--textarea>
				<u-form-item label="一分钟表扬" prop="PRAISE"></u-form-item> <u--textarea disabled autoHeight v-model="model.PRAISE" border="surround"></u--textarea>
				<u-form-item label="优秀员工分享" prop="SHARE"></u-form-item> <u--textarea disabled autoHeight v-model="model.SHARE" border="surround"></u--textarea>
				<u-form-item label="安全环保事项" prop="DANGER"></u-form-item> <u--textarea disabled autoHeight v-model="model.DANGER" border="surround"></u--textarea>
				<u-form-item label="员工困难或建议" prop="DIFFICULTY"></u-form-item> <u--textarea disabled autoHeight v-model="model.DIFFICULTY" border="surround"></u--textarea>
				<u-form-item label="安全宣誓" prop="SAFETY_OATH"></u-form-item> <u--textarea disabled autoHeight v-model="model.SAFETY_OATH" border="surround"></u--textarea>

			</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="QUOTA"></u-form-item> <u--textarea disabled v-model="item.QUOTA" border="surround"></u--textarea>
								<u-form-item label="目标" prop="PURPOSE"></u-form-item> <u--textarea disabled autoHeight v-model="item.PURPOSE" border="surround"></u--textarea>
								<u-form-item label="实际" prop="ACTUAL"></u-form-item> <u--textarea disabled autoHeight v-model="item.ACTUAL" border="surround"></u--textarea>
								<u-form-item label="达成率" prop="RATE" borderBottom> <u--input disabled disabledColor="#ffffff" v-model="item.RATE" border="none"  inputAlign="right" fontSize="14px"></u--input>
								</u-form-item>
								<u-form-item label="原因" prop="REASON"></u-form-item> <u--textarea disabled autoHeight v-model="item.REASON" border="surround"></u--textarea>
								<u-form-item label="改善对策" prop="IMPROVE"></u-form-item> <u--textarea disabled autoHeight v-model="item.IMPROVE" border="surround"></u--textarea>
								<u-form-item label="涉及岗位:" prop="Nav_Users">
									<!-- <u-icon style="margin-left: 4px;" name="arrow-down" size="12" ></u-icon> -->
								</u-form-item>
								<u-textarea v-model="item.Nav_DetailPostsName" disabled autoHeight></u-textarea>


							</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'

	export default {
		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);
				extendInclude(json, "Nav_Monitor")
				extendInclude(json, "Nav_Class")
				extendInclude(json, "Nav_Record")
				extendInclude(json, "Nav_Team")
				extendInclude(json, "Nav_User")
				extendInclude(json, "Nav_Details")
				extendInclude(json, "Nav_Users.Nav_User")
				extendInclude(json, 'Nav_Files.Nav_ImgFile.Nav_File')
				extendInclude(json, "Nav_Details.Nav_DetailPosts.Nav_Post")
				getRequest(json, "/FO/PreShiftMeetingRecord/Get").then(res => {
					this.model = res
					//数据组装
					this.model.MEETING_TIME = uni.$u.timeFormat(res.MEETING_TIME, 'yyyy-mm-dd')
					let strUserName = ''
					if (res.Nav_Users && res.Nav_Users.length > 0) {
						for (let i = 0; i < res.Nav_Users.length; i++) {
							if (res.Nav_Users[i].DEAL_STATUS == 0) {
								strUserName += (strUserName.length > 0 ? " " : "") +
									"<view style='color:#E35D58;background-color:rgba(227,93,88,0.2);padding:5px;line-height:20px;white-space:nowrap;'>" +
									res.Nav_Users[i].Nav_User.NAME + "</view>";
							} else {
								strUserName += (strUserName.length > 0 ? " " : "") +
									"<text style='padding:5px;line-height:20px;white-space:nowrap;color:#303133'>" +
									res.Nav_Users[i].Nav_User.NAME + "</text>";
							}

						}
					}
					this.model.UserNames = strUserName;

					if (res.Nav_Details && res.Nav_Details.length > 0) {
						res.Nav_Details.map(item => {
							let postName = ''
							if (item.Nav_DetailPosts && item.Nav_DetailPosts.length > 0) {
								item.Nav_DetailPosts.map(item1 => {
									postName += item1.Nav_Post.NAME + ' '
								})
							}
							item.Nav_DetailPostsName = postName
						})
					}
					this.isLoadOK = true;
				})
			},
			onTableBtnAgree() {
				let json = {};
				json.ID = this.ID;
				json.TaskID = this.TaskID;
				getRequest(json, "/FO/FOPreShiftMeetingRecord/PersonalAgree").then(res => {
					if (res) {
						uni.$showMsgFunc('操作成功!', () => {
							uni.navigateBack()
						}, 'success', 1000)
					}
				})

			}
		},
		computed: {

		}
	}
</script>

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