Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

344 рядки
11 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" disabled
  8. :range="dataSource.Purchase_Service.DepartmentId" title="填报部门" disabled />
  9. <l-organize-picker
  10. :value="formData.Purchase_Service.Creator" readonly type="user" title="填报人" readonly />
  11. <l-datetime-picker
  12. :value="formData.Purchase_Service.Createtime"
  13. disabled
  14. title="填报时间"
  15. />
  16. <l-input :value="formData.Purchase_Service.Payee" title="收款人" disabled/>
  17. <l-input :value="formData.Purchase_Service.Attachcount" title="附件张数" disabled/>
  18. <l-upload-file :value="fileList" title="附件" readonly />
  19. <l-input :value="formData.Purchase_Service.Totalamount" title="申请报账金额" disabled/>
  20. <l-input :value="formData.Purchase_Service.Approvalamount"
  21. :disabled="!isEdit('Approvalamount')" title="核准金额" @input="setValue('Approvalamount',$event)" />
  22. <view style="background-color: #fff;">
  23. <view style="line-height: 40px;font-size: 14px;padding-left: 12px;">
  24. 报账明细:
  25. </view>
  26. <next-table ref="table" :show-header="true" :columns="column" :stripe="true" :fit="false" :border="true" :data="data"
  27. :highlight="true" @currentChange="currentChange">
  28. </next-table>
  29. <l-customform-table
  30. :value="currentRowDetail" :item="Purchase_Service_Details"
  31. :edit="false" />
  32. </view>
  33. <l-workflow-action
  34. @audit="audit"
  35. @action="action"
  36. :type="type"
  37. :currentNode="currentNode"
  38. :currentTask="currentTask"
  39. />
  40. </view>
  41. <view v-if="ready && tab == 1" class="progress"><l-workflow-timeline :processList="processList" /></view>
  42. <!-- <view class="padding-sm text-grey notice-info">
  43. <view class="text-right">本页内容发布于 {{ time }}</view>
  44. <view class="text-right">{{ date }}</view>
  45. </view> -->
  46. </view>
  47. </template>
  48. <script>
  49. import moment from 'moment'
  50. import workflowFormMixins from '@/pages/nworkflow/workflow.js'
  51. export default {
  52. mixins: [workflowFormMixins],
  53. data() {
  54. return {
  55. tab:0,
  56. type:'view',
  57. currentNode:null,
  58. currentTask:null,
  59. taskId:'',
  60. processId:'',
  61. processInfo:null,
  62. processList:[],
  63. formData:{},
  64. ready: false,
  65. content: '',
  66. time: '',
  67. date: '',
  68. fileList:[],
  69. Purchase_Service_Details: {
  70. type: 'girdtable',
  71. title: '劳务维修详情',
  72. __defaultItem__: {},
  73. fieldsData: [
  74. { field:'ServiceContent', type:'input', name:'维修内容' },
  75. { field:'Price', type:'input', name:'价格' },
  76. { field:'Peoplecount', type:'input', name:'人数' },
  77. { field:'Days', type:'input', name:'天数' },
  78. { field:'Standar', type:'input', name:'标准' },
  79. ]
  80. },
  81. // 数据源
  82. dataSource: {
  83. Purchase_Service: {
  84. DepartmentId: [],
  85. Status: [{
  86. text: '已提交',
  87. value: '1'
  88. }, {
  89. text: '未提交',
  90. value: '2'
  91. }],
  92. CheckStatus: [{
  93. text: '审核中',
  94. value: '1'
  95. }, {
  96. text: '审核通过',
  97. value: '2'
  98. }, {
  99. text: '',
  100. value: '草稿'
  101. }]
  102. },
  103. },
  104. // 采购数据
  105. column:[
  106. // { type:'selection', fixed:true,width:60 },
  107. // { name: 'CreatorName', label: '申请人',width:80,emptyString:'--' },
  108. { name: 'TotalAmount', label: '金额',fixed:false,width:86,emptyString:'--' },
  109. // { name: 'DepartmentName', label: '部门',fixed:false,width:200,emptyString:'--' },
  110. { name: 'Remark', label: '备注',fixed:false,width:126,emptyString:'--' },
  111. { name: 'CreateTime', label: '申请时间',width:80,emptyString:'--' },
  112. // { name: 'SubmitTime', label: '提交时间',fixed:false,width:146,emptyString:'--' },
  113. // { name: 'CheckTime', label: '审核时间',fixed:false,width:146,emptyString:'--' },
  114. ],
  115. data:[],
  116. list: [],
  117. currentRow:null,
  118. currentRowDetail:[],
  119. changeData:{},
  120. // 权限
  121. authorize:{},
  122. }
  123. },
  124. async onLoad({type}) {
  125. await this.init(type)
  126. },
  127. methods: {
  128. async init(type) {
  129. if(type){this.type = type}
  130. this.LOADING('加载中…')
  131. const noticeItem = this.GET_PARAM()
  132. this.processList = noticeItem.logList
  133. this.currentNode = noticeItem.currentNode
  134. this.currentTask = noticeItem.currentTask
  135. this.processInfo = noticeItem.processInfo
  136. this.taskId = this.currentTask.F_TaskId
  137. this.processId = this.currentTask.F_Id
  138. this.formValue = noticeItem.formValue
  139. this.scheme = noticeItem.scheme
  140. // console.log(this.currentNode.wfForms[0].authorize)
  141. // 权限
  142. if(this.currentNode.wfForms && this.currentNode.wfForms[0].authorize){
  143. let arr = Object.values(this.currentNode.wfForms[0].authorize)
  144. for (let item of arr) {
  145. this.authorize[item.fieldId] = item
  146. }
  147. }
  148. // 拉取表单数据,同时拉取所有来自数据源的选单数据
  149. await Promise.all([
  150. this.FETCH_DATASOURCE('classdata').then(data => {
  151. this.dataSource.Purchase_Service.DepartmentId = data.data.map(t => ({
  152. text: t.name,
  153. value: t.id
  154. }));
  155. }),
  156. () => {}
  157. ])
  158. await this.getFormData(this.processList[0].F_ProcessId)
  159. this.HIDE_LOADING();
  160. // this.content = this.CONVERT_HTML(noticeItem.f_content)
  161. // this.time = moment(noticeItem.f_time).format('HH : mm')
  162. // this.date = moment(noticeItem.f_time).format('YYYY年 M月 D日')
  163. // this.SET_TITLE(noticeItem.f_title)
  164. // this.HIDE_LOADING()
  165. },
  166. // 获取表单数据
  167. getFormData(ProcessId){
  168. return this.HTTP_GET("learun/adms/purchaseserviceapply/shList",{ProcessId},"加载数据时出错").then(async res=>{
  169. if(res){
  170. // res.F_SourceName = res.F_SourceName&&this.GET_GLOBAL('department')[res.F_SourceName]? this.GET_GLOBAL('department')[res.F_SourceName].name : res.F_SourceName
  171. this.formData = res
  172. this.data = res.Purchase_Service_Details
  173. let fileList = await this.getFileListById(res.Purchase_Service.FilePath)
  174. if(fileList&&fileList.length){
  175. this.fileList = [fileList[0]]
  176. }
  177. // this.content = res.F_NewsContent
  178. this.ready = true
  179. }
  180. })
  181. },
  182. isEdit(field){
  183. return this.authorize[field] && this.authorize[field].isEdit !== 0
  184. },
  185. // 点击某一行
  186. async currentChange(row){
  187. this.currentRow = row
  188. this.currentRowDetail = []
  189. const result = await this.HTTP_GET('learun/adms/purchaseservice/formdetail',row.purchaseid)
  190. if(!result)return
  191. this.currentRowDetail = result
  192. },
  193. // 保存表单
  194. async saveForm(){
  195. if(this.changeData.Approvalamount&&!this.checkAmt(this.changeData.Approvalamount)){
  196. this.TOAST('请输入正确的核准金额')
  197. return false
  198. }
  199. let postData = {
  200. strEntity:JSON.stringify(this.changeData),
  201. keyValue:this.formData.Purchase_Service.Id,
  202. }
  203. let res = await this.HTTP_POST('learun/adms/purchaseserviceapply/save', postData, '表单提交保存失败')
  204. if(!res){
  205. this.TOAST('表单提交保存失败')
  206. return false
  207. }
  208. return true
  209. },
  210. // 点击审批相关按钮
  211. async audit(action) {
  212. this.LOADING('加载中…')
  213. let res = await this.saveForm()
  214. if(!res){
  215. this.HIDE_LOADING()
  216. return
  217. }
  218. const currentTask = this.processInfo.task.find(t => t.F_NodeId === this.currentNode.id)
  219. const postData = await this.getPostData(this.formValue, this.scheme)
  220. const pageParam = {
  221. type: 'sign',
  222. processId: currentTask.F_ProcessId,
  223. taskId: currentTask.F_Id,
  224. formreq: postData.formreq,
  225. taskName: this.currentTask.F_Title,
  226. currentNode:this.currentNode,
  227. code:this.code||''
  228. }
  229. // 不是加签
  230. if (action.code !== '__sign__') {
  231. Object.assign(pageParam, action)
  232. pageParam.type = 'verify'
  233. pageParam.auditors = JSON.stringify({})
  234. pageParam.isFromSignAudit = Number(this.currentTask.F_TaskType) === 3
  235. }
  236. this.HIDE_LOADING()
  237. this.NAV_TO('/pages/nworkflow/myflow/sign', pageParam, true)
  238. },
  239. // 点击操作按钮(非审批类按钮)
  240. async action(taskType) {
  241. switch (taskType) {
  242. // 点击「催办」/「撤销流程」/「标记已阅」按钮
  243. case 'urge':
  244. case 'revoke':
  245. case 'refer':
  246. const actionText = { urge: '催办', revoke: '撤销', refer: '已阅' }[taskType]
  247. const actionUrl = { urge: '/urge', revoke: '/revoke', refer: '/refer' }[taskType]
  248. let actionData = this.processId
  249. if (taskType === 'refer') {
  250. actionData = { processId: this.processId, taskId: this.taskId }
  251. }
  252. if (!(await this.CONFIRM(`${actionText}确认`, `确定要提交${actionText}吗?`, true))) {
  253. return
  254. }
  255. this.LOADING(`提交${actionText}中…`)
  256. this.HTTP_POST(`/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => {
  257. this.HIDE_LOADING()
  258. if (success) {
  259. this.EMIT('task-list-change')
  260. this.TOAST(`成功提交${actionText}`, 'success')
  261. if (taskType === 'revoke') {
  262. this.NAV_BACK()
  263. }
  264. }
  265. })
  266. break
  267. // 点击「提交草稿」按钮
  268. case 'draft':
  269. this.CONFIRM('不支持此操作')
  270. return
  271. if (!(await this.CONFIRM('提交确认', '确定要提交草稿吗?', true))) {
  272. return
  273. }
  274. this.LOADING('正在提交…')
  275. const draftFormValue = this.$refs.form.getFormValue()
  276. const draftPostData = await this.getPostData(draftFormValue, this.scheme)
  277. this.HTTP_POST('/newwf​/draft', draftPostData, '提交草稿失败').then(success => {
  278. this.HIDE_LOADING()
  279. if (success) {
  280. this.EMIT('task-list-change')
  281. this.NAV_BACK()
  282. this.TOAST('草稿已保存', 'success')
  283. }
  284. })
  285. break
  286. // 点击「发起流程」按钮
  287. case 'submit':
  288. this.CONFIRM('不支持此操作')
  289. return
  290. const verifyResult = this.$refs.form.verifyValue()
  291. if (verifyResult.length > 0) {
  292. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  293. return
  294. }
  295. if (!(await this.CONFIRM('提交确认', '确定要发起流程吗?', true))) {
  296. return
  297. }
  298. this.LOADING('正在提交…')
  299. const formValue = this.$refs.form.getFormValue()
  300. const postData = await this.getPostData(formValue, this.scheme)
  301. postData.auditors = JSON.stringify({})
  302. if (this.type === 'child') {
  303. postData.parentProcessId = this.processId
  304. postData.parentTaskId = this.taskId
  305. }
  306. const errorTips = '流程发起失败'
  307. this.HTTP_POST('/newwf/createchildflow', postData, errorTips).then(success => {
  308. this.HIDE_LOADING()
  309. if (success) {
  310. this.EMIT('task-list-change')
  311. this.NAV_BACK()
  312. this.TOAST('流程发起成功', 'success')
  313. }
  314. })
  315. break
  316. default:
  317. break
  318. }
  319. },
  320. }
  321. }
  322. </script>