detail.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <div class="widget-wrapper">
  3. <div class="widget-list">
  4. <div class="fx-field x-grid-col-12">
  5. <div class="field-label">
  6. <span class="field-required">*</span>
  7. <div class="field-name">申请人</div>
  8. </div>
  9. <div class="field-component">
  10. <span :title="form.loginName">{{ form.employeeName }}</span>
  11. </div>
  12. </div>
  13. <div class="fx-field x-grid-col-12">
  14. <div class="field-label">
  15. <div class="field-name">部门</div>
  16. </div>
  17. <div class="field-component">
  18. <span :title="form.deptName">{{ form.deptName }}</span>
  19. </div>
  20. </div>
  21. <div class="fx-field x-grid-col-12">
  22. <div class="field-label">
  23. <div class="field-name">职位</div>
  24. </div>
  25. <div class="field-component">
  26. <span :title="form.position">{{ form.position }}</span>
  27. </div>
  28. </div>
  29. <div class="fx-field x-grid-col-12">
  30. <div class="field-label">
  31. <span class="field-required">*</span>
  32. <div class="field-name">手机号</div>
  33. </div>
  34. <div class="field-component">
  35. <span :title="form.contactNumber">{{ form.employeePhone }}</span>
  36. </div>
  37. </div>
  38. <div class="fx-field x-grid-col-12">
  39. <div class="field-label">
  40. <span class="field-required">*</span>
  41. <div class="field-name">事项标题</div>
  42. </div>
  43. <div class="field-component">
  44. <span :title="form.email">{{ form.title }}</span>
  45. </div>
  46. </div>
  47. <div class="fx-field x-grid-col-12">
  48. <div class="field-label">
  49. <div class="field-name">详细描述</div>
  50. </div>
  51. <div class="field-component">
  52. <span :title="form.education">{{ form.description }}</span>
  53. </div>
  54. </div>
  55. <div class="fx-field x-grid-col-12">
  56. <div class="field-label">
  57. <div class="field-name">附件</div>
  58. </div>
  59. <div class="field-component" v-for="(item, index) in form.fileList" :key="index">
  60. <a :href="item.url" target="_blank" :title="item.name" style="color: #5094d5;">{{ item.name }}</a>
  61. <!-- <span style="color: #5094d5;cursor: pointer;">
  62. </span> -->
  63. </div>
  64. </div>
  65. <div class="fx-field x-grid-col-12">
  66. <div class="field-label">
  67. <div class="field-name">备注</div>
  68. </div>
  69. <div class="field-component">
  70. <span :title="form.remarks">{{ form.remarks }}</span>
  71. </div>
  72. </div>
  73. <div class="fx-field x-grid-col-12" v-if="form.auditStatus==2">
  74. <div class="field-label">
  75. <span class="field-required">*</span>
  76. <div class="field-name">审批意见</div>
  77. </div>
  78. <el-input type="textarea" v-model="reason" placeholder="请输入审批建议" />
  79. </div>
  80. <div class="fx-field x-grid-col-12">
  81. <div class="field-label">
  82. <div class="field-name">流程动态</div>
  83. </div>
  84. <el-timeline>
  85. <el-timeline-item v-for="(item, index) in tasks" :key="index" :icon="getTimelineItemIcon(item)"
  86. :type="getTimelineItemType(item)">
  87. <p style="font-weight: 700">任务:{{ item.name }}</p>
  88. <el-card :body-style="{ padding: '10px' }">
  89. <label v-if="item.assigneeUser" style="font-weight: normal; margin-right: 30px;">
  90. 审批人:{{ item.assigneeUser.nickname }}
  91. <el-tag type="info" size="mini">{{ item.assigneeUser.deptName }}</el-tag>
  92. </label>
  93. <label style="font-weight: normal" v-if="item.createTime">创建时间:</label>
  94. <label style="color:#8a909c; font-weight: normal">{{ parseTime(item.createTime) }}</label>
  95. <label v-if="item.endTime" style="margin-left: 30px;font-weight: normal">审批时间:</label>
  96. <label v-if="item.endTime" style="color:#8a909c;font-weight: normal"> {{
  97. parseTime(item.endTime)
  98. }}</label>
  99. <label v-if="item.durationInMillis" style="margin-left: 30px;font-weight: normal">耗时:</label>
  100. <label v-if="item.durationInMillis" style="color:#8a909c;font-weight: normal">
  101. {{ getDateStar(item.durationInMillis) }} </label>
  102. <p v-if="item.reason">
  103. <el-tag :type="getTimelineItemType(item)">{{ item.reason }}</el-tag>
  104. </p>
  105. </el-card>
  106. </el-timeline-item>
  107. </el-timeline>
  108. </div>
  109. <div class="fx-field x-grid-col-12" v-if="form.auditStatus==2">
  110. <div style="float: right;">
  111. <el-button @click="handleAudit(false)">驳回</el-button>
  112. <el-button type="primary" @click="handleAudit(true)">同意</el-button>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </template>
  118. <script>
  119. import { getDetail,completeTask } from "@/api/oa/universal"
  120. export default {
  121. props: {
  122. id: {
  123. type: [String, Number],
  124. default: undefined
  125. },
  126. },
  127. data() {
  128. return {
  129. entryId: undefined, // 编号
  130. reason: '',
  131. auditRule: {
  132. reason: [{ required: true, message: '审批建议不能为空', trigger: 'blur' }],
  133. },
  134. tasks: [
  135. {
  136. "id": "f514d489-0afd-11ed-a881-427d68986255",
  137. "name": "领导审批",
  138. "claimTime": null,
  139. "createTime": 1658632137000,
  140. "suspensionState": null,
  141. "processInstance": {
  142. "id": "f51374f1-0afd-11ed-a881-427d68986255",
  143. "name": "OA 请假",
  144. "startUserId": 1,
  145. "startUserNickname": "芋道源码",
  146. "processDefinitionId": "oa_leave:3:f07c1280-0afd-11ed-a881-427d68986255"
  147. },
  148. "endTime": null,
  149. "durationInMillis": null,
  150. "result": 1,
  151. "reason": null,
  152. "definitionKey": "task-01",
  153. "assigneeUser": {
  154. "id": 1,
  155. "nickname": "芋道源码",
  156. "deptId": 103,
  157. "deptName": "研发部门"
  158. },
  159. "parentTaskId": null,
  160. "children": null
  161. }
  162. ],
  163. peopleList: ['林动', '萧炎', '叶凡'],
  164. // 表单参数
  165. form: {
  166. loginName: '张三',
  167. dept: '软件工程院',
  168. },
  169. };
  170. },
  171. created() {
  172. // this.entryId = this.id || this.$route.query.id;
  173. // console.log(this.entryId);
  174. // this.getDetail();
  175. },
  176. watch: {
  177. id: {
  178. immediate: true,
  179. handler(val) {
  180. // console.log(val);
  181. this.entryId = val;
  182. this.getDetail();
  183. }
  184. }
  185. },
  186. methods: {
  187. handleEdit() {
  188. this.$router.push({ path: '/oa/entry/edit' })
  189. },
  190. handleAudit(pass) {
  191. if (!this.reason) {
  192. this.$message({
  193. message: '请填写审批意见',
  194. type: 'warning',
  195. customClass: 'myBox'
  196. });
  197. return;
  198. } else {
  199. const data = {
  200. id: '12',
  201. reason: this.reason,
  202. auditPass:pass
  203. }
  204. if (pass) {
  205. this.$modal.msgSuccess({
  206. message: '审批通过成功!',
  207. customClass: 'myBox'
  208. });
  209. // completeTask(data).then(response => {
  210. // this.$modal.msgSuccess({
  211. // message: '审批通过成功!',
  212. // customClass: 'myBox'
  213. // });
  214. // });
  215. } else {
  216. this.$modal.msgSuccess({
  217. message: '审批不通过成功!',
  218. customClass: 'myBox'
  219. });
  220. // completeTask(data).then(response => {
  221. // this.$modal.msgSuccess({
  222. // message: '审批不通过成功!',
  223. // customClass: 'myBox'
  224. // });
  225. // });
  226. }
  227. }
  228. },
  229. getTimelineItemIcon(item) {
  230. if (item.result === 1) {
  231. return 'el-icon-time';
  232. }
  233. if (item.result === 2) {
  234. return 'el-icon-check';
  235. }
  236. if (item.result === 3) {
  237. return 'el-icon-close';
  238. }
  239. if (item.result === 4) {
  240. return 'el-icon-remove-outline';
  241. }
  242. if (item.result === 5) {
  243. return 'el-icon-back'
  244. }
  245. return '';
  246. },
  247. getTimelineItemType(item) {
  248. if (item.result === 1) {
  249. return 'primary';
  250. }
  251. if (item.result === 2) {
  252. return 'success';
  253. }
  254. if (item.result === 3) {
  255. return 'danger';
  256. }
  257. if (item.result === 4) {
  258. return 'info';
  259. }
  260. if (item.result === 5) {
  261. return 'warning';
  262. }
  263. if (item.result === 6) {
  264. return 'default'
  265. }
  266. return '';
  267. },
  268. /** 获得请假信息 */
  269. getDetail() {
  270. getDetail(this.entryId).then(response => {
  271. this.form = response.data;
  272. this.tasks = response.data.auditRecordList;
  273. });
  274. },
  275. }
  276. };
  277. </script>
  278. <style>
  279. /* .el-timeline-item__wrapper {
  280. top: -12px !important;
  281. } */
  282. </style>
  283. <style lang="scss" scoped>
  284. .widget-wrapper>.widget-list {
  285. display: flex;
  286. flex-wrap: wrap;
  287. }
  288. .x-grid-col-6 {
  289. width: 50%;
  290. }
  291. .x-grid-col-12 {
  292. width: 100%;
  293. }
  294. .fx-field {
  295. line-height: 20px;
  296. padding: 7px 12px 12px;
  297. position: relative;
  298. }
  299. .fx-field .field-label {
  300. word-wrap: break-word;
  301. color: #141e31;
  302. display: flex;
  303. font-weight: 600;
  304. line-height: 20px;
  305. padding: 5px 0;
  306. position: relative;
  307. word-break: break-word;
  308. }
  309. .fx-field .field-label .field-required {
  310. color: #eb5050;
  311. margin-left: -6px;
  312. position: relative;
  313. }
  314. .fx-field .field-label .field-name {
  315. overflow: hidden;
  316. }
  317. .field-component {
  318. word-wrap: break-word;
  319. background: #f5f6f8;
  320. border-radius: 2px;
  321. color: #141e31;
  322. font-size: 14px;
  323. line-height: 20px;
  324. min-height: 32px;
  325. padding: 6px 8px;
  326. white-space: pre-wrap;
  327. word-break: break-word;
  328. }
  329. ul {
  330. padding-left: 0px !important;
  331. }
  332. .el-tag+.el-tag {
  333. margin-left: 10px;
  334. }
  335. </style>