MainPlanDeviceList.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. <template>
  2. <Dialog
  3. v-model="dialogVisible"
  4. :title="t('deviceList.selectDevice')"
  5. :style="{ width: dialogWidth }"
  6. :body-style="{ height: '100%' }"
  7. class="device-select-dialog"
  8. @close="handleClose"
  9. :close-on-click-modal="false">
  10. <ContentWrap class="dialog-top">
  11. <el-form
  12. class="-mb-15px"
  13. :model="queryParams"
  14. ref="queryFormRef"
  15. :inline="true"
  16. label-width="68px"
  17. @submit.prevent>
  18. <el-form-item :label="t('deviceList.deviceName')" prop="deviceName">
  19. <el-input
  20. @keyup.enter="handleQuery"
  21. v-model="queryParams.deviceName"
  22. :placeholder="t('deviceList.nameHolder')"
  23. clearable
  24. class="!w-200px" />
  25. </el-form-item>
  26. <el-form-item :label="t('deviceList.deviceCode')" prop="deviceCode">
  27. <el-input
  28. @keyup.enter="handleQuery"
  29. v-model="queryParams.deviceCode"
  30. :placeholder="t('deviceList.codeHolder')"
  31. clearable
  32. class="!w-200px" />
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button @click="handleQuery"
  36. ><Icon icon="ep:search" class="mr-5px" /> {{ t('deviceList.search') }}</el-button
  37. >
  38. <el-button @click="resetQuery"
  39. ><Icon icon="ep:refresh" class="mr-5px" /> {{ t('deviceList.reset') }}</el-button
  40. >
  41. <el-button @click="handleConfirm" class="custom-green-button"
  42. ><Icon icon="ep:check" class="mr-5px" /> {{ t('workOrderMaterial.confirm') }}</el-button
  43. >
  44. </el-form-item>
  45. </el-form>
  46. </ContentWrap>
  47. <ContentWrap class="table-container">
  48. <div class="table-wrapper">
  49. <el-table
  50. v-loading="loading"
  51. :data="list"
  52. :stripe="true"
  53. ref="tableRef"
  54. :show-overflow-tooltip="false"
  55. @row-click="handleRowClick"
  56. :max-height="effectiveTableHeight"
  57. style="width: 100%; min-width: 100%"
  58. class="fixed-layout-table">
  59. <el-table-column width="60" :label="t('workOrderMaterial.select')">
  60. <template #default="{ row }">
  61. <el-checkbox
  62. :model-value="selectedRows.some((item) => item.id === row.id)"
  63. @click.stop="toggleRow(row)"
  64. class="no-label-radio" />
  65. </template>
  66. </el-table-column>
  67. <el-table-column
  68. :label="t('chooseMaintain.deviceCode')"
  69. align="center"
  70. prop="deviceCode"
  71. :min-width="flexColumnMinWidths.deviceCode" />
  72. <el-table-column
  73. :label="t('deviceList.deviceName')"
  74. align="center"
  75. prop="deviceName"
  76. width="320"
  77. show-overflow-tooltip
  78. class-name="device-name-column">
  79. <template #default="{ row }">
  80. <div class="device-name-cell">
  81. {{ row.deviceName }}
  82. </div>
  83. </template>
  84. </el-table-column>
  85. <el-table-column
  86. :label="t('faultForm.deptId')"
  87. align="center"
  88. prop="deptId"
  89. v-if="false" />
  90. <el-table-column
  91. :label="t('iotDevice.dept')"
  92. align="center"
  93. prop="deptName"
  94. :min-width="flexColumnMinWidths.deptName" />
  95. <el-table-column
  96. :label="t('iotDevice.status')"
  97. align="center"
  98. prop="deviceStatus"
  99. :min-width="flexColumnMinWidths.deviceStatus">
  100. <template #default="scope">
  101. <dict-tag :type="DICT_TYPE.PMS_DEVICE_STATUS" :value="scope.row.deviceStatus" />
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. :label="t('deviceInfo.deviceBOM')"
  106. align="center"
  107. prop="hasSetMaintenanceBom"
  108. :min-width="flexColumnMinWidths.createTime">
  109. <template #header>
  110. <div class="column-header">
  111. {{ t('deviceInfo.deviceBOM') }}
  112. <!-- 添加感叹号图标,并使用 el-tooltip 显示提示 -->
  113. <el-tooltip effect="dark" content="请选择有保养项的设备" placement="top">
  114. <el-icon :size="12" color="#e6a23c" style="margin-left: 3px; cursor: pointer">
  115. <WarningFilled />
  116. </el-icon>
  117. </el-tooltip>
  118. </div>
  119. </template>
  120. <template #default="{ row }">
  121. <div
  122. :class="{
  123. 'no-maintenance': !row.hasSetMaintenanceBom,
  124. 'has-maintenance': row.hasSetMaintenanceBom
  125. }">
  126. {{
  127. row.hasSetMaintenanceBom
  128. ? t('mainPlan.haveMaintItems')
  129. : t('mainPlan.noMaintItems')
  130. }}
  131. </div>
  132. </template>
  133. </el-table-column>
  134. <!-- <el-table-column
  135. :label="t('deviceList.createTime')"
  136. align="center"
  137. prop="createTime"
  138. :min-width="flexColumnMinWidths.createTime"
  139. >
  140. <template #default="{ row }">
  141. <div class="date-cell">
  142. {{ formatDateTime(row.createTime) }}
  143. </div>
  144. </template>
  145. </el-table-column> -->
  146. </el-table>
  147. </div>
  148. <!-- 分页 -->
  149. <Pagination
  150. v-if="showPagination"
  151. :total="total"
  152. v-model:page="queryParams.pageNo"
  153. v-model:limit="queryParams.pageSize"
  154. @pagination="getList" />
  155. </ContentWrap>
  156. </Dialog>
  157. </template>
  158. <script setup lang="ts">
  159. import { IotDeviceApi, IotDeviceVO } from '@/api/pms/device'
  160. import { DICT_TYPE } from '@/utils/dict'
  161. import { useCache } from '@/hooks/web/useCache'
  162. import { WarningFilled } from '@element-plus/icons-vue'
  163. const dialogVisible = ref(false) // 弹窗的是否展示
  164. const loading = ref(true) // 列表的加载中
  165. const queryFormRef = ref() // 搜索的表单
  166. const list = ref<IotDeviceVO[]>([]) // 列表的数据
  167. const total = ref(0) // 列表的总页数
  168. const tableRef = ref()
  169. const selectedRows = ref<IotDeviceVO[]>([]) // 多选数据(存储所有选中行的数组)
  170. const { t } = useI18n() // 国际化
  171. // 调整 emit 类型
  172. const emit = defineEmits<{
  173. (e: 'choose', value: IotDeviceVO[]): void
  174. (e: 'close'): void
  175. }>()
  176. const queryParams = reactive({
  177. pageNo: 1,
  178. pageSize: 10,
  179. label: '',
  180. status: undefined,
  181. deptId: undefined,
  182. assetClass: undefined,
  183. deviceName: undefined,
  184. deviceCode: undefined,
  185. name: undefined,
  186. code: undefined
  187. })
  188. // 响应式变量
  189. const dialogWidth = ref('1100px')
  190. const tableMinHeight = ref(400) // 初始最小高度
  191. const effectiveTableHeight = ref<number | null>(null) // 单一高度变量
  192. const dialogTopRef = ref<HTMLElement | null>(null)
  193. const showPagination = ref(false) // 控制分页显示
  194. const tableContainerWidth = ref(0) // 表格容器宽度
  195. // 弹性列最小宽度记录
  196. const flexColumnMinWidths = reactive({
  197. deviceCode: 0,
  198. deviceName: 0,
  199. deptName: 0,
  200. deviceStatus: 0,
  201. createTime: 0
  202. })
  203. // 点击整行选中
  204. const handleRowClick = (row) => {
  205. toggleRow(row)
  206. }
  207. const open = async () => {
  208. dialogVisible.value = true
  209. // 重置为初始参数(保留分页设置)
  210. Object.assign(queryParams, initialQueryParams)
  211. queryFormRef.value?.resetFields()
  212. // 初始隐藏分页组件
  213. showPagination.value = false
  214. await getList()
  215. // 动态计算宽度
  216. await nextTick()
  217. const viewportWidth = window.innerWidth
  218. if (viewportWidth < 1200) {
  219. // 小屏幕自适应
  220. dialogWidth.value = Math.min(1100, viewportWidth - 40) + 'px'
  221. } else {
  222. // 大屏幕保持固定
  223. dialogWidth.value = '1100px'
  224. }
  225. // 确保计算高度的DOM已渲染
  226. await nextTick()
  227. calculateTableHeight()
  228. }
  229. defineExpose({ open })
  230. const { wsCache } = useCache()
  231. // 文本测量工具函数
  232. const measureText = (
  233. text: string,
  234. fontSize: string = '14px',
  235. fontWeight: string = 'normal',
  236. extraStyles: Record<string, string> = {}
  237. ): number => {
  238. const span = document.createElement('span')
  239. span.style.visibility = 'hidden'
  240. span.style.position = 'absolute'
  241. span.style.fontSize = fontSize
  242. span.style.fontWeight = fontWeight
  243. span.style.fontFamily = "'Microsoft YaHei', sans-serif"
  244. span.style.whiteSpace = 'nowrap'
  245. span.textContent = text
  246. // 应用额外样式
  247. Object.keys(extraStyles).forEach((key) => {
  248. span.style[key as any] = extraStyles[key]
  249. })
  250. document.body.appendChild(span)
  251. const width = span.offsetWidth
  252. document.body.removeChild(span)
  253. return width
  254. }
  255. // 自定义日期时间格式化函数
  256. const formatDateTime = (dateString: string | Date) => {
  257. if (!dateString) return ''
  258. const date = new Date(dateString)
  259. // 确保日期有效
  260. if (isNaN(date.getTime())) {
  261. return String(dateString).replace(/[\r\n]/g, '')
  262. }
  263. const year = date.getFullYear()
  264. const month = String(date.getMonth() + 1).padStart(2, '0')
  265. const day = String(date.getDate()).padStart(2, '0')
  266. const hours = String(date.getHours()).padStart(2, '0')
  267. const minutes = String(date.getMinutes()).padStart(2, '0')
  268. const seconds = String(date.getSeconds()).padStart(2, '0')
  269. return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`.replace(/[\r\n]/g, '')
  270. }
  271. // 列宽计算函数
  272. const calculateColumnWidths = async () => {
  273. await nextTick()
  274. if (!tableRef.value || !list.value.length) return
  275. const table = tableRef.value
  276. const columns = table.columns
  277. const rows = list.value
  278. // 获取表格容器宽度
  279. const tableContainer = tableRef.value?.$el?.closest('.table-wrapper')
  280. if (tableContainer) {
  281. tableContainerWidth.value = tableContainer.clientWidth
  282. }
  283. // 计算各列所需最小宽度
  284. const columnMinWidths = columns.map((col, colIndex) => {
  285. if (colIndex === 0) return 60 // 选择列固定宽度
  286. // 测量表头宽度
  287. // 测量表头宽度 - 使用表头实际样式
  288. const headerWidth = col.label
  289. ? measureText(col.label, '14px', 'bold', {
  290. padding: '0 12px', // 表头实际内边距
  291. boxSizing: 'border-box'
  292. }) + 0 // 安全边距
  293. : 0
  294. // 测量单元格内容宽度
  295. let maxCellWidth = 0
  296. rows.forEach((row) => {
  297. let cellValue = ''
  298. let cellWidth = 0
  299. if (col.property === 'createTime') {
  300. // 特殊处理:使用格式化后的日期文本
  301. cellValue = formatDateTime(row[col.property])
  302. // 使用完整时间样本确保宽度足够
  303. const sampleText = '2024-12-31 23:59:59'
  304. const sampleWidth = measureText(sampleText, '14px', 'normal', {
  305. padding: '0 12px',
  306. boxSizing: 'border-box'
  307. })
  308. // 时间列额外增加安全边距
  309. cellWidth =
  310. Math.max(
  311. measureText(cellValue, '14px', 'normal', {
  312. padding: '0 12px',
  313. boxSizing: 'border-box'
  314. }),
  315. sampleWidth
  316. ) + 0 // 安全边距
  317. // if (cellWidth > maxCellWidth) maxCellWidth = cellWidth
  318. } else if (col.property === 'deviceStatus') {
  319. // 特殊处理:字典标签文本
  320. const statusText = row.deviceStatusLabel || row[col.property] || ''
  321. // 模拟el-tag样式进行测量
  322. cellWidth =
  323. measureText(statusText, '12px', 'normal', {
  324. padding: '2px 7px',
  325. border: '1px solid #dcdfe6',
  326. borderRadius: '4px',
  327. display: 'inline-block',
  328. lineHeight: '1.5',
  329. boxSizing: 'border-box'
  330. }) + 0 // 20px安全边距
  331. } else {
  332. cellValue = row[col.property] || ''
  333. cellWidth =
  334. measureText(cellValue, '14px', 'normal', {
  335. padding: '0 12px',
  336. boxSizing: 'border-box'
  337. }) + 0 // 安全边距
  338. }
  339. if (cellWidth > maxCellWidth) maxCellWidth = cellWidth
  340. })
  341. // 取标题和内容的最大值,并设置最小宽度
  342. let minWidth = 100 // 默认最小宽度
  343. if (col.property === 'createTime') {
  344. minWidth = 100 // 时间列最小宽度设为180px
  345. }
  346. // 取标题和内容的最大值
  347. return Math.max(headerWidth, maxCellWidth, minWidth)
  348. })
  349. // 记录弹性列的最小宽度
  350. flexColumnMinWidths.deviceCode = columnMinWidths[1]
  351. flexColumnMinWidths.deviceName = columnMinWidths[2]
  352. flexColumnMinWidths.deptName = columnMinWidths[4]
  353. flexColumnMinWidths.deviceStatus = columnMinWidths[5]
  354. flexColumnMinWidths.createTime = columnMinWidths[6]
  355. // 触发表格重新布局
  356. table.doLayout()
  357. }
  358. const getList = async () => {
  359. loading.value = true
  360. try {
  361. // const user = wsCache.get(CACHE_KEY.USER)
  362. // queryParams.deptId = user.user.deptId
  363. const data = await IotDeviceApi.getIotDevicePage(queryParams)
  364. list.value = data.list
  365. total.value = data.total
  366. // 只有在需要时才显示分页
  367. showPagination.value = total.value > queryParams.pageSize
  368. // 数据加载完成后重新计算高度
  369. await nextTick()
  370. calculateTableHeight()
  371. calculateColumnWidths()
  372. } finally {
  373. loading.value = false
  374. // 数据加载完成后计算列宽
  375. await nextTick()
  376. calculateColumnWidths()
  377. }
  378. }
  379. // 计算表格最大高度
  380. const calculateTableHeight = () => {
  381. nextTick(() => {
  382. try {
  383. // 获取对话框实际可用空间
  384. const dialogBody = document.querySelector('.el-dialog__body')
  385. if (!dialogBody || !dialogTopRef.value) return
  386. const dialogBodyRect = dialogBody.getBoundingClientRect()
  387. // 计算可用高度 = 对话框body高度 - 顶部表单高度 - 内边距
  388. const dialogPadding = 20 // 上下内边距
  389. const topHeight = dialogTopRef.value.offsetHeight
  390. const availableHeight = dialogBodyRect.height - topHeight - dialogPadding
  391. // 保证最小高度
  392. let calculatedHeight = Math.max(availableHeight, tableMinHeight.value)
  393. // 根据记录数量计算所需高度(考虑表头和行高)
  394. const headerHeight = 40 // 表头高度估算
  395. const rowHeight = 48 // 行高估算(增加8px用于行间分割线)
  396. const totalRowsHeight = headerHeight + list.value.length * rowHeight
  397. // 如果所需高度小于可用高度,则按实际高度显示
  398. if (totalRowsHeight < availableHeight) {
  399. calculatedHeight = totalRowsHeight
  400. }
  401. // 确保高度合理
  402. effectiveTableHeight.value = Math.max(calculatedHeight, 300)
  403. } catch (e) {
  404. console.error('高度计算错误:', e)
  405. // 设置回退高度
  406. effectiveTableHeight.value = 500
  407. }
  408. })
  409. }
  410. const initialQueryParams = {
  411. pageNo: 1,
  412. pageSize: 10,
  413. label: '',
  414. status: undefined,
  415. deptId: undefined,
  416. assetClass: undefined,
  417. deviceName: undefined,
  418. deviceCode: undefined,
  419. name: undefined,
  420. code: undefined
  421. }
  422. // 多选 切换行选中状态
  423. const toggleRow = (row) => {
  424. const index = selectedRows.value.findIndex((item) => item.id === row.id)
  425. if (index > -1) {
  426. selectedRows.value.splice(index, 1) // 取消选中
  427. } else {
  428. selectedRows.value.push(row) // 选中
  429. }
  430. }
  431. // 关闭时清空选择
  432. const handleClose = () => {
  433. tableRef.value?.clearSelection()
  434. selectedRows.value = []
  435. emit('close')
  436. }
  437. // 确认选择
  438. const handleConfirm = () => {
  439. if (selectedRows.value.length === 0) {
  440. ElMessage.warning('请至少选择一个设备')
  441. return
  442. }
  443. // 检查是否有设备没有保养项
  444. const hasInvalidDevice = selectedRows.value.some((row) => row.hasSetMaintenanceBom === false)
  445. if (hasInvalidDevice) {
  446. // 显示警告信息
  447. ElMessage.warning({
  448. message: '请选择有保养项的设备',
  449. duration: 3000,
  450. grouping: true
  451. })
  452. return // 不关闭弹窗
  453. }
  454. emit(
  455. 'choose',
  456. selectedRows.value.map((row) => ({
  457. ...row,
  458. // 确保返回必要字段
  459. id: row.id,
  460. deviceCode: row.deviceCode,
  461. deviceName: row.deviceName,
  462. deviceStatus: row.deviceStatus,
  463. deptName: row.deptName,
  464. assetProperty: row.assetProperty,
  465. name: row.name,
  466. code: row.code
  467. }))
  468. )
  469. dialogVisible.value = false
  470. handleClose()
  471. }
  472. /** 搜索按钮操作 */
  473. const handleQuery = () => {
  474. queryParams.pageNo = 1
  475. getList()
  476. }
  477. const choose = (row: DictDataVO) => {
  478. emit('choose', row)
  479. dialogVisible.value = false
  480. }
  481. /** 重置按钮操作 */
  482. const resetQuery = () => {
  483. // 重置为初始参数
  484. Object.assign(queryParams, initialQueryParams)
  485. queryFormRef.value?.resetFields()
  486. handleQuery()
  487. }
  488. // 监听列表变化动态调整高度
  489. watch(list, () => {
  490. calculateTableHeight()
  491. if (dialogVisible.value) {
  492. calculateColumnWidths()
  493. }
  494. })
  495. // 监听窗口大小变化
  496. onMounted(() => {
  497. window.addEventListener('resize', calculateTableHeight)
  498. window.addEventListener('resize', calculateColumnWidths)
  499. })
  500. onUnmounted(() => {
  501. window.removeEventListener('resize', calculateTableHeight)
  502. window.removeEventListener('resize', calculateColumnWidths)
  503. })
  504. </script>
  505. <style lang="scss" scoped>
  506. .device-select-dialog {
  507. display: flex;
  508. flex-direction: column;
  509. height: 100%;
  510. // 增强弹窗高度利用
  511. ::v-deep(.el-dialog) {
  512. display: flex;
  513. max-height: 85vh;
  514. flex-direction: column;
  515. .el-dialog__header {
  516. padding: 15px 20px;
  517. }
  518. .el-dialog__body {
  519. display: flex;
  520. flex-direction: column;
  521. flex: 1;
  522. padding: 15px;
  523. overflow: hidden;
  524. }
  525. }
  526. }
  527. /* 列宽度保证 - 防止挤压 */
  528. .el-table {
  529. /* 确保所有列头文字居中 */
  530. ::v-deep(.el-table__header) th > .cell {
  531. display: flex;
  532. justify-content: center;
  533. align-items: center;
  534. text-align: center;
  535. }
  536. /* 所有内容列居中对齐 */
  537. ::v-deep(.el-table__body) td {
  538. text-align: center !important;
  539. .cell {
  540. display: flex;
  541. justify-content: center;
  542. align-items: center;
  543. }
  544. }
  545. // 行高增加,提升可读性
  546. ::v-deep(.el-table__row) {
  547. height: 40px;
  548. }
  549. }
  550. /* 列宽自适应样式 */
  551. ::v-deep(.el-table) {
  552. .el-table__header th {
  553. padding: 0 !important;
  554. .cell {
  555. display: flex;
  556. height: 100%;
  557. padding: 0 !important;
  558. font-weight: bold !important;
  559. box-sizing: border-box !important;
  560. justify-content: center;
  561. align-items: center;
  562. }
  563. }
  564. .el-table__body td {
  565. padding: 0 !important;
  566. .cell {
  567. display: flex;
  568. height: 100%;
  569. padding: 0 !important;
  570. box-sizing: border-box !important;
  571. justify-content: center;
  572. align-items: center;
  573. }
  574. }
  575. /* 特定列额外修正 */
  576. .el-table__cell:nth-child(4), /* 部门列 */
  577. .el-table__cell:nth-child(5), /* 状态列 */
  578. .el-table__cell:nth-child(6) /* 时间列 */ {
  579. .date-cell {
  580. overflow: visible !important;
  581. text-overflow: clip !important;
  582. white-space: nowrap !important;
  583. justify-content: center;
  584. }
  585. }
  586. }
  587. /* 固定表格布局 */
  588. .fixed-layout-table {
  589. ::v-deep(table) {
  590. width: auto !important;
  591. min-width: 100%;
  592. table-layout: fixed !important; /* 固定列宽 */
  593. }
  594. ::v-deep(.el-table__header),
  595. ::v-deep(.el-table__body) {
  596. width: auto !important; /* 允许宽度扩展 */
  597. }
  598. ::v-deep(.el-table__cell) {
  599. overflow: visible !important; /* 禁用裁剪 */
  600. text-overflow: unset !important; /* 移除省略号 */
  601. white-space: nowrap !important; /* 禁止换行 */
  602. &:nth-child(4) {
  603. /* 部门 */
  604. min-width: v-bind('flexColumnMinWidths.deptName + "px"');
  605. text-align: center;
  606. }
  607. &:nth-child(5) {
  608. /* 状态 */
  609. min-width: v-bind('flexColumnMinWidths.deviceStatus + "px"');
  610. text-align: center;
  611. }
  612. &:nth-child(6) {
  613. /* 创建时间 */
  614. min-width: v-bind('(flexColumnMinWidths.createTime) + "px"');
  615. overflow: visible !important;
  616. text-align: center;
  617. }
  618. }
  619. }
  620. .dialog-top {
  621. flex-shrink: 0;
  622. margin-bottom: 15px;
  623. .el-form {
  624. padding: 5px 0; // 减少表单内边距
  625. }
  626. }
  627. .table-container {
  628. display: flex;
  629. max-height: 100%;
  630. min-height: 0;
  631. flex: 1;
  632. flex-direction: column;
  633. .table-wrapper {
  634. overflow: auto !important;
  635. .el-table {
  636. // 表格自带的滚动机制
  637. ::v-deep(.el-table__body-wrapper) {
  638. overflow: auto !important;
  639. }
  640. }
  641. }
  642. }
  643. .no-maintenance {
  644. font-weight: bold;
  645. color: red; /* 无保养项文本为红色 */
  646. }
  647. .has-maintenance {
  648. font-weight: bold;
  649. color: #67c23a; /* 有保养项文本为淡绿色 */
  650. }
  651. .table-wrapper {
  652. width: 100%;
  653. overflow: auto hidden !important;
  654. }
  655. .no-label-radio .el-radio__label {
  656. display: none;
  657. }
  658. .no-label-radio .el-radio__inner {
  659. margin-right: 0;
  660. }
  661. .fixed-layout-table {
  662. ::v-deep(.device-name-column) {
  663. overflow: hidden !important;
  664. text-overflow: ellipsis !important;
  665. }
  666. ::v-deep(.device-name-column .cell) {
  667. display: block !important;
  668. overflow: hidden !important;
  669. text-overflow: ellipsis !important;
  670. white-space: nowrap !important;
  671. }
  672. }
  673. .device-name-cell {
  674. width: 100%;
  675. overflow: hidden;
  676. text-overflow: ellipsis;
  677. white-space: nowrap;
  678. }
  679. /* 自定义淡绿色按钮 */
  680. :deep(.custom-green-button) {
  681. color: #67c23a;
  682. background-color: #e1f3d8;
  683. border-color: #e1f3d8;
  684. }
  685. /* 悬停效果 */
  686. :deep(.custom-green-button:hover) {
  687. color: #5daf34;
  688. background-color: #d1e8c0;
  689. border-color: #d1e8c0;
  690. }
  691. /* 点击效果 */
  692. :deep(.custom-green-button:active) {
  693. background-color: #c2dca8;
  694. border-color: #c2dca8;
  695. }
  696. // 分页样式优化 - 弹性位置
  697. .pagination-container {
  698. z-index: 10;
  699. padding: 15px 0 5px;
  700. margin-top: auto; // 将分页推到底部
  701. background: white; // 防止内容重叠
  702. }
  703. /* 使感叹号图标与标题对齐 */
  704. .column-header {
  705. display: flex;
  706. align-items: center;
  707. justify-content: center;
  708. .el-tooltip {
  709. display: inline-flex;
  710. margin-left: 3px;
  711. align-items: center;
  712. .el-icon {
  713. font-size: 12px;
  714. color: #e6a23c;
  715. cursor: pointer;
  716. transition: color 0.3s;
  717. &:hover {
  718. color: #d48816;
  719. }
  720. }
  721. }
  722. }
  723. .el-tooltip {
  724. cursor: pointer;
  725. }
  726. /* 优化图标样式 */
  727. .el-tooltip .el-icon-warning {
  728. font-size: 18px;
  729. color: #e6a23c; /* 使感叹号图标有明显的颜色 */
  730. }
  731. </style>