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.
 
 
 
 
 
 

278 lines
8.0 KiB

  1. <template>
  2. <view id="notice" class="page">
  3. <!-- 顶部页签 -->
  4. <l-nav v-model="tab" :items="['表单信息', '流程信息']" type="flex" class="solid-bottom" />
  5. <view v-if="ready && tab == 0">
  6. <l-input
  7. :value="formData.MeetingTitle"
  8. disabled
  9. title="会议主题"
  10. />
  11. <l-select
  12. :value="formData.MeetingPlace"
  13. disabled
  14. :range="dataSource.MeetingPlace"
  15. title="会议地点"
  16. />
  17. <l-datetime-picker
  18. :value="formData.BeginTime"
  19. disabled
  20. title="开始时间"
  21. />
  22. <l-datetime-picker
  23. :value="formData.EndTime"
  24. disabled
  25. title="结束时间"
  26. />
  27. <l-organize-picker
  28. :value="formData.CreateUser"
  29. readonly
  30. type="user"
  31. title="申请人"
  32. />
  33. <l-input
  34. :value="formData.Linkman"
  35. readonly
  36. title="联系人"
  37. />
  38. <l-input
  39. :value="formData.LinkPhone"
  40. readonly
  41. title="联系方式"
  42. />
  43. <l-organize-picker
  44. :value="formData.InternalParticipants"
  45. readonly
  46. type="user"
  47. title="参会人员"
  48. :multiple="true"
  49. />
  50. <l-organize-picker
  51. :value="formData.RecordPerson"
  52. readonly
  53. type="user"
  54. title="会议记录者"
  55. />
  56. <l-textarea
  57. :value="formData.Content"
  58. readonly
  59. title="会议内容"
  60. />
  61. <l-upload-file
  62. :value="fileList"
  63. readonly
  64. title="附件上传"
  65. />
  66. <l-workflow-action
  67. @audit="audit"
  68. @action="action"
  69. :type="type"
  70. :currentNode="currentNode"
  71. :currentTask="currentTask"
  72. />
  73. </view>
  74. <view v-if="ready && tab == 1" class="progress"><l-workflow-timeline :processList="processList" /></view>
  75. <!-- <view class="padding-sm text-grey notice-info">
  76. <view class="text-right">本页内容发布于 {{ time }}</view>
  77. <view class="text-right">{{ date }}</view>
  78. </view> -->
  79. </view>
  80. </template>
  81. <script>
  82. import moment from 'moment'
  83. import workflowFormMixins from '@/pages/nworkflow/workflow.js'
  84. export default {
  85. mixins: [workflowFormMixins],
  86. data() {
  87. return {
  88. tab:0,
  89. type:'view',
  90. currentNode:null,
  91. currentTask:null,
  92. taskId:'',
  93. processId:'',
  94. processInfo:null,
  95. processList:[],
  96. formData:{},
  97. ready: false,
  98. content: '',
  99. time: '',
  100. date: '',
  101. fileList:[],
  102. // 数据源
  103. dataSource: {
  104. MeetingManagement: {
  105. MeetingPlace: [],
  106. },
  107. } ,
  108. }
  109. },
  110. async onLoad({type}) {
  111. await this.init(type)
  112. },
  113. methods: {
  114. async init(type) {
  115. if(type){this.type = type}
  116. this.LOADING('加载中…')
  117. const noticeItem = this.GET_PARAM()
  118. this.processList = noticeItem.logList
  119. this.currentNode = noticeItem.currentNode
  120. this.currentTask = noticeItem.currentTask
  121. this.processInfo = noticeItem.processInfo
  122. this.taskId = this.currentTask.F_TaskId
  123. this.processId = this.currentTask.F_Id
  124. this.formValue = noticeItem.formValue
  125. this.scheme = noticeItem.scheme
  126. // 拉取表单数据,同时拉取所有来自数据源的选单数据
  127. await Promise.all([
  128. this.FETCH_DATASOURCE('ConferenceRoom').then(result => {
  129. this.dataSource.MeetingManagement.MeetingPlace = result.data.map(t => ({ text: t.name, value: t.id }))
  130. }),
  131. () => {}
  132. ])
  133. await this.getFormData(this.processList[0].F_ProcessId)
  134. this.HIDE_LOADING();
  135. // this.content = this.CONVERT_HTML(noticeItem.f_content)
  136. // this.time = moment(noticeItem.f_time).format('HH : mm')
  137. // this.date = moment(noticeItem.f_time).format('YYYY年 M月 D日')
  138. // this.SET_TITLE(noticeItem.f_title)
  139. // this.HIDE_LOADING()
  140. },
  141. // 获取表单数据
  142. getFormData(ProcessId){
  143. return this.HTTP_GET("learun/adms/PersonnelManagement/MeetingManagement/shList",{ProcessId},"加载数据时出错").then(async res=>{
  144. if(res){
  145. // res.F_SourceName = res.F_SourceName&&this.GET_GLOBAL('department')[res.F_SourceName]? this.GET_GLOBAL('department')[res.F_SourceName].name : res.F_SourceName
  146. this.formData = res
  147. let fileList = await this.getFileListById(res.Files)
  148. if(fileList&&fileList.length){
  149. this.fileList = fileList
  150. }
  151. // this.content = res.F_NewsContent
  152. this.ready = true
  153. }
  154. })
  155. },
  156. // 点击审批相关按钮
  157. async audit(action) {
  158. this.LOADING('加载中…')
  159. const currentTask = this.processInfo.task.find(t => t.F_NodeId === this.currentNode.id)
  160. const postData = await this.getPostData(this.formValue, this.scheme)
  161. const pageParam = {
  162. type: 'sign',
  163. processId: currentTask.F_ProcessId,
  164. taskId: currentTask.F_Id,
  165. formreq: postData.formreq,
  166. taskName: this.currentTask.F_Title,
  167. currentNode:this.currentNode,
  168. code:this.code||''
  169. }
  170. // 不是加签
  171. if (action.code !== '__sign__') {
  172. Object.assign(pageParam, action)
  173. pageParam.type = 'verify'
  174. pageParam.auditors = JSON.stringify({})
  175. pageParam.isFromSignAudit = Number(this.currentTask.F_TaskType) === 3
  176. }
  177. this.HIDE_LOADING()
  178. this.NAV_TO('/pages/nworkflow/myflow/sign', pageParam, true)
  179. },
  180. // 点击操作按钮(非审批类按钮)
  181. async action(taskType) {
  182. switch (taskType) {
  183. // 点击「催办」/「撤销流程」/「标记已阅」按钮
  184. case 'urge':
  185. case 'revoke':
  186. case 'refer':
  187. const actionText = { urge: '催办', revoke: '撤销', refer: '已阅' }[taskType]
  188. const actionUrl = { urge: '/urge', revoke: '/revoke', refer: '/refer' }[taskType]
  189. let actionData = this.processId
  190. if (taskType === 'refer') {
  191. actionData = { processId: this.processId, taskId: this.taskId }
  192. }
  193. if (!(await this.CONFIRM(`${actionText}确认`, `确定要提交${actionText}吗?`, true))) {
  194. return
  195. }
  196. this.LOADING(`提交${actionText}中…`)
  197. this.HTTP_POST(`/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => {
  198. this.HIDE_LOADING()
  199. if (success) {
  200. this.EMIT('task-list-change')
  201. this.TOAST(`成功提交${actionText}`, 'success')
  202. if (taskType === 'revoke') {
  203. this.NAV_BACK()
  204. }
  205. }
  206. })
  207. break
  208. // 点击「提交草稿」按钮
  209. case 'draft':
  210. this.CONFIRM('不支持此操作')
  211. return
  212. if (!(await this.CONFIRM('提交确认', '确定要提交草稿吗?', true))) {
  213. return
  214. }
  215. this.LOADING('正在提交…')
  216. const draftFormValue = this.$refs.form.getFormValue()
  217. const draftPostData = await this.getPostData(draftFormValue, this.scheme)
  218. this.HTTP_POST('/newwf​/draft', draftPostData, '提交草稿失败').then(success => {
  219. this.HIDE_LOADING()
  220. if (success) {
  221. this.EMIT('task-list-change')
  222. this.NAV_BACK()
  223. this.TOAST('草稿已保存', 'success')
  224. }
  225. })
  226. break
  227. // 点击「发起流程」按钮
  228. case 'submit':
  229. this.CONFIRM('不支持此操作')
  230. return
  231. const verifyResult = this.$refs.form.verifyValue()
  232. if (verifyResult.length > 0) {
  233. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  234. return
  235. }
  236. if (!(await this.CONFIRM('提交确认', '确定要发起流程吗?', true))) {
  237. return
  238. }
  239. this.LOADING('正在提交…')
  240. const formValue = this.$refs.form.getFormValue()
  241. const postData = await this.getPostData(formValue, this.scheme)
  242. postData.auditors = JSON.stringify({})
  243. if (this.type === 'child') {
  244. postData.parentProcessId = this.processId
  245. postData.parentTaskId = this.taskId
  246. }
  247. const errorTips = '流程发起失败'
  248. this.HTTP_POST('/newwf/createchildflow', postData, errorTips).then(success => {
  249. this.HIDE_LOADING()
  250. if (success) {
  251. this.EMIT('task-list-change')
  252. this.NAV_BACK()
  253. this.TOAST('流程发起成功', 'success')
  254. }
  255. })
  256. break
  257. default:
  258. break
  259. }
  260. },
  261. }
  262. }
  263. </script>