bug
liuying
2024-04-25 ae4e29f352975c2197521cf3c0b7179868d8cb84
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<template>
  <div class="entry-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>
      <template slot="action" slot-scope="text,record">
        <a @click="onOpenEntrance(record.id)">入库</a>
        <a style="margin-left:10px;" :class="[record.isCancel!==1?'disabled':'']" @click="onCancel(record)">取消</a>
      </template>
    </s-table>
    
    <entrance-select-modal :visible.sync="entranceVisible" :preferredPortList="preferredPortList" :did="entraceId" @callback="actionBack" />
  </div>
</template>
 
<script>
import { STable } from '@/components'
import { FoamingRuKuOrderDetailPage, FoamingRuKuDetailCancel } from '@/api/modular/main/FoamingRuKuOrderManage'
import entranceSelectModal from './entranceSelectModal.vue'
const pagination = {PageNo:1,PageSize:5}
export default {
  name:'entryNotesInfoBlock',
  components:{STable,entranceSelectModal},
  props:{
    queryId:{
      type:[Number,null],
      default:null
    },
    orderNo:{
      type:String,
      default:''
    },
    preferredPortList:{
      type:Array,
      default:function(){
        return []
      }
    }
  },
  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: 80 },
        { title: '尺寸', align:'center', dataIndex: 'spec', scopedSlots: { customRender: 'specSlots' }, width: 150 },
        { title: '入库口', align:'center', dataIndex: 'preferredPort', key: 'preferredPort' },
        { title: '任务状态', align:'center', dataIndex: 'taskStatusName', scopedSlots: { customRender: 'statusSlots' }, width: 150 }
      ],
      queried:{...pagination},
      refreshKey:true,
      entranceVisible:false,
      entraceId:null
    }
  },
  created(){
    if (this.hasPerm('fp_rk_action')) {
      this.columns.push({ title: '操作', align: 'center', dataIndex: 'action', scopedSlots: { customRender: 'action' }, width: 105 })
    }
  },
  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 FoamingRuKuOrderDetailPage(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
          })
        })
      } 
    },
    onOpenEntrance(id){
      this.entraceId = id
      this.entranceVisible = true
    },
    actionBack(){
      this.$refs.table.refresh()
    },
    onCancel(obj){
      if (obj.isCancel!==1) return false
      this.dealCancel(obj.id)
    },
    dealCancel(id){
      this.$confirm({
        title: '确定要进行取消操作吗?',
        okText: '确定',
        okType: 'danger',
        cancelText: '取消',
        onOk:()=>{
          this.handleCancel(id,(f)=>{
            if (f) {
              this.$refs.table.refresh()
            }
          })
        }
      });
    },
    handleCancel(id,callback){
      this.$loading.show()
      FoamingRuKuDetailCancel(id).then(()=>{
        this.$loading.hide()
        callback(true)
      }).catch(()=>{
        this.$loading.hide()
        callback(false)
      })
    }
  }
}
</script>
 
<style lang="less" scoped>
.entry-notes-info-block{
  padding-top: 8px;
}
</style>