feat(app): 优化移动端应用配置和功能实现

- 添加生产环境服务器地址配置支持内外网切换
- 实现采购列表只看我创建的功能开关
- 更新构建脚本中的默认生产环境API地址
- 优化采购单表格单元格编辑体验改用自动补全组件
- 调整应用更新检查逻辑增强生产环境兼容性
- 修复开发服务器切换时的一些验证问题
- 增强应用启动时的服务地址配置灵活性
This commit is contained in:
lixiaolong 2026-10-30 15:28:31 +08:00
parent 415752c55d
commit 071994c0e0
4 changed files with 12 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<template>
<div ref="container" class="achievement-editor-content">
<div ref="container" class="achievement-editor-content" :class="{'is-narrow':width>0&&width<620}">
<el-tabs v-model="tab" :before-leave="canLeave" class="editor-tabs">
<el-tab-pane label="基本资料" name="basic">
<el-form class="business-responsive-form" label-position="right" label-width="110px" :disabled="!editable||busy">
@ -55,5 +55,7 @@ defineExpose({showTab})
.additional-info{margin-top:4px;border-top:0}
.additional-info :deep(.el-collapse-item__header){font-size:13px;color:var(--el-text-color-secondary)}
.additional-info .form-grid{padding:8px 0 0}.additional-info :deep(.el-collapse-item__wrap){border-bottom:0}
.is-narrow .form-grid,.is-narrow .form-grid.team-grid{grid-template-columns:1fr;gap:0}
.is-narrow :deep(.el-form-item){display:block}.is-narrow :deep(.el-form-item__label){display:block;float:none;width:auto!important;text-align:left;height:auto;line-height:20px;padding:0 0 6px}
@media(max-width:620px){.form-grid,.form-grid.team-grid{grid-template-columns:1fr;gap:0}.form-grid :deep(.el-form-item){display:block}.form-grid :deep(.el-form-item__label){display:block;float:none;width:auto!important;text-align:left;height:auto;line-height:20px;padding:0 0 6px}.editor-tabs :deep(.el-tabs__header){margin-bottom:12px}}
</style>

View File

@ -21,10 +21,10 @@
<el-table-column v-if="!projectId" label="所属项目" prop="projectName" min-width="180" show-overflow-tooltip/>
<el-table-column label="成果类别" width="100" align="center" class-name="business-status-cell"><template #default="{row}"><el-tag size="small" effect="light" :type="kindTones[row.kind]">{{ kinds[row.kind] }}</el-tag></template></el-table-column>
<el-table-column v-if="!query.kind||query.kind==='PATENT'" label="专利类型" width="110"><template #default="{row}">{{ row.kind==='PATENT'?(patentTypes[row.details?.patentType]||'—'):'—' }}</template></el-table-column>
<el-table-column label="当前进展" width="145" class-name="business-control-cell"><template #default="{row}"><el-dropdown v-if="mayEdit&&(row.canEdit||(Number(row.archived)&&row.canManage))" trigger="click" :disabled="busy" @command="command=>emit('state-change',row,command)"><el-button link :type="progressTone(row)" :disabled="busy" :aria-label="`调整${row.title}的状态`">{{ progressLabel(row) }}<el-icon class="state-arrow"><ArrowDown/></el-icon></el-button><template #dropdown><el-dropdown-menu><template v-if="!Number(row.archived)"><el-dropdown-item v-for="(label,key) in row.kind==='PATENT'?progressNames:{}" :key="key" :command="key" :disabled="row.progress===key">{{ label }}<span v-if="row.progress===key">(当前)</span></el-dropdown-item><el-dropdown-item command="archive" :divided="row.kind==='PATENT'">归档成果</el-dropdown-item></template><el-dropdown-item v-else command="reopen">重新开启维护</el-dropdown-item></el-dropdown-menu></template></el-dropdown><el-tag v-else size="small" :type="progressTone(row)">{{ progressLabel(row) }}</el-tag><span v-if="Number(row.archived)&&row.kind==='PATENT'" class="archived-progress">{{ progressNames[row.progress] }}</span></template></el-table-column>
<el-table-column label="成果编号" min-width="160" show-overflow-tooltip><template #default="{row}">{{ row.details?.number||row.details?.doi||'—' }}</template></el-table-column>
<el-table-column label="负责人" prop="ownerName" width="110" show-overflow-tooltip/>
<el-table-column label="参与人员" min-width="180" show-overflow-tooltip><template #default="{row}">{{ row.participantNames||'—' }}</template></el-table-column>
<el-table-column label="当前进展" width="145" class-name="business-control-cell"><template #default="{row}"><el-dropdown v-if="mayEdit&&(row.canEdit||(Number(row.archived)&&row.canManage))" trigger="click" :disabled="busy" @command="command=>emit('state-change',row,command)"><el-button link :type="progressTone(row)" :disabled="busy" :aria-label="`调整${row.title}的状态`">{{ progressLabel(row) }}<el-icon class="state-arrow"><ArrowDown/></el-icon></el-button><template #dropdown><el-dropdown-menu><template v-if="!Number(row.archived)"><el-dropdown-item v-for="(label,key) in row.kind==='PATENT'?progressNames:{}" :key="key" :command="key" :disabled="row.progress===key">{{ label }}<span v-if="row.progress===key">(当前)</span></el-dropdown-item><el-dropdown-item command="archive" :divided="row.kind==='PATENT'">归档成果</el-dropdown-item></template><el-dropdown-item v-else command="reopen">重新开启维护</el-dropdown-item></el-dropdown-menu></template></el-dropdown><el-tag v-else size="small" :type="progressTone(row)">{{ progressLabel(row) }}</el-tag><span v-if="Number(row.archived)&&row.kind==='PATENT'" class="archived-progress">{{ progressNames[row.progress] }}</span></template></el-table-column>
<el-table-column label="更新时间" width="180"><template #default="{row}">{{ formatDateTime(row.updateTime) }}</template></el-table-column>
<el-table-column label="操作" width="145" fixed="right" align="center" class-name="business-operation-cell"><template #default="{row}"><el-button link type="primary" @click="emit('open',row.id)">详情</el-button><el-button link type="primary" :icon="Paperclip" @click="emit('open',row.id,'materials')">材料</el-button></template></el-table-column>
</business-table>
@ -50,4 +50,4 @@ function chooseKind(kind){query.value.kind=kind||undefined;emit('search')}
<style scoped>
.achievement-ledger{min-width:0}.state-arrow{margin-left:6px}.archived-progress{display:block;font-size:12px;line-height:18px;color:var(--el-text-color-secondary)}
.achievement-ledger:not(.app-container){height:100%;min-height:0}
</style>
</style>

