From f95e4b63471516c2d33bf9fd9beea85512083292 Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Wed, 31 Dec 2025 16:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E5=8F=96=E5=AD=A6=E6=A0=A1=E6=A8=A1?= =?UTF-8?q?=E7=B3=8A=E6=90=9C=E7=B4=A2=E4=B8=BA=E7=BB=84=E4=BB=B6=E3=80=81?= =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E9=A1=B5=E9=9D=A2=E5=86=85=E7=9A=84=E5=8E=9F?= =?UTF-8?q?=E6=9C=89=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/clientSet/searchInput.vue | 226 ++++++++++++++++++++++++++++ src/views/super/clientSet/coverInfoPage.vue | 81 ++-------- src/views/super/paiban/tpl.vue | 78 +++------- 3 files changed, 265 insertions(+), 120 deletions(-) create mode 100644 src/components/clientSet/searchInput.vue diff --git a/src/components/clientSet/searchInput.vue b/src/components/clientSet/searchInput.vue new file mode 100644 index 0000000..70d1a39 --- /dev/null +++ b/src/components/clientSet/searchInput.vue @@ -0,0 +1,226 @@ + + + + + \ No newline at end of file diff --git a/src/views/super/clientSet/coverInfoPage.vue b/src/views/super/clientSet/coverInfoPage.vue index 15c02a6..9d912c6 100644 --- a/src/views/super/clientSet/coverInfoPage.vue +++ b/src/views/super/clientSet/coverInfoPage.vue @@ -6,25 +6,16 @@
所属学校
-
-
+ - - - + style="width: 356px;" + /> @@ -65,6 +56,7 @@ import GroupFormBtns from '@/components/GroupFormBtns.vue'; import GuipRadio from '@/components/GuipRadio.vue'; import GuipButton from '@/components/GuipButton.vue'; // import GuipSelect from '@/components/GuipSelect.vue'; +import SchoolAutoComplete from '@/components/clientSet/searchInput.vue'; // 引入公共组件 export default { name: 'CoverInfoPage', @@ -73,6 +65,7 @@ export default { GuipInput, GuipRadio, GuipButton, + SchoolAutoComplete // GuipSelect }, data() { @@ -127,55 +120,17 @@ export default { }, methods: { - handleSelect(item) { - console.log('选中:', item); - this.$emit('select', item); + handleSchoolSelect(item) { + console.log('选中学校:', item); this.coverInfo.school = item.id; this.coverInfo.school_name = item.name; - console.log(this.coverInfo.school,this.coverInfo.school_name,'==='); }, - querySearchAsync(queryString, callback) { - const keyword = queryString && queryString.trim(); - - // 如果搜索内容为空或与上次相同,直接返回 - if (!keyword || keyword === this.lastSearchKeyword) { - callback([]); - return; - } - - this.lastSearchKeyword = keyword; - this.loading = true; - - // 使用防抖 - clearTimeout(this.timeout); - this.timeout = setTimeout(() => { - this.getSchoolSearchList(keyword, callback); - }, 300); - }, - getSchoolSearchList(keyword, callback) { - try { - this.$http('POST', '/supernew/ajax_get_paiban_schools', { - keyword - }).then(response => { - if(response.status){ - const data = response.data || []; - - if (data.length === 0) { - // this.$Message.info('未找到相关学校') - } - callback(data); - }else{ - callback([]); - } - }).catch(error => { - this.$Message.info('搜索学校列表失败') - callback([]); - console.error(error, 'error') - }) - } catch (error) { - console.error('数据加载失败:', error) - } + handleSchoolClear() { + console.log('学校选择已清空'); + this.coverInfo.school = ''; + this.coverInfo.school_name = ''; }, + async getCoverInfo(){ // this.$http('POST', '/supernew/ajax_get_paiban_template_list', {}, { // }).then(response => { @@ -342,8 +297,4 @@ export default { align-items: flex-start; padding: 24px 32px; } -.autoInput{ - width: 300px; - -} \ No newline at end of file diff --git a/src/views/super/paiban/tpl.vue b/src/views/super/paiban/tpl.vue index a58704b..f6051bf 100644 --- a/src/views/super/paiban/tpl.vue +++ b/src/views/super/paiban/tpl.vue @@ -7,7 +7,7 @@ - - - + --> + + @@ -64,15 +73,15 @@ import GuipTable from "@/components/GuipTable.vue"; import GuipSelect from "@/components/GuipSelect.vue"; // import GuipInput from "@/components/GuipInput.vue"; import GuipFormItem from '@/components/GuipFormItem.vue' - +import SchoolAutoComplete from '@/components/clientSet/searchInput.vue'; // 引入公共组件 export default { components: { // GuipInput, GuipSelect, GuipTable, GuipButton, - GuipFormItem - + GuipFormItem, + SchoolAutoComplete }, options: { styleIsolation: "shared" }, data() { @@ -120,55 +129,17 @@ export default { this.getList() this.getStatusList() //缺学历下拉列表 }, - handleSelect(item) { - console.log('选中:', item); - this.$emit('select', item); + handleSchoolSelect(item) { + console.log('选中学校:', item); this.school = item.id; this.schoolName = item.name; - console.log(this.school,this.schoolName,'==='); - this.getList() - }, - querySearchAsync(queryString, callback) { - const keyword = queryString.trim(); - - // 如果搜索内容为空或与上次相同,直接返回 - if (!keyword || keyword === this.lastSearchKeyword) { - callback([]); - return; - } - - this.lastSearchKeyword = keyword; - this.loading = true; - - // 使用防抖 - clearTimeout(this.timeout); - this.timeout = setTimeout(() => { - this.getSchoolSearchList(keyword, callback); - }, 300); + this.getList(); }, - getSchoolSearchList(keyword, callback) { - try { - this.$http('POST', '/supernew/ajax_get_paiban_schools', { - keyword - }).then(response => { - if(response.status){ - const data = response.data || []; - - if (data.length === 0) { - // this.$Message.info('未找到相关学校') - } - callback(data); - }else{ - callback([]); - } - }).catch(error => { - this.$Message.info('搜索学校列表失败') - callback([]); - console.error(error, 'error') - }) - } catch (error) { - console.error('数据加载失败:', error) - } + handleSchoolClear() { + console.log('学校选择已清空'); + this.school = ''; + this.schoolName = ''; + this.getList(); }, getStatusList() { @@ -240,9 +211,6 @@ export default { ::v-deep .el-form-item{ margin: 0; } -.autoInput{ - width: 300px; -} .filter-area{ gap: 32px;