WafRuleEdit.vue 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <template>
  2. <base-dialog :width="1000" @cancel="cancelDialog">
  3. <div slot="header">{{$t('network.waf.rule_expression_edit')}}</div>
  4. <div slot="body">
  5. <a-textarea :rows="10" v-model="expression" />
  6. </div>
  7. <div slot="footer">
  8. <a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
  9. <a-button @click="cancelDialog">{{ $t('network.text_33') }}</a-button>
  10. </div>
  11. </base-dialog>
  12. </template>
  13. <script>
  14. import DialogMixin from '@/mixins/dialog'
  15. import WindowsMixin from '@/mixins/windows'
  16. import { decodeRuleExpression } from '../utils'
  17. export default {
  18. name: 'WafRuleEditDialog',
  19. components: {
  20. },
  21. mixins: [DialogMixin, WindowsMixin],
  22. props: {
  23. parmas: Object,
  24. },
  25. data () {
  26. return {
  27. loading: false,
  28. expression: this.params.expression,
  29. }
  30. },
  31. computed: {
  32. },
  33. created () {
  34. },
  35. methods: {
  36. handleConfirm () {
  37. const rules = decodeRuleExpression(this.expression)
  38. if (rules.length) {
  39. this.params.success(rules)
  40. this.cancelDialog()
  41. } else {
  42. this.$message.error(this.$t('network.waf.rule_expression_error'))
  43. }
  44. },
  45. },
  46. }
  47. </script>