<template>
|
<div>
|
<a-card :bordered="false" :bodyStyle="tstyle">
|
|
<div class="table-page-search-wrapper" v-if="hasPerm('WareTaskBak:page')">
|
<a-form layout="inline">
|
<a-row :gutter="48">
|
<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.taskCategory" 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><template v-if="advanced">
|
|
<a-col :md="8" :sm="24">
|
<a-form-item label="任务状态">
|
<a-select :allowClear="true" style="width: 100%" v-model="queryParam.taskState" 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.containerCode" allow-clear placeholder="请输入小车编号"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="出发地库位">
|
<a-input v-model="queryParam.fromLocationCode" allow-clear placeholder="请输入出发地库位"/>
|
</a-form-item>
|
</a-col>
|
<a-col :md="8" :sm="24">
|
<a-form-item label="目的地库位">
|
<a-input v-model="queryParam.toLocationCode" allow-clear placeholder="请输入目的地库位"/>
|
</a-form-item>
|
</a-col>
|
<!-- <a-col :md="8" :sm="24">
|
<a-form-item label="任务完成时间">
|
<a-date-picker style="width: 100%" placeholder="请选择任务完成时间" v-model="queryParam.finishedTimeDate" @change="onChangefinishedTime"/>
|
</a-form-item>
|
</a-col> -->
|
<!-- <a-col :md="8" :sm="24">
|
<a-form-item label="移库标识">
|
<a-input-number v-model="queryParam.moveFlag" style="width: 100%" allow-clear placeholder="请输入移库标识"/>
|
</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" v-if="hasPerm('WmsContainer:add')" >
|
<a-button type="primary" v-if="hasPerm('WmsContainer:add')" icon="plus" @click="handExport()">导出</a-button>
|
</template>
|
|
<span slot="action" slot-scope="text, record">
|
<a v-if="hasPerm('WareTaskBak:edit')" @click="onOpenInfo(record)">详情</a>
|
</span>
|
<span slot="tasktypescopedSlots" slot-scope="text">
|
<a-tag :color="text===1?'#2db7f5':'#87d068'">{{ 'task_type' | dictType(text) }}</a-tag>
|
</span>
|
<span slot="taskstatusscopedSlots" slot-scope="text">
|
<a-tag :color="text===1?'#2db7f5':(text===2?'#108ee9':'#87d068')">{{ 'task_status' | dictType(text) }}</a-tag>
|
</span>
|
<span slot="isornoDataSlots" slot-scope="text,record">
|
<div v-for="option in isorno" :key=option.value>
|
<span v-if="record.moveFlag ==option.value"> {{ option.title }}</span>
|
</div>
|
</span>
|
</s-table>
|
<add-form ref="addForm" @ok="handleOk" />
|
<edit-form ref="editForm" @ok="handleOk" />
|
<info-modal :visible.sync="infoVisible" :row="infoRow" />
|
</a-card>
|
</div>
|
</template>
|
<script>
|
import { STable } from '@/components'
|
import moment from 'moment'
|
import { WareTaskBakPage, WareTaskBakDelete } from '@/api/modular/main/WareTaskBakManage'
|
import addForm from './addForm.vue'
|
import editForm from './editForm.vue'
|
import InfoModal from './InfoModal.vue'
|
import { axios } from '@/utils/request'
|
export default {
|
components: {
|
STable,
|
addForm,
|
editForm,
|
InfoModal,
|
},
|
data () {
|
return {
|
advanced: false, // 高级搜索 展开/关闭
|
queryParam: {},
|
columns: [
|
{
|
title: '任务号',
|
align: 'center',
|
dataIndex: 'taskNo'
|
},
|
{
|
title: '任务类别',
|
align: 'center',
|
dataIndex: 'taskCategory',
|
scopedSlots: { customRender: 'tasktypescopedSlots' }
|
},
|
{
|
title: '任务状态',
|
align: 'center',
|
dataIndex: 'taskState',
|
scopedSlots: { customRender: 'taskstatusscopedSlots' }
|
},
|
{
|
title: '小车编号',
|
align: 'center',
|
dataIndex: 'containerCode'
|
},
|
{
|
title: '零件号',
|
align: 'center',
|
dataIndex: 'partCode'
|
},
|
{
|
title: '起始地',
|
align: 'center',
|
dataIndex: 'fromLocationCode'
|
},
|
{
|
title: '目的地',
|
align: 'center',
|
dataIndex: 'toLocationCode'
|
},
|
{
|
title: '创建时间',
|
align: 'center',
|
dataIndex: 'beginTime'
|
},
|
{
|
title: '完成时间',
|
align: 'center',
|
dataIndex: 'finishedTime'
|
},
|
{
|
title: 'AGV编号',
|
align: 'center',
|
dataIndex: 'agvCode'
|
},
|
{
|
title: '移库标识',
|
align: 'center',
|
dataIndex: 'moveFlag',
|
scopedSlots: { customRender: 'isornoDataSlots' }
|
},
|
{
|
title: '任务耗时',
|
align: 'center',
|
dataIndex: 'taskTime'
|
},
|
{
|
title: '',
|
align: 'center',
|
dataIndex: 'operationRemark'
|
}
|
],
|
tstyle: { 'padding-bottom': '0px', 'margin-bottom': '10px' },
|
// 加载数据方法 必须为 Promise 对象
|
loadData: parameter => {
|
return WareTaskBakPage(Object.assign(parameter, this.switchingDate())).then((res) => {
|
return res.data
|
})
|
},
|
selectedRowKeys: [],
|
selectedRows: [],
|
infoVisible:false,
|
infoRow:{},
|
tasktypeData: [],
|
taskstatusData: [],
|
isorno:[{title:"是",
|
value:1},
|
{title:"否",
|
value:0}
|
]
|
}
|
},
|
created () {
|
if (this.hasPerm('WareTaskBak:edit') || this.hasPerm('WareTaskBak:delete')) {
|
this.columns.push({
|
title: '操作',
|
width: '150px',
|
dataIndex: 'action',
|
scopedSlots: { customRender: 'action' }
|
})
|
}
|
const tasktypeOption = this.$options
|
this.tasktypeData = tasktypeOption.filters['dictData']('task_type')
|
const taskstatusOption = this.$options
|
this.taskstatusData = taskstatusOption.filters['dictData']('task_status')
|
},
|
methods: {
|
moment,
|
onOpenInfo(row){
|
this.infoRow = row;
|
this.infoVisible = true
|
},
|
|
//导出
|
handExport(){
|
//ExcelExport(this.queryParam)
|
let fileName = "历史任务信息" + new Date().toLocaleString();
|
var AxiosRequestConfig = {responseType:"blob"}
|
var data = axios.post('http://10.103.9.5:7788/api/WareTaskBakService/download',this.queryParam,AxiosRequestConfig)
|
.then((res) => {
|
if (res.status == 200) {
|
let blob = new Blob([res.data],
|
{type: "application/vnd.ms-excel"})
|
if (window.navigator.msSaveOrOpenBlob) {
|
navigator.msSaveBlob(blob,fileName)
|
}else {
|
var link = document.createElement('a');
|
link.href = window.URL.createObjectURL(blob);
|
link.download = fileName;
|
link.click();//释放内存
|
window.URL.revokeobjectURL(link.href);
|
}}
|
else{
|
Message.error("操作失败,服务端出现异常错误!")
|
}})
|
return data;
|
},
|
/**
|
* 查询参数组装
|
*/
|
switchingDate () {
|
const queryParamfinishedTime = this.queryParam.finishedTimeDate
|
if (queryParamfinishedTime != null) {
|
this.queryParam.finishedTime = moment(queryParamfinishedTime).format('YYYY-MM-DD')
|
if (queryParamfinishedTime.length < 1) {
|
delete this.queryParam.finishedTime
|
}
|
}else
|
{
|
delete this.queryParam.finishedTime
|
}
|
const obj = JSON.parse(JSON.stringify(this.queryParam))
|
return obj
|
},
|
WareTaskBakDelete (record) {
|
WareTaskBakDelete(record).then((res) => {
|
if (res.success) {
|
this.$message.success('删除成功')
|
this.$refs.table.refresh()
|
} else {
|
this.$message.error('删除失败') // + res.message
|
}
|
})
|
},
|
toggleAdvanced () {
|
this.advanced = !this.advanced
|
},
|
onChangefinishedTime(date, dateString) {
|
this.finishedTimeDateString = dateString
|
},
|
handleOk () {
|
this.$refs.table.refresh()
|
},
|
onSelectChange (selectedRowKeys, selectedRows) {
|
this.selectedRowKeys = selectedRowKeys
|
this.selectedRows = selectedRows
|
}
|
}
|
}
|
</script>
|
<style lang="less">
|
.table-operator {
|
margin-bottom: 18px;
|
}
|
button {
|
margin-right: 8px;
|
}
|
</style>
|