diff --git a/src/api/address_book.js b/src/api/address_book.js index 3414da2..26f3716 100644 --- a/src/api/address_book.js +++ b/src/api/address_book.js @@ -52,3 +52,19 @@ export function shareByWebClient (data) { data, }) } + +export function batchCreateFromPeers (data) { + return request({ + url: '/address_book/batchCreateFromPeers', + method: 'post', + data, + }) +} + +export function batchUpdateTags (data) { + return request({ + url: '/address_book/batchUpdateTags', + method: 'post', + data, + }) +} diff --git a/src/utils/i18n/en.json b/src/utils/i18n/en.json index b609803..1d12b92 100644 --- a/src/utils/i18n/en.json +++ b/src/utils/i18n/en.json @@ -450,5 +450,11 @@ }, "UserToken": { "One": "User Token" + }, + "BatchAddToAB": { + "One": "Batch Add To Address Book" + }, + "BatchEditTags": { + "One": "Batch Edit Tags" } } diff --git a/src/utils/i18n/es.json b/src/utils/i18n/es.json index c300af6..763525e 100644 --- a/src/utils/i18n/es.json +++ b/src/utils/i18n/es.json @@ -453,5 +453,11 @@ }, "MyPeer": { "One": "Mis pares" + }, + "BatchAddToAB": { + "One": "Agregar en bloque a la libreta de direcciones" + }, + "BatchEditTags": { + "One": "Editar etiquetas en bloque" } } diff --git a/src/utils/i18n/ko.json b/src/utils/i18n/ko.json index 21937af..bc5a660 100644 --- a/src/utils/i18n/ko.json +++ b/src/utils/i18n/ko.json @@ -439,5 +439,11 @@ }, "MyPeer": { "One": "내 피어" + }, + "BatchAddToAB": { + "One": "주소록에 일괄 추가" + }, + "BatchEditTags": { + "One": "태그 일괄 편집" } } diff --git a/src/utils/i18n/ru.json b/src/utils/i18n/ru.json index 9ac1b8f..935bc3e 100644 --- a/src/utils/i18n/ru.json +++ b/src/utils/i18n/ru.json @@ -453,6 +453,12 @@ }, "MyPeer": { "One": "Мои партнеры" + }, + "BatchAddToAB": { + "One": "Пакетное добавление в адресную книгу" + }, + "BatchEditTags": { + "One": "Пакетное редактирование тегов" } } diff --git a/src/utils/i18n/zh_CN.json b/src/utils/i18n/zh_CN.json index b46c8ec..e59d38f 100644 --- a/src/utils/i18n/zh_CN.json +++ b/src/utils/i18n/zh_CN.json @@ -469,5 +469,11 @@ }, "Information": { "One": "信息" + }, + "BatchAddToAB": { + "One": "批量添加到地址簿" + }, + "BatchEditTags": { + "One": "批量编辑标签" } } diff --git a/src/views/address_book/index.js b/src/views/address_book/index.js index c4da5e6..3e5889f 100644 --- a/src/views/address_book/index.js +++ b/src/views/address_book/index.js @@ -1,5 +1,5 @@ -import { reactive, ref, watch } from 'vue' -import { create, list, remove, update } from '@/api/address_book' +import { reactive, ref } from 'vue' +import { batchUpdateTags, create, list, remove, update } from '@/api/address_book' import { ElMessage, ElMessageBox } from 'element-plus' import { T } from '@/utils/i18n' import { useRepositories as useCollectionRepositories } from '@/views/address_book/collection' @@ -246,3 +246,53 @@ export function useRepositories (is_my = 0) { fromPeer, } } + +export function useBatchUpdateTagsRepositories (is_my = 0) { + const { + listRes: tagListRes, + listQuery: tagListQuery, + getList: getTagList, + } = useTagRepositories(is_my) + tagListQuery.page_size = 9999 + + const visible = ref(false) + const show = () => { + if (formData.value.row_ids.length === 0) { + ElMessage.warning(T('PleaseSelectData')) + return + } + visible.value = true + } + const formData = ref({ + tags: [], + row_ids: [], + }) + const submit = async () => { + if (formData.value.row_ids.length === 0) { + ElMessage.warning(T('PleaseSelectData')) + return false + } + if (formData.value.tags.length === 0) { + ElMessage.warning(T('PleaseSelectData')) + return false + } + const res = await batchUpdateTags(formData.value).catch(_ => false) + if (res) { + ElMessage.success(T('Success')) + visible.value = false + return true + } + return false + } + + return { + tagListQuery, + getTagList, + tagListRes, + + visible, + formData, + show, + submit, + } +} diff --git a/src/views/my/address_book/index.vue b/src/views/my/address_book/index.vue index 7e5cd98..942d5ff 100644 --- a/src/views/my/address_book/index.vue +++ b/src/views/my/address_book/index.vue @@ -20,12 +20,13 @@ {{ T('Filter') }} {{ T('Add') }} + {{ T('BatchEditTags') }} - - + + @@ -151,13 +152,31 @@ @cancel="shareToWebClientVisible=false" @success=""/> + + + + + + + + + {{ T('Cancel') }} + {{ T('Submit') }} + + +