Compare commits

3 Commits
Author SHA1 Message Date
bestlee 14f1d44622 路由title修改 2026-11-13 16:34:22 +08:00
bestlee 37905949dc logo替换 2026-11-13 16:31:48 +08:00
bestlee d8ede65a24 变更查看页面筛选与排序修改 2026-11-13 16:08:24 +08:00
6 changed files with 307 additions and 53 deletions
+1 -4
View File
@@ -16,21 +16,18 @@ declare module 'vue' {
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
VanButton: typeof import('vant/es')['Button'] VanButton: typeof import('vant/es')['Button']
VanCell: typeof import('vant/es')['Cell'] VanCalendar: typeof import('vant/es')['Calendar']
VanCellGroup: typeof import('vant/es')['CellGroup'] VanCellGroup: typeof import('vant/es')['CellGroup']
VanEmpty: typeof import('vant/es')['Empty'] VanEmpty: typeof import('vant/es')['Empty']
VanField: typeof import('vant/es')['Field'] VanField: typeof import('vant/es')['Field']
VanForm: typeof import('vant/es')['Form'] VanForm: typeof import('vant/es')['Form']
VanIcon: typeof import('vant/es')['Icon'] VanIcon: typeof import('vant/es')['Icon']
VanImage: typeof import('vant/es')['Image']
VanList: typeof import('vant/es')['List'] VanList: typeof import('vant/es')['List']
VanLoading: typeof import('vant/es')['Loading'] VanLoading: typeof import('vant/es')['Loading']
VanNavBar: typeof import('vant/es')['NavBar']
VanPicker: typeof import('vant/es')['Picker'] VanPicker: typeof import('vant/es')['Picker']
VanPopup: typeof import('vant/es')['Popup'] VanPopup: typeof import('vant/es')['Popup']
VanSearch: typeof import('vant/es')['Search'] VanSearch: typeof import('vant/es')['Search']
VanTabbar: typeof import('vant/es')['Tabbar'] VanTabbar: typeof import('vant/es')['Tabbar']
VanTabbarItem: typeof import('vant/es')['TabbarItem'] VanTabbarItem: typeof import('vant/es')['TabbarItem']
VanTag: typeof import('vant/es')['Tag']
} }
} }
+2 -2
View File
@@ -2,13 +2,13 @@
<html lang="zh-CN"> <html lang="zh-CN">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" /> <link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta <meta
name="viewport" name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, viewport-fit=cover"
/> />
<meta name="format-detection" content="telephone=no" /> <meta name="format-detection" content="telephone=no" />
<title>mocmobile</title> <title>MOC变更管理</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>
Binary file not shown.

After

