<!-- 会议召开 安委会 -->
<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" :rules="rules"
					ref="wForm" errorType="border-bottom">
					<u-form-item v-if="isAdd" label="会议类型" required prop="MEETINGTYPESHOW"
						@click="handleTypeChange(model)" borderBottom>
						<u--input disabledColor="#fff" v-model="model.MEETINGTYPESHOW" border="none"
							inputAlign="right"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
					</u-form-item>
					<u-form-item v-else label="会议类型" required prop="MEETINGTYPESHOW" borderBottom>
						<u--input disabled disabledColor="#fff" v-model="model.MEETINGTYPESHOW" border="none"
							inputAlign="right"></u--input>
					</u-form-item>
					<u-form-item v-if="model.MEETINGTYPE=='40'||model.MEETINGTYPE=='50'" label="会议主题" required
						prop="THEME" @click='handleChange("Theme")' borderBottom>
						<u--input disabledColor="#fff" v-model="model.THEME" border="none"
							inputAlign="right"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
					</u-form-item>
					<w-view-require v-else class="label-title" title='会议主题'></w-view-require>
					<u-form-item v-if="model.MEETINGTYPE!='40'&&model.MEETINGTYPE!='50'" prop="THEME" borderBottom>
						<u--textarea autoHeight maxlength='500' v-model="model.THEME" placeholder="请输入会议主题"
							border="surround"></u--textarea>
					</u-form-item>
					<u-form-item v-if="model.MEETINGTYPE!='40'&&model.MEETINGTYPE!='50'" label="会议内容" required
						prop="CONTENT" @click='handleChange("CONTENT")' borderBottom>
						<u--input disabledColor="#fff" v-model="model.CONTENT" border="none"
							inputAlign="right"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
					</u-form-item>
					<u-form-item label="主持人" required prop="Nav_UserHost.NAME" @click='handleChange("UserHost")'
						borderBottom>
						<u--input disabledColor="#fff" v-model="model.Nav_UserHost.NAME" border="none"
							inputAlign="right"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
					</u-form-item>
					<u-form-item label="记录人" required prop="Nav_UserRecorder.NAME" @click='handleChange("UserRecorder")'
						borderBottom>
						<u--input disabledColor="#fff" v-model="model.Nav_UserRecorder.NAME" border="none"
							inputAlign="right"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
					</u-form-item>
					<!-- 
					<u-form-item label="评审人员" v-if="model.MEETINGTYPE=='30'" required prop="Nav_UserRecorder.NAME"
						@click='handleChange("PReView")' borderBottom>
						<u--input disabledColor="#fff" v-model="model.Nav_ListPReViewSHOW" border="none"
							inputAlign="right"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
					</u-form-item> -->
					<u-form-item v-if="model.MEETINGTYPE=='30'" required label="评审人员：">
						<u-icon name="man-add" @click="handleShowUserSelector(true)" size="24" color="#3d9cff"
							slot="right"></u-icon>
					</u-form-item>
					<view v-if="model.MEETINGTYPE=='30'" v-show="!!model.Nav_ListPReView.length" class="tag-view">
						<uni-tag class="tag" v-for="(i, k) in model.Nav_ListPReView.filter(i => !i.IS_DELETED)" :key="k"
							:inverted="true" :text="i.NAME" type="primary" />
					</view>
					<u-form-item label="会议时间" required prop="BEGIN_TIME" borderBottom @click="showCheckDate()">
						<u--input disabledColor="#fff" v-model="model.BEGIN_TIME" placeholder="请选择会议时间" border="none"
							inputAlign="right"></u--input>
						<u-icon style="margin-left: 4px;" slot="right" name="arrow-down"></u-icon>
					</u-form-item>
					<u-form-item label="会议地点" required prop="ADDRESS" borderBottom>
						<u--input disabledColor="#fff" v-model="model.ADDRESS" border="none" slot="right"
							inputAlign="right"></u--input>
					</u-form-item>
					<view v-if="model.MEETINGTYPE=='40'||model.MEETINGTYPE=='50'" class="label-title">会议内容</view>
					<u-form-item v-if="model.MEETINGTYPE=='40'||model.MEETINGTYPE=='50'" prop="CONTENT" borderBottom>
						<u--textarea autoHeight 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='true' :listProp='listPropUpload'
						:listPropVal='listPropValUpload'></full-upload>
					<view class="upload-title">加盖公章会议通知</view>
					<full-upload v-model="model.Nav_Files" :isShowBtn='true' :listProp='listPropUpload'
						:listPropVal='listPropValUpload'></full-upload>
					<u-form-item required label="参会人员：">
						<u-icon name="man-add" @click="handleShowUserSelector(false)" size="24" color="#3d9cff"
							slot="right"></u-icon>
					</u-form-item>
					<view 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>

		<query-selector :multiple="selectorInfo.isMultiple" :show="selectorInfo.showPopup"
			:defaultChecked="selectorInfo.defaultChecked" :title="selectorInfo.title" :lists="selectorInfo.dataLists"
			@search="handleSearch" @select="handleSelected" @close="selectorInfo.showPopup=false"
			:total="selectorInfo.totalCount" />
		<u-datetime-picker :show="dateTimePickerInfo.showCheckDate" mode="datetime"
			v-model='dateTimePickerInfo.defaultDateTime' @confirm="handleCheckDate"
			@close="dateTimePickerInfo.showCheckDate = false"
			@cancel="dateTimePickerInfo.showCheckDate = false"></u-datetime-picker>
		<people-selector :defaultChecked="peopleSelectOption.defaultChecked" :show="peopleSelectOption.showSelector"
			@select="handleSelectorPeople" @close="peopleSelectOption.showSelector = false">
		</people-selector>
		<u-picker :show="comPickerInfo.showSheet" :columns="comPickerInfo.columns" @confirm="onConfirmPicker"
			@close="closePicker" @cancel="closePicker" keyName="NAME"></u-picker>
		<view class="bottom-button">
			<button type="primary" v-if='(isLoadOK && tableKey === "1")||isAdd==true'
				@click="FullCheckUpdate">提交</button>
		</view>
	</view>
