wuzhen update

This commit is contained in:
wuzhen committed 2025-08-21 14:21:15 +08:00
1 parent cf5eb97553
commit be3d48b6e3
13 files changed
+273 -59

No files matched your search

+30 -5
View File
@@ -720,12 +720,14 @@ function handleAdd() {
/** 修改按钮操作 */
async function handleUpdate(row?: ScholarshipBatchVO) {
reset();
const _id = row?.id || ids.value[0];
const res = await getScholarshipBatch(_id);
// 先赋值基本数据
Object.assign(form.value, res.data);
// 关键修复:不调用reset(),直接赋值数据,确保ID不会被重置为undefined
form.value = {
...res.data,
id: String(_id) // 🔧 修复:确保ID为字符串格式,避免精度丢失
};
// 确保scholarshipTypeIds正确赋值
if (res.data.scholarshipTypeIds && Array.isArray(res.data.scholarshipTypeIds)) {
@@ -734,6 +736,13 @@ async function handleUpdate(row?: ScholarshipBatchVO) {
form.value.scholarshipTypeIds = [];
}
// 清除表单验证状态,但不重置数据
batchFormRef.value?.clearValidate();
// 调试日志 - 验证ID是否正确
console.log('修改操作 - ID:', form.value.id, '类型:', typeof form.value.id);
console.log('修改操作 - 完整数据:', JSON.stringify(form.value, null, 2));
dialog.visible = true;
dialog.title = '修改奖学金评定批次';
}
@@ -753,6 +762,10 @@ function submitForm() {
buttonLoading.value = true;
try {
// 调试日志 - 提交前检查数据
console.log('提交前表单数据:', form.value);
console.log('提交前ID值:', form.value.id, '类型:', typeof form.value.id);
// 检查时间冲突
const conflictCheck = await checkTimeConflict(form.value);
if (conflictCheck.data) {
@@ -760,10 +773,22 @@ function submitForm() {
return;
}
if (form.value.id) {
await updateScholarshipBatch(form.value);
// 关键修复:更严格的ID检查逻辑
const isUpdate = form.value.id && form.value.id !== undefined && form.value.id !== '' && form.value.id !== null;
if (isUpdate) {
console.log('执行修改操作,ID:', form.value.id, '类型:', typeof form.value.id);
// 🔧 修复:保持ID为字符串格式,避免精度丢失
// 不再使用parseInt(),直接使用字符串格式的ID
const updateData = {
...form.value,
id: String(form.value.id) // 确保ID始终为字符串格式
};
console.log('发送到后端的修改数据:', JSON.stringify(updateData, null, 2));
await updateScholarshipBatch(updateData);
proxy?.$modal.msgSuccess('修改成功');
} else {
console.log('执行新增操作,ID为:', form.value.id);
await addScholarshipBatch(form.value);
proxy?.$modal.msgSuccess('新增成功');
}
@@ -16,10 +16,7 @@
<span class="preview-label">岗位名称:</span>
<el-tag type="primary" size="large">{{ position?.positionName }}</el-tag>
</div>
<div class="preview-item">
<span class="preview-label">工作地点:</span>
<span class="preview-value">{{ position?.workLocation }}</span>
</div>
<div class="preview-item">
<span class="preview-label">工作时间:</span>
<span class="preview-value">{{ position?.workTime }}</span>
@@ -196,7 +193,6 @@ const formData = reactive<WorkStudyApplicationForm>({
positionId: 0,
positionName: '',
positionType: '',
workLocation: '',
familyFinancialStatus: '',
applicationReason: '',
personalAbility: '',