<template>
  <div>
    <a @click="routerTo">
      <span
        v-for="(item,i) in valueData"
        v-show="item.iesstorename"
        :key="i"
      >{{ item.iesstorename }}({{ item.otherqtyfee }})<i v-if="i+1 !== valueData.length"> , </i></span>
      
    </a>
  </div>
</template>

<script>
  export default {
    props: {
      params: {        
        type: Object,         
        default: () => ({})   
      }, 
    },
    computed: {
      valueData() {
        try {
          return JSON.parse(this.params.value || '[]');
        } catch (error) {
          return [];
        }
      }
    },
    data() {
      return {
        url: '',
      };
    },
    methods: {
      // getSessionObject(key) {
      //   let data = window.R3.getSessionObject('routeMapRecordForHideBackButton');
      //   data[key] = this.$route.path;
      //   window.sessionStorage.setItem('routeMapRecordForHideBackButton', JSON.stringify(data));
      // },
      routerTo() {
        // this.getSessionObject(url);
        let refobjid = [];
        let defaultValue = this.valueData.reduce((arr, item)=>{
          arr.push(item.iesstorename);
          refobjid.push(item.iesstoreid);
          return arr;
        }, []);
        // 跳转库存查询
        this.$store.commit('global/tabOpen', {
          type: 'S',
          tableName: 'V_IES_STOCK',
          tableId: '10610',
          isSetQuery: true,
          isRefresh: true,
          queryData: {
            values: [
              { // sku 
                display: 'text',
                colid: '191522',
                defaultValue: this.params.data.IESSKUID && this.params.data.IESSKUID.val
              },
              { // 所属逻辑仓
                colid: '191521',
                display: 'OBJ_FK',
                defaultValue: defaultValue.join(','),
                refobjid: refobjid.join(',')
              }
            ]
          }        
        });
      }

    },
    mounted() {
      // this.params.value = '[{"iesstorename":"mhy的逻辑","iesstoreid":41,"otherqtyfee":5},{"iesstorename":"ZQ逻辑仓A02-80","iesstoreid":244,"otherqtyfee":7}]';
      // this.valueData = JSON.parse('[{"iesstorename":"mhy的逻辑","iesstoreid":41,"otherqtyfee":5},{"iesstorename":"ZQ逻辑仓A02-80","iesstoreid":244,"otherqtyfee":7}]');
    }

  };
</script>

<style lang="less" scoped>
 a{
  text-decoration: underline;

 }
</style>
