130 lines
3.1 KiB
Vue
130 lines
3.1 KiB
Vue
<!--
|
|
* @Author: zwq
|
|
* @Date: 2021-10-11 16:38:28
|
|
* @LastEditors: zwq
|
|
* @LastEditTime: 2021-10-27 16:17:23
|
|
* @Description:
|
|
-->
|
|
<template>
|
|
<div>
|
|
<div style="margin:0 0 20px;text-align:left">
|
|
<el-button type="primary" icon="el-icon-refresh" @click="init"
|
|
>刷新</el-button
|
|
>
|
|
</div>
|
|
<div>
|
|
<el-table :data="tableData" stripe border style="width: 100%">
|
|
<el-table-column type="index" align="center" label="序号" width="80">
|
|
</el-table-column>
|
|
<el-table-column prop="code" align="center" label="任务编码">
|
|
</el-table-column>
|
|
<el-table-column prop="status" align="center" label="状态">
|
|
<template slot-scope="scope">
|
|
<span>{{
|
|
scope.row.status === 0
|
|
? "等待执行"
|
|
: scope.row.status === 1
|
|
? "执行中"
|
|
: "执行完成"
|
|
}}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="操作" align="center" width="250">
|
|
<template slot-scope="scope">
|
|
<el-button
|
|
size="mini"
|
|
type="warning"
|
|
v-show="scope.row.status === 1"
|
|
@click="handleEdit(scope.row.id)"
|
|
>停止</el-button
|
|
>
|
|
<el-button
|
|
size="mini"
|
|
type="danger"
|
|
@click="handleDelete(scope.row.id)"
|
|
>删除</el-button
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
export default {
|
|
data() {
|
|
return {
|
|
current: 1,
|
|
size: 500,
|
|
tableData: []
|
|
};
|
|
},
|
|
mounted() {
|
|
this.init();
|
|
},
|
|
methods: {
|
|
init() {
|
|
this.$axios({
|
|
method: "post",
|
|
url: "/api/business/t-wcs-task/findAll",
|
|
data: {
|
|
current: this.current,
|
|
size: this.size
|
|
}
|
|
}).then(res => {
|
|
if (res && res.data.code === 0) {
|
|
this.tableData = res.data.data.records;
|
|
} else {
|
|
this.$message.error(res.data.msg);
|
|
}
|
|
});
|
|
},
|
|
handleEdit(id) {
|
|
this.$axios({
|
|
method: "post",
|
|
url: "/api/business/t-wcs-task/delete",
|
|
data: {
|
|
id
|
|
}
|
|
}).then(res => {
|
|
if (res.data && res.data.code === 0) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "已停止",
|
|
onClose: () => {
|
|
this.init();
|
|
}
|
|
});
|
|
} else {
|
|
this.$message.error(res.data.msg);
|
|
}
|
|
});
|
|
},
|
|
handleDelete(id) {
|
|
this.$axios({
|
|
method: "post",
|
|
url: "/api/business/t-wcs-task/delete",
|
|
data: {
|
|
id
|
|
}
|
|
}).then(res => {
|
|
if (res.data && res.data.code === 0) {
|
|
this.$message({
|
|
type: "success",
|
|
message: "成功删除",
|
|
onClose: () => {
|
|
this.init();
|
|
}
|
|
});
|
|
} else {
|
|
this.$message.error(res.data.msg);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style></style>
|