<template>
|
<div class="ex-warehouse1-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="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="onDistribute(record)">下发</a>
|
</template>
|
</s-table>
|
</div>
|
</template>
|
|
<script>
|
import { STable } from '@/components'
|
import { CncTakeMaterialsDetailPage,DetailDistribute } from '@/api/modular/main/ExWarehouseManage1'
|
const pagination = {PageNo:1,PageSize:5}
|
export default {
|
name:'exWarehouse1InfoBlock',
|
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: 'drawingNo', key: 'drawingNo' },
|
{ title: '入库时间', align: 'center', dataIndex: 'createdTime', width: 170},
|
{ title: '任务状态', align:'center', dataIndex: 'taskStatusName', scopedSlots: { customRender: 'statusSlots' }, width: 150 },
|
{ title: '操作', width: '80px', align: 'center', dataIndex: 'action', scopedSlots: { customRender: 'action' } }
|
],
|
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
|
})
|
})
|
}
|
},
|
onDistribute(obj){
|
this.$confirm({
|
title: '系统提示',
|
content: '您将要进行下发的操作,确认要继续嘛?',
|
okText:'确认',
|
cancelText:'取消',
|
onOk:()=>{
|
this.dealDistribute(obj.id,(f)=>{
|
if (f) {
|
this.$message.success('操作成功')
|
this.$refs.table.refresh()
|
}
|
})
|
}
|
});
|
},
|
dealDistribute(id,callback){
|
this.$loading.show()
|
DetailDistribute(id).then(()=>{
|
this.$loading.hide()
|
callback && callback(true)
|
}).catch(()=>{
|
this.$loading.hide()
|
callback && callback(false)
|
})
|
}
|
}
|
}
|
</script>
|
|
<style lang="less" scoped>
|
.ex-warehouse1-info-block{
|
padding-top: 8px;
|
}
|
</style>
|