MatchField.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div>
  3. <a-form-item :label="$t('network_waf_statement.label.match_field')" v-bind="formLayout">
  4. <a-select v-if="isEdit" v-model="value">
  5. <a-select-option v-for="item in matchFieldOptions" :value="item.value" :key="item.value">
  6. {{item.label}}
  7. </a-select-option>
  8. </a-select>
  9. <box-show v-else :value="showValue" />
  10. </a-form-item>
  11. </div>
  12. </template>
  13. <script>
  14. import WafMixin from '../../mixins/waf'
  15. import BoxShow from './BoxShow'
  16. import WindowsMixin from '@/mixins/windows'
  17. export default {
  18. name: 'MatchFieldStatement',
  19. components: {
  20. BoxShow,
  21. },
  22. mixins: [WindowsMixin, WafMixin],
  23. props: {
  24. isEdit: Boolean,
  25. type: String,
  26. value: String,
  27. },
  28. data () {
  29. return {
  30. formLayout: {
  31. wrapperCol: {
  32. span: 20,
  33. },
  34. labelCol: {
  35. span: 4,
  36. },
  37. },
  38. }
  39. },
  40. computed: {
  41. matchFieldOptions () {
  42. // 根据不同type返回
  43. return [
  44. { label: 'RequestBody', value: 'Body' },
  45. { label: 'JsonBody', value: 'JsonBody' },
  46. { label: 'QueryString', value: 'Query' },
  47. { label: 'RequestMethod', value: 'Method' },
  48. { label: 'RequestHeaders', value: 'Header' },
  49. { label: 'URI path', value: 'UriPath' },
  50. { label: 'PostArgs', value: 'PostArgs' },
  51. { label: 'RequestCookies', value: 'Cookie' },
  52. { label: 'RemoteAddr', value: 'RemoteAddr' },
  53. ]
  54. },
  55. showValue () {
  56. const matchField = this.matchFieldOptions.filter(item => item.value === this.value)
  57. if (matchField.length) {
  58. return matchField[0].label
  59. } else {
  60. return this.value
  61. }
  62. },
  63. },
  64. watch: {
  65. },
  66. created () {
  67. },
  68. methods: {
  69. },
  70. }
  71. </script>