| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179 |
- <template>
- <view class="task-form-container">
- <u--form style="margin: 0 20px;" labelPosition="left" :model="form" ref="uForm" labelWidth="180rpx">
- <u-form-item label="申请人" borderBottom>
- {{ applicantName || '-' }}
- </u-form-item>
- <u-form-item label="所属部门" borderBottom>
- {{ form.deptName || '-' }}
- </u-form-item>
- <u-form-item label="请假类型" borderBottom>
- {{ leaveTypeLabel }}
- </u-form-item>
- <u-form-item label="开始日期" borderBottom>
- {{ datePart(form.startTime) }}
- </u-form-item>
- <u-form-item label="开始时间" borderBottom>
- {{ timePart(form.startTime) }}
- </u-form-item>
- <u-form-item label="结束日期" borderBottom>
- {{ datePart(form.endTime) }}
- </u-form-item>
- <u-form-item label="结束时间" borderBottom>
- {{ timePart(form.endTime) }}
- </u-form-item>
- <u-form-item v-if="durationLabel" label="申请时长" borderBottom>
- {{ durationLabel }}
- </u-form-item>
- <u-form-item label="申请事由" borderBottom>
- {{ form.reason || '-' }}
- </u-form-item>
- <u-form-item label="附件" borderBottom>
- <view v-if="attachmentIds.length" class="attachment-row">
- <fileMain :value="attachmentIds" type="view"></fileMain>
- </view>
- <text v-else>-</text>
- </u-form-item>
- </u--form>
- </view>
- </template>
- <script>
- import { getAttendanceApplicationDetail } from '@/api/hr/attendanceApply';
- import fileMain from '@/pages/doc/index.vue';
- // 请假类型枚举(与 /hr/attendance/applications 的 leaveType 口径一致)
- const LEAVE_TYPE_LABELS = {
- ANNUAL: '年假',
- PERSONAL: '事假',
- SICK: '病假',
- COMPENSATORY: '调休假',
- MARRIAGE: '婚假',
- MATERNITY: '产假',
- PATERNITY: '陪产假',
- BEREAVEMENT: '丧假',
- OTHER: '其他',
- };
- export default {
- components: { fileMain },
- props: {
- bizType: {
- type: String,
- default: ''
- },
- businessId: {
- type: String,
- default: ''
- },
- taskId: {
- type: String,
- default: ''
- },
- // 流程实例主键(processTask 透传),详情从流程表单变量取
- id: {
- type: String,
- default: ''
- },
- taskDefinitionKey: {
- type: String,
- default: ''
- },
- isUpload: {
- type: Boolean,
- default: false
- },
- isInterior: {
- type: Boolean,
- default: true
- },
- isIds: {
- type: Boolean,
- default: false
- }
- },
- data() {
- return {
- form: {},
- startUser: {},
- };
- },
- computed: {
- applicantName() {
- return this.form.userName || this.form.applicantName || '';
- },
- leaveTypeLabel() {
- const code = this.form.leaveType;
- if (!code) return '-';
- return LEAVE_TYPE_LABELS[code] || code;
- },
- durationLabel() {
- const minutes = Number(this.form.durationMinutes);
- if (!minutes || isNaN(minutes) || minutes <= 0) return '';
- const hours = Math.floor(minutes / 60);
- const mins = minutes % 60;
- if (!hours) return `${mins} 分钟`;
- if (!mins) return `${hours} 小时`;
- return `${hours} 小时 ${mins} 分钟`;
- },
- attachmentIds() {
- const raw = this.form.attachmentFileIds;
- if (!raw) return [];
- return String(raw)
- .split(',')
- .map((item) => item.trim())
- .filter(Boolean);
- },
- },
- watch: {
- businessId(val) {
- if (val) this._getInfo();
- }
- },
- mounted() {
- this._getInfo();
- },
- methods: {
- async _getInfo() {
- // 审批处理看的是完整表单:待办任务上的 businessId 就是考勤申请业务主键
- // (对应 ESS 列表 row.businessId),直接查 /hr/attendance/applications/{businessId};
- // 不要拿它去调 /hr/ess/admin/applications/{id}(那个要的是 row.id 索引主键)
- if (!this.businessId) return;
- try {
- this.form =
- (await getAttendanceApplicationDetail(this.businessId, false)) || {};
- } catch (e) {
- console.log("[考勤审批] 审批详情加载失败:", (e && e.message) || e);
- }
- },
- datePart(val) {
- const text = String(val || '');
- if (!text) return '-';
- return text.split('T')[0].split(' ')[0];
- },
- timePart(val) {
- const text = String(val || '');
- if (!text) return '-';
- const time = text.split('T')[1] || text.split(' ')[1] || '';
- return time ? time.slice(0, 5) : '-';
- },
- getTableValue() {
- return {};
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .task-form-container {
- background-color: #fff;
- padding-bottom: 40rpx;
- }
- .attachment-row {
- width: 100%;
- display: flex;
- justify-content: flex-end;
- }
- </style>
|