ReportView.vue 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683
  1. <template>
  2. <div class="common-layout">
  3. <el-container>
  4. <el-header
  5. style="height: 250px; background-color: rgba(255,0,0,50%); display: flex; flex-direction: column; justify-content: center; align-items: center;">
  6. <div class="demo-image" style="text-align: center;"> <!-- 注意这里添加了 text-align: center; 但对于块级元素这不是必需的 -->
  7. <img src="../assets/pji-logo.jpg" alt="" style="width:506.5px;height: 146px">
  8. <!-- 推荐使用 max-width 保持图片比例 -->
  9. </div>
  10. </el-header>
  11. <el-main style="background-color:white;">
  12. <div class="topbar">
  13. <el-form style=" background-color: rgba(0,0,0,0%);" :inline="true" :model="queryLine"
  14. class="demo-form-inline">
  15. <el-form-item label="数据名称">
  16. <el-input v-model="queryLine.dataName" placeholder="请输入数据名称" clearable/>
  17. </el-form-item>
  18. <!-- <el-form-item label="数据标签">-->
  19. <!-- <el-input v-model="queryLine.teamName" placeholder="请输入数据标签" clearable/>-->
  20. <!-- </el-form-item>-->
  21. <el-form-item label="设备名称">
  22. <el-input v-model="queryLine.equipmentName" placeholder="请输入设备名称" clearable/>
  23. </el-form-item>
  24. <el-form-item label="设备类型">
  25. <el-input v-model="queryLine.equipmentTypeName" placeholder="请输入设备类型" clearable/>
  26. </el-form-item>
  27. <el-form-item label="触发器名称">
  28. <el-input v-model="queryLine.triggerName" placeholder="请输入触发器名称" clearable/>
  29. </el-form-item>
  30. <el-form-item label="触发器类型">
  31. <el-input v-model="queryLine.triggerTypeName" placeholder="请输入触发器类型" clearable/>
  32. </el-form-item>
  33. <el-form-item>
  34. <el-button type="danger" @click="onSubmit">查询</el-button>
  35. </el-form-item>
  36. <el-form-item>
  37. <el-button type="danger" @click="onSubmit">重置</el-button>
  38. </el-form-item>
  39. </el-form>
  40. <el-button type="primary" @click="updateMap">地图更新</el-button>
  41. <el-button type="primary" @click="goToUpdateStat">地图更新统计</el-button>
  42. <el-button type="primary" @click="mapDialogVisible = true">地图续扫提醒阈值</el-button>
  43. <el-button type="primary" @click="goToMapRescan">地图续扫提醒</el-button>
  44. <el-dialog
  45. v-model="updateDialogVisible"
  46. title="地图更新"
  47. width="400"
  48. :before-close="handleClose"
  49. :close-on-click-modal="false"
  50. >
  51. <el-steps style="max-width: 600px" :active="update_active" finish-status="success">
  52. <el-step title="数据拉取"/>
  53. <el-step title="地图生成"/>
  54. </el-steps>
  55. <template #footer>
  56. <el-button @click="goToMapUpdate" :disabled="update_active !== 2">去部署</el-button>
  57. </template>
  58. </el-dialog>
  59. <el-dialog
  60. v-model="mapDialogVisible"
  61. title="地图续扫提醒"
  62. width="400"
  63. :before-close="handleMapClose"
  64. :close-on-click-modal="false"
  65. >
  66. <el-form :model="mapRescanForm">
  67. <el-form-item label="请输入地图续扫提醒阈值" label-width="170">
  68. <el-input v-model="mapRescanForm.name">
  69. <template #suffix>
  70. <i slot="suffix" style="color: #181818">%</i>
  71. </template>
  72. </el-input>
  73. </el-form-item>
  74. </el-form>
  75. <template #footer>
  76. <div class="dialog-footer">
  77. <el-button type="primary" @click="mapDialogVisible = false">
  78. 确认
  79. </el-button>
  80. </div>
  81. </template>
  82. </el-dialog>
  83. <div style="float: right">
  84. <!-- <el-switch-->
  85. <!-- style="margin-left: 10px;"-->
  86. <!-- v-model="value"-->
  87. <!-- size="large"-->
  88. <!-- inactive-text="算法容器"-->
  89. <!-- />-->
  90. <span class="el-form-item__label" style="font-size: 14px;">算法镜像选择:</span>
  91. <el-select
  92. v-model="selectImageName"
  93. placeholder="Select image"
  94. size="default"
  95. @click.native="getDockerImages('pji_nav')"
  96. style="width: 180px; "
  97. >
  98. <el-option
  99. v-for="item in imageNames"
  100. :key="item"
  101. :label="item"
  102. :value="item"
  103. />
  104. </el-select>
  105. <el-button type="primary" @click="algorithmDialogVisible = true" style="margin-left: 10px;">算法镜像导入</el-button>
  106. <el-dialog
  107. v-model="algorithmDialogVisible"
  108. title="请输入算法版本"
  109. width="300"
  110. :before-close="handleClose"
  111. :close-on-click-modal="false"
  112. >
  113. <template #footer>
  114. <div class="dialog-footer">
  115. <el-form :model="algorithmForm" label-width="auto">
  116. <el-form-item style="margin-bottom: 10px" label="算法版本:" required>
  117. <el-input v-model="algorithmForm.tag"/>
  118. </el-form-item>
  119. </el-form>
  120. <!-- -->
  121. <!-- <el-button @click="algorithmDialogVisible = false">取消</el-button>-->
  122. <el-button type="primary" @click="algorithmImport" :disabled="algorithmForm.tag == ''">选择镜像文件</el-button>
  123. </div>
  124. </template>
  125. </el-dialog>
  126. <!-- <el-button style="margin-left: 10px;" type="primary" @click="getDockerImages('pji_nav')">算法镜像选择</el-button>-->
  127. <!-- <el-switch-->
  128. <!-- v-model="algorithmContainerState"-->
  129. <!-- class="ml-2"-->
  130. <!-- inline-prompt-->
  131. <!-- style="margin-left: 100px;&#45;&#45;el-switch-on-color: #13ce66; &#45;&#45;el-switch-off-color: #ff4949"-->
  132. <!-- active-text="算法容器已开启"-->
  133. <!-- inactive-text="算法容器已关闭"-->
  134. <!-- />-->
  135. <!-- <el-switch-->
  136. <!-- v-model="gazeboState"-->
  137. <!-- class="ml-2"-->
  138. <!-- inline-prompt-->
  139. <!-- style="margin-left: 100px; &#45;&#45;el-switch-on-color: #13ce66; &#45;&#45;el-switch-off-color: #ff4949"-->
  140. <!-- active-text="Gazebo 已开启"-->
  141. <!-- inactive-text="Gazebo 已关闭"-->
  142. <!-- @click="gazebo"-->
  143. <!-- />-->
  144. <!-- <el-switch-->
  145. <!-- v-model="rvizState"-->
  146. <!-- class="ml-2"-->
  147. <!-- inline-prompt-->
  148. <!-- style="margin-left: 100px;&#45;&#45;el-switch-on-color: #13ce66; &#45;&#45;el-switch-off-color: #ff4949"-->
  149. <!-- active-text="Rviz 已开启"-->
  150. <!-- inactive-text="Rviz 已关闭"-->
  151. <!-- @click="rviz"-->
  152. <!-- />-->
  153. <el-button style="margin-left: 10px;" type="primary" @click="goToTestRecord">仿真测试记录</el-button>
  154. </div>
  155. </div>
  156. <el-dialog
  157. v-model="worldDialogVisible"
  158. title="生成world"
  159. width="400"
  160. :before-close="handleWorldClose"
  161. :close-on-click-modal="false"
  162. >
  163. <el-steps style="max-width: 600px" :active="world_active" finish-status="success">
  164. <el-step title="数据准备"/>
  165. <el-step title="world生成"/>
  166. <el-step title="world上传"/>
  167. </el-steps>
  168. <template #footer>
  169. <el-button @click="nextToUpload" v-if="world_active != 2" :disabled="world_active !== 1">下一步</el-button>
  170. <el-upload
  171. v-if="world_active == 2"
  172. ref="upload"
  173. class="upload-demo"
  174. :action="uploadUrl"
  175. :limit="1"
  176. :before-upload="beforeUpload"
  177. :on-exceed="handleExceed"
  178. :auto-upload="true"
  179. :multiple="false"
  180. :on-success="uploadSuccess"
  181. :on-error="errorMessage"
  182. >
  183. <el-button @click="nextToUpload" >上传</el-button>
  184. </el-upload>
  185. </template>
  186. </el-dialog>
  187. <el-table stripe style="background-color: rgba(255,0,0,99%);width: 100%" border :data="tableData"
  188. fixed ref="multipleTableRef" @selection-change="handleSelectionChange" :cell-style="{ textAlign: 'center'}" :header-cell-style="{ textAlign: 'center'}">
  189. <el-table-column type="selection" width="55"/>
  190. <el-table-column prop="dataName" label="数据名称"/>
  191. <el-table-column prop="dataSize" label="数据容量" :formatter="dataSizeFormatter"/>
  192. <el-table-column prop="equipmentName" label="设备名称"/>
  193. <el-table-column prop="equipmentTypeName" label="设备类型"/>
  194. <el-table-column prop="triggerName" label="触发器名称"/>
  195. <el-table-column prop="triggerTypeName" label="触发器类型"/>
  196. <el-table-column prop="callbackTime" label="上报时间"/>
  197. <el-table-column prop="dataStateName" label="数据状态"/>
  198. <el-table-column width="300" fixed="right" label="操作">
  199. <template v-slot="scope">
  200. <el-button size="small" type="danger" @click="generateWorld(scope.row)">生成world</el-button>
  201. <el-button size="small" type="danger" @click="goToDetail">仿真测试</el-button>
  202. <!-- <el-button size="small" type="danger" @click="goToDetail">算法评价</el-button>-->
  203. </template>
  204. </el-table-column>
  205. </el-table>
  206. <p></p> <!--空行-->
  207. <el-pagination
  208. v-model:current-page="currentPage"
  209. v-model:page-size="pageSize"
  210. :page-sizes="[10]"
  211. :small="small"
  212. :disabled="disabled"
  213. :background="true"
  214. layout="total, sizes, prev, pager, next, jumper"
  215. :total="total"
  216. @size-change="handleSizeChange"
  217. @current-change="handleCurrentChange"
  218. />
  219. <!-- <el-pagination background layout="prev, pager, next" :total="1000"/>-->
  220. </el-main>
  221. <!-- <el-footer style="background-color: rgba(255,0,0,99%)">国家智能网联汽车创新中心</el-footer>-->
  222. </el-container>
  223. </div>
  224. </template>
  225. <script lang="ts" setup>
  226. import {onBeforeMount, ref, nextTick} from "vue";
  227. import axios from "axios";
  228. import {reactive} from 'vue'
  229. import {ElTable, ElLoading, ElMessage} from "element-plus";
  230. import {useRouter} from 'vue-router'; // 导入 Vue Router 的 useRouter 钩子
  231. import { genFileId } from 'element-plus'
  232. import type { UploadInstance, UploadProps, UploadRawFile } from 'element-plus'
  233. const value
  234. = ref(true)
  235. const update_active = ref(0)
  236. const world_active = ref(0)
  237. const router = useRouter();
  238. const algorithmContainerState = ref(false)
  239. const gazeboState = ref(false)
  240. const rvizState = ref(false)
  241. const multipleTableRef = ref<InstanceType<typeof ElTable>>
  242. const algorithmDialogVisible = ref(false)
  243. const mapDialogVisible = ref(false)
  244. const updateDialogVisible = ref(false)
  245. const worldDialogVisible = ref(false)
  246. const upload = ref<UploadInstance>()
  247. const uploadUrl = ref<string>()
  248. const selectImageName = ref("")
  249. const imageNames = ref([])
  250. const handleClose = (done: () => void) => {
  251. done()
  252. }
  253. const handleWorldClose = (done: () => void) => {
  254. world_active.value = 0
  255. done()
  256. }
  257. const handleMapClose = (done: () => void) => {
  258. done()
  259. }
  260. const nextToUpload = () => {
  261. world_active.value = 2
  262. }
  263. const handleExceed: UploadProps['onExceed'] = (files) => {
  264. upload.value!.clearFiles()
  265. const file = files[0] as UploadRawFile
  266. file.uid = genFileId()
  267. upload.value!.handleStart(file)
  268. }
  269. const beforeUpload = (file) => {
  270. const isWorld = file.name.endsWith(".world")
  271. if(!isWorld) {
  272. ElMessage.error("请上传world文件(以.world结尾)!")
  273. return false
  274. } else {
  275. return true
  276. }
  277. }
  278. //上传文件失败
  279. const errorMessage = (response) => {
  280. return ElMessage({
  281. message: "文件上传失败",
  282. type: "error",
  283. offset: 60
  284. })
  285. }
  286. //上传文件成功
  287. const uploadSuccess = (response, file, fileList) => {
  288. world_active.value = 3
  289. ElMessage({
  290. message: "文件上传成功,请关闭对话框",
  291. type: "success",
  292. offset: 60
  293. })
  294. }
  295. const getDockerImages = (filter_prefix) => {
  296. axios.get('http://localhost:2375/v1.43/images/json').then(function (response) {
  297. // console.log(response.data);
  298. var images = response.data
  299. .filter(d => d["RepoTags"].length > 0)
  300. .map(d => d["RepoTags"][0])
  301. .filter(d => d.startsWith(filter_prefix))
  302. // console.log("images", images)
  303. imageNames.value = images
  304. }).catch(function (error) {
  305. console.log(error);
  306. });
  307. }
  308. const multipleSelection = ref<[]>([])
  309. // do not use same name with ref
  310. const algorithmForm = reactive({
  311. sudoPassword: '',
  312. tag: '',
  313. // date1: '',
  314. // date2: '',
  315. // delivery: false,
  316. // type: [],
  317. // resource: '',
  318. // desc: '',
  319. })
  320. const mapRescanForm = reactive({
  321. name: ''
  322. })
  323. const currentTag = ref('')
  324. const algorithmImport = async () => {
  325. algorithmDialogVisible.value = false
  326. try {
  327. const result = await window.electronAPI.openFileManager();
  328. console.log('用户选择的文件路径为:', result, ',版本为:', algorithmForm.tag);
  329. // 导入镜像
  330. window.electronAPI.dockerImport(result, algorithmForm.tag)
  331. // 监听脚本执行状态
  332. window.electronAPI.onDockerImportResponse( (event, result) => {
  333. if (result.success) { // 脚本执行成功
  334. console.log('Script execution completed successfully.')
  335. ElMessage.success("镜像导入发生成功!");
  336. } else { // 脚本执行过程中发生错误
  337. console.error('Script execution failed.');
  338. ElMessage.error("镜像导入发生错误!");
  339. }
  340. })
  341. } catch (error) {
  342. console.error('打开文件管理器时出错:', error);
  343. }
  344. };
  345. const goToDetail = () => {
  346. router.push('/about')
  347. }
  348. const goToMapUpdate = () => {
  349. router.push('/map_update')
  350. }
  351. const goToUpdateStat = () => {
  352. router.push('/update_stat')
  353. }
  354. const goToMapRescan = () => {
  355. router.push('/map_rescan')
  356. }
  357. const goToTestRecord = () => {
  358. router.push('/test_record')
  359. }
  360. // 数据容量单位从B转成MB
  361. const dataSizeFormatter = (row, column, cellValue, index) => {
  362. // 假设 1MB = 1024 * 1024 字节
  363. if (cellValue) {
  364. const mb = (cellValue / (1024 * 1024)).toFixed(2); // 保留两位小数
  365. return `${mb}MB`;
  366. }
  367. return cellValue; // 如果cellValue为null或undefined,则返回原值或你想要的默认值
  368. }
  369. const isPropertySame= (array, propertyName) => {
  370. if (array.length <= 1) {
  371. return true; // 空数组或但个元素视为所有值相同
  372. }
  373. const firstValue = array[0][propertyName];
  374. for (let i = 1; i < array.length; i++) {
  375. if (array[i][propertyName] !== firstValue) {
  376. return false; // 发现不同的值
  377. }
  378. }
  379. return true; // 所有值都是相同的
  380. }
  381. const updateMap = async () => {
  382. // 检查选择的记录数量
  383. if (multipleSelection.value.length == 0) {
  384. ElMessage.error("请选择记录!")
  385. return
  386. }
  387. // 检查记录是否属于同一机器人
  388. const isEquipmentSame = isPropertySame(multipleSelection.value, "equipmentId")
  389. if (!isEquipmentSame) { // 属于多个设备
  390. ElMessage.error("所选择的记录属于多个设备,请进行检查!")
  391. return
  392. }
  393. // 检查记录的mapBuf是否一致
  394. const ids = multipleSelection.value.map(item => item["id"])
  395. console.log("ids:",ids)
  396. const status = checkMapbufConsistency(ids)
  397. if(!status) { // mapBuf不一致
  398. ElMessage.error("所选择的记录mapBuf不一致,请重新选择!")
  399. return
  400. }
  401. // 开启对话框
  402. updateDialogVisible.value = true
  403. await nextTick()
  404. // 根据id下载地图更新需要的数据(压缩包)
  405. const id = ids[0]
  406. const url = "http://127.0.0.1:8888/map/download/zipfile?id=" + id
  407. const fileName = "data-" + id + ".zip"
  408. const savePath = "/home/cicv/work/pji_desktop/tmp_download/map_zip"
  409. // 开启loading
  410. const loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
  411. const result = await window.electronAPI.downloadFile(url, fileName, savePath);
  412. if (!result.success) { // 下载失败
  413. console.error('File download failed:', result.error);
  414. ElMessage.error("地图更新数据拉取失败!");
  415. } else { // 下载成功
  416. console.log('File downloaded successfully:', result.filePath);
  417. // 关闭loading
  418. loadingInstance.close()
  419. // 更新步骤条状态
  420. update_active.value = 1
  421. }
  422. }
  423. const checkMapbufConsistency = async (ids) => {
  424. try {
  425. const response = await axios.post('http://127.0.0.1:8888/map/check/mapbufconsistency', ids)
  426. console.log(response.data)
  427. return response.data.status
  428. } catch (error) {
  429. console.log("Error checking the mapBufs' onsistency:", error)
  430. }
  431. }
  432. const handleSelectionChange = (rows: []) => {
  433. multipleSelection.value = rows
  434. // 检查记录是否属于同一机器人
  435. const isEquipmentSame = isPropertySame(rows, "equipmentId")
  436. if (!isEquipmentSame) {
  437. ElMessage.error("所选择的记录属于多个设备,请进行检查!");
  438. } else {
  439. // console.log(JSON.stringify(multipleSelection.value))
  440. }
  441. }
  442. const gazebo = () => {
  443. if (gazeboState.value) {
  444. if (window.electronAPI) {
  445. window.electronAPI.openGazebo(); // 关闭 gazebo
  446. } else {
  447. console.error('electronAPI is not defined');
  448. }
  449. // gazeboState.value = false
  450. } else {
  451. if (window.electronAPI) {
  452. window.electronAPI.closeGazebo();
  453. } else {
  454. console.error('electronAPI is not defined');
  455. }
  456. // gazeboState.value = true
  457. }
  458. }
  459. const rviz = () => {
  460. if (rvizState.value) {
  461. if (window.electronAPI) {
  462. window.electronAPI.openRviz();
  463. } else {
  464. console.error('electronAPI is not defined');
  465. }
  466. } else {
  467. if (window.electronAPI) {
  468. window.electronAPI.closeRviz();
  469. } else {
  470. console.error('electronAPI is not defined');
  471. }
  472. }
  473. }
  474. const generateWorld = async (row) => {
  475. const id = row.id
  476. const equipmentNo = row.equipmentNo
  477. const sceneNo = id
  478. const url = "http://127.0.0.1:8888/map/download/mapbagfile?id=" + id
  479. const fileName = "map-" + id + ".bag"
  480. const savePath = "/home/cicv/work/pji_desktop/tmp_download/map_bag"
  481. console.log("id", id)
  482. // 拼接world文件上传url
  483. uploadUrl.value = "http://127.0.0.1:8888/world/upload/worldfile?equipmentNo=" + equipmentNo + "&sceneNo=" + sceneNo
  484. console.log("uploadUrl.value=" + uploadUrl.value)
  485. console.log("Starting download: map.bag...")
  486. // 开启对话框
  487. worldDialogVisible.value = true
  488. // 下载map.bag
  489. const result = await window.electronAPI.downloadFile(url, fileName, savePath);
  490. if (!result.success) { // 下载失败
  491. console.error('File download failed:', result.error);
  492. ElMessage.error("地图bag数据拉取失败!");
  493. } else { // 下载成功
  494. console.log('File downloaded successfully:', result.filePath);
  495. // 更新步骤条状态
  496. world_active.value = 1
  497. console.log("Starting world generation...")
  498. // 执行脚本
  499. window.electronAPI.generateWorld(result.filePath);
  500. // 开启loading
  501. const loadingInstance = ElLoading.service({fullscreen: false, target: '.el-dialog'})
  502. // 监听脚本执行状态
  503. window.electronAPI.onGenerateWorldResponse( (event, result) => {
  504. if (result.success) { // 脚本执行成功
  505. console.log('Script execution completed successfully.')
  506. // 关闭loading
  507. loadingInstance.close()
  508. // 使用 Electron 进行文件删除操作
  509. window.electronAPI.deleteFile(fileName, savePath)
  510. // 监听删除文件的响应
  511. window.electronAPI.onDeleteFileResponse((event, response) => {
  512. if (response.success) { // 删除成功
  513. console.log("File deleted successfully.")
  514. } else { // 删除失败
  515. console.log(`Error: ${response.message}`)
  516. }
  517. })
  518. } else { // 脚本执行过程中发生错误
  519. console.error('Script execution failed.');
  520. ElMessage.error("world生成发生错误!");
  521. }
  522. })
  523. }
  524. }
  525. const queryLine = reactive({
  526. dataName: '',
  527. equipmentName: '',
  528. equipmentTypeName: '',
  529. triggerName: '',
  530. triggerTypeName: '',
  531. })
  532. const onSubmit = () => {
  533. page()
  534. }
  535. let total = ref(0)
  536. let tableData = ref([]);
  537. onBeforeMount(() => {
  538. page()
  539. })
  540. function page() {
  541. axios.get('http://36.110.106.156:11121/open/scene/list?equipmentType=YI_DAO_JI_QI_REN&page=' + currentPage.value + '&size=' + pageSize.value,
  542. {
  543. headers: {
  544. "Authorization": "4773hd92ysj54paflw2jem3onyhywxt2"
  545. }
  546. }
  547. ).then(function (response) {
  548. tableData.value = response.data.data.content
  549. total.value = response.data.data.totalElements
  550. // total.value = tableData.value.length
  551. // console.log(tableData);
  552. // console.log(response.data.data);
  553. }).catch(function (error) {
  554. console.log(error);
  555. });
  556. }
  557. const currentPage = ref(1)
  558. const pageSize = ref(10)
  559. const small = ref(false)
  560. const disabled = ref(false)
  561. const handleSizeChange = (val: number) => {
  562. pageSize.value = val
  563. page()
  564. if (tableData.value.length == 0) {
  565. page()
  566. }
  567. }
  568. const handleCurrentChange = (val: number) => {
  569. currentPage.value = val
  570. page()
  571. }
  572. const handleClick = () => {
  573. console.log('click')
  574. }
  575. </script>
  576. <style scoped>
  577. .demo-pagination-block + .demo-pagination-block {
  578. margin-top: 10px;
  579. }
  580. .demo-pagination-block .demonstration {
  581. margin-bottom: 16px;
  582. }
  583. .demo-form-inline .el-input {
  584. --el-input-width: 200px;
  585. }
  586. .demo-form-inline .el-select {
  587. --el-select-width: 400px;
  588. }
  589. .demo-image .block {
  590. padding: 30px 0;
  591. text-align: center;
  592. border-right: solid 1px var(--el-border-color);
  593. display: inline-block;
  594. width: 20%;
  595. box-sizing: border-box;
  596. vertical-align: top;
  597. }
  598. .demo-image .block:last-child {
  599. border-right: none;
  600. }
  601. .demo-image .demonstration {
  602. display: block;
  603. color: var(--el-text-color-secondary);
  604. font-size: 14px;
  605. margin-bottom: 20px;
  606. }
  607. .topbar {
  608. margin-bottom: 15px;
  609. }
  610. /* 假设 .el-pager__item 是分页按钮的类名,这可能需要你根据实际的 Element UI 版本和源码进行调整 */
  611. .el-pager__item {
  612. background-color: rgba(255, 0, 0, 50%) !important; /* 修改背景色 */
  613. color: #fff; /* 可能需要修改文本颜色以在红色背景上可见 */
  614. border-color: transparent; /* 如果需要,修改边框颜色 */
  615. }
  616. /* 修改当前选中页码的按钮样式 */
  617. .el-pager__item.is-active {
  618. background-color: rgba(255, 0, 0, 70%) !important; /* 选中时的背景色 */
  619. color: #fff; /* 选中时的文本颜色 */
  620. }
  621. </style>