From 29214bad64fb4046a3857ba1a98297aeeb27bf62 Mon Sep 17 00:00:00 2001 From: 10086 <845831435@qq.com> Date: Fri, 26 Jul 2024 18:47:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8F=82=E6=95=B0=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat: 新增参数校验 fix: 参数筛选问题修改 fix: 删除打印 --- components.d.ts | 1 + opendesign/dropdown/ODropdown.vue | 2 +- src/components/AppIssue.vue | 72 +++++++++++++++++++++----- src/components/AppPull.vue | 55 +++++++++++++++++--- src/i18n/quick-issue/quick-issue-en.ts | 6 ++- src/i18n/quick-issue/quick-issue-zh.ts | 6 ++- src/views/submit-issue/SubmitIssue.vue | 7 +-- 7 files changed, 118 insertions(+), 31 deletions(-) diff --git a/components.d.ts b/components.d.ts index d8212c3..0af5c05 100644 --- a/components.d.ts +++ b/components.d.ts @@ -17,6 +17,7 @@ declare module 'vue' { DocAnchor: typeof import('./src/components/DocAnchor.vue')['default'] ElCard: typeof import('element-plus/es')['ElCard'] ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] + ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] ElCollapse: typeof import('element-plus/es')['ElCollapse'] ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem'] ElDialog: typeof import('element-plus/es')['ElDialog'] diff --git a/opendesign/dropdown/ODropdown.vue b/opendesign/dropdown/ODropdown.vue index ed9f557..52cad61 100644 --- a/opendesign/dropdown/ODropdown.vue +++ b/opendesign/dropdown/ODropdown.vue @@ -106,7 +106,7 @@ onUnmounted(() => { margin-bottom: 5px; background-color: var(--o-color-bg2); width: 100%; - z-index: 1; + z-index: 2; .o-search { padding: 4px 8px; diff --git a/src/components/AppIssue.vue b/src/components/AppIssue.vue index 262b432..0539853 100644 --- a/src/components/AppIssue.vue +++ b/src/components/AppIssue.vue @@ -22,6 +22,8 @@ import IconSetting from '~icons/app/icon-setting'; import ODropdown from 'opendesign/dropdown/ODropdown.vue'; import OIcon from 'opendesign/icon/OIcon.vue'; +import { ElOption } from 'element-plus'; + const props = defineProps({ issueType: { type: String, @@ -377,15 +379,50 @@ watch( deep: true, } ); +// element-plus select 组件 超出 limit 点击 仍然会触发 watch问题处理 +const maxTag = 5; watch( - () => queryData, - () => { + () => [queryData.label, queryData.exclusion], + (oldValue, newValue) => { + // 超出 limit 继续点击当前选项不调用接口 + if ( + (oldValue[0].length === newValue[0].length && + oldValue[0].length === maxTag && + oldValue[1].length === newValue[1].length) || + (oldValue[1].length === newValue[1].length && + oldValue[1].length === maxTag && + oldValue[0].length === newValue[0].length) + ) { + return; + } getRepoIssueData(); }, { deep: true, } ); +watch( + () => [ + queryData.assignee, + queryData.author, + queryData.create, + queryData.direction, + queryData.page, + queryData.per_page, + queryData.branch, + queryData.repo, + queryData.search, + queryData.priority, + queryData.sort, + queryData.issue_state, + queryData.milestone, + queryData.issue_type, + ], + () => { + getRepoIssueData(); + } +); + watch( () => optionQuery, () => { @@ -413,6 +450,7 @@ watch( @@ -571,18 +609,19 @@ watch( @change="handleCheckAllChange" >{{ t('quickIssue.SELECT_ALL') }} - - {{ item }} - - + + @@ -632,19 +671,20 @@ watch( @input="valueChangeDebounced" > - - {{ item }} - - + + No Data @@ -1089,6 +1129,7 @@ watch( multiple :placeholder="t('quickIssue.SELECT')" popper-class="remove-scrollbar" + :multiple-limit="5" :listener-scorll="true" @scorll-bottom="getNextPage" @visible-change="(val: boolean) => changeVisible(val, 'labels')" @@ -1120,13 +1161,16 @@ watch( -

{{ t('quickIssue.LABER_TIP') }}

+

+ {{ t('quickIssue.LABER_TIP', [t('quickIssue.ISSUE')]) }} +

{{ t('quickIssue.EXCLUDE') }}
-

{{ t('quickIssue.LABER_TIP1') }}

+

+ {{ t('quickIssue.LABER_TIP1', [t('quickIssue.ISSUE')]) }} +

