|
@@ -2,114 +2,118 @@
|
|
|
<div class="component-vote-form light-iview-form light-el-input">
|
|
|
<Form ref="voteForm" :model="voteForm" label-position="top" :rules="ruleValidate" :disabled="!voteFormEdit"
|
|
|
hide-required-mark>
|
|
|
- <FormItem :label="$t('vote.form.name')" prop="name">
|
|
|
- <Input v-special-char :class="!voteFormEdit ? 'vote-form-disabled':''" v-model="voteForm.name"
|
|
|
- :placeholder="$t('vote.form.namePlace')"></Input>
|
|
|
- </FormItem>
|
|
|
- <FormItem :label="$t('vote.form.target')" prop="classes">
|
|
|
- <!-- 预览状态 -->
|
|
|
- <div v-if="!voteFormEdit && curVoteItem" class="vote-class">
|
|
|
- <span v-for="item in classNameArr" class="vote-class-item">{{ item.name }}</span>
|
|
|
- </div>
|
|
|
- <!-- 编辑状态 -->
|
|
|
- <div v-else>
|
|
|
- <!-- 区级选学校 -->
|
|
|
- <div v-if="isAreaVote">
|
|
|
- <el-cascader size="small" :show-all-levels="false" clearable filterable v-model="schoolTarget"
|
|
|
- :options="csOptions" :props="props" @change="treeChange" style="width:100%;">
|
|
|
- </el-cascader>
|
|
|
- </div>
|
|
|
- <div v-else>
|
|
|
- <!-- 校级选教研组或者学生名单 -->
|
|
|
- <BaseClassSelect :classes="classTargets" :type="targetType" @onChange="onTargetChange"
|
|
|
- ref="classSelectRef" v-if="getCurScope === 'school' && curVoteItem"></BaseClassSelect>
|
|
|
- <BaseClassSelectPri :classes="classTargets" :scope="classType" @onChange="onTargetChange"
|
|
|
- ref="classSelectRef" v-if="getCurScope === 'private' && curVoteItem"></BaseClassSelectPri>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </FormItem>
|
|
|
- <FormItem :label="$t('learnActivity.createEv.publishType')" prop="publishModel" v-show="voteFormEdit && !isAreaVote">
|
|
|
- <Checkbox v-model="isImmediate">{{$t('global.publishType1')}}</Checkbox>
|
|
|
- </FormItem>
|
|
|
- <FormItem :label="$t('learnActivity.createEv.startTime')" v-if="!isImmediate || !voteFormEdit"
|
|
|
- prop="startTime">
|
|
|
- <DatePicker v-show="voteFormEdit" type="datetime" :options="startOption" format="yyyy/MM/dd HH:mm"
|
|
|
- v-model="voteForm.startTime" split-panels :placeholder="$t('learnActivity.createEv.sTimeHolder')"
|
|
|
- style="width:100%" @on-change="onChangeSTime"></DatePicker>
|
|
|
- <div v-show="!voteFormEdit" style="margin:10px;font-size:16px;font-weight:bold;">
|
|
|
- {{ $tools.formatTime(voteForm.startTime,'yyyy-MM-dd hh:mm') }}
|
|
|
- </div>
|
|
|
- </FormItem>
|
|
|
- <FormItem :label="$t('learnActivity.createEv.endTime')" prop="endTime">
|
|
|
- <DatePicker v-show="voteFormEdit" type="datetime" :options="endOption" format="yyyy/MM/dd HH:mm"
|
|
|
- v-model="voteForm.endTime" split-panels @on-change="onChangeEndTime"
|
|
|
- :placeholder="$t('learnActivity.createEv.eTimeHolder')" style="width:100%"></DatePicker>
|
|
|
- <div v-show="!voteFormEdit" style="margin:10px;font-size:16px;font-weight:bold;">
|
|
|
- {{ $tools.formatTime(voteForm.endTime,'yyyy-MM-dd hh:mm') }}
|
|
|
- </div>
|
|
|
- </FormItem>
|
|
|
-
|
|
|
- <FormItem :label="$t('vote.form.description')" prop="description">
|
|
|
- <div ref="descriptionEditor" style="text-align:left" v-show="voteFormEdit"></div>
|
|
|
- <div v-html="voteForm.description" v-show="!voteFormEdit"
|
|
|
- style="margin:10px;font-size:16px;font-weight:bold;word-break: break-all;"></div>
|
|
|
- </FormItem>
|
|
|
-
|
|
|
- <FormItem :label="$t('vote.form.optionSetting')" prop="attachment" ref="optionsBox">
|
|
|
- <div v-if="voteOptions.length">
|
|
|
- <div v-for="(item,index) in voteOptions" :key="index" class="option-editor-wrap">
|
|
|
- <div v-show="voteFormEdit" style="display: flex;">
|
|
|
- <span class="option-order">{{ index + 1 }}
|
|
|
- <Icon type="md-trash" @click="deleteOption(index)" />
|
|
|
- </span>
|
|
|
- <div :ref="'voteOption'+index" style="text-align:left" class="option-editor"
|
|
|
- @click="optionClick(index)"></div>
|
|
|
+ <div style="display: flex;">
|
|
|
+ <div style="width: 48%;">
|
|
|
+ <FormItem :label="$t('vote.form.name')" prop="name">
|
|
|
+ <Input v-special-char :class="!voteFormEdit ? 'vote-form-disabled':''" v-model="voteForm.name"
|
|
|
+ :placeholder="$t('vote.form.namePlace')"></Input>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('vote.form.target')" prop="classes">
|
|
|
+ <!-- 预览状态 -->
|
|
|
+ <div v-if="!voteFormEdit && curVoteItem" class="vote-class">
|
|
|
+ <span v-for="item in classNameArr" class="vote-class-item">{{ item.name }}</span>
|
|
|
</div>
|
|
|
- <div v-show="!voteFormEdit">
|
|
|
- <span style="margin-left: 10px;">{{ index + 1 }} .</span>
|
|
|
- <div v-html="(voteOptionsContent[index]) ? voteOptionsContent[index].value : ''"
|
|
|
- v-show="!voteFormEdit"
|
|
|
- style="margin:10px;font-size:16px;font-weight:bold;display: inline-block;vertical-align: middle;">
|
|
|
+ <!-- 编辑状态 -->
|
|
|
+ <div v-else>
|
|
|
+ <!-- 区级选学校 -->
|
|
|
+ <div v-if="isAreaVote">
|
|
|
+ <el-cascader size="small" :show-all-levels="false" clearable filterable
|
|
|
+ v-model="schoolTarget" :options="csOptions" :props="props" @change="treeChange"
|
|
|
+ style="width:100%;">
|
|
|
+ </el-cascader>
|
|
|
+ </div>
|
|
|
+ <div v-else>
|
|
|
+ <!-- 校级选教研组或者学生名单 -->
|
|
|
+ <BaseClassSelect :classes="classTargets" :type="targetType" @onChange="onTargetChange"
|
|
|
+ ref="classSelectRef" v-if="getCurScope === 'school' && curVoteItem">
|
|
|
+ </BaseClassSelect>
|
|
|
+ <BaseClassSelectPri :classes="classTargets" :scope="classType"
|
|
|
+ @onChange="onTargetChange" ref="classSelectRef"
|
|
|
+ v-if="getCurScope === 'private' && curVoteItem"></BaseClassSelectPri>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('learnActivity.createEv.publishType')" prop="publishModel"
|
|
|
+ v-show="voteFormEdit && !isAreaVote">
|
|
|
+ <Checkbox v-model="isImmediate">{{$t('global.publishType1')}}</Checkbox>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('learnActivity.createEv.startTime')" v-if="!isImmediate || !voteFormEdit"
|
|
|
+ prop="startTime">
|
|
|
+ <DatePicker v-show="voteFormEdit" type="datetime" :options="startOption"
|
|
|
+ format="yyyy/MM/dd HH:mm" v-model="voteForm.startTime" split-panels
|
|
|
+ :placeholder="$t('learnActivity.createEv.sTimeHolder')" style="width:100%"
|
|
|
+ @on-change="onChangeSTime"></DatePicker>
|
|
|
+ <div v-show="!voteFormEdit" style="margin:10px;font-size:16px;font-weight:bold;">
|
|
|
+ {{ $tools.formatTime(voteForm.startTime,'yyyy-MM-dd hh:mm') }}
|
|
|
+ </div>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('learnActivity.createEv.endTime')" prop="endTime">
|
|
|
+ <DatePicker v-show="voteFormEdit" type="datetime" :options="endOption" format="yyyy/MM/dd HH:mm"
|
|
|
+ v-model="voteForm.endTime" split-panels @on-change="onChangeEndTime"
|
|
|
+ :placeholder="$t('learnActivity.createEv.eTimeHolder')" style="width:100%"></DatePicker>
|
|
|
+ <div v-show="!voteFormEdit" style="margin:10px;font-size:16px;font-weight:bold;">
|
|
|
+ {{ $tools.formatTime(voteForm.endTime,'yyyy-MM-dd hh:mm') }}
|
|
|
+ </div>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('vote.form.description')" prop="description">
|
|
|
+ <div ref="descriptionEditor" style="text-align:left" v-show="voteFormEdit"></div>
|
|
|
+ <div v-html="voteForm.description" v-show="!voteFormEdit"
|
|
|
+ style="margin:10px;font-size:16px;font-weight:bold;word-break: break-all;"></div>
|
|
|
+ </FormItem>
|
|
|
</div>
|
|
|
-
|
|
|
- <p style="float:right;color:#757575;cursor:pointer" @click="onAddOption" v-show="voteFormEdit">
|
|
|
- <Icon type="md-add" />{{ $t('vote.form.addOption') }}
|
|
|
- </p>
|
|
|
- </FormItem>
|
|
|
-
|
|
|
- <FormItem :label="$t('vote.form.times')">
|
|
|
- <Select v-model="voteForm.times" :class="!voteFormEdit ? 'vote-form-disabled':''">
|
|
|
- <Option value="once">{{ $t('vote.form.once') }}</Option>
|
|
|
- <Option value="day">{{ $t('vote.form.day') }}</Option>
|
|
|
- <Option value="week">{{ $t('vote.form.week') }}</Option>
|
|
|
- <Option value="month">{{ $t('vote.form.month') }}</Option>
|
|
|
- <Option value="year">{{ $t('vote.form.year') }}</Option>
|
|
|
- </Select>
|
|
|
- </FormItem>
|
|
|
-
|
|
|
- <FormItem :label="$t('vote.form.selectNum')" prop="selectMax">
|
|
|
- <!--<Input :class="!voteFormEdit ? 'vote-form-disabled':''" v-model="voteForm.count" placeholder="请输入投票名称"></Input>-->
|
|
|
- <InputNumber :min="1" v-model="voteForm.selectMax"></InputNumber>
|
|
|
- </FormItem>
|
|
|
-
|
|
|
- <FormItem :label="$t('vote.form.other')" prop="secret">
|
|
|
- <CheckboxGroup v-model="voteForm.secret">
|
|
|
- <Checkbox label="secret">{{ $t('vote.form.openSecret') }}</Checkbox>
|
|
|
- </CheckboxGroup>
|
|
|
- <CheckboxGroup v-model="voteForm.repeat" v-if="voteForm.selectMax > 1">
|
|
|
- <Checkbox label="repeat">{{ $t('vote.form.openRepeat') }}</Checkbox>
|
|
|
- </CheckboxGroup>
|
|
|
- </FormItem>
|
|
|
-
|
|
|
- <FormItem v-show="voteFormEdit">
|
|
|
- <Button type="primary" class="btn-save" @click="handleSubmit('voteForm')"
|
|
|
- :loading="isBtnLoading">{{ $t('vote.form.save') }}</Button>
|
|
|
- <Button @click="handleCancel('voteForm')" class="btn-reset"
|
|
|
- style="margin-left: 8px">{{ $t('vote.form.cancel') }}</Button>
|
|
|
- </FormItem>
|
|
|
+ <div style="width: 48%;padding-left: 2%;margin-left:2%;border-left: 1px dashed #D2D2D2;">
|
|
|
+ <FormItem :label="$t('vote.form.optionSetting')" prop="attachment" ref="optionsBox">
|
|
|
+ <div v-if="voteOptions.length">
|
|
|
+ <div v-for="(item,index) in voteOptions" :key="index" class="option-editor-wrap">
|
|
|
+ <div v-show="voteFormEdit" style="display: flex;">
|
|
|
+ <span class="option-order">{{ index + 1 }}
|
|
|
+ <Icon type="md-trash" @click="deleteOption(index)" />
|
|
|
+ </span>
|
|
|
+ <div :ref="'voteOption'+index" style="text-align:left" class="option-editor"
|
|
|
+ @click="optionClick(index)"></div>
|
|
|
+ </div>
|
|
|
+ <div v-show="!voteFormEdit">
|
|
|
+ <span style="margin-left: 10px;">{{ index + 1 }} .</span>
|
|
|
+ <div v-html="(voteOptionsContent[index]) ? voteOptionsContent[index].value : ''"
|
|
|
+ v-show="!voteFormEdit"
|
|
|
+ style="margin:10px;font-size:16px;font-weight:bold;display: inline-block;vertical-align: middle;">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <p style="float:right;color:#757575;cursor:pointer" @click="onAddOption" v-show="voteFormEdit">
|
|
|
+ <Icon type="md-add" />{{ $t('vote.form.addOption') }}
|
|
|
+ </p>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('vote.form.times')">
|
|
|
+ <Select v-model="voteForm.times" :class="!voteFormEdit ? 'vote-form-disabled':''">
|
|
|
+ <Option value="once">{{ $t('vote.form.once') }}</Option>
|
|
|
+ <Option value="day">{{ $t('vote.form.day') }}</Option>
|
|
|
+ <Option value="week">{{ $t('vote.form.week') }}</Option>
|
|
|
+ <Option value="month">{{ $t('vote.form.month') }}</Option>
|
|
|
+ <Option value="year">{{ $t('vote.form.year') }}</Option>
|
|
|
+ </Select>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('vote.form.selectNum')" prop="selectMax">
|
|
|
+ <!--<Input :class="!voteFormEdit ? 'vote-form-disabled':''" v-model="voteForm.count" placeholder="请输入投票名称"></Input>-->
|
|
|
+ <InputNumber :min="1" v-model="voteForm.selectMax"></InputNumber>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem :label="$t('vote.form.other')" prop="secret">
|
|
|
+ <CheckboxGroup v-model="voteForm.secret">
|
|
|
+ <Checkbox label="secret">{{ $t('vote.form.openSecret') }}</Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ <CheckboxGroup v-model="voteForm.repeat" v-if="voteForm.selectMax > 1">
|
|
|
+ <Checkbox label="repeat">{{ $t('vote.form.openRepeat') }}</Checkbox>
|
|
|
+ </CheckboxGroup>
|
|
|
+ </FormItem>
|
|
|
+ <FormItem v-show="voteFormEdit">
|
|
|
+ <Button type="primary" class="btn-save" @click="handleSubmit('voteForm')"
|
|
|
+ :loading="isBtnLoading">{{ $t('vote.form.save') }}</Button>
|
|
|
+ <!-- <Button @click="handleCancel('voteForm')" class="btn-reset"
|
|
|
+ style="margin-left: 8px">{{ $t('vote.form.cancel') }}</Button> -->
|
|
|
+ </FormItem>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</Form>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -258,7 +262,7 @@
|
|
|
name: sItem.sname,
|
|
|
children: []
|
|
|
}
|
|
|
- sItem.name.forEach((gItem,gIndex) => {
|
|
|
+ sItem.name.forEach((gItem, gIndex) => {
|
|
|
i.children.push({
|
|
|
id: sItem.sname + '-' + gItem,
|
|
|
name: sItem.sname + '-' + gItem,
|
|
@@ -307,10 +311,13 @@
|
|
|
/* 提交保存 */
|
|
|
async handleSubmit(name) {
|
|
|
this.isBtnLoading = true
|
|
|
- let hasTargets = (!this.isAreaVote && this.voteForm.classes.length) || (this.isAreaVote && this.schoolTarget.length)
|
|
|
- let optionComplete = this.voteOptionsContent.length && this.voteOptionsContent.every(i => i.value !== '')
|
|
|
+ let hasTargets = (!this.isAreaVote && this.voteForm.classes.length) || (this.isAreaVote && this
|
|
|
+ .schoolTarget.length)
|
|
|
+ let optionComplete = this.voteOptionsContent.length && this.voteOptionsContent.every(i => i.value !==
|
|
|
+ '')
|
|
|
this.$refs[name].validate(async (valid) => {
|
|
|
- if (valid && this.getSimpleText(this.voteForm.description) && optionComplete && hasTargets) {
|
|
|
+ if (valid && this.getSimpleText(this.voteForm.description) && optionComplete &&
|
|
|
+ hasTargets) {
|
|
|
if (this.voteForm.selectMax > this.voteOptionsContent.length && this.voteForm
|
|
|
.repeat.indexOf('repeat') === -1) {
|
|
|
this.$Message.warning(this.$t('vote.optionMaxTip'))
|
|
@@ -322,7 +329,9 @@
|
|
|
console.log(this.voteForm)
|
|
|
let classSelectScope = this.isAreaVote ? 'school' : this.$refs.classSelectRef
|
|
|
.evaluationInfo.scope
|
|
|
- let isSchoolClass = this.isAreaVote ? false : (this.$refs.classSelectRef.evaluationInfo.scope === 'school' && this.$refs.classSelectRef.privateClassType === 'school')
|
|
|
+ let isSchoolClass = this.isAreaVote ? false : (this.$refs.classSelectRef
|
|
|
+ .evaluationInfo.scope === 'school' && this.$refs.classSelectRef
|
|
|
+ .privateClassType === 'school')
|
|
|
let params = Object.assign({}, this.defaultParams)
|
|
|
let areaParams = null
|
|
|
let target = []
|
|
@@ -335,7 +344,8 @@
|
|
|
params.code = this.getCurCode
|
|
|
params.scope = isPersonal ? 'private' : 'school'
|
|
|
params.name = this.voteForm.name
|
|
|
- params.startTime = !this.isImmediate ? new Date(this.voteForm.startTime).getTime() : -1
|
|
|
+ params.startTime = !this.isImmediate ? new Date(this.voteForm.startTime)
|
|
|
+ .getTime() : -1
|
|
|
params.endTime = new Date(this.voteForm.endTime).getTime()
|
|
|
params.description = this.voteForm.description
|
|
|
params.targets = this.voteForm.targets
|
|
@@ -348,7 +358,8 @@
|
|
|
params.creatorId = this.$store.state.userInfo.TEAMModelId
|
|
|
params.voteNum = this.voteForm.selectMax
|
|
|
params.times = this.voteForm.times
|
|
|
- params.school = params.scope === 'school' ? this.$store.state.userInfo.schoolCode : null
|
|
|
+ params.school = params.scope === 'school' ? this.$store.state.userInfo
|
|
|
+ .schoolCode : null
|
|
|
params.tchLists = []
|
|
|
params.classes = []
|
|
|
params.stuLists = []
|
|
@@ -365,7 +376,7 @@
|
|
|
sId: i,
|
|
|
sName: this.schList.find(j => j.id === i).sname,
|
|
|
gName: [],
|
|
|
- gId:[]
|
|
|
+ gId: []
|
|
|
})
|
|
|
// 如果是区级活动 需要拼接学校加教研组信息
|
|
|
this.schoolTarget.forEach(j => {
|
|
@@ -375,8 +386,10 @@
|
|
|
para[index].gName = []
|
|
|
para[index].gId = ['default']
|
|
|
} else {
|
|
|
- let curSch = this.schList.find(sch => sch.id === i)
|
|
|
- let groupId = curSch.gId[curSch.name.indexOf(groupName)]
|
|
|
+ let curSch = this.schList.find(sch => sch
|
|
|
+ .id === i)
|
|
|
+ let groupId = curSch.gId[curSch.name
|
|
|
+ .indexOf(groupName)]
|
|
|
para[index].gName.push(groupName)
|
|
|
para[index].gId.push(groupId)
|
|
|
}
|
|
@@ -392,7 +405,7 @@
|
|
|
"para": para,
|
|
|
"vote": params
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
// 如果是校本投票 则需要进一步确定发布对象是教研组还是学生名单
|
|
|
if (isSchool && this.$refs.classSelectRef.targetType === 'research') {
|
|
|
params.tchLists = this.voteForm.classes
|
|
@@ -405,7 +418,7 @@
|
|
|
params.targetType = 'student'
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
let finalParams = this.isAreaVote ? areaParams : params
|
|
|
console.log('提交的投票对象', finalParams)
|
|
|
/* 保存BLOB以及COSMOS */
|
|
@@ -426,7 +439,7 @@
|
|
|
this.$Message.error(this.$t('vote.form.noOptionTip'))
|
|
|
} else if (!hasTargets) {
|
|
|
this.$Message.error(this.$t('vote.form.ruleClasses'))
|
|
|
- } else if(!this.getSimpleText(this.voteForm.description)){
|
|
|
+ } else if (!this.getSimpleText(this.voteForm.description)) {
|
|
|
this.$Message.error(this.$t('homework.noDes'))
|
|
|
} else {
|
|
|
this.$Message.error(this.$t('vote.form.noCompleteTip'))
|
|
@@ -605,17 +618,19 @@
|
|
|
console.log('需要渲染的投票对象', item)
|
|
|
// await this.findResearchList()
|
|
|
// 如果是区级投票
|
|
|
- if(this.isAreaVote){
|
|
|
+ if (this.isAreaVote) {
|
|
|
this.classNameArr = item.targets.map(i => {
|
|
|
return {
|
|
|
- name:i
|
|
|
+ name: i
|
|
|
}
|
|
|
})
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (item.targetType === 'research') {
|
|
|
- if(item.tchLists.includes('TeacherAll')){
|
|
|
- this.classNameArr = [{ name:this.$t('vote.allTeacher') }]
|
|
|
- }else{
|
|
|
+ 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)
|
|
@@ -630,10 +645,10 @@
|
|
|
.stuLists.length ? await this.getClassNameByIds(item.stuLists) : []
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
console.log(this.classNameArr);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
this.classType = item.classes.length ? 'school' : 'private'
|
|
|
this.classTargets = item.targetType === 'research' ? item.tchLists : this.getCurScope === 'school' ?
|
|
|
item.classes : item.targets
|
|
@@ -689,7 +704,7 @@
|
|
|
},
|
|
|
/* 查找学校检验组信息 */
|
|
|
findResearchList() {
|
|
|
- return new Promise((r,j) => {
|
|
|
+ return new Promise((r, j) => {
|
|
|
this.$api.common.getActivityTarget({
|
|
|
tmdid: this.$store.state.userInfo.TEAMModelId,
|
|
|
schoolId: this.$store.state.userInfo.schoolCode,
|
|
@@ -699,7 +714,7 @@
|
|
|
r(200)
|
|
|
})
|
|
|
})
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
},
|
|
|
mounted() {
|