<template>
	<div class="qn-container">
		<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoading"></Loading>
		<div class="qn-header" style="display: none">
			<div>
				<span :class="tabIndex == 0 ? 'tab-active' : ''" @click="handleTabClick(0)">校本问卷</span>
				<span :class="tabIndex == 1 ? 'tab-active' : ''" @click="handleTabClick(1)">个人问卷</span>
			</div>
		</div>
		<div class="qn-box dark-iview-split">
			<Split v-model="split1" ref="leftSplit" >
				<div slot="left" class="demo-split-pane">
					<!-- 问卷活动列表 -->
					<div class="qn-col qn-list-box" v-if="!isFromRecord">
						<div class="qn-box-header">
							<span>{{ $t('survey.list') }}</span>
							<div>
								<Icon type="md-trash" class="to-create-icon" @click="onDeleteQn" style="margin-left: 10px" v-if="qnList.length && ($access.can('admin.*|schoolAc-upd') || isPrivate)" />
								<Icon type="md-add" class="to-create-icon" @click="goToCreate" v-if="($access.can('admin.*|schoolAc-upd') || isPrivate)" />
							</div>
						</div>
						<vuescroll>
							<Loading :top="200" bgColor="rgba(103, 103, 103, 0.27)" type="1" v-show="isLoadList"></Loading>
							<div class="qn-item-wrap">
								<div v-if="qnList.length === 0">
									<EmptyData :top="50"></EmptyData>
								</div>
								<div style="width: 100%" v-else>
									<div :class="['qn-item',index === activeQnIndex ? 'item-active' : '']" v-for="(item, index) in qnList" :key="index"
									 @click="onQnClick(item, index)">
										<p class="qn-item-name">{{ item.name }}</p>
										<div class="qn-item-info">
											<span class="qn-item-nums">
												<Icon type="md-time" size="14" style="margin-right: 5px" />{{ $tools.formatTime(item.startTime,'yyyy-MM-dd hh:mm') }}</span>
											<span class="qn-item-status" :style="{ background: item.progress === 'pending' ? '#0BADD4'  : item.progress === 'going' ? '#12a568' : '#949594', }">
												{{ item.progress === "pending" ? $t('survey.pending') : item.progress === "going"  ? $t('survey.going') : $t('survey.finish')  }}
											</span>
										</div>
									</div>
								</div>
							</div>
						</vuescroll>
					</div>
				</div>
				<div slot="right" class="demo-split-pane">
					<Split v-model="split2">
						<div slot="left" class="demo-split-pane">
							<!-- 问卷基础信息展示 -->
							<div class="qn-col qn-info-box">
								<div class="qn-box-header">
									<span>{{ $t('survey.surveyDetails') }}</span>
									<div class="qn-box-header-tools">
										<!-- <span class="qn-box-header-tools-tool" v-show="currentQn.status !== 300 && qnList.length">
											<Icon type="md-create" size="18" title="编辑" @click="onEditQn" /></span> -->
										<!-- <span class="qn-box-header-tools-tool" v-show="currentQn.progress === 'going' && qnList.length">
											<Icon type="md-undo" size="18" :title="$t('survey.undo')" @click="onCancelQn" style="margin-left: 8px" v-if="($access.can('admin.*|schoolAc-upd') || isPrivate)" />
										</span> -->
									</div>
								</div>
								<vuescroll ref="qnDetailsScroll">
									<div class="qn-info-wrap">
										<div v-show="qnList.length === 0">
											<EmptyData :top="50"></EmptyData>
										</div>
										<BaseQnForm :editItem="currentQn" @onAddSuccess="onAddSuccess" ref="qnForm" v-show="qnList.length"></BaseQnForm>
									</div>
								</vuescroll>
							</div>
						</div>
						<div slot="right" class="demo-split-pane">
							<!-- 问卷提交数据 -->
							<div class="qn-col qn-data-box">
								<div class="qn-box-header">
									<div>
										<span :class="['qn-box-header-tab',curTab === 'progress' ? 'qn-box-header-tab-active' : '']" @click="onChangeResultTab('progress')" v-if="currentQn.progress !== 'pending'">问卷进度</span>
										<span :class="['qn-box-header-tab',curTab === 'result' ? 'qn-box-header-tab-active' : '']" @click="onChangeResultTab('result')">{{ $t('survey.surveyResult') }}</span>
									</div>
									
									<div class="qn-box-header-tools" v-show="!isEmptyData">
										<div class="qn-box-header-tools-tool" style="margin-right: 10px" v-show="currentQn.progress !== 'finish' && editable">
											<Icon type="md-list-box" color="#dcdcdc" />
											<Dropdown @on-click="onAddItem">
												<Button>
													{{ $t('survey.addItem') }}
													<Icon type="ios-arrow-down"></Icon>
												</Button>
												<DropdownMenu slot="list">
													<DropdownItem name="single">{{ $t('survey.single') }}</DropdownItem>
													<DropdownItem name="multiple">{{ $t('survey.multiple') }}</DropdownItem>
													<DropdownItem name="judge">{{ $t('survey.judge') }}</DropdownItem>
													<DropdownItem name="subjective">{{ $t('survey.subjective') }}</DropdownItem>
												</DropdownMenu>
											</Dropdown>
										</div>
										<!-- 						<div class="qn-box-header-tools-tool" style="margin-right: 25px;" @click="onShowAllAnalysis" v-show="currentQn.progress === 'finish' || currentQn.progress === 0">
											<Icon type="md-podium" color="#dcdcdc" />
											<span>查看统计数据</span>
										</div> -->
										<div class="qn-box-header-tools-tool" @click="onEditQn" v-show="currentQn.progress === 'pending' && qnList.length && !editable && ($access.can('admin.*|schoolAc-upd') || isPrivate)">
											<Icon type="md-create" color="#209460" />
											<span>{{ $t('survey.edit') }}</span>
										</div>

										<div class="qn-box-header-tools-tool" v-show="editable" style="margin-right: 10px">
											<Button class="btn-save" icon="md-folder" :loading="isBtnLoading" @click="onSaveQn">{{ $t('survey.save') }}</Button>
										</div>
										
										<div class="qn-box-header-tools-tool" v-if="isFromRecord">
											<Button class="btn-save" icon="md-arrow-round-back" @click="goBackRecord">{{ $t('survey.backToRecord') }}</Button>
										</div>

										<div class="qn-box-header-tools-tool" @click="onCancelEditQn" v-show="editable">
											<Icon type="md-create" color="#209460" />
											<span>{{ $t('survey.cancelEdit') }}</span>
										</div>
									</div>
								</div>
								<vuescroll>
									<div v-show="qnList.length === 0">
										<EmptyData :top="50"></EmptyData>
									</div>
									<div v-show="qnList.length">
										<div class="qn-data-wrap" v-if="curTab === 'result'">
											<BaseQuestionnaire :currentQn="currentQn" :students="allSsList" :isEdit="editable" ref="qnPaper" v-if="!isEmptyData"></BaseQuestionnaire>
										</div>
										<div class="qn-data-wrap qn-progress-wrap" v-else>
											<div class="progress-wrap">
												<BaseProgress barId="pro1" :total="allSsList.length" :noAnswerdCount="noFinishStudents.length"></BaseProgress>
												<BasePie barId="pie1" :total="allSsList.length" :noAnswerdCount="noFinishStudents.length"></BasePie>
											</div>
											<div class="no-table-wrap">
												<BaseSsTable :tableDatas="noFinishStudents"></BaseSsTable>
											</div>
										</div>
									</div>
									
								</vuescroll>
							</div>
						</div>
					</Split>
				</div>
			</Split>
		</div>
	</div>
