<template>
  <div>
    <CommonFilter
      ref="filter"
      action="getAttributeList"
      :fixedValues="query['attribute-list']" />
    <CommonWrapper name="attribute-detail">
      <CommonDetail
        name="attribute-detail"
        :query="query"
        resetAction="getAttributeDetail"
        submitAction="editAttributeDetail"
        @on-save="onDetailSave">
      </CommonDetail>
    </CommonWrapper>
  </div>
</template>

<script>
export default {
  name: 'attribute-list',
  props: {
    query: {
      type: Object,
      required: false,
      default () {
        return {}
      },
    },
  },
  methods: {
    init () {
      this.$refs.filter.request()
    },
    onDetailSave () {
      this.$emit('on-save')
      this.$stack.go()
      this.init()
    },
  },
}
</script>