Width:  |  Height:  |  Size: 894 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
import request from '@/utils/request' import request from '@/utils/request'
export type ChangeSort = 'apply' | 'plan' | 'status' export type ChangeSort = 'apply' | 'applyDesc' | 'plan' | 'planDesc' | 'status' | 'statusDesc'
export interface ChangeTag { export interface ChangeTag {
text: string text: string
+299 -42
View File
@@ -24,11 +24,53 @@ const page = ref(1)
const pageSize = 10 const pageSize = 10
const listScroll = ref<HTMLDivElement | null>(null) const listScroll = ref<HTMLDivElement | null>(null)
let requestId = 0 let requestId = 0
// 类型筛选
const filterType = ref('')
const typeOptions = [
{ label: '全部', value: '' },
{ label: '工艺', value: '工艺' },
{ label: '设备', value: '设备' },
{ label: '管理', value: '管理' },
]
// 时限筛选
const filterDuration = ref('')
const durationOptions = [
{ label: '全部', value: '' },
{ label: '永久', value: '永久' },
{ label: '临时', value: '临时' },
]
// 时间筛选
type TimeRangeKey = 'year' | 'halfYear' | 'threeMonths' | 'month' | 'custom'
const timeRange = ref<TimeRangeKey>('year')
const customStart = ref('')
const customEnd = ref('')
const timeOptions: Array<{ label: string; value: TimeRangeKey }> = [
{ label: '近一年', value: 'year' },
{ label: '近半年', value: 'halfYear' },
{ label: '近三个月', value: 'threeMonths' },
{ label: '近一个月', value: 'month' },
{ label: '自定义', value: 'custom' },
]
// 状态筛选
const filterStatus = ref('')
const statusOptions = [
{ label: '全部', value: '' },
{ label: '审批中', value: '审批中' },
{ label: '已批准', value: '已批准' },
{ label: '实施中', value: '实施中' },
{ label: '待PSSR', value: '待PSSR' },
{ label: '待验收', value: '待验收' },
{ label: '待关闭', value: '待关闭' },
{ label: '已关闭', value: '已关闭' },
]
// 排序选项 // 排序选项
const sortOptions: Array<{ key: ChangeSort; label: string }> = [ const sortOptions: Array<{ key: ChangeSort; label: string }> = [
{ key: 'apply', label: '最新申请' }, { key: 'apply', label: '申请时间 · 最新' },
{ key: 'plan', label: '计划投用' }, { key: 'applyDesc', label: '申请时间 · 最早' },
{ key: 'status', label: '状态更新' }, { key: 'plan', label: '计划投用 · 最近' },
{ key: 'planDesc', label: '计划投用 · 最晚' },
{ key: 'status', label: '状态更新 · 最新' },
{ key: 'statusDesc', label: '状态更新 · 最早' },
] ]
// 组织选项 // 组织选项
const orgOptions: Array<{ text: string; value: string }> = [ const orgOptions: Array<{ text: string; value: string }> = [
@@ -52,21 +94,112 @@ function onOrgConfirm(params: {
showOrgPicker.value = false showOrgPicker.value = false
resetList() resetList()
} }
// 排序选择器显隐
const showSortPicker = ref(false)
// 当前排序显示文本
const sortLabel = computed(
() => sortOptions.find((item) => item.key === sort.value)?.label ?? ''
)
// 排序选择器数据源
const sortColumns = sortOptions.map((item) => ({
text: item.label,
value: item.key,
}))
// 确认排序选择
function onSortConfirm(params: {
selectedOptions: Array<{ text: string; value: ChangeSort }>
}) {
sort.value = params.selectedOptions[0]?.value ?? 'apply'
showSortPicker.value = false
resetList()
}
// 格式化日期为 YYYY-MM-DD
function formatDate(date: Date) {
const m = String(date.getMonth() + 1).padStart(2, '0')
const d = String(date.getDate()).padStart(2, '0')
return `${date.getFullYear()}-${m}-${d}`
}
// 计算申请时间范围
function applyTimeRange() {
if (timeRange.value === 'custom') {
return { start: customStart.value, end: customEnd.value }
}
const monthMap: Record<Exclude<TimeRangeKey, 'custom'>, number> = {
month: 1,
threeMonths: 3,
halfYear: 6,
year: 12,
}
const start = new Date()
start.setMonth(start.getMonth() - monthMap[timeRange.value])
return { start: formatDate(start), end: formatDate(new Date()) }
}
// 选择类型
function selectType(value: string) {
if (filterType.value === value) return
filterType.value = value
resetList()
}
// 选择时限
function selectDuration(value: string) {
if (filterDuration.value === value) return
filterDuration.value = value
resetList()
}
// 自定义时间选择器显隐
const showCalendar = ref(false)
// 选择时间范围,自定义时打开日期选择
function selectTime(value: TimeRangeKey) {
if (value === 'custom') {
showCalendar.value = true
return
}
if (timeRange.value === value) return
timeRange.value = value
resetList()
}
// 确认自定义时间范围
function onCalendarConfirm(range: Date[]) {
const [start, end] = range
customStart.value = formatDate(start)
customEnd.value = formatDate(end)
timeRange.value = 'custom'
showCalendar.value = false
resetList()
}
// 选择状态
function selectStatus(value: string) {
if (filterStatus.value === value) return
filterStatus.value = value
resetList()
}
// 重置筛选与排序
function resetFilters() {
filterType.value = ''
filterDuration.value = ''
filterStatus.value = ''
timeRange.value = 'year'
customStart.value = ''
customEnd.value = ''
sort.value = 'apply'
resetList()
}
// 搜索关键字变化时刷新列表 // 搜索关键字变化时刷新列表
watch(keyword, resetList) watch(keyword, resetList)
// 变更列表 // 变更列表
async function onLoad() { async function onLoad() {
const currentRequest = requestId const currentRequest = requestId
try { try {
const { start, end } = applyTimeRange()
const res = await changeListApi({ const res = await changeListApi({
kw: keyword.value, kw: keyword.value,
org_id: org.value, org_id: org.value,
type: '', type: filterType.value,
level: '', level: '',
duration: '', duration: filterDuration.value,
status: '', status: filterStatus.value,
apply_time_start: '', apply_time_start: start,
apply_time_end: '', apply_time_end: end,
onlyOpen: mode.value === 'open', onlyOpen: mode.value === 'open',
sort: sort.value, sort: sort.value,
self: 1, self: 1,
@@ -108,12 +241,6 @@ function setMode(value: 'all' | 'open') {
mode.value = value mode.value = value
resetList() resetList()
} }
// 排序变更
function selectSort(key: ChangeSort) {
if (sort.value === key) return
sort.value = key
resetList()
}
// 审批状态类名 // 审批状态类名
function approvalClass(value: ChangeItem['approval']) { function approvalClass(value: ChangeItem['approval']) {
if (value === '审批中') return 'pending' if (value === '审批中') return 'pending'
@@ -128,10 +255,6 @@ function goDetail(item: ChangeItem) {
function goProgress(item: ChangeItem) { function goProgress(item: ChangeItem) {
router.push(`/change/${item.id}/progress`) router.push(`/change/${item.id}/progress`)
} }
// 操作变更
function onAction(action: string) {
showToast(`${action}功能建设中`)
}
onMounted(() => { onMounted(() => {
resetList() resetList()
}) })
@@ -188,16 +311,81 @@ onMounted(() => {
</div> </div>
<div v-if="expanded" class="sort-panel"> <div v-if="expanded" class="sort-panel">
<div class="filter-group">
<span class="group-label">类型</span>
<div class="chip-row">
<span <span
v-for="item in sortOptions" v-for="item in typeOptions"
:key="item.key" :key="item.label"
class="sort-chip" class="chip"
:class="{ active: sort === item.key }" :class="{ active: filterType === item.value }"
@click="selectSort(item.key)" @click="selectType(item.value)"
> >
{{ item.label }} {{ item.label }}
</span> </span>
</div> </div>
</div>
<div class="filter-group">
<span class="group-label">时限</span>
<div class="chip-row">
<span
v-for="item in durationOptions"
:key="item.label"
class="chip"
:class="{ active: filterDuration === item.value }"
@click="selectDuration(item.value)"
>
{{ item.label }}
</span>
</div>
</div>
<div class="filter-group">
<span class="group-label">时间</span>
<div class="chip-row">
<span
v-for="item in timeOptions"
:key="item.value"
class="chip"
:class="{ active: timeRange === item.value }"
@click="selectTime(item.value)"
>
{{ item.label }}
</span>
</div>
</div>
<div class="filter-group">
<span class="group-label">状态</span>
<div class="chip-row">
<span
v-for="item in statusOptions"
:key="item.label"
class="chip"
:class="{ active: filterStatus === item.value }"
@click="selectStatus(item.value)"
>
{{ item.label }}
</span>
</div>
</div>
<div class="sort-row">
<span class="group-label">排序</span>
<div class="sort-select" @click="showSortPicker = true">
<span>{{ sortLabel }}</span>
<van-icon name="arrow-down" class="sort-select-icon" />
</div>
<div class="reset-row">
<span class="reset-btn" @click="resetFilters">
<van-icon name="replay" class="reset-icon" />
重置
</span>
</div>
</div>
</div>
<div ref="listScroll" class="list-scroll"> <div ref="listScroll" class="list-scroll">
<van-list <van-list
@@ -252,13 +440,6 @@ onMounted(() => {
<div class="card-footer"> <div class="card-footer">
<div class="actions"> <div class="actions">
<button
class="btn btn-withdraw"
type="button"
@click="onAction('撤回')"
>
撤回
</button>
<button <button
class="btn btn-detail" class="btn btn-detail"
type="button" type="button"
@@ -294,6 +475,21 @@ onMounted(() => {
/> />
</van-popup> </van-popup>
<van-popup v-model:show="showSortPicker" position="bottom" round>
<van-picker
title="排序方式"
:columns="sortColumns"
@confirm="onSortConfirm"
@cancel="showSortPicker = false"
/>
</van-popup>
<van-calendar
v-model:show="showCalendar"
type="range"
@confirm="onCalendarConfirm"
/>
<AppTabbar :active="1" /> <AppTabbar :active="1" />
</div> </div>
</template> </template>
@@ -461,27 +657,88 @@ onMounted(() => {
} }
.sort-panel { .sort-panel {
display: flex;
flex-shrink: 0; flex-shrink: 0;
flex-wrap: wrap;
gap: 8px;
margin: 4px 10px 0; margin: 4px 10px 0;
padding: 10px; padding: 12px 10px;
background: #fff; background: #fff;
border-radius: 8px; border-radius: 8px;
} }
.sort-chip { .filter-group {
padding: 5px 12px; display: flex;
font-size: 12px; align-items: flex-start;
color: #5f6b7a; margin-bottom: 12px;
background: #f1f4f9;
border-radius: 12px;
} }
.sort-chip.active { .group-label {
flex-shrink: 0;
width: 32px;
padding-top: 3px;
font-size: 13px;
color: #4e5868;
}
.chip-row {
display: flex;
flex: 1;
flex-wrap: wrap;
gap: 8px;
}
.chip {
padding: 2px 10px;
font-size: 12px;
color: #5f6b7a;
background: #fff;
border: 1px solid #dfe6f0;
border-radius: 14px;
}
.chip.active {
color: #fff;
background: #1f5db3;
border-color: #1f5db3;
}
.sort-row {
display: flex;
align-items: center;
}
.sort-select {
display: flex;
flex: 1;
align-items: center;
justify-content: space-between;
height: 32px;
padding: 0 10px;
font-size: 13px;
color: #1d2430;
border: 1px solid #dfe6f0;
border-radius: 6px;
}
.sort-select-icon {
font-size: 13px;
color: #8a94a6;
}
.reset-row {
display: flex;
justify-content: flex-end;
margin-left: 40px;
}
.reset-btn {
display: inline-flex;
align-items: center;
gap: 4px;
font-size: 14px;
color: #1f5db3; color: #1f5db3;
background: #e6f0ff; }
.reset-icon {
font-size: 14px;
} }
/* 可滚动列表区域 */ /* 可滚动列表区域 */