|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209 |
- <template>
- <view class="page">
- <view v-if="ready">
- <!-- <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 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="aa"
- :range="item.Eval_QuestionItems"
- title=""
- placeholder="请选择"
- :disabled="false"
- textField="ITitle"
- valueField="IID"
- />
- <!-- 多选 -->
- <!-- <l-checkbox
- v-if="item.QTypeString == 1"
- v-model="aa"
- @change="searchChange"
- :range="item.Eval_QuestionItems"
- title=""
- placeholder="请选择"
- :disabled="false"
- textField="ITitle"
- valueField="IID"
- /> -->
- <checkbox-group v-if="item.QType == 1">
- <l-checkbox v-for="item1 in item.Eval_QuestionItems" :key="item1.IID" v-model="bbb" :title="item1.ITitle" :checkboxValue="item1.IID.toString()" />
- </checkbox-group>
- <!-- 填空 -->
- <l-textarea v-if="item.QType == 1" v-model="aa" placeholder="请输入" />
- </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>
- </view>
- </view>
- </template>
-
-
- <script>
-
- import get from 'lodash/get'
- import set from 'lodash/set'
- import moment from 'moment'
- import customPageMixins from '@/common/custompage.js'
-
- export default {
- mixins: [customPageMixins],
-
- data() {
- return {
- aa:"",
- bbb:[],
- // 页面相关参数
- id: null,
- edit: null,
- ready: false,
- formData:{},
- submitParams:null
- }
- },
-
- async onLoad({ id,EmpNo,LessonNo }) {
- this.submitParams = {EmpNo,LessonNo}
- await this.init(id)
- },
-
- methods: {
- aaa(){
- console.log(this.bbb,this)
- },
- // 页面初始化
- async init( id ) {
- this.LOADING('加载数据中...')
- this.id = id
- await this.fetchForm()
- this.ready = true
- this.HIDE_LOADING()
- },
-
- // 加载表单数据
- 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
- }
- console.log(success)
- this.formData = success
- })
-
- },
-
- // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
- async action(type) {
- switch (type) {
- case 'edit':
- this.edit = true
- break
-
- case 'reset':
- this.current = this.COPY(this.origin)
- this.edit = false
- 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('正在提交...')
- let postarray = this.formData.Eval_Questions.map(item=>{
- return {
- QID:item.QID,
- IID:item.IID.toString(),
- UText:item.UText,
- }
- })
- const postData = {
- VID:this.formData.VID,
- ...this.submitParams,
- postarray
- }
- this.HTTP_POST('learun/adms/EducationalAdministration/Journal/save', postData, '表单提交保存失败').then(success => {
- this.HIDE_LOADING()
- if (!success) {
- return
- }
- this.NAV_BACK()
- this.TOAST('提交保存成功')
- })
- break
-
- case 'delete':
- if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
- return
- }
-
- this.LOADING('提交删除中...')
- this.HTTP_POST('learun/adms/EducationalAdministration/Journal/delete', this.id, '删除失败').then(success => {
- this.HIDE_LOADING()
- if (!success) {
- return
- }
-
- this.EMIT('EducationalAdministrationJournalSend-list-change')
- this.NAV_BACK()
- this.this.TOAST('删除成功', 'success')
- })
- break
-
- default: break
- }
- },
-
- // 获取表单值
- getValue(path) {
- return get(this.current, path)
- },
-
- // 设置表单值
- setValue(path, val) {
- set(this.current, path, val)
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .questionTitle{
- line-height: 18px;
- background-color: #fff;
- color: #000;
- margin-top: 8px;
- margin-bottom: 1px;
- padding: 16px 12px;
- }
- :deep(.cu-form-group){
- display: none;
- }
- </style>
|