Commit 149a0ffe authored by zhengke's avatar zhengke

1

parent 5138f4e2
<style> <style scoped>
.time-select { .wenjuan_Shuru{
z-index: 9999 !important; position:relative;
}
.SurverDel{
position:absolute;
right:-5px;
top:-5px;
} }
</style> </style>
<template> <template>
<q-dialog v-model="persistent" content-class="bg-grey-1" persistent transition-show="scale" transition-hide="scale"> <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 style="width: 800px;max-width:900px;">
<q-card-section> <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>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh"> <q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap"> <div class="row wrap">
<q-input filled v-model="objOption.ClassDate" class="col-6 q-pr-lg q-pb-lg" <q-input filled v-model="addMsg.Title" class="col-6 q-pr-lg q-pb-lg" :rules="[val => !!val || '请填写标题']"
:rules="[val => !!val || '请选择预约日期']" ref="ClassDate" mask="date" label="预约日期"> ref="Title" 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> </q-input>
<div class="Sysuser_Date col-6 q-pb-lg"> <q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.SurveyType"
<q-field> :options="platList" label="类型" ref="SurveyType" @input="getPlat()" :rules="[val => !!val || '请选择类型']" class="col-6 q-pb-lg" emit-value map-options />
<template v-slot:control> <q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.FormType"
<el-time-select v-model="objOption.ClassTime" ref="ClassTime" style="width:50%" :picker-options="{ :options="FormTypeList" label="问卷类型" ref="FormType" :rules="[val => !!val || '请选择问卷类型']" class="col-6 q-pb-lg q-pr-lg" emit-value map-options />
start: '09:00', <q-input filled v-model="addMsg.Sort" class="col-6 q-pb-lg" ref="Sort" label="排序" :rules="[val => !!val || '请填写排序']"></q-input>
step: '00:15', <q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.IsShow"
end: '21:00', :options="ShowList" label="是否显示" ref="IsShow" class="col-6 q-pb-lg q-pr-lg" emit-value map-options />
maxTime:objOption.EndTime <q-select filled stack-label option-value="Id" option-label="Name" v-model="addMsg.IsRequired"
}" placeholder="预约开始时间"> :options="requireList" label="是否必填" ref="IsRequired" class="col-6 q-pb-lg" emit-value map-options />
</el-time-select> <template v-if="addMsg.SurveyType==2||addMsg.SurveyType==3">
<el-time-select v-model="objOption.EndTime" ref="EndTime" style="width:50%" :picker-options="{ <div v-for="(item,index) in addMsg.SurveyOptionsList" class="row wrap wenjuan_Shuru" style="width:100%" :key="index">
start: '09:00', <q-input filled v-model="item.OptionsName" class="col-6 q-pb-lg q-pr-lg" :label="'选项'+(index+1)"> </q-input>
step: '00:15', <q-input filled v-model="item.Sort" @keyup.native="checkInteger(item,'Sort')" class="col-6 q-pb-lg" label="排序"> </q-input>
end: '21:00', <q-btn size="8px" class="SurverDel" @click="deleteSurveyType(index)" round color="red"
minTime:objOption.ClassTime icon="iconfont icon-guanbi1" />
}" placeholder="预约结束时间"> </div>
</el-time-select> <div style="text-align:right;width:100%;">
</template> <q-btn label="新增" color="accent q-px-md" style="font-weight:400 !important" @click="addSurver" />
</q-field> </div>
</div> </template>
<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 />
</div> </div>
</q-card-section> </q-card-section>
<q-separator /> <q-separator />
<q-card-actions align="right" class="bg-white"> <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="取消" 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" <q-btn label="立即提交" color="accent q-px-md" style="font-weight:400 !important" :loading="saveLoading"
@click="saveCategory" /> @click="saveActive" />
</q-card-actions> </q-card-actions>
</q-card> </q-card>
</q-dialog> </q-dialog>
</template> </template>
<script> <script>
import {
getTeacherDropDownList,
queryClassRoomList,
GetTrialLessonList
} from "../../api/school/index";
import {
GetReserveClass,
SetReserveClass
} from '../../api/scheduling/schedu'
export default { export default {
props: { props: {
saveObj: { saveObj: {
type: Object, type: Object,
default: null default: null
},
ID: {
type: String,
default: null
} }
}, },
data() { data() {
return { return {
persistent: true, persistent: true,
objOption: { addMsg:{
ReserveClassId: 0, ID:0,
TeacherId: "", SurveyType:'',
ClassDate: "", Title:'',
ClassTime: "", Sort:'',
EndTime: "", IsShow:0,
ClassRoomId: "", FormType:'',
ClassContent: '', ActivitySurveyId:0,
TrialLessonId: '' SurveyOptionsList:[],
IsRequired:0
}, },
saveLoading: false, platList: [],
TeacherList: [], dateList: [],
ClassRoomList: [], FormTypeList: [],
ContentList: [{ ShowList:[{
Id: 1, Id:0,
Name: '少儿类:主要以丰富可与时间和兴趣为主,要求课堂轻松活跃。趣味性十足' Name:'是'
}, { },{
Id: 2, Id:1,
Name: '兴趣类:成年人,对日语学习从兴趣开始,要求课堂丰富有趣' Name:'否'
}, { }],
Id: 3, requireList:[{
Name: '实用类:对于日语学习有一定的需求(考研、就业等),要求学习过程专业,干货多' Id:0,
}, { Name:'不必填'
Id: 4, },{
Name: '留学类:打算去往日本留学(本科、硕士、语言学校、私塾等)' Id:1,
Name:'必填'
}], }],
TrialList: [] //试听课程下拉数据 saveLoading: false,
} }
}, },
mounted() { mounted() {
let nowDay = new Date(); this.GetSurveyTypeEnumList();
var year = nowDay.getFullYear(); //年 this.GetFormTypeEnumEnumList();
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.initObj() this.initObj()
}, },
methods: { methods: {
GetTrialDrop() {
GetTrialLessonList({}).then(res => {
if (res.Code == 1) {
this.TrialList = res.Data;
}
});
},
//初始化表单 //初始化表单
initObj() { initObj() {
if (this.saveObj && this.saveObj.ReserveClassId > 0) { if (this.saveObj && this.saveObj.ID > 0) {
GetReserveClass({ this.apipostDS("/api/Survey/GetSurvey", {
ReserveClassId: this.saveObj.ReserveClassId SurveyID:this.saveObj.ID
}).then(res => { }, res => {
if (res.Code == 1) { this.addMsg = res.data.data;
this.objOption.ReserveClassId = res.Data.ReserveClassId; this.addMsg.SurveyType = this.addMsg.SurveyType.toString()
this.objOption.TeacherId = res.Data.TeacherId; this.addMsg.FormType = this.addMsg.FormType.toString()
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 = "";
}
}) })
}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 @@ ...@@ -173,88 +129,79 @@
this.$emit('close') this.$emit('close')
this.persistent = false this.persistent = false
}, },
//保存菜单 GetSurveyTypeEnumList(){
saveCategory() { this.apipostDS("/api/Survey/GetSurveyTypeEnumList", {}, res => {
if(this.objOption.ClassDate==''){ if(res.data.resultCode==1){
this.$q.notify({ this.platList = res.data.data
type: 'negative', }else {
position: "top", this.$q.notify({
message: `请选择预约日期` type: 'negative',
}) position: "top",
return message: res.data.message
} })
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;
} }
}); })
}, },
//获取教室下拉 GetFormTypeEnumEnumList(){
getClassRoomList() { this.apipostDS("/api/Survey/GetFormTypeEnumEnumList", {}, res => {
queryClassRoomList({}).then(res => { if(res.data.resultCode==1){
if (res.Code == 1) { this.FormTypeList = res.data.data
this.ClassRoomList = res.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 @@ ...@@ -7,7 +7,7 @@
label="问卷调查名称" maxlength="20" /> label="问卷调查名称" maxlength="20" />
</div> </div>
<div class="col-3"> <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="类型" v-model="msg.SurveyType" ref="SurveyType" :options="platList" emit-value map-options label="类型"
:dense="false" /> :dense="false" />
</div> </div>
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
</q-td> </q-td>
</template> </template>
</q-table> </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>
</div> </div>
</template> </template>
...@@ -145,6 +145,9 @@ ...@@ -145,6 +145,9 @@
created() { created() {
}, },
mounted() { mounted() {
if(this.$route.query&&this.$route.query.ID){
this.msg.ActivitySurveyId = this.$route.query.ID;
}
this.getPlat(); this.getPlat();
this.getList(); this.getList();
}, },
...@@ -179,12 +182,53 @@ ...@@ -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(){ closeSaveForm(){
this.isShowWenjuan=false; 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