feat(work-results): support historical project outcomes
This commit is contained in:
@@ -2,12 +2,19 @@
|
||||
<view class="page supervisor-result-page">
|
||||
<view class="page-head">
|
||||
<button class="back" @click="goBack">‹</button>
|
||||
<view class="head-copy"><text class="title">团队今日成果</text><text class="subtitle">{{ result?.projectName || currentProject?.projectName || '当前项目' }} · {{ workDate }}</text></view>
|
||||
<view class="head-copy"><text class="title">团队工作成果</text><text class="subtitle">{{ result?.projectName || currentProject?.projectName || '当前项目' }} · {{ workDate }}</text></view>
|
||||
<button class="refresh" @click="load">刷新</button>
|
||||
</view>
|
||||
<WorkDateSelector
|
||||
v-if="currentProject"
|
||||
:model-value="workDate"
|
||||
:max-date="today"
|
||||
:disabled="loading"
|
||||
@change="changeWorkDate"
|
||||
/>
|
||||
<view v-if="message" class="message">{{ message }}</view>
|
||||
<view v-if="result" class="metrics">
|
||||
<view><text class="num">{{ result.contributorCount }}</text><text>今日记录人数</text></view>
|
||||
<view><text class="num">{{ result.contributorCount }}</text><text>记录人数</text></view>
|
||||
<view><text class="num">{{ result.resultCount }}</text><text>已形成成果</text></view>
|
||||
<view><text class="num warn">{{ result.pendingCount }}</text><text>待跟进</text></view>
|
||||
<view><text class="num danger">{{ result.highPriorityCount }}</text><text>高优问题</text></view>
|
||||
@@ -29,13 +36,13 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="result && !result.members.length" class="empty">当前项目今天还没有已确认的工作记录。</view>
|
||||
<view v-if="result && !result.members.length" class="empty">{{ emptyMessage }}</view>
|
||||
<SupervisorTabBar active="today" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import { computed, ref } from 'vue';
|
||||
import { onShow } from '@dcloudio/uni-app';
|
||||
import type { MobileProject, ProjectWorkResult, WorkResult, WorkResultItem } from '@/types/api';
|
||||
import { getCurrentProject, reconcileCurrentProject } from '@/services/auth';
|
||||
@@ -44,12 +51,18 @@ import { updateAssistantCaptureStatus } from '@/services/personal-assistant';
|
||||
import { openProtectedSource } from '@/services/source-preview';
|
||||
import { getProjectWorkResult } from '@/services/work-results';
|
||||
import SupervisorTabBar from '@/components/SupervisorTabBar.vue';
|
||||
import WorkDateSelector from '@/components/WorkDateSelector.vue';
|
||||
|
||||
const result = ref<ProjectWorkResult | null>(null);
|
||||
const currentProject = ref<MobileProject | null>(getCurrentProject());
|
||||
const message = ref('');
|
||||
const loading = ref(false);
|
||||
const workDate = new Date().toLocaleDateString('sv-SE', { timeZone: 'Asia/Shanghai' });
|
||||
const currentDate = () => new Date().toLocaleDateString('sv-SE', { timeZone: 'Asia/Shanghai' });
|
||||
const today = ref(currentDate());
|
||||
const workDate = ref(today.value);
|
||||
const emptyMessage = computed(() => workDate.value === today.value
|
||||
? '当前项目今天还没有已确认的工作记录。'
|
||||
: '当前项目这一天没有已确认的工作记录。');
|
||||
const memberItems = (member: WorkResult) => Object.values(member.sections || {}).flat();
|
||||
|
||||
const load = async () => {
|
||||
@@ -60,13 +73,18 @@ const load = async () => {
|
||||
const identity = await fetchMobileIdentity();
|
||||
currentProject.value = reconcileCurrentProject(identity.projects || []);
|
||||
if (!currentProject.value) throw new Error('请先选择当前项目');
|
||||
result.value = await getProjectWorkResult(currentProject.value.projectCode, workDate);
|
||||
result.value = await getProjectWorkResult(currentProject.value.projectCode, workDate.value);
|
||||
} catch (error) {
|
||||
message.value = error instanceof Error ? error.message : '团队成果读取失败';
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
};
|
||||
const changeWorkDate = (value: string) => {
|
||||
workDate.value = value;
|
||||
result.value = null;
|
||||
void load();
|
||||
};
|
||||
const advance = async (item: WorkResultItem) => {
|
||||
const next = item.businessStatus === 'IN_PROGRESS' ? 'COMPLETED' : 'IN_PROGRESS';
|
||||
try { await updateAssistantCaptureStatus(item.captureId, next); await load(); }
|
||||
@@ -75,7 +93,10 @@ const advance = async (item: WorkResultItem) => {
|
||||
const openSource = (item: WorkResultItem) => openProtectedSource(item.sourceUrl, item.sourceType);
|
||||
const sourceLabel = (value: string) => ({ TEXT: '文字来源', VOICE: '原始语音', IMAGE: '现场照片', VIDEO: '现场视频' }[value] || '原始来源');
|
||||
const goBack = () => uni.navigateBack({ fail: () => uni.redirectTo({ url: '/pages/supervisor/index/index' }) });
|
||||
onShow(load);
|
||||
onShow(() => {
|
||||
today.value = currentDate();
|
||||
load();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user