<template>
  <CommonStack title="商品列表" :query="Object.assign({}, query, {  })">
    <template v-slot:default="{ stackQuery }">
      <CommonFilter
        ref="filter"
        action="getProductList"
        :actionOption="query[name]"
        :fixedValues="{  }" />
      <CommonWrapper name="product-detail">
        <CommonDetail
          name="product-detail"
          :query="stackQuery"
          resetAction="getProduct"
          submitAction="editProduct"
          :components="{ pattern, attribute, parameter, receive, tag, editor }"
          @on-save="save" />
        </CommonDetail>
      </CommonWrapper>
    </template>
  </CommonStack>
</template>

<script>
import pattern from './pattern'
import attribute from './attribute'
import parameter from './parameter'
import receive from './receive'
import tag from './tag'
import editor from '@/components/common/editor/detail'

export default {
  name: 'comment',
  props: {
    query: {
      type: Object,
      required: false,
      default () {
        return {}
      },
    },
    name: {
      type: String,
      required: false,
      default: 'trash',
    },
  },
  data () {
    return {
      pattern,
      attribute,
      parameter,
      receive,
      tag,
      editor,
    }
  },
  methods: {
    save () {
      this.$stack.go()
      this.$refs.filter.request()
    },
  },
}
</script>
