Skip to content

Commit b548ee5

Browse files
author
Taois
committed
feat:增加全局动作
1 parent d76dfa0 commit b548ee5

File tree

4 files changed

+636
-5
lines changed

4 files changed

+636
-5
lines changed

dashboard/src/api/types/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ export const createSiteInfo = () => ({
183183
quickSearch: 1, // 是否支持快速搜索
184184
filterable: 1, // 是否可筛选
185185
order: 0, // 排序
186-
ext: '' // 扩展参数
186+
ext: '', // 扩展参数
187+
more: null // 额外配置信息(包含actions等)
187188
})
188189

189190
/**

dashboard/src/components/Breadcrumb.vue

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,11 +88,19 @@
8888
</div>
8989
</div>
9090
</a-modal>
91+
92+
<!-- 全局动作弹窗 -->
93+
<GlobalActionDialog
94+
v-model:visible="showGlobalActionDialog"
95+
:sites="sites"
96+
@action-executed="handleActionExecuted"
97+
/>
9198
</template>
9299

93100
<script setup>
94101
import { ref } from 'vue'
95102
import { Message, Modal } from '@arco-design/web-vue'
103+
import GlobalActionDialog from './GlobalActionDialog.vue'
96104
97105
const props = defineProps({
98106
navigation_title: {
@@ -101,6 +109,12 @@ const props = defineProps({
101109
},
102110
103111
now_site_title: String,
112+
113+
// 站源配置数据
114+
sites: {
115+
type: Array,
116+
default: () => []
117+
}
104118
});
105119
const emit = defineEmits([
106120
"handleOpenForm",
@@ -110,11 +124,13 @@ const emit = defineEmits([
110124
"minimize",
111125
"maximize",
112126
"closeWindow",
127+
"actionExecuted"
113128
]);
114129
115130
const searchValue = ref('')
116131
const showPushModal = ref(false)
117132
const pushContent = ref('')
133+
const showGlobalActionDialog = ref(false)
118134
119135
const handleOpenForm = () => {
120136
emit("handleOpenForm");
@@ -138,10 +154,43 @@ const handlePush = () => {
138154
139155
// 全局动作按钮点击事件
140156
const handleGlobalAction = () => {
141-
Message.info({
142-
content: '全局动作功能开发中,敬请期待!',
143-
duration: 3000
144-
})
157+
if (!props.sites || props.sites.length === 0) {
158+
Message.warning('当前没有可用的站源配置');
159+
return;
160+
}
161+
162+
console.log(props.sites);
163+
164+
// 检查是否有站源包含动作
165+
const sitesWithActions = props.sites.filter(site =>
166+
site.more &&
167+
site.more.actions &&
168+
Array.isArray(site.more.actions) &&
169+
site.more.actions.length > 0
170+
);
171+
172+
if (sitesWithActions.length === 0) {
173+
Message.info('当前站源配置中没有可用的全局动作');
174+
return;
175+
}
176+
177+
showGlobalActionDialog.value = true;
178+
};
179+
180+
// 处理动作执行完成事件
181+
const handleActionExecuted = (event) => {
182+
console.log('全局动作执行完成:', event);
183+
184+
// 向父组件发送动作执行事件
185+
emit('actionExecuted', event);
186+
187+
if (event.success) {
188+
Message.success(`动作 "${event.action.name}" 执行成功`);
189+
} else {
190+
if (event.error !== 'cancel') {
191+
Message.error(`动作 "${event.action.name}" 执行失败: ${event.error}`);
192+
}
193+
}
145194
};
146195
147196
// 确认推送

0 commit comments

Comments
 (0)