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.
 
 
 
 
 
 

419 lines
14 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. <!-- 指派审核人弹窗 -->
  78. <l-modal v-model="modal" @close="reviewer = ''" title="指派审核人">
  79. <l-checkbox-picker @input="(e)=>{reviewer = e}" :value="reviewer" :readonly="false" :range="reviewerList"
  80. required title="审核人" />
  81. <l-button @click="userAssign" color="blue" class="block" block>确定指派</l-button>
  82. <l-button @click="()=>{modal = false;reviewer = ''}" line="blue" class="block margin-top-sm" block>取消</l-button>
  83. </l-modal>
  84. <view v-if="ready && current.MeetingManagement && current.MeetingManagement.status != '1'" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
  85. <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
  86. 保存
  87. </l-button>
  88. <l-button v-if="edit" @click="action('save',true)" size="lg" color="orange" class="block margin-top" block>
  89. 保存并提交
  90. </l-button>
  91. <!-- <l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
  92. 编辑本页
  93. </l-button>
  94. <l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
  95. 取消编辑
  96. </l-button>
  97. <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
  98. 删除
  99. </l-button> -->
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. /*
  105. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  106. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  107. * 创建人:超级管理员
  108. * 日 期:2020-10-20 09:25
  109. * 描 述:活动安排
  110. */
  111. /**
  112. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  113. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  114. * { "path": "pages/PersonnelManagement/BookBorrow/single", "style": { "navigationBarTitleText": "表单详情页" } }
  115. *
  116. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  117. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  118. */
  119. import get from 'lodash/get'
  120. import set from 'lodash/set'
  121. import moment from 'moment'
  122. import customPageMixins from '@/common/custompage.js'
  123. import workflowFormMixins from '@/pages/nworkflow/workflow.js'
  124. export default {
  125. mixins: [workflowFormMixins,customPageMixins,],
  126. data() {
  127. return {
  128. // 页面相关参数
  129. id: null,
  130. mode: null,
  131. edit: null,
  132. ready: false,
  133. // 表单数据
  134. current: {},
  135. origin: {},
  136. // 表单项数据结构
  137. scheme: {
  138. MeetingManagement: {
  139. MeetingTitle: { type: 'text', title: '会议主题' ,verify:"NotNull"},
  140. MeetingPlace: { type: 'select', title: '会议地点', dataSource: '0',verify:"NotNull" },
  141. BeginTime: { type: 'datetime', title: '开始时间', dateformat: '1',verify:"NotNull" },
  142. EndTime: { type: 'datetime', title: '结束时间', dateformat: '1',verify:"NotNull" },
  143. InternalParticipants: { type: 'organize', title: '参会人员', dataType: 'user',verify:"NotNull" },
  144. RecordPerson: { type: 'organize', title: '会议记录者', dataType: 'user' },
  145. Content: { type: 'texteditor', title: '会议内容',verify:"NotNull" },
  146. Linkman: { type: 'text', title: '联系人',verify:"NotNull" },
  147. LinkPhone: { type: 'text', title: '联系方式',verify:"Mobile" },
  148. Files: { type: 'upload', title: '附件上传' },
  149. // CreateUser: { type: 'organize', title: '申请人', dataType: 'user',verify:"NotNull" },
  150. },
  151. },
  152. // 数据源
  153. dataSource: {
  154. MeetingManagement: {
  155. MeetingPlace: [],
  156. },
  157. },
  158. type:null,
  159. code:null,
  160. level: '1',
  161. processId:null,
  162. // 指派审核人数据
  163. modal: false,
  164. userAssignData:{},//收集数据用来判断是否需要审核人
  165. reviewerListId:'',
  166. reviewerList:[],
  167. submitPostData:{},
  168. reviewer: [],
  169. }
  170. },
  171. async onLoad({ type, id }) {
  172. await this.init(type, id)
  173. },
  174. methods: {
  175. // 页面初始化
  176. async init(type, id) {
  177. this.LOADING('加载数据中...')
  178. this.id = id
  179. this.mode = type
  180. this.edit = ['create', 'edit'].includes(this.mode)
  181. this.type = type
  182. this.code = 'MeetingManagementApply'
  183. const currentTask = this.GET_PARAM()
  184. // 新建表单则生成
  185. this.processId = this.GUID('-')
  186. const processInfo = await this.fetchProcessInfo({ code:this.code })
  187. const currentNode = this.getCurrentNode(processInfo)
  188. this.userAssignData.currentTask = currentTask
  189. this.userAssignData.currentNode = currentNode
  190. // wfForms 的数组成员 t,表示表单数据项(TAB页),t.type 表示类别,注意它是字符串型,用 Number(t.type) 转换
  191. // 为 1 则使用工作流表单,依据它的 .formId
  192. // 不为 1 则使用系统表单,依据它的 .appurl
  193. const { wfForms } = currentNode
  194. // 处理没有有效表单的情况,停止加载
  195. if (!wfForms || wfForms.length <= 0) {
  196. this.HIDE_LOADING()
  197. this.TOAST('移动表单数据(wfForms)中无有效表单')
  198. return
  199. }
  200. // 拉取表单数据,同时拉取所有来自数据源的选单数据
  201. await Promise.all([
  202. this.FETCH_DATASOURCE('ConferenceRoom').then(result => {
  203. this.dataSource.MeetingManagement.MeetingPlace = result.data.map(t => ({ text: t.name, value: t.id }))
  204. }),
  205. () => {}
  206. ])
  207. await this.fetchForm()
  208. this.ready = true
  209. this.HIDE_LOADING()
  210. },
  211. // 加载表单数据
  212. async fetchForm() {
  213. if (this.mode === 'create') {
  214. this.origin = await this.getDefaultForm()
  215. } else {
  216. const result = await this.HTTP_GET('learun/adms/PersonnelManagement/MeetingManagement/form', this.id)
  217. this.origin = await this.formatFormData(result)
  218. }
  219. this.current = this.COPY(this.origin)
  220. },
  221. // 指派审核人
  222. async userAssign() {
  223. this.modal = false
  224. if(!this.reviewer.length){
  225. this.TOAST('请选择审核人')
  226. return
  227. }
  228. this.LOADING('正在提交…')
  229. let postData = {
  230. auditors :JSON.stringify({[this.reviewerListId]:this.reviewer.toString()}),
  231. level : this.level,
  232. code: this.code,
  233. processId: this.processId,
  234. }
  235. const url = 'learun/adms/newwf/createnoform'
  236. const tips = `流程发起失败`
  237. this.HTTP_POST(url, postData, tips).then(success => {
  238. this.HIDE_LOADING()
  239. if (!success) {
  240. return
  241. }
  242. this.submit1()
  243. })
  244. },
  245. // 发起流程
  246. async submit() {
  247. // 判断是否指派审核人
  248. let isNext = this.userAssignData.currentNode.isNext
  249. Object.assign(this.userAssignData,{ code: 'agree' })
  250. if (this.userAssignData.next == '2') {
  251. isNext = '1';
  252. }
  253. if (isNext == '1') {
  254. let params = {
  255. code: this.code,
  256. processId: this.processId,
  257. taskId: '',
  258. nodeId: this.userAssignData.currentNode.id,
  259. operationCode: this.userAssignData.code,
  260. }
  261. this.LOADING('正在获取审核人…')
  262. const userList = await this.HTTP_GET('learun/adms/newwf/auditer', params, `获取审核人时发生错误`)
  263. this.HIDE_LOADING()
  264. if (!userList) {
  265. return
  266. }
  267. let arr = Object.entries(userList)
  268. this.reviewerListId = arr[0][0]
  269. this.reviewerList = arr[0][1].map(item => {
  270. return {
  271. text: item.Name,
  272. value: item.Id
  273. }
  274. })
  275. if(this.reviewerList.length>1){
  276. this.modal = true
  277. return
  278. }
  279. }
  280. this.LOADING('正在提交…')
  281. let postData = {
  282. auditors :JSON.stringify({}),
  283. level : this.level,
  284. code: this.code,
  285. processId: this.processId,
  286. }
  287. const url = 'learun/adms/newwf/createnoform'
  288. const tips = `流程发起失败`
  289. this.HTTP_POST(url, postData, tips).then(success => {
  290. this.HIDE_LOADING()
  291. if (!success) {
  292. return
  293. }
  294. this.submit1()
  295. })
  296. },
  297. // 提交
  298. async submit1(){
  299. // if (!(await this.CONFIRM('提交项目', '是否确认提交该项?', true))) {
  300. // return
  301. // }
  302. this.LOADING('正在提交...')
  303. this.HTTP_POST('/learun/adms/PersonnelManagement/MeetingManagement/submit', {Id:this.id, ProcessId:this.processId} , '提交失败').then(
  304. success => {
  305. this.HIDE_LOADING()
  306. if (!success) {
  307. return
  308. }
  309. this.TOAST('提交成功', 'success')
  310. this.EMIT('PersonnelManagementMeetingManagement-list-change')
  311. this.NAV_BACK()
  312. })
  313. return
  314. },
  315. // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
  316. async action(type,isSubmit=false) {
  317. switch (type) {
  318. case 'edit':
  319. this.edit = true
  320. break
  321. case 'reset':
  322. this.current = this.COPY(this.origin)
  323. this.edit = false
  324. break
  325. case 'save':
  326. // if(!this.current.MeetingManagement.TotalAmount){
  327. // this.CONFIRM('表单验证失败', '[劳务维修详情]:价格为空或错误')
  328. // return
  329. // }
  330. const verifyResult = this.verifyForm()
  331. if (verifyResult.length > 0) {
  332. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  333. return
  334. }
  335. if (!(await this.CONFIRM('提交确认', '确定要提交本页表单内容吗?', true))) {
  336. return
  337. }
  338. this.LOADING('正在提交...')
  339. const postData = await this.getPostData(this.id)
  340. this.HTTP_POST('learun/adms/PersonnelManagement/MeetingManagement/save', postData, '表单提交保存失败').then(success => {
  341. this.HIDE_LOADING()
  342. if (!success) {
  343. return
  344. }
  345. this.id = success.Id
  346. if(isSubmit){
  347. this.submit()
  348. return
  349. }
  350. this.EMIT('PersonnelManagementMeetingManagement-list-change')
  351. setTimeout(()=>this.NAV_BACK(),500)
  352. this.TOAST('提交保存成功')
  353. })
  354. break
  355. case 'delete':
  356. if (!(await this.CONFIRM('删除项目', '确定要删除本项吗?', true))) {
  357. return
  358. }
  359. this.LOADING('提交删除中...')
  360. this.HTTP_POST('learun/adms/PersonnelManagement/MeetingManagement/delete', this.id, '删除失败').then(success => {
  361. this.HIDE_LOADING()
  362. if (!success) {
  363. return
  364. }
  365. this.EMIT('PersonnelManagementMeetingManagement-list-change')
  366. this.NAV_BACK()
  367. this.this.TOAST('删除成功', 'success')
  368. })
  369. break
  370. default: break
  371. }
  372. },
  373. // 获取表单值
  374. getValue(path) {
  375. return get(this.current, path)
  376. },
  377. // 设置表单值
  378. setValue(path, val) {
  379. set(this.current, path, val)
  380. },
  381. }
  382. }
  383. </script>