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.

single.vue 12 KiB

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