You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

216 lines
6.1 KiB

  1. <template>
  2. <view class="page">
  3. <view v-if="ready">
  4. <l-input
  5. @input="setValue('SYS_ReceiveMessage.SENDER', $event)"
  6. :value="getValue('SYS_ReceiveMessage.SENDER')"
  7. :disabled="!edit"
  8. title="发件人"
  9. />
  10. <l-input
  11. @input="setValue('SYS_ReceiveMessage.TITLE', $event)"
  12. :value="getValue('SYS_ReceiveMessage.TITLE')"
  13. :disabled="!edit"
  14. title="主题"
  15. />
  16. <l-select
  17. @input="setValue('SYS_ReceiveMessage.READFLAG', $event)"
  18. :value="getValue('SYS_ReceiveMessage.READFLAG')"
  19. :disabled="!edit"
  20. :range="dataSource.SYS_ReceiveMessage.READFLAG"
  21. title="状态"
  22. />
  23. <l-date-picker
  24. @input="setValue('SYS_ReceiveMessage.SENDTIME', $event)"
  25. :value="getValue('SYS_ReceiveMessage.SENDTIME')"
  26. :disabled="!edit"
  27. title="收件时间"
  28. />
  29. <l-upload-file
  30. @input="setValue('SYS_ReceiveMessage.URL', $event)"
  31. :value="getValue('SYS_ReceiveMessage.URL')"
  32. :readonly="!edit"
  33. :number="9"
  34. title="附件上传"
  35. />
  36. <l-textarea
  37. @input="setValue('SYS_ReceiveMessage.CONTENTS', $event)"
  38. :value="getValue('SYS_ReceiveMessage.CONTENTS')"
  39. :readonly="!edit"
  40. title="邮件内容"
  41. />
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. /*
  47. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  48. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  49. * 创建人:超级管理员
  50. * 日 期:2020-10-19 17:58
  51. * 描 述:收件箱
  52. */
  53. /**
  54. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  55. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  56. * { "path": "pages/EducationalAdministration/SYS_ReceiveMessage/single", "style": { "navigationBarTitleText": "表单详情页" } }
  57. *
  58. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  59. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  60. */
  61. import get from 'lodash/get'
  62. import set from 'lodash/set'
  63. import moment from 'moment'
  64. import customPageMixins from '@/common/custompage.js'
  65. export default {
  66. mixins: [customPageMixins],
  67. data() {
  68. return {
  69. // 页面相关参数
  70. id: null,
  71. mode: null,
  72. edit: null,
  73. ready: false,
  74. // 表单数据
  75. current: {},
  76. origin: {},
  77. // 表单项数据结构
  78. scheme: {
  79. SYS_ReceiveMessage: {
  80. SENDER: { type: 'text', title: '发件人' },
  81. TITLE: { type: 'text', title: '主题' },
  82. READFLAG: { type: 'select', title: '状态', dataSource: '0' },
  83. SENDTIME: { type: 'datetime', title: '收件时间', dateformat: '0' },
  84. URL: { type: 'upload', title: '附件上传' },
  85. CONTENTS: { type: 'textarea', title: '邮件内容' },
  86. },
  87. },
  88. // 数据源
  89. dataSource: {
  90. SYS_ReceiveMessage: {
  91. READFLAG: [],
  92. },
  93. }
  94. }
  95. },
  96. async onLoad({ type, id }) {
  97. await this.init(type, id)
  98. },
  99. methods: {
  100. // 页面初始化
  101. async init(type, id) {
  102. this.LOADING('加载数据中...')
  103. this.id = id
  104. this.mode = type
  105. this.edit = ['create', 'edit'].includes(this.mode)
  106. // 拉取表单数据,同时拉取所有来自数据源的选单数据
  107. await Promise.all([
  108. () => {}
  109. ])
  110. await this.fetchForm()
  111. this.ready = true
  112. this.HIDE_LOADING()
  113. },
  114. // 加载表单数据
  115. async fetchForm() {
  116. if (this.mode === 'create') {
  117. this.origin = await this.getDefaultForm()
  118. } else {
  119. const result = await this.HTTP_GET('learun/adms/EducationalAdministration/SYS_ReceiveMessage/form', this.id)
  120. this.origin = await this.formatFormData(result)
  121. }
  122. this.current = this.COPY(this.origin)
  123. },
  124. // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
  125. async action(type) {
  126. switch (type) {
  127. case 'edit':
  128. this.edit = true
  129. break
  130. case 'reset':
  131. this.current = this.COPY(this.origin)
  132. this.edit = false
  133. break
  134. case 'save':
  135. const verifyResult = this.verifyForm()
  136. if (verifyResult.length > 0) {
  137. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  138. return
  139. }
  140. if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
  141. return
  142. }
  143. this.LOADING('正在提交...')
  144. const postData = await this.getPostData(this.id)
  145. this.HTTP_POST('learun/adms/EducationalAdministration/SYS_ReceiveMessage/save', postData, '表单提交保存失败').then(success => {
  146. this.HIDE_LOADING()
  147. if (!success) {
  148. return
  149. }
  150. this.EMIT('EducationalAdministrationSYS_ReceiveMessage-list-change')
  151. this.NAV_BACK()
  152. this.TOAST('提交保存成功')
  153. })
  154. break
  155. case 'delete':
  156. if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
  157. return
  158. }
  159. this.LOADING('提交删除中...')
  160. this.HTTP_POST('learun/adms/EducationalAdministration/SYS_ReceiveMessage/delete', this.id, '删除失败').then(success => {
  161. this.HIDE_LOADING()
  162. if (!success) {
  163. return
  164. }
  165. this.EMIT('EducationalAdministrationSYS_ReceiveMessage-list-change')
  166. this.NAV_BACK()
  167. this.this.TOAST('删除成功', 'success')
  168. })
  169. break
  170. default: break
  171. }
  172. },
  173. // 获取表单值
  174. getValue(path) {
  175. return get(this.current, path)
  176. },
  177. // 设置表单值
  178. setValue(path, val) {
  179. set(this.current, path, val)
  180. }
  181. }
  182. }
  183. </script>