</template>
<script>
	import blobTool from "@/utils/blobTool.js";
	import BaseQuestionnaire from "@/components/questionnaire/BaseQuestionnaire.vue";
	import BaseQnForm from "@/components/questionnaire/BaseQnForm.vue";
	import BaseProgress from "@/components/questionnaire/BaseProgress.vue";
	import BasePie from "@/components/questionnaire/BasePie.vue";
	import BaseSsTable from "@/components/questionnaire/BaseSsTable.vue";
	export default {
		components: {
			BaseQuestionnaire,
			BaseQnForm,
			BaseProgress,
			BasePie,
			BaseSsTable
		},
		data() {
			return {
				split1: 0.2,
				split2: 0.35,
				tabIndex: 0,
				isEmptyData: true,
				isLoading: false,
				isLoadList: false,
				isBtnLoading: false,
				isEdit: false,
				editable: false,
				qnList: [],
				studentsList: [],
				currentQn: {
					progress: "pending",
				},
				currentRecord: null,
				editItem: {},
				activeQnIndex: null,
				addQnModal: false,
				curTab:'progress',
				noFinishStudents:[],
				allSsList:[],
				isFromRecord:false,
				hasModify:false
			};
		},
		created() {
			
		},
		methods: {
			// 校本课纲与个人课纲切换
			handleTabClick(index) {
				this.tabIndex = index;
				setTimeout(() => {
					this.getQnList(index === 0 ? "school" : "private");
				}, 500)
			},
			
			goBackRecord(){
				this.$router.back(-1)
			},
			
			onChangeResultTab(tab){
				this.curTab = tab
			},

			/** 新增问卷 */
			goToCreate() {
				let hasNoSaveQn = this.qnList.filter(i => !i.id).length
				if (hasNoSaveQn) {
					this.$Message.warning(this.$t('survey.isExistTip'));
				} else {
					let defaultQn = {
						name: this.$t('survey.defaultName'),
						classes: [],
						endTime: new Date(new Date().toLocaleDateString()).getTime() + 2 * 24 * 60 * 60 * 1000 - 1,
						startTime:new Date().getTime(),
						description: "",
						rangeTime: [],
						isReset: [],
						progress: "pending",
						questionUrl: [],
						other: [],
					};

					this.qnList.unshift(defaultQn);
					this.currentQn = defaultQn;
					this.activeQnIndex = 0;
					this.editable = true;
					this.isEmptyData = false;
					this.$refs.qnForm.qnFormEdit = true;
					this.onChangeResultTab('result')
				}
			},



			/** 获取问卷列表 */
			getQnList(type) {
				this.isLoadList = true;
				let params = {
					code: this.getCurCode,
					scope: this.getCurScope,
				};
				this.$api.questionnaire.FindSurveys(params).then(async (res) => {
					if (!res.error && res.surveys) {
						let list = res.surveys.reverse();
						this.qnList = list;
						if (list.length) {
							let queryId = this.$route.query.acId
							if(queryId && list.filter(i => i.id === queryId).length === 0){
								this.$Modal.confirm({
									title: this.$t('survey.questionaire.confirmTitle'),
									content: this.$t('survey.noFoundAc'),
									cancelText: ' ',
									onOk: () => {
										this.goBackRecord()
									},
									onCancel: () => {}
								});
							}
							let queryItem = queryId && list.filter(i => i.id === queryId).length ?  list.filter(i => i.id === queryId)[0] : list[0]
							let queryIndex = queryId ? list.indexOf(queryItem) : 0
							this.onQnClick(queryItem, queryIndex);
							this.isEmptyData = false;
						} else {
							this.isEmptyData = true;
						}
						this.isLoadList = false;
					} else {
						this.$Message.error(this.$t('survey.getDataFailTip'));
					}
				}).catch(err => {
					this.isLoadList = false
				});
			},

			/** 获取问卷列表 */
			async getQnDetails(qnItem) {
				console.log(qnItem)
				return new Promise(async (r, j) => {
					this.$api.questionnaire
						.FindSurveysSummary({
							id: qnItem.id,
							code: qnItem.code,
						})
						.then(async (res) => {
							if (!res.error && res.survey) {
								r(res.survey);
							} else {
								this.$Message.error(this.$t('survey.getDataFailTip'));
							}
						});
				});
			},

			/**
			 * 问卷点击事件
			 * @param item
			 * @param index
			 */
			async onQnClick(item, index) {
				if (this.activeQnIndex === index && this.currentQn.id && this.currentQn.id === item.id && !this.hasModify) return
				console.log(item, index);
				/* 判断是否有新增但是无效的ITEM  如果有 则清空 需要重新添加 */
				let hasNewQn = this.qnList.filter((i) => !i.id).length;
				if (hasNewQn) {
					this.qnList
						.filter((i) => !i.id)
						.forEach((item) => {
							this.qnList.splice(this.qnList.indexOf(item), 1);
						});
				}
				this.currentQn = item.id ? await this.getQnDetails(item) : this.currentQn;
				this.currentQn.progress = item.progress;
				if (item.id) this.getSurveyStudents(this.currentQn)
				if(item.progress === 'pending'){
					this.onChangeResultTab('result')
				}else{
					this.onChangeResultTab('progress')
				}
				console.log("获取问卷数据");
				console.log(this.currentQn);
				this.activeQnIndex = hasNewQn ? this.qnList.indexOf(item) : index;
				this.$refs.qnForm.qnFormEdit = false;
				this.editable = false;
				this.hasModify = false
			},

			/* 获取问卷所有试题的选项内容 */
			getSurveyAns(items) {
				let result = []
				items.forEach(item => {
					result.push(item.option.map(i => i.code))
				})
				return result
			},

			/* 保存问卷操作 */
			async onSaveQn() {
				this.isBtnLoading = true;
				let isQnFormEdit = this.$refs.qnForm.qnFormEdit; // 判断当前表单是否为编辑状态
				try{
					let qnBaseInfo = isQnFormEdit ? await this.$refs.qnForm.handleSubmit("qnForm") : this.currentQn;
					let qnItems = this.$refs.qnPaper.items || [];
					// 将问卷试题内容保存到blob 用blobUrl来替换quesitons字段
					qnBaseInfo.answers = this.getSurveyAns(qnItems)
					qnBaseInfo.blob = await this.doUploadBlob(qnBaseInfo, qnItems);
					// 开始保存问卷
					this.saveorUpdataQn(qnBaseInfo)
						.then((res) => {
							this.$Message.success(this.$t('survey.doSuc'));
							this.editable = false;
							this.hasModify = true
							this.onAddSuccess();
						})
						.catch((error) => {
							this.$Message.error(`${error}`);
						}).finally(data => {
							this.$refs.qnForm.qnFormEdit = false;
							this.isLoading = false;
							this.isBtnLoading = false;
						});
				}catch(e){
					this.isLoading = false;
					this.isBtnLoading = false;
				}
				
			},
			
			/* 上传index.json */
			async doUploadItems(qnBaseInfo,items){
				return new Promise(async (resolve, reject) => {
					let promiseArr = []
					// 获取初始化Blob需要的数据
					let sasData = qnBaseInfo.scope === 'private' ? await this.$tools.getPrivateSas() : await this.$tools.getSchoolSas();
					//初始化Blob
					let containerClient = new blobTool(
						sasData.url,
						sasData.name,
						sasData.sas,
						qnBaseInfo.scope
					);
					
					for (let item of items) {
						let curId = item.id || this.$tools.guid()
						promiseArr.push(new Promise(async (r, j) => {
							// let itemJsonFile = await this.$evTools.createBlobItem(exerciseItem);
							let file = new File([JSON.stringify(item)], curId + ".json");
							try {
								// 等待上传blob的返回结果
								let blobFile = await containerClient.upload(file, 'survey/' + qnBaseInfo.id);
								if (blobFile.blob) {
									console.log('上传Blob成功', blobFile)
									r(blobFile.blob)
								} else {
									this.$Message.error(this.$t('evaluation.newExercise.uploadErrorTip'));
								}
							} catch (e) {
								this.$Message.error(e.spaceError);
							}
						}))
					}
					Promise.all(promiseArr).then(result => {
						resolve(result)
					})
				})
			},
			
			/* 保存问卷题目到Blob */
			doUploadBlob(qnBaseInfo, items) {
				return new Promise(async (resolve,reject) => {
					let itemUrls = await this.doUploadItems(qnBaseInfo, items)
					qnBaseInfo.slides = itemUrls
					// 获取初始化Blob需要的数据
					let sasData = qnBaseInfo.scope === 'private' ? await this.$tools.getPrivateSas() : await this.$tools.getSchoolSas();
					//初始化Blob
					let containerClient = new blobTool(
						sasData.url,
						sasData.name,
						sasData.sas,
						qnBaseInfo.scope
					);
					let file = new File([JSON.stringify(qnBaseInfo)], "index.json");
					try {
						// 等待上传blob的返回结果
						let blobFile = await containerClient.upload(file, 'survey/' + qnBaseInfo.id);
						if (blobFile.blob) {
							delete qnBaseInfo.slides
							resolve(blobFile.blob)
						} else {
							this.$Message.error(this.$t('evaluation.newExercise.uploadErrorTip'));
						}
					} catch (e) {
						reject(e);
					}
				})
				
			},
			
			/* 获取当前问卷活动学生作答数据 */
			async getSurveyStudents(surveyItem) {
				this.isLoading = true
				try{
					let answerdList = await this.getAnswerdRecord(surveyItem)
					//  先查找 投票发布对象关联的学生清单 然后再去判断学生的作答情况
					this.$api.schoolSetting.getClassroomStudent({
						school_code: this.$store.state.userInfo.schoolCode,
						ids: surveyItem.classes,
						scope:surveyItem.scope
					}).then(res => {
						if (!res.error && res.stus.length) {
							let list = []
							res.stus.forEach(classStus => {
								classStus.forEach(i => {
									list.push({
										id: i.id,
										name: i.name,
										no: i.no,
										classroomName: i.className
									})
								})
							})
							this.allSsList = list
							// 要根据作答情况 结合两张表 处理表格显示的数据 
							if (answerdList.length) {
								this.noFinishStudents = this.getNoFinishList(answerdList,list)
							} else {
								this.noFinishStudents = list
							}
							this.isLoading = false
						} else {
							this.$Message.error(this.$t('vote.getDataFailTip'))
							this.isLoading = false
						}
					}).catch(err => {
						console.log(err)
						this.$Message.error(this.$t('vote.getClassDataFailTip'))
						this.isLoading = false
					})
				}catch(e){
					this.$Message.error(this.$t('vote.getDataFailTip'))
					this.isLoading = false
				}
				
			},
			
			/* 根据学生ID集合 来换取学生详细数据 */
			getStudentsList(ids){
				return new Promise((r,j) => {
					
				})
			},
			
			/* 获取未作答学生清单 */
			getNoFinishList(answerdList,allList){
				let result = []
				allList.forEach(i => {
					if(!answerdList.includes(i.id)){
						result.push(i)
					}
				})
				return result
			},
			
			/* 获取正在进行中的投票活动的投票数据 */
			getAnswerdRecord(surveyItem){
				return new Promise(async (r,j) => {
					if(surveyItem.progress !== 'finish'){
						this.$api.questionnaire.GetAnswerdRecord({
							id: surveyItem.id,
							code: surveyItem.code,
						}).then(res => {
							if(!res.error){
								r(res.userids)
							}
						}).catch(err => {
							j(err)
						})
					}else{ // 如果是已结束的活动 则从blob读取作答数据 
						try{
							let curItemRecord = await this.getBlobJsonFile(surveyItem.scope,surveyItem.recordUrl)
							r(curItemRecord.userids)
						}catch(e){
							j(e)
						}
					}
					
				})
			},
			
			/* 根据已结束的RecordUrl来获取投票结果数据 */
			getBlobJsonFile(scope,url){
				return new Promise(async (resolve,reject) => {
					let blobHost = scope === 'private' ?  JSON.parse(decodeURIComponent(localStorage.user_profile, "utf-8")).blob_uri : JSON.parse(decodeURIComponent(localStorage.school_profile, "utf-8")).blob_uri
					// 根据试卷的Blob地址 去读取JSON文件
					let sasString = scope === 'private' ?  await this.$tools.getPrivateSas() : await this.$tools.getSchoolSas()
					try{
						let itemJson = JSON.parse(await this.$tools.getFile(blobHost + url + sasString.sas))
						resolve(itemJson)
					}catch(e){
						this.$Message.error(this.$t('vote.getDataFailTip'))
						reject(e)
					}
				})
			},

			onShowAllAnalysis() {
				this.$refs.qnPaper.onShowAllAnalysis();
			},

			onAddItem(name) {
				this.$refs.qnPaper.onMenuClick(name);
			},


			/* 查找指定题目指定选项在作答数据里出现的次数 */
			getSelectNum(origin, itemIndex, option) {
				let num = 0;
				origin.forEach((i) => {
					if (i.answers[itemIndex].answer.includes(option)) num++;
				});
				return num;
			},

			// 提取富文本内容中的文本
			getSimpleText(html) {
				var r = /<(?!img|video|audio).*?>/g;
				return html.replace(r, "");
			},

			/**
			 * 新增问卷或者编辑问卷
			 * @param data
			 */
			saveorUpdataQn(data) {
				return new Promise((r, j) => {
					this.$api.questionnaire.UpsertSurvey(data).then((res) => {
						if (!res.error) {
							r(res);
						} else {
							j(res.error);
						}
					});
				});
			},

			/** 问卷编辑事件 */
			onEditQn() {
				this.editItem = this.currentQn;
				this.isEdit = true;
				this.editable = true;
				this.$refs.qnForm.qnFormEdit = !this.$refs.qnForm.qnFormEdit;
			},

			onCancelEditQn() {
				if (this.currentQn.id && this.qnList.length > 0) {
					this.$refs.qnForm.qnFormEdit = false;
					// this.onQnClick(this.currentQn, this.activeQnIndex);
					this.$refs.qnForm.doRender(this.currentQn)
				} else if (!this.currentQn.id && this.qnList.length > 1) {
					this.onQnClick(this.qnList[1], 1)
				} else {
					this.qnList = [];
					this.currentQn = {
						progress: "pending",
					};
					this.activeQnIndex = 0;
					this.isEmptyData = true;
				}
				this.isBtnLoading = false;
				this.editable = false;
			},

			/* 取消发布问卷 */
			onCancelQn() {
				this.$Modal.confirm({
					title: this.$t('survey.cancelSurvey'),
					content: this.$t('survey.cancelConfirmTip'),
					onOk: () => {
						this.isLoading = true;
						this.$api.questionnaire
							.CancelSurvey({
								surveyId: this.currentQn.id
							})
							.then((res) => {
								if (!res.error) {
									this.isLoading = false;
									this.$Message.success(this.$t('survey.doSuc'));
									this.getQnList();
								} else {
									this.isLoading = false;
									this.$Message.success(this.$t('survey.doFail'));
								}
							});
					},
				});
			},

			/** 新增问卷成功回调 */
			onAddSuccess() {
				this.handleTabClick(this.$route.name === "manageQuestionnaire" ? 0 : 1);
			},

			/** 删除当前问卷 */
			onDeleteQn() {
				this.$Modal.confirm({
					title: this.$t('survey.deletesurvey'),
					content: this.$t('survey.deleteConfirmTip'),
					onOk: () => {
						this.isLoading = true;
						if (this.currentQn.id) {
							this.$api.questionnaire
								.DeleteSurvey({
									id: this.currentQn.id,
									code: this.currentQn.code,
									scope: this.getCurScope,
								})
								.then((res) => {
									if (!res.error) {
										// 获取初始化Blob需要的数据
										this.deleteBlobPrefix(this.currentQn).then(status => {
											if (status === 200) {
												this.isLoading = false;
												this.qnList.splice(this.qnList.reverse().indexOf(this.currentQn), 1);
												this.$Message.success(this.$t('survey.deleteSuc'));
												this.handleTabClick(
													this.$route.name === "manageQuestionnaire" ? 0 : 1
												);
											} else {
												console.log(err)
												this.isLoading = false;
											}
										})
									} else {
										this.isLoading = false;
										this.$Message.error(this.$t('survey.deleteFail'));
									}
								});
						} else {
							this.qnList.splice(this.qnList.indexOf(this.currentQn), 1);
							this.isLoading = false;
							this.$Message.success(this.$t('survey.deleteSuc'));
							if (this.qnList.length) this.onQnClick(this.qnList[0], 0);
						}
					},
				});
			},

			/* 删除blob指定试题目录下所有 */
			deleteBlobPrefix(item) {
				return new Promise((resolve, reject) => {
					this.$api.blob.deletePrefix({
						"cntr": item.scope === 'school' ? this.$store.state.userInfo.schoolCode : this.$store.state.userInfo.TEAMModelId,
						"prefix": "survey/" + item.id
					}).then(
						(res) => {
							if (!res.error) {
								resolve(200)
							} else {
								resolve(500)
							}
						},
						(err) => {
							reject(err)
						}
					)
				})
			},

			/**
			 * 滚动条返回顶部
			 * @param refName
			 */
			backToTop(refName) {
				this.$refs[refName].scrollTo({
						y: 0,
					},
					100,
					"easeInQuad"
				);
			},
		},
		mounted() {
			// this.handleTabClick(0)
			if(this.$route.query.acId){
				this.isFromRecord = true
				this.split1 = 0
				this.split2 = 0.3
				this.$refs.leftSplit.$el.getElementsByClassName('ivu-split-trigger-con')[0].style.display = 'none'
			}
		},
		computed: {
			getCurCode() {
				return this.$route.name === "personalSurvey" ?
					this.$store.state.userInfo.TEAMModelId :
					this.$store.state.userInfo.schoolCode;
			},
			getCurScope() {
				return this.$route.name === "personalSurvey" ? "private" : "school";
			},
			isPrivate() {
				return this.$route.name === 'personalSurvey'
			}
		},
		watch: {
			$route: {
				handler: function(to, from) {
					this.handleTabClick(this.$route.name === "manageQuestionnaire" ? 0 : 1);
				},
				immediate: true,
			},
		},
	};
</script>
<style lang="less" scoped>
	@import "./ManageQuestionnaire.less";
</style>
<style>
	.qn-modal .ivu-modal-content {
		background: #454545;
	}

	.qn-modal .ivu-modal-body {
		padding: 0;
	}

	.qn-modal .ivu-modal-header p,
	.qn-modal .ivu-modal-header-inner {
		color: #fff;
		font-size: 18px;
		font-weight: bold;
	}

	.qn-modal .ivu-modal-header {
		border-bottom: none;
	}

	.qn-modal .qn-modal-box {
		height: 600px;
		max-height: 600px;
		padding: 15px;
	}
</style>
