index.vue 2.38 KB
Newer Older
wangdanlei's avatar
wangdanlei committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
<template>
  <div class="dxStInventoryAFD-com" style="height: calc(100% - 40px);">
    <div v-if="typeName && basicData" class="sub-title">{{ basicData.name }}<span>({{ status }})</span></div>
    <dee-as-com
      v-if="typeName && basicData"
      :key="basicData.id"
      ref="detailCom"
      :lay-config="{
        typeName: typeName,
        layKey: 'defaultResult'
      }"
      :basic-data="basicData"
      @tb-viewDetail="tbViewDetail"
    />
  </div>
</template>

<script>
export default {
  name: 'DxStInventoryAFD',
  componentName: '库存盘点明细',
  components: {},
  props: {
  },
  data() {
    // 这里存放数据
    return {
      evenList: [
        {
          even: 'tb-viewDetail',
          name: '查看盘点明细'
        }
      ],
      emitMethods: [
        {
          methods: 'initData',
          methodsName: '渲染列表'
        }
      ],
      basicData: null,
      typeName: [],
      objStatusObj: {},
      status: ''
    }
  },
  // 监听属性 类似于data概念
  computed: {},
  // 监控data中的数据变化
  watch: {},
  // 生命周期 - 创建完成(可以访问当前this实例)
  created() {
    this.getObjStatusData()
    this.$bus.$on('refreshDxStInventoryStatus', (data) => {
      this.refreshStatus()
    })
  },
  // 生命周期 - 挂载完成(可以访问DOM元素)
  mounted() {
  },
  activated() {
  },
  // 方法集合
  methods: {
    async getObjStatusData() {
      const arr = this.$store.state.dictionaries && this.$store.state.dictionaries.ObjStatus ? this.$store.state.dictionaries.ObjStatus.default : await this.$utils.getDicListByCode('ObjStatus')
      arr.forEach(x => {
        this.$set(this.objStatusObj, x.value, x.label)
      })
    },
    tbViewDetail() {
      this.$emit('tb-viewDetail', this.basicData)
    },
    initData(val) {
      this.basicData = val
      this.typeName = val.infoType === '1' ? 'DxStInventoryHouseAFD' : 'DxStInventoryResAFD'
      this.refreshStatus()
    },
    refreshStatus() {
      const params = {
        'searchItems': {
          'items': [{
            'fieldName': 'id',
            'operator': 'EQ',
            'value': this.basicData.id
          }],
          'operator': 'AND'
        }}
      this.$api.searchApi('DxStInventoryAF', params).then(res => {
        this.status = this.objStatusObj[res.items.content[0].state]
      })
    }
  }
}
</script>
<style lang='scss'>

</style>