企业户调整

master
lion 2 weeks ago
parent b6caed4999
commit c12285604a

@ -19,3 +19,7 @@ export function cancel(data) {
export function unknownConfirm(data) {
return request({ method: 'post', url: '/api/admin/qcc-enterprise-accounts/unknown-confirm', data, isLoading: true })
}
export function selectNonOccupying(data) {
return request({ method: 'post', url: '/api/admin/qcc-enterprise-accounts/select-non-occupying', data, isLoading: true })
}

@ -39,7 +39,7 @@
</div>
<div class="card-content">
<div class="card-value">{{ schoolmate_total }}</div>
<div class="card-label">付费校友数</div>
<div class="card-label">校友数</div>
</div>
</div>
<!-- <div class="card-note">校友包含:初创班、高研班、攀峰班</div> -->

@ -25,7 +25,7 @@ import { index } from '@/api/qccEnterpriseAccount/index'
import StudentFilters from './StudentFilters'
import StudentInfo from './StudentInfo'
const statusMap = { selected: ['warning', '候选'], occupied: ['success', '已占额'], unknown: ['danger', '待人工确认'] }
const statusMap = { selected: ['warning', '候选'], non_occupying: ['info', '不占额企业'], occupied: ['success', '已占额'], unknown: ['danger', '待人工确认'] }
export default {
name: 'QccAccountList',

@ -1,17 +1,18 @@
<template>
<div v-loading="loading" class="qcc-enterprise-account">
<lx-header icon="md-business" :text="$route.meta.title || '企查查企业户标注'" style="margin: 15px 0 10px; border: 0">
<div slot="content"><el-alert title="纳入候选池不会调用企查查。首次调用明确成功后即标记为已占额且不可撤销;状态未知时需先人工确认。" type="warning" :closable="false" show-icon /></div>
<div slot="content"><el-alert title="纳入候选池不会调用企查查。首次调用明确成功后即标记为已占额且不可撤销;状态未知时需先人工确认。不占额企业不参与新闻采集。" type="warning" :closable="false" show-icon /></div>
</lx-header>
<el-tabs v-model="activeTab">
<el-tab-pane label="候选企业" name="candidates">
<div class="toolbar">
<el-input v-model.trim="candidateQuery.keyword" clearable placeholder="企业名称或统一社会信用代码" style="width: 280px" @keyup.enter.native="resetCandidatePage" />
<el-select v-model="candidateQuery.status" clearable placeholder="企业户状态" style="width: 150px"><el-option label="未纳入" value="none" /><el-option label="候选" value="selected" /><el-option label="已占额" value="occupied" /><el-option label="待人工确认" value="unknown" /></el-select>
<el-select v-model="candidateQuery.status" clearable placeholder="企业户状态" style="width: 150px"><el-option label="未纳入" value="none" /><el-option label="候选" value="selected" /><el-option label="不占额企业" value="non_occupying" /><el-option label="已占额" value="occupied" /><el-option label="待人工确认" value="unknown" /></el-select>
<student-filters :value="candidateQuery" @search="resetCandidatePage" />
<el-button type="primary" size="small" @click="resetCandidatePage">查询</el-button>
<el-button type="primary" size="small" :disabled="selectedCompanies.length === 0" @click="selectCompanies">纳入候选池</el-button>
<el-button type="primary" size="small" :disabled="selectedCompanies.length === 0 || enrolling" @click="selectCompanies">纳入候选池</el-button>
<el-button type="primary" size="small" :disabled="selectedCompanies.length === 0 || enrolling" @click="selectNonOccupyingCompanies">纳入不占额企业</el-button>
</div>
<el-table :data="candidateList" border stripe @selection-change="selectedCompanies = $event">
<el-table-column type="selection" width="50" :selectable="isSelectable" />
@ -24,6 +25,7 @@
</el-table>
<el-pagination class="pagination" background layout="total, prev, pager, next" :current-page="candidateQuery.page" :page-size="candidateQuery.page_size" :total="candidateTotal" @current-change="changeCandidatePage" />
</el-tab-pane>
<el-tab-pane label="不占额企业" name="non_occupying"><account-list v-if="activeTab === 'non_occupying'" status="non_occupying" empty-text="暂无不占额企业" /></el-tab-pane>
<el-tab-pane label="已占额企业" name="occupied"><account-list v-if="activeTab === 'occupied'" status="occupied" empty-text="暂无已占额企业" /></el-tab-pane>
<el-tab-pane label="待人工确认" name="unknown"><account-list v-if="activeTab === 'unknown'" ref="unknownList" status="unknown" empty-text="暂无待人工确认企业" @confirm="openUnknownConfirm" /></el-tab-pane>
</el-tabs>
@ -40,15 +42,15 @@
</template>
<script>
import { candidates, select, cancel, unknownConfirm } from '@/api/qccEnterpriseAccount/index'
import { candidates, select, selectNonOccupying, cancel, unknownConfirm } from '@/api/qccEnterpriseAccount/index'
import AccountList from './components/AccountList'
import StudentFilters from './components/StudentFilters'
import StudentInfo from './components/StudentInfo'
const statusMap = { none: ['info', '未纳入'], selected: ['warning', '候选'], occupied: ['success', '已占额'], unknown: ['danger', '待人工确认'] }
const statusMap = { none: ['info', '未纳入'], selected: ['warning', '候选'], non_occupying: ['info', '不占额企业'], occupied: ['success', '已占额'], unknown: ['danger', '待人工确认'] }
export default {
name: 'QccEnterpriseAccount', components: { AccountList, StudentFilters, StudentInfo },
data() { return { activeTab: 'candidates', loading: false, candidateList: [], candidateTotal: 0, selectedCompanies: [], candidateQuery: { user_name: '', is_schoolmate: '', course_type_id: '', course_name: '', keyword: '', status: '', page: 1, page_size: 20 }, confirmDialogVisible: false, confirming: false, confirmForm: { id: '', decision: 'retry', evidence: '' }} },
data() { return { activeTab: 'candidates', loading: false, enrolling: false, candidateList: [], candidateTotal: 0, selectedCompanies: [], candidateQuery: { user_name: '', is_schoolmate: '', course_type_id: '', course_name: '', keyword: '', status: '', page: 1, page_size: 20 }, confirmDialogVisible: false, confirming: false, confirmForm: { id: '', decision: 'retry', evidence: '' }} },
created() { this.loadCandidates() },
methods: {
accountStatus(company) { return company.qcc_account ? company.qcc_account.status : 'none' },
@ -58,7 +60,18 @@ export default {
async loadCandidates() { this.loading = true; this.selectedCompanies = []; try { const res = await candidates(this.candidateQuery); this.candidateList = res.data || []; this.candidateTotal = res.total || 0 } finally { this.loading = false } },
resetCandidatePage() { this.candidateQuery.page = 1; this.loadCandidates() },
changeCandidatePage(page) { this.candidateQuery.page = page; this.loadCandidates() },
async selectCompanies() { await select({ company_ids: this.selectedCompanies.map(item => item.id) }); this.$message.success('已纳入候选池,尚未发生外部调用'); this.selectedCompanies = []; this.loadCandidates() },
selectCompanies() { return this.enrollCompanies(false) },
selectNonOccupyingCompanies() { return this.enrollCompanies(true) },
async enrollCompanies(nonOccupying) {
if (this.enrolling || !this.selectedCompanies.length) return
this.enrolling = true
try {
const action = nonOccupying ? selectNonOccupying : select
await action({ company_ids: this.selectedCompanies.map(item => item.id) })
this.$message.success(nonOccupying ? '已纳入不占额企业' : '已纳入候选池,尚未发生外部调用')
await this.loadCandidates()
} catch (_) { /* Request interceptor displays errors. */ } finally { this.enrolling = false }
},
async cancelCandidate(id) { await this.$confirm('仅候选状态可取消,确认继续吗?', '取消候选', { type: 'warning' }); await cancel({ id }); this.$message.success('已取消候选关系'); this.loadCandidates() },
openUnknownConfirm(account) { this.confirmForm = { id: account.id, decision: 'retry', evidence: '' }; this.confirmDialogVisible = true },
async confirmUnknown() { if (!this.confirmForm.evidence) return this.$message.warning('请填写核验依据'); if (this.confirmForm.decision === 'occupied') await this.$confirm('确认已占额后不可撤销,确认继续吗?', '不可撤销确认', { type: 'warning' }); this.confirming = true; try { await unknownConfirm(this.confirmForm); this.$message.success('状态已确认'); this.confirmDialogVisible = false; if (this.$refs.unknownList) this.$refs.unknownList.load(); this.loadCandidates() } finally { this.confirming = false } }

@ -252,6 +252,10 @@
</div>
<div>
<div v-if="isIndex2Route" class="schoolmate-statistics">
<span v-for="item in schoolmateCourseTypeStats" :key="item.id">{{ item.name }}:{{ item.total }}人</span>
<span>报名多课程体系校友数:{{ multiCourseTypeSchoolmateTotal }}人</span>
</div>
<div v-if="!isIndex2Route" class="txl">统计:{{searyear?searyear+'年':'本年度'}}报名{{year_total}}人;本年度培养学员{{year_training_total}}人;累计报名{{alltotal}}人;累计培养学员{{training_total}}人。</div>
<xy-table :list="list" @pageIndexChange="pageIndexChange" @pageSizeChange="pageSizeChange" :showIndex="false"
@selection-change="selectionChange" :total="total" :table-item="table_item">
@ -521,6 +525,8 @@
courseOptions: [],
list: [],
total: 0,
schoolmateCourseTypeStats: [],
multiCourseTypeSchoolmateTotal: 0,
year_total: 0,
alltotal: 0,
year_training_total: 0,
@ -855,7 +861,7 @@
this.select.is_vip = ''
this.select.courses_start_date = ''
this.select.courses_end_date = ''
this.select.is_schoolmate = ''
this.select.is_schoolmate = this.isIndex2Route ? 1 : ''
this.select.education = ''
this.select.type = ''
this.select.status = ''
@ -915,6 +921,8 @@
})
this.list = res.list.data
this.total = res.list.total
this.schoolmateCourseTypeStats = res.schoolmate_course_type_stats || []
this.multiCourseTypeSchoolmateTotal = res.multi_course_type_schoolmate_total || 0
// 获取统计数据
this.year_total = res.year_total || 0
this.year_training_total = res.year_training_total || 0
@ -1109,6 +1117,17 @@
</script>
<style lang="scss" scoped>
.schoolmate-statistics {
display: flex;
flex-wrap: wrap;
gap: 12px 24px;
margin-bottom: 16px;
padding: 16px;
background: #f5f7fa;
border-radius: 4px;
font-size: 16px;
}
.txl {
display: flex;
align-items: center;

@ -0,0 +1,34 @@
import { shallowMount, createLocalVue } from '@vue/test-utils'
import VueRouter from 'vue-router'
import Account from '@/views/qccEnterpriseAccount/index'
import { candidates, select, selectNonOccupying } from '@/api/qccEnterpriseAccount/index'
jest.mock('@/api/qccEnterpriseAccount/index', () => ({ candidates: jest.fn(), select: jest.fn(), selectNonOccupying: jest.fn(), cancel: jest.fn(), unknownConfirm: jest.fn() }))
const flush = async() => { await Promise.resolve(); await Promise.resolve() }
const localVue = createLocalVue()
localVue.use(VueRouter)
localVue.directive('loading', {})
let wrapper
beforeEach(() => {
candidates.mockResolvedValue({ data: [], total: 0 })
selectNonOccupying.mockResolvedValue({})
wrapper = shallowMount(Account, { localVue, router: new VueRouter(), mocks: { $message: { success: jest.fn() }}, stubs: ['lx-header', 'student-filters', 'student-info', 'account-list', 'el-tabs', 'el-tab-pane', 'el-table', 'el-table-column', 'el-select', 'el-option', 'el-button', 'el-input', 'el-pagination', 'el-dialog', 'el-form', 'el-form-item', 'el-alert', 'el-radio-group', 'el-radio'] })
})
afterEach(() => { if (wrapper) wrapper.destroy(); jest.clearAllMocks() })
it('sends selected company IDs to the non-occupying action and refreshes the list', async() => {
await flush()
wrapper.setData({ selectedCompanies: [{ id: 1 }, { id: 2 }] })
await wrapper.vm.selectNonOccupyingCompanies()
expect(selectNonOccupying).toHaveBeenCalledWith({ company_ids: [1, 2] })
expect(select).not.toHaveBeenCalled()
expect(candidates).toHaveBeenCalledTimes(2)
expect(wrapper.vm.selectedCompanies).toEqual([])
expect(wrapper.vm.statusLabel('non_occupying')).toBe('不占额企业')
})
it('prevents duplicate submissions and keeps already enrolled companies unselectable', async() => {
await flush()
wrapper.setData({ selectedCompanies: [{ id: 1 }], enrolling: true })
await wrapper.vm.selectNonOccupyingCompanies()
expect(selectNonOccupying).not.toHaveBeenCalled()
expect(wrapper.vm.isSelectable({ credit_code: 'code', qcc_account: { status: 'non_occupying' }})).toBe(false)
expect(wrapper.vm.isSelectable({ credit_code: 'code' })).toBe(true)
})
Loading…
Cancel
Save