feat(M08-B): 补保洁员待补资料导出

This commit is contained in:
Codex
2026-07-07 09:18:59 +08:00
parent b643fda99c
commit 05cf27f112
6 changed files with 54 additions and 12 deletions
+31 -1
View File
@@ -19,6 +19,9 @@
<el-button :icon="Download" :disabled="items.length === 0" @click="exportCleaners">
导出
</el-button>
<el-button :icon="FileWarning" :disabled="incompleteCleaners.length === 0" @click="exportCleanerProfileIssues">
导出待补
</el-button>
<el-button type="primary" :icon="UserPlus" @click="createDialog.open = true">
新增
</el-button>
@@ -141,9 +144,10 @@
</template>
<script setup lang="ts">
import { reactive, ref, watch } from 'vue';
import { computed, reactive, ref, watch } from 'vue';
import {
Download,
FileWarning,
Pencil,
RefreshCw,
ShieldX,
@@ -196,6 +200,7 @@ const editDialog = reactive({
storeIdsText: '',
note: ''
});
const incompleteCleaners = computed(() => props.items.filter((row) => !profileComplete(row)));
watch(
() => props.search,
@@ -244,6 +249,14 @@ function profileComplete(row: ManagedUser) {
return row.wechatMiniappBound && row.storeIds.length > 0 && Boolean(row.nickname);
}
function profileIssues(row: ManagedUser) {
const issues: string[] = [];
if (!row.wechatMiniappBound) issues.push('未绑定微信');
if (!row.storeIds.length) issues.push('未配置门店范围');
if (!row.nickname) issues.push('缺姓名');
return issues;
}
function exportCleaners() {
downloadCsv(`cleaning-cleaners-${Date.now()}.csv`, [
['ID', '姓名', '状态', '微信绑定', '资料完整度', '门店范围', '手机号', '最近登录', '最近 IP', '注册时间', '备注'],
@@ -263,6 +276,23 @@ function exportCleaners() {
]);
}
function exportCleanerProfileIssues() {
downloadCsv(`cleaning-cleaner-profile-issues-${Date.now()}.csv`, [
['ID', '姓名', '状态', '待补项目', '微信绑定', '门店范围', '手机号', '最近登录', '备注'],
...incompleteCleaners.value.map((row) => [
row.id,
row.nickname || '',
row.status,
profileIssues(row).join(' / '),
row.wechatMiniappBound ? '已绑定微信' : '未绑定微信',
row.storeIds.join(' / '),
row.maskedPhone,
row.lastLoginAt || '',
row.note
])
]);
}
function downloadCsv(filename: string, rows: string[][]) {
const content = rows.map((row) => row.map(csvCell).join(',')).join('\r\n');
const blob = new Blob([`\uFEFF${content}`], { type: 'text/csv;charset=utf-8;' });