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.
 
 
 
 
 
 

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