diff --git a/admin/dashboard/templates/plugin_schedules.html b/admin/dashboard/templates/plugin_schedules.html
index 65b5921..a8d7604 100644
--- a/admin/dashboard/templates/plugin_schedules.html
+++ b/admin/dashboard/templates/plugin_schedules.html
@@ -87,10 +87,34 @@
-
+
+
+
+
-
+
+
+
+
@@ -126,6 +150,7 @@ new Vue({
return {
loading: false,
schedules: [],
+ groupOptions: [],
editDialogVisible: false,
logsDialogVisible: false,
logs: [],
@@ -142,11 +167,14 @@ new Vue({
target_scope: 'all_enabled_groups',
group_ids_text: '',
single_group_id: '',
+ selected_group_ids: [],
+ selected_single_group_id: '',
payload_text: '{}'
}
}
},
mounted() {
+ this.loadGroupOptions()
this.loadSchedules()
},
methods: {
@@ -165,6 +193,20 @@ new Vue({
this.loading = false
}
},
+ async loadGroupOptions() {
+ try {
+ const resp = await axios.get('/contacts/api/groups')
+ if (resp.data && resp.data.success) {
+ const groups = (resp.data.data && resp.data.data.groups) || {}
+ this.groupOptions = Object.entries(groups).map(([wxid, name]) => ({
+ wxid: String(wxid),
+ name: String(name || wxid)
+ }))
+ }
+ } catch (e) {
+ this.groupOptions = []
+ }
+ },
openEdit(row) {
this.currentId = row.id
const trigger = row.trigger_config || {}
@@ -180,6 +222,8 @@ new Vue({
this.editForm.target_scope = row.target_scope || 'all_enabled_groups'
this.editForm.group_ids_text = (target.group_ids || []).join(',')
this.editForm.single_group_id = target.group_id || ''
+ this.editForm.selected_group_ids = Array.isArray(target.group_ids) ? target.group_ids.map(x => String(x)) : []
+ this.editForm.selected_single_group_id = target.group_id ? String(target.group_id) : ''
this.editForm.payload_text = JSON.stringify(row.payload || {}, null, 2)
this.editDialogVisible = true
},
@@ -199,9 +243,14 @@ new Vue({
},
buildTargetConfig() {
if (this.editForm.target_scope === 'single_group') {
- return { group_id: String(this.editForm.single_group_id || '').trim() }
+ const groupId = String(this.editForm.selected_single_group_id || this.editForm.single_group_id || '').trim()
+ return { group_id: groupId }
}
if (this.editForm.target_scope === 'group_whitelist') {
+ const ids = (this.editForm.selected_group_ids || []).map(x => String(x).trim()).filter(Boolean)
+ if (ids.length > 0) {
+ return { group_ids: ids }
+ }
return {
group_ids: String(this.editForm.group_ids_text || '').split(',').map(x => x.trim()).filter(Boolean)
}