diff --git a/src/views/gh/improvementProposal/ImprovementProposal.data.ts b/src/views/gh/improvementProposal/ImprovementProposal.data.ts index 25f1925..e810b03 100644 --- a/src/views/gh/improvementProposal/ImprovementProposal.data.ts +++ b/src/views/gh/improvementProposal/ImprovementProposal.data.ts @@ -16,8 +16,16 @@ export const columns: BasicColumn[] = [ { title: '提案名称', align:"center", - dataIndex: 'proposalName' + dataIndex: 'proposalName', + width:250 }, + { + title: '提案类别', + align:"center", + dataIndex: 'proposalCategory_dictText', + width:110 + + }, { title: '最终奖项', align:"center", @@ -63,13 +71,7 @@ export const columns: BasicColumn[] = [ width:110 }, - { - title: '提案类别', - align:"center", - dataIndex: 'proposalCategory_dictText', - width:110 - }, { title: '问题描述', align:"center", @@ -83,9 +85,8 @@ export const columns: BasicColumn[] = [ { title: '流程状态', align:"center", - dataIndex: 'bpmStatus_dictText', - width:90 - + width:90, + dataIndex: 'bpmStatus_dictText' }, ]; diff --git a/src/views/gh/improvementProposal/components/ImprovementProposalBPMForm.vue b/src/views/gh/improvementProposal/components/ImprovementProposalBPMForm.vue index 2ff8be8..967da2e 100644 --- a/src/views/gh/improvementProposal/components/ImprovementProposalBPMForm.vue +++ b/src/views/gh/improvementProposal/components/ImprovementProposalBPMForm.vue @@ -14,7 +14,7 @@ {{ proposal.proposalNo || '-' }} {{ proposal.proposalName || '-' }} {{ formatDate(proposal.proposalDate) }} - {{ proposal.proposalCategory_dictText || proposal.proposalCategory || '-' }} + {{ proposalCategoryText }} {{ proposal.proposalDeptName || '-' }} {{ proposal.applicantName || '-' }} {{ proposal.teamName || '-' }} @@ -258,6 +258,7 @@ import Icon from '/@/components/Icon/index'; import { useMessage } from '/@/hooks/web/useMessage'; import { useUserStore } from '/@/store/modules/user'; + import { initDictOptions } from '/@/utils/dict/index'; import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue'; import SUploadFile from '/@/components/semri/fileComponent/SUploadFile.vue'; import TaskHandleInnerContent from '/@/views/super/bpm/process/personalOffice/myHandleTask/content/TaskHandleInnerContent.vue'; @@ -290,6 +291,7 @@ const savingVote = ref(false); const scoreModalVisible = ref(false); const proposal = ref({}); + const proposalCategoryText = ref('-'); const currentScore = ref(null); const voteRows = ref([]); const instituteVoteCandidates = ref([]); @@ -363,6 +365,7 @@ const mainId = processInfo.value.mainId; if (!mainId) { proposal.value = {}; + proposalCategoryText.value = '-'; currentScore.value = null; voteRows.value = []; instituteVoteCandidates.value = []; @@ -379,6 +382,7 @@ : Promise.resolve(null), ]); proposal.value = main || {}; + proposalCategoryText.value = await resolveProposalCategoryText(proposal.value); currentScore.value = myScore || null; voteRows.value = votes || []; initialAward.value = proposal.value.initialAward || ''; @@ -406,6 +410,28 @@ return processInfo.value.taskDefKey === taskDefKey; } + /** + * BPM 详情接口未必携带 JEECG 自动追加的 _dictText 字段,因此此处以字典接口兜底, + * 保证基本信息中的提案类别始终展示 proposal_category 的文本。 + */ + async function resolveProposalCategoryText(data: Recordable) { + const dictText = data.proposalCategory_dictText || data.proposalCategoryDictText; + if (dictText) return String(dictText); + + const categoryValue = data.proposalCategory; + if (categoryValue === undefined || categoryValue === null || categoryValue === '') return '-'; + + try { + const options = await initDictOptions('proposal_category'); + const matched = Array.isArray(options) + ? options.find((item) => String(item.value) === String(categoryValue)) + : undefined; + return matched?.text || matched?.label || String(categoryValue); + } catch (error) { + return String(categoryValue); + } + } + function actionPayload(extra: Recordable = {}) { return { ...processInfo.value, ...extra }; } diff --git a/src/views/gh/improvementProposal/components/ImprovementProposalForm.vue b/src/views/gh/improvementProposal/components/ImprovementProposalForm.vue index 45f88c9..9de5c3b 100644 --- a/src/views/gh/improvementProposal/components/ImprovementProposalForm.vue +++ b/src/views/gh/improvementProposal/components/ImprovementProposalForm.vue @@ -6,7 +6,7 @@ - + @@ -126,7 +126,7 @@ import { defineComponent, ref, reactive, computed, toRaw, onMounted, nextTick } from 'vue'; import { defHttp } from '/@/utils/http/axios'; import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods'; - import { queryImprovementDeptScoreListByMainId, queryImprovementInstituteVoteListByMainId, queryDataById, saveOrUpdate, getLatestProposalSequence } from '../ImprovementProposal.api'; + import { queryImprovementDeptScoreListByMainId, queryImprovementInstituteVoteListByMainId, queryDataById, saveOrUpdate } from '../ImprovementProposal.api'; import { JVxeTable } from '/@/components/jeecg/JVxeTable'; import {improvementDeptScoreColumns, improvementInstituteVoteColumns} from '../ImprovementProposal.data'; import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue'; @@ -308,20 +308,6 @@ formData.proposalDeptCode = departInfo.orgCode; } - async function getProposalSequence() { - const year = new Date().getFullYear(); - const latestSequence = await getLatestProposalSequence(year); - // return Number(latestSequence) + 1; - return String(Number(latestSequence) + 1).padStart(4, '0'); - } - - async function generateProposalNo() { - const deptCode = formData.proposalDeptName || ''; - const year = new Date().getFullYear(); - const proposalSequence = await getProposalSequence(); - return `${deptCode}-${year}年-${proposalSequence}`; - } - onMounted(()=>{ initFormData(); }); @@ -355,7 +341,6 @@ improvementInstituteVoteTable.dataSource = []; formData.proposalDate = getCurrentDate(); await applyCurrentUserDeptInfo(); - formData.proposalNo = await generateProposalNo(); } async function edit(row) { @@ -420,12 +405,14 @@ // 新增阶段附件暂不绑定;主表生成 ID 后统一关联,保证普通表单和 BPM 使用同一查询键。 if (!isUpdate) { const newId = typeof result?.id === 'string' ? result.id.trim() : ''; + const proposalNo = typeof result?.proposalNo === 'string' ? result.proposalNo.trim() : ''; if (!newId) { // 阻断成功文案等非业务 ID 写入附件表,避免后续 BPM 无法按主表 ID 查询附件。 createMessage.error('新增成功但未返回提案ID,附件未关联,请刷新后重试'); return; } formData.id = newId; + formData.proposalNo = proposalNo; await beforeFileRef.value?.bindBussinessId(`${formData.id}:before`); await afterFileRef.value?.bindBussinessId(`${formData.id}:after`); }