<template>
|
<div>
|
<a-card :bordered="false" :bodyStyle="tstyle">
|
|
<div class="table-page-search-wrapper" v-if="hasPerm('FoamingTask:page')">
|
<a-form layout="inline">
|
<a-row :gutter="48">
|
<a-col :md="8" :sm="24">
|
<a-form-item label="批次">
|
<a-input v-model="queryParam.batch" allow-clear placeholder="请输入批次"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="巷道">
|
<a-select style="width: 100%" placeholder="请选择巷道" allow-clear v-model="queryParam.Aisle">
|
<a-select-option v-for="(item,index) in aislesOptions" :key="'aisle-sel-'+index" :value="item">{{item}}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<template v-if="advanced">
|
<a-col :md="8" :sm="24">
|
<a-form-item label="物料编号">
|
<a-input v-model="queryParam.MaterialNo" allow-clear placeholder="请输入物料编号"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="密度">
|
<a-input v-model="queryParam.MaterialDensity" allow-clear placeholder="请输入密度"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="任务号">
|
<a-input v-model="queryParam.taskNo" allow-clear placeholder="请输入任务号"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="任务方式">
|
<a-select :allowClear="true" style="width: 100%" v-model="queryParam.taskModel" placeholder="请选择任务方式">
|
<a-select-option v-for="(item,index) in taskModelData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="任务类型">
|
<a-select :allowClear="true" style="width: 100%" v-model="queryParam.taskType" placeholder="请选择任务类型">
|
<a-select-option v-for="(item,index) in taskTypeData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="任务状态">
|
<a-select :allowClear="true" style="width: 100%" v-model="queryParam.taskStatus" placeholder="请选择任务状态">
|
<a-select-option v-for="(item,index) in taskStatusData" :key="index" :value="item.code">{{ item.name }}</a-select-option>
|
</a-select>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="起始点">
|
<a-input v-model="queryParam.SourcePlace" allow-clear placeholder="请输入起始点"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="目标点">
|
<a-input v-model="queryParam.ToPlace" allow-clear placeholder="请输入目标点"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="创建时间">
|
<a-range-picker v-model="queryParam.dateRange" value-format="YYYY-MM-DD" format="YYYY-MM-DD" />
|
</a-form-item>
|
</a-col>
|
</template>
|
<a-col :md="8" :sm="24" >
|
<span class="table-page-search-submitButtons">
|
<a-button type="primary" @click="$refs.table.refresh(true)" >查询</a-button>
|
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
|
<a @click="toggleAdvanced" style="margin-left: 8px"> {{ advanced ? '收起' : '展开' }}
|
<a-icon :type="advanced ? 'up' : 'down'"/>
|
</a>
|
</span>
|
</a-col>
|
</a-row>
|
</a-form>
|
</div>
|
</a-card>
|
<a-card :bordered="false">
|
<s-table
|
ref="table"
|
:columns="columns"
|
:data="loadData"
|
:alert="true"
|
:rowKey="(record) => record.id"
|
:rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }">
|
<template class="table-operator" slot="operator">
|
<a-button type="danger" icon="close-circle" :disabled="!selectedCancels.length" @click="">取消</a-button>
|
<a-button type="danger" icon="pause" :disabled="!selectedPauses.length" @click="">暂停</a-button>
|
<a-button type="danger" icon="double-right" :disabled="!selectedContinuess.length" @click="">继续</a-button>
|
</template>
|
<span slot="taskModelscopedSlots" slot-scope="text">
|
<a-tag :color="text===1?'#ffd700':(text===3?'#00ced1':(text===2?'#1e90ff':'gray'))">{{ 'task_model' | dictType(text) }}</a-tag>
|
</span>
|
<span slot="taskTypescopedSlots" slot-scope="text">
|
<a-tag :color="text===1?'#008000':(text===3?'#ffd700':(text===3?'#1e90ff':'gray'))">{{ 'task_type' | dictType(text) }}</a-tag>
|
</span>
|
<span slot="taskStatusscopedSlots" slot-scope="text">
|
<a-tag :color="text===3?'#008000':(
|
text===2?'#1e90ff':(
|
text===4?'#556b2f':(
|
text===5?'#8b0000':(
|
text===6?'#ff00ff':'gray'
|
)
|
)
|
)
|
)">{{ 'task_status' | dictType(text) }}</a-tag>
|
</span>
|
<span slot="isReadscopedSlots" slot-scope="text">
|
{{ 'yes_or_no' | dictType(text) }}
|
</span>
|
<span slot="taskDodeviceStatusscopedSlots" slot-scope="text">
|
<a-tag :color="text===6?'#008000':(
|
text===5?'#ff00ff':(
|
text===2?'#00ced1':(
|
text===3?'#1e90ff':(
|
text===4?'#0000cd':'gray'
|
)
|
)
|
)
|
)">{{ 'task_dodevice_status' | dictType(text) }}</a-tag>
|
</span>
|
<span slot="action" slot-scope="text, record">
|
<!-- <a :class="[(record.taskStatus===3||record.taskStatus===4||record.taskStatus===5||record.taskStatus===6)?'disabled':'']" style="margin-right:10px;" @click="onForceComplete(record)">完成</a> -->
|
<a :class="[record.taskStatus===1?'':'disabled']" @click="onUpLevel(record)" style="margin-right:10px;"><a-icon type="arrow-up" /></a>
|
<a :class="[record.taskStatus===1?'':'disabled']" @click="onDownLevel(record)" style="margin-right:10px;"><a-icon type="arrow-down" /></a>
|
<!-- <a-dropdown>
|
<a class="ant-dropdown-link" @click="e => e.preventDefault()">更多</a>
|
<a-menu slot="overlay">
|
<a-menu-item><a :class="[record.taskStatus===1?'':'disabled']" @click="onCancel(record)">取消</a></a-menu-item>
|
<a-menu-item><a :class="[record.taskStatus===1?'':'disabled']" @click="onPause(record)">暂停</a></a-menu-item>
|
<a-menu-item><a :class="[record.taskStatus===5?'':'disabled']" @click="onContinue(record)">继续</a></a-menu-item>
|
</a-menu>
|
</a-dropdown> -->
|
</span>
|
</s-table>
|
</a-card>
|
|
<!-- <edit-level-modal :visible.sync="levelVisible" :obj="levelObj" @callback="onLevelConfirm" /> -->
|
</div>
|
</template>
|
<script>
|
import { STable } from '@/components'
|
import {
|
FoamingTaskPage,
|
FoamingTaskForceComplete,
|
FoamingTaskCancel,
|
FoamingTaskPause,
|
FoamingTaskContinue ,
|
FoamingTaskUpLevel,
|
FoamingTaskDownLevel
|
} from '@/api/modular/main/FoamingTaskManage'
|
import { WmsPlaceGetFAisles } from '@/api/modular/main/WmsPlaceManage'
|
//import editLevelModal from './editLevelModal.vue'
|
export default {
|
components: {
|
STable,
|
//editLevelModal
|
},
|
data () {
|
return {
|
advanced: false, // 高级搜索 展开/关闭
|
queryParam: {},
|
columns: [
|
{
|
title: '任务号',
|
align: 'center',
|
sorter: true,
|
dataIndex: 'taskNo'
|
},
|
{
|
title: '任务方式',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'taskModel',
|
scopedSlots: { customRender: 'taskModelscopedSlots' }
|
},
|
{
|
title: '任务类型',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'taskType',
|
scopedSlots: { customRender: 'taskTypescopedSlots' }
|
},
|
{
|
title: '任务状态',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'taskStatus',
|
scopedSlots: { customRender: 'taskStatusscopedSlots' }
|
},
|
{
|
title: '任务优先级',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'taskLevel'
|
},
|
{
|
title: '巷道',
|
align: 'center',
|
dataIndex: 'aisle'
|
},
|
{
|
title: '起始点',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'sourcePlace'
|
},
|
{
|
title: '目标点',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'toPlace'
|
},
|
{
|
title: '任务设备状态',
|
align: 'center',
|
dataIndex: 'taskDodeviceStatus',
|
scopedSlots: { customRender: 'taskDodeviceStatusscopedSlots' }
|
},
|
{
|
title: '物料编号',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'materialNo'
|
},
|
{
|
title: '物料尺寸',
|
align: 'center',
|
// sorter: true,
|
dataIndex: 'materialSpec'
|
},
|
{
|
title: '创建时间',
|
align: 'center',
|
dataIndex: 'createdTime'
|
},
|
{
|
title: '更新时间',
|
align: 'center',
|
dataIndex: 'updatedTime'
|
},
|
{
|
title: '操作',
|
width: '70px',
|
dataIndex: 'action',
|
fixed:'right',
|
align: 'center',
|
scopedSlots: { customRender: 'action' }
|
}
|
],
|
tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
|
// 加载数据方法 必须为 Promise 对象
|
loadData: parameter => {
|
let params = {...this.queryParam}
|
if ((params.dateRange instanceof Array) && params.dateRange.length===2) {
|
params.SearchBeginTime = params.dateRange[0] + ' 00:00:00'
|
params.SearchEndTime = params.dateRange[1] + ' 23:59:59'
|
delete params.dateRange
|
} else {
|
delete params.dateRange
|
delete params.SearchBeginTime
|
delete params.SearchEndTime
|
}
|
return FoamingTaskPage(Object.assign(parameter, params)).then((res) => {
|
return res.data
|
})
|
},
|
taskModelData: [],
|
taskTypeData: [],
|
taskStatusData: [],
|
isReadData: [],
|
areaNameData: [],
|
taskDodeviceStatusData: [],
|
aislesOptions:[],
|
selectedRowKeys: [],
|
selectedCancels: [],
|
selectedPauses: [],
|
selectedContinuess: [],
|
levelVisible:false,
|
levelObj:{}
|
}
|
},
|
created () {
|
const $options = this.$options
|
this.taskModelData = $options.filters['dictData']('task_model')
|
this.taskTypeData = $options.filters['dictData']('task_type')
|
this.taskStatusData = $options.filters['dictData']('task_status')
|
this.isReadData = $options.filters['dictData']('yes_or_no')
|
this.taskDodeviceStatusData = $options.filters['dictData']('task_dodevice_status')
|
/* console.log(this.taskDodeviceStatusData.map((item)=>{
|
return [item.code,item.name]
|
})) */
|
},
|
mounted(){
|
this.getAislesSelectOptions()
|
},
|
methods: {
|
getAislesSelectOptions(){
|
WmsPlaceGetFAisles().then((d)=>{
|
this.aislesOptions = d.data || []
|
}).catch(()=>{})
|
},
|
/**
|
* 查询参数组装
|
*/
|
toggleAdvanced () {
|
this.advanced = !this.advanced
|
},
|
handleOk () {
|
this.$refs.table.refresh()
|
},
|
/* openLevelModal(obj){
|
if (obj.taskStatus!==1) return false
|
this.levelObj = obj
|
this.levelVisible = true
|
},
|
onLevelConfirm(){
|
this.$refs.table.refresh()
|
}, */
|
onMulCancel(){
|
this.dealCancel(this.selectedCancels)
|
},
|
onMulPause(){
|
this.dealPause(this.selectedPauses)
|
},
|
onMulContinue(){
|
this.dealContinue(this.selectedContinuess)
|
},
|
onForceComplete(obj){
|
if (obj.taskStatus===3||obj.taskStatus===4||obj.taskStatus===5) return false
|
this.$confirm({
|
title: '确定要进行强制完成操作吗?',
|
okText: '确定',
|
okType: 'danger',
|
cancelText: '取消',
|
onOk:()=>{
|
this.handleForceComplete(obj.id,(f)=>{
|
if (f) {
|
this.$refs.table.refresh()
|
}
|
})
|
}
|
});
|
},
|
onUpLevel(obj){
|
if (obj.taskStatus!==1) return false
|
this.$confirm({
|
title: '确定要进行优先级调整吗?',
|
okText: '确定',
|
okType: 'danger',
|
cancelText: '取消',
|
onOk:()=>{
|
this.handleUpLevel(obj.id,(f)=>{
|
if (f) {
|
this.$refs.table.refresh()
|
}
|
})
|
}
|
});
|
},
|
onDownLevel(obj){
|
if (obj.taskStatus!==1) return false
|
this.$confirm({
|
title: '确定要进行优先级调整吗?',
|
okText: '确定',
|
okType: 'danger',
|
cancelText: '取消',
|
onOk:()=>{
|
this.handleDownLevel(obj.id,(f)=>{
|
if (f) {
|
this.$refs.table.refresh()
|
}
|
})
|
}
|
});
|
},
|
onCancel(obj){
|
if (obj.taskStatus!==1) return false
|
this.dealCancel([obj.id])
|
},
|
onPause(obj){
|
if (obj.taskStatus!==1) return false
|
this.dealPause([obj.id])
|
},
|
onContinue(obj){
|
if (obj.taskStatus!==5) return false
|
this.dealContinue([obj.id])
|
},
|
dealCancel(ids){
|
this.$confirm({
|
title: '确定要进行取消操作吗?',
|
okText: '确定',
|
okType: 'danger',
|
cancelText: '取消',
|
onOk:()=>{
|
this.handleCancel(ids,(f)=>{
|
if (f) {
|
this.$refs.table.refresh()
|
}
|
})
|
}
|
});
|
},
|
dealPause(ids){
|
this.$confirm({
|
title: '确定要进行暂停操作吗?',
|
okText: '确定',
|
okType: 'danger',
|
cancelText: '取消',
|
onOk:()=>{
|
this.handlePause(ids,(f)=>{
|
if (f) {
|
this.$refs.table.refresh()
|
}
|
})
|
}
|
});
|
},
|
dealContinue(ids){
|
this.$confirm({
|
title: '确定要继续任务吗?',
|
okText: '确定',
|
okType: 'danger',
|
cancelText: '取消',
|
onOk:()=>{
|
this.handleContinue(ids,(f)=>{
|
if (f) {
|
this.$refs.table.refresh()
|
}
|
})
|
}
|
});
|
},
|
handleForceComplete(id,callback){
|
this.$loading.show()
|
FoamingTaskForceComplete(id).then(()=>{
|
this.$loading.hide()
|
callback(true)
|
}).catch(()=>{
|
this.$loading.hide()
|
callback(false)
|
})
|
},
|
handleUpLevel(id,callback){
|
this.$loading.show()
|
FoamingTaskUpLevel(id).then(()=>{
|
this.$loading.hide()
|
callback(true)
|
}).catch(()=>{
|
this.$loading.hide()
|
callback(false)
|
})
|
},
|
handleDownLevel(id,callback){
|
this.$loading.show()
|
FoamingTaskDownLevel(id).then(()=>{
|
this.$loading.hide()
|
callback(true)
|
}).catch(()=>{
|
this.$loading.hide()
|
callback(false)
|
})
|
},
|
handleCancel(id,callback){
|
this.$loading.show()
|
FoamingTaskCancel(id).then(()=>{
|
this.$loading.hide()
|
callback(true)
|
}).catch(()=>{
|
this.$loading.hide()
|
callback(false)
|
})
|
},
|
handlePause(id,callback){
|
this.$loading.show()
|
FoamingTaskPause(id).then(()=>{
|
this.$loading.hide()
|
callback(true)
|
}).catch(()=>{
|
this.$loading.hide()
|
callback(false)
|
})
|
},
|
handleContinue(id,callback){
|
this.$loading.show()
|
FoamingTaskContinue(id).then(()=>{
|
this.$loading.hide()
|
callback(true)
|
}).catch(()=>{
|
this.$loading.hide()
|
callback(false)
|
})
|
},
|
onSelectChange (selectedRowKeys, selectedRows){
|
this.selectedRowKeys = selectedRowKeys
|
let arr1=[],arr2=[],arr3=[]
|
selectedRows.forEach((item)=>{
|
if (item.taskStatus===1) {
|
arr1.push(item.id)
|
arr2.push(item.id)
|
}
|
if (item.taskStatus===5) {
|
arr3.push(item.id)
|
}
|
})
|
this.selectedCancels = arr1
|
this.selectedPauses = arr2
|
this.selectedContinuess = arr3
|
}
|
}
|
}
|
</script>
|
<style lang="less">
|
.table-operator {
|
margin-bottom: 18px;
|
}
|
button {
|
margin-right: 8px;
|
}
|
</style>
|