反馈修改

master
lion 2 months ago
parent aa3a569b75
commit 1d134c6ec0

@ -8,8 +8,27 @@
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>企业名称
</div>
<div class="xy-table-item-content">
<el-input v-model="form.company_name" placeholder="请输入企业名称" clearable style="width: 100%;"></el-input>
<!-- @input="searchCompany" @clear="clearCompanySearch" -->
<el-select
v-model="form.company_name"
filterable
remote
reserve-keyword
allow-create
default-first-option
placeholder="请输入企业名称搜索"
:remote-method="searchCompany"
:loading="companySearchLoading"
clearable
style="width: 100%;"
@change="onCompanyChange"
@create="onCreateCompany">
<el-option
v-for="item in companySearchResults"
:key="item.id"
:label="item.enterpriseName"
:value="item.enterpriseName">
</el-option>
</el-select>
</div>
</div>
</template>
@ -236,23 +255,46 @@
this.form = this.base.requestToForm(res, this.form)
})
},
async searchCompany() {
const keyword = (this.form.company_name || '').trim()
if (!keyword) {
async searchCompany(query) {
if (query !== '') {
this.companySearchLoading = true
try {
const res = await search({ company_name: query })
// 使 enterpriseName
this.companySearchResults = res || []
} catch (error) {
console.error('企业搜索失败:', error)
this.companySearchResults = []
} finally {
this.companySearchLoading = false
}
} else {
this.companySearchResults = []
return
}
this.companySearchLoading = true
try {
const res = await search({ company_name: keyword})
// { data: [...] } { list: [...] }
this.companySearchResults = res.data || res.list || []
} catch (e) {
},
onCompanyChange(value) {
if (!value) {
this.form.company_name = ''
this.companySearchResults = []
} finally {
this.companySearchLoading = false
} else {
//
const selectedCompany = this.companySearchResults.find(item => item.enterpriseName === value)
if (selectedCompany) {
//
// this.form.company_attribute = selectedCompany.attribute
}
}
},
onCreateCompany(query) {
//
console.log('Creating new company:', query);
//
this.companySearchResults.push({
id: Math.random().toString(36).substr(2, 9), // ID
enterpriseName: query
});
this.form.company_name = query; //
},
clearCompanySearch() {
this.companySearchResults = []
}

@ -173,6 +173,7 @@
</div>
<div>
<div 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">
<template v-slot:index>
@ -347,6 +348,11 @@
courseTypeList: [],
list: [],
total: 0,
year_total: 0,
alltotal: 0,
year_training_total: 0,
training_total: 0,
searyear: '',
seleSchoolmates: [],
table_item: [{
type: 'selection',
@ -560,6 +566,12 @@
})
this.list = res.list.data
this.total = res.list.total
//
this.year_total = res.year_total || 0
this.year_training_total = res.year_training_total || 0
this.training_total = res.training_total || 0
this.alltotal = res.total || 0
this.searyear = this.select.year ? this.select.year : ''
},
changeDate(e) {
if (e) {
@ -706,11 +718,34 @@
})
this.courseTypeList = res.data
}
},
watch: {
isShow(newVal) {
if (!newVal) {
//
this.year_total = 0
this.alltotal = 0
this.year_training_total = 0
this.training_total = 0
this.searyear = ''
}
}
}
}
</script>
<style lang="scss" scoped>
.txl {
display: flex;
align-items: center;
margin-bottom: 10px;
font-size: 18px;
&>div {
margin-right: 15px;
}
}
.searchwrap {
display: flex;
align-items: center;

Loading…
Cancel
Save