Merge branch '1114'
This commit is contained in:
commit
c4f875d979
|
|
@ -26,4 +26,7 @@ export * from './customer';
|
||||||
export * from './common';
|
export * from './common';
|
||||||
|
|
||||||
// 导入审批相关 API
|
// 导入审批相关 API
|
||||||
export * from './verify';
|
export * from './verify';
|
||||||
|
|
||||||
|
// 导入项目相关 API
|
||||||
|
export * from './project';
|
||||||
102
api/project.js
Normal file
102
api/project.js
Normal file
|
|
@ -0,0 +1,102 @@
|
||||||
|
/**
|
||||||
|
* 项目相关 API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目列表
|
||||||
|
* @param {Object} params 请求参数
|
||||||
|
* @param {number} params.pageNum 页码
|
||||||
|
* @param {number} params.pageSize 每页数量
|
||||||
|
* @param {string} params.orderByColumn 排序字段
|
||||||
|
* @param {string} params.isAsc 排序方式(ascending/descending)
|
||||||
|
* @param {number[]} params.statusList 项目状态列表
|
||||||
|
* @param {string} params.createId 创建人ID
|
||||||
|
* @param {string} params.ownerId 负责人ID
|
||||||
|
* @param {string[]} params.keys 搜索关键词数组
|
||||||
|
* @returns {Promise} 返回项目列表
|
||||||
|
*/
|
||||||
|
export const getProjectList = (params = {}) => {
|
||||||
|
const queryParams = [];
|
||||||
|
|
||||||
|
// 分页参数
|
||||||
|
if (params.pageNum !== undefined) {
|
||||||
|
queryParams.push(`pageNum=${params.pageNum}`);
|
||||||
|
}
|
||||||
|
if (params.pageSize !== undefined) {
|
||||||
|
queryParams.push(`pageSize=${params.pageSize}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 排序参数
|
||||||
|
if (params.orderByColumn !== undefined && params.orderByColumn !== '') {
|
||||||
|
queryParams.push(`orderByColumn=${encodeURIComponent(params.orderByColumn)}`);
|
||||||
|
}
|
||||||
|
if (params.isAsc !== undefined && params.isAsc !== '') {
|
||||||
|
queryParams.push(`isAsc=${encodeURIComponent(params.isAsc)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 状态列表
|
||||||
|
if (params.statusList !== undefined && Array.isArray(params.statusList) && params.statusList.length > 0) {
|
||||||
|
params.statusList.forEach((status, index) => {
|
||||||
|
queryParams.push(`statusList=${status}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 创建人ID
|
||||||
|
if (params.createId !== undefined && params.createId !== '') {
|
||||||
|
queryParams.push(`createId=${params.createId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 负责人ID
|
||||||
|
if (params.ownerId !== undefined && params.ownerId !== '') {
|
||||||
|
queryParams.push(`ownerId=${params.ownerId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 搜索关键词
|
||||||
|
if (params.keys !== undefined && Array.isArray(params.keys) && params.keys.length > 0) {
|
||||||
|
params.keys.forEach((key, index) => {
|
||||||
|
queryParams.push(`keys[${index}]=${encodeURIComponent(key)}`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// 项目名称搜索
|
||||||
|
if (params.projectName !== undefined && params.projectName !== '') {
|
||||||
|
queryParams.push(`projectName=${encodeURIComponent(params.projectName)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 项目编号搜索
|
||||||
|
if (params.projectId !== undefined && params.projectId !== '') {
|
||||||
|
queryParams.push(`projectId=${encodeURIComponent(params.projectId)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 客户名称搜索
|
||||||
|
if (params.customerName !== undefined && params.customerName !== '') {
|
||||||
|
queryParams.push(`customerName=${encodeURIComponent(params.customerName)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 成员ID搜索
|
||||||
|
if (params.memberId !== undefined && params.memberId !== '') {
|
||||||
|
queryParams.push(`memberId=${params.memberId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
const queryString = queryParams.length > 0 ? `?${queryParams.join('&')}` : '';
|
||||||
|
|
||||||
|
return uni.$uv.http.get(`bst/project/list${queryString}`, {
|
||||||
|
custom: {
|
||||||
|
auth: true // 启用 token 认证
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取项目详情
|
||||||
|
* @param {string} id 项目ID
|
||||||
|
* @returns {Promise} 返回项目详情
|
||||||
|
*/
|
||||||
|
export const getProjectDetail = (id) => {
|
||||||
|
return uni.$uv.http.get(`bst/project/${id}`, {
|
||||||
|
custom: {
|
||||||
|
auth: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
@ -106,7 +106,8 @@ export const applyTaskDelay = (payload) => {
|
||||||
export const createTask = (payload) => {
|
export const createTask = (payload) => {
|
||||||
return uni.$uv.http.post('/bst/task', payload, {
|
return uni.$uv.http.post('/bst/task', payload, {
|
||||||
custom: {
|
custom: {
|
||||||
auth: true
|
auth: true,
|
||||||
|
catch: true // 允许在 catch 中处理错误
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,12 @@ const handleClick = (item) => {
|
||||||
uni.switchTab({ url: '/pages/index/index' });
|
uni.switchTab({ url: '/pages/index/index' });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (item.key === 'project') {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: '/pages/project/list/index'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
// 其他入口占位
|
// 其他入口占位
|
||||||
uni.showToast({ title: '开发中', icon: 'none' });
|
uni.showToast({ title: '开发中', icon: 'none' });
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,12 @@
|
||||||
"navigationBarTitleText": "修改跟进记录",
|
"navigationBarTitleText": "修改跟进记录",
|
||||||
"navigationStyle": "custom"
|
"navigationStyle": "custom"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "pages/project/list/index",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "项目管理"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
|
|
||||||
661
pages/project/list/index.vue
Normal file
661
pages/project/list/index.vue
Normal file
|
|
@ -0,0 +1,661 @@
|
||||||
|
<template>
|
||||||
|
<view class="project-list-page">
|
||||||
|
<!-- 筛选区域 -->
|
||||||
|
<view class="filter-section">
|
||||||
|
<view class="filter-row">
|
||||||
|
<view class="filter-item">
|
||||||
|
<text class="filter-label">客户</text>
|
||||||
|
<input
|
||||||
|
class="filter-input"
|
||||||
|
v-model="filterParams.customerName"
|
||||||
|
placeholder="请输入客户名称"
|
||||||
|
@confirm="handleSearch"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="filter-item">
|
||||||
|
<text class="filter-label">项目编号</text>
|
||||||
|
<input
|
||||||
|
class="filter-input"
|
||||||
|
v-model="filterParams.projectId"
|
||||||
|
placeholder="请输入项目编号"
|
||||||
|
@confirm="handleSearch"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<view class="filter-row">
|
||||||
|
<view class="filter-item">
|
||||||
|
<text class="filter-label">项目名称</text>
|
||||||
|
<input
|
||||||
|
class="filter-input"
|
||||||
|
v-model="filterParams.projectName"
|
||||||
|
placeholder="请输入项目名称"
|
||||||
|
@confirm="handleSearch"
|
||||||
|
/>
|
||||||
|
</view>
|
||||||
|
<view class="filter-item">
|
||||||
|
<text class="filter-label">成员</text>
|
||||||
|
<picker
|
||||||
|
mode="selector"
|
||||||
|
:range="memberOptions"
|
||||||
|
range-key="userName"
|
||||||
|
@change="handleMemberChange"
|
||||||
|
>
|
||||||
|
<view class="filter-picker">
|
||||||
|
<text class="picker-text">{{ selectedMemberName || '请选择用户' }}</text>
|
||||||
|
<text class="picker-arrow">▼</text>
|
||||||
|
</view>
|
||||||
|
</picker>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 开发超期筛选 -->
|
||||||
|
<view class="filter-row">
|
||||||
|
<text class="filter-label">开发超期</text>
|
||||||
|
<view class="radio-group">
|
||||||
|
<view
|
||||||
|
class="radio-item"
|
||||||
|
:class="{ active: filterParams.overdue === '' }"
|
||||||
|
@click="filterParams.overdue = ''; handleSearch()"
|
||||||
|
>
|
||||||
|
<text>全部</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="radio-item"
|
||||||
|
:class="{ active: filterParams.overdue === true }"
|
||||||
|
@click="filterParams.overdue = true; handleSearch()"
|
||||||
|
>
|
||||||
|
<text>是</text>
|
||||||
|
</view>
|
||||||
|
<view
|
||||||
|
class="radio-item"
|
||||||
|
:class="{ active: filterParams.overdue === false }"
|
||||||
|
@click="filterParams.overdue = false; handleSearch()"
|
||||||
|
>
|
||||||
|
<text>否</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 状态标签 -->
|
||||||
|
<view class="status-tabs">
|
||||||
|
<view
|
||||||
|
class="status-tab"
|
||||||
|
v-for="tab in statusTabs"
|
||||||
|
:key="tab.value"
|
||||||
|
:class="{ active: activeStatusTab === tab.value }"
|
||||||
|
@click="handleStatusTabClick(tab.value)"
|
||||||
|
>
|
||||||
|
<text>{{ tab.label }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 操作按钮 -->
|
||||||
|
<view class="action-buttons">
|
||||||
|
<uv-button type="primary" size="small" @click="handleSearch">
|
||||||
|
<text class="btn-icon">🔍</text>
|
||||||
|
<text>搜索</text>
|
||||||
|
</uv-button>
|
||||||
|
<uv-button size="small" @click="handleReset">
|
||||||
|
<text>重置</text>
|
||||||
|
</uv-button>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 项目列表 -->
|
||||||
|
<scroll-view
|
||||||
|
class="project-scroll"
|
||||||
|
scroll-y
|
||||||
|
@scrolltolower="handleScrollToLower"
|
||||||
|
>
|
||||||
|
<view class="project-container">
|
||||||
|
<view
|
||||||
|
class="project-card"
|
||||||
|
v-for="project in projects"
|
||||||
|
:key="project.id"
|
||||||
|
@click="goToProjectDetail(project)"
|
||||||
|
>
|
||||||
|
<!-- 状态标签和过期时间 -->
|
||||||
|
<view class="project-header">
|
||||||
|
<view class="status-badge">
|
||||||
|
<uv-tags
|
||||||
|
:text="getStatusText(project.status)"
|
||||||
|
:type="getStatusType(project.status)"
|
||||||
|
size="mini"
|
||||||
|
:plain="false"
|
||||||
|
></uv-tags>
|
||||||
|
</view>
|
||||||
|
<view class="expire-time">
|
||||||
|
<text class="expire-label">过期时间:</text>
|
||||||
|
<text class="expire-value">{{ formatDate(project.expireTime) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 项目信息 -->
|
||||||
|
<view class="project-content">
|
||||||
|
<text class="project-name">{{ project.projectName }}</text>
|
||||||
|
<text class="project-description">{{ project.description }}</text>
|
||||||
|
|
||||||
|
<view class="project-meta">
|
||||||
|
<text class="meta-item">创建人: {{ project.createName }}</text>
|
||||||
|
<text class="meta-item">负责人: {{ getOwnerNames(project.memberList) }}</text>
|
||||||
|
<view class="meta-row">
|
||||||
|
<text class="meta-item">提交: {{ project.submitCount || 0 }}次</text>
|
||||||
|
<text class="meta-item">接收: {{ project.receivedCount || 0 }}次</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 逾期提示 -->
|
||||||
|
<view class="overdue-tip" v-if="project.overdue">
|
||||||
|
<text class="overdue-text">⚠️ 已逾期</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 加载状态 -->
|
||||||
|
<view class="empty-state" v-if="loading">
|
||||||
|
<text class="empty-text">加载中...</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 空状态 -->
|
||||||
|
<view class="empty-state" v-else-if="isEmpty">
|
||||||
|
<text class="empty-text">暂无项目数据</text>
|
||||||
|
</view>
|
||||||
|
|
||||||
|
<!-- 加载更多提示 -->
|
||||||
|
<view class="load-more-tip" v-if="!isEmpty && !loading && !noMore">
|
||||||
|
<text class="load-more-text">上拉加载更多</text>
|
||||||
|
</view>
|
||||||
|
<view class="load-more-tip" v-if="!isEmpty && noMore">
|
||||||
|
<text class="load-more-text">没有更多数据了</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</scroll-view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, computed, watch, onMounted, nextTick } from 'vue';
|
||||||
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
|
import { getProjectList, getUserList } from '@/api';
|
||||||
|
import { usePagination } from '@/composables';
|
||||||
|
import { useDictStore } from '@/store/dict';
|
||||||
|
import { useUserStore } from '@/store/user';
|
||||||
|
import { getDictLabel } from '@/utils/dict';
|
||||||
|
|
||||||
|
const dictStore = useDictStore();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
|
||||||
|
// 筛选参数
|
||||||
|
const filterParams = ref({
|
||||||
|
customerName: '',
|
||||||
|
projectId: '',
|
||||||
|
projectName: '',
|
||||||
|
memberId: '',
|
||||||
|
overdue: '', // ''表示全部, true表示是, false表示否
|
||||||
|
});
|
||||||
|
|
||||||
|
// 状态标签
|
||||||
|
const statusTabs = ref([
|
||||||
|
{ label: '待开始', value: '1' },
|
||||||
|
{ label: '开发中', value: '2' },
|
||||||
|
{ label: '开发完成', value: '4' },
|
||||||
|
{ label: '已验收', value: '5' },
|
||||||
|
{ label: '维护中', value: '6' },
|
||||||
|
{ label: '维护到期', value: '7' },
|
||||||
|
{ label: '开发超期', value: '8' }
|
||||||
|
]);
|
||||||
|
|
||||||
|
const activeStatusTab = ref('2'); // 默认选中"开发中"
|
||||||
|
|
||||||
|
// 成员选项
|
||||||
|
const memberOptions = ref([]);
|
||||||
|
const selectedMemberName = ref('');
|
||||||
|
|
||||||
|
// 使用分页组合式函数
|
||||||
|
const {
|
||||||
|
list,
|
||||||
|
noMore,
|
||||||
|
isEmpty,
|
||||||
|
loading,
|
||||||
|
getList,
|
||||||
|
loadMore,
|
||||||
|
updateParams,
|
||||||
|
refresh,
|
||||||
|
queryParams,
|
||||||
|
reset
|
||||||
|
} = usePagination({
|
||||||
|
fetchData: async (params) => {
|
||||||
|
// 构建请求参数
|
||||||
|
const requestParams = {
|
||||||
|
...params,
|
||||||
|
orderByColumn: 'expireTime',
|
||||||
|
isAsc: 'ascending'
|
||||||
|
};
|
||||||
|
|
||||||
|
// 添加状态筛选
|
||||||
|
if (activeStatusTab.value) {
|
||||||
|
// 根据选中的状态标签设置statusList
|
||||||
|
const statusMap = {
|
||||||
|
'1': [1], // 待开始
|
||||||
|
'2': [2], // 开发中
|
||||||
|
'4': [4], // 开发完成
|
||||||
|
'5': [5], // 已验收
|
||||||
|
'6': [6], // 维护中
|
||||||
|
'7': [7], // 维护到期
|
||||||
|
'8': [2] // 开发超期(也是状态2,但需要overdue=true)
|
||||||
|
};
|
||||||
|
|
||||||
|
if (activeStatusTab.value === '8') {
|
||||||
|
// 开发超期需要特殊处理
|
||||||
|
requestParams.statusList = [2];
|
||||||
|
requestParams.overdue = true;
|
||||||
|
} else {
|
||||||
|
requestParams.statusList = statusMap[activeStatusTab.value] || [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加其他筛选条件
|
||||||
|
if (filterParams.value.customerName) {
|
||||||
|
requestParams.customerName = filterParams.value.customerName;
|
||||||
|
}
|
||||||
|
if (filterParams.value.projectId) {
|
||||||
|
requestParams.projectId = filterParams.value.projectId;
|
||||||
|
}
|
||||||
|
if (filterParams.value.projectName) {
|
||||||
|
requestParams.projectName = filterParams.value.projectName;
|
||||||
|
}
|
||||||
|
if (filterParams.value.memberId) {
|
||||||
|
requestParams.memberId = filterParams.value.memberId;
|
||||||
|
}
|
||||||
|
if (filterParams.value.overdue !== '' && activeStatusTab.value !== '8') {
|
||||||
|
// 如果不是"开发超期"标签,才使用overdue筛选
|
||||||
|
requestParams.overdue = filterParams.value.overdue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加创建人和负责人筛选(根据用户私有视角)
|
||||||
|
const userId = userStore.getUserInfo?.user?.userId || userStore.getUserInfo?.userId;
|
||||||
|
const privateView = userStore.privateView;
|
||||||
|
if (userId && privateView) {
|
||||||
|
requestParams.ownerId = userId;
|
||||||
|
requestParams.createId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
const res = await getProjectList(requestParams);
|
||||||
|
return res;
|
||||||
|
},
|
||||||
|
mode: 'loadMore',
|
||||||
|
pageSize: 20,
|
||||||
|
defaultParams: {}
|
||||||
|
});
|
||||||
|
|
||||||
|
// 项目列表
|
||||||
|
const projects = computed(() => list.value);
|
||||||
|
|
||||||
|
// 获取状态文本
|
||||||
|
const getStatusText = (status) => {
|
||||||
|
if (!status && status !== 0) return '未知';
|
||||||
|
// 优先从字典获取,如果没有则使用默认映射
|
||||||
|
const dictLabel = getDictLabel('project_status', status);
|
||||||
|
if (dictLabel && dictLabel !== String(status)) {
|
||||||
|
return dictLabel;
|
||||||
|
}
|
||||||
|
// 默认映射
|
||||||
|
const statusMap = {
|
||||||
|
'1': '待开始',
|
||||||
|
'2': '开发中',
|
||||||
|
'4': '开发完成',
|
||||||
|
'5': '已验收',
|
||||||
|
'6': '维护中',
|
||||||
|
'7': '维护到期'
|
||||||
|
};
|
||||||
|
return statusMap[String(status)] || `状态${status}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取状态类型(用于标签颜色)
|
||||||
|
const getStatusType = (status) => {
|
||||||
|
if (!status && status !== 0) return 'primary';
|
||||||
|
const typeMap = {
|
||||||
|
'1': 'primary', // 待开始
|
||||||
|
'2': 'warning', // 开发中
|
||||||
|
'4': 'success', // 开发完成
|
||||||
|
'5': 'info', // 已验收
|
||||||
|
'6': 'primary', // 维护中
|
||||||
|
'7': 'warning' // 维护到期
|
||||||
|
};
|
||||||
|
return typeMap[String(status)] || 'primary';
|
||||||
|
};
|
||||||
|
|
||||||
|
// 格式化日期
|
||||||
|
const formatDate = (dateStr) => {
|
||||||
|
if (!dateStr) return '未知';
|
||||||
|
return dateStr.split(' ')[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
// 获取负责人名称
|
||||||
|
const getOwnerNames = (memberList) => {
|
||||||
|
if (!Array.isArray(memberList) || memberList.length === 0) return '未分配';
|
||||||
|
return memberList.map(member => member.userName || member.name || '').filter(name => name).join('、');
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理状态标签点击
|
||||||
|
const handleStatusTabClick = (value) => {
|
||||||
|
activeStatusTab.value = value;
|
||||||
|
handleSearch();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理成员选择
|
||||||
|
const handleMemberChange = (e) => {
|
||||||
|
const index = e.detail.value;
|
||||||
|
const member = memberOptions.value[index];
|
||||||
|
if (member) {
|
||||||
|
filterParams.value.memberId = member.userId;
|
||||||
|
selectedMemberName.value = member.userName;
|
||||||
|
} else {
|
||||||
|
filterParams.value.memberId = '';
|
||||||
|
selectedMemberName.value = '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 搜索
|
||||||
|
const handleSearch = () => {
|
||||||
|
reset();
|
||||||
|
getList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 重置
|
||||||
|
const handleReset = () => {
|
||||||
|
filterParams.value = {
|
||||||
|
customerName: '',
|
||||||
|
projectId: '',
|
||||||
|
projectName: '',
|
||||||
|
memberId: '',
|
||||||
|
overdue: ''
|
||||||
|
};
|
||||||
|
selectedMemberName.value = '';
|
||||||
|
activeStatusTab.value = '2';
|
||||||
|
handleSearch();
|
||||||
|
};
|
||||||
|
|
||||||
|
// 处理滚动到底部
|
||||||
|
const handleScrollToLower = () => {
|
||||||
|
if (!noMore.value && !loading.value) {
|
||||||
|
loadMore();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 跳转到项目详情
|
||||||
|
const goToProjectDetail = (project) => {
|
||||||
|
// TODO: 跳转到项目详情页面
|
||||||
|
uni.showToast({
|
||||||
|
title: '项目详情功能开发中',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// 加载成员列表
|
||||||
|
const loadMemberList = async () => {
|
||||||
|
try {
|
||||||
|
const res = await getUserList({ pageSize: 200 });
|
||||||
|
if (res && res.rows) {
|
||||||
|
memberOptions.value = res.rows || [];
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('加载成员列表失败:', err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// 页面初始化标志
|
||||||
|
const isInitialized = ref(false);
|
||||||
|
|
||||||
|
// 监听用户私有视角变化
|
||||||
|
watch(() => userStore.privateView, () => {
|
||||||
|
if (isInitialized.value) {
|
||||||
|
handleSearch();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
// 加载字典数据
|
||||||
|
if (!dictStore.isLoaded) {
|
||||||
|
dictStore.loadDictData();
|
||||||
|
}
|
||||||
|
// 加载成员列表
|
||||||
|
loadMemberList();
|
||||||
|
});
|
||||||
|
|
||||||
|
onLoad(() => {
|
||||||
|
nextTick(() => {
|
||||||
|
isInitialized.value = true;
|
||||||
|
handleSearch();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.project-list-page {
|
||||||
|
width: 100%;
|
||||||
|
height: 100vh;
|
||||||
|
background: #f5f5f5;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-section {
|
||||||
|
background: #fff;
|
||||||
|
padding: 16px;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-item {
|
||||||
|
flex: 1;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-input {
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 12px;
|
||||||
|
background: #f5f6f7;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.filter-picker {
|
||||||
|
height: 36px;
|
||||||
|
padding: 0 12px;
|
||||||
|
background: #f5f6f7;
|
||||||
|
border-radius: 6px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-text {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.picker-arrow {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-group {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.radio-item {
|
||||||
|
padding: 6px 16px;
|
||||||
|
background: #f5f6f7;
|
||||||
|
border-radius: 16px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #2885ff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tabs {
|
||||||
|
display: flex;
|
||||||
|
gap: 8px;
|
||||||
|
margin: 12px 0;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-tab {
|
||||||
|
padding: 6px 16px;
|
||||||
|
background: #f5f6f7;
|
||||||
|
border-radius: 16px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
background: #2885ff;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-buttons {
|
||||||
|
display: flex;
|
||||||
|
gap: 12px;
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-icon {
|
||||||
|
margin-right: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-scroll {
|
||||||
|
flex: 1;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-container {
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-card {
|
||||||
|
background: #fff;
|
||||||
|
border-radius: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 12px;
|
||||||
|
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expire-time {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expire-label {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.expire-value {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-name {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-description {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #666;
|
||||||
|
line-height: 1.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.project-meta {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 6px;
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-item {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.meta-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overdue-tip {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.overdue-text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #ff4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-state {
|
||||||
|
padding: 40px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.empty-text {
|
||||||
|
font-size: 14px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-more-tip {
|
||||||
|
padding: 20px 0;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.load-more-text {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
|
@ -436,7 +436,8 @@ const handleSubmit = async () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await createTask(payload);
|
const res = await createTask(payload);
|
||||||
|
console.log('@@@@@@@@@@',res);
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: '创建成功',
|
title: '创建成功',
|
||||||
|
|
@ -448,14 +449,11 @@ const handleSubmit = async () => {
|
||||||
}, 1200);
|
}, 1200);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
uni.hideLoading();
|
uni.hideLoading();
|
||||||
submitting.value = false;
|
|
||||||
console.error('创建任务失败:', error);
|
console.error('创建任务失败:', error);
|
||||||
uni.showToast({
|
// 错误提示已在响应拦截器中统一处理,这里不需要重复显示
|
||||||
title: error.message || '创建失败,请重试',
|
|
||||||
icon: 'none'
|
|
||||||
});
|
|
||||||
} finally {
|
} finally {
|
||||||
submitting.value = false;
|
submitting.value = false;
|
||||||
|
console.log('submitting', submitting.value);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -843,7 +841,7 @@ onLoad(async (options) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-label {
|
.form-label {
|
||||||
flex: 1;
|
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,6 +88,21 @@
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<!-- 任务文件展示 -->
|
||||||
|
<view class="task-files-wrapper" v-if="task.files && task.files.length > 0">
|
||||||
|
<view
|
||||||
|
class="file-attachment-item"
|
||||||
|
v-for="(file, fileIndex) in task.files"
|
||||||
|
:key="fileIndex"
|
||||||
|
@click="previewTaskFile(file)"
|
||||||
|
>
|
||||||
|
<text class="file-icon">{{ getFileIcon(file.name) }}</text>
|
||||||
|
<view class="file-info">
|
||||||
|
<text class="file-name">{{ file.name }}</text>
|
||||||
|
<text class="file-size" v-if="file.size > 0">{{ formatFileSize(file.size) }}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
<view class="delay-btn-wrapper">
|
<view class="delay-btn-wrapper">
|
||||||
<uv-button type="error" size="small" @click="applyDelay">申请延期</uv-button>
|
<uv-button type="error" size="small" @click="applyDelay">申请延期</uv-button>
|
||||||
</view>
|
</view>
|
||||||
|
|
@ -269,23 +284,19 @@ const determineTaskStatus = (status, expireTime) => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
// 设置时间到当天0点,便于日期比较
|
// 设置时间到当天0点,便于日期比较
|
||||||
now.setHours(0, 0, 0, 0);
|
// now.setHours(0, 0, 0, 0);
|
||||||
expireDate.setHours(23, 59, 59, 999);
|
// expireDate.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
// 如果已过期,标记为逾期
|
// 如果已过期,标记为逾期
|
||||||
if (expireDate.getTime() < now.getTime()) {
|
if (expireDate.getTime() < now.getTime()) {
|
||||||
return 'overdue';
|
return 'overdue';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 计算距离过期的天数
|
// 计算距离过期的天数
|
||||||
const diffTime = expireDate.getTime() - now.getTime();
|
const diffTime = expireDate.getTime() - now.getTime();
|
||||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||||
|
|
||||||
// 如果3天内到期,标记为即将逾期
|
// 如果3天内到期,标记为即将逾期
|
||||||
if (diffDays <= 3 && diffDays > 0) {
|
if (diffDays <= 3 && diffDays > 0) {
|
||||||
return 'imminent';
|
return 'imminent';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 否则返回待完成状态
|
// 否则返回待完成状态
|
||||||
return 'pending';
|
return 'pending';
|
||||||
};
|
};
|
||||||
|
|
@ -329,6 +340,32 @@ const isImageUrl = (url) => {
|
||||||
return /\.(jpg|jpeg|png|gif|bmp|webp)(\?|$)/i.test(url);
|
return /\.(jpg|jpeg|png|gif|bmp|webp)(\?|$)/i.test(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 解析任务附件(区分图片和文件)
|
||||||
|
const parseTaskAttachments = (attachStr) => {
|
||||||
|
if (!attachStr) return { pictures: [], files: [] };
|
||||||
|
if (typeof attachStr !== 'string') return { pictures: [], files: [] };
|
||||||
|
|
||||||
|
const urls = parseAttachUrls(attachStr);
|
||||||
|
const pictures = [];
|
||||||
|
const files = [];
|
||||||
|
|
||||||
|
urls.forEach(url => {
|
||||||
|
if (isImageUrl(url)) {
|
||||||
|
pictures.push(url);
|
||||||
|
} else {
|
||||||
|
// 从URL中提取文件名
|
||||||
|
const fileName = url.split('/').pop().split('?')[0] || '文件';
|
||||||
|
files.push({
|
||||||
|
name: fileName,
|
||||||
|
path: url,
|
||||||
|
size: 0 // 如果API没有返回文件大小,默认为0
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return { pictures, files };
|
||||||
|
};
|
||||||
|
|
||||||
// 转换提交记录数据
|
// 转换提交记录数据
|
||||||
const transformSubmitRecords = (submitList) => {
|
const transformSubmitRecords = (submitList) => {
|
||||||
if (!Array.isArray(submitList) || submitList.length === 0) {
|
if (!Array.isArray(submitList) || submitList.length === 0) {
|
||||||
|
|
@ -492,6 +529,73 @@ const previewTaskImages = (imageUrls, index) => {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 预览/下载任务文件
|
||||||
|
const previewTaskFile = (file) => {
|
||||||
|
if (!file.path) {
|
||||||
|
uni.showToast({
|
||||||
|
title: '文件路径不存在',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果是图片,使用预览图片功能
|
||||||
|
const imageExts = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
|
||||||
|
const ext = file.name ? file.name.split('.').pop().toLowerCase() : '';
|
||||||
|
|
||||||
|
if (imageExts.includes(ext)) {
|
||||||
|
uni.previewImage({
|
||||||
|
urls: [file.path],
|
||||||
|
current: file.path
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// 其他文件类型,尝试打开或下载
|
||||||
|
// #ifdef H5
|
||||||
|
window.open(file.path, '_blank');
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef APP-PLUS
|
||||||
|
plus.runtime.openURL(file.path);
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifndef H5 || APP-PLUS
|
||||||
|
uni.showToast({
|
||||||
|
title: '正在下载文件...',
|
||||||
|
icon: 'loading',
|
||||||
|
duration: 2000
|
||||||
|
});
|
||||||
|
// 下载并打开文档
|
||||||
|
uni.downloadFile({
|
||||||
|
url: file.path,
|
||||||
|
success: (res) => {
|
||||||
|
if (res.statusCode === 200) {
|
||||||
|
uni.openDocument({
|
||||||
|
filePath: res.tempFilePath,
|
||||||
|
success: () => {
|
||||||
|
console.log('打开文档成功');
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('打开文档失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '无法打开此文件',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: (err) => {
|
||||||
|
console.error('下载文件失败:', err);
|
||||||
|
uni.showToast({
|
||||||
|
title: '下载文件失败',
|
||||||
|
icon: 'none'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// #endif
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// 预览提交记录图片
|
// 预览提交记录图片
|
||||||
const previewRecordImages = (imageUrls, index) => {
|
const previewRecordImages = (imageUrls, index) => {
|
||||||
if (imageUrls && imageUrls.length > 0) {
|
if (imageUrls && imageUrls.length > 0) {
|
||||||
|
|
@ -683,8 +787,16 @@ const loadTaskData = async (taskId) => {
|
||||||
// 转换提交记录
|
// 转换提交记录
|
||||||
const submitRecords = transformSubmitRecords(res.submitList || []);
|
const submitRecords = transformSubmitRecords(res.submitList || []);
|
||||||
|
|
||||||
// 解析任务图片(逗号分隔的URL字符串)
|
// 解析任务附件(图片和文件)
|
||||||
const taskPictures = res.picture ? parseAttachUrls(res.picture) : [];
|
// 优先使用 file 字段,如果没有则使用 picture 字段(可能包含图片和文件)
|
||||||
|
let taskAttachments = { pictures: [], files: [] };
|
||||||
|
if (res.file) {
|
||||||
|
// 如果 API 返回了 file 字段,解析它
|
||||||
|
taskAttachments = parseTaskAttachments(res.file);
|
||||||
|
} else if (res.picture) {
|
||||||
|
// 如果只有 picture 字段,也解析它(可能包含图片和文件)
|
||||||
|
taskAttachments = parseTaskAttachments(res.picture);
|
||||||
|
}
|
||||||
|
|
||||||
// 更新任务数据
|
// 更新任务数据
|
||||||
task.value = {
|
task.value = {
|
||||||
|
|
@ -698,7 +810,8 @@ const loadTaskData = async (taskId) => {
|
||||||
responsible: getOwnerNames(res.memberList || []),
|
responsible: getOwnerNames(res.memberList || []),
|
||||||
publishTime: res.createTime ? formatTimeToChinese(res.createTime) : '',
|
publishTime: res.createTime ? formatTimeToChinese(res.createTime) : '',
|
||||||
content: res.description || '',
|
content: res.description || '',
|
||||||
pictures: taskPictures, // 任务图片数组
|
pictures: taskAttachments.pictures, // 任务图片数组
|
||||||
|
files: taskAttachments.files, // 任务文件数组
|
||||||
submitRecords: submitRecords,
|
submitRecords: submitRecords,
|
||||||
// 保存原始数据,供其他功能使用
|
// 保存原始数据,供其他功能使用
|
||||||
rawData: res
|
rawData: res
|
||||||
|
|
@ -722,24 +835,26 @@ onLoad((options) => {
|
||||||
task.value.id = taskId;
|
task.value.id = taskId;
|
||||||
// 优先从 API 加载数据
|
// 优先从 API 加载数据
|
||||||
loadTaskData(taskId);
|
loadTaskData(taskId);
|
||||||
} else {
|
}
|
||||||
// 如果没有 taskId,尝试从 Pinia store 获取任务详情数据(兼容旧逻辑)
|
else {
|
||||||
const taskStore = useTaskStore();
|
// // 如果没有 taskId,尝试从 Pinia store 获取任务详情数据(兼容旧逻辑)
|
||||||
const storedTask = taskStore.getTaskDetail;
|
// const taskStore = useTaskStore();
|
||||||
if (storedTask) {
|
// const storedTask = taskStore.getTaskDetail;
|
||||||
task.value = {
|
// if (storedTask) {
|
||||||
...task.value,
|
// task.value = {
|
||||||
...storedTask
|
// ...task.value,
|
||||||
};
|
// ...storedTask
|
||||||
} else {
|
// };
|
||||||
uni.showToast({
|
// }
|
||||||
title: '缺少任务ID',
|
// else {
|
||||||
icon: 'none'
|
// uni.showToast({
|
||||||
});
|
// title: '缺少任务ID',
|
||||||
setTimeout(() => {
|
// icon: 'none'
|
||||||
uni.navigateBack();
|
// });
|
||||||
}, 1500);
|
// setTimeout(() => {
|
||||||
}
|
// uni.navigateBack();
|
||||||
|
// }, 1500);
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -1187,6 +1302,14 @@ onShow(() => {
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 任务文件展示 */
|
||||||
|
.task-files-wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 8px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
/* 提交记录图片展示(一行三个) */
|
/* 提交记录图片展示(一行三个) */
|
||||||
.record-images-wrapper {
|
.record-images-wrapper {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed, watch, onMounted, onUnmounted } from 'vue';
|
import { ref, computed, watch, onMounted, onUnmounted, nextTick } from 'vue';
|
||||||
import { onLoad } from '@dcloudio/uni-app';
|
import { onLoad } from '@dcloudio/uni-app';
|
||||||
import { getStatusText, getTaskStatusType, getTaskStatusStyle } from '@/utils/taskConfig.js';
|
import { getStatusText, getTaskStatusType, getTaskStatusStyle } from '@/utils/taskConfig.js';
|
||||||
import {getTaskList} from '@/api';
|
import {getTaskList} from '@/api';
|
||||||
|
|
@ -285,9 +285,9 @@ const determineTaskStatus = (item, expireTime) => {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
// 设置时间到当天0点,便于日期比较
|
// 设置时间到当天0点,便于日期比较
|
||||||
now.setHours(0, 0, 0, 0);
|
// now.setHours(0, 0, 0, 0);
|
||||||
expireDate.setHours(23, 59, 59, 999);
|
// expireDate.setHours(23, 59, 59, 999);
|
||||||
|
|
||||||
// 如果已过期,标记为逾期
|
// 如果已过期,标记为逾期
|
||||||
if (expireDate.getTime() < now.getTime()) {
|
if (expireDate.getTime() < now.getTime()) {
|
||||||
return 'overdue';
|
return 'overdue';
|
||||||
|
|
@ -298,7 +298,7 @@ const determineTaskStatus = (item, expireTime) => {
|
||||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||||
|
|
||||||
// 如果3天内到期,标记为即将逾期
|
// 如果3天内到期,标记为即将逾期
|
||||||
if (diffDays <= 3 && diffDays > 0) {
|
if (diffDays <= 3 && diffDays >= 0) {
|
||||||
return 'imminent';
|
return 'imminent';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -431,7 +431,7 @@ watch(() => userStore.privateView, () => {
|
||||||
|
|
||||||
// 页面加载时获取参数
|
// 页面加载时获取参数
|
||||||
onLoad((options) => {
|
onLoad((options) => {
|
||||||
// 获取状态参数
|
// 获取状态参数(此时 isInitialized 为 false,watch 不会触发)
|
||||||
if (options.status) {
|
if (options.status) {
|
||||||
statusFilter.value = options.status;
|
statusFilter.value = options.status;
|
||||||
} else if (options.label) {
|
} else if (options.label) {
|
||||||
|
|
@ -446,9 +446,12 @@ onLoad((options) => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// 标记为已初始化,然后加载任务列表数据
|
// 在下一个 tick 中标记为已初始化并加载数据
|
||||||
isInitialized.value = true;
|
// 这样可以确保 watch 的回调(如果触发)在 isInitialized 还是 false 时不执行
|
||||||
loadTaskList();
|
nextTick(() => {
|
||||||
|
isInitialized.value = true;
|
||||||
|
loadTaskList();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -321,7 +321,6 @@ const handleSubmit = async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-label {
|
.form-label {
|
||||||
flex: 1;
|
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
color: #333;
|
color: #333;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ export const Request = () => {
|
||||||
// 初始化请求配置
|
// 初始化请求配置
|
||||||
uni.$uv.http.setConfig((config) => {
|
uni.$uv.http.setConfig((config) => {
|
||||||
/* config 为默认全局配置*/
|
/* config 为默认全局配置*/
|
||||||
config.baseURL = 'http://192.168.1.5:4001'; /* 根域名 */
|
config.baseURL = 'http://192.168.1.9:4001'; /* 根域名 */
|
||||||
// config.baseURL = 'https://pm.ccttiot.com/prod-api'; /* 根域名 */
|
// config.baseURL = 'https://pm.ccttiot.com/prod-api'; /* 根域名 */
|
||||||
return config
|
return config
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user