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>
94101import { ref } from ' vue'
95102import { Message , Modal } from ' @arco-design/web-vue'
103+ import GlobalActionDialog from ' ./GlobalActionDialog.vue'
96104
97105const 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});
105119const emit = defineEmits ([
106120 " handleOpenForm" ,
@@ -110,11 +124,13 @@ const emit = defineEmits([
110124 " minimize" ,
111125 " maximize" ,
112126 " closeWindow" ,
127+ " actionExecuted"
113128]);
114129
115130const searchValue = ref (' ' )
116131const showPushModal = ref (false )
117132const pushContent = ref (' ' )
133+ const showGlobalActionDialog = ref (false )
118134
119135const handleOpenForm = () => {
120136 emit (" handleOpenForm" );
@@ -138,10 +154,43 @@ const handlePush = () => {
138154
139155// 全局动作按钮点击事件
140156const 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