<template>
	<view class="page-wrap">
		<uni-card margin="0" :is-shadow="true">
			<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model">
				<u-form-item label="会议时间：" prop="MEETING_TIME" borderBottom>
					<u--input v-model="model.MEETING_TIME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#ffffff"></u--input>
				</u-form-item>
				<u-form-item label="班组名称：" prop="Nav_Team.NAME" borderBottom>
					<u--input v-model="model.Nav_Team.NAME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#ffffff"></u--input>
				</u-form-item>
				<u-form-item label="班次：" prop="Nav_Class.NAME" borderBottom>
					<u--input v-if="model.Nav_Class" v-model="model.Nav_Class.NAME" border="none" slot="right" inputAlign="right" disabled
						disabledColor="#ffffff"></u--input>
				</u-form-item>
				<u-form-item label="班组长/主持人：" prop="Nav_User.NAME" borderBottom>
					<u--text :text="model.Nav_User.NAME" align="right"></u--text>
					<!--					<u&#45;&#45;input v-model="model.Nav_User.NAME" border="none" slot="right" inputAlign="right" disabled-->
					<!--						disabledColor="#ffffff"></u&#45;&#45;input>-->
				</u-form-item>
				<u-form-item label="参会人员：" prop="UserNames" borderBottom>

				</u-form-item>
				<rich-text autoHeight v-html="model.UserNames" border="none" disabled></rich-text>

				<u-form-item label="班组当班工作内容：" prop="JOB_CONTENT" borderBottom>
				</u-form-item>
				<u--textarea autoHeight v-model="model.JOB_CONTENT" border="none" inputAlign="right" disabled
					disabledColor="#ffffff"></u--textarea>
				<u-form-item label="安全注意事项及防护措施：" prop="PROTECT_MEASURE" borderBottom>
				</u-form-item>
				<u--textarea autoHeight v-model="model.PROTECT_MEASURE" border="none" inputAlign="right" disabled
					disabledColor="#ffffff"></u--textarea>
				<u-form-item label="其他内容：" prop="OTHER_CONTENT" borderBottom>
				</u-form-item>
				<u--textarea autoHeight v-model="model.OTHER_CONTENT" border="none" inputAlign="right" disabled
					disabledColor="#ffffff"></u--textarea>
				<view class="upload-title">附件</view>
				<full-upload v-model="model.Nav_Files" :listProp='listPropUpload'
					:listPropVal='listPropValUpload' :isShowBtn="false"></full-upload>
			</u--form>
		</uni-card>
		<view class="bottom-button">
			<button type="primary" class="bottom" v-if='isLoadOK&&tableKey==1' @click="onTableBtnAgree">签到</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: ""
				},
				listPropUpload: ['PRE_SHIFT_MEETING_RECORD_ID'],
				listPropValUpload: [],
				TaskID: "",
				tableKey: '0',
				isLoadOK: false,
			}
		},
		onLoad(option) {
			this.model.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.model.ID);
				extendInclude(json, "Nav_Class")
				extendInclude(json, "Nav_Team")
				extendInclude(json, "Nav_User")
				extendInclude(json, 'Nav_Users.Nav_User.Nav_UserSignFiles.Nav_ImgFile.Nav_File');
				extendInclude(json, 'Nav_Files.Nav_ImgFile.Nav_File');
				getRequest(json, "/FO/PreShiftMeetingRecord/Get").then(res => {
					this.model = res
					//数据组装
					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:30px;white-space:nowrap;'>" +
									res.Nav_Users[i].Nav_User.NAME + "</view>";
							} else {
								strUserName += (strUserName.length > 0 ? " " : "") +
									"<text style='padding:5px;line-height:30px;white-space:nowrap;'>" +
									res.Nav_Users[i].Nav_User.NAME + "</text>";
							}

						}
					}
					this.model.UserNames = strUserName;
					this.isLoadOK = true;
				})
			},
			onTableBtnAgree() {
				let json = {};
				json.ID = this.model.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/editTemplate.css");
</style>