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

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