|
- <template>
- <view class="page">
- <view v-if="ready">
- <uploadImage @input="setValue('AttendanceCard.ADPhoto', $event)" :accept="['camera']" :value="getValue('AttendanceCard.ADPhoto')"
- :readonly="!edit" :number="1" title="照片上传" required/>
- <l-textarea @input="setValue('AttendanceCard.ARemark', $event)" :value="getValue('AttendanceCard.ARemark')"
- :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>
- 外勤打卡
- </l-button>
- </view>
- </view>
- </template>
-
-
- <script>
- /*
- * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
- * Copyright (c) 2013-2020 上海力软信息技术有限公司
- * 创建人:超级管理员
- * 日 期:2020-10-21 10:28
- * 描 述:听课记录
- */
-
- /**
- * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
- * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
- * { "path": "pages/LogisticsManagement/AttendanceCard/single", "style": { "navigationBarTitleText": "表单详情页" } }
- *
- * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
- * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
- */
-
- import get from 'lodash/get'
- import set from 'lodash/set'
- import moment from 'moment'
- import customPageMixins from '@/common/custompage.js'
- import uploadImage from '@/components/uploadImage.vue'
-
- export default {
- mixins: [customPageMixins],
- components:{
- uploadImage
- },
-
- data() {
- return {
- // 页面相关参数
- edit:true,
- mode:null,
- ready: false,
- id:null,
- params:{},
-
- // 表单数据
- current: {},
- origin: {},
-
- // 表单项数据结构
- scheme: {
- AttendanceCard: {
- ADPhoto: {
- type: 'upload_old',
- title: '图片',
- verify:'NotNull'
- },
- ARemark: {
- type: 'textarea',
- title: '备注'
- },
- },
-
- },
-
- // 数据源
- dataSource: {
- AttendanceCard: {},
- }
- }
- },
-
- async onLoad({
- type,
- id
- }) {
- await this.init(type, id)
- },
-
- methods: {
- // 页面初始化
- async init(type, id) {
- this.LOADING('加载数据中...')
- this.params = this.GET_PARAM()
-
- // 拉取表单数据,同时拉取所有来自数据源的选单数据
- await Promise.all([
- () => {}
- ])
- await this.fetchForm()
-
- this.ready = true
- this.HIDE_LOADING()
- },
-
- // 加载表单数据
- async fetchForm() {
- this.origin = await this.getDefaultForm()
- this.current = this.COPY(this.origin)
- },
-
- // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
- async action(type) {
- switch (type) {
- 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)
- console.log(postData)
- let strEntity = JSON.parse(postData.strEntity)
- let strEntity_ = {...strEntity,...this.params}
- this.HTTP_POST('learun/adms/attendance/clockinStudent', JSON.stringify(strEntity_), '打卡失败').then(success => {
- this.HIDE_LOADING()
- if (!success) {
- this.TOAST('打卡失败')
- return
- }
- this.TOAST('打卡成功', 'success')
- setTimeout(()=>{
- this.NAV_BACK(2)
- }, 500)
- })
- break
-
- default:
- break
- }
- },
-
- // 获取表单值
- getValue(path) {
- return get(this.current, path)
- },
-
- // 设置表单值
- setValue(path, val) {
- set(this.current, path, val)
- },
- }
- }
- </script>
|