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.
 
 
 
 
 
 

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