| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <template>
- <view class="document-form">
- <uv-loading-icon v-if="loading" mode="circle" text="正在加载奖项荣誉详情..."></uv-loading-icon>
- <template v-else-if="form">
- <!-- 基本信息 -->
- <CommonSection title="基本信息" :isFirst="true">
- <CommonInfoRow label="所在部门" :value="form.deptName" />
- <CommonInfoRow label="批文年月日" :value="formatDate(form.awardDate)" />
- <CommonInfoRow label="奖项所属年度" :value="form.awardYear ? formatDate(form.awardYear, 'YYYY') : '-'" />
- <CommonInfoRow label="获奖项目名称" :value="form.projectSource" />
- <CommonInfoRow label="获奖类别" :value="form.awardType === '10' ? '教学成果' : '科研奖项'" />
- <CommonInfoRow label="获奖等级" :value="getDictLabel('sci_awards_grade', form.awardGrade)" />
- <CommonInfoRow label="获奖级别" :value="getDictLabel('sci_awards_level', form.awardLevel)" />
- <CommonInfoRow label="获奖人(备案人)" :value="form.members || showMembers(form.memberList)" />
- <CommonInfoRow label="全部获奖完成人(按获奖顺序排列)" :value="form.remark" isColumn />
- <CommonInfoRow label="颁奖机构" :value="form.awardIssueAuthority" />
- <CommonInfoRow label="完成单位" :value="form.completionUnit" />
- <CommonInfoRow label="获奖金额" :value="'¥' + amountUnitTransferToYuan(form.awardAmount) + '元'" isAmount />
- <CommonInfoRow label="所属平台" isColumn>
- <view class="platform-tags">
- <template v-if="platformList.length > 0">
- <uv-tags v-for="(p, index) in platformList" :key="index" :text="p.platformName === '其他' ? '其他' : (p.platformType ? p.platformName + ' (' + p.platformType + ')' : p.platformName)" type="primary" plain size="mini" class="mr5"></uv-tags>
- </template>
- <text v-else>-</text>
- </view>
- </CommonInfoRow>
- <CommonInfoRow label="所属团队" :value="form.belongTeam || '-'" />
- </CommonSection>
- <!-- 电子附件 -->
- <CommonSection title="电子附件">
- <CommonInfoRow label="获奖批文" isColumn>
- <view class="file-links">
- <template v-if="awardIssueAuthorityProofList.length">
- <view class="file-item" v-for="(item, index) in awardIssueAuthorityProofList" :key="'award-proof-' + index" @click="handlePreview(item)">
- <text class="file-link">{{ item.fileName || item.name || '-' }}</text>
- </view>
- </template>
- <text v-else>-</text>
- </view>
- </CommonInfoRow>
- <CommonInfoRow label="获奖证书" isColumn>
- <view class="file-links">
- <template v-if="awardCertificateList.length">
- <view class="file-item" v-for="(item, index) in awardCertificateList" :key="'award-certificate-' + index" @click="handlePreview(item)">
- <text class="file-link">{{ item.fileName || item.name || '-' }}</text>
- </view>
- </template>
- <text v-else>-</text>
- </view>
- </CommonInfoRow>
- <CommonInfoRow label="获奖金额证明" isColumn>
- <view class="file-links">
- <template v-if="awardAmountProofList.length">
- <view class="file-item" v-for="(item, index) in awardAmountProofList" :key="'award-amount-proof-' + index" @click="handlePreview(item)">
- <text class="file-link">{{ item.fileName || item.name || '-' }}</text>
- </view>
- </template>
- <text v-else>-</text>
- </view>
- </CommonInfoRow>
- </CommonSection>
- <!-- 审批记录 -->
- <CommonSection title="审批记录" v-if="form.id">
- <FlowTable :id="form.id" :businessCode="'奖项荣誉-' + String(form.awardCode)" defCode="sci_academic_achievement" />
- </CommonSection>
- <!-- 授权审核进度 -->
- <CommonSection title="授权审核进度" v-if="form.id">
- <FlowTable :id="form.id" :businessCode="'奖项荣誉授权-' + String(form.awardCode)" defCode="sci_academic_achievement_reward_auth" />
- </CommonSection>
- </template>
- <uv-empty v-else mode="data" text="暂无数据"></uv-empty>
- </view>
- </template>
- <script setup lang="ts">
- import { ref, onMounted, watch, computed } from 'vue';
- import { useDict } from '@/hooks/useDict';
- import { useDocumentApi } from '@/api/document';
- import { formatDate } from '@/utils/date';
- import { previewFile } from '@/utils/file';
- import to from 'await-to-js';
- import FlowTable from '@/pages/project/components/detail/FlowTable.vue';
- import CommonSection from '@/components/ui/CommonSection.vue';
- import CommonInfoRow from '@/components/ui/CommonInfoRow.vue';
- const props = defineProps<{
- code: string;
- }>();
- const { getDictLabel } = useDict('sci_awards_grade', 'sci_awards_level');
- const documentApi = useDocumentApi();
- const form = ref<any>(null);
- const loading = ref(false);
- const platformList = computed(() => {
- if (form.value?.belongPlatform) {
- try {
- const data = JSON.parse(form.value.belongPlatform);
- return Array.isArray(data) ? data : [];
- } catch (e) {
- if (form.value.belongPlatform === '其他') return [{ platformName: '其他' }];
- return [{ platformName: form.value.belongPlatform }];
- }
- }
- return [];
- });
- const parseFileList = (fileStr: string) => {
- if (!fileStr) return [];
- try {
- const files = JSON.parse(fileStr);
- return Array.isArray(files) ? files : [files];
- } catch (e) {
- return [];
- }
- };
- const awardIssueAuthorityProofList = computed(() => parseFileList(form.value?.awardIssueAuthorityProof));
- const awardCertificateList = computed(() => parseFileList(form.value?.awardCertificate));
- const awardAmountProofList = computed(() => parseFileList(form.value?.awardAmountProof));
- const handlePreview = (file: any) => {
- const url = file.fileUrl || file.url;
- const name = file.fileName || file.name;
- if (url) {
- previewFile(url, name);
- }
- };
- const fetchData = async () => {
- if (!props.code) return;
- loading.value = true;
- const awardCode = props.code.includes('-') ? props.code.split('-')[1] : props.code;
- const [err, res] = await to(documentApi.getAwardsByCode(awardCode));
- if (!err && res?.data) {
- form.value = res.data;
- }
- loading.value = false;
- };
- onMounted(() => {
- fetchData();
- });
- watch(() => props.code, () => {
- fetchData();
- });
- const showMembers = (list: any[]) => {
- return list?.map(m => m.memberName).join(', ') || '-';
- };
- const amountUnitTransferToYuan = (amount: number | string) => {
- const num = Number(amount || 0);
- const amountInYuan = num * 10000;
- const formattedYuan = amountInYuan.toFixed(2);
- const parts = formattedYuan.split('.');
- const integerPart = parts[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
- const decimalPart = parts[1];
- return `${integerPart}.${decimalPart}`;
- };
- </script>
- <style lang="scss" scoped>
- @import "./common.scss";
- .platform-tags {
- display: flex;
- flex-wrap: wrap;
- justify-content: flex-end;
- gap: 8rpx;
-
- .platform-tag {
- font-size: 20rpx;
- padding: 2rpx 12rpx;
- background-color: #f6f8fa;
- color: #64748b;
- border-radius: 4rpx;
- border: 1rpx solid #e2e8f0;
- }
- }
- .file-links {
- .file-item {
- padding: 6rpx 0;
- }
- .file-link {
- color: #2979ff;
- text-decoration: underline;
- word-break: break-all;
- }
- }
- </style>
|