StatusMonitoring.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  1. <template>
  2. <DashboardLayout ref="layout" layoutClass="special-situation-monitoring">
  3. <template #header-left>
  4. </template>
  5. <template #header-right>
  6. <!-- 日期 -->
  7. <DateTimeWidget />
  8. </template>
  9. <template #map>
  10. <!-- 路口列表 -->
  11. <div v-if="currentView === 'list-mode' && activeLeftTab === 'crossing'" class="list-mode-panel">
  12. <CrossingListPanel :onViewDetail="handleCrossingViewDetail"/>
  13. </div>
  14. <!-- 地图 -->
  15. <TongzhouTrafficMap v-else ref="trafficMapRef"
  16. amapKey="db2da7e3e248c3b2077d53fc809be63f"
  17. securityJsCode="a7413c674852c5eaf01d90813c5b7ef6"
  18. :mode="activeLeftTab === 'crossing' ? '路口' : activeLeftTab === 'trunkLine' ? '干线' : activeLeftTab === 'specialDuty' ? '特勤' : ''"
  19. @map-crossing-click="handleMapCrossingClick"
  20. @map-crossing-mouseover="handleMapCrossingMouseover"
  21. @map-crossing-mouseout="handleMapCrossingMouseout"
  22. />
  23. </template>
  24. <template #left>
  25. <!-- 左侧Tab菜单栏 -->
  26. <div class="left-sidebar-wrap" v-if="currentView !== 'list-mode'">
  27. <TechTabs v-model="activeLeftTab" type="underline" @tab-click="handleTabClick">
  28. <TechTabPane label="总览" name="overview" class="menu-scroll-view">
  29. <MenuItem theme="tech" v-for="item in menuData" :key="item.id" :node="item" :level="0"
  30. @node-click="handleMenuClick" @folder-click="handleFolderClick"/>
  31. </TechTabPane>
  32. <TechTabPane label="路口" name="crossing" class="menu-scroll-view">
  33. <MenuItem theme="tech" v-for="item in menuData" :key="item.id" :node="item" :level="0"
  34. @node-click="handleMenuClick" />
  35. </TechTabPane>
  36. <TechTabPane label="干线" name="trunkLine" class="menu-scroll-view">
  37. <MenuItem v-for="item in trunkLineMenuData" :key="item.id" :node="item" :level="0"
  38. @node-click="handleTrunkLineClick">
  39. <template #label="{ node }">
  40. <span v-if="node.children && node.children.length > 0">{{ node.label }}</span>
  41. <span v-else>{{ node.label }} 绿波带</span>
  42. </template>
  43. </MenuItem>
  44. </TechTabPane>
  45. <TechTabPane label="特勤" name="specialDuty" class="menu-scroll-view">
  46. <TaskCardList :listData="tableData" class="special-duty-pane"
  47. @view="({ item }) => handleSpecialTaskView(item)"
  48. @start="({ item }) => handleSpecialTaskStart(item)"
  49. @end="({ item }) => handleSpecialTaskEnd(item)"
  50. @restart="({ item }) => handleSpecialTaskRestart(item)"
  51. />
  52. </TechTabPane>
  53. </TechTabs>
  54. </div>
  55. <div class="list-mode-tabs" v-else>
  56. <TechTabs v-model="activeLeftTab" type="underline" @tab-click="onListTabSelect">
  57. <TechTabPane label="总览" name="overview" />
  58. <TechTabPane label="路口" name="crossing" />
  59. <TechTabPane label="干线" name="trunkLine" />
  60. <TechTabPane label="特勤" name="specialDuty" />
  61. </TechTabs>
  62. </div>
  63. </template>
  64. <template #right>
  65. <!-- 模式切换按钮组 -->
  66. <div class="mode-switch" v-if="activeLeftTab === 'crossing'">
  67. <ButtonGroup v-model="currentView" :options="viewOptions" @select="onViewSelect" />
  68. </div>
  69. </template>
  70. <template #center>
  71. <!-- 顶部常驻图表区域(替代弹窗) -->
  72. <div class="top-charts-bar" v-if="currentView !== 'list-mode'">
  73. <!-- 总览Tab -->
  74. <template v-if="activeLeftTab === 'overview'">
  75. <div class="top-chart-box overview-chart-box">
  76. <OnlineStatusTabs />
  77. </div>
  78. <div class="top-chart-box overview-chart-box">
  79. <DeviceStatusTabs />
  80. </div>
  81. </template>
  82. <!-- 路口Tab -->
  83. <template v-if="activeLeftTab === 'crossing'">
  84. <div class="top-chart-box overview-chart-box">
  85. <OnlineStatusTabs />
  86. </div>
  87. <div class="top-chart-box overview-chart-box">
  88. <DeviceStatusTabs />
  89. </div>
  90. </template>
  91. </div>
  92. </template>
  93. </DashboardLayout>
  94. </template>
  95. <script>
  96. import DashboardLayout from '@/layouts/DashboardLayout.vue';
  97. import DateTimeWidget from '@/components/ui/DateTimeWidget.vue';
  98. import TechTabs from '@/components/ui/TechTabs.vue';
  99. import TechTabPane from '@/components/ui/TechTabPane.vue';
  100. import TongzhouTrafficMap from '@/components/TongzhouTrafficMap.vue';
  101. import MenuItem from '@/components/ui/MenuItem.vue';
  102. import ButtonGroup from '@/components/ui/ButtonGroup.vue';
  103. import TechTable from '@/components/ui/TechTable.vue';
  104. import TaskCardList from '@/components/ui/TaskCardList.vue';
  105. import CrossingListPanel from '@/components/ui/CrossingListPanel.vue';
  106. import OnlineStatusTabs from '@/components/ui/OnlineStatusTabs.vue';
  107. import DeviceStatusTabs from '@/components/ui/DeviceStatusTabs.vue';
  108. import RingDonutChart from '@/components/ui/RingDonutChart.vue';
  109. import { apiGetTongzhouMenuTree, apiGetTrunkLineMenuTree, apiGetTasks, apiGetTrafficTimeSpace, apiGetCrossingTopCharts, apiGetSpecialTaskMonitorData, apiGetOverviewTopCharts, apiGetCrossingDetailData } from '@/api';
  110. export default {
  111. name: "HomePage",
  112. components: {
  113. DashboardLayout,
  114. DateTimeWidget,
  115. TechTabs,
  116. TechTabPane,
  117. TongzhouTrafficMap,
  118. MenuItem,
  119. ButtonGroup,
  120. TechTable,
  121. TaskCardList,
  122. CrossingListPanel,
  123. OnlineStatusTabs,
  124. DeviceStatusTabs,
  125. RingDonutChart
  126. },
  127. data() {
  128. return {
  129. // 左侧边栏数据
  130. activeLeftTab: '',
  131. menuData: [],
  132. trunkLineMenuData: [],
  133. // 地图模式切换数据
  134. currentView: 'map-mode',
  135. viewOptions: [
  136. { label: '列表模式', value: 'list-mode' },
  137. { label: '地图模式', value: 'map-mode' },
  138. ],
  139. // 特勤表头
  140. tableColumns: [
  141. { label: '序号', key: 'id', width: '10%' },
  142. { label: '名称', key: 'name', width: '30%' },
  143. { label: '执行人', key: 'executor', width: '15%' },
  144. { label: '等级', key: 'level', width: '12%' },
  145. { label: '状态', key: 'status', width: '13%' },
  146. { label: '操作', key: 'action', width: '20%' }
  147. ],
  148. tableData: [],
  149. // 路口顶部图表数据
  150. crossingTopCharts: {},
  151. // 路口多选分屏
  152. crossingSelections: [],
  153. maxCrossingSlots: 4,
  154. };
  155. },
  156. watch: {
  157. // 监听路由参数变化(解决多次从首页点击不同数据跳转过来,页面不刷新的问题)
  158. '$route.query': {
  159. handler() {
  160. this.checkRouteParams();
  161. },
  162. deep: true
  163. }
  164. },
  165. created() {
  166. },
  167. async mounted() {
  168. // 加载菜单和任务数据
  169. const [menuData, trunkData, taskData] = await Promise.all([
  170. apiGetTongzhouMenuTree(),
  171. apiGetTrunkLineMenuTree(),
  172. apiGetTasks({ pageSize: 5 }),
  173. ]);
  174. this.menuData = menuData || [];
  175. this.trunkLineMenuData = trunkData || [];
  176. this.tableData = taskData?.list || taskData || [];
  177. // 组件挂载时检查路由
  178. this.checkRouteParams();
  179. // 初始显示顶部图表(如果没有路由参数覆盖的话)
  180. if (Object.keys(this.$route.query).length === 0) {
  181. this.activeLeftTab = 'overview';
  182. this.showTopChartDalogs();
  183. }
  184. },
  185. methods: {
  186. // 处理地图鼠标滑入事件
  187. handleMapCrossingMouseover(mapData, lnglat, pixel) {
  188. console.log('父组件接收到了地图路口鼠标滑入事件:', mapData);
  189. // 组装模拟数据
  190. const scale = window.innerWidth / 1920;
  191. let nodeData = {
  192. id: mapData.position[0] + mapData.position[1],
  193. label: mapData.road,
  194. // 反算为设计稿坐标(SmartDialog 内部会再乘 scale)
  195. pixelX: pixel ? Math.round(pixel.x / scale) : 950,
  196. pixelY: pixel ? Math.round(pixel.y / scale) : 430,
  197. }
  198. console.log(nodeData);
  199. if (this.activeLeftTab === 'overview') { // 总览
  200. this.showOverviewDalogs(nodeData);
  201. }
  202. },
  203. // 处理地图鼠标滑出事件
  204. handleMapCrossingMouseout(mapData) {
  205. console.log('父组件接收到了地图路口鼠标滑出事件:', mapData);
  206. if (this.activeLeftTab === 'overview' && mapData) { // 总览
  207. const id = mapData.position[0] + mapData.position[1];
  208. this.$refs.layout.handleDialogClose('crossing3_' + id);
  209. }
  210. },
  211. // 处理地图点击事件
  212. handleMapCrossingClick(mapData, lnglat, pixel) {
  213. console.log('父组件接收到了地图路口点击事件:', mapData);
  214. console.log('父组件接收到了地图路口点击事件:', lnglat);
  215. console.log('父组件接收到了地图路口点击事件:', pixel);
  216. // 组装模拟数据
  217. const scale = window.innerWidth / 1920;
  218. let nodeData = {
  219. id: mapData.position[0] + mapData.position[1],
  220. label: mapData.road,
  221. // 反算为设计稿坐标(SmartDialog 内部会再乘 scale)
  222. pixelX: pixel ? Math.round(pixel.x / scale) : 950,
  223. pixelY: pixel ? Math.round(pixel.y / scale) : 430,
  224. }
  225. console.log(nodeData);
  226. if (this.activeLeftTab === 'overview') { // 总览
  227. this.showCrossingDetailDialogs(nodeData);
  228. } else if (this.activeLeftTab === 'crossing') { // 路口
  229. this.showCrossingDalogs(nodeData);
  230. } else if (this.activeLeftTab === 'trunkLine') { // 干线
  231. this.showTrunkLineDalogs(nodeData);
  232. } else if (this.activeLeftTab === 'specialDuty') { // 特勤
  233. this.showSpecialDutyDalogs(nodeData);
  234. }
  235. },
  236. // 列表模式Tab切换
  237. onListTabSelect(tabName) {
  238. if (tabName !== 'crossing') {
  239. this.currentView = 'map-mode';
  240. }
  241. this.handleTabClick(tabName);
  242. },
  243. // 模式切换
  244. onViewSelect(item) {
  245. console.log('你点击了:', item.label);
  246. this.currentView = item.value;
  247. this.$refs.layout.clearDialogs(); // 清空全部弹窗
  248. this.crossingSelections = [];
  249. // 列表模式弹窗
  250. if (this.currentView === 'list-mode') {
  251. // this.$refs.layout.openDialog({
  252. // id: 'crossing-list', // 这里的 ID 可以根据实际业务场景动态生成
  253. // title: '',
  254. // component: 'CrossingListPanel',
  255. // width: 1920,
  256. // height: 750,
  257. // center: false,
  258. // showClose: true,
  259. // noPadding: false,
  260. // enableDblclickExpand: false,
  261. // position: { x: 100, y: 150 },
  262. // data: {
  263. // onViewDetail: (rowData) => this.handleCrossingViewDetail(rowData)
  264. // }
  265. // });
  266. } else {
  267. this.loadCrossingTopCharts();
  268. }
  269. },
  270. // 处理tab点击
  271. handleTabClick(tabName) {
  272. console.log('父组件接收到了tab点击事件:', tabName);
  273. this.$refs.layout.clearDialogs(); // 清空全部弹窗
  274. this.crossingSelections = [];
  275. this.showTopChartDalogs(); // 根据当前Tab显示对应的顶部常驻图表
  276. },
  277. // 处理菜单folder标题点击
  278. handleFolderClick(nodeData) {
  279. console.log('父组件接收到了文件夹点击事件:', nodeData);
  280. // 临时逻辑,有真实接口后可以删除
  281. const index = Math.floor(Math.random() * 10);
  282. const position = localStorage.getItem(`pos${index + 1}`).split(',');
  283. // 地图联动
  284. this.$refs.trafficMapRef.focusByLocation([Number(position[0]), Number(position[1])]);
  285. },
  286. // 处理菜单点击
  287. handleMenuClick(nodeData) {
  288. console.log('父组件接收到了最底层路口点击事件:', nodeData);
  289. // 通过地图组件获取像素坐标(如果有经纬度的话)
  290. // if (nodeData.lng && nodeData.lat && this.$refs.trafficMapRef) {
  291. // // 地图联动
  292. // this.$refs.trafficMapRef.focusByLocation([nodeData.lng, nodeData.lat]);
  293. // const pixel = this.$refs.trafficMapRef.lngLatToPixel(nodeData.lng, nodeData.lat);
  294. // if (pixel) {
  295. // const scale = window.innerWidth / 1920;
  296. // nodeData.pixelX = Math.round(pixel.x / scale) + 20;
  297. // nodeData.pixelY = Math.round(pixel.y / scale);
  298. // }
  299. // }
  300. // 根据Tab来显示不同的弹窗内容
  301. if (this.activeLeftTab === 'overview') { // 总览
  302. // 临时逻辑,有真实接口后可以删除
  303. const index = Math.floor(Math.random() * 10);
  304. const position = localStorage.getItem(`pos${index + 1}`).split(',');
  305. // 地图联动
  306. this.$refs.trafficMapRef.focusByLocation([Number(position[0]), Number(position[1])]);
  307. this.showOverviewDalogs(nodeData);
  308. } else if (this.activeLeftTab === 'crossing') { // 路口
  309. this.showCrossingDalogs(nodeData);
  310. } else if (this.activeLeftTab === 'trunkLine') { // 干线
  311. this.showTrunkLineDalogs(nodeData);
  312. } else if (this.activeLeftTab === 'specialDuty') { // 特勤
  313. this.showSpecialDutyDalogs(nodeData);
  314. }
  315. },
  316. // 处理弹窗双击展开(通过 onExpand 回调从 Layout 传入)
  317. handleDoubleClickExpend(nodeData) {
  318. console.log('处理弹窗双击事件', nodeData);
  319. if (this.activeLeftTab === 'crossing' || this.activeLeftTab === 'overview') {
  320. this.showCrossingDetailDialogs(nodeData);
  321. }
  322. },
  323. // 显示顶部常驻图表(根据当前Tab状态)
  324. showTopChartDalogs() {
  325. if (this.activeLeftTab === 'crossing') {
  326. this.loadCrossingTopCharts();
  327. }
  328. },
  329. // 显示总览弹窗组
  330. showOverviewDalogs(nodeData) {
  331. console.log('显示总览弹窗组', nodeData.id, nodeData.label);
  332. // 路口弹窗
  333. this.$refs.layout.openDialog({
  334. id: 'crossing3_' + nodeData.id, // 这里的 ID 可以根据实际业务场景动态生成
  335. title: nodeData.label,
  336. component: 'CrossingPanel',
  337. width: 260,
  338. height: 260,
  339. center: false,
  340. showClose: true,
  341. position: { x: (nodeData.pixelX || 950) + 20, y: nodeData.pixelY || 430 },
  342. noPadding: false,
  343. data: {
  344. ...nodeData,
  345. onExpand: (data) => this.handleDoubleClickExpend(data)
  346. },
  347. onClose: () => {
  348. // this.$refs.layout.handleDialogClose('top-chart-crossing-1');
  349. // this.$refs.layout.handleDialogClose('top-chart-crossing-2');
  350. }
  351. });
  352. },
  353. async loadCrossingTopCharts() {
  354. try {
  355. this.crossingTopCharts = await apiGetCrossingTopCharts();
  356. } catch (e) { /* ignore */ }
  357. },
  358. // 显示路口弹窗组(多选分屏)
  359. showCrossingDalogs(nodeData) {
  360. console.log('路口多选', nodeData.id, nodeData.label);
  361. // 1. 已选中 → 不重复操作
  362. const existIndex = this.crossingSelections.findIndex(c => c.id === nodeData.id);
  363. if (existIndex !== -1) {
  364. return;
  365. }
  366. // 2. 已满 → 先进先出
  367. if (this.crossingSelections.length >= this.maxCrossingSlots) {
  368. this.crossingSelections.shift();
  369. }
  370. // 3. 追加选中
  371. this.crossingSelections.push({ ...nodeData });
  372. // 4. 打开或更新弹窗
  373. this.openCrossingMultiView();
  374. },
  375. openCrossingMultiView() {
  376. this.$refs.layout.openDialog({
  377. id: 'crossing-multi-view',
  378. title: '',
  379. component: 'CrossingMultiView',
  380. width: 1400,
  381. height: 700,
  382. center: false,
  383. position: { x: 500, y: 150 },
  384. showClose: false,
  385. noPadding: true,
  386. enableDblclickExpand: false,
  387. draggable: false,
  388. data: {
  389. crossings: [...this.crossingSelections],
  390. maxSlots: this.maxCrossingSlots,
  391. onRemove: (id) => this.handleCrossingRemove(id),
  392. onReorder: (newOrder) => {
  393. this.crossingSelections = newOrder;
  394. }
  395. },
  396. onClose: () => {
  397. this.crossingSelections = [];
  398. }
  399. });
  400. },
  401. handleCrossingRemove(id) {
  402. this.crossingSelections = this.crossingSelections.filter(c => c.id !== id);
  403. if (this.crossingSelections.length === 0) {
  404. this.$refs.layout.handleDialogClose('crossing-multi-view');
  405. } else {
  406. this.openCrossingMultiView();
  407. }
  408. },
  409. // 单个路口详情弹窗(总览双击展开等场景使用)
  410. async showCrossingDetailDialogs(nodeData) {
  411. console.log('显示路口详情弹窗组', nodeData.id, nodeData.label);
  412. const detailData = await apiGetCrossingDetailData(nodeData.id);
  413. const dialogId = 'crossing_detail' + nodeData.id;
  414. this.$refs.layout.openDialog({
  415. id: dialogId,
  416. title: ' ',
  417. component: 'CrossingDetailPanel',
  418. width: 1315,
  419. height: 682,
  420. center: false,
  421. showClose: true,
  422. position: { x: 500, y: 170 },
  423. noPadding: false,
  424. enableDblclickExpand: false,
  425. data: { ...nodeData, preloadedData: detailData },
  426. headerComponent: 'CrossingDetailHeader',
  427. headerProps: {
  428. currentRoute: detailData?.currentRoute || {},
  429. intersectionData: detailData?.intersectionData || {},
  430. cycleLength: detailData?.cycleLength || 0,
  431. }
  432. });
  433. },
  434. // 路口列表模式下弹窗
  435. handleCrossingViewDetail(rowData) {
  436. console.log('显示路口列表查看', rowData);
  437. this.showCrossingDetailDialogs(rowData);
  438. },
  439. // 显示干线弹窗组
  440. // 干线菜单叶子节点点击
  441. handleTrunkLineClick(nodeData) {
  442. console.log('干线菜单点击:', nodeData);
  443. this.showTrunkLineDalogs(nodeData);
  444. },
  445. async showTrunkLineDalogs(nodeData) {
  446. console.log('显示干线弹窗组', nodeData.id, nodeData.label);
  447. // 优先使用菜单节点自带的路口和距离数据
  448. let tsData;
  449. if (nodeData.intersections && nodeData.distances) {
  450. tsData = await apiGetTrafficTimeSpace({
  451. intersections: nodeData.intersections,
  452. distances: nodeData.distances,
  453. });
  454. } else {
  455. tsData = await apiGetTrafficTimeSpace();
  456. }
  457. this.$refs.layout.openDialog({
  458. id: nodeData.id,
  459. title: nodeData.label + ' 绿波带',
  460. component: 'TrafficTimeSpace',
  461. width: 1000,
  462. height: 500,
  463. center: true,
  464. showClose: true,
  465. data: tsData,
  466. });
  467. },
  468. // 显示特勤弹窗组
  469. showSpecialDutyDalogs(nodeData) {
  470. console.log('显示特勤弹窗组', nodeData.id, nodeData.label);
  471. this.openDutyDetailDialog(nodeData);
  472. },
  473. // === 解析路由参数并执行对应操作 ===
  474. checkRouteParams() {
  475. // 统一参数接收:特勤接收 id,路口接收 intersectionName 和 plan
  476. const { tab, action, id, } = this.$route.query;
  477. if (!tab) return; // 如果没有传递 tab 参数,说明是正常访问,不处理
  478. // 1. 处理“特勤线路”跳转
  479. if (tab === 'specialDuty') {
  480. this.activeLeftTab = 'specialDuty'; // 切换到左侧【特勤】Tab
  481. this.handleTabClick('specialDuty'); // 手动触发 Tab 切换事件,更新顶部图表
  482. // 这里判断的条件改为 id
  483. if (action === 'open-dialog' && id) {
  484. this.$nextTick(() => {
  485. this.openDutyDetailDialog({id: id, label: '特勤路口'}); // 打开特勤弹窗
  486. });
  487. }
  488. }
  489. // 2. 处理“关键路口”跳转
  490. else if (tab === 'crossing') {
  491. this.activeLeftTab = 'crossing'; // 切换到左侧【路口】Tab
  492. this.handleTabClick('crossing'); // 手动触发 Tab 切换事件,更新顶部图表
  493. if (action === 'open-dialog') {
  494. this.$nextTick(() => {
  495. // 构造一个假的 nodeData 传给详情弹窗方法
  496. this.showCrossingDetailDialogs({
  497. id: 'route_' + new Date().getTime(), // 动态生成一个ID防重复
  498. label: '路口详情',
  499. });
  500. });
  501. }
  502. }
  503. },
  504. // === 特勤详情弹窗 (你需要根据实际组件名替换) ===
  505. async openDutyDetailDialog(nodeData) {
  506. console.log('准备打开特勤线路详情:', nodeData);
  507. // 1. 获取数据
  508. const panelData = await apiGetSpecialTaskMonitorData(nodeData.id);
  509. const id = 'special-task-dialog' + new Date().getTime();
  510. // 2. 呼出弹窗
  511. this.$refs.layout.openDialog({
  512. id: id,
  513. title: ' ', // 留空以隐藏默认标题,使用自定义 Header
  514. width: 1400, // 弹窗宽一点,容纳 3 列
  515. height: 700,
  516. center: false,
  517. showClose: true,
  518. noPadding: true, // 去除默认内边距,让内部组件自己控制
  519. position: {x: 200, y: 150},
  520. // 挂载主体组件和数据
  521. component: 'SpecialTaskMonitorPanel',
  522. data: { panelData: panelData },
  523. // 挂载自定义 Header 和数据
  524. headerComponent: 'TaskMonitorHeader',
  525. headerProps: {
  526. taskData: panelData.taskInfo,
  527. onStartTask: () => {
  528. console.log('点击了立即执行');
  529. panelData.taskInfo.status = '进行中';
  530. const tableRow = this.tableData.find(r => r.id === nodeData.id);
  531. if (tableRow) tableRow.status = '进行中';
  532. },
  533. onEndTask: () => {
  534. console.log('点击了立即结束');
  535. panelData.taskInfo.status = '已完成';
  536. const tableRow = this.tableData.find(r => r.id === nodeData.id);
  537. if (tableRow) tableRow.status = '已完成';
  538. }
  539. }
  540. });
  541. return panelData;
  542. },
  543. handleSpecialTaskView(row) {
  544. console.log('查看特勤线路,当前数据:', row);
  545. this.openDutyDetailDialog(row);
  546. },
  547. async handleSpecialTaskStart(row) {
  548. console.log('立即执行特勤任务:', row);
  549. const panelData = await this.openDutyDetailDialog(row);
  550. this.$msg({
  551. title: '操作确认',
  552. message: `确认立即执行任务「${row.name}」?`,
  553. duration: 0,
  554. showConfirm: true,
  555. showCancel: true,
  556. confirmText: '确认执行',
  557. noBackdrop: true,
  558. onConfirm: () => { row.status = '进行中'; panelData.taskInfo.status = '进行中'; }
  559. });
  560. },
  561. async handleSpecialTaskEnd(row) {
  562. console.log('立即结束特勤任务:', row);
  563. const panelData = await this.openDutyDetailDialog(row);
  564. this.$msg({
  565. title: '操作确认',
  566. message: `确认立即结束任务「${row.name}」?`,
  567. duration: 0,
  568. showConfirm: true,
  569. showCancel: true,
  570. confirmText: '确认结束',
  571. noBackdrop: true,
  572. onConfirm: () => { row.status = '已完成'; panelData.taskInfo.status = '已完成'; }
  573. });
  574. },
  575. async handleSpecialTaskRestart(row) {
  576. console.log('重新开始特勤任务:', row);
  577. const panelData = await this.openDutyDetailDialog(row);
  578. this.$msg({
  579. title: '操作确认',
  580. message: `确认重新开始任务「${row.name}」?`,
  581. duration: 0,
  582. showConfirm: true,
  583. showCancel: true,
  584. confirmText: '确认开始',
  585. noBackdrop: true,
  586. onConfirm: () => { row.status = '进行中'; panelData.taskInfo.status = '进行中'; }
  587. });
  588. },
  589. }
  590. }
  591. </script>
  592. <style scoped>
  593. .mode-switch {
  594. display: flex;
  595. flex-direction: row;
  596. justify-content: flex-end;
  597. }
  598. .mode-switch>div {
  599. width: 200px;
  600. }
  601. .duty-table {
  602. margin-top: 10px;
  603. }
  604. .action-btn {
  605. cursor: pointer;
  606. color: #4da8ff;
  607. margin-right: 10px;
  608. }
  609. .action-btn:hover {
  610. text-decoration: underline;
  611. }
  612. .action-start {
  613. color: #67c23a;
  614. }
  615. .action-end {
  616. color: #f56c6c;
  617. }
  618. .top-charts-bar {
  619. display: flex;
  620. justify-content: center;
  621. gap: clamp(10px, 1.04vw, 20px);
  622. pointer-events: none;
  623. }
  624. .top-chart-box {
  625. pointer-events: auto;
  626. flex-shrink: 0;
  627. background: radial-gradient(circle at 20% 0%, rgba(40,120,200,0.5) 0%, rgba(20,60,130,0.7) 70%);
  628. box-shadow: inset 0px 0px 0.625rem 0px rgba(88, 146, 255, 0.4), inset 1.25rem 0px 1.875rem -0.625rem rgba(88, 146, 255, 0.15);
  629. border: 1px solid rgba(255, 255, 255, 0.15);
  630. border-radius: clamp(6px, 0.625vw, 12px);
  631. overflow: hidden;
  632. }
  633. /* --- 总览Tab图表尺寸适配 (原 300x160) --- */
  634. .overview-chart-box {
  635. /* clamp(最小值, 理想值(1920下比例), 最大值) */
  636. width: clamp(200px, 15.625vw, 300px);
  637. height: clamp(106px, 8.333vw, 160px);
  638. }
  639. /* --- 路口Tab图表尺寸适配 (原 228x124) --- */
  640. .crossing-chart-box {
  641. width: clamp(152px, 11.875vw, 228px);
  642. height: clamp(82px, 6.458vw, 124px);
  643. }
  644. ::v-deep .list-mode-panel {
  645. position: absolute;
  646. inset: 0;
  647. padding: 150px 30px 30px 30px;
  648. box-sizing: border-box;
  649. display: flex;
  650. flex-direction: column;
  651. overflow: hidden;
  652. }
  653. .list-mode-tabs {
  654. flex-shrink: 0;
  655. max-width: 400px;
  656. }
  657. .duty-name {
  658. display: inline-block;
  659. max-width: 8em;
  660. overflow: hidden;
  661. text-overflow: ellipsis;
  662. white-space: nowrap;
  663. vertical-align: middle;
  664. }
  665. /* 针对特勤 Tab 单独剥离背景和边框 */
  666. ::v-deep .special-duty-pane {
  667. padding: 10px 20px;
  668. }
  669. </style>