|
|
@@ -19,7 +19,7 @@
|
|
19
|
19
|
></el-option>
|
|
20
|
20
|
</el-select>
|
|
21
|
21
|
</el-form-item>
|
|
22
|
|
- <el-form-item >
|
|
|
22
|
+ <el-form-item>
|
|
23
|
23
|
<el-button type="primary" @click="handlerQuery">{{ T('Filter') }}</el-button>
|
|
24
|
24
|
<el-button type="success" @click="toExport">{{ T('Export') }}</el-button>
|
|
25
|
25
|
<el-button type="danger" @click="toBatchDelete">{{ T('BatchDelete') }}</el-button>
|
|
|
@@ -71,9 +71,9 @@
|
|
71
|
71
|
:total="listRes.total">
|
|
72
|
72
|
</el-pagination>
|
|
73
|
73
|
</el-card>
|
|
74
|
|
- <el-dialog v-model="formVisible" :title="T('Information')" width="800" :style="{ textAlign: 'center' }" >
|
|
|
74
|
+ <el-dialog v-model="formVisible" :title="T('Information')" width="800" :style="{ textAlign: 'center' }">
|
|
75
|
75
|
<el-form class="dialog-form" ref="form" :model="formData" label-width="120px">
|
|
76
|
|
- <el-form-item label="ID" prop="id" >
|
|
|
76
|
+ <el-form-item label="ID" prop="id">
|
|
77
|
77
|
<el-input v-model="formData.id" disabled></el-input>
|
|
78
|
78
|
</el-form-item>
|
|
79
|
79
|
<el-form-item :label="T('Username')" prop="username">
|
|
|
@@ -102,14 +102,10 @@
|
|
102
|
102
|
|
|
103
|
103
|
<el-dialog v-model="ABFormVisible" width="800" :title="T('Create')">
|
|
104
|
104
|
<el-form class="dialog-form" ref="form" :model="ABFormData" label-width="120px">
|
|
105
|
|
- <el-form-item :label="T('Owner')" prop="user_ids" required>
|
|
106
|
|
- <el-select v-model="ABFormData.user_ids" multiple>
|
|
107
|
|
- <el-option
|
|
108
|
|
- v-for="item in allUsers"
|
|
109
|
|
- :key="item.id"
|
|
110
|
|
- :label="item.username"
|
|
111
|
|
- :value="item.id"
|
|
112
|
|
- ></el-option>
|
|
|
105
|
+ <el-form-item :label="T('AddressBookName')" required prop="collection_id">
|
|
|
106
|
+ <el-select v-model="ABFormData.collection_id" clearable @change="changeCollection">
|
|
|
107
|
+ <el-option :value="0" :label="T('MyAddressBook')"></el-option>
|
|
|
108
|
+ <el-option v-for="c in collectionListRes.list" :key="c.id" :label="c.name" :value="c.id"></el-option>
|
|
113
|
109
|
</el-select>
|
|
114
|
110
|
</el-form-item>
|
|
115
|
111
|
<el-form-item label="ID" prop="id" required>
|
|
|
@@ -138,7 +134,7 @@
|
|
138
|
134
|
<el-form-item :label="T('Tags')" prop="tags">
|
|
139
|
135
|
<el-select v-model="ABFormData.tags" multiple>
|
|
140
|
136
|
<el-option
|
|
141
|
|
- v-for="item in tagList"
|
|
|
137
|
+ v-for="item in tagListRes.list"
|
|
142
|
138
|
:key="item.name"
|
|
143
|
139
|
:label="item.name"
|
|
144
|
140
|
:value="item.name"
|
|
|
@@ -164,9 +160,6 @@
|
|
164
|
160
|
import { timeAgo } from '@/utils/time'
|
|
165
|
161
|
import { jsonToCsv, downBlob } from '@/utils/file'
|
|
166
|
162
|
import { useRepositories as useABRepositories } from '@/views/address_book/index'
|
|
167
|
|
- import { loadAllUsers } from '@/global'
|
|
168
|
|
- import { list as fetchTagList } from '@/api/tag'
|
|
169
|
|
- import { batchCreate } from '@/api/address_book'
|
|
170
|
163
|
import { useAppStore } from '@/store/app'
|
|
171
|
164
|
import { connectByClient } from '@/utils/peer'
|
|
172
|
165
|
import { CopyDocument } from '@element-plus/icons'
|
|
|
@@ -244,7 +237,7 @@
|
|
244
|
237
|
formData[key] = row[key]
|
|
245
|
238
|
})
|
|
246
|
239
|
}
|
|
247
|
|
-
|
|
|
240
|
+
|
|
248
|
241
|
const timeDis = (time) => {
|
|
249
|
242
|
let now = new Date().getTime()
|
|
250
|
243
|
let after = new Date(time * 1000).getTime()
|
|
|
@@ -284,33 +277,18 @@
|
|
284
|
277
|
platformList: ABPlatformList,
|
|
285
|
278
|
formVisible: ABFormVisible,
|
|
286
|
279
|
formData: ABFormData,
|
|
|
280
|
+ collectionListRes,
|
|
|
281
|
+ getCollectionList,
|
|
|
282
|
+ tagListRes,
|
|
|
283
|
+ changeCollection,
|
|
|
284
|
+ submit: ABSubmit,
|
|
|
285
|
+ fromPeer
|
|
287
|
286
|
} = useABRepositories()
|
|
|
287
|
+ onMounted(getCollectionList)
|
|
288
|
288
|
const toAddressBook = (peer) => {
|
|
289
|
|
- ABFormData.id = peer.id
|
|
290
|
|
- ABFormData.username = peer.username
|
|
291
|
|
- ABFormData.hostname = peer.hostname
|
|
292
|
|
- //匹配os
|
|
293
|
|
- if (peer.os.indexOf('windows') !== -1) {
|
|
294
|
|
- ABFormData.platform = ABPlatformList.find(item => item.label === 'Windows').value
|
|
295
|
|
- } else if (peer.os.indexOf('linux') !== -1) {
|
|
296
|
|
- ABFormData.platform = ABPlatformList.find(item => item.label === 'Linux').value
|
|
297
|
|
- } else if (peer.os.indexOf('android') !== -1) {
|
|
298
|
|
- ABFormData.platform = ABPlatformList.find(item => item.label === 'Android').value
|
|
299
|
|
- } else if (peer.os.indexOf('mac') !== -1) {
|
|
300
|
|
- ABFormData.platform = ABPlatformList.find(item => item.label === 'Mac OS').value
|
|
301
|
|
- }
|
|
302
|
|
- ABFormData.uuid = peer.uuid
|
|
|
289
|
+ fromPeer(peer)
|
|
303
|
290
|
ABFormVisible.value = true
|
|
304
|
|
-
|
|
305
|
291
|
}
|
|
306
|
|
- const ABSubmit = async () => {
|
|
307
|
|
- const res = await batchCreate(ABFormData).catch(_ => false)
|
|
308
|
|
- if (res) {
|
|
309
|
|
- ElMessage.success(T('OperationSuccess'))
|
|
310
|
|
- ABFormVisible.value = false
|
|
311
|
|
- }
|
|
312
|
|
- }
|
|
313
|
|
-
|
|
314
|
292
|
|
|
315
|
293
|
const multipleSelection = ref([])
|
|
316
|
294
|
const handleSelectionChange = (val) => {
|