</template>

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

	import {
		Get,
		GetPAll,
		GetAPP,
		OrderPagedMeetingTheme,
		FullUpdate,
		OrderPagedContentNameCount
	} from '../../../../services/apply/subPages/SCMT/meeting'

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

	import {
		getEnum
	} from '@/services/common'
	import wViewRequire from '@/components/custom/w-view-require.vue'
	import UButton from '../../../../uni_modules/uview-ui/components/u-button/u-button.vue'

	export default {
		components: {
			UButton,
			wViewRequire
		},
		data() {
			return {
				isAdd: false,
				tableKey: '0',
				TaskID: '',
				listPropUpload: ['MEETING_ID'],
				listPropValUpload: [],
				AUDIT_OPINION: '',
				isAudit: true,
				isLoadOK: false,
				listMEETINGTYPE: [],
				listMEETINGTYPEVal: [],
				model: {
					ID: '',
					TaskID: '',
					Nav_Files: [],
					Nav_UserHost: {
						NAME: ''
					},
					Nav_UserRecorder: {
						NAME: '',
					},
					THEME: '',
					CONTENT32: '',
					Nav_ListThemes: [],
					Nav_ListPReViewSHOW: '',
					Nav_ListPReView: [{
						MEETING_ID: '',
						PERSONTYPE: 50,
						USER_ID: '',
						NAME: '',
						Nav_User: {
							NAME: ''
						}
					}],
					Nav_ListPAll: [{
						USER_ID: '',
						NAME: '',
						Nav_User: {
							NAME: ''
						}
					}]
				},

				rules: {
					'MEETINGTYPESHOW': {
						type: 'string',
						required: true,
						trigger: ['blur', 'change']
					},
					'THEME': {
						type: 'string',
						required: true,
						trigger: ['blur', 'change']
					},
					'Nav_UserHost.NAME': {
						type: 'string',
						required: true,
						trigger: ['blur', 'change']
					},
					'Nav_UserRecorder.NAME': {
						type: 'string',
						required: true,
						trigger: ['blur', 'change']
					},
					'BEGIN_TIME': {
						type: 'string',
						required: true,
						trigger: ['blur', 'change']
					},
					'ADDRESS': {
						type: 'string',
						required: true,
						trigger: ['blur', 'change']
					}
				},
				selectorInfo: {
					showPopup: false,
					title: '人员选择',
					isMultiple: false,
					name: '',
					itemData: {},
					index: 0,
					totalCount: 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: [],
					isReView: false
				},
				comPickerInfo: {
					showSheet: false,
					columns: [],
					title: '会议类型',
					dataIndex: undefined,
					formIndex: undefined,
					dataItem: {},
					name: ''
				},
			}
		},
		onLoad(option) {
			if (!option.ID) {
				this.isAdd = true
			} else {
				this.model.ID = option.ID
				this.model.TaskID = option.taskID
				this.TaskID = option.taskID
				this.tableKey = option.tableKey
			}
			this.loadData()
		},
		methods: {

			//显示时间控件
			showCheckDate() {
				if (this.model.BEGIN_TIME == null) {
					this.model.BEGIN_TIME = uni.$u.timeFormat(new Date(),
						'yyyy-mm-dd hh:MM:ss')
				}
				this.dateTimePickerInfo = {
					showCheckDate: true,
					defaultDateTime: this.model.BEGIN_TIME
				}
			},
			//隐藏控件 显示时间
			handleCheckDate(e) {
				let v = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM:ss')
				const {
					name,
					dataIndex
				} = this.dateTimePickerInfo
				this.dateTimePickerInfo.showCheckDate = false
				this.model.BEGIN_TIME = uni.$u.timeFormat(e.value,
					'yyyy-mm-dd hh:MM:ss')
			},


			//人员多选start
			handleShowUserSelector(isReView) {
				if (isReView == undefined || isReView == false) {
					this.peopleSelectOption = {
						showSelector: true,
						value: this.model,
						isReView: false,
						defaultChecked: this.model.Nav_ListPAll.map(i => {
							return {
								...i,
								NAME: i.Nav_User.NAME,
								USER_ID: i.Nav_User.ID,
							}
						})
					}
				} else {
					this.peopleSelectOption = {
						showSelector: true,
						value: this.model,
						isReView: true,
						defaultChecked: this.model.Nav_ListPReView.map(i => {
							return {
								...i,
								NAME: i.Nav_User.NAME,
								USER_ID: i.Nav_User.ID,
							}
						})
					}
				}
			},

			//显示信息
			handleSelectorPeople(e) {
				if (!this.peopleSelectOption.isReView) {
					this.model.Nav_ListPAll = []
					e.forEach(i => {
						if (i.NAME != '') {
							this.model.Nav_ListPAll.push({
								USER_ID: i.USER_ID,
								ID: i.ID || guid(),
								MEETING_ID: this.model.ID,
								PERSONTYPE: 10,
								ORG_ID: this.model.ORG_ID,
								IS_DELETED: i.IS_DELETED == undefined ? false : i.IS_DELETED,
								NAME: i.NAME,
								Nav_User: {
									NAME: i.NAME,
									ID: i.USER_ID
								}
							})
						}
					})
					// this.model.Nav_ListPAll = e.map(i => {
					// 	// if (i.USER_ID != undefined && i.USER_ID != '00000000-0000-0000-0000-000000000000') {
					// 	return {
					// 		USER_ID: i.USER_ID,
					// 		ID: i.ID || guid(),
					// 		MEETING_ID: this.model.ID,
					// 		PERSONTYPE: 10,
					// 		ORG_ID: this.model.ORG_ID,
					// 		IS_DELETED: i.IS_DELETED == undefined ? false : i.IS_DELETED,
					// 		NAME: i.NAME,
					// 		Nav_User: {
					// 			NAME: i.NAME,
					// 			ID: i.USER_ID
					// 		}
					// 	}
					// 	// }
					// })
				} else {
					this.model.Nav_ListPReView = []
					e.forEach(i => {
						if (i.NAME != '') {
							this.model.Nav_ListPReView.push({
								USER_ID: i.USER_ID,
								ID: i.ID || guid(),
								MEETING_ID: this.model.ID,
								PERSONTYPE: 50,
								ORG_ID: this.model.ORG_ID,
								IS_DELETED: i.IS_DELETED == undefined ? false : i.IS_DELETED,
								NAME: i.NAME,
								Nav_User: {
									NAME: i.NAME,
									ID: i.USER_ID
								}
							})
						}
					})
					// this.model.Nav_ListPReView = e.map(i => {
					// 	// if (i.USER_ID != undefined && i.USER_ID != '00000000-0000-0000-0000-000000000000') {
					// 	return {
					// 		USER_ID: i.USER_ID,
					// 		ID: i.ID || guid(),
					// 		MEETING_ID: this.model.ID,
					// 		PERSONTYPE: 50,
					// 		ORG_ID: this.model.ORG_ID,
					// 		IS_DELETED: i.IS_DELETED == undefined ? false : i.IS_DELETED,
					// 		NAME: i.NAME,
					// 		Nav_User: {
					// 			NAME: i.NAME,
					// 			ID: i.USER_ID
					// 		}
					// 	}
					// 	// }
					// })
				}
			},

			FullCheckUpdate() {
				const ele = this.$refs
				ele['wForm'].validate().then(res => {
					this.modelEdit = JSON.parse(JSON.stringify(this.model))
					if (this.TaskID != '')
						this.modelEdit.TaskID = this.TaskID
					else {
						this.modelEdit.TaskID = '00000000-0000-0000-0000-000000000000'
					}

					if ((!this.modelEdit.CONTENT32 || this.modelEdit.CONTENT32 == '') && (this.modelEdit
							.Nav_ListMeetingContent != null && this.modelEdit.Nav_ListMeetingContent.length > 0)) {
						this.modelEdit.CONTENT32 = ''
						this.modelEdit.Nav_ListMeetingContent.forEach(e => {
							this.modelEdit.CONTENT32 += e.Nav_ContentName.NAME
						})
					}

					this.modelEdit.STATUS = 20;
					if (!this.modelEdit.DEPARTMENT_ID || !this.modelEdit.USER_ID_ORIGINATOR) {
						var loginInfo = uni.getStorageSync('appInfo')
						this.modelEdit.DEPARTMENT_ID = loginInfo.User.DEPARTMENT_ID
						this.modelEdit.USER_ID_ORIGINATOR = loginInfo.User.ID
					}
					this.modelEdit.Nav_UserHost = null
					this.modelEdit.Nav_UserRecorder = null
					this.modelEdit.Nav_ListPAll.forEach(e => e.Nav_User = null)

					if (this.modelEdit.Nav_ListPReView != null && this.modelEdit.Nav_ListPReView.length > 0) {
						if (this.modelEdit.Nav_ListPReView.length == 1 && this.modelEdit.Nav_ListPReView[0].USER_ID ==
							'') {
							this.modelEdit.Nav_ListPReView = null
						} else {
							this.modelEdit.Nav_ListPReView.forEach(e => e.Nav_User = null)
						}
					}
					FullUpdate(this.modelEdit).then(res => {
						uni.$showMsgFunc('操作成功!', () => {
							// if (this.tableKey == null || this.tableKey == 0) {
							// 	uni.navigateTo({
							// 		url: 'safeCheckIndex'
							// 	})
							// } else {
							uni.navigateBack()
							// }
						}, 'success', 1000)
					})
				}).catch(err => {
					uni.$showErrorInfo('校验失败')
				})
			},

			async loadData() {
				const orgId = uni.getStorageSync('orgId')
				if (this.isAdd == true) {
					var info = uni.getStorageSync('appInfo')
					this.model.ID = guid()
					this.model.DEPARTMENT_ID = info.User.DEPARTMENT_ID
					this.model.USER_ID_ORIGINATOR = info.User.ID
					this.model.ISBEGIN = false
					this.model.ISCANCEL = false
					this.model.ORG_ID = orgId
					this.model.CODE = 'HY' + uni.$u.timeFormat(new Date(),
						'yyyymmddhhMM')
					this.listPropValUpload.push(this.model.ID)
					this.isLoadOK = true
				} else {

					if (this.listPropValUpload.length == 0) {
						this.listPropValUpload.push(this.model.ID)
					}
					const json = initFilter(orgId, "", "CODE", 1)
					extendRule(json, 'ID', 1, this.model.ID);
					extendInclude(json, "Nav_Department");
					extendInclude(json, "Nav_User_Originator");
					extendInclude(json, "Nav_ListThemes");
					extendInclude(json, "Nav_ListThemes.Nav_MeetingTheme");
					extendInclude(json, "Nav_ListMeetingContent");
					extendInclude(json, "Nav_ListMeetingContent.Nav_ContentName");
					extendInclude(json, "Nav_UserHost");
					extendInclude(json, "Nav_UserRecorder");
					extendInclude(json, "Nav_ListPReView");
					extendInclude(json, "Nav_ListPReView.Nav_User");
					extendInclude(json, "Nav_FilesOfficialseal.Nav_ImgFile");
					extendInclude(json, "Nav_Files.Nav_ImgFile");
					extendInclude(json, "Nav_ListPAll");
					extendInclude(json, "Nav_ListPAll.Nav_User");
					extendInclude(json, "Nav_ListPAll.Nav_User.Nav_Department");
					extendInclude(json, "Nav_ListPAll.Nav_User.Nav_Person.Nav_Post");
					json.IgnoreDataRule = true
					GetAPP(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
						// }
						// CONTENT
						if (res.Nav_ListMeetingContent != null && res.Nav_ListMeetingContent.length > 0) {
							res.CONTENT = ''
							res.Nav_ListMeetingContent.forEach((e, i) => {
								res.CONTENT += (i == 0 ? '' : ' ') + e.Nav_ContentName.NAME
							})
						}
						this.model = res
						this.isLoadOK = true
					})
				}
			},

			//显示组件
			handleChange(name) {
				// Theme    UserHost    UserRecorder
				this.selectorInfo.name = name
				switch (name) {
					// case 'PReView':
					// 	this.selectorInfo.title = '评审人员'
					// 	this.selectorInfo.isMultiple = true
					// 	if (this.model.Nav_ListPReView && this.model.Nav_ListPReView.length > 0) {
					// 		// Nav_MeetingTheme
					// 		let defCheck = []
					// 		for (let i = 0; i < this.model.Nav_ListPReView.length; i++) {

					// 			if (this.model.Nav_ListPReView[i].Nav_User) {
					// 				defCheck.push(this.model.Nav_ListPReView[i].Nav_User)
					// 			} else {
					// 				defCheck.push(this.model.Nav_ListPReView[i])
					// 			}
					// 		}

					// 		this.selectorInfo.defaultChecked = defCheck
					// 	}
					// 	break;
					case 'Theme':
						this.selectorInfo.title = '会议主题选择'
						this.selectorInfo.isMultiple = true
						if (this.model.Nav_ListThemes && this.model.Nav_ListThemes.length > 0) {
							// Nav_MeetingTheme
							let defCheck = []
							for (let i = 0; i < this.model.Nav_ListThemes.length; i++) {

								if (this.model.Nav_ListThemes[i].Nav_MeetingTheme) {
									defCheck.push(this.model.Nav_ListThemes[i].Nav_MeetingTheme)
								} else {
									defCheck.push(this.model.Nav_ListThemes[i])
								}
							}
							this.selectorInfo.defaultChecked = defCheck
						}
						break;
					case 'UserHost':
						this.selectorInfo.title = '主持人选择'
						this.selectorInfo.isMultiple = false
						if (this.model.Nav_UserHost && this.model.Nav_UserHost.ID)
							this.selectorInfo.defaultChecked = this.model.Nav_UserHost
						break;
					case 'UserRecorder':
						this.selectorInfo.title = '记录人选择'
						this.selectorInfo.isMultiple = false
						if (this.model.Nav_UserRecorder && this.model.Nav_UserRecorder.ID)
							this.selectorInfo.defaultChecked = this.model.Nav_UserRecorder
						break;
					case 'CONTENT':
						this.selectorInfo.title = '会议内容选择'
						this.selectorInfo.isMultiple = true
						if (this.model.Nav_ListMeetingContent && this.model.Nav_ListMeetingContent.length > 0) {
							let defCheck = []
							for (let i = 0; i < this.model.Nav_ListMeetingContent.length; i++) {
								if (this.model.Nav_ListMeetingContent[i].Nav_ContentName) {
									defCheck.push(this.model.Nav_ListMeetingContent[i].Nav_ContentName)
								} else {
									defCheck.push(this.model.Nav_ListMeetingContent[i])
								}
							}
							this.selectorInfo.defaultChecked = defCheck
						}
						break;
				}
				this.selectorInfo.showPopup = true
				this.handleSearch()
			},

			//数据加载
			handleSearch(val, pageIndex) {
				const orgId = uni.getStorageSync('orgId')
				const json = initFilter(orgId, "", "", 0)
				if (val) {
					extendRule(json, 'NAME', 9, val);
				}
				switch (this.selectorInfo.name) {
					case 'Theme':
						OrderPagedMeetingTheme(json).then(res => {
							this.selectorInfo.dataLists = res.map(i => {
								return {
									...i,
									name: i.NAME,
									code: i.CODE
								}
							})
						})
						break;
					case 'UserHost':
					case 'UserRecorder':
						// OrderPagedUseful2(json).then(res => {
						// 	if (res.IsSuccessful) {
						// 		this.selectorInfo.dataLists = res.Data.map(i => {
						// 			return {
						// 				...i,
						// 				name: i.NAME,
						// 				code: i.CODE
						// 			}
						// 		})
						// 	}
						// })

						json.PageIndex = pageIndex ?? 1
						json.Limit = 20
						json.Sort = 'NAME'
						if (pageIndex) {
							json.Start = (pageIndex - 1) * json.Limit;
						}

						// let dataSelect = []
						UserPagedLimit(json).then(res => {
							this.selectorInfo.totalCount = res.TotalCount
							this.selectorInfo.dataLists = res.Data.map(i => {
								return {
									...i,
									name: i.NAME,
									code: i.CODE
								}
							})
						})
						break;
					case 'CONTENT':
						extendRule(json, 'ENABLE_STATUS', 1, 0);
						json.PageIndex = pageIndex ?? 1
						json.Limit = 20
						json.Sort = 'NAME'
						if (pageIndex) {
							json.Start = (pageIndex - 1) * json.Limit;
						}
						OrderPagedContentNameCount(json).then(res => {
							this.selectorInfo.totalCount = res.TotalCount
							this.selectorInfo.dataLists = res.Data.map(i => {
								return {
									...i,
									name: i.NAME,
									code: i.CODE
								}
							})
						})
						break;
				}
			},

			//选择信息
			handleSelected(e) {
				this.selectorInfo.showPopup = false
				switch (this.selectorInfo.name) {
					case 'Theme':
						var ThemesShow = ''
						this.model.Nav_ListThemes = []
						// e.forEach(item => {
						// 	this.model.Nav_ListThemes.push(item)
						// 	ThemesShow += (ThemesShow.length > 0 ? ' ' : '') + item.NAME
						// })
						this.model.Nav_ListThemes = e.map(i => {
							ThemesShow += (ThemesShow.length > 0 ? ' ' : '') + i.NAME
							return {
								...i,
								MEETING_ID: this.model.ID,
								THEME_ID: i.ID,
								ORG_ID: this.model.ORG_ID,
								ID: guid(),
								Nav_MeetingTheme: i
							}
						})
						this.model.THEME = ThemesShow
						break;
					case 'UserHost':
						this.model.Nav_UserHost = e
						this.model.USER_ID_HOST = e.ID
						break;
					case 'UserRecorder':
						this.model.Nav_UserRecorder = e
						this.model.USER_ID_RECORDER = e.ID
						break;
					case 'CONTENT':
						var CONTENT = ''
						this.model.Nav_ListMeetingContent = []
						this.model.Nav_ListMeetingContent = e.map(i => {
							CONTENT += (CONTENT.length > 0 ? ' ' : '') + i.NAME
							return {
								...i,
								MEETING_ID: this.model.ID,
								CONTENTNAME_ID: i.ID,
								ORG_ID: this.model.ORG_ID,
								ID: guid(),
								Nav_ContentName: i
							}
						})
						this.model.CONTENT = CONTENT
						this.model.CONTENT32 = CONTENT //冗余到后台处理关联信息
						break;
				}
			},

			closePicker() {
				this.comPickerInfo = {
					showSheet: false,
					columns: [],
					title: '',
					name: '',
					formIndex: undefined
				}
			},

			//显示组件
			handleTypeChange(itemData) {
				this.comPickerInfo.showSheet = true
				// this.selectorInfo.title = '会议类型'
				// this.selectorInfo.name = name
				// this.selectorInfo.index = val
				this.comPickerInfo.itemData = itemData
				this.handleSearchType()
			},

			//加载 会议类型
			async handleSearchType(val) {
				if (this.listMEETINGTYPE.length < 1) {
					var parm = {
						'name': 'SCMEETINGTYPE'
					}
					await getEnum(parm).then(res => {
						res.forEach(e => {
							this.listMEETINGTYPE.push(e.NAME)
							this.listMEETINGTYPEVal.push(e.ID)
						})
					})
				}
				this.comPickerInfo.columns = [this.listMEETINGTYPE]
			},

			onConfirmPicker(e) {
				//会议类型
				this.model.MEETINGTYPESHOW = e.value[0]
				this.model.MEETINGTYPE = this.listMEETINGTYPEVal[e.indexs[0]]
				this.comPickerInfo.showSheet = false
			},
		},
		computed: {},
	}
</script>


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