tab.vue 1.19 KB
<template>
  <div>
    <select-comp :cb="onClick">
      <img src="~assets/floor-recommend.png" alt="" srcset="" width="100%">
    </select-comp>

    <Modal
      v-model="show"
      title="商品池资源位"
      @on-ok="onOk"
      @on-cancel="onCancel"
    >
      <tab-editor :list.sync="list"></tab-editor>
    </Modal>
  </div>
</template>

<script>
import selectComp from './select-comp';
import tabEditor from './tab-editor';
import ResourceService from '@/service/resource-service';
import util from '@/libs/util';

export default {
  name: 'tab',
  props: ['data'],
  data() {
    return {
      show: false,
      list: util.clone(this.data)
    }
  },
  mounted() {
    this.resourceService = new ResourceService();
  },
  methods: {
    onClick() {
      this.show = true;
    },
    onOk() {
      const updateVal = this.list.map((i) => {
        return {
          id: i.id,
          poolId: i.poolId
        }
      })

      this.resourceService.editGoodsPool(updateVal);
      this.$bus.$emit('updated');
    },
    onCancel() {
      this.list = util.clone(this.data)
      this.$bus.$emit('updated');
    },
  },
  components: {
    selectComp,
    tabEditor
  }
}
</script>

<style>

</style>