优化项目列表和添加项目
This commit is contained in:
parent
37b81d188a
commit
a9234a69b2
|
|
@ -108,7 +108,8 @@ export const getProjectDetail = (id) => {
|
||||||
export const createProject = (data) => {
|
export const createProject = (data) => {
|
||||||
return uni.$uv.http.post('bst/project', data, {
|
return uni.$uv.http.post('bst/project', data, {
|
||||||
custom: {
|
custom: {
|
||||||
auth: true
|
auth: true,
|
||||||
|
catch: true // 允许在 catch 中处理错误
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@
|
||||||
|
|
||||||
<view class="form-row">
|
<view class="form-row">
|
||||||
<view class="form-item half">
|
<view class="form-item half">
|
||||||
<text class="form-label required">项目金额(元)</text>
|
<text class="form-label ">项目金额(元)</text>
|
||||||
<input
|
<input
|
||||||
class="form-input"
|
class="form-input"
|
||||||
v-model="formData.amount"
|
v-model="formData.amount"
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<view class="form-item">
|
<view class="form-item">
|
||||||
<text class="form-label required">客户</text>
|
<text class="form-label ">客户</text>
|
||||||
<view class="picker-input" @click="openCustomerPicker">
|
<view class="picker-input" @click="openCustomerPicker">
|
||||||
<text>{{ formData.customerName || '请选择客户' }}</text>
|
<text>{{ formData.customerName || '请选择客户' }}</text>
|
||||||
<text class="picker-arrow">›</text>
|
<text class="picker-arrow">›</text>
|
||||||
|
|
@ -305,11 +305,12 @@ const pendingDateField = ref('');
|
||||||
|
|
||||||
const canSubmit = computed(() => {
|
const canSubmit = computed(() => {
|
||||||
return (
|
return (
|
||||||
!!formData.value.name &&
|
!!formData.value.name
|
||||||
!!formData.value.customerId &&
|
// &&
|
||||||
!!formData.value.amount &&
|
// !!formData.value.customerId &&
|
||||||
formData.value.memberList.length > 0 &&
|
// !!formData.value.amount &&
|
||||||
!submitting.value
|
// formData.value.memberList.length > 0 &&
|
||||||
|
// !submitting.value
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -533,7 +534,7 @@ const loadProjectDetail = async (id) => {
|
||||||
amount: merged.amount != null ? String(merged.amount) : '',
|
amount: merged.amount != null ? String(merged.amount) : '',
|
||||||
customerId: merged.customerId ? String(merged.customerId) : merged.customerId,
|
customerId: merged.customerId ? String(merged.customerId) : merged.customerId,
|
||||||
customerName: merged.customerName || '',
|
customerName: merged.customerName || '',
|
||||||
expireTime: normalizeDateString(merged.expireTime),
|
expireTime: merged.expireTime,
|
||||||
projectTags: merged.projectTags || '',
|
projectTags: merged.projectTags || '',
|
||||||
remark: merged.remark || '',
|
remark: merged.remark || '',
|
||||||
developmentCost: safeNumberToString(merged.developmentCost),
|
developmentCost: safeNumberToString(merged.developmentCost),
|
||||||
|
|
@ -584,15 +585,15 @@ const buildPayload = () => {
|
||||||
amount: parseNumber(formData.value.amount),
|
amount: parseNumber(formData.value.amount),
|
||||||
customerId: formData.value.customerId,
|
customerId: formData.value.customerId,
|
||||||
customerName: formData.value.customerName,
|
customerName: formData.value.customerName,
|
||||||
expireTime: formData.value.expireTime || null,
|
expireTime: formData.value.expireTime,
|
||||||
projectTags: formData.value.projectTags || '',
|
projectTags: formData.value.projectTags || '',
|
||||||
remark: formData.value.remark || '',
|
remark: formData.value.remark || '',
|
||||||
developmentCost: parseNumber(formData.value.developmentCost),
|
developmentCost: parseNumber(formData.value.developmentCost),
|
||||||
developmentTime: formData.value.developmentTime || null,
|
developmentTime: formatDateTimeForPayload(formData.value.developmentTime),
|
||||||
middleCost: parseNumber(formData.value.middleCost),
|
middleCost: parseNumber(formData.value.middleCost),
|
||||||
middleTime: formData.value.middleTime || null,
|
middleTime: formatDateTimeForPayload(formData.value.middleTime),
|
||||||
afterCost: parseNumber(formData.value.afterCost),
|
afterCost: parseNumber(formData.value.afterCost),
|
||||||
afterTime: formData.value.afterTime || null,
|
afterTime: formatDateTimeForPayload(formData.value.afterTime),
|
||||||
attaches: formData.value.attaches.map((file, index) => ({
|
attaches: formData.value.attaches.map((file, index) => ({
|
||||||
name: file.name || getFileNameFromUrl(file.path),
|
name: file.name || getFileNameFromUrl(file.path),
|
||||||
url: file.path,
|
url: file.path,
|
||||||
|
|
@ -622,7 +623,16 @@ const safeNumberToString = (value) => {
|
||||||
|
|
||||||
const normalizeDateString = (value) => {
|
const normalizeDateString = (value) => {
|
||||||
if (!value) return '';
|
if (!value) return '';
|
||||||
return value.split(' ')[0];
|
return value.replace('T', ' ').split(' ')[0];
|
||||||
|
};
|
||||||
|
|
||||||
|
const formatDateTimeForPayload = (value) => {
|
||||||
|
if (!value) return null;
|
||||||
|
const cleaned = value.replace('T', ' ').trim();
|
||||||
|
if (cleaned.includes(':')) {
|
||||||
|
return cleaned;
|
||||||
|
}
|
||||||
|
return `${cleaned} 00:00:00`;
|
||||||
};
|
};
|
||||||
|
|
||||||
const normalizeAttaches = (value) => {
|
const normalizeAttaches = (value) => {
|
||||||
|
|
@ -688,8 +698,8 @@ const formatDate = (timestamp) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.custom-navbar {
|
.custom-navbar {
|
||||||
height: 56px;
|
|
||||||
padding: 0 16px;
|
padding: 20px 20px;
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
background: #fff;
|
background: #fff;
|
||||||
|
|
@ -697,11 +707,12 @@ const formatDate = (timestamp) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.navbar-content {
|
.navbar-content {
|
||||||
|
margin-top: 15px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding-bottom: 10px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.nav-btn {
|
.nav-btn {
|
||||||
|
|
@ -803,6 +814,7 @@ const formatDate = (timestamp) => {
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
color: #111;
|
color: #111;
|
||||||
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-textarea {
|
.form-textarea {
|
||||||
|
|
@ -917,7 +929,7 @@ const formatDate = (timestamp) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.col.role {
|
.col.role {
|
||||||
width: 180px;
|
width: 140px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.col.action {
|
.col.action {
|
||||||
|
|
@ -1000,7 +1012,7 @@ const formatDate = (timestamp) => {
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
max-height: 80%;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-header {
|
.modal-header {
|
||||||
|
|
@ -1021,7 +1033,7 @@ const formatDate = (timestamp) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-box {
|
.search-box {
|
||||||
margin-bottom: 12px;
|
//margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.search-input {
|
.search-input {
|
||||||
|
|
@ -1034,6 +1046,7 @@ const formatDate = (timestamp) => {
|
||||||
|
|
||||||
.member-list {
|
.member-list {
|
||||||
height: 600px;
|
height: 600px;
|
||||||
|
margin: 12px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.member-item {
|
.member-item {
|
||||||
|
|
@ -1074,8 +1087,8 @@ const formatDate = (timestamp) => {
|
||||||
|
|
||||||
.modal-actions {
|
.modal-actions {
|
||||||
display: flex;
|
display: flex;
|
||||||
gap: 12px;
|
justify-content: space-between;
|
||||||
margin-top: 12px;
|
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -133,13 +133,17 @@
|
||||||
<view class="card-title">{{ project.name }}</view>
|
<view class="card-title">{{ project.name }}</view>
|
||||||
|
|
||||||
<!-- 项目标签和描述 -->
|
<!-- 项目标签和描述 -->
|
||||||
<view class="card-tags-row">
|
<!-- <view class="card-tags-row">-->
|
||||||
<view class="tag-circle" :style="{ backgroundColor: getTagColor(project) }">
|
|
||||||
<text class="tag-text">{{ getTagText(project) }}</text>
|
<!-- <view class="tag-circle" :style="{ backgroundColor: getTagColor(project) }">-->
|
||||||
</view>
|
<!-- <text class="tag-text">{{ getTagText(project) }}</text>-->
|
||||||
|
<!-- </view>-->
|
||||||
|
<!-- <text class="member-text">{{ project.createName }}</text>-->
|
||||||
|
|
||||||
|
<!-- </view>-->
|
||||||
|
<view class="card-tags-row" v-if="project.remark">
|
||||||
<text class="card-description" v-if="project.remark">{{ project.remark }}</text>
|
<text class="card-description" v-if="project.remark">{{ project.remark }}</text>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<!-- 操作标签 -->
|
<!-- 操作标签 -->
|
||||||
<view class="action-tags" v-if="project.tags && project.tags.length > 0">
|
<view class="action-tags" v-if="project.tags && project.tags.length > 0">
|
||||||
<view
|
<view
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user