Analysis.vue 6.48 KB
<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="add">
        <a-row :gutter="24">
          <a-col :xl="24" :sm="24">
            <a-form-item>
              <a-input :placeholder="$t('scanin.scanCodeText')" v-model="queryParam.context" ref="input" @blur="focus" style="height: 60px;font-size: x-large;" ></a-input>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->
    <div style=" margin: 22px 0px 0px;display: flex; width: 80%;font-size: 30px;">
      <div style="flex: 1;">{{$t('pallet.containerCode')}}: {{this.containerCode}}</div>
      <div style="flex: 1;">{{$t('pallet.orderNumber')}}: {{this.orderNumber}}</div>
      <div style="flex: 1;">{{$t('pallet.actual')}}: {{this.successNumber}}/{{this.orderNumber}}</div>
      <div style="flex: 1;">{{$t('pallet.availablePallets')}}: {{this.availablePallets}}</div>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{ x: false }"
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="false"
        class="j-table-force-nowrap" style="padding: 28px 0 0 0;"
        @change="handleTableChange"
      >
      <span slot="isstack_dictText" slot-scope="isstack_dictText">
        <a-tag :key="isstack_dictText" :color="getStatusColor(isstack_dictText)">
          {{ isstack_dictText }}
        </a-tag>
      </span>
      </a-table>
    </div>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import { httpGroupRequest } from '@/api/GroupRequest.js'
import { getAction, postAction } from '@/api/manage'

export default {
  name: 'ScaninRecordList',
  mixins: [JeecgListMixin, mixinDevice],
  props: ['groupId'],
  components: {},
  data() {
    let ellipsis1 = (v, l = 40) => <j-ellipsis value={v} length={l} />
    return {
      description: '托盘任务表管理页面',
      disableMixinCreated: true,
      containerCode: undefined,
      availablePallets: 0,
      orderNumber: 0,
      successNumber: 0,
      // 表头
      columns: [
        {
          title: this.$t('pallet.detailId'),
          align: 'center',
          dataIndex: 'id'
        },
        {
          title: this.$t('pallet.lecangsCode'),
          align: 'center',
          dataIndex: 'code'
        },
        {
          title: this.$t('pallet.barcode'),
          align: 'center',
          dataIndex: 'barcodes'
        },
        // {
        //   title: this.$t('pallet.outboundOrderCode'),
        //   align: 'center',
        //   dataIndex: 'outboundordercode'
        // },
        {
          title: this.$t('pallet.waybillcode'),
          align: 'center',
          dataIndex: 'waybillcode'
        },
        // {
        //   title: this.$t('pallet.batch'),
        //   align: 'center',
        //   dataIndex: 'batch'
        // },
        {
          title: this.$t('pallet.packPlanNum'),
          align: 'center',
          dataIndex: 'packplannum'
        },
        {
          title: this.$t('pallet.stackStatus'),
          align: 'center',
          dataIndex: 'isstack_dictText',
          scopedSlots: {customRender: 'isstack_dictText'}
        }
      ],
      isorter: {
        column: 'id',
        order: 'asc'
      },
      url: {
        list: '/task/palletTask/listPalletBillByMainId',
        main: '/task/palletTask/mainPalletBill',
        add: '/scan/scaninRecord/add'
      },
      dictOptions: {}
    }
  },
  mounted() {
    // 每隔3秒定时刷新
    this.timer = setInterval(() => {
      this.loadPeriodData(this.containerCode)
    }, 2000)
  },
  created() {
    this.$nextTick(() => this.$refs.input.focus())
    this.getSuperFieldList()
  },
  computed: {
    importExcelUrl: function() {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    }
  },
  methods: {
    getStatusColor(status) {
      const colors = {
        'No': 'red',
        'Yes': 'green',
        default: 'default'
      };
      return colors[status] || colors.default;
    },
    focus() {
      this.$nextTick(() => this.$refs.input.focus())
    },
    add() {
      let params = Object.assign({}, this.queryParam, this.isorter)
      let url = `${this.url.add}`
      //缓存key
      let groupIdKey
      if (this.groupId) {
        groupIdKey = this.groupId + url
      }
      httpGroupRequest(() => postAction(url, params), groupIdKey).then(res => {
        if (res.success) {
          if (res.message != '') {
            this.$notification.success({
              message: this.$t('system.systemMessage'),
              description: this.queryParam.context + ' ' + this.$t('scanin.scanSuccessful')
            })
          }
          this.containerCode = this.queryParam.context;
        } else {
          this.$notification.error({
            message: this.$t('system.systemMessage'),
            description: res.message
          })
        }
        this.queryParam.context = ''
      })
    },
    initDictConfig() {},
    getSuperFieldList() {
      let fieldList = []
      fieldList.push({ type: 'string', value: 'context', text: 'context', dictCode: '' })
      fieldList.push({ type: 'string', value: 'status', text: 'status', dictCode: '' })
      this.superFieldList = fieldList
    },
    async loadPeriodData(containercode) {
      let params = {
        containercode: containercode
      }
      if (params.containercode == undefined) {
        params.containercode = '0'
      }
      // console.info(params.containerCode)
      let url = `${this.url.list}`
      //缓存key
      let groupIdKey
      if (this.groupId) {
        groupIdKey = this.groupId + url
      }
      httpGroupRequest(() => getAction(url, params), groupIdKey).then(res => {
        let data = res.result.records
        if (data != null && data.length > 0) {
          this.dataSource = data
        } else {
          this.dataSource = []
          this.containerCode = undefined
        }
      })
      httpGroupRequest(() => getAction(`${this.url.main}`, params), groupIdKey).then(res => {
        let data = res.result
        if (data != null) {
          this.availablePallets = data.availablePallets;
          this.orderNumber = data.orderNumber;
          this.successNumber = data.successNumber;
        }
      })
    }
  }
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>