diff --git a/src/packageMine/declare.vue b/src/packageMine/declare.vue index b19e616..9922f27 100644 --- a/src/packageMine/declare.vue +++ b/src/packageMine/declare.vue @@ -167,7 +167,7 @@ const moduleMeta = getModuleMeta(item.module) const title = String(item.title || '').trim() || ((moduleMeta && moduleMeta.title) || '申报表') uni.navigateTo({ - url: `/pages/gxmu/form?code=${encodeURIComponent(item.module)}&year=${encodeURIComponent(item.year || '')}&declareTitle=${encodeURIComponent(title)}` + url: `/pages/gxmu/form?code=${encodeURIComponent(item.module)}&year=${encodeURIComponent(item.year || '')}&declareId=${encodeURIComponent(item.id)}&declareTitle=${encodeURIComponent(title)}` }) } } @@ -370,4 +370,4 @@ color: #1496f2; font-size: 22rpx; } - + \ No newline at end of file diff --git a/src/pages/gxmu/form.vue b/src/pages/gxmu/form.vue index 40ca39f..738780b 100644 --- a/src/pages/gxmu/form.vue +++ b/src/pages/gxmu/form.vue @@ -30,6 +30,8 @@ {{ item.year || fixedYear || '-' }} {{ getRecordMeta(item) }} + 审核状态:{{ getRecordStatusText(item.declareStatus) }} + 撤回申报 @@ -214,7 +216,8 @@ userPageWshqtwForm, userPageWshqtzbForm, userPageYxgqtdgbForm, - userPageYxgqtyForm + userPageYxgqtyForm, + withdrawDeclareRecord } from './module-form-service' const STORAGE_PREFIX = 'gxmu_form_draft_' @@ -275,6 +278,7 @@ nationOptions: [], politicsOptions: [], recordId: '', + declareId: '', loading: false, showEdit: false, list: [], @@ -322,6 +326,7 @@ this.fixedYear = fixedYear this.declareTitle = declareTitle this.recordId = recordId + this.declareId = String(options.declareId || '').trim() if (config) { uni.setNavigationBarTitle({ @@ -448,6 +453,19 @@ .slice(0, 1) return parts.length ? parts.join(' · ') : (this.moduleMeta && this.moduleMeta.group) || '申报记录' }, + getRecordStatusText(status) { + const map = { 0: '草稿', 1: '审核中', 2: '已通过', 3: '已驳回', 4: '已作废' } + return map[status] === undefined ? '待提交' : map[status] + }, + async withdrawRecord(item) { + try { + await withdrawDeclareRecord(this.moduleCode, item.id) + uni.showToast({ title: '已撤回,可继续修改后重新提交', icon: 'none' }) + this.loadData() + } catch (error) { + uni.showToast({ title: (error && error.message) || '撤回失败', icon: 'none' }) + } + }, getRecordMeta(item) { const pairs = [ ['政治面貌', item && item.politics], @@ -782,7 +800,8 @@ try { const payload = { ...this.formData, - year: this.fixedYear || this.formData.year + year: this.fixedYear || this.formData.year, + declareId: this.declareId ? Number(this.declareId) : undefined } const request = payload.id ? api.update : api.add await request({ @@ -890,4 +909,10 @@ .empty-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48rpx; text-align: center; } .empty-title { font-size: 30rpx; font-weight: 700; color: #1f2329; } .empty-desc { margin-top: 12rpx; font-size: 24rpx; line-height: 1.7; color: #7b8694; } - + .card-withdraw { + margin-top: 12rpx; + font-size: 22rpx; + color: #cf1322; + } + + \ No newline at end of file diff --git a/src/pages/gxmu/index.vue b/src/pages/gxmu/index.vue index 5c36866..1e93077 100644 --- a/src/pages/gxmu/index.vue +++ b/src/pages/gxmu/index.vue @@ -51,7 +51,7 @@ v-for="item in filteredDeclareList" :key="item.id || `${item.module}-${item.year}`" class="declare-card" - :class="{ 'declare-card--disabled': !isModuleSupported(item.module) }" + :class="{ 'declare-card--disabled': !isModuleSupported(item.module) || item.myStatus === 1 || item.myStatus === 2 }" @tap="goApply(item)" > @@ -61,9 +61,9 @@ - {{ isModuleSupported(item.module) ? '可申报' : '待支持' }} + {{ getDeclareStatus(item).text }} @@ -87,7 +87,7 @@ {{ getDeclareGroup(item.module) }} - {{ isModuleSupported(item.module) ? '进入申报' : '暂未开放' }} + {{ getDeclareActionText(item) }} @@ -231,6 +231,37 @@ getDeclareGroup(module) { return this.getModuleMetaSafe(module).group }, + getDeclareStatus(item) { + const status = item && item.myStatus + if (status === 0) { + return { text: '草稿', className: 'card-status--draft' } + } + if (status === 1) { + return { text: '审核中', className: 'card-status--pending' } + } + if (status === 2) { + return { text: '已通过', className: 'card-status--passed' } + } + if (status === 3) { + return { text: '已驳回', className: 'card-status--rejected' } + } + if (status === 4) { + return { text: '已作废', className: 'card-status--void' } + } + if (!this.isModuleSupported(item.module)) { + return { text: '待支持', className: 'card-status--disabled' } + } + return { text: '可申报', className: 'card-status--active' } + }, + getDeclareActionText(item) { + if (item.myStatus === 1) { + return '审核中' + } + if (item.myStatus === 2) { + return '已通过' + } + return this.isModuleSupported(item.module) ? '进入申报' : '暂未开放' + }, isModuleSupported(module) { return !!getFormConfig(module) }, @@ -305,6 +336,14 @@ } }, goApply(item) { + if (item.myStatus === 1) { + this.showToast('该项目你的申报正在审核中,请等待审核结果') + return + } + if (item.myStatus === 2) { + this.showToast('该项目你已通过,不能重复申报') + return + } if (!item.module) { this.showToast('当前申报项目缺少模块标识') return @@ -334,7 +373,8 @@ const query = [ `code=${encodeURIComponent(item.module)}`, `year=${encodeURIComponent(item.year || '')}`, - `declareTitle=${encodeURIComponent(this.getDeclareTitle(item))}` + `declareTitle=${encodeURIComponent(this.getDeclareTitle(item))}`, + `declareId=${encodeURIComponent(item.id)}` ] uni.navigateTo({ url: `/pages/gxmu/form?${query.join('&')}` @@ -628,6 +668,31 @@ color: #8f837d; } + .card-status--draft { + background: #f0f5ff; + color: #2f54eb; + } + + .card-status--pending { + background: #fff7e6; + color: #d46b08; + } + + .card-status--passed { + background: #f0f9eb; + color: #389e0d; + } + + .card-status--rejected { + background: #fff1f0; + color: #cf1322; + } + + .card-status--void { + background: #f5f5f5; + color: #8c8c8c; + } + .card-year { display: inline-flex; align-items: center; @@ -694,4 +759,4 @@ font-weight: 600; color: #1496f2; } - + \ No newline at end of file diff --git a/src/pages/gxmu/module-form-service.js b/src/pages/gxmu/module-form-service.js index a42adc0..9f61ee0 100644 --- a/src/pages/gxmu/module-form-service.js +++ b/src/pages/gxmu/module-form-service.js @@ -49,6 +49,14 @@ export function removeSjqnForm(id) { return request(`/gxmu/sjqn-form/${id}`, 'DELETE') } +export function withdrawDeclareRecord(module, id) { + return request('/gxmu/declare-record/withdraw', 'POST', { module, id }) +} + +export function getDeclareRecord(module, declareId) { + return request('/gxmu/declare-record/mine', 'GET', { module, declareId }) +} + export function getDeclare(id) { return request(`/gxmu/declare/${id}`, 'GET') } @@ -209,4 +217,4 @@ export function uploadTempFile(file) { } }) }) -} +} \ No newline at end of file diff --git a/src/pages/gxmu/qmgc.vue b/src/pages/gxmu/qmgc.vue index 7318be1..042c217 100644 --- a/src/pages/gxmu/qmgc.vue +++ b/src/pages/gxmu/qmgc.vue @@ -22,6 +22,8 @@ 手机号:{{ item.phone || '-' }} 团学职务:{{ item.leaguePosition || '-' }} + 审核状态:{{ getRecordStatusText(item.declareStatus) }} + 撤回申报 @@ -128,7 +130,7 @@