修正征信维护列表筛选与上传展示逻辑

This commit is contained in:
wkc
2026-03-24 14:00:21 +08:00
parent 47eed3e63c
commit 8fa1b6e098
10 changed files with 160 additions and 26 deletions

View File

@@ -1,13 +1,18 @@
import request from '@/utils/request'
export function uploadCreditHtml(data) {
export function uploadCreditHtml(files) {
const formData = new FormData()
files.forEach((file) => {
formData.append('files', file)
})
return request({
url: '/ccdi/creditInfo/upload',
method: 'post',
data: formData,
headers: {
'Content-Type': 'multipart/form-data'
},
data
}
})
}

View File

@@ -31,9 +31,8 @@
/>
</el-form-item>
<el-form-item label="是否已维护">
<el-select v-model="queryParams.maintained" clearable placeholder="请选择是否已维护" style="width: 240px">
<el-select v-model="queryParams.maintained" placeholder="仅展示已维护数据" style="width: 240px">
<el-option label="已维护" value="1" />
<el-option label="未维护" value="0" />
</el-select>
</el-form-item>
<el-form-item>
@@ -53,7 +52,11 @@
<el-table-column label="姓名" prop="name" align="center" />
<el-table-column label="柜员号" prop="staffId" align="center" />
<el-table-column label="身份证号" prop="idCard" align="center" />
<el-table-column label="最近征信查询日期" prop="queryDate" align="center" width="160" />
<el-table-column label="最近征信查询日期" align="center" width="160">
<template slot-scope="scope">
{{ formatQueryDate(scope.row.queryDate) }}
</template>
</el-table-column>
<el-table-column label="负债笔数" prop="debtCount" align="center" width="100" />
<el-table-column label="负债总额" prop="debtTotalAmount" align="center" width="140" />
<el-table-column label="民事案件笔数" prop="civilCnt" align="center" width="120" />
@@ -130,7 +133,7 @@
<el-dialog title="征信详情" :visible.sync="detailDialogVisible" width="960px" append-to-body>
<div class="section-title">征信摘要</div>
<el-row :gutter="16" class="detail-summary">
<el-col :span="8">征信查询日期{{ detailForm.queryDate || "-" }}</el-col>
<el-col :span="8">征信查询日期{{ formatQueryDate(detailForm.queryDate) }}</el-col>
<el-col :span="8">负债笔数{{ detailForm.debtCount || 0 }}</el-col>
<el-col :span="8">负债总额{{ detailForm.debtTotalAmount || 0 }}</el-col>
</el-row>
@@ -207,7 +210,7 @@ export default {
name: undefined,
staffId: undefined,
idCard: undefined,
maintained: undefined,
maintained: "1",
},
};
},
@@ -239,7 +242,7 @@ export default {
name: undefined,
staffId: undefined,
idCard: undefined,
maintained: undefined,
maintained: "1",
};
this.resetForm("queryForm");
this.handleQuery();
@@ -274,12 +277,9 @@ export default {
this.$modal.msgError("请先选择征信 HTML 文件");
return;
}
const formData = new FormData();
this.uploadFileList.forEach((file) => {
formData.append("files", file.raw || file);
});
const files = this.uploadFileList.map((file) => file.raw || file);
this.uploadSubmitting = true;
return uploadCreditHtml(formData)
return uploadCreditHtml(files)
.then((response) => {
const data = response.data || {};
this.uploadResult = {
@@ -289,6 +289,10 @@ export default {
};
this.failureList = data.failures || [];
this.$modal.msgSuccess(response.msg || "上传成功");
this.uploadFileList = [];
if (this.$refs.upload) {
this.$refs.upload.clearFiles();
}
this.getList();
})
.finally(() => {
@@ -302,7 +306,7 @@ export default {
this.detailForm = {
personId: data.personId || row.idCard,
personName: data.personName || row.name,
queryDate: negativeInfo.queryDate || row.queryDate,
queryDate: data.queryDate || negativeInfo.queryDate || row.queryDate,
debtCount: row.debtCount || (data.debtList || []).length,
debtTotalAmount: row.debtTotalAmount || 0,
civilCnt: negativeInfo.civilCnt || row.civilCnt || 0,
@@ -327,6 +331,18 @@ export default {
this.getList();
});
},
formatQueryDate(value) {
if (!value) {
return "-";
}
if (typeof value === "string") {
const matched = value.match(/^(\d{4}-\d{2}-\d{2})/);
if (matched) {
return matched[1];
}
}
return this.parseTime(value, "{y}-{m}-{d}") || "-";
},
},
};
</script>

View File

@@ -8,7 +8,7 @@ assert(fs.existsSync(apiPath), "未找到征信维护 API 文件 ccdiCreditInfo.
const source = fs.readFileSync(apiPath, "utf8");
[
"export function uploadCreditHtml(data)",
"export function uploadCreditHtml(files)",
"export function listCreditInfo(query)",
"export function getCreditInfoDetail(personId)",
"export function deleteCreditInfo(personId)",

View File

@@ -0,0 +1,21 @@
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const componentPath = path.resolve(
__dirname,
"../../src/views/ccdiCreditInfo/index.vue"
);
const source = fs.readFileSync(componentPath, "utf8");
[
"formatQueryDate(value)",
"const matched = value.match(/^(",
'this.parseTime(value, "{y}-{m}-{d}")',
"{{ formatQueryDate(scope.row.queryDate) }}",
"{{ formatQueryDate(detailForm.queryDate) }}",
].forEach((token) => {
assert(source.includes(token), `征信时间展示缺少关键实现: ${token}`);
});
console.log("credit-info-date-display test passed");

View File

@@ -0,0 +1,21 @@
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const componentPath = path.resolve(
__dirname,
"../../src/views/ccdiCreditInfo/index.vue"
);
const source = fs.readFileSync(componentPath, "utf8");
assert(
source.includes('maintained: "1"'),
"征信维护页面应默认只查询已维护数据"
);
assert(
!source.includes('label="未维护"'),
"征信维护页面不应再提供未维护筛选项"
);
console.log("credit-info-maintained-filter test passed");

View File

@@ -0,0 +1,37 @@
const assert = require("assert");
const fs = require("fs");
const path = require("path");
const apiPath = path.resolve(__dirname, "../../src/api/ccdiCreditInfo.js");
const pagePath = path.resolve(__dirname, "../../src/views/ccdiCreditInfo/index.vue");
const apiSource = fs.readFileSync(apiPath, "utf8");
const pageSource = fs.readFileSync(pagePath, "utf8");
assert(
apiSource.includes("const formData = new FormData()"),
"征信上传 API 应在接口层构造 FormData避免页面层直接传裸 FormData"
);
assert(
apiSource.includes("files.forEach((file) => {"),
"征信上传 API 应逐个追加批量文件"
);
assert(
apiSource.includes("formData.append('files', file)"),
"征信上传 API 应按后端约定使用 files 字段名"
);
assert(
apiSource.includes("'Content-Type': 'multipart/form-data'"),
"征信上传 API 必须显式声明 multipart/form-data 请求头"
);
assert(
pageSource.includes("const files = this.uploadFileList.map((file) => file.raw || file);") &&
pageSource.includes("uploadCreditHtml(files)"),
"征信上传页面应把原始文件数组交给 API 层处理"
);
assert(
!pageSource.includes("const formData = new FormData();"),
"征信上传页面不应自行拼装 FormData"
);
console.log("credit-info-upload-api-behavior test passed");