liuying
2024-05-09 f4078b75fe80f03e58af3217bf642d0de118d1c9
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
  <div class="issue-notes-info-block">
    <s-table
      ref="table"
      :columns="columns"
      :data="loadData"
      :alert="true"
      rowKey="tableRowKey"
      :pageSize="queried.PageSize"
      :pageSizeOptions="['5','10','20','30']"
      :rowSelection="null">
      <template class="table-operator" slot="operator" >
        <span style="font-weight:bold;cursor:default;"><a style="cursor:default;">{{orderNo}}</a>单据详情</span>
      </template>
      <template slot="index" slot-scope="text,record,index">{{(queried.PageNo-1)*queried.PageSize+(index+1)}}</template>
      <template slot="specSlots" slot-scope="text,record">
        {{`${record.long}*${record.wide}*${record.high}`}}
      </template>
      <template slot="statusSlots" slot-scope="text,record">
        <a-tag :color="text==='完成'?'#008000':(
          text==='执行中'?'#1e90ff':(
            text==='取消'?'#556b2f':(
              text==='暂停'?'#8b0000':(
                text==='撤回'?'#ff00ff':'gray'
              )
            )
          )
        )">{{text}}</a-tag>
      </template>
    </s-table>
  </div>
</template>
 
<script>
import { STable } from '@/components'
import { FoamingChuKuOrderDetailPage } from '@/api/modular/main/FoamingChuKuOrderManage'
const pagination = {PageNo:1,PageSize:5}
export default {
  name:'issueNotesInfoBlock',
  components:{STable},
  props:{
    queryId:{
      type:[Number,null],
      default:null
    },
    orderNo:{
      type:String,
      default:''
    }
  },
  data(){
    return {
      columns:[
        { title: '序号', key: 'index', width: 70, align:'center', fixed:"left", scopedSlots: { customRender: 'index' }},
        { title: '物料编号', align:'center', dataIndex: 'materialNo', key: 'materialNo' },
        { title: '批次', align:'center', dataIndex: 'batch', key: 'batch' },
        { title: '密度', align:'center', dataIndex: 'materialDensity', key: 'materialDensity', width: 100 },
        { title: '尺寸', align:'center', dataIndex: 'spec', scopedSlots: { customRender: 'specSlots' }, width: 150 },
        { title: '巷道', align:'center', dataIndex: 'aisle', key: 'aisle', width: 70 },
        {
          title: '入库时间',
          align: 'center',
          dataIndex: 'createdTime'
        },
        { title: '任务状态', align:'center', dataIndex: 'taskStatusName', scopedSlots: { customRender: 'statusSlots' }, width: 150 }
      ],
      queried:{...pagination},
      refreshKey:true,
    }
  },
  watch:{
    queryId(newV,oldV){
      if (newV!==oldV){
        this.initData()
      }
    }
  },
  methods:{
    initData(){
      this.refreshKey = true
      this.$refs.table.refresh()
    },
    loadData(parameter){
      parameter.OrderId = this.queryId
      if (this.queryId) {
        if (this.refreshKey) {
          parameter.pageNo = pagination.PageNo
          parameter.pageSize = pagination.PageSize
        } 
        this.refreshKey = false
        this.queried.PageNo = parameter.pageNo 
        this.queried.PageSize = parameter.pageSize 
        return FoamingChuKuOrderDetailPage(parameter).then((res) => {
          if (res.data.rows) {
            res.data.rows = res.data.rows.map((item,index)=>{
              item.tableRowKey = index
              return item
            })
          }
          return res.data
        })
      } else {
        return new Promise((resolve,reject)=>{
          resolve({
            pageNo:pagination.PageNo,
            pageSize:pagination.PageSize,
            rows:[],
            totalPage:0,
            totalRows:0
          })
        })
      } 
    }
  }
}
</script>
 
<style lang="less" scoped>
.issue-notes-info-block{
  padding-top: 8px;
}
</style>