Commit 149a0ffe authored by zhengke's avatar zhengke

1

parent 5138f4e2
<style>
.time-select {
z-index: 9999 !important;
<style scoped>
.wenjuan_Shuru{
position:relative;
}
.SurverDel{
position:absolute;
right:-5px;
top:-5px;
}
</style>
<template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:900px;">
<q-card-section>
<div class="text-h6">{{objOption.ReserveClassId==0?'新增试听课程':'修改试听课程'}}</div>
<div class="text-h6">{{addMsg.ID==0?'新增问卷调查':'修改问卷调查'}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<q-input filled v-model="objOption.ClassDate" class="col-6 q-pr-lg q-pb-lg"
:rules="[val => !!val || '请选择预约日期']" ref="ClassDate" mask="date" label="预约日期">
<template v-slot:append>
<q-icon name="event" class="cursor-pointer">
<q-popup-proxy ref="qDateProxy1" transition-show="scale" transition-hide="scale">
<q-date v-model="objOption.ClassDate" @input="() => $refs.qDateProxy1.hide()" />
</q-popup-proxy>
</q-icon>
</template>
<q-input filled v-model="addMsg.Title" class="col-6 q-pr-lg q-pb-lg" :rules="[val => !!val || '请填写标题']"
ref="Title" label="标题">
</q-input>
<div class="Sysuser_Date col-6 q-pb-lg">
<q-field>
<template v-slot:control>
<el-time-select v-model="objOption.ClassTime" ref="ClassTime" style="width:50%" :picker-options="{
start: '09:00',
step: '00:15',
end: '21:00',
maxTime:objOption.EndTime
}" placeholder="预约开始时间">
</el-time-select>
<el-time-select v-model="objOption.EndTime" ref="EndTime" style="width:50%" :picker-options="{
start: '09:00',
step: '00:15',
end: '21:00',
minTime:objOption.ClassTime
}" placeholder="预约结束时间">
</el-time-select>
</template>
</q-field>
</div>
<q-select filled stack-label option-value="TId" option-label="TeacherName" v-model="objOption.TeacherId"
ref="TeacherId" :options="TeacherList" label="选择教师" :dense="false" class="col-6 q-pr-lg q-pb-lg" emit-value
map-options />
<q-select filled stack-label option-value="RoomId" option-label="RoomName" v-model="objOption.ClassRoomId"
ref="ClassRoomId" :options="ClassRoomList" label="关联教室" :dense="false" class="col-6 q-pb-lg" emit-value
map-options />
<q-select filled stack-label option-value="Id" option-label="LessonName" v-model="objOption.TrialLessonId"
:options="TrialList" label="试听课程" :dense="false" class="col-6 q-pb-lg q-pr-lg" emit-value map-options />
<q-select filled stack-label option-value="Name" option-label="Name" v-model="objOption.ClassContent"
ref="ClassContent" :options="ContentList" label="主讲内容" :dense="false" class="col-12 q-pb-lg" emit-value
map-options />
<q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.SurveyType"
:options="platList" label="类型" ref="SurveyType" @input="getPlat()" :rules="[val => !!val || '请选择类型']" class="col-6 q-pb-lg" emit-value map-options />
<q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.FormType"
:options="FormTypeList" label="问卷类型" ref="FormType" :rules="[val => !!val || '请选择问卷类型']" class="col-6 q-pb-lg q-pr-lg" emit-value map-options />
<q-input filled v-model="addMsg.Sort" class="col-6 q-pb-lg" ref="Sort" label="排序" :rules="[val => !!val || '请填写排序']"></q-input>
<q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.IsShow"
:options="ShowList" label="是否显示" ref="IsShow" class="col-6 q-pb-lg q-pr-lg" emit-value map-options />
<q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.IsRequired"
:options="requireList" label="是否必填" ref="IsRequired" class="col-6 q-pb-lg" emit-value map-options />
<template v-if="addMsg.SurveyType==2||addMsg.SurveyType==3">
<div v-for="(item,index) in addMsg.SurveyOptionsList" class="row wrap wenjuan_Shuru" style="width:100%" :key="index">
<q-input filled v-model="item.OptionsName" class="col-6 q-pb-lg q-pr-lg" :label="'选项'+(index+1)"> </q-input>
<q-input filled v-model="item.Sort" @keyup.native="checkInteger(item,'Sort')" class="col-6 q-pb-lg" label="排序"> </q-input>
<q-btn size="8px" class="SurverDel" @click="deleteSurveyType(index)" round color="red"
icon="iconfont icon-guanbi1" />
</div>
<div style="text-align:right;width:100%;">
<q-btn label="新增" color="accent q-px-md" style="font-weight:400 !important" @click="addSurver" />
</div>
</template>
</div>
</q-card-section>
<q-separator />
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeSaveForm" />
<q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="saveCategory" />
@click="saveActive" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
getTeacherDropDownList,
queryClassRoomList,
GetTrialLessonList
} from "../../api/school/index";
import {
GetReserveClass,
SetReserveClass
} from '../../api/scheduling/schedu'
export default {
props: {
saveObj: {
type: Object,
default: null
},
ID: {
type: String,
default: null
}
},
data() {
return {
persistent: true,
objOption: {
ReserveClassId: 0,
TeacherId: "",
ClassDate: "",
ClassTime: "",
EndTime: "",
ClassRoomId: "",
ClassContent: '',
TrialLessonId: ''
addMsg:{
ID:0,
SurveyType:'',
Title:'',
Sort:'',
IsShow:0,
FormType:'',
ActivitySurveyId:0,
SurveyOptionsList:[],
IsRequired:0
},
saveLoading: false,
TeacherList: [],
ClassRoomList: [],
ContentList: [{
Id: 1,
Name: '少儿类:主要以丰富可与时间和兴趣为主,要求课堂轻松活跃。趣味性十足'
}, {
Id: 2,
Name: '兴趣类:成年人,对日语学习从兴趣开始,要求课堂丰富有趣'
}, {
Id: 3,
Name: '实用类:对于日语学习有一定的需求(考研、就业等),要求学习过程专业,干货多'
}, {
Id: 4,
Name: '留学类:打算去往日本留学(本科、硕士、语言学校、私塾等)'
platList: [],
dateList: [],
FormTypeList: [],
ShowList:[{
Id:0,
Name:'是'
},{
Id:1,
Name:'否'
}],
requireList:[{
Id:0,
Name:'不必填'
},{
Id:1,
Name:'必填'
}],
TrialList: [] //试听课程下拉数据
saveLoading: false,
}
},
mounted() {
let nowDay = new Date();
var year = nowDay.getFullYear(); //年
var month = nowDay.getMonth() + 1; //月
var day = nowDay.getDate(); //日
if (month < 10) {
month = '0' + month
}
this.objOption.ClassDate = year + '-' + month + '-' + day;
this.GetTeacherList();
this.getClassRoomList();
this.GetTrialDrop();
this.GetSurveyTypeEnumList();
this.GetFormTypeEnumEnumList();
this.initObj()
},
methods: {
GetTrialDrop() {
GetTrialLessonList({}).then(res => {
if (res.Code == 1) {
this.TrialList = res.Data;
}
});
},
//初始化表单
initObj() {
if (this.saveObj && this.saveObj.ReserveClassId > 0) {
GetReserveClass({
ReserveClassId: this.saveObj.ReserveClassId
}).then(res => {
if (res.Code == 1) {
this.objOption.ReserveClassId = res.Data.ReserveClassId;
this.objOption.TeacherId = res.Data.TeacherId;
this.objOption.ClassDate = res.Data.ClassDateStr;
this.objOption.ClassTime = res.Data.ClassTime;
this.objOption.EndTime = res.Data.EndTime;
this.objOption.ClassRoomId = res.Data.ClassRoomId;
this.objOption.TrialLessonId = res.Data.TrialLessonId;
this.objOption.ClassContent = res.Data.ClassContent;
} else {
let nowDay = new Date();
var year = nowDay.getFullYear(); //年
var month = nowDay.getMonth() + 1; //月
var day = nowDay.getDate(); //日
this.objOption.ClassDate = year + '-' + month + '-' + day;
this.objOption.TeacherId = '';
this.objOption.ClassTime = '';
this.objOption.EndTime = '';
this.objOption.ClassRoomId = '';
this.objOption.ClassContent = '';
this.objOption.TrialLessonId = "";
}
if (this.saveObj && this.saveObj.ID > 0) {
this.apipostDS("/api/Survey/GetSurvey", {
SurveyID:this.saveObj.ID
}, res => {
this.addMsg = res.data.data;
this.addMsg.SurveyType = this.addMsg.SurveyType.toString()
this.addMsg.FormType = this.addMsg.FormType.toString()
})
}else{
this.addMsg.ID = 0;
this.addMsg.SurveyType = ''
this.addMsg.Title = '';
this.addMsg.Sort = '';
this.addMsg.IsShow = 1;
this.addMsg.IsRequired = 1;
this.addMsg.FormType = '';
this.addMsg.ActivitySurveyId = this.ID;
this.addMsg.SurveyOptionsList = [];
}
},
//关闭弹窗
......@@ -173,88 +129,79 @@
this.$emit('close')
this.persistent = false
},
//保存菜单
saveCategory() {
if(this.objOption.ClassDate==''){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择预约日期`
})
return
}
if(this.objOption.ClassTime==''||this.objOption.ClassTime==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择预约开始时间`
})
return
}
if(this.objOption.EndTime==''||this.objOption.EndTime==null){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择预约结束时间`
})
return
}
if(this.objOption.TeacherId==''){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择教师`
})
return
}
if(this.objOption.ClassRoomId==''){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择关联教室`
})
return
}
if(this.objOption.TrialLessonId==''){
this.$q.notify({
type: 'negative',
position: "top",
message: `请选择试听课程`
})
return
}
this.saveLoading = true;
SetReserveClass(this.objOption).then(res => {
this.saveLoading = false
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit("success")
this.closeSaveForm()
}).catch(() => {
this.saveLoading = false
})
},
//获取教师下拉
GetTeacherList() {
getTeacherDropDownList({}).then(res => {
if (res.Code == 1) {
this.TeacherList = res.Data;
GetSurveyTypeEnumList(){
this.apipostDS("/api/Survey/GetSurveyTypeEnumList", {}, res => {
if(res.data.resultCode==1){
this.platList = res.data.data
}else {
this.$q.notify({
type: 'negative',
position: "top",
message: res.data.message
})
}
});
})
},
//获取教室下拉
getClassRoomList() {
queryClassRoomList({}).then(res => {
if (res.Code == 1) {
this.ClassRoomList = res.Data;
GetFormTypeEnumEnumList(){
this.apipostDS("/api/Survey/GetFormTypeEnumEnumList", {}, res => {
if(res.data.resultCode==1){
this.FormTypeList = res.data.data
}else {
this.$q.notify({
type: 'negative',
position: "top",
message: res.data.message
})
}
})
},
//选择类型
getPlat(){
if(this.addMsg.SurveyType==2 || this.addMsg.SurveyType==3){
this.addMsg.SurveyOptionsList= [
{ID:0,SurveyID:0,OptionsName:'',Sort:0,}
]
}else {
this.addMsg.SurveyOptionsList=[]
};
},
//新增
addSurver(){
this.addMsg.SurveyOptionsList.push({ID:0,SurveyID:0,OptionsName:'',Sort:0,})
},
//删除
deleteSurveyType(index){
this.addMsg.SurveyOptionsList.splice(index,1);
},
//保存数据
saveActive() {
this.$refs.Title.validate();
this.$refs.SurveyType.validate();
this.$refs.FormType.validate();
this.$refs.Sort.validate();
if (!this.$refs.Title.hasError&&!this.$refs.SurveyType.hasError&&!this.$refs.FormType.hasError&&!this.$refs.Sort.hasError) {
this.apipostDS("/api/Survey/SetSurvey", this.addMsg, res => {
if (res.data.resultCode == 1) {
this.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据保存成功!',
position: 'top'
})
this.$emit('close');
this.$emit('success');
} else {
this.$q.notify({
type: 'negative',
position: "top",
message: res.data.message
})
}
})
}
}
}
}
</script>
\ No newline at end of file
</script>
......@@ -7,7 +7,7 @@
label="问卷调查名称" maxlength="20" />
</div>
<div class="col-3">
<q-select @input="resetSearch" clearable filled stack-label option-value="Id" option-label="Name"
<q-select @input="resetSearch" filled stack-label option-value="Id" option-label="Name"
v-model="msg.SurveyType" ref="SurveyType" :options="platList" emit-value map-options label="类型"
:dense="false" />
</div>
......@@ -53,7 +53,7 @@
</q-td>
</template>
</q-table>
<wenjuan-form v-if="isShowWenjuan" :save-obj="objOption" @close="closeSaveForm" @success="resetSearch"></wenjuan-form>
<wenjuan-form v-if="isShowWenjuan" :save-obj="objOption" :ID="msg.ActivitySurveyId" @close="closeSaveForm" @success="resetSearch"></wenjuan-form>
</div>
</div>
</template>
......@@ -145,6 +145,9 @@
created() {
},
mounted() {
if(this.$route.query&&this.$route.query.ID){
this.msg.ActivitySurveyId = this.$route.query.ID;
}
this.getPlat();
this.getList();
},
......@@ -179,12 +182,53 @@
}
})
},
addObj(){
addObj(obj) {
if (obj) {
this.objOption = obj
} else {
this.objOption = null
}
this.isShowWenjuan = true;
},
//删除问卷
delQuestion(){
delQuestion(row){
let that = this;
this.$q.dialog({
title: "提示",
message: '是否删除该活动信息?',
cancel: {
label: "取消",
flat: true
},
ok: {
label: "确认",
flat: true,
focus: true
}
}).onOk(() => {
that.apipostDS(
"/api/Survey/DelSurvey",
{SurveyID:row.ID},
res => {
if (res.data.resultCode == 1) {
that.$q.notify({
icon: 'iconfont icon-chenggong',
color: 'accent',
timeout: 2000,
message: '数据删除成功!',
position: 'top'
})
that.getList();
} else {
that.$q.notify({
type: 'negative',
position: "top",
message: res.data.message
})
}
},
);
});
},
closeSaveForm(){
this.isShowWenjuan=false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment