diff --git a/src/api/my.js b/src/api/my.js
index 746cd38..d4b0fee 100644
--- a/src/api/my.js
+++ b/src/api/my.js
@@ -22,3 +22,18 @@ export function share_record_batchDelete (data) {
data,
})
}
+
+export function peer_list (params) {
+ return request({
+ url: '/my/peer/list',
+ params,
+ })
+}
+
+export function address_book_batchCreateFromPeers (data) {
+ return request({
+ url: '/my/address_book/batchCreateFromPeers',
+ method: 'post',
+ data,
+ })
+}
diff --git a/src/views/my/peer/index.vue b/src/views/my/peer/index.vue
index dcd5c0c..261e0ec 100644
--- a/src/views/my/peer/index.vue
+++ b/src/views/my/peer/index.vue
@@ -191,7 +191,7 @@
import { connectByClient } from '@/utils/peer'
import { CopyDocument } from '@element-plus/icons'
import { handleClipboard } from '@/utils/clipboard'
- import { batchCreateFromPeers } from '@/api/address_book'
+ import { address_book_batchCreateFromPeers as batchCreateFromPeers } from '@/api/my'
const appStore = useAppStore()
const listRes = reactive({
diff --git a/src/views/peer/index.vue b/src/views/peer/index.vue
index 66e4aa1..46bb2ed 100644
--- a/src/views/peer/index.vue
+++ b/src/views/peer/index.vue
@@ -24,6 +24,7 @@
{{ T('Add') }}
{{ T('Export') }}
{{ T('BatchDelete') }}
+ {{ T('BatchAddToAB') }}
@@ -157,6 +158,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ T('Cancel') }}
+ {{ T('Submit') }}
+
+
+
@@ -176,6 +213,7 @@
import { connectByClient } from '@/utils/peer'
import { CopyDocument } from '@element-plus/icons'
import { handleClipboard } from '@/utils/clipboard'
+ import { batchCreateFromPeers } from '@/api/address_book'
const appStore = useAppStore()
const listRes = reactive({
@@ -312,11 +350,14 @@
formVisible: ABFormVisible,
formData: ABFormData,
fromPeer,
+ changeCollection,
+ collectionListRes,
+ collectionListQuery,
+ getCollectionList,
} = useABRepositories()
const toAddressBook = (peer) => {
fromPeer(peer)
ABFormVisible.value = true
-
}
const ABSubmit = async () => {
const res = await batchCreate(ABFormData).catch(_ => false)
@@ -367,6 +408,42 @@
getList()
}
}
+
+ // 批量添加到地址簿
+ const changeUser = (val) => {
+ collectionListQuery.user_id = val
+ batchABFormData.value.collection_id = 0
+ getCollectionList()
+ }
+ const batchABFormVisible = ref(false)
+ const toBatchAddToAB = () => {
+ batchABFormVisible.value = true
+ }
+ const batchABFormData = ref({
+ collection_id: 0,
+ tags: [],
+ peer_ids: [],
+ user_id: null,
+ })
+ const submitBatchAddToAB = async () => {
+ if (multipleSelection.value.length === 0) {
+ ElMessage.warning(T('PleaseSelectData'))
+ return false
+ }
+ batchABFormData.value.peer_ids = multipleSelection.value.map(i => i.row_id)
+ if (!batchABFormData.value.peer_ids.length) {
+ ElMessage.warning(T('PleaseSelectData'))
+ return false
+ }
+
+ const res = await batchCreateFromPeers(batchABFormData.value).catch(_ => false)
+ if (res) {
+ ElMessage.success(T('OperationSuccess'))
+ batchABFormVisible.value = false
+ getList()
+ }
+ }
+