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

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