mixin.js 666 B

1234567891011121314151617181920212223242526272829303132
  1. export default {
  2. props: {
  3. options: {
  4. type: Object,
  5. required: true,
  6. },
  7. params: Object,
  8. formItemLayout: {
  9. type: Object,
  10. required: true,
  11. },
  12. visible: {
  13. type: Boolean,
  14. default: false,
  15. },
  16. type: String,
  17. },
  18. methods: {
  19. setDefaultName (usage) {
  20. const usageKey = this.type === 'k8s' ? 'k8s_usage' : 'usage'
  21. if (!this.form.fc.isFieldTouched(this.decorators.name[0])) {
  22. this.form.fc.setFieldsValue({
  23. [this.decorators.name[0]]: this.$t(usageKey)[usage],
  24. })
  25. }
  26. this.currentUsageKey = usage
  27. },
  28. cancel () {
  29. this.$emit('cancel')
  30. },
  31. },
  32. }