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
| <template>
| <div class="prepare-manage-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>
| <span slot="materialTyleSlot" slot-scope="text">{{ 'material_type' | dictType(text) }}</span>
| </s-table>
| </div>
| </template>
|
| <script>
| import { STable } from '@/components'
| import { CncTakeMaterialsDetailPage } from '@/api/modular/main/prePareManage'
| const pagination = {PageNo:1,PageSize:5}
| export default {
| name:'prepareManageInfoBlock',
| 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: '物料类型', dataIndex: 'materialType', width: 120, scopedSlots: { customRender: 'materialTyleSlot' }},
| { title: '物料编码', dataIndex: 'materialNo', key: 'materialNo' },
| { title: '物料名称', dataIndex: 'materialName', key: 'materialName' },
| { title: '批次', dataIndex: 'materialBatch', key: 'materialBatch', width: 180 },
| { title: '需求数量', dataIndex: 'orderQuantity', key: 'orderQuantity', width: 100},
| { title: '已备数量', dataIndex: 'actualQuantity', key: 'actualQuantity', width: 100},
| { title: '需求日期', dataIndex: 'requireTime', key: 'requireTime', width: 170}
| ],
| 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 CncTakeMaterialsDetailPage(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>
| .prepare-manage-info-block{
| padding-top: 8px;
| }
| </style>
|
|