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.
 
 
 
 
 
 

265 lines
7.8 KiB

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