<!-- 会议通知 -->
<template>
	<view class="page-wrap">
		<view class="card">
			<uni-card margin="0" :is-shadow="true">
				<u--form labelPosition="left" labelWidth="auto" labelAlign="center" :model="model" ref="wForm"
					errorType="border-bottom"> <!-- :rules="rules" -->


					<u-form-item label="通知编号" prop="CODE" borderBottom>
						<u--input disabled disabledColor="#fff" v-model="model.CODE" border="none"
							inputAlign="right"></u--input>
					</u-form-item>
					<u-form-item label="发起部门" prop="Nav_Department.NAME" borderBottom>
						<u--input disabled disabledColor="#fff" v-model="model.Nav_Department.NAME" border="none"
							inputAlign="right"></u--input>
					</u-form-item>
					<u-form-item label="发起人" prop="Nav_User_Originator.NAME" borderBottom>
						<u--input disabled disabledColor="#fff" v-model="model.Nav_User_Originator.NAME" border="none"
							inputAlign="right"></u--input>
					</u-form-item>

					<view class="label-title">会议主题</view>
					<u-form-item prop="THEME" borderBottom>
						<u--textarea autoHeight disabled maxlength='1500' v-model="model.THEME" placeholder="请输入检查内容"
							border="surround"></u--textarea>
					</u-form-item>

					<u-form-item label="主持人" prop="Nav_UserHost.NAME" borderBottom>
						<u--input disabled disabledColor="#fff" v-model="model.Nav_UserHost.NAME" border="none"
							inputAlign="right"></u--input>
					</u-form-item>
					<u-form-item label="记录人" prop="Nav_UserRecorder.NAME" borderBottom>
						<u--input disabled disabledColor="#fff" v-model="model.Nav_UserRecorder.NAME" border="none"
							inputAlign="right"></u--input>
					</u-form-item>
					<u-form-item label="会议时间" prop="BEGIN_TIME" borderBottom>
						<u--input disabled disabledColor="#fff" v-model="model.BEGIN_TIME" border="none"
							inputAlign="right"></u--input>
					</u-form-item>
					<view class="label-title">会议内容</view>
					<u-form-item prop="CONTENT" borderBottom>
						<u--textarea autoHeight disabled maxlength='1500' v-model="model.CONTENT" placeholder="请输入检查内容"
							border="surround"></u--textarea>
					</u-form-item>


					<view class="upload-title">附件</view>
					<full-upload v-model="model.Nav_FilesOfficialseal" :isShowBtn='false'></full-upload>

					<view class="upload-title">加盖公章会议通知</view>
					<full-upload v-model="model.Nav_Files" :isShowBtn='false'></full-upload>

					<view class="upload-title">参会人员</view>
					<view v-if="model.Nav_ListPAll!=null&&model.Nav_ListPAll.length>0"
						v-show="!!model.Nav_ListPAll.length" class="tag-view">
						<uni-tag class="tag" v-for="(i, k) in model.Nav_ListPAll.filter(i => !i.IS_DELETED)" :key="k"
							:inverted="true" :text="i.NAME" type="primary" />
					</view>

				</u--form>
			</uni-card>
		</view>

		<!-- <view class="bottom-button">
			<button type="primary" v-if='isLoadOK && tableKey === "1"' @click="FullCheckUpdate">提交</button>
		</view> -->
		<!-- <view class="bottom-button">
			<check-join v-if='isLoadOK && tableKey === "1" ' v-on:chilCheck='handleCheck'></check-join>
		</view> -->
		<check-join v-if='isLoadOK && tableKey === "1" ' v-on:chilCheck='handleCheck'></check-join>
		<!-- && !isActualDealCheck&&(isCheckerCheck || isDealUserCheck) -->
	</view>
</template>