View File

@ -2,7 +2,7 @@
<AchievementLedger class="achievement-page" v-model:query="query" :embedded="embedded" :project-id="projectId" :rows="rows" :total="total" :loading="loading" :busy="busy||materialBusy" :error="error" :may-edit="mayEdit" :projects="projects" @search="search" @reset="reset" @load="load" @create="create" @export="download" @open="open" @project-search="searchProjects" @state-change="changeState"/>
<el-drawer v-model="drawer" class="project-achievement-drawer" :title="form.id?'成果详情':'登记成果'" size="min(940px,100vw)" append-to-body :before-close="beforeClose" :close-on-click-modal="false">
<template #header="{titleId,titleClass}"><div class="editor-heading"><h2 :id="titleId" :class="titleClass">{{ form.id?(form.title||'成果详情'):'登记成果' }}</h2><div class="editor-context"><el-tag size="small" :type="kindTones[form.kind]">{{ kinds[form.kind] }}</el-tag><el-tag v-if="form.id" size="small" :type="progressTone(form)">{{ progressLabel(form) }}</el-tag><span v-if="currentProjectName" :title="currentProjectName">{{ currentProjectName }}</span></div></div></template>
<div v-loading="busy"><AchievementEditor ref="editor" v-model="form" :project-id="projectId" :projects="projects" :members="members" :editable="editable" :is-manager="isManager" :busy="busy" :material-busy="materialBusy" :participant-options="participantOptions" :participant-loading="participantLoading" :participant-search="searchParticipants" @project-search="searchProjects" @project-change="loadMembers" @kind-change="kindChanged" @material-changed="refreshMaterialVersion" @material-busy="materialBusy=$event"/></div>
<div v-loading="busy"><AchievementEditor :key="form.id||'new'" ref="editor" v-model="form" :project-id="projectId" :projects="projects" :members="members" :editable="editable" :is-manager="isManager" :busy="busy" :material-busy="materialBusy" :participant-options="participantOptions" :participant-loading="participantLoading" :participant-search="searchParticipants" @project-search="searchProjects" @project-change="loadMembers" @kind-change="kindChanged" @material-changed="refreshMaterialVersion" @material-busy="materialBusy=$event"/></div>
<template #footer><div class="drawer-actions"><div class="archive-actions"><el-button v-if="form.id&&!Number(form.archived)&&editable" :disabled="busy||dirty||materialBusy" @click="archive(false)">归档</el-button><el-button v-if="form.id&&Number(form.archived)&&form.canManage&&mayEdit" :disabled="busy||materialBusy" @click="archive(true)">重新开启维护</el-button></div><div class="save-actions"><el-button :disabled="busy||materialBusy" @click="beforeClose(()=>drawer=false)">关闭</el-button><el-button v-if="editable" type="primary" :disabled="materialBusy" :loading="busy" @click="save(form.id?'basic':'materials')">{{ form.id?'保存资料':'保存并上传材料' }}</el-button></div></div></template>
</el-drawer>
</template>

View File

@ -259,6 +259,12 @@ it('ledger materials action opens the file tab directly without saving or reques
expect(editor.findComponent({name:'ElTabs'}).props('modelValue')).toBe('materials')
expect(api.listProjectDocuments).toHaveBeenCalledWith(71,99)
expect(api.saveAchievement).not.toHaveBeenCalled()
await w.findAllComponents({name:'ElButton'}).find(c=>c.text()==='关闭').trigger('click');await flushPromises()
await button(w,'登记成果').trigger('click');await flushPromises()
const reopened=w.findComponent(AchievementEditor)
expect(reopened.get('[role="tab"][aria-selected="true"]').text()).toBe('基本资料')
expect(reopened.find('.editor-section').isVisible()).toBe(true)
expect(api.saveAchievement).not.toHaveBeenCalled()
})
it('materials tab navigation is blocked while a transfer is running and unsaved form data is retained',async()=>{
const data={id:99,projectId:71,kind:'PAPER',title:'正在编辑的成果',details:{},participantIds:[],archived:0}