index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853
  1. <template>
  2. <div class="param-item" :class="{ disabled: disabled, error: hasError }">
  3. <!-- 只读模式 -->
  4. <div v-if="!isEditing" class="read-mode" @mouseenter="showEdit = true" @mouseleave="showEdit = false">
  5. <div class="param-label" v-html="highlightedLabel"></div>
  6. <div class="param-value">
  7. <span v-if="type === 'switch'" class="switch-value">
  8. <i :class="value ? 'el-icon-check' : 'el-icon-close'" :style="{ color: value ? '#67C23A' : '#F56C6C' }"></i>
  9. {{ value ? '已启用' : '已禁用' }}
  10. </span>
  11. <span v-else-if="type === 'textarea'" class="textarea-value" :class="{ 'monospace': type === 'textarea' }">{{ displayValue }}</span>
  12. <span v-else-if="type === 'select'" class="text-value">{{ displayValue }}</span>
  13. <span v-else-if="type === 'number'" class="text-value">{{ displayValue }}</span>
  14. <span v-else class="text-value">{{ displayValue }}</span>
  15. </div>
  16. <div class="param-actions">
  17. <!-- 复制按钮 -->
  18. <el-button
  19. v-if="showCopyButton && !disabled"
  20. v-show="showEdit"
  21. type="text"
  22. size="mini"
  23. icon="el-icon-document-copy"
  24. @click="handleCopy"
  25. :aria-label="`复制${label}值`"
  26. class="copy-btn"
  27. >
  28. </el-button>
  29. <el-button
  30. v-show="!disabled && showEdit"
  31. type="text"
  32. size="mini"
  33. icon="el-icon-edit"
  34. @click="startEdit"
  35. :aria-label="`编辑${label}`"
  36. >
  37. 编辑
  38. </el-button>
  39. </div>
  40. </div>
  41. <!-- 编辑模式 -->
  42. <div v-else class="edit-mode" @keydown="handleKeyDown">
  43. <div class="param-label">{{ label }}</div>
  44. <div class="param-input">
  45. <!-- 开关类型 -->
  46. <el-switch
  47. v-if="type === 'switch'"
  48. v-model="editValue"
  49. active-text="启用"
  50. inactive-text="禁用"
  51. :disabled="saving"
  52. ref="editInput"
  53. />
  54. <!-- 文本域类型 -->
  55. <div v-else-if="type === 'textarea'" class="textarea-container">
  56. <el-input
  57. v-model="editValue"
  58. type="textarea"
  59. :rows="3"
  60. :placeholder="placeholder"
  61. :disabled="saving"
  62. ref="editInput"
  63. class="monospace-input"
  64. />
  65. <!-- 过滤规则示例 -->
  66. <el-popover
  67. v-if="label.includes('过滤规则')"
  68. placement="top"
  69. width="300"
  70. trigger="click"
  71. >
  72. <div class="filter-examples">
  73. <p><strong>常见过滤规则示例:</strong></p>
  74. <div class="example-item" v-for="example in filterExamples" :key="example.rule">
  75. <code>{{ example.rule }}</code>
  76. <span class="example-desc">{{ example.desc }}</span>
  77. </div>
  78. </div>
  79. <el-button slot="reference" type="text" size="mini" class="example-btn">
  80. <i class="el-icon-question"></i>
  81. 示例
  82. </el-button>
  83. </el-popover>
  84. </div>
  85. <!-- 数字输入类型 -->
  86. <el-input
  87. v-else-if="type === 'number'"
  88. v-model="editValue"
  89. :placeholder="placeholder"
  90. :disabled="saving"
  91. ref="editInput"
  92. @input="handleNumberInput"
  93. />
  94. <!-- 下拉选择类型 -->
  95. <el-select
  96. v-else-if="type === 'select'"
  97. v-model="editValue"
  98. :placeholder="placeholder"
  99. :disabled="saving"
  100. ref="editInput"
  101. >
  102. <el-option
  103. v-for="option in options"
  104. :key="option.value"
  105. :label="option.label"
  106. :value="option.value"
  107. />
  108. </el-select>
  109. <!-- 其他输入类型 -->
  110. <el-input
  111. v-else
  112. v-model="editValue"
  113. :placeholder="placeholder"
  114. :disabled="saving"
  115. ref="editInput"
  116. />
  117. </div>
  118. <div class="param-actions">
  119. <el-button
  120. type="primary"
  121. size="mini"
  122. :loading="saving"
  123. @click="handleSave"
  124. :aria-label="`保存${label}`"
  125. >
  126. 保存
  127. </el-button>
  128. <el-button
  129. type="text"
  130. size="mini"
  131. :disabled="saving"
  132. @click="handleCancel"
  133. :aria-label="`取消编辑${label}`"
  134. >
  135. 取消
  136. </el-button>
  137. </div>
  138. </div>
  139. <!-- 错误提示 -->
  140. <div v-if="hasError" class="error-message">{{ errorMessage }}</div>
  141. <!-- 保存成功图标 -->
  142. <transition name="save-success">
  143. <div v-if="showSaveSuccess" class="save-success-icon">
  144. <i class="el-icon-check"></i>
  145. </div>
  146. </transition>
  147. </div>
  148. </template>
  149. <script>
  150. export default {
  151. name: 'XtParamItem',
  152. props: {
  153. label: {
  154. type: String,
  155. required: true
  156. },
  157. value: {
  158. type: [String, Number, Boolean],
  159. default: ''
  160. },
  161. type: {
  162. type: String,
  163. default: 'text',
  164. validator: value => ['text', 'url', 'ip', 'switch', 'textarea', 'number', 'select'].includes(value)
  165. },
  166. placeholder: {
  167. type: String,
  168. default: ''
  169. },
  170. disabled: {
  171. type: Boolean,
  172. default: false
  173. },
  174. searchKeyword: {
  175. type: String,
  176. default: ''
  177. },
  178. // 数字类型相关属性
  179. unit: {
  180. type: String,
  181. default: ''
  182. },
  183. min: {
  184. type: Number,
  185. default: undefined
  186. },
  187. max: {
  188. type: Number,
  189. default: undefined
  190. },
  191. step: {
  192. type: Number,
  193. default: 0.01
  194. },
  195. precision: {
  196. type: Number,
  197. default: 2
  198. },
  199. // 选择类型相关属性
  200. options: {
  201. type: Array,
  202. default: () => []
  203. }
  204. },
  205. data() {
  206. return {
  207. isEditing: false,
  208. editValue: '',
  209. showEdit: false,
  210. saving: false,
  211. hasError: false,
  212. errorMessage: '',
  213. showSaveSuccess: false,
  214. filterExamples: [
  215. { rule: 'tcp and (port 80 or port 443)', desc: 'HTTP/HTTPS 流量' },
  216. { rule: 'udp and port 53', desc: 'DNS 查询' },
  217. { rule: 'icmp', desc: 'ICMP 协议(ping)' },
  218. { rule: 'host 192.168.1.100', desc: '特定主机流量' },
  219. { rule: 'src net 192.168.0.0/16', desc: '来源网段过滤' }
  220. ]
  221. }
  222. },
  223. computed: {
  224. // 是否显示复制按钮
  225. showCopyButton() {
  226. return ['ip', 'url', 'text', 'number', 'textarea', 'select'].includes(this.type) && this.value && this.value.toString().trim()
  227. },
  228. // 显示值
  229. displayValue() {
  230. if (this.type === 'switch') {
  231. return this.value ? '已启用' : '已禁用'
  232. } else if (this.type === 'select') {
  233. const option = this.options.find(opt => opt.value === this.value)
  234. return option ? option.label : this.value
  235. } else if (this.type === 'number' && this.unit) {
  236. return this.value !== null && this.value !== undefined ? `${this.value} ${this.unit}` : (this.placeholder || '未设置')
  237. }
  238. return this.value || this.placeholder || '未设置'
  239. },
  240. // 高亮标签
  241. highlightedLabel() {
  242. if (!this.searchKeyword.trim()) {
  243. return this.label
  244. }
  245. const keyword = this.searchKeyword.toLowerCase()
  246. const labelLower = this.label.toLowerCase()
  247. const index = labelLower.indexOf(keyword)
  248. if (index === -1) {
  249. return this.label
  250. }
  251. const before = this.label.substring(0, index)
  252. const match = this.label.substring(index, index + keyword.length)
  253. const after = this.label.substring(index + keyword.length)
  254. return `${before}<mark class="search-highlight">${match}</mark>${after}`
  255. }
  256. },
  257. methods: {
  258. startEdit() {
  259. if (this.disabled) return
  260. this.isEditing = true
  261. this.editValue = this.value
  262. this.hasError = false
  263. this.errorMessage = ''
  264. this.$nextTick(() => {
  265. if (this.$refs.editInput) {
  266. if (this.type === 'switch') {
  267. this.$refs.editInput.$el.focus()
  268. } else {
  269. this.$refs.editInput.focus()
  270. }
  271. }
  272. })
  273. },
  274. async handleSave() {
  275. if (this.saving) return
  276. // 验证数字输入
  277. if (this.type === 'number') {
  278. const validation = this.validateNumber(this.editValue)
  279. if (!validation.valid) {
  280. this.hasError = true
  281. this.errorMessage = validation.message
  282. return
  283. }
  284. // 转换为数字类型
  285. this.editValue = this.editValue === '' ? null : parseFloat(this.editValue)
  286. }
  287. // 校验
  288. const validation = this.validateValue(this.editValue)
  289. if (!validation.valid) {
  290. this.hasError = true
  291. this.errorMessage = validation.message
  292. return
  293. }
  294. this.saving = true
  295. this.hasError = false
  296. try {
  297. await this.$emit('save', this.editValue)
  298. // 保存成功
  299. this.isEditing = false
  300. this.showSaveSuccess = true
  301. // 1.2秒后隐藏成功图标
  302. setTimeout(() => {
  303. this.showSaveSuccess = false
  304. }, 1200)
  305. } catch (error) {
  306. this.hasError = true
  307. this.errorMessage = error.message || '保存失败'
  308. } finally {
  309. this.saving = false
  310. }
  311. },
  312. handleCancel() {
  313. if (this.saving) return
  314. this.isEditing = false
  315. this.editValue = ''
  316. this.hasError = false
  317. this.errorMessage = ''
  318. this.$emit('cancel')
  319. },
  320. // 复制功能
  321. async handleCopy() {
  322. try {
  323. const copyValue = this.type === 'select' ? this.displayValue : this.value.toString()
  324. await navigator.clipboard.writeText(copyValue)
  325. this.$message.success('已复制')
  326. } catch (error) {
  327. // Fallback for older browsers
  328. const copyValue = this.type === 'select' ? this.displayValue : this.value.toString()
  329. const textArea = document.createElement('textarea')
  330. textArea.value = copyValue
  331. document.body.appendChild(textArea)
  332. textArea.select()
  333. document.execCommand('copy')
  334. document.body.removeChild(textArea)
  335. this.$message.success('已复制')
  336. }
  337. },
  338. // 键盘事件处理
  339. handleKeyDown(event) {
  340. if (event.key === 'Enter' && !event.shiftKey) {
  341. event.preventDefault()
  342. this.handleSave()
  343. } else if (event.key === 'Escape') {
  344. event.preventDefault()
  345. this.handleCancel()
  346. } else if (event.key === 'Tab') {
  347. // Tab 键在卡片内循环 - 这里可以根据需要实现特定逻辑
  348. // 现在让浏览器默认处理 Tab 键
  349. }
  350. },
  351. // 数字输入处理
  352. handleNumberInput(value) {
  353. if (this.type !== 'number') return
  354. // 允许输入负号、小数点和数字
  355. const numericValue = value.replace(/[^-0-9.]/g, '')
  356. // 确保只有一个负号且在开头
  357. let cleanValue = numericValue.replace(/-/g, '')
  358. if (numericValue.indexOf('-') === 0) {
  359. cleanValue = '-' + cleanValue
  360. }
  361. // 确保只有一个小数点
  362. const parts = cleanValue.split('.')
  363. if (parts.length > 2) {
  364. cleanValue = parts[0] + '.' + parts.slice(1).join('')
  365. }
  366. this.editValue = cleanValue
  367. },
  368. // 验证数字值
  369. validateNumber(value) {
  370. if (this.type !== 'number') return { valid: true }
  371. // 空值检查
  372. if (value === '' || value === null || value === undefined) {
  373. return { valid: true } // 允许空值
  374. }
  375. const numValue = parseFloat(value)
  376. // 检查是否为有效数字
  377. if (isNaN(numValue)) {
  378. return { valid: false, message: '请输入有效的数字' }
  379. }
  380. // 检查范围
  381. if (this.min !== undefined && numValue < this.min) {
  382. return { valid: false, message: `值不能小于 ${this.min}` }
  383. }
  384. if (this.max !== undefined && numValue > this.max) {
  385. return { valid: false, message: `值不能大于 ${this.max}` }
  386. }
  387. return { valid: true }
  388. },
  389. validateValue(value) {
  390. if (this.type === 'switch') {
  391. return { valid: true }
  392. }
  393. // 空值检查(可选,根据需求调整)
  394. if (!value && value !== 0 && value !== false) {
  395. return { valid: true } // 允许空值
  396. }
  397. switch (this.type) {
  398. case 'ip':
  399. return this.validateIP(value)
  400. case 'url':
  401. return this.validateURL(value)
  402. case 'text':
  403. case 'textarea':
  404. case 'number':
  405. case 'select':
  406. default:
  407. return { valid: true }
  408. }
  409. },
  410. validateIP(value) {
  411. const ipRegex = /^(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}$/
  412. if (!ipRegex.test(value)) {
  413. return { valid: false, message: '请输入正确的IP地址格式' }
  414. }
  415. return { valid: true }
  416. },
  417. validateURL(value) {
  418. const urlRegex = /^(https?|wss?|mqtt|tcp):\/\/.+/i
  419. if (!urlRegex.test(value)) {
  420. return { valid: false, message: '请输入正确的URL格式(支持http/https/ws/wss/mqtt/tcp协议)' }
  421. }
  422. return { valid: true }
  423. }
  424. }
  425. }
  426. </script>
  427. <style lang="scss" scoped>
  428. .param-item {
  429. position: relative;
  430. padding: 12px 0;
  431. border-bottom: 1px solid var(--color-border-secondary);
  432. transition: all var(--duration-200) var(--ease-out);
  433. &:last-child {
  434. border-bottom: none;
  435. }
  436. &.disabled {
  437. opacity: 0.6;
  438. cursor: not-allowed;
  439. }
  440. &.error {
  441. .read-mode,
  442. .edit-mode {
  443. border-radius: var(--radius-base);
  444. border: 1px solid rgba(245, 108, 108, 0.3);
  445. padding: 8px;
  446. margin: -8px;
  447. }
  448. }
  449. .read-mode,
  450. .edit-mode {
  451. display: flex;
  452. align-items: flex-start;
  453. gap: var(--spacing-4);
  454. min-height: 36px;
  455. }
  456. .param-label {
  457. flex: 0 0 180px;
  458. color: var(--color-text-primary);
  459. font-weight: var(--font-weight-medium);
  460. font-size: var(--font-size-sm);
  461. line-height: 36px;
  462. padding-right: var(--spacing-2);
  463. white-space: nowrap;
  464. overflow: hidden;
  465. text-overflow: ellipsis;
  466. }
  467. .param-value {
  468. flex: 1;
  469. min-width: 0;
  470. line-height: 36px;
  471. .switch-value {
  472. display: flex;
  473. align-items: center;
  474. gap: var(--spacing-2);
  475. color: var(--color-text-secondary);
  476. font-size: var(--font-size-sm);
  477. i {
  478. font-size: var(--font-size-base);
  479. }
  480. }
  481. .textarea-value {
  482. color: var(--color-text-secondary);
  483. font-size: var(--font-size-sm);
  484. line-height: var(--line-height-normal);
  485. white-space: pre-wrap;
  486. word-break: break-word;
  487. }
  488. .text-value {
  489. color: var(--color-text-secondary);
  490. font-size: var(--font-size-sm);
  491. word-break: break-all;
  492. }
  493. }
  494. .param-input {
  495. flex: 1;
  496. min-width: 0;
  497. .el-input,
  498. .el-switch,
  499. .el-select {
  500. width: 100%;
  501. }
  502. .el-input {
  503. ::v-deep .el-input__inner {
  504. height: 36px;
  505. border-radius: var(--radius-base);
  506. border: 1px solid var(--color-border-primary);
  507. background: var(--color-bg-card);
  508. transition: all var(--duration-200) var(--ease-out);
  509. &:focus {
  510. border-color: var(--color-primary);
  511. box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.15);
  512. }
  513. }
  514. &.is-disabled {
  515. ::v-deep .el-input__inner {
  516. background: var(--color-bg-secondary);
  517. color: var(--color-text-quaternary);
  518. }
  519. }
  520. }
  521. .el-switch {
  522. ::v-deep .el-switch__core {
  523. border-radius: var(--radius-full);
  524. }
  525. }
  526. .el-select {
  527. ::v-deep .el-input__inner {
  528. height: 36px;
  529. border-radius: var(--radius-base);
  530. border: 1px solid var(--color-border-primary);
  531. background: var(--color-bg-card);
  532. transition: all var(--duration-200) var(--ease-out);
  533. &:focus {
  534. border-color: var(--color-primary);
  535. box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.15);
  536. }
  537. }
  538. }
  539. ::v-deep .el-textarea {
  540. .el-textarea__inner {
  541. border-radius: var(--radius-base);
  542. border: 1px solid var(--color-border-primary);
  543. background: var(--color-bg-card);
  544. resize: vertical;
  545. min-height: 72px;
  546. transition: all var(--duration-200) var(--ease-out);
  547. &:focus {
  548. border-color: var(--color-primary);
  549. box-shadow: 0 0 0 2px rgba(64, 158, 255, 0.15);
  550. }
  551. }
  552. }
  553. }
  554. .param-actions {
  555. flex: 0 0 auto;
  556. display: flex;
  557. align-items: center;
  558. gap: var(--spacing-2);
  559. height: 36px;
  560. .el-button {
  561. height: 28px;
  562. padding: 0 var(--spacing-3);
  563. border-radius: var(--radius-base);
  564. font-size: var(--font-size-xs);
  565. &.el-button--text {
  566. color: var(--color-text-tertiary);
  567. &:hover {
  568. color: var(--color-primary);
  569. background: rgba(64, 158, 255, 0.08);
  570. }
  571. }
  572. &.el-button--primary {
  573. background: var(--color-primary);
  574. border-color: var(--color-primary);
  575. &:hover {
  576. background: var(--color-primary-light);
  577. border-color: var(--color-primary-light);
  578. }
  579. }
  580. }
  581. }
  582. .error-message {
  583. color: var(--color-danger);
  584. font-size: var(--font-size-xs);
  585. line-height: var(--line-height-normal);
  586. margin-top: var(--spacing-2);
  587. margin-left: 184px;
  588. opacity: 0.8;
  589. }
  590. .save-success-icon {
  591. position: absolute;
  592. top: 8px;
  593. right: 8px;
  594. width: 24px;
  595. height: 24px;
  596. background: var(--color-success);
  597. color: white;
  598. border-radius: 50%;
  599. display: flex;
  600. align-items: center;
  601. justify-content: center;
  602. z-index: 10;
  603. box-shadow: var(--shadow-sm);
  604. i {
  605. font-size: var(--font-size-sm);
  606. font-weight: bold;
  607. }
  608. }
  609. // 保存成功动画
  610. .save-success-enter-active,
  611. .save-success-leave-active {
  612. transition: all 0.3s ease;
  613. }
  614. .save-success-enter,
  615. .save-success-leave-to {
  616. opacity: 0;
  617. transform: scale(0.8) translateY(-4px);
  618. }
  619. // 复制按钮样式
  620. .copy-btn {
  621. margin-right: var(--spacing-1);
  622. &:hover {
  623. color: var(--color-primary) !important;
  624. }
  625. }
  626. // 搜索高亮样式
  627. ::v-deep .search-highlight {
  628. background: rgba(64, 158, 255, 0.15);
  629. border-radius: 3px;
  630. padding: 0 2px;
  631. color: var(--color-primary);
  632. font-weight: var(--font-weight-medium);
  633. }
  634. // 等宽字体样式
  635. .monospace,
  636. .monospace-input {
  637. font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  638. }
  639. // 文本域容器
  640. .textarea-container {
  641. position: relative;
  642. .example-btn {
  643. position: absolute;
  644. top: 8px;
  645. right: 8px;
  646. z-index: 2;
  647. opacity: 0.7;
  648. &:hover {
  649. opacity: 1;
  650. color: var(--color-primary);
  651. }
  652. }
  653. }
  654. // 过滤规则示例
  655. .filter-examples {
  656. .example-item {
  657. margin-bottom: var(--spacing-3);
  658. &:last-child {
  659. margin-bottom: 0;
  660. }
  661. code {
  662. display: block;
  663. background: var(--color-bg-secondary);
  664. padding: var(--spacing-1) var(--spacing-2);
  665. border-radius: var(--radius-base);
  666. font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  667. font-size: var(--font-size-xs);
  668. color: var(--color-text-primary);
  669. margin-bottom: var(--spacing-1);
  670. }
  671. .example-desc {
  672. font-size: var(--font-size-xs);
  673. color: var(--color-text-secondary);
  674. }
  675. }
  676. }
  677. }
  678. // 暗色主题适配
  679. html.dark {
  680. .param-item {
  681. .param-input {
  682. .el-input {
  683. ::v-deep .el-input__inner {
  684. background: var(--color-bg-tertiary);
  685. border-color: var(--color-border-tertiary);
  686. color: var(--color-text-primary);
  687. }
  688. }
  689. .el-select {
  690. ::v-deep .el-input__inner {
  691. background: var(--color-bg-tertiary);
  692. border-color: var(--color-border-tertiary);
  693. color: var(--color-text-primary);
  694. }
  695. }
  696. ::v-deep .el-textarea {
  697. .el-textarea__inner {
  698. background: var(--color-bg-tertiary);
  699. border-color: var(--color-border-tertiary);
  700. color: var(--color-text-primary);
  701. }
  702. }
  703. }
  704. .filter-examples {
  705. .example-item {
  706. code {
  707. background: var(--color-bg-quaternary);
  708. color: var(--color-text-primary);
  709. }
  710. }
  711. }
  712. ::v-deep .search-highlight {
  713. background: rgba(64, 158, 255, 0.25);
  714. }
  715. }
  716. }
  717. // 大屏优化
  718. @media (min-width: 1280px) {
  719. .param-item {
  720. .param-label {
  721. flex: 0 0 220px; // 大屏下给更多空间
  722. }
  723. .error-message {
  724. margin-left: 224px;
  725. }
  726. }
  727. }
  728. // 移动端适配
  729. @media (max-width: 768px) {
  730. .param-item {
  731. .read-mode,
  732. .edit-mode {
  733. flex-direction: column;
  734. gap: var(--spacing-2);
  735. }
  736. .param-label {
  737. flex: none;
  738. line-height: var(--line-height-normal);
  739. }
  740. .param-value {
  741. line-height: var(--line-height-normal);
  742. }
  743. .param-actions {
  744. justify-content: flex-end;
  745. height: auto;
  746. }
  747. .error-message {
  748. margin-left: 0;
  749. }
  750. }
  751. }
  752. </style>