|
|
@ -0,0 +1,165 @@ |
|
|
|
<template> |
|
|
|
<el-dialog title="明细" visible width="90%" :close-on-click-modal="false"> |
|
|
|
<el-table |
|
|
|
:data="tableData" |
|
|
|
border |
|
|
|
tooltip-effect="dark" |
|
|
|
height="410" |
|
|
|
ref="multipleTable" |
|
|
|
class="order-table-content-wrap" |
|
|
|
@select="handleSelectionChange" |
|
|
|
> |
|
|
|
<el-table-column |
|
|
|
type="selection" |
|
|
|
width="55"> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column v-for="item in headers" :key="item" :label="getColumnName(item)" :show-overflow-tooltip="true" align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<div v-if="item === 'OM_SerialOrder-SerialOrderStatus'" |
|
|
|
:class="['bg-div',{'not-plan-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 10}, |
|
|
|
{'has-plan-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 20}, |
|
|
|
{'has-lock-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 24}, |
|
|
|
{'has-issued-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 26}, |
|
|
|
{'interrupt-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 39}, |
|
|
|
{'in-production-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 40}, |
|
|
|
{'has-complete-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 80}, |
|
|
|
{'has-shipment-bg':scope.row[item]['OM_SerialOrderStatus-Status'] == 90}, |
|
|
|
{'freeze-bg': scope.row[item]['OM_SerialOrderStatus-Status'] == 95}, |
|
|
|
{'has-cancel-bg': scope.row[item]['OM_SerialOrderStatus-Status'] == 98}]"> {{ fieldTrans(scope.row[item]['OM_SerialOrderStatus-Status']) }} </div> |
|
|
|
<span v-else>{{ scope.row[item] }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column |
|
|
|
v-for="(item, index) in timeHeaders" |
|
|
|
:key="index" |
|
|
|
:label="getColumnName(item)" |
|
|
|
:show-overflow-tooltip="true" |
|
|
|
width="170" |
|
|
|
align="center"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span v-if="item === 'OM_SerialOrder-ActEndTime' && scope.row[item] === '19000101000000'"></span> |
|
|
|
<span v-else>{{ parseTime(scope.row[item]) }}</span> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button @click="clearSelect">取消选择</el-button> |
|
|
|
<el-button type="primary" @click="submit">确 定</el-button> |
|
|
|
<el-button @click="cancel">取 消</el-button> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</template> |
|
|
|
<script> |
|
|
|
import {getUncomplete, cancelUncomplete} from '@/api/productplan/base' |
|
|
|
export default { |
|
|
|
props:{ |
|
|
|
item:{ |
|
|
|
default:{} |
|
|
|
} |
|
|
|
}, |
|
|
|
data(){ |
|
|
|
return{ |
|
|
|
tableData:[], |
|
|
|
headers:[ |
|
|
|
'OM_SerialOrder-WorkOrderId', |
|
|
|
'OM_SerialOrder-SerialOrderId', |
|
|
|
'OM_SerialOrder-PlanResourceId', |
|
|
|
'OM_SerialOrder-UsedResourceId', |
|
|
|
'OM_SerialOrder-PlanQty', |
|
|
|
'OM_SerialOrder-ProjectId', |
|
|
|
'OM_SerialOrder-SerialOrderStatus' |
|
|
|
], |
|
|
|
timeHeaders:[ |
|
|
|
'OM_SerialOrder-PlanStartTime', |
|
|
|
'OM_SerialOrder-PlanEndTime', |
|
|
|
'OM_SerialOrder-ActEndTime', |
|
|
|
], |
|
|
|
orderStatusArray: [], // 订单状态 |
|
|
|
selectionValue:[], // 当前选择的工单明细 |
|
|
|
} |
|
|
|
}, |
|
|
|
methods:{ |
|
|
|
submit(){ |
|
|
|
if(this.selectionValue.length<=0){ |
|
|
|
this.msgError('请选择工单'); |
|
|
|
}else{ |
|
|
|
cancelUncomplete(this.selectionValue.map(e=>e['OM_SerialOrderStatus-SerialOrderId'])).then(({code})=>{ |
|
|
|
if(code==200){ |
|
|
|
this.msgSuccess('取消成功'); |
|
|
|
this.cancel(); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
// 关闭 |
|
|
|
cancel(){ |
|
|
|
this.$emit('setIsCloseOrder', {}); |
|
|
|
}, |
|
|
|
// 订单状态字段转换 |
|
|
|
fieldTrans(value) { |
|
|
|
if (this.orderStatusArray.length > 0) { |
|
|
|
let fieldValue = '' |
|
|
|
this.orderStatusArray.forEach(el => { |
|
|
|
if (value === Number(el['stdeftab-stdeftyp'])) { |
|
|
|
fieldValue = el['stdeftab-bez'] |
|
|
|
} |
|
|
|
}) |
|
|
|
return fieldValue |
|
|
|
} |
|
|
|
}, |
|
|
|
// 数组排序 |
|
|
|
sortby(a,b){return a['OM_SerialOrder-Sort']-b['OM_SerialOrder-Sort']}, |
|
|
|
// 选择后的回调 |
|
|
|
handleSelectionChange(value){ |
|
|
|
if(value.length<=1){ |
|
|
|
this.selectionValue=value; |
|
|
|
}else{ |
|
|
|
// 清空已有选择 |
|
|
|
this.$refs.multipleTable.clearSelection(); |
|
|
|
// 根据已选中排序 |
|
|
|
const newData=value.sort(this.sortby); |
|
|
|
// 查找所有符合条件的选项 |
|
|
|
this.selectionValue=this.tableData.filter(e=>{ |
|
|
|
return parseInt(e['OM_SerialOrder-Sort'])>=parseInt(newData[0]['OM_SerialOrder-Sort']) && parseInt(e['OM_SerialOrder-Sort'])<=parseInt(newData[newData.length-1]['OM_SerialOrder-Sort']); |
|
|
|
}); |
|
|
|
// 追加选中 |
|
|
|
this.selectionValue.forEach(row => { |
|
|
|
this.$refs.multipleTable.toggleRowSelection(row); |
|
|
|
}); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 取消选择 |
|
|
|
clearSelect(){ |
|
|
|
this.$refs.multipleTable.clearSelection(); |
|
|
|
}, |
|
|
|
// 获取未完成工单明细 |
|
|
|
getUncomplete(){ |
|
|
|
getUncomplete({workOrderId: this.item['OM_WorkOrder-WorkOrderId']}).then(({code, data=[]}) => { |
|
|
|
this.tableData=(data || []).sort(this.sortby); |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 获取生产状态 |
|
|
|
getOrderStatus(){ |
|
|
|
this.getStanderOne({ statid: 'WorkOrderStatus' }).then(res => { |
|
|
|
this.orderStatusArray = res.data |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
mounted(){ |
|
|
|
this.getUncomplete(); |
|
|
|
this.getOrderStatus(); |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style lang="scss"> |
|
|
|
.order-table-content-wrap{ |
|
|
|
.el-table__header-wrapper{ |
|
|
|
.el-table-column--selection{ |
|
|
|
.el-checkbox{ |
|
|
|
display: none; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
</style> |