diff --git a/src/components/AppPull.vue b/src/components/AppPull.vue index b739c75..c4c04ff 100644 --- a/src/components/AppPull.vue +++ b/src/components/AppPull.vue @@ -9,6 +9,8 @@ import { OptionList } from '@/shared/@types/type-quick-issue'; import { isValidKey } from '@/shared/utils'; import { useLabelColor } from '@/stores/index'; +import { ElOption } from 'element-plus'; + import IconTraingleUp from '~icons/app/icon-arrow-traingle-up.svg'; import IconTraingleDown from '~icons/app/icon-arrow-traingle-down.svg'; import IconFilter from '~icons/app/icon-filter.svg'; @@ -323,8 +325,39 @@ watch( deep: true, } ); +// element-plus select 组件 超出 limit 点击 仍然会触发 watch问题处理 +const maxTag = 5; +watch( + () => [queryData.label, queryData.exclusion], + (oldValue, newValue) => { + if ( + (oldValue[0].length === newValue[0].length && + oldValue[0].length === maxTag && + oldValue[1].length === newValue[1].length) || + (oldValue[1].length === newValue[1].length && + oldValue[1].length === maxTag && + oldValue[0].length === newValue[0].length) + ) { + return; + } + getRepoIssueData(); + } +); watch( - () => queryData, + () => [ + queryData.assignee, + queryData.author, + queryData.create, + queryData.direction, + queryData.page, + queryData.per_page, + queryData.ref, + queryData.repo, + queryData.search, + queryData.sig, + queryData.sort, + queryData.state, + ], () => { getRepoIssueData(); }, @@ -359,6 +392,7 @@ watch( @@ -563,15 +597,16 @@ watch( @@ -895,6 +930,7 @@ watch( -

{{ t('quickIssue.LABER_TIP') }}

+

+ {{ t('quickIssue.LABER_TIP', [t('quickIssue.PR')]) }} +

{{ t('quickIssue.EXCLUDE') }}
-

{{ t('quickIssue.LABER_TIP1') }}

+

+ {{ t('quickIssue.LABER_TIP1', [t('quickIssue.PR')]) }} +

diff --git a/src/i18n/quick-issue/quick-issue-en.ts b/src/i18n/quick-issue/quick-issue-en.ts index c61e680..5dcfb75 100644 --- a/src/i18n/quick-issue/quick-issue-en.ts +++ b/src/i18n/quick-issue/quick-issue-en.ts @@ -37,8 +37,10 @@ export default { PRIVACY: 'Privacy Statement', SELECT_ALL: 'Select All', EXCLUDE: 'Exclude Labels', - LABER_TIP: 'PRs containing all included labels will be displayed', - LABER_TIP1: 'PRs containing any of the excluded labels will be hidden', + LABER_TIP: '{0} containing all included labels will be displayed', + LABER_TIP1: '{0} containing any of the excluded labels will be hidden', + PR:'PRs', + ISSUE:'Issues', PRIVACY_TEXT: 'By filling and submitting the content, I fully understand and agree to the terms of the openEuler ', SELECT_SIG: 'Select SIG', diff --git a/src/i18n/quick-issue/quick-issue-zh.ts b/src/i18n/quick-issue/quick-issue-zh.ts index 61a0b36..06dbf68 100644 --- a/src/i18n/quick-issue/quick-issue-zh.ts +++ b/src/i18n/quick-issue/quick-issue-zh.ts @@ -38,8 +38,10 @@ export default { PRIVACY: '《隐私声明》', SELECT_ALL: '选择全部', EXCLUDE: '排除标签', - LABER_TIP: '同时包括所有“选中标签”的PR将会被筛选出来', - LABER_TIP1: '包含“排除标签”的PR不会被筛选出来', + LABER_TIP: '同时包括所有“选中标签”的{0}将会被筛选出来', + LABER_TIP1: '包含“排除标签”的{0}不会被筛选出来', + PR:'PR', + ISSUE:'ISSUE', PRIVACY_TEXT: '您理解并同意,您填写并提交的内容,即视为您已充分阅读并同意openEuler的', SELECT_SIG: '选择SIG组', diff --git a/src/views/submit-issue/SubmitIssue.vue b/src/views/submit-issue/SubmitIssue.vue index 992edb1..71ab313 100644 --- a/src/views/submit-issue/SubmitIssue.vue +++ b/src/views/submit-issue/SubmitIssue.vue @@ -361,12 +361,7 @@ onMounted(async () => { issueData.description = targetType?.template || ''; } landscapeInfo.value = await getSigLandscape(lang.value); - } catch { - ElMessage({ - message: 'error', - type: 'error', - }); - } + } catch (err) {} }); watch( () => repoParams, -- Gitee