Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

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