|
@@ -232,16 +232,18 @@
|
|
|
areaId: sessionStorage.getItem('areaId'),
|
|
|
}
|
|
|
},
|
|
|
- created() {
|
|
|
- this.findResearchList()
|
|
|
+ async created() {
|
|
|
+ await this.findResearchList()
|
|
|
if (this.isAreaVote) {
|
|
|
this.getAreaTargets()
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ /* 选择变化 */
|
|
|
treeChange(data) {
|
|
|
console.log('选择数据', this.schoolTarget)
|
|
|
},
|
|
|
+ /* 获取区级的发布对象 */
|
|
|
getAreaTargets() {
|
|
|
this.$api.ability.findAreaGroup({
|
|
|
id: this.areaId
|
|
@@ -279,32 +281,30 @@
|
|
|
}
|
|
|
)
|
|
|
},
|
|
|
+ /* 发布对象类型变化 */
|
|
|
onClassTypeChange(val) {
|
|
|
this.voteForm.classes = []
|
|
|
},
|
|
|
-
|
|
|
+ /* 发布对象变化 */
|
|
|
onTargetChange(data) {
|
|
|
this.voteForm.classes = data
|
|
|
this.voteForm.targets = this.getCurScope === 'school' ? [] : data
|
|
|
},
|
|
|
-
|
|
|
+ /* 修改开始时间 */
|
|
|
onChangeSTime(val) {
|
|
|
let endTime = this.voteForm.endTime || Date.now()
|
|
|
if (new Date(val).getTime() >= new Date(endTime).getTime()) {
|
|
|
this.voteForm.endTime = null
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
+ /* 修改结束时间 */
|
|
|
onChangeEndTime(val) {
|
|
|
if (val.indexOf('00:00') > 0) {
|
|
|
val = val.replace('00:00', '23:59')
|
|
|
this.voteForm.endTime = val
|
|
|
}
|
|
|
},
|
|
|
- /**
|
|
|
- * 提交新增投票表单
|
|
|
- * @param name FormName
|
|
|
- */
|
|
|
+ /* 提交保存 */
|
|
|
async handleSubmit(name) {
|
|
|
this.isBtnLoading = true
|
|
|
let hasTargets = (!this.isAreaVote && this.voteForm.classes.length) || (this.isAreaVote && this.schoolTarget.length)
|
|
@@ -434,7 +434,7 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
+ /* 初始化编辑器 */
|
|
|
initEditors() {
|
|
|
console.log('进入编辑起初始化')
|
|
|
console.log(this.voteOptions)
|
|
@@ -481,8 +481,7 @@
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- // 模拟选项聚焦事件
|
|
|
+ /* 模拟选项聚焦事件 */
|
|
|
optionClick(index) {
|
|
|
console.log(index)
|
|
|
let allToolbars = document.getElementsByClassName('option-editor')
|
|
@@ -499,8 +498,7 @@
|
|
|
currentToolBar.style.visibility = 'visible'
|
|
|
}, 100)
|
|
|
},
|
|
|
-
|
|
|
- // 删除选项
|
|
|
+ /* 删除选项 */
|
|
|
deleteOption(index) {
|
|
|
this.voteOptions.splice(index, 1)
|
|
|
this.voteOptionsContent.splice(index, 1)
|
|
@@ -510,8 +508,7 @@
|
|
|
this.initEditors()
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
- // 添加选项
|
|
|
+ /* 添加选项 */
|
|
|
onAddOption() {
|
|
|
let that = this
|
|
|
let newIndex = this.voteOptions.length
|
|
@@ -550,28 +547,17 @@
|
|
|
this.$Message.warning(this.$t('vote.form.optionNumsTip'))
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
- // 提取富文本内容中的文本
|
|
|
+ /* 提取富文本内容中的文本 */
|
|
|
getSimpleText(html) {
|
|
|
var r = /<(?!img|video|audio).*?>/g;
|
|
|
return html.replace(r, "");
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 重置表单
|
|
|
- * @param name
|
|
|
- */
|
|
|
+ /* 重置操作 */
|
|
|
handleReset(name) {
|
|
|
this.$refs[name].resetFields();
|
|
|
this.descriptionEditor.txt.clear()
|
|
|
-
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 重置表单
|
|
|
- * @param name
|
|
|
- */
|
|
|
+ /* 取消操作 */
|
|
|
handleCancel() {
|
|
|
// 如果是新增的问卷点击取消编辑 则需要进行特殊处理
|
|
|
if (!this.curVoteItem.id) {
|
|
@@ -581,7 +567,6 @@
|
|
|
this.doRender(this.editInfo)
|
|
|
|
|
|
},
|
|
|
-
|
|
|
/** 附件上传之前钩子 限制附件上传个数 */
|
|
|
handleBeforeUpload() {
|
|
|
const check = this.uploadList.length < 5;
|
|
@@ -592,11 +577,7 @@
|
|
|
}
|
|
|
return check;
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 新增投票或者编辑投票
|
|
|
- * @param data
|
|
|
- */
|
|
|
+ /* API保存操作 */
|
|
|
saveorUpdateVote(data) {
|
|
|
return new Promise((r, j) => {
|
|
|
if (this.curVoteItem.owner !== 'area') {
|
|
@@ -619,14 +600,10 @@
|
|
|
})
|
|
|
|
|
|
},
|
|
|
-
|
|
|
- /**
|
|
|
- * 回显投票详情
|
|
|
- * @param item
|
|
|
- */
|
|
|
+ /* 渲染投票对象表单 */
|
|
|
async doRender(item) {
|
|
|
console.log('需要渲染的投票对象', item)
|
|
|
-
|
|
|
+ // await this.findResearchList()
|
|
|
// 如果是区级投票
|
|
|
if(this.isAreaVote){
|
|
|
this.classNameArr = item.targets.map(i => {
|
|
@@ -636,15 +613,18 @@
|
|
|
})
|
|
|
}else{
|
|
|
if (item.targetType === 'research') {
|
|
|
- console.log(this.groupList);
|
|
|
- let groupNameArr = []
|
|
|
- item.tchLists.forEach(i => {
|
|
|
- let findObj = this.groupList.find(j => j.id === i)
|
|
|
- if (findObj) {
|
|
|
- groupNameArr.push(findObj)
|
|
|
- }
|
|
|
- })
|
|
|
- this.classNameArr = groupNameArr
|
|
|
+ if(item.tchLists.includes('TeacherAll')){
|
|
|
+ this.classNameArr = [{ name:this.$t('vote.allTeacher') }]
|
|
|
+ }else{
|
|
|
+ let groupNameArr = []
|
|
|
+ item.tchLists.forEach(i => {
|
|
|
+ let findObj = this.groupList.find(j => j.id === i)
|
|
|
+ if (findObj) {
|
|
|
+ groupNameArr.push(findObj)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ this.classNameArr = groupNameArr
|
|
|
+ }
|
|
|
} else {
|
|
|
this.classNameArr = item.classes.length ? await this.getClassNameByIds(item.classes) : item
|
|
|
.stuLists.length ? await this.getClassNameByIds(item.stuLists) : []
|
|
@@ -692,7 +672,6 @@
|
|
|
this.$refs.voteForm.validateField('description')
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
/* 根据班级ID集合换取班级名称 */
|
|
|
getClassNameByIds(ids) {
|
|
|
return new Promise((r, j) => {
|
|
@@ -708,16 +687,19 @@
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
-
|
|
|
/* 查找学校检验组信息 */
|
|
|
findResearchList() {
|
|
|
- this.$api.common.getActivityTarget({
|
|
|
- tmdid: this.$store.state.userInfo.TEAMModelId,
|
|
|
- schoolId: this.$store.state.userInfo.schoolCode,
|
|
|
- opt: 'manage'
|
|
|
- }).then(res => {
|
|
|
- this.groupList = res.groupLists.filter(i => i.type === 'research')
|
|
|
+ return new Promise((r,j) => {
|
|
|
+ this.$api.common.getActivityTarget({
|
|
|
+ tmdid: this.$store.state.userInfo.TEAMModelId,
|
|
|
+ schoolId: this.$store.state.userInfo.schoolCode,
|
|
|
+ opt: 'manage'
|
|
|
+ }).then(res => {
|
|
|
+ this.groupList = res.groupLists.filter(i => i.type === 'research')
|
|
|
+ r(200)
|
|
|
+ })
|
|
|
})
|
|
|
+
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|
|
@@ -729,8 +711,6 @@
|
|
|
this.$editorTools.initSimpleEditor(descriptionEditor, this)
|
|
|
descriptionEditor.create()
|
|
|
this.descriptionEditor = descriptionEditor
|
|
|
-
|
|
|
-
|
|
|
if (this.editItem && this.editItem.name) {
|
|
|
console.log(this.editItem)
|
|
|
this.editInfo = JSON.parse(JSON.stringify(this.editItem))
|