|
|
@@ -0,0 +1,151 @@
|
|
|
+<template>
|
|
|
+ <el-container>
|
|
|
+ <el-header height="220">
|
|
|
+ <h3>任务结果列表</h3>
|
|
|
+ <el-row style="margin-top: 10px">
|
|
|
+ <el-select
|
|
|
+ v-model="env"
|
|
|
+ size="mini"
|
|
|
+ placeholder="环境"
|
|
|
+ style="margin-left: 5px"
|
|
|
+ @change="onSelectChange"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in envList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-select
|
|
|
+ v-model="queryInfo.machineId"
|
|
|
+ size="mini"
|
|
|
+ placeholder="机器"
|
|
|
+ style="margin-left: 5px"
|
|
|
+ @change="onSelectChange1"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in machineList"
|
|
|
+ :key="index"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ <el-button size="mini" type="warning" icon="el-icon-refresh" style="margin-left: 5px" @click="onRefresh">刷新</el-button>
|
|
|
+ <el-button size="mini" type="warning" icon="el-icon-delete" style="margin-left: 5px" @click="onErase">清空</el-button>
|
|
|
+ </el-row>
|
|
|
+ </el-header>
|
|
|
+ <el-main>
|
|
|
+ <el-table
|
|
|
+ :data="dataList"
|
|
|
+ border
|
|
|
+ height="480"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ <el-table-column
|
|
|
+ prop="createTime"
|
|
|
+ label="执行时间"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ prop="taskName"
|
|
|
+ label="任务名"
|
|
|
+ />
|
|
|
+ </el-table>
|
|
|
+ </el-main>
|
|
|
+ </el-container>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import { eraseMachineTask, getEnvList, getMachineSessions, getMachineTaskList } from '@/api/devops'
|
|
|
+
|
|
|
+export default {
|
|
|
+ name: 'MachineTask',
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ env: 'test',
|
|
|
+ envList: [],
|
|
|
+ machine: '',
|
|
|
+ machineList: [],
|
|
|
+ queryInfo: {
|
|
|
+ machineId: ''
|
|
|
+ },
|
|
|
+ multipleSelection: [],
|
|
|
+ dataList: []
|
|
|
+ }
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ document.title = '任务结果列表'
|
|
|
+
|
|
|
+ getEnvList().then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.env = resp.data.userEnv
|
|
|
+ this.envList = resp.data.envList
|
|
|
+ this.getMachineList(this.env)
|
|
|
+ this.getData()
|
|
|
+ } else {
|
|
|
+ this.$message.error(resp.msg)
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ getMachineList(env) {
|
|
|
+ getMachineSessions(env).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.machineList = resp.data
|
|
|
+ } else {
|
|
|
+ this.$message.error(resp.msg)
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ getData() {
|
|
|
+ getMachineTaskList(this.queryInfo).then(resp => {
|
|
|
+ if (resp.code === 0) {
|
|
|
+ this.dataList = resp.data
|
|
|
+ } else {
|
|
|
+ this.$message.error(resp.msg)
|
|
|
+ }
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ onSelectChange() {
|
|
|
+ this.machine = ''
|
|
|
+ this.getMachineList(this.env)
|
|
|
+ },
|
|
|
+ onSelectChange1() {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ onRefresh() {
|
|
|
+ this.getData()
|
|
|
+ },
|
|
|
+ onErase() {
|
|
|
+ this.$confirm('确定要情况删除 ' + this.queryInfo.machineId + ' 的任务记录?', '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ const formData = new FormData()
|
|
|
+ formData.append('machineId', this.queryInfo.machineId)
|
|
|
+ eraseMachineTask(formData).then(resp => {
|
|
|
+ this.$message.info(resp.msg)
|
|
|
+ this.getData()
|
|
|
+ }).catch(error => {
|
|
|
+ this.$message.error(error.message)
|
|
|
+ })
|
|
|
+ }).catch(() => {
|
|
|
+ this.$message({
|
|
|
+ type: 'info',
|
|
|
+ message: '已取消'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+</style>
|