更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -1,7 +1,6 @@
|
||||
<template>
|
||||
<view class="page">
|
||||
<view class="body">
|
||||
<!-- ==================== 今日打卡 ==================== -->
|
||||
<view class="punch-card">
|
||||
<view class="punch-head">
|
||||
<view class="head-left">
|
||||
@@ -25,7 +24,6 @@
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<!-- 未匹配排班等提醒:只提示,不阻断打卡 -->
|
||||
<view v-if="warning" class="warn-bar">
|
||||
<FaIcon name="triangle-exclamation" color="#b45309" :size="14" />
|
||||
<text class="warn-text">{{ warning }}</text>
|
||||
@@ -49,6 +47,17 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view v-if="record.id && (record.fix_status_text || canFix(record))" class="punch-fix">
|
||||
<text
|
||||
v-if="record.fix_status_text"
|
||||
class="fix-chip"
|
||||
:class="fixChipClass(record)"
|
||||
@tap="openFixApproval(record)"
|
||||
>{{ record.fix_status_text }} · 查看审批 ›</text>
|
||||
<text v-else class="punch-fix-tip">打卡异常?可申请补卡</text>
|
||||
<text v-if="canFix(record)" class="fix-link" @tap="openFixSheet(record)">补卡</text>
|
||||
</view>
|
||||
|
||||
<view class="punch-actions">
|
||||
<view class="punch-btn is-in" :class="{ 'is-disabled': !canClockIn, 'is-busy': punching }" @tap="punch('in')">
|
||||
<text class="btn-title">{{ record.clock_in_hm ? '已签到' : '签到' }}</text>
|
||||
@@ -61,7 +70,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- ==================== 近 7 天 ==================== -->
|
||||
<view v-if="recentDays.length" class="week-card">
|
||||
<view class="block-head">
|
||||
<text class="block-title">近 7 天</text>
|
||||
@@ -82,7 +90,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- ==================== 考勤卡(本月 / 本季 / 本年) ==================== -->
|
||||
<view class="stat-card">
|
||||
<view class="block-head">
|
||||
<text class="block-title">考勤卡</text>
|
||||
@@ -107,7 +114,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- ==================== 考勤记录 ==================== -->
|
||||
<view class="list-card">
|
||||
<view class="block-head">
|
||||
<text class="block-title">考勤记录</text>
|
||||
@@ -139,6 +145,15 @@
|
||||
<text class="rm-punch">签退 {{ item.clock_out_hm || '--:--' }}</text>
|
||||
</view>
|
||||
<text v-if="recordNote(item)" class="rm-note">{{ recordNote(item) }}</text>
|
||||
<view v-if="item.fix_status_text || canFix(item)" class="rm-foot">
|
||||
<text
|
||||
v-if="item.fix_status_text"
|
||||
class="fix-chip"
|
||||
:class="fixChipClass(item)"
|
||||
@tap="openFixApproval(item)"
|
||||
>{{ item.fix_status_text }} · 查看审批 ›</text>
|
||||
<text v-if="canFix(item)" class="fix-link" @tap="openFixSheet(item)">补卡</text>
|
||||
</view>
|
||||
</view>
|
||||
<text class="record-status" :class="dayClass(item.day_status)">{{ item.day_status_text }}</text>
|
||||
</view>
|
||||
@@ -151,18 +166,70 @@
|
||||
|
||||
<view class="bottom-space" />
|
||||
</view>
|
||||
|
||||
<view v-if="fixVisible" class="fix-mask" @tap="closeFixSheet">
|
||||
<view class="fix-sheet" @tap.stop>
|
||||
<view class="fix-head">
|
||||
<text class="fix-cancel" @tap="closeFixSheet">取消</text>
|
||||
<text class="fix-title">补卡申请</text>
|
||||
<text class="fix-submit" :class="{ disabled: fixSubmitting }" @tap="submitFix">
|
||||
{{ fixSubmitting ? '提交中…' : '提交' }}
|
||||
</text>
|
||||
</view>
|
||||
|
||||
<view class="fix-body">
|
||||
<view class="fix-info">
|
||||
<text class="fix-info-date">{{ fixForm.date }}</text>
|
||||
<text class="fix-info-shift">{{ fixForm.shift }}</text>
|
||||
</view>
|
||||
<text class="fix-desc">迟到、早退、缺卡可申请补卡。提交后进入审批,通过后当天打卡恢复正常;审批单与审批意见仍可在审批中心查看。</text>
|
||||
|
||||
<text class="fix-label">补卡类型</text>
|
||||
<view class="fix-types">
|
||||
<view
|
||||
v-for="opt in fixTypeOptions"
|
||||
:key="opt.value"
|
||||
class="fix-type"
|
||||
:class="{ on: fixForm.fixType === opt.value }"
|
||||
@tap="chooseFixType(opt)"
|
||||
>
|
||||
<text class="fix-type-text">{{ opt.label }}</text>
|
||||
<text class="fix-type-sub">{{ opt.sub }}</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<template v-if="fixForm.needTime">
|
||||
<text class="fix-label">实际打卡时间</text>
|
||||
<picker mode="time" :value="fixForm.fixTime" @change="onFixTimeChange">
|
||||
<view class="fix-input" :class="{ placeholder: !fixForm.fixTime }">
|
||||
{{ fixForm.fixTime || '请选择时间' }}
|
||||
</view>
|
||||
</picker>
|
||||
</template>
|
||||
|
||||
<text class="fix-label">补卡原因</text>
|
||||
<textarea
|
||||
v-model="fixForm.reason"
|
||||
class="fix-textarea"
|
||||
placeholder="请说明迟到 / 早退 / 缺卡原因"
|
||||
:maxlength="200"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { computed, ref } from 'vue'
|
||||
import { computed, reactive, ref } from 'vue'
|
||||
import { onHide, onReachBottom, onShow, onUnload } from '@dcloudio/uni-app'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
import {
|
||||
clockAttendance,
|
||||
fetchAttendanceStats,
|
||||
fetchAttendanceToday,
|
||||
fetchMyAttendanceRecords
|
||||
fetchMyAttendanceRecords,
|
||||
submitAttendanceFix
|
||||
} from '@/api/oaAttendance.js'
|
||||
|
||||
const WEEKDAY_LABELS = ['', '周一', '周二', '周三', '周四', '周五', '周六', '周日']
|
||||
@@ -245,7 +312,6 @@ const statItems = computed(() => {
|
||||
]
|
||||
})
|
||||
|
||||
// 近 7 天:后端按「最近在前」返回,这里翻成从左到右的时间轴
|
||||
const recentDays = computed(() => {
|
||||
const list = Array.isArray(today.value.recent) ? today.value.recent : []
|
||||
return list.slice().reverse()
|
||||
@@ -316,6 +382,130 @@ function recordNote(item) {
|
||||
return item.clock_out_note || item.clock_in_note || ''
|
||||
}
|
||||
|
||||
const FIX_RUNNING = 1
|
||||
const fixVisible = ref(false)
|
||||
const fixSubmitting = ref(false)
|
||||
const fixTypeOptions = ref([])
|
||||
const fixForm = reactive({
|
||||
recordId: 0,
|
||||
date: '',
|
||||
shift: '',
|
||||
fixType: 1,
|
||||
needTime: false,
|
||||
fixTime: '',
|
||||
reason: ''
|
||||
})
|
||||
|
||||
function abnormalSides(item) {
|
||||
const bad = (status) => [2, 3, 4].includes(Number(status))
|
||||
const sides = []
|
||||
if (!item.clock_in_hm || bad(item.clock_in_status)) {
|
||||
sides.push({
|
||||
value: 1,
|
||||
label: '签到补卡',
|
||||
sub: item.clock_in_hm ? `当前 ${item.clock_in_hm} ${item.clock_in_text || '异常'}` : '未签到(缺卡)',
|
||||
needTime: !item.clock_in_hm
|
||||
})
|
||||
}
|
||||
if (!item.clock_out_hm || bad(item.clock_out_status)) {
|
||||
sides.push({
|
||||
value: 2,
|
||||
label: '签退补卡',
|
||||
sub: item.clock_out_hm ? `当前 ${item.clock_out_hm} ${item.clock_out_text || '异常'}` : '未签退(缺卡)',
|
||||
needTime: !item.clock_out_hm
|
||||
})
|
||||
}
|
||||
return sides
|
||||
}
|
||||
|
||||
function canFix(item) {
|
||||
if (!item || !item.id) return false
|
||||
return Number(item.day_status) !== 8 && abnormalSides(item).length > 0 && Number(item.fix_status) !== FIX_RUNNING
|
||||
}
|
||||
|
||||
function fixChipClass(item) {
|
||||
switch (Number(item.fix_status)) {
|
||||
case 1:
|
||||
return 'is-running'
|
||||
case 2:
|
||||
return 'is-done'
|
||||
case 3:
|
||||
return 'is-reject'
|
||||
default:
|
||||
return 'is-muted'
|
||||
}
|
||||
}
|
||||
|
||||
function openFixApproval(item) {
|
||||
const id = Number(item.fix_instance_id || 0)
|
||||
if (!id) {
|
||||
uni.showToast({ title: '暂无审批单,请稍后重试', icon: 'none' })
|
||||
return
|
||||
}
|
||||
uni.navigateTo({ url: `/pages/approval/detail?id=${id}` })
|
||||
}
|
||||
|
||||
function openFixSheet(item) {
|
||||
const sides = abnormalSides(item)
|
||||
if (!sides.length) {
|
||||
uni.showToast({ title: '当前记录无需补卡', icon: 'none' })
|
||||
return
|
||||
}
|
||||
fixTypeOptions.value = sides
|
||||
const first = sides[0]
|
||||
fixForm.recordId = item.id
|
||||
fixForm.date = item.attend_date
|
||||
fixForm.shift = item.shift_name || '未匹配排班'
|
||||
fixForm.fixType = first.value
|
||||
fixForm.needTime = first.needTime
|
||||
fixForm.fixTime = ''
|
||||
fixForm.reason = ''
|
||||
fixVisible.value = true
|
||||
}
|
||||
|
||||
function closeFixSheet() {
|
||||
if (!fixSubmitting.value) fixVisible.value = false
|
||||
}
|
||||
|
||||
function chooseFixType(opt) {
|
||||
fixForm.fixType = opt.value
|
||||
fixForm.needTime = opt.needTime
|
||||
if (!opt.needTime) fixForm.fixTime = ''
|
||||
}
|
||||
|
||||
function onFixTimeChange(e) {
|
||||
fixForm.fixTime = (e && e.detail && e.detail.value) || ''
|
||||
}
|
||||
|
||||
async function submitFix() {
|
||||
if (fixSubmitting.value) return
|
||||
const reason = String(fixForm.reason || '').trim()
|
||||
if (!reason) {
|
||||
uni.showToast({ title: '请填写补卡原因', icon: 'none' })
|
||||
return
|
||||
}
|
||||
if (fixForm.needTime && !fixForm.fixTime) {
|
||||
uni.showToast({ title: '请选择实际打卡时间', icon: 'none' })
|
||||
return
|
||||
}
|
||||
fixSubmitting.value = true
|
||||
try {
|
||||
const data = await submitAttendanceFix({
|
||||
recordId: fixForm.recordId,
|
||||
fixType: fixForm.fixType,
|
||||
fixTime: fixForm.needTime ? fixForm.fixTime : '',
|
||||
reason
|
||||
})
|
||||
fixVisible.value = false
|
||||
uni.showToast({ title: (data && data.message) || '补卡申请已提交', icon: 'success' })
|
||||
await Promise.all([loadToday(), loadRecords(true)])
|
||||
} catch (error) {
|
||||
uni.showToast({ title: (error && error.message) || '补卡申请提交失败', icon: 'none' })
|
||||
} finally {
|
||||
fixSubmitting.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function confirmDialog(title, content) {
|
||||
return new Promise((resolve) => {
|
||||
uni.showModal({
|
||||
@@ -343,13 +533,11 @@ async function loadToday() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 月度卡标题(today 接口只返回区间数字,标题在前端拼) */
|
||||
function monthLabel() {
|
||||
const now = new Date()
|
||||
return `${now.getFullYear()} 年 ${now.getMonth() + 1} 月`
|
||||
}
|
||||
|
||||
/** 切换考勤卡维度:本月 / 本季 / 本年(后端返回统一口径的统计) */
|
||||
async function loadStats(period) {
|
||||
if (statsLoading.value || (statsPeriod.value === period && statsLabel.value)) {
|
||||
return
|
||||
@@ -407,7 +595,6 @@ async function punch(type) {
|
||||
return
|
||||
}
|
||||
|
||||
// 排班匹配不上:先提醒,确认后仍可打卡
|
||||
if (warning.value) {
|
||||
const ok = await confirmDialog('排班提醒', `${warning.value}\n\n是否继续${type === 'in' ? '签到' : '签退'}?`)
|
||||
if (!ok) return
|
||||
@@ -471,7 +658,6 @@ onReachBottom(() => {
|
||||
padding: 28rpx $page-padding-x 0;
|
||||
}
|
||||
|
||||
/* ==================== 今日打卡 ==================== */
|
||||
.punch-card {
|
||||
@include card;
|
||||
padding: 28rpx 24rpx 24rpx;
|
||||
@@ -688,7 +874,6 @@ onReachBottom(() => {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* ==================== 近 7 天 ==================== */
|
||||
.week-card,
|
||||
.stat-card,
|
||||
.list-card {
|
||||
@@ -844,7 +1029,6 @@ onReachBottom(() => {
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
/* ==================== 考勤记录 ==================== */
|
||||
.state-box {
|
||||
padding: 60rpx 0;
|
||||
display: flex;
|
||||
@@ -966,4 +1150,203 @@ onReachBottom(() => {
|
||||
.bottom-space {
|
||||
height: 40rpx;
|
||||
}
|
||||
|
||||
.punch-fix {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
margin-top: 20rpx;
|
||||
}
|
||||
|
||||
.punch-fix-tip {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
font-size: 22rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.rm-foot {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 12rpx;
|
||||
margin-top: 8rpx;
|
||||
}
|
||||
|
||||
.fix-chip {
|
||||
font-size: 22rpx;
|
||||
padding: 6rpx 14rpx;
|
||||
border-radius: $radius-full;
|
||||
background: #f1f5f9;
|
||||
|
||||
&.is-running { color: $color-primary; background: #e8f1ff; }
|
||||
&.is-done { color: $color-success; background: #e7f8ee; }
|
||||
&.is-reject { color: $color-danger; background: #fef2f2; }
|
||||
&.is-muted { color: $color-text-muted; }
|
||||
}
|
||||
|
||||
.fix-link {
|
||||
font-size: 24rpx;
|
||||
color: $color-primary;
|
||||
padding: 6rpx 14rpx;
|
||||
border: 1rpx solid $color-primary;
|
||||
border-radius: $radius-full;
|
||||
|
||||
&:active { opacity: 0.6; }
|
||||
}
|
||||
|
||||
.fix-mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1000;
|
||||
display: flex;
|
||||
align-items: flex-end;
|
||||
background: rgba(15, 23, 42, 0.48);
|
||||
@include mask-responsive;
|
||||
}
|
||||
|
||||
.fix-sheet {
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
padding: 28rpx $page-padding-x 40rpx;
|
||||
padding-bottom: calc(40rpx + env(safe-area-inset-bottom));
|
||||
border-radius: 32rpx 32rpx 0 0;
|
||||
background: #ffffff;
|
||||
@include sheet-responsive;
|
||||
}
|
||||
|
||||
.fix-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 24rpx;
|
||||
}
|
||||
|
||||
.fix-cancel {
|
||||
font-size: 26rpx;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.fix-title {
|
||||
font-size: 32rpx;
|
||||
font-weight: 700;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.fix-submit {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $color-primary;
|
||||
|
||||
&.disabled { opacity: 0.55; }
|
||||
}
|
||||
|
||||
.fix-body {
|
||||
max-height: 65vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.fix-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 16rpx;
|
||||
padding: 20rpx;
|
||||
border-radius: $radius-md;
|
||||
background: #f8fafc;
|
||||
}
|
||||
|
||||
.fix-info-date {
|
||||
font-size: 28rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.fix-info-shift {
|
||||
font-size: 24rpx;
|
||||
color: $color-text-secondary;
|
||||
}
|
||||
|
||||
.fix-desc {
|
||||
display: block;
|
||||
margin: 20rpx 0 8rpx;
|
||||
font-size: 22rpx;
|
||||
line-height: 1.6;
|
||||
color: $color-text-muted;
|
||||
}
|
||||
|
||||
.fix-label {
|
||||
display: block;
|
||||
margin: 22rpx 0 12rpx;
|
||||
font-size: 25rpx;
|
||||
font-weight: 600;
|
||||
color: #334155;
|
||||
}
|
||||
|
||||
.fix-types {
|
||||
display: flex;
|
||||
gap: 16rpx;
|
||||
}
|
||||
|
||||
.fix-type {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
padding: 18rpx 20rpx;
|
||||
box-sizing: border-box;
|
||||
border: 2rpx solid #e2e8f0;
|
||||
border-radius: $radius-md;
|
||||
background: #ffffff;
|
||||
|
||||
&.on {
|
||||
border-color: $color-primary;
|
||||
background: #f2f7ff;
|
||||
}
|
||||
}
|
||||
|
||||
.fix-type-text {
|
||||
display: block;
|
||||
font-size: 27rpx;
|
||||
font-weight: 600;
|
||||
color: $color-text;
|
||||
}
|
||||
|
||||
.fix-type-sub {
|
||||
display: block;
|
||||
margin-top: 6rpx;
|
||||
font-size: 21rpx;
|
||||
color: $color-text-muted;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.fix-input {
|
||||
height: 88rpx;
|
||||
line-height: 88rpx;
|
||||
padding: 0 22rpx;
|
||||
box-sizing: border-box;
|
||||
border: 1rpx solid #dce7f7;
|
||||
border-radius: $radius-md;
|
||||
background: #fbfdff;
|
||||
font-size: 28rpx;
|
||||
color: $color-text;
|
||||
|
||||
&.placeholder { color: #adb6c9; font-size: 26rpx; }
|
||||
}
|
||||
|
||||
.fix-textarea {
|
||||
width: 100%;
|
||||
min-height: 160rpx;
|
||||
box-sizing: border-box;
|
||||
padding: 18rpx 22rpx;
|
||||
border: 1rpx solid #dce7f7;
|
||||
border-radius: $radius-md;
|
||||
background: #fbfdff;
|
||||
font-size: 27rpx;
|
||||
line-height: 1.6;
|
||||
color: $color-text;
|
||||
}
|
||||
</style>
|
||||
@@ -91,7 +91,6 @@ import {
|
||||
} from '@/api/contact.js'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
|
||||
/** 顶部大类 tab:全部 / 内部 / 外部,索引与 contact_type 对应(0 表示不筛选) */
|
||||
const TYPE_TABS = [{ name: '全部' }, { name: '内部' }, { name: '外部' }]
|
||||
const TYPE_VALUES = [0, 1, 2]
|
||||
|
||||
@@ -117,7 +116,6 @@ onMounted(() => {
|
||||
loadContacts(true)
|
||||
})
|
||||
|
||||
/** 部门下拉选项:全部 + 有内部联系人的部门(带人数) */
|
||||
const deptOptions = computed(() => {
|
||||
const options = [{ label: '全部部门', value: 0 }]
|
||||
orgs.value.forEach((org) => {
|
||||
@@ -127,7 +125,6 @@ const deptOptions = computed(() => {
|
||||
return options
|
||||
})
|
||||
|
||||
/** 组织树拍平为部门列表,只保留有内部联系人的部门 */
|
||||
function flattenOrgs(nodes, out) {
|
||||
;(nodes || []).forEach((n) => {
|
||||
if (Number(n.contact_count) > 0) {
|
||||
|
||||
@@ -191,7 +191,6 @@ function openEdit() {
|
||||
})
|
||||
}
|
||||
|
||||
// 撤销提交:退回草稿并留存修改痕迹,改完需重新提交
|
||||
function handleWithdraw() {
|
||||
uni.showModal({
|
||||
title: '撤销提交',
|
||||
|
||||
@@ -128,7 +128,6 @@ async function loadProfile() {
|
||||
const data = await fetchDailyReportProfile()
|
||||
if (data) profile.value = { ...profile.value, ...data }
|
||||
} catch (e) {
|
||||
// 窗口信息失败时仍允许按今日编辑
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +146,6 @@ async function loadDetail(id) {
|
||||
function applyDetail(data) {
|
||||
const report = data?.report
|
||||
if (!report) return
|
||||
// 已提交的日报已锁定:不进入编辑,引导到详情中撤销提交
|
||||
if (report.status === 1) {
|
||||
uni.showModal({
|
||||
title: '日报已提交',
|
||||
@@ -169,7 +167,6 @@ function applyDetail(data) {
|
||||
: []
|
||||
}
|
||||
|
||||
/** 按日期查找已有日报;载入后可直接编辑 */
|
||||
async function loadByDate(date, notify = true) {
|
||||
const data = await fetchMyDailyReports({ page: 1, pageSize: 1, startDate: date, endDate: date })
|
||||
const item = data?.list?.[0]
|
||||
@@ -255,7 +252,6 @@ async function chooseImages() {
|
||||
size: files[i]?.size || 0
|
||||
})
|
||||
} catch (e) {
|
||||
// 上传失败已提示,继续处理其余文件
|
||||
}
|
||||
}
|
||||
uploading.value = false
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- ==================== 我的日报 ==================== -->
|
||||
<view v-if="activeTab === 'mine'" class="content">
|
||||
<view class="summary-row">
|
||||
<view class="summary-item">
|
||||
@@ -160,7 +159,6 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- ==================== 团队日报 ==================== -->
|
||||
<view v-else class="content">
|
||||
<view class="team-filter">
|
||||
<picker mode="date" :value="teamDate" :end="today" @change="onTeamDateChange">
|
||||
@@ -268,7 +266,6 @@ const mineList = ref([])
|
||||
const minePage = ref(1)
|
||||
const hasMore = ref(false)
|
||||
|
||||
// 近期热力图(近三个月)
|
||||
const calendarDays = ref([])
|
||||
const calendarRange = ref({ start: '', end: '' })
|
||||
const calendarTotal = ref(0)
|
||||
@@ -303,7 +300,6 @@ const todayStatusClass = computed(() => {
|
||||
const calendarMap = computed(() => {
|
||||
const map = new Map()
|
||||
calendarDays.value.forEach((day) => {
|
||||
// 后端 DATE 字段可能带出时间,统一截到 YYYY-MM-DD 再建索引
|
||||
const key = String(day?.date || '').slice(0, 10)
|
||||
if (key) map.set(key, day)
|
||||
})
|
||||
@@ -315,7 +311,6 @@ const calendarRangeText = computed(() => {
|
||||
return start && end ? `${start} 至 ${end}` : ''
|
||||
})
|
||||
|
||||
// 按区间生成热力图:每列一周(周一在上、周日在下),月内补空格,每月固定 6 周
|
||||
const calendarMonths = computed(() => {
|
||||
const map = calendarMap.value
|
||||
const { start, end } = calendarRange.value
|
||||
@@ -373,7 +368,6 @@ async function loadCalendar() {
|
||||
calendarTotal.value = data?.total || 0
|
||||
calendarSubmitted.value = data?.submitted || 0
|
||||
} catch (e) {
|
||||
// 热力图加载失败不阻断列表展示
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,8 +385,6 @@ function cellClass(cell) {
|
||||
return cell.isFuture ? 'is-future' : 'is-none'
|
||||
}
|
||||
|
||||
// 补写窗口内、往日尚未写日报的日期标注「补」,点击直接进入补写
|
||||
// 今天属于正常填写,未写时不标「补」
|
||||
function cellBackfill(cell) {
|
||||
if (!cell || cell.isFuture || cell.record) return false
|
||||
if (cell.date === today) return false
|
||||
@@ -497,7 +489,6 @@ function openBackfill() {
|
||||
function writeToday() {
|
||||
const id = summary.value.today_report_id
|
||||
if (id) {
|
||||
// 已提交的日报已锁定,直接进详情,可在详情中撤销提交
|
||||
if (summary.value.today_status === 1) {
|
||||
uni.showToast({ title: '今日日报已提交并锁定,可先在详情中撤销提交', icon: 'none' })
|
||||
openDetail(id)
|
||||
@@ -518,13 +509,11 @@ function previewText(item) {
|
||||
return text || '暂无内容'
|
||||
}
|
||||
|
||||
// ---------------- 团队 ----------------
|
||||
async function loadTeamOrgs() {
|
||||
try {
|
||||
const data = await fetchTeamDailyReportOrgs()
|
||||
orgOptions.value = data?.list || []
|
||||
} catch (e) {
|
||||
// 部门列表失败不阻断团队汇总主流程
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,6 @@ async function loadDetail() {
|
||||
}
|
||||
}
|
||||
|
||||
/** 把可能的相对地址补全为绝对地址 */
|
||||
function absoluteUrl(url) {
|
||||
const value = String(url || '').trim()
|
||||
if (!value) return ''
|
||||
|
||||
@@ -127,10 +127,6 @@ const file = ref(null)
|
||||
const records = ref([])
|
||||
const loading = ref(true)
|
||||
|
||||
/**
|
||||
* 档案 ID。
|
||||
* 带 id(HR 从列表进入)看指定员工档案;不带 id 则看本人档案。
|
||||
*/
|
||||
const fileId = ref(0)
|
||||
|
||||
const avatarText = computed(() => {
|
||||
@@ -199,7 +195,6 @@ onLoad((options) => {
|
||||
uni.reLaunch({ url: '/pages/login/login' })
|
||||
return
|
||||
}
|
||||
// 带 id 进入(HR 从档案列表进入)看指定员工档案;不带 id 则看本人档案
|
||||
fileId.value = Number((options && options.id) || 0)
|
||||
loadFile()
|
||||
})
|
||||
|
||||
@@ -82,12 +82,6 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 员工档案(HR 视角):展示全公司员工的档案列表。
|
||||
*
|
||||
* 权限口径:租户角色里勾选了「员工档案」菜单即为 HR,可见全公司档案;
|
||||
* 未开通该权限的用户自动降级为查看本人档案(跳详情页),与旧版行为一致。
|
||||
*/
|
||||
import { ref, computed } from 'vue'
|
||||
import { onLoad } from '@dcloudio/uni-app'
|
||||
import {
|
||||
@@ -95,11 +89,9 @@ import {
|
||||
fetchEmployeeFiles,
|
||||
getEmploymentStatusLabel
|
||||
} from '@/api/oa.js'
|
||||
// 组织树复用通讯录接口(同一套组织数据,仅用于部门筛选)
|
||||
import { fetchContactOrgTree } from '@/api/contact.js'
|
||||
import { isLoggedIn } from '@/utils/auth.js'
|
||||
|
||||
/** 在职状态 tab:全部 / 试用 / 正式 / 离职,索引与 employment_status 对应(0 表示不筛选) */
|
||||
const STATUS_TABS = [{ name: '全部' }, { name: '试用' }, { name: '正式' }, { name: '离职' }]
|
||||
const STATUS_VALUES = [0, 1, 2, 3]
|
||||
|
||||
@@ -131,7 +123,6 @@ async function init() {
|
||||
canViewAll = false
|
||||
}
|
||||
if (!canViewAll) {
|
||||
// 无 HR 权限:保持原有「只能看本人档案」的行为
|
||||
uni.redirectTo({ url: '/pages/oa/employeefile/detail' })
|
||||
return
|
||||
}
|
||||
@@ -139,14 +130,12 @@ async function init() {
|
||||
loadFiles(true)
|
||||
}
|
||||
|
||||
/** 部门下拉选项:全部 + 各部门(组织树含子级,展开为平铺列表) */
|
||||
const deptOptions = computed(() => {
|
||||
const options = [{ label: '全部部门', value: 0 }]
|
||||
flattenOrgs(orgs.value, options)
|
||||
return options
|
||||
})
|
||||
|
||||
/** 组织树拍平为部门列表 */
|
||||
function flattenOrgs(nodes, out) {
|
||||
;(nodes || []).forEach((node) => {
|
||||
if (node.org_name) {
|
||||
@@ -160,7 +149,6 @@ function flattenOrgs(nodes, out) {
|
||||
|
||||
async function loadOrgTree() {
|
||||
try {
|
||||
// 复用通讯录的组织树接口:同一套组织数据,仅用于筛选,不涉及联系人明细
|
||||
const tree = await fetchContactOrgTree()
|
||||
orgs.value = Array.isArray(tree) ? tree : []
|
||||
} catch (e) {
|
||||
|
||||
@@ -3,10 +3,5 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · functions 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubFunctions from '@/components/sub/SubFunctions.vue'
|
||||
</script>
|
||||
@@ -3,10 +3,5 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · home 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubHome from '@/components/sub/SubHome.vue'
|
||||
</script>
|
||||
@@ -3,10 +3,5 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · 我的页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubMine.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubMine from '@/components/sub/SubMine.vue'
|
||||
</script>
|
||||
@@ -67,7 +67,6 @@ onMounted(() => {
|
||||
loadDetail()
|
||||
})
|
||||
|
||||
/** 公告级别 → u-tag 类型:1 重要 / 2 紧急 / 其他 普通 */
|
||||
function levelTagType(level) {
|
||||
const n = Number(level)
|
||||
if (n === 1) return 'warning'
|
||||
|
||||
@@ -80,7 +80,6 @@ function clearSearch() {
|
||||
loadNotices()
|
||||
}
|
||||
|
||||
/** 公告级别 → uview tag 类型 */
|
||||
function levelTagType(level) {
|
||||
const n = Number(level)
|
||||
if (n === 1) return 'warning'
|
||||
|
||||
@@ -3,10 +3,5 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* oa 子系统 · todo 页。
|
||||
* 页面逻辑全部收敛在 components/sub/SubXxx.vue,这里只做 slug 绑定,
|
||||
* 便于统一维护;该子系统拥有独立的页面目录与独立 tabbar。
|
||||
*/
|
||||
import SubTodo from '@/components/sub/SubTodo.vue'
|
||||
</script>
|
||||
Reference in new issue
Block a user