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.
 
 
 
 
 
 

362 lines
10 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 v-model="formData.FundsApply.ApplyUser" title="填报人" disabled></l-input> -->
  7. <l-select v-model="formData.FundsApply.ApplyUser" :range="dataSource.ApplyUser" title="填报人" disabled></l-select>
  8. <l-select v-model="formData.FundsApply.ApplyDept" :range="dataSource.ApplyDept" title="申报部门" disabled></l-select>
  9. <l-input v-model="formData.FundsApply.ApplyTime" title="时间" disabled></l-input>
  10. <!-- <l-select v-model="formData.FundsApply.IsFixedAssets" :range="dataSource.IsFixedAssets" title="固定资产" disabled></l-select> -->
  11. <l-input :value="IsFixedAssetsitem(formData.FundsApply.IsFixedAssets)" title="固定资产" disabled></l-input>
  12. <l-textarea v-model="formData.FundsApply.Remark" title="备注" readonly/>
  13. <l-input v-model="formData.FundsApply.SumAmount" title="总金额" disabled></l-input>
  14. <l-input v-model="formData.FundsApply.UpperAmount" title="人民币大写" disabled></l-input>
  15. <l-upload-file
  16. :value="fileList"
  17. :readonly="true"
  18. title="附件"
  19. />
  20. <view class="welT" style="padding-top: 10px;">
  21. 明细
  22. </view>
  23. <view class="welBox" id="StuInfoFreshEmergePeople" v-show="FundsApplyDetail.length != 0">
  24. <view class="welCon" v-for="(item, i) in FundsApplyDetail" :key='i'>
  25. <l-input v-model="item.ProjectContent" title="项目内容" placeholder="请填写" disabled right />
  26. <l-input v-model="item.Number" type="number" @change="SumAmountChange(item)" title="数量" disabled placeholder="请填写" right />
  27. <l-input v-model="item.Price" type="number" @change="SumAmountChange(item)" title="单价(元)" disabled placeholder="请填写" right />
  28. <l-input v-model="item.Amount" title="金额(元)" disabled placeholder="请填写" right />
  29. </view>
  30. </view>
  31. <l-workflow-action
  32. @audit="audit"
  33. @action="action"
  34. :type="type"
  35. :currentNode="currentNode"
  36. :currentTask="currentTask"
  37. />
  38. </view>
  39. <view v-if="ready && tab == 1" class="progress"><l-workflow-timeline :processList="processList" /></view>
  40. <!-- <view class="padding-sm text-grey notice-info">
  41. <view class="text-right">本页内容发布于 {{ time }}</view>
  42. <view class="text-right">{{ date }}</view>
  43. </view> -->
  44. </view>
  45. </template>
  46. <script>
  47. import moment from 'moment'
  48. import workflowFormMixins from '@/pages/nworkflow/workflow.js'
  49. export default {
  50. mixins: [workflowFormMixins],
  51. data() {
  52. return {
  53. tab:0,
  54. type:'view',
  55. currentNode:null,
  56. currentTask:null,
  57. taskId:'',
  58. processId:'',
  59. processInfo:null,
  60. processList:[],
  61. formData:{},
  62. ready: false,
  63. content: '',
  64. time: '',
  65. date: '',
  66. fileList:[],
  67. // 数据源
  68. dataSource: {
  69. ApplyDept: [],
  70. ApplyUser: [],
  71. IsFixedAssets: []
  72. },
  73. FundsApplyDetail: [],
  74. FundsApplyDetails: {
  75. ProjectContent: '',
  76. Number: '',
  77. Price: '',
  78. Amount: ''
  79. },
  80. }
  81. },
  82. async onLoad({type}) {
  83. await this.init(type)
  84. },
  85. methods: {
  86. async init(type) {
  87. if(type){this.type = type}
  88. await Promise.all([
  89. this.FETCH_DATASOURCE('classdata').then(result => {
  90. this.dataSource.ApplyDept = result.data.map(t => ({
  91. text: t.name,
  92. value: t.id
  93. }));
  94. }),
  95. this.FETCH_DATASOURCE('teacheruserdata').then(result => {
  96. this.dataSource.ApplyUser = result.data.map(t => ({
  97. text: t.f_realname,
  98. value: t.f_userid
  99. }));
  100. }),
  101. this.dataSource.IsFixedAssets = Object.values(this.GET_GLOBAL('dataDictionary').YesOrNoInt).map(t => ({
  102. value: t.value,
  103. text: t.text
  104. }))
  105. ])
  106. // console.log(this.dataSource.IsFixedAssets)
  107. this.LOADING('加载中…')
  108. const noticeItem = this.GET_PARAM()
  109. this.processList = noticeItem.logList
  110. this.currentNode = noticeItem.currentNode
  111. this.currentTask = noticeItem.currentTask
  112. this.processInfo = noticeItem.processInfo
  113. this.taskId = this.currentTask.F_TaskId
  114. this.processId = this.currentTask.F_Id
  115. this.formValue = noticeItem.formValue
  116. this.scheme = noticeItem.scheme
  117. // console.log(this.processList[0].F_ProcessId)
  118. await this.getFormData(this.processList[0].F_ProcessId)
  119. this.HIDE_LOADING();
  120. // this.content = this.CONVERT_HTML(noticeItem.f_content)
  121. // this.time = moment(noticeItem.f_time).format('HH : mm')
  122. // this.date = moment(noticeItem.f_time).format('YYYY年 M月 D日')
  123. // this.SET_TITLE(noticeItem.f_title)
  124. // this.HIDE_LOADING()
  125. },
  126. // 获取表单数据
  127. getFormData(ProcessId){
  128. return this.HTTP_GET("learun/adms/FundsApply/shList",{ProcessId},"加载数据时出错").then(async res=>{
  129. if(res){
  130. // res.F_SourceName = res.F_SourceName&&this.GET_GLOBAL('department')[res.F_SourceName]? this.GET_GLOBAL('department')[res.F_SourceName].name : res.F_SourceName
  131. this.formData = res
  132. let FundsApplyDetailitem = res.FundsApplyDetail
  133. if(FundsApplyDetailitem.length>0){
  134. for(let i=0;i<FundsApplyDetailitem.length;i++){
  135. FundsApplyDetailitem[i].Price = Number(FundsApplyDetailitem[i].Price).toFixed(2)
  136. FundsApplyDetailitem[i].Amount = Number(FundsApplyDetailitem[i].Amount).toFixed(2)
  137. }
  138. }
  139. this.FundsApplyDetail = res.FundsApplyDetail
  140. let fileList = []
  141. fileList = await this.getFileListById(res.FundsApply.Path);
  142. if(fileList&&fileList.length){
  143. this.fileList = fileList
  144. }
  145. // let fileList = await this.getFileListById(res.F_NewsImage)
  146. // if(fileList&&fileList.length){
  147. // this.fileList = [fileList[0]]
  148. // }
  149. // this.content = res.F_NewsContent
  150. this.ready = true
  151. }
  152. })
  153. },
  154. // 点击审批相关按钮
  155. async audit(action) {
  156. this.LOADING('加载中…')
  157. const currentTask = this.processInfo.task.find(t => t.F_NodeId === this.currentNode.id)
  158. const postData = await this.getPostData(this.formValue, this.scheme)
  159. const pageParam = {
  160. type: 'sign',
  161. processId: currentTask.F_ProcessId,
  162. taskId: currentTask.F_Id,
  163. formreq: postData.formreq,
  164. taskName: this.currentTask.F_Title,
  165. currentNode:this.currentNode,
  166. code:this.code||''
  167. }
  168. // 不是加签
  169. if (action.code !== '__sign__') {
  170. Object.assign(pageParam, action)
  171. pageParam.type = 'verify'
  172. pageParam.auditors = JSON.stringify({})
  173. pageParam.isFromSignAudit = Number(this.currentTask.F_TaskType) === 3
  174. }
  175. this.HIDE_LOADING()
  176. this.NAV_TO('/pages/nworkflow/myflow/sign', pageParam, true)
  177. },
  178. // 点击操作按钮(非审批类按钮)
  179. async action(taskType) {
  180. switch (taskType) {
  181. // 点击「催办」/「撤销流程」/「标记已阅」按钮
  182. case 'urge':
  183. case 'revoke':
  184. case 'refer':
  185. const actionText = { urge: '催办', revoke: '撤销', refer: '已阅' }[taskType]
  186. const actionUrl = { urge: '/urge', revoke: '/revoke', refer: '/refer' }[taskType]
  187. let actionData = this.processId
  188. if (taskType === 'refer') {
  189. actionData = { processId: this.processId, taskId: this.taskId }
  190. }
  191. if (!(await this.CONFIRM(`${actionText}确认`, `确定要提交${actionText}吗?`, true))) {
  192. return
  193. }
  194. this.LOADING(`提交${actionText}中…`)
  195. this.HTTP_POST(`/newwf${actionUrl}`, actionData, `提交${actionText}失败`).then(success => {
  196. this.HIDE_LOADING()
  197. if (success) {
  198. this.EMIT('task-list-change')
  199. this.TOAST(`成功提交${actionText}`, 'success')
  200. if (taskType === 'revoke') {
  201. this.NAV_BACK()
  202. }
  203. }
  204. })
  205. break
  206. // 点击「提交草稿」按钮
  207. case 'draft':
  208. this.CONFIRM('不支持此操作')
  209. return
  210. if (!(await this.CONFIRM('提交确认', '确定要提交草稿吗?', true))) {
  211. return
  212. }
  213. this.LOADING('正在提交…')
  214. const draftFormValue = this.$refs.form.getFormValue()
  215. const draftPostData = await this.getPostData(draftFormValue, this.scheme)
  216. this.HTTP_POST('/newwf​/draft', draftPostData, '提交草稿失败').then(success => {
  217. this.HIDE_LOADING()
  218. if (success) {
  219. this.EMIT('task-list-change')
  220. this.NAV_BACK()
  221. this.TOAST('草稿已保存', 'success')
  222. }
  223. })
  224. break
  225. // 点击「发起流程」按钮
  226. case 'submit':
  227. this.CONFIRM('不支持此操作')
  228. return
  229. const verifyResult = this.$refs.form.verifyValue()
  230. if (verifyResult.length > 0) {
  231. this.CONFIRM('表单验证失败', verifyResult.join('\n'))
  232. return
  233. }
  234. if (!(await this.CONFIRM('提交确认', '确定要发起流程吗?', true))) {
  235. return
  236. }
  237. this.LOADING('正在提交…')
  238. const formValue = this.$refs.form.getFormValue()
  239. const postData = await this.getPostData(formValue, this.scheme)
  240. postData.auditors = JSON.stringify({})
  241. if (this.type === 'child') {
  242. postData.parentProcessId = this.processId
  243. postData.parentTaskId = this.taskId
  244. }
  245. const errorTips = '流程发起失败'
  246. this.HTTP_POST('/newwf/createchildflow', postData, errorTips).then(success => {
  247. this.HIDE_LOADING()
  248. if (success) {
  249. this.EMIT('task-list-change')
  250. this.NAV_BACK()
  251. this.TOAST('流程发起成功', 'success')
  252. }
  253. })
  254. break
  255. default:
  256. break
  257. }
  258. },
  259. IsFixedAssetsitem(data){
  260. if(data == 0){
  261. return '否'
  262. }else{
  263. return '是'
  264. }
  265. }
  266. }
  267. }
  268. </script>
  269. <style lang="less" scoped>
  270. .welT {
  271. font-size: 16px;
  272. line-height: 26px;
  273. padding: 0 12px;
  274. background-color: #ffffff;
  275. padding-bottom: 12px;
  276. }
  277. .welT text {
  278. width: 26px;
  279. height: 26px;
  280. line-height: 24px;
  281. border: 1px solid #efefef;
  282. border-radius: 4px;
  283. float: right;
  284. text-align: center;
  285. color: #999;
  286. }
  287. .welBox {
  288. // margin-top: 10px;
  289. }
  290. .welCon {
  291. padding: 10px;
  292. border: 1px solid #efefef;
  293. padding-top: 18px;
  294. border-radius: 4px;
  295. position: relative;
  296. // background-color: #ffffff;
  297. margin-top: 15px;
  298. }
  299. .welDel {
  300. border-radius: 50%;
  301. position: absolute;
  302. top: 4px;
  303. left: 0px;
  304. background: #fff;
  305. }
  306. .welDel text {
  307. text-align: center;
  308. width: 26px;
  309. height: 26px;
  310. display: block;
  311. line-height: 24px;
  312. border: 1px solid #efefef;
  313. border-radius: 50%;
  314. }
  315. .welImgAdd {
  316. text-align: center;
  317. line-height: 0;
  318. }
  319. .passwordDes {
  320. color: #606266;
  321. font-size: 14px;
  322. padding: 8px;
  323. text-indent: 2em;
  324. }
  325. </style>