您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 
 

162 行
4.0 KiB

  1. <template>
  2. <view class="page">
  3. <view v-if="ready">
  4. <uploadImage @input="setValue('AttendanceCard.ADPhoto', $event)" :accept="['camera']" :value="getValue('AttendanceCard.ADPhoto')"
  5. :readonly="!edit" :number="1" title="照片上传" required/>
  6. <l-textarea @input="setValue('AttendanceCard.ARemark', $event)" :value="getValue('AttendanceCard.ARemark')"
  7. :readonly="!edit" title="备注" />
  8. </view>
  9. <view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
  10. <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
  11. 外勤打卡
  12. </l-button>
  13. </view>
  14. </view>
  15. </template>
  16. <script>
  17. /*
  18. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  19. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  20. * 创建人:超级管理员
  21. * 日 期:2020-10-21 10:28
  22. * 描 述:听课记录
  23. */
  24. /**
  25. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  26. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  27. * { "path": "pages/LogisticsManagement/AttendanceCard/single", "style": { "navigationBarTitleText": "表单详情页" } }
  28. *
  29. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  30. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  31. */
  32. import get from 'lodash/get'
  33. import set from 'lodash/set'
  34. import moment from 'moment'
  35. import customPageMixins from '@/common/custompage.js'
  36. import uploadImage from '@/components/uploadImage.vue'
  37. export default {
  38. mixins: [customPageMixins],
  39. components:{
  40. uploadImage
  41. },
  42. data() {
  43. return {
  44. // 页面相关参数
  45. edit:true,
  46. mode:null,
  47. ready: false,
  48. id:null,
  49. params:{},
  50. // 表单数据
  51. current: {},
  52. origin: {},
  53. // 表单项数据结构
  54. scheme: {
  55. AttendanceCard: {
  56. ADPhoto: {
  57. type: 'upload_old',
  58. title: '图片',
  59. verify:'NotNull'
  60. },
  61. ARemark: {
  62. type: 'textarea',
  63. title: '备注'
  64. },
  65. },
  66. },
  67. // 数据源
  68. dataSource: {
  69. AttendanceCard: {},
  70. }
  71. }
  72. },
  73. async onLoad({
  74. type,
  75. id
  76. }) {
  77. await this.init(type, id)
  78. },
  79. methods: {
  80. // 页面初始化
  81. async init(type, id) {
  82. this.LOADING('加载数据中...')
  83. this.params = this.GET_PARAM()
  84. // 拉取表单数据,同时拉取所有来自数据源的选单数据
  85. await Promise.all([
  86. () => {}
  87. ])
  88. await this.fetchForm()
  89. this.ready = true
  90. this.HIDE_LOADING()
  91. },
  92. // 加载表单数据
  93. async fetchForm() {
  94. this.origin = await this.getDefaultForm()
  95. this.current = this.COPY(this.origin)
  96. },
  97. // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
  98. async action(type) {
  99. switch (type) {
  100. case 'save':
  101. const verifyResult = this.verifyForm()
  102. if (verifyResult.length > 0) {
  103. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  104. return
  105. }
  106. if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
  107. return
  108. }
  109. this.LOADING('正在提交...')
  110. const postData = await this.getPostData(this.id)
  111. console.log(postData)
  112. let strEntity = JSON.parse(postData.strEntity)
  113. let strEntity_ = {...strEntity,...this.params}
  114. this.HTTP_POST('learun/adms/attendance/clockinStudent', JSON.stringify(strEntity_), '打卡失败').then(success => {
  115. this.HIDE_LOADING()
  116. if (!success) {
  117. this.TOAST('打卡失败')
  118. return
  119. }
  120. this.TOAST('打卡成功', 'success')
  121. setTimeout(()=>{
  122. this.NAV_BACK(2)
  123. }, 500)
  124. })
  125. break
  126. default:
  127. break
  128. }
  129. },
  130. // 获取表单值
  131. getValue(path) {
  132. return get(this.current, path)
  133. },
  134. // 设置表单值
  135. setValue(path, val) {
  136. set(this.current, path, val)
  137. },
  138. }
  139. }
  140. </script>