MrShi
2025-01-17 78d03fa48defaf77c2b533dc4616a210088ab49c
admin/src/views/stock/record.vue
@@ -2,19 +2,35 @@
  <div class="main_app">
    <QueryForm v-model="filters" :query-form-config="queryFormConfig" @handleQuery="getList(1)" @clear="clear" />
    <div class="mt20">
      <el-button type="primary" @click="handleEx()" v-permissions="['business:ywpatrolline:create']">导出</el-button>
      <el-button @click="handleEx()" v-permissions="['business:ywpatrolline:create']">导出</el-button>
    </div>
    <el-table v-loading="loading" :data="list" stripe>
      <el-table-column prop="platformName" label="单据日期" min-width="100" show-overflow-tooltip />
      <el-table-column prop="platformName" label="资产编码" min-width="100" show-overflow-tooltip />
      <el-table-column prop="platformGroupName" label="资产名称" min-width="100" show-overflow-tooltip />
      <el-table-column prop="carCodeFront" label="资产分类" min-width="100" show-overflow-tooltip />
      <el-table-column prop="carCodeBack" label="数量" min-width="80" show-overflow-tooltip />
      <el-table-column prop="param1" label="类型" min-width="80" show-overflow-tooltip />
      <el-table-column prop="workTime" label="仓库" min-width="90" show-overflow-tooltip />
      <el-table-column prop="workTime" label="单据编号" min-width="120" show-overflow-tooltip />
      <el-table-column prop="workTime" label="创建人" min-width="80" show-overflow-tooltip />
      <el-table-column prop="workTime" label="创建时间" min-width="140" show-overflow-tooltip />
      <el-table-column prop="doneDate" label="单据日期" min-width="90" show-overflow-tooltip />
      <el-table-column prop="materialCode" label="物料编码" min-width="90" show-overflow-tooltip />
      <el-table-column prop="materialName" label="物料名称" min-width="90" show-overflow-tooltip />
      <el-table-column prop="carCodeFront" label="物料分类" min-width="120" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span>{{ row.categoryParentName }}/{{ row.categoryName }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="carCodeBack" label="数量" min-width="80" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span>{{ row.stock }}{{ row.materialUnitName }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="param1" label="类型" min-width="70" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span v-if="row.type || row.type == 0">{{ StoreTypeOps[row.type] }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="warehouseName" label="仓库" min-width="90" show-overflow-tooltip />
      <el-table-column prop="code" label="单据编号" min-width="120" show-overflow-tooltip>
        <template v-slot="{ row }">
          <span class="primaryColor">{{ row.code }}</span>
        </template>
      </el-table-column>
      <el-table-column prop="createUserName" label="创建人" min-width="80" show-overflow-tooltip />
      <el-table-column prop="createDate" label="创建时间" min-width="140" show-overflow-tooltip />
    </el-table>
    <div class="mt20">
      <Pagination @size-change="handleSizeChange" @current-change="getList" :pagination="pagination" />
@@ -28,7 +44,9 @@
import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
dayjs.extend(duration)
import { platformLogPage, getPlatformGroupList } from '@/api'
import { ywOutinboundRecord, ywOutinboundRecordEx } from '@/api'
import { fetchList as getStoreList } from '@/api/ywWarehouse'
import { StoreTypeOps } from './components/config'
export default {
  components: {
    Pagination,
@@ -45,29 +63,34 @@
      filters: {},
      list: [],
      total: 0,
      StoreTypeOps,
      queryFormConfig: {
        formItems: [
          {
            filed: 'carCodeFront',
            filed: 'materialCode',
            type: 'input',
            label: '资产编码',
            label: '物料编码',
          },
          {
            filed: 'platformGroupId',
            filed: 'warehouseId',
            type: 'select',
            labelCode: 'name',
            valueCode: 'id',
            label: '所在仓库',
            options: []
          },
          {
            filed: 'carCodeFront',
            filed: 'code',
            type: 'input',
            label: '单据编号',
          },
          {
            filed: 'platformGroupId',
            filed: 'type',
            type: 'select',
            label: '单据类型',
            options: []
            labelCode: 'name',
            valueCode: 'id',
            options: StoreTypeOps
          },
          {
            filed: 'selDate',
@@ -76,7 +99,7 @@
          },
          {
            filed: 'selTime',
            type: 'daterange',
            type: 'datetimerange',
            label: '创建时间',
          },
        ],
@@ -85,8 +108,8 @@
    }
  },
  created() {
    // this.getList()
    // this.getGroupList()
    this.getList()
    this.initData()
  },
  methods: {
    handleSub() {
@@ -96,39 +119,58 @@
        }
      })
    },
    handleEx() { },
    getGroupList() {
      getPlatformGroupList({ queryData: 0, queryType: 0 }).then(res => {
        this.queryFormConfig.formItems[1].options = res.map(i => {
          return {
            value: i.id,
            label: i.name
          }
    handleEx() {
      this.$dialog.exportConfirm('确认导出吗?')
        .then(() => {
          this.loading = true
          ywOutinboundRecordEx({
            page: this.pagination.page,
            capacity: 1000000,
            model: this.filters
          })
            .then(response => {
              this.download(response)
            })
            .catch(e => {
              this.$tip.apiFailed(e)
            })
            .finally(() => {
              this.loading = false
            })
        })
        // this.queryFormConfig.formItems[1].options.unshift({ value: '', label: '全部月台组' })
        .catch(() => { })
    },
    initData() {
      getStoreList({ capacity: 9999, page: 1, model: {} }).then(res => {
        this.queryFormConfig.formItems[1].options = res.records || []
      })
    },
    getList(page) {
      const { pagination, filters } = this
      this.loading = true
      platformLogPage({
      if (filters.selDate && filters.selDate.length > 0) {
        filters.doneDateStart = filters.selDate[0]
        filters.doneDateEnd = filters.selDate[1]
      } else {
        filters.doneDateStart = null
        filters.doneDateEnd = null
      }
      if (filters.selTime && filters.selTime.length > 0) {
        filters.createDateStart = filters.selTime[0]
        filters.createDateEnd = filters.selTime[1]
      } else {
        filters.createDateStart = null
        filters.createDateEnd = null
      }
      ywOutinboundRecord({
        model: {
          ...filters,
          queryStatus: '6,7,8',
          beginWorkDateStart: filters.selDate && filters.selDate.length > 0 ? filters.selDate[0] : null,
          beginWorkDateEnd: filters.selDate && filters.selDate.length > 0 ? filters.selDate[1] : null,
          ...filters
        },
        sorts: [{ direction: 'DESC', property: 'param1' }],
        capacity: pagination.pageSize,
        page: page || pagination.page,
      }).then(res => {
        this.loading = false
        this.list = res.records || []
        this.list.forEach(item => {
          item.inTypeTemp = item.inType == 0 ? '整托盘' : '件烟'
          item.taskOrigin = 'WMS获取'
          item.workTime = dayjs.duration(item.param3, 'seconds').format('H时m分s秒')
        })
        this.pagination.total = res.total || 0
      }, () => {
        this.loading = false