mt-qj-wms-ui/src/views/order/current-task.vue

263 lines
7.3 KiB
Vue
Raw Normal View History

2021-11-19 16:36:32 +08:00
<template>
<div class="mod-config">
2022-07-06 16:59:18 +08:00
<!-- <el-form style="display: flex; align-items: center; justify-content: right;" :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
2021-11-19 16:36:32 +08:00
<el-form-item>
2021-12-15 19:36:23 +08:00
<el-select size="small" v-model="dataForm.vehicleId" filterable placeholder="车辆名称">
2021-12-01 16:46:26 +08:00
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
2021-11-19 16:36:32 +08:00
</el-form-item>
<el-form-item>
2021-12-15 19:36:23 +08:00
<el-button size="small" @click="getDataList()">查询</el-button>
2022-07-06 16:59:18 +08:00
<el-button type="primary" @click="handTask()">手动执行任务</el-button>
2021-11-19 16:36:32 +08:00
</el-form-item>
2022-07-06 16:59:18 +08:00
</el-form> -->
2021-11-19 16:36:32 +08:00
<el-table
:data="dataList"
2021-12-15 19:36:23 +08:00
:stripe="true"
2022-07-06 16:59:18 +08:00
:header-cell-style="{
background: '#eef1f6',
color: '#606266',
height: '56px'
}"
2021-11-19 16:36:32 +08:00
v-loading="dataListLoading"
2022-07-06 16:59:18 +08:00
style="width: 100%;"
>
2021-11-19 16:36:32 +08:00
<el-table-column
type="index"
header-align="center"
align="center"
label="序号"
2022-07-06 16:59:18 +08:00
width="50"
>
2021-11-19 16:36:32 +08:00
</el-table-column>
2022-07-06 16:59:18 +08:00
<el-table-column prop="taskCode" label="任务编码"> </el-table-column>
<el-table-column prop="createTime" label="发起时间">
<template slot-scope="scope">
{{
scope.row.createTime ? scope.row.createTime.replace("T", " ") : ""
}}
</template>
2021-12-01 16:46:26 +08:00
</el-table-column>
2022-07-06 16:59:18 +08:00
<el-table-column prop="status" label="任务状态">
2021-12-14 21:12:32 +08:00
<template slot-scope="scope">
2022-07-06 16:59:18 +08:00
{{ scope.row.status >= 0 ? statusList[scope.row.status] : "" }}
2021-12-14 21:12:32 +08:00
</template>
2021-12-01 16:46:26 +08:00
</el-table-column>
2022-07-06 16:59:18 +08:00
<el-table-column prop="taskType" label="任务类型">
2021-12-08 14:54:13 +08:00
<template slot-scope="scope">
<span>{{
scope.row.taskType === 0
? "缓存到窑炉加工"
: scope.row.taskType === 1
? "出炉到缓存"
: scope.row.taskType === 2
? "缓存出库"
: "入库缓存"
}}</span>
</template>
2021-12-01 16:46:26 +08:00
</el-table-column>
2022-07-06 16:59:18 +08:00
<el-table-column prop="startPosition" label="开始位置"> </el-table-column>
<el-table-column prop="targetPosition" label="目标位置">
2021-11-19 16:36:32 +08:00
</el-table-column>
2022-07-06 16:59:18 +08:00
<el-table-column prop="vehicleName" label="车辆名称"> </el-table-column>
2021-11-19 16:36:32 +08:00
<el-table-column
fixed="right"
header-align="center"
align="center"
width="80"
2022-07-06 16:59:18 +08:00
label="详情"
>
2021-11-19 16:36:32 +08:00
<template slot-scope="scope">
2022-07-06 16:59:18 +08:00
<el-button type="text" size="small" @click="Detail(scope.row.id)"
>详情</el-button
>
2021-11-19 16:36:32 +08:00
</template>
</el-table-column>
2021-12-08 14:54:13 +08:00
<el-table-column
fixed="right"
header-align="center"
align="center"
width="120"
2022-07-06 16:59:18 +08:00
label="操作"
>
2021-12-08 14:54:13 +08:00
<template slot-scope="scope">
2022-07-06 16:59:18 +08:00
<el-button
type="text"
:disabled="scope.row.status === 1"
size="small"
@click="addOrUpdateHandle(scope.row.id)"
>
<el-tooltip
class="item"
effect="dark"
content="执行"
placement="top"
>
<icon-svg class="iconClass" name="维护开始"></icon-svg>
2021-12-15 19:36:23 +08:00
</el-tooltip>
</el-button>
2022-07-06 16:59:18 +08:00
<el-button
type="text"
:disabled="scope.row.status === 1"
v-if="!scope.row.isAuto"
style="color:red"
size="small"
@click="deleteHandle(scope.row.sheetNo)"
>
<el-tooltip
class="item"
effect="dark"
content="删除"
placement="top"
>
2021-12-15 19:36:23 +08:00
<icon-svg class="iconClass" name="删除"></icon-svg>
</el-tooltip>
</el-button>
2021-12-08 14:54:13 +08:00
</template>
</el-table-column>
2021-11-19 16:36:32 +08:00
</el-table>
<el-pagination
@size-change="sizeChangeHandle"
@current-change="currentChangeHandle"
:current-page="pageIndex"
:page-sizes="[10, 20, 50, 100]"
:page-size="pageSize"
:total="totalPage"
2022-07-06 16:59:18 +08:00
layout="total, sizes, prev, pager, next, jumper"
>
2021-11-19 16:36:32 +08:00
</el-pagination>
</div>
</template>
<script>
2022-07-06 16:59:18 +08:00
// 任务状态列表
const statusList = {
0: '等待执行',
1: '执行中',
2: '执行完成',
3: '追加后完成'
}
export default {
data () {
return {
dataForm: {
vehicleId: ''
},
timer: '',
dataList: [],
options: [],
pageIndex: 1,
pageSize: 10,
totalPage: 0,
dataListLoading: false,
statusList
}
},
created () {
this.getDataList()
this.timer = setInterval(this.getDataList, 180000)
},
methods: {
// 获取数据列表
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/currTask/currentTaskNow'),
method: 'post',
data: this.$http.adornData({
current: this.pageIndex,
size: this.pageSize,
vehicleId: this.dataForm.vehicleId
})
}).then(({ data }) => {
if (data && data.code === 0) {
this.dataList = data.data.records
this.totalPage = data.data.total
} else {
this.dataList = []
this.totalPage = 0
}
this.dataListLoading = false
})
},
// 每页数
sizeChangeHandle (val) {
this.pageSize = val
this.pageIndex = 1
this.getDataList()
2021-11-19 16:36:32 +08:00
},
2022-07-06 16:59:18 +08:00
// 当前页
currentChangeHandle (val) {
this.pageIndex = val
2021-11-19 16:36:32 +08:00
this.getDataList()
},
2022-07-06 16:59:18 +08:00
Detail (id) {
this.$router.push({ name: 'order-current-task-detail', query: { id } })
},
handTask () {
this.$router.push({ name: 'orderProcess' })
},
// 执行
addOrUpdateHandle (id) {
this.$http({
url: this.$http.adornUrl('/currTask/runTask'),
method: 'post',
data: this.$http.adornData({ id })
// params: this.$http.adornParams({ id }, false)
}).then(({ data }) => {
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
2021-11-19 16:36:32 +08:00
})
2022-07-06 16:59:18 +08:00
} else {
this.$message.error(data.msg)
}
})
},
// 删除
deleteHandle (sheetNo) {
this.$confirm(`确定对[生产单编号=${sheetNo}]进行删除操作?`, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
})
.then(() => {
2021-11-19 16:36:32 +08:00
this.$http({
2021-12-10 17:07:29 +08:00
url: this.$http.adornUrl('/currTask/deleteBySheetNo'),
2021-11-19 16:36:32 +08:00
method: 'post',
2021-12-08 14:54:13 +08:00
data: this.$http.adornData(sheetNo)
2022-07-06 16:59:18 +08:00
}).then(({ data }) => {
2021-11-19 16:36:32 +08:00
if (data && data.code === 0) {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getDataList()
}
})
} else {
this.$message.error(data.msg)
}
})
2022-07-06 16:59:18 +08:00
})
.catch(() => {})
2021-11-19 16:36:32 +08:00
}
2022-07-06 16:59:18 +08:00
},
beforeDestroy () {
clearInterval(this.timer)
2021-11-19 16:36:32 +08:00
}
2022-07-06 16:59:18 +08:00
}
2021-11-19 16:36:32 +08:00
</script>