244 lines
6.4 KiB
Vue
244 lines
6.4 KiB
Vue
<template>
|
|
<div style="margin:20px">
|
|
<el-table
|
|
:data="dataList"
|
|
ref="dataList"
|
|
size="mini"
|
|
height="250"
|
|
:header-cell-style="{
|
|
background: '#eef1f6',
|
|
color: '#606266',
|
|
width: '100%'
|
|
}"
|
|
>
|
|
<el-table-column
|
|
type="index"
|
|
header-align="center"
|
|
align="center"
|
|
label="序号"
|
|
width="50"
|
|
>
|
|
</el-table-column>
|
|
<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>
|
|
</el-table-column>
|
|
<el-table-column prop="kilnName" label="工业炉">
|
|
<template slot-scope="scope">
|
|
<span>{{
|
|
kilnInfoArr.find(item => {
|
|
return item.id === scope.row.kilnId;
|
|
})
|
|
? kilnInfoArr.find(item => {
|
|
return item.id === scope.row.kilnId;
|
|
}).kilnName
|
|
: ""
|
|
}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="status" label="任务状态">
|
|
<template slot-scope="scope">
|
|
{{ scope.row.status >= 0 ? statusList[scope.row.status] : "" }}
|
|
</template>
|
|
</el-table-column>
|
|
<!-- <el-table-column prop="taskType" label="任务类型">
|
|
<template slot-scope="scope">
|
|
<span>{{
|
|
scope.row.taskType === 0
|
|
? "入库到工业炉"
|
|
: scope.row.taskType === 1
|
|
? "入库到缓存"
|
|
: scope.row.taskType === 2
|
|
? "工业炉出库到缓存区"
|
|
: "缓存区出库"
|
|
}}</span>
|
|
</template>
|
|
</el-table-column> -->
|
|
<el-table-column prop="isAuto" label="多步骤">
|
|
<template slot-scope="scope">
|
|
<span>{{ scope.row.isAuto === 1 ? "是" : "否" }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="craftCodeId" label="工艺"> </el-table-column>
|
|
<el-table-column prop="startPosition" label="开始位置"> </el-table-column>
|
|
<el-table-column prop="targetPosition" label="目标位置">
|
|
</el-table-column>
|
|
<el-table-column
|
|
fixed="right"
|
|
header-align="center"
|
|
align="center"
|
|
width="150"
|
|
label="操作"
|
|
>
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
type="text"
|
|
size="small"
|
|
@click="
|
|
addOrUpdateHandle(
|
|
scope.row.id,
|
|
scope.row.status,
|
|
scope.row.kilnId
|
|
)
|
|
"
|
|
>
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
content="修改"
|
|
placement="top"
|
|
>
|
|
<icon-svg class="iconClass" name="编辑"></icon-svg>
|
|
</el-tooltip>
|
|
</el-button>
|
|
<el-button
|
|
type="text"
|
|
:disabled="scope.row.status === 1"
|
|
size="small"
|
|
@click="runTask(scope.row.id)"
|
|
>
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
content="执行"
|
|
placement="top"
|
|
>
|
|
<icon-svg class="iconClass" name="维护开始"></icon-svg>
|
|
</el-tooltip>
|
|
</el-button>
|
|
<el-button
|
|
type="text"
|
|
style="color:red"
|
|
size="small"
|
|
@click="deleteHandle(scope.row.id)"
|
|
>
|
|
<el-tooltip
|
|
class="item"
|
|
effect="dark"
|
|
content="删除"
|
|
placement="top"
|
|
>
|
|
<icon-svg class="iconClass" name="删除"></icon-svg>
|
|
</el-tooltip>
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
<!-- 弹窗, 新增 / 修改 -->
|
|
<add-or-update
|
|
v-if="addOrUpdateVisible"
|
|
ref="addOrUpdate"
|
|
:kiln-info-arr="kilnInfoArr"
|
|
@refreshDataList="reDataList"
|
|
></add-or-update>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import AddOrUpdate from './current-task-new-add'
|
|
// 任务状态列表
|
|
const statusList = {
|
|
0: '等待执行',
|
|
1: '执行中',
|
|
2: '执行完成'
|
|
}
|
|
export default {
|
|
props: {
|
|
dataList: {
|
|
type: Array,
|
|
default: () => {
|
|
return []
|
|
}
|
|
},
|
|
kilnInfoArr: {
|
|
type: Array,
|
|
default: () => {
|
|
return []
|
|
}
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
statusList,
|
|
addOrUpdateVisible: false
|
|
}
|
|
},
|
|
components: {
|
|
AddOrUpdate
|
|
},
|
|
activated () {},
|
|
methods: {
|
|
init () {
|
|
console.log(1)
|
|
},
|
|
// 新增 / 修改
|
|
addOrUpdateHandle (id, status, kilnId) {
|
|
this.addOrUpdateVisible = true
|
|
this.$nextTick(() => {
|
|
this.$refs.addOrUpdate.init(id, status, kilnId)
|
|
})
|
|
},
|
|
reDataList () {
|
|
this.$emit('refreshDataList')
|
|
},
|
|
// 删除
|
|
deleteHandle (id) {
|
|
this.$confirm(`确定对[${id}]进行删除操作?`, '提示', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
})
|
|
.then(() => {
|
|
this.$http({
|
|
url: this.$http.adornUrl('/currTask/deleteById'),
|
|
method: 'post',
|
|
data: this.$http.adornData({ id })
|
|
}).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
this.$message({
|
|
message: '操作成功',
|
|
type: 'success',
|
|
duration: 1500,
|
|
onClose: () => {
|
|
this.reDataList()
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.error(data.msg)
|
|
}
|
|
})
|
|
})
|
|
.catch(() => {})
|
|
},
|
|
// 执行
|
|
runTask (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.reDataList()
|
|
}
|
|
})
|
|
} else {
|
|
this.$message.error(data.msg)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style></style>
|