Sfoglia il codice sorgente

app2.0 掌上评教 完成

新疆影视学院高职
杨晓琪 2 anni fa
parent
commit
e0c9f81c28
2 ha cambiato i file con 194 aggiunte e 111 eliminazioni
  1. +14
    -4
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EvaluationTeach/list.vue
  2. +180
    -107
      Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EvaluationTeach/single.vue

+ 14
- 4
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EvaluationTeach/list.vue Vedi File

@@ -3,13 +3,14 @@
<!-- 主列表页 -->
<view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
<!-- 顶部条目/分页信息栏 -->
<l-customlist-banner @buttonClick="sideOpen = true">{{ tips }}</l-customlist-banner>
<!-- @buttonClick="sideOpen = true" -->
<l-customlist-banner>{{ tips }}</l-customlist-banner>
<!-- 滚动列表,跨端支持上拉/下拉 -->
<l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
<l-customlist :tips="loadState" showTips>
<!-- 单条记录 -->
<view class="customlist-item" v-for="item of list" :key="item.VID">
<view class="customlist-item" v-for="(item,index) of list" :key="index+item.VID+item.EmpName">
<view class="customlist-item-field">
<text class="customlist-item-field-title">学年:</text>
@@ -126,6 +127,13 @@ export default {
async onLoad() {
await this.init()
},
async onShow() {
if(this.ready){
this.ready = false
await this.refreshList()
this.ready = true
}
},
onUnload() {
this.OFF('EducationalAdministrationJournalSend-list-change')
},
@@ -207,9 +215,11 @@ export default {
// 点击「编辑」、「查看」、「添加」、「删除」按钮
async action(type, item) {
if (item.UID != undefined && item.UID !== '') {
this.TOAST('当前项已评价!');
if (item.UID) {
this.TOAST('当前项已评价!')
return
}
this.NAV_TO(`./single?type=view&id=${item.VID}&EmpNo=${item.EmpNo}&LessonNo=${item.LessonNo}`)
},
// 显示列表中的标题项


+ 180
- 107
Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/EvaluationTeach/single.vue Vedi File

@@ -1,47 +1,67 @@
<template>
<view class="page">
<view v-if="ready">
<l-input
@input="setValue('JournalSend.JTitle', $event)"
:value="getValue('JournalSend.JTitle')"
:disabled="!edit"
title="上课是否迟到"
/>
<l-select
@input="setValue('JournalSend.JTypeId', $event)"
:value="getValue('JournalSend.JTypeId')"
:disabled="!edit"
:range="dataSource.JournalSend.JTypeId"
title="是否拖堂"
/>
<l-organize-picker
@input="setValue('JournalSend.JReceiveId', $event)"
:value="getValue('JournalSend.JReceiveId')"
:readonly="!edit"
type="user"
title="作业量是否合理"
/>
<l-textarea
@input="setValue('JournalSend.JContent', $event)"
:value="getValue('JournalSend.JContent')"
:readonly="!edit"
title="对老师还有什么建议"
/>
</view>
<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
<l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
<view v-if="ready">
<view class="paper-title">
{{formData.VTitle}}
<view class="paper-time">
{{formData.VStartTime}}
-
{{formData.VStopTime}}
</view>
</view>
<view v-for="(item,index) in formData.Eval_Questions" :key="item.QID">
<view class="questionTitle">
<text style="color: red;">{{item.QMust?"* ":""}}</text>
{{item.QTitle}}
</view>
<!-- 单选 -->
<l-select
v-if="item.QType == 1"
v-model="item.IID"
@change="(e)=>{checkBoxGroupChange(item.QID,e)}"
:range="item.Eval_QuestionItems"
title=""
placeholder="请选择"
:disabled="false"
textField="ITitle"
valueField="IID"
/>
<!-- 多选 -->
<view v-if="item.QType == 2">
<checkbox-group v-model="item.checked" @change="(e)=>{checkBoxGroupChange(item.QID,e.detail.value)}">
<view v-for="item1 in item.Eval_QuestionItems" :key="item1.IID">
<l-checkbox :title="item1.ITitle" v-model="item1.isChecked" :checkboxValue="item1.IID.toString()" />
<l-textarea
simpleMode
v-if="item1.QShowText&&
checkBoxs[item.QID]&&
checkBoxs[item.QID].includes(item1.IID)"
v-model="uTexts[item1.IID]"
style="margin-top: 6px;"
placeholder="请输入"
/>
</view>
</checkbox-group>
</view>
<!-- 填空 -->
<l-textarea v-if="item.QType == 3" v-model="item.QContent" placeholder="请输入" />
<!-- 校验提示 -->
<view v-if="validate[item.QID]" style="color: red;font-size: 12px;margin-bottom: 4px;padding-left: 12px;">
{{validate[item.QID]}}
</view>
</view>
<!-- <l-input v-model="text" disabled title="你说呢你说呢?"></l-input>
<radio-group>
<l-radio v-model="radioValue" title="单选框1" radioValue="1" />
<l-radio v-model="radioValue" title="单选框2" radioValue="2" />
</radio-group> -->
</view>
<view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
<l-button v-if="edit" @click="action('save')" size="lg" style="background-color: #0C86D8;color: #fff;" class="block margin-top" block>
提交保存
</l-button>
<l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
编辑本页
</l-button>
<l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
取消编辑
</l-button>
<l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
删除
</l-button>
</l-button>
</view>
</view>
</template>
@@ -74,57 +94,37 @@ export default {
mixins: [customPageMixins],
data() {
return {
return {
aa:"",
bbb:[],
// 页面相关参数
id: null,
mode: null,
edit: null,
ready: false,
// 表单数据
current: {},
origin: {},
// 表单项数据结构
scheme: {
JournalSend: {
JTitle: { type: 'text' },
JTypeId: { type: 'select' },
JReceiveId: { type: 'organize'},
JContent: { type: 'textarea' },
},
},
// 数据源
dataSource: {
JournalSend: {
JTypeId: [],
},
}
}
},
async onLoad({ type, id }) {
await this.init(type, id)
ready: false,
formData:{
Eval_Questions:[]
},
submitParams:null,
uTexts:{},
checkBoxs:{},
validate:{},
}
},
async onLoad({ id,EmpNo,LessonNo }) {
this.submitParams = {EmpNo,LessonNo}
await this.init(id)
},
methods: {
checkBoxGroupChange(id,value){
this.checkBoxs[id] = value
},
// 页面初始化
async init(type, id) {
this.LOADING('加载数据中...')
this.id = id
this.mode = type
this.edit = ['create', 'edit'].includes(this.mode)
// 拉取表单数据,同时拉取所有来自数据源的选单数据
await Promise.all([
() => {}
])
async init( id ) {
this.LOADING('加载数据中...')
this.id = id
await this.fetchForm()
this.ready = true
@@ -132,15 +132,18 @@ export default {
},
// 加载表单数据
async fetchForm() {
if (this.mode === 'create') {
this.origin = await this.getDefaultForm()
} else {
const result = await this.HTTP_GET('learun/adms/eval/paper', {VID:this.id})
this.origin = await this.formatFormData(result)
console.log(result,"result")
}
this.current = this.COPY(this.origin)
async fetchForm() {
return this.HTTP_GET('learun/adms/eval/paper', {VID:this.id}, '加载数据时出错').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
if(success){
this.edit = true
}
this.formData = success
})
},
// 点击 「编辑」、「重置」、「保存」、「删除」 按钮
@@ -156,29 +159,78 @@ export default {
break
case 'save':
const verifyResult = this.verifyForm()
if (verifyResult.length > 0) {
this.CONFIRM('表单验证失败', verifyResult.join('\n'))
return
}
if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
return
}
this.LOADING('正在提交...')
const postData = await this.getPostData(this.id)
this.LOADING('正在提交...')
let postarray = []
this.formData.Eval_Questions.map(item=>{
let validate = {}
switch (item.QType){
case 1:
if(item.QMust){
validate[item.QID] = this.checkBoxs[item.QID]?'':'此项必填!'
}
this.validate = {...this.validate,...validate}
postarray.push({
QID:item.QID,
IID:this.checkBoxs[item.QID]?this.checkBoxs[item.QID].toString():'',
UText:item.UText||'',
})
break;
case 2:
if(item.QMust){
validate[item.QID] = (this.checkBoxs[item.QID]&&this.checkBoxs[item.QID].length)?'':"此项必填!"
this.validate = {...this.validate,...validate}
}
if(this.checkBoxs[item.QID]&&this.checkBoxs[item.QID].length){
this.checkBoxs[item.QID].map(t=>{
postarray.push({
QID:item.QID,
IID:t,
UText:this.uTexts[t]||'',
})
})
}
break;
case 3:
if(item.QMust){
validate[item.QID] = item.QContent?'':"此项必填"
this.validate = {...this.validate,...validate}
}
if(this.checkBoxs[item.QID]&&this.checkBoxs[item.QID].length){
this.checkBoxs[item.QID].map(t=>{
postarray.push({
QID:item.QID,
IID:'',
QContent:item.QContent||'',
})
})
}
break;
}
})
let validataArr = Object.values(this.validate)
if(validataArr.some(t=>t)){
this.TOAST("请完善表单信息!")
return
}
const postData = {
VID:this.formData.VID,
...this.submitParams,
postarray
}
console.log(postData)
this.HTTP_POST('learun/adms/EducationalAdministration/Journal/save', postData, '表单提交保存失败').then(success => {
this.HIDE_LOADING()
if (!success) {
return
}
this.EMIT('EducationalAdministrationJournalSend-list-change')
this.NAV_BACK()
this.TOAST('提交保存成功')
})
this.NAV_BACK()
this.TOAST('提交保存成功')
})
break
case 'delete':
@@ -214,4 +266,25 @@ export default {
}
}
}
</script>
</script>
<style scoped lang="scss">
.paper-title{
font-size: 20px;
color: #000;
text-align: center;
margin: 16px 0;
}
.paper-time{
color: #606266;
font-size: 12px;
text-align: center;
}
.questionTitle{
line-height: 18px;
background-color: #fff;
color: #000;
margin-top: 8px;
margin-bottom: 1px;
padding: 16px 12px;
}
</style>

Caricamento…
Annulla
Salva