index.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. <template>
  2. <div class="page-container">
  3. <!-- 搜索表单 -->
  4. <div class="search-form">
  5. <el-form :model="searchForm" inline data-id="search-form">
  6. <el-form-item :label="t('摄像头ID')">
  7. <el-input
  8. v-model.trim="searchForm.cameraId"
  9. :placeholder="t('请输入摄像头ID')"
  10. clearable
  11. data-id="search-camera-id"
  12. @keyup.enter="handleSearch"
  13. />
  14. </el-form-item>
  15. <el-form-item :label="t('名称')">
  16. <el-input
  17. v-model.trim="searchForm.name"
  18. :placeholder="t('请输入名称')"
  19. clearable
  20. data-id="search-name"
  21. @keyup.enter="handleSearch"
  22. />
  23. </el-form-item>
  24. <el-form-item :label="t('所属机器')">
  25. <el-select v-model="searchForm.machineId" :placeholder="t('全部')" clearable data-id="search-machine">
  26. <el-option :label="t('全部')" value="" />
  27. <el-option
  28. v-for="machine in machineList"
  29. :key="machine.machineId"
  30. :label="machine.name"
  31. :value="machine.machineId"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item :label="t('状态')">
  36. <el-select v-model="searchForm.status" :placeholder="t('全部')" clearable data-id="search-status">
  37. <el-option :label="t('全部')" value="" />
  38. <el-option :label="t('在线')" value="ONLINE" />
  39. <el-option :label="t('离线')" value="OFFLINE" />
  40. </el-select>
  41. </el-form-item>
  42. <el-form-item :label="t('启用状态')">
  43. <el-select v-model="searchForm.enabled" :placeholder="t('全部')" clearable data-id="search-enabled">
  44. <el-option :label="t('全部')" value="" />
  45. <el-option :label="t('已启用')" :value="true" />
  46. <el-option :label="t('已禁用')" :value="false" />
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item :label="t('创建时间')">
  50. <el-date-picker
  51. v-model="searchForm.dateRange"
  52. type="daterange"
  53. :range-separator="t('至')"
  54. :start-placeholder="t('开始日期')"
  55. :end-placeholder="t('结束日期')"
  56. value-format="YYYY-MM-DD"
  57. data-id="search-date-range"
  58. />
  59. </el-form-item>
  60. <el-form-item>
  61. <el-button type="primary" :icon="Search" data-id="btn-search" @click="handleSearch">
  62. {{ t('查询') }}
  63. </el-button>
  64. <el-button :icon="RefreshRight" data-id="btn-reset" @click="handleReset">{{ t('重置') }}</el-button>
  65. <el-button type="primary" :icon="Plus" data-id="btn-add-camera" @click="handleAdd">
  66. {{ t('新增') }}
  67. </el-button>
  68. </el-form-item>
  69. </el-form>
  70. </div>
  71. <!-- 数据表格 -->
  72. <div class="table-wrapper">
  73. <el-table
  74. ref="tableRef"
  75. v-loading="loading"
  76. :data="sortedList"
  77. stripe
  78. size="default"
  79. data-id="camera-table"
  80. height="100%"
  81. @sort-change="handleSortChange"
  82. >
  83. <el-table-column
  84. prop="cameraId"
  85. :label="t('摄像头ID')"
  86. min-width="120"
  87. sortable="custom"
  88. show-overflow-tooltip
  89. />
  90. <el-table-column prop="name" :label="t('名称')" min-width="120" sortable="custom" show-overflow-tooltip>
  91. <template #default="{ row }">
  92. <el-link type="primary" :data-id="`link-edit-${row.cameraId}`" @click="handleEdit(row)">
  93. {{ row.name }}
  94. </el-link>
  95. </template>
  96. </el-table-column>
  97. <el-table-column prop="ip" :label="t('IP地址')" min-width="130" sortable="custom" show-overflow-tooltip />
  98. <el-table-column prop="port" :label="t('端口')" width="80" sortable="custom" align="center" />
  99. <el-table-column prop="brand" :label="t('品牌')" min-width="100" sortable="custom" show-overflow-tooltip>
  100. <template #default="{ row }">
  101. {{ getBrandLabel(row.brand) }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column
  105. prop="machineName"
  106. :label="t('所属机器')"
  107. min-width="100"
  108. sortable="custom"
  109. show-overflow-tooltip
  110. />
  111. <el-table-column prop="capability" :label="t('能力')" width="100" sortable="custom" align="center">
  112. <template #default="{ row }">
  113. <el-tag :type="row.capability === 'ptz_enabled' ? 'success' : 'info'">
  114. {{ row.capability === 'ptz_enabled' ? 'PTZ' : t('仅切换') }}
  115. </el-tag>
  116. </template>
  117. </el-table-column>
  118. <el-table-column prop="status" :label="t('状态')" width="80" sortable="custom" align="center">
  119. <template #default="{ row }">
  120. <el-tag :type="row.status === 'ONLINE' ? 'success' : 'danger'">
  121. {{ row.status === 'ONLINE' ? t('在线') : t('离线') }}
  122. </el-tag>
  123. </template>
  124. </el-table-column>
  125. <el-table-column prop="enabled" :label="t('启用')" width="80" sortable="custom" align="center">
  126. <template #default="{ row }">
  127. <el-tag :type="row.enabled ? 'success' : 'info'">
  128. {{ row.enabled ? t('是') : t('否') }}
  129. </el-tag>
  130. </template>
  131. </el-table-column>
  132. <el-table-column prop="createdAt" :label="t('创建时间')" width="160" sortable="custom" align="center">
  133. <template #default="{ row }">
  134. {{ formatDateTime(row.createdAt) }}
  135. </template>
  136. </el-table-column>
  137. <el-table-column :label="t('操作')" min-width="200" align="center" fixed="right">
  138. <template #default="{ row }">
  139. <el-button
  140. type="primary"
  141. link
  142. :icon="View"
  143. :data-id="`btn-channel-${row.cameraId}`"
  144. @click="handleChannel(row)"
  145. >
  146. {{ t('通道') }}
  147. </el-button>
  148. <el-button
  149. type="success"
  150. link
  151. :icon="Connection"
  152. :data-id="`btn-check-${row.cameraId}`"
  153. @click="handleCheck(row)"
  154. >
  155. {{ t('检测') }}
  156. </el-button>
  157. <el-button type="primary" link :icon="Edit" :data-id="`btn-edit-${row.cameraId}`" @click="handleEdit(row)">
  158. {{ t('编辑') }}
  159. </el-button>
  160. <el-button
  161. type="danger"
  162. link
  163. :icon="Delete"
  164. :disabled="deleteLoading"
  165. :data-id="`btn-delete-${row.cameraId}`"
  166. @click="handleDelete(row)"
  167. >
  168. {{ t('删除') }}
  169. </el-button>
  170. </template>
  171. </el-table-column>
  172. </el-table>
  173. </div>
  174. <!-- 分页 -->
  175. <div class="pagination-container">
  176. <el-pagination
  177. v-model:current-page="currentPage"
  178. v-model:page-size="pageSize"
  179. :page-sizes="[10, 20, 50, 100]"
  180. :total="total"
  181. layout="total, sizes, prev, pager, next, jumper"
  182. background
  183. @size-change="handleSizeChange"
  184. @current-change="handleCurrentChange"
  185. />
  186. </div>
  187. <!-- 新增/编辑弹窗 -->
  188. <el-dialog v-model="dialogVisible" :title="dialogTitle" width="650px" destroy-on-close data-id="dialog-camera">
  189. <el-scrollbar>
  190. <div class="form-container">
  191. <el-form ref="formRef" :model="form" :rules="rules" label-width="auto" data-id="form-camera">
  192. <el-form-item :label="t('摄像头ID')" prop="cameraId">
  193. <el-input
  194. v-model="form.cameraId"
  195. placeholder="请输入摄像头ID"
  196. :disabled="isEdit"
  197. data-id="input-camera-id"
  198. />
  199. </el-form-item>
  200. <el-form-item :label="t('名称')" prop="name">
  201. <el-input v-model="form.name" placeholder="请输入名称" data-id="input-name" />
  202. </el-form-item>
  203. <el-row>
  204. <el-col :span="12">
  205. <el-form-item :label="t('IP地址')" prop="ip">
  206. <el-input v-model="form.ip" placeholder="请输入IP地址" data-id="input-ip" />
  207. </el-form-item>
  208. </el-col>
  209. <el-col :span="12">
  210. <el-form-item :label="t('端口')" prop="port">
  211. <el-input v-model="form.port" data-id="input-port" />
  212. </el-form-item>
  213. </el-col>
  214. </el-row>
  215. <el-row>
  216. <el-col :span="12">
  217. <el-form-item :label="t('用户名')" prop="username">
  218. <el-input v-model="form.username" placeholder="请输入用户名" data-id="input-username" />
  219. </el-form-item>
  220. </el-col>
  221. <el-col :span="12">
  222. <el-form-item :label="t('密码')" prop="password">
  223. <el-input
  224. v-model="form.password"
  225. type="password"
  226. placeholder="请输入密码"
  227. show-password
  228. data-id="input-password"
  229. />
  230. </el-form-item>
  231. </el-col>
  232. </el-row>
  233. <el-row>
  234. <el-col :span="12">
  235. <el-form-item :label="t('品牌')" prop="brand">
  236. <el-select v-model="form.brand" placeholder="请选择" data-id="select-brand">
  237. <el-option label="海康威视" value="hikvision" />
  238. <el-option label="大华" value="dahua" />
  239. <el-option label="其他" value="other" />
  240. </el-select>
  241. </el-form-item>
  242. </el-col>
  243. <el-col :span="12">
  244. <el-form-item :label="t('能力')" prop="capability">
  245. <el-select v-model="form.capability" placeholder="请选择" data-id="select-capability">
  246. <el-option label="仅切换" value="switch_only" />
  247. <el-option label="支持PTZ" value="ptz_enabled" />
  248. </el-select>
  249. </el-form-item>
  250. </el-col>
  251. </el-row>
  252. <el-form-item :label="t('所属机器')" prop="machineId">
  253. <el-select v-model="form.machineId" placeholder="请选择机器" clearable data-id="select-machine">
  254. <el-option
  255. v-for="machine in machineList"
  256. :key="machine.machineId"
  257. :label="machine.name"
  258. :value="machine.machineId"
  259. />
  260. </el-select>
  261. </el-form-item>
  262. <el-form-item v-if="isEdit" :label="t('启用状态')">
  263. <el-switch v-model="form.enabled" data-id="switch-enabled" />
  264. </el-form-item>
  265. </el-form>
  266. </div>
  267. </el-scrollbar>
  268. <template #footer>
  269. <el-button data-id="btn-cancel" @click="dialogVisible = false">{{ t('取消') }}</el-button>
  270. <el-button type="primary" :loading="submitLoading" data-id="btn-submit" @click="handleSubmit">
  271. {{ t('确定') }}
  272. </el-button>
  273. </template>
  274. </el-dialog>
  275. <!-- 通道弹窗 -->
  276. <el-dialog
  277. v-model="channelDialogVisible"
  278. :title="t('通道列表')"
  279. width="700px"
  280. destroy-on-close
  281. data-id="dialog-channel"
  282. >
  283. <el-table :data="currentChannels" border stripe>
  284. <el-table-column prop="channelId" :label="t('通道ID')" min-width="100" />
  285. <el-table-column prop="name" :label="t('名称')" min-width="100" />
  286. <el-table-column prop="rtspUrl" :label="t('RTSP地址')" min-width="200" show-overflow-tooltip />
  287. <el-table-column prop="defaultView" :label="t('默认视角')" width="90" align="center">
  288. <template #default="{ row }">
  289. <el-tag :type="row.defaultView ? 'success' : 'info'">
  290. {{ row.defaultView ? t('是') : t('否') }}
  291. </el-tag>
  292. </template>
  293. </el-table-column>
  294. <el-table-column prop="status" :label="t('状态')" width="80" align="center">
  295. <template #default="{ row }">
  296. <el-tag :type="row.status === 'ONLINE' ? 'success' : 'danger'">
  297. {{ row.status === 'ONLINE' ? t('在线') : t('离线') }}
  298. </el-tag>
  299. </template>
  300. </el-table-column>
  301. </el-table>
  302. </el-dialog>
  303. </div>
  304. </template>
  305. <script setup lang="ts">
  306. import { ref, reactive, onMounted, computed } from 'vue'
  307. import { ElMessage, ElMessageBox, type FormInstance, type FormRules } from 'element-plus'
  308. import { Plus, Edit, Delete, Search, RefreshRight, View, Connection } from '@element-plus/icons-vue'
  309. import { adminListCameras, adminAddCamera, adminUpdateCamera, adminDeleteCamera, adminCheckCamera } from '@/api/camera'
  310. import { listAllMachines } from '@/api/machine'
  311. import type { CameraInfoDTO, ChannelInfoDTO, CameraAddRequest, CameraUpdateRequest, MachineDTO } from '@/types'
  312. import dayjs from 'dayjs'
  313. import { useI18n } from 'vue-i18n'
  314. const { t } = useI18n({ useScope: 'global' })
  315. // 格式化时间
  316. function formatDateTime(dateStr: string | undefined): string {
  317. if (!dateStr) return '-'
  318. return dayjs(dateStr).format('YYYY-MM-DD HH:mm')
  319. }
  320. // 获取品牌标签
  321. function getBrandLabel(brand: string): string {
  322. const brandMap: Record<string, string> = {
  323. hikvision: '海康威视',
  324. dahua: '大华',
  325. other: '其他'
  326. }
  327. return brandMap[brand] || brand
  328. }
  329. const loading = ref(false)
  330. const submitLoading = ref(false)
  331. const deleteLoading = ref(false)
  332. const cameraList = ref<CameraInfoDTO[]>([])
  333. const machineList = ref<MachineDTO[]>([])
  334. const dialogVisible = ref(false)
  335. const channelDialogVisible = ref(false)
  336. const currentChannels = ref<ChannelInfoDTO[]>([])
  337. const formRef = ref<FormInstance>()
  338. // 排序状态
  339. const sortState = reactive<{
  340. prop: string
  341. order: 'ascending' | 'descending' | null
  342. }>({
  343. prop: '',
  344. order: null
  345. })
  346. // 搜索表单
  347. const searchForm = reactive<{
  348. cameraId: string
  349. name: string
  350. machineId: string
  351. status: '' | 'ONLINE' | 'OFFLINE'
  352. enabled: boolean | ''
  353. dateRange: [string, string] | null
  354. }>({
  355. cameraId: '',
  356. name: '',
  357. machineId: '',
  358. status: '',
  359. enabled: '',
  360. dateRange: null
  361. })
  362. // 分页相关
  363. const currentPage = ref(1)
  364. const pageSize = ref(20)
  365. const total = ref(0)
  366. // 排序后的数据
  367. const sortedList = computed(() => {
  368. const list = [...cameraList.value]
  369. if (sortState.prop && sortState.order) {
  370. list.sort((a, b) => {
  371. const aVal = a[sortState.prop as keyof CameraInfoDTO]
  372. const bVal = b[sortState.prop as keyof CameraInfoDTO]
  373. // 处理空值
  374. if (aVal == null && bVal == null) return 0
  375. if (aVal == null) return sortState.order === 'ascending' ? -1 : 1
  376. if (bVal == null) return sortState.order === 'ascending' ? 1 : -1
  377. // 比较
  378. let result = 0
  379. if (typeof aVal === 'number' && typeof bVal === 'number') {
  380. result = aVal - bVal
  381. } else if (typeof aVal === 'boolean' && typeof bVal === 'boolean') {
  382. result = aVal === bVal ? 0 : aVal ? 1 : -1
  383. } else {
  384. result = String(aVal).localeCompare(String(bVal))
  385. }
  386. return sortState.order === 'ascending' ? result : -result
  387. })
  388. }
  389. return list
  390. })
  391. const form = reactive<{
  392. id?: number
  393. cameraId: string
  394. name: string
  395. ip: string
  396. port: number
  397. username: string
  398. password: string
  399. brand: string
  400. capability: 'switch_only' | 'ptz_enabled'
  401. machineId: string
  402. enabled: boolean
  403. }>({
  404. cameraId: '',
  405. name: '',
  406. ip: '',
  407. port: 80,
  408. username: 'admin',
  409. password: '',
  410. brand: 'hikvision',
  411. capability: 'switch_only',
  412. machineId: '',
  413. enabled: true
  414. })
  415. const isEdit = computed(() => !!form.id)
  416. const dialogTitle = computed(() => (isEdit.value ? t('编辑摄像头') : t('新增摄像头')))
  417. const rules: FormRules = {
  418. cameraId: [{ required: true, message: t('请输入摄像头ID'), trigger: 'blur' }],
  419. name: [{ required: true, message: t('请输入名称'), trigger: 'blur' }],
  420. ip: [
  421. { required: true, message: t('请输入IP地址'), trigger: 'blur' },
  422. {
  423. pattern: /^((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)$/,
  424. message: t('请输入正确的IP地址'),
  425. trigger: 'blur'
  426. }
  427. ]
  428. }
  429. async function getMachines() {
  430. try {
  431. const res = await listAllMachines()
  432. if (res.success) {
  433. machineList.value = res.data
  434. }
  435. } catch (error) {
  436. console.error(t('获取机器列表失败'), error)
  437. }
  438. }
  439. async function getList() {
  440. loading.value = true
  441. try {
  442. // 构建查询参数
  443. const params: Record<string, any> = {
  444. page: currentPage.value,
  445. size: pageSize.value
  446. }
  447. // 搜索关键词(摄像头ID或名称)
  448. if (searchForm.cameraId || searchForm.name) {
  449. params.keyword = searchForm.cameraId || searchForm.name
  450. }
  451. // 机器过滤
  452. if (searchForm.machineId) {
  453. params.machineId = searchForm.machineId
  454. }
  455. // 状态过滤
  456. if (searchForm.status) {
  457. params.status = searchForm.status
  458. }
  459. // 启用状态过滤
  460. if (searchForm.enabled !== '') {
  461. params.enabled = searchForm.enabled
  462. }
  463. // 排序
  464. if (sortState.prop && sortState.order) {
  465. params.sortBy = sortState.prop
  466. params.sortDir = sortState.order === 'ascending' ? 'ASC' : 'DESC'
  467. }
  468. const res = await adminListCameras(params)
  469. if (res.success) {
  470. cameraList.value = res.data.list
  471. total.value = res.data.total || 0
  472. }
  473. } finally {
  474. loading.value = false
  475. }
  476. }
  477. function handleSearch() {
  478. currentPage.value = 1 // 搜索时重置到第一页
  479. getList()
  480. }
  481. function handleReset() {
  482. searchForm.cameraId = ''
  483. searchForm.name = ''
  484. searchForm.machineId = ''
  485. searchForm.status = ''
  486. searchForm.enabled = ''
  487. searchForm.dateRange = null
  488. currentPage.value = 1
  489. // 重置排序
  490. sortState.prop = ''
  491. sortState.order = null
  492. getList()
  493. }
  494. // 排序变化处理
  495. function handleSortChange({ prop, order }: { prop: string; order: 'ascending' | 'descending' | null }) {
  496. sortState.prop = prop || ''
  497. sortState.order = order
  498. getList()
  499. }
  500. function handleAdd() {
  501. Object.assign(form, {
  502. id: undefined,
  503. cameraId: '',
  504. name: '',
  505. ip: '',
  506. port: 80,
  507. username: 'admin',
  508. password: '',
  509. brand: 'hikvision',
  510. capability: 'switch_only',
  511. machineId: '',
  512. enabled: true
  513. })
  514. dialogVisible.value = true
  515. }
  516. function handleEdit(row: CameraInfoDTO) {
  517. Object.assign(form, {
  518. id: row.id,
  519. cameraId: row.cameraId,
  520. name: row.name,
  521. ip: row.ip,
  522. port: row.port,
  523. username: row.username,
  524. password: '',
  525. brand: row.brand,
  526. capability: row.capability,
  527. machineId: row.machineId || '',
  528. enabled: row.enabled
  529. })
  530. dialogVisible.value = true
  531. }
  532. function handleChannel(row: CameraInfoDTO) {
  533. currentChannels.value = row.channels || []
  534. channelDialogVisible.value = true
  535. }
  536. async function handleCheck(row: CameraInfoDTO) {
  537. try {
  538. const res = await adminCheckCamera(row.id)
  539. if (res.success) {
  540. if (res.data) {
  541. ElMessage.success(t('摄像头连接正常'))
  542. } else {
  543. ElMessage.warning(t('摄像头连接失败'))
  544. }
  545. }
  546. } catch (error) {
  547. console.error(t('检测失败'), error)
  548. }
  549. }
  550. async function handleDelete(row: CameraInfoDTO) {
  551. if (deleteLoading.value) return
  552. try {
  553. await ElMessageBox.confirm(`${t('确定要删除摄像头')} "${row.name}" ${t('吗?')}`, t('提示'), {
  554. type: 'warning'
  555. })
  556. deleteLoading.value = true
  557. const res = await adminDeleteCamera(row.id)
  558. if (res.success) {
  559. ElMessage.success(t('删除成功'))
  560. getList()
  561. }
  562. } catch (error) {
  563. if (error !== 'cancel') {
  564. console.error(t('删除失败'), error)
  565. }
  566. } finally {
  567. deleteLoading.value = false
  568. }
  569. }
  570. async function handleSubmit() {
  571. if (!formRef.value) return
  572. await formRef.value.validate(async (valid) => {
  573. if (valid) {
  574. submitLoading.value = true
  575. try {
  576. if (isEdit.value) {
  577. const updateData: CameraUpdateRequest = {
  578. id: form.id!,
  579. name: form.name,
  580. ip: form.ip,
  581. port: form.port,
  582. username: form.username,
  583. password: form.password || undefined,
  584. brand: form.brand,
  585. capability: form.capability,
  586. machineId: form.machineId || undefined,
  587. enabled: form.enabled
  588. }
  589. const res = await adminUpdateCamera(updateData)
  590. if (res.success) {
  591. ElMessage.success(t('修改成功'))
  592. dialogVisible.value = false
  593. getList()
  594. }
  595. } else {
  596. const addData: CameraAddRequest = {
  597. cameraId: form.cameraId,
  598. cameraName: form.name
  599. }
  600. const res = await adminAddCamera(addData)
  601. if (res.success) {
  602. ElMessage.success(t('新增成功'))
  603. dialogVisible.value = false
  604. getList()
  605. }
  606. }
  607. } finally {
  608. submitLoading.value = false
  609. }
  610. }
  611. })
  612. }
  613. function handleSizeChange(val: number) {
  614. pageSize.value = val
  615. currentPage.value = 1
  616. getList()
  617. }
  618. function handleCurrentChange(val: number) {
  619. currentPage.value = val
  620. getList()
  621. }
  622. onMounted(() => {
  623. getMachines()
  624. getList()
  625. })
  626. </script>
  627. <style lang="scss" scoped>
  628. .page-container {
  629. display: flex;
  630. flex-direction: column;
  631. box-sizing: border-box;
  632. }
  633. .form-container {
  634. padding-top: 18px;
  635. }
  636. .search-form {
  637. flex-shrink: 0;
  638. margin-bottom: 16px;
  639. padding: 16px 16px 4px 16px;
  640. background: #f5f7fa;
  641. :deep(.el-form-item) {
  642. margin-bottom: 12px;
  643. margin-right: 16px;
  644. }
  645. :deep(.el-input),
  646. :deep(.el-select) {
  647. width: 160px;
  648. }
  649. :deep(.el-date-editor--daterange) {
  650. width: 280px;
  651. .el-range-input {
  652. width: 90px;
  653. }
  654. .el-range-separator {
  655. width: 30px;
  656. }
  657. }
  658. }
  659. .table-wrapper {
  660. flex: 1;
  661. min-height: 0;
  662. overflow: hidden;
  663. }
  664. .pagination-container {
  665. flex-shrink: 0;
  666. display: flex;
  667. justify-content: flex-end;
  668. padding-top: 16px;
  669. }
  670. // 表格样式
  671. :deep(.el-table) {
  672. // 斑马纹对比度
  673. --el-table-row-hover-bg-color: #f0f0ff;
  674. .el-table__row--striped td.el-table__cell {
  675. background-color: #f8f9fc;
  676. }
  677. // 表头样式
  678. .el-table__header th {
  679. background-color: #f5f7fa;
  680. color: #333;
  681. font-weight: 600;
  682. }
  683. }
  684. // 弹窗 Indigo 主题
  685. :deep(.el-dialog) {
  686. .el-dialog__header {
  687. border-bottom: 1px solid #e5e7eb;
  688. padding-bottom: 16px;
  689. }
  690. .el-dialog__footer {
  691. border-top: 1px solid #e5e7eb;
  692. padding-top: 16px;
  693. }
  694. }
  695. </style>