反馈修改

dev
lion 2 months ago
parent aa3a569b75
commit 1d134c6ec0

@ -8,8 +8,27 @@
<span style="color: red;font-weight: bold;padding-right: 4px;">*</span>企业名称 <span style="color: red;font-weight: bold;padding-right: 4px;">*</span>企业名称
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<el-input v-model="form.company_name" placeholder="请输入企业名称" clearable style="width: 100%;"></el-input> <el-select
<!-- @input="searchCompany" @clear="clearCompanySearch" --> 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>
</div> </div>
</template> </template>
@ -236,23 +255,46 @@
this.form = this.base.requestToForm(res, this.form) this.form = this.base.requestToForm(res, this.form)
}) })
}, },
async searchCompany() { async searchCompany(query) {
const keyword = (this.form.company_name || '').trim() if (query !== '') {
if (!keyword) { 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 = [] this.companySearchResults = []
return
} }
this.companySearchLoading = true },
try { onCompanyChange(value) {
const res = await search({ company_name: keyword}) if (!value) {
// { data: [...] } { list: [...] } this.form.company_name = ''
this.companySearchResults = res.data || res.list || []
} catch (e) {
this.companySearchResults = [] this.companySearchResults = []
} finally { } else {
this.companySearchLoading = false //
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() { clearCompanySearch() {
this.companySearchResults = [] this.companySearchResults = []
} }

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

Loading…
Cancel
Save