<script>
	import {
		guid,
		initFilter,
		extendRule,
		extendInclude,
		extendGroupRule,
		initFilterGroup,
		extendFilterGroup,
		extendFilterGroupGroupRules
	} from '../../../../utils/common'

	import checkJoin from '@/components/custom/check-join.vue'
	import {
		GetSuitDevlop,
		PAllCheck
	} from '../../../../services/apply/subPages/SCMT/meeting'

	import {
		OrderPagedUseful2
	} from '../../../../services/common'

	// import UButton from '../../../../uni_modules/uview-ui/components/u-button/u-button.vue'

	export default {
		components: {
			checkJoin
			// ,UButton
		},
		data() {
			return {
				tableKey: '0',
				TaskID: '',
				listPropUpload: ['MEETING_ID'],
				listPropValUpload: [],
				AUDIT_OPINION: '',
				isAudit: true,
				isLoadOK: false,

				model: {
					ID: '',
					CODE: '',
					TaskID: '',
					BEGIN_TIME: '',
					CONTENT: '',
					Nav_Files: [],
					Nav_FilesOfficialseal: [],
					Nav_Department: {
						NAME: ''
					},
					Nav_User_Originator: {
						NAME: ''
					},
					Nav_UserHost: {
						NAME: ''
					},
					Nav_UserRecorder: {
						NAME: '',
					},
					THEME: '',
					Nav_ListThemes: [],

					Nav_ListPAll: [{
						USER_ID: '',
						NAME: '',
						Nav_User: {
							NAME: ''
						}
					}]
				},

				selectorInfo: {
					showPopup: false,
					title: '人员选择',
					isMultiple: false,
					name: '',
					itemData: {},
					index: 0,
					dataLists: [],
					defaultText: '',
					defaultValue: '',
					defaultChecked: []
				},

				dateTimePickerInfo: {
					showCheckDate: false,
					dataIndex: undefined,
					defaultDateTime: uni.$u.timeFormat(new Date(), 'yyyy-mm-dd hh:MM:ss'),
					value: ''
				},
				peopleSelectOption: {
					showSelector: false,
					value: null,
					index: 0,
					defaultChecked: []
				},
			}
		},
		onLoad(option) {
			this.model.ID = option.ID
			this.model.TaskID = option.taskID
			this.TaskID = option.taskID
			this.tableKey = option.tableKey
			this.loadData()
		},

		methods: {
			handleCheck(data) {
				var JOINRESULT = 10 // 参加 10  // 请假 20
				if (!data.isJoin) {
					JOINRESULT = 20
				}
				let json = initFilter(this.model.ORG_ID, this.model.ID, null, null, null, this.TaskID,
					JOINRESULT, data.opinions);
				PAllCheck(json).then(res => {
					uni.$showMsgFunc('操作成功!', () => {
						uni.navigateBack()
					}, 'success', 1000)
				})
			},


			async loadData() {
				const orgId = uni.getStorageSync('orgId')
				if (this.listPropValUpload.length == 0) {
					this.listPropValUpload.push(this.model.ID)
				}

				const json = initFilter(orgId, "", "", 1)
				extendRule(json, 'ID', 1, this.model.ID);
				extendInclude(json, 'Nav_Department');
				extendInclude(json, 'Nav_Minutes');
				extendInclude(json, 'Nav_User_Originator');
				extendInclude(json, 'Nav_UserHost');
				extendInclude(json, 'Nav_UserRecorder');
				extendInclude(json, 'Nav_ListMeetingContent.Nav_ContentName');
				extendInclude(json, 'Nav_ListMeetingContent.Nav_ContentName.Nav_ListContent.Nav_ListContentDeal');
				extendInclude(json, 'Nav_ListPAll');
				extendInclude(json, 'Nav_ListPAll.Nav_User.Nav_Department');
				extendInclude(json, 'Nav_ListPAll.Nav_User.Nav_Person.Nav_Post');
				extendInclude(json, 'Nav_ListPReView.Nav_User');
				extendInclude(json, 'Nav_Files.Nav_ImgFile');
				extendInclude(json, 'Nav_FilesOfficialseal.Nav_ImgFile');

				json.IgnoreDataRule = true

				GetSuitDevlop(json).then(res => {
					if (res.Nav_UserHost == null) {
						res.Nav_UserHost = {
							NAME: ''
						}
					}
					if (res.Nav_UserRecorder == null) {
						res.Nav_UserRecorder = {
							NAME: ''
						}
					}

					if (res.Nav_ListPAll != null && res.Nav_ListPAll.length > 0) {
						res.Nav_ListPAll.forEach(e => e.NAME = e.Nav_User.NAME)
					}

					// if (res.Nav_ListPAll != null && res.Nav_ListPAll.length > 0) {
					// 	var k = res.Nav_ListPAll.map(i => {
					// 		return {
					// 			...i,
					// 			NAME: i.Nav_User.NAME,
					// 		}
					// 	})
					// 	res.Nav_ListPAll = k
					// }

					this.model = res
					this.isLoadOK = true
				})
			}
		},
		computed: {},
	}
</script>


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