detail.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <div class="app-container">
  3. <!-- 对话框(添加 / 修改) -->
  4. <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  5. <el-form-item label="开始时间:" prop="startTime"> {{parseTime(form.startTime, '{y}-{m}-{d}')}} </el-form-item>
  6. <el-form-item label="结束时间:" prop="endTime"> {{parseTime(form.endTime, '{y}-{m}-{d}')}} </el-form-item>
  7. <el-form-item label="请假类型:" prop="type">{{ typeFormat(form) }}</el-form-item>
  8. <el-form-item label="原因:" prop="reason"> {{ form.reason }}</el-form-item>
  9. </el-form>
  10. </div>
  11. </template>
  12. <script>
  13. import { getLeave} from "@/api/bpm/leave"
  14. import {getDictDatas, DICT_TYPE, getDictDataLabel} from '@/utils/dict'
  15. export default {
  16. name: "LeaveDetail",
  17. components: {
  18. },
  19. data() {
  20. return {
  21. id: undefined, // 请假编号
  22. // 表单参数
  23. form: {
  24. startTime: undefined,
  25. endTime: undefined,
  26. type: undefined,
  27. reason: undefined,
  28. },
  29. typeDictData: getDictDatas(DICT_TYPE.BPM_OA_LEAVE_TYPE),
  30. };
  31. },
  32. created() {
  33. this.id = this.$route.query.id;
  34. if (!this.id) {
  35. this.$message.error('未传递 id 参数,无法查看 OA 请假信息');
  36. return;
  37. }
  38. this.getDetail();
  39. },
  40. methods: {
  41. /** 获得请假信息 */
  42. getDetail() {
  43. getLeave(this.id).then(response => {
  44. this.form = response.data;
  45. });
  46. },
  47. typeFormat(row) {
  48. return getDictDataLabel(DICT_TYPE.BPM_OA_LEAVE_TYPE, row.type)
  49. }
  50. }
  51. };
  52. </script>