yidun送检新增账户下拉和导出优化

This commit is contained in:
2026-05-15 14:01:15 +08:00
parent 307b01c0e3
commit 3dbcf7a8e3
7 changed files with 388 additions and 30 deletions

View File

@@ -255,8 +255,15 @@
</el-select>
</div>
<div class="filter-item">
<label>账户ID:</label>
<el-input v-model="imageFilters.accountId" placeholder="账户ID" style="width: 120px;" clearable @keyup.enter.native="searchImage"></el-input>
<label>账户:</label>
<el-select v-model="imageFilters.accountId" placeholder="全部账户" clearable filterable style="width: 200px;" @change="searchImage">
<el-option
v-for="item in accounts"
:key="item.accountId"
:label="item.accountId + ' - ' + item.corporationName"
:value="item.accountId">
</el-option>
</el-select>
</div>
<el-button type="primary" @click="searchImage">搜索</el-button>
<el-button @click="resetImageFilter">重置</el-button>
@@ -334,8 +341,15 @@
</el-select>
</div>
<div class="filter-item">
<label>账户ID:</label>
<el-input v-model="videoFilters.accountId" placeholder="账户ID" style="width: 120px;" clearable @keyup.enter.native="searchVideo"></el-input>
<label>账户:</label>
<el-select v-model="videoFilters.accountId" placeholder="全部账户" clearable filterable style="width: 200px;" @change="searchVideo">
<el-option
v-for="item in accounts"
:key="item.accountId"
:label="item.accountId + ' - ' + item.corporationName"
:value="item.accountId">
</el-option>
</el-select>
</div>
<el-button type="primary" @click="searchVideo">搜索</el-button>
<el-button @click="resetVideoFilter">重置</el-button>
@@ -601,11 +615,14 @@
previewUrl: '',
previewType: 'image',
materialLogs: [],
batchLoading: false
batchLoading: false,
// 账户列表(下拉筛选用)
accounts: []
},
mounted() {
this.loadStats();
this.loadImageList();
this.loadAccounts();
},
methods: {
// API 请求
@@ -639,6 +656,21 @@
});
},
// 加载账户列表(下拉筛选用)
loadAccounts() {
this.apiPost('/material/verify/controller/list-accounts', {}).then(res => {
this.accounts = res.data.data?.list || [];
}).catch(err => {
console.error('加载账户列表失败', err);
});
},
// 获取账户名称(显示用)
getAccountName(accountId) {
const account = this.accounts.find(a => a.accountId === accountId);
return account ? account.corporationName : '';
},
// 图片列表
loadImageList() {
this.imageLoading = true;
@@ -813,36 +845,50 @@
});
},
// 导出
// 导出(不通过数据,含失败原因)
exportImageUrls() {
if (!this.imageList.length) {
this.$message.warning('没有可导出的图片');
return;
}
const rows = [['ID', '图片ID', '账户ID', '用途', '预览URL', '状态', '描述']];
this.imageList.forEach(item => {
rows.push([
item.id, item.imageId, item.accountId, item.imageUsage,
item.previewUrl || '-',
this.getStatusText(item.verifyStatus), item.description || '-'
]);
this.apiPost('/material/verify/controller/export-rejected', { materialType: 'IMAGE' }).then(res => {
const items = res.data.data?.items || [];
if (!items.length) {
this.$message.warning('没有不通过的图片数据');
return;
}
const rows = [['序号', '账户(名称)', '预览URL', '描述', '失败原因', '检测时间']];
items.forEach((item, index) => {
const accountLabel = item.corporationName ? item.accountId + ' - ' + item.corporationName : item.accountId;
rows.push([
index + 1, accountLabel,
item.previewUrl || '-', item.description || '-',
item.errorMsg || '-', item.createdAt || '-'
]);
});
this.downloadCsv('图片不通过数据.csv', rows);
this.$message.success('导出成功,共 ' + items.length + ' 条');
}).catch(err => {
this.$message.error('导出失败: ' + (err.response?.data?.msg || err.message));
});
this.downloadCsv('图片列表.csv', rows);
},
exportVideoUrls() {
if (!this.videoList.length) {
this.$message.warning('没有可导出的视频');
return;
}
const rows = [['ID', '视频ID', '账户ID', '预览URL', '状态', '描述']];
this.videoList.forEach(item => {
rows.push([
item.id, item.videoId, item.accountId,
item.previewUrl || '-',
this.getStatusText(item.verifyStatus), item.description || '-'
]);
this.apiPost('/material/verify/controller/export-rejected', { materialType: 'VIDEO' }).then(res => {
const items = res.data.data?.items || [];
if (!items.length) {
this.$message.warning('没有不通过的视频数据');
return;
}
const rows = [['序号', '账户(名称)', '预览URL', '描述', '失败原因', '检测时间']];
items.forEach((item, index) => {
const accountLabel = item.corporationName ? item.accountId + ' - '+ item.corporationName : item.accountId;
rows.push([
index + 1, accountLabel,
item.previewUrl || '-', item.description || '-',
item.errorMsg || '-', item.createdAt || '-'
]);
});
this.downloadCsv('视频不通过数据.csv', rows);
this.$message.success('导出成功,共 ' + items.length + ' 条');
}).catch(err => {
this.$message.error('导出失败: ' + (err.response?.data?.msg || err.message));
});
this.downloadCsv('视频列表.csv', rows);
},
downloadCsv(filename, rows) {
const csv = rows.map(r => r.map(v => `"${String(v).replace(/"/g, '""')}"`).join(',')).join('\n');