| | |
| | | |
| | | <el-table v-loading="loading" :data="jobList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="任务编号" align="center" prop="jobId" /> |
| | | <el-table-column label="任务编号" width="100" align="center" prop="jobId" /> |
| | | <el-table-column label="任务名称" align="center" prop="jobName" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="任务组名" align="center" prop="jobGroup" :formatter="jobGroupFormat" /> |
| | | <el-table-column label="任务组名" align="center" prop="jobGroup"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="jobGroupOptions" :value="scope.row.jobGroup"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="调用目标字符串" align="center" prop="invokeTarget" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="cron执行表达式" align="center" prop="cronExpression" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="状态" align="center"> |
| | |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['monitor:job:remove']" |
| | | >删除</el-button> |
| | | <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)"> |
| | | <el-dropdown size="mini" @command="(command) => handleCommand(command, scope.row)" v-hasPermi="['monitor:job:changeStatus', 'monitor:job:query']"> |
| | | <span class="el-dropdown-link"> |
| | | <i class="el-icon-d-arrow-right el-icon--right"></i>更多 |
| | | </span> |
| | |
| | | /> |
| | | |
| | | <!-- 添加或修改定时任务对话框 --> |
| | | <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> |
| | | <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | |
| | | <el-input v-model="form.invokeTarget" placeholder="请输入调用目标字符串" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="cron表达式" prop="cronExpression"> |
| | | <el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="是否并发" prop="concurrent"> |
| | | <el-radio-group v-model="form.concurrent" size="small"> |
| | | <el-radio-button label="0">允许</el-radio-button> |
| | | <el-radio-button label="1">禁止</el-radio-button> |
| | | </el-radio-group> |
| | | <el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式"> |
| | | <template slot="append"> |
| | | <el-button type="primary" @click="handleShowCron"> |
| | | 生成表达式 |
| | | <i class="el-icon-time el-icon--right"></i> |
| | | </el-button> |
| | | </template> |
| | | </el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="是否并发" prop="concurrent"> |
| | | <el-radio-group v-model="form.concurrent" size="small"> |
| | | <el-radio-button label="0">允许</el-radio-button> |
| | | <el-radio-button label="1">禁止</el-radio-button> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="状态"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | |
| | | <el-button type="primary" @click="submitForm">确 定</el-button> |
| | | <el-button @click="cancel">取 消</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <el-dialog title="Cron表达式生成器" :visible.sync="openCron" append-to-body class="scrollbar"> |
| | | <crontab @hide="openCron=false" @fill="crontabFill" :expression="expression"></crontab> |
| | | </el-dialog> |
| | | |
| | | <!-- 任务日志详细 --> |
| | |
| | | </template> |
| | | |
| | | <script> |
| | | import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job"; |
| | | import { listJob, getJob, delJob, addJob, updateJob, runJob, changeJobStatus } from "@/api/monitor/job"; |
| | | import Crontab from '@/components/Crontab' |
| | | |
| | | export default { |
| | | components: { Crontab }, |
| | | name: "Job", |
| | | data() { |
| | | return { |
| | |
| | | open: false, |
| | | // 是否显示详细弹出层 |
| | | openView: false, |
| | | // 是否显示Cron表达式弹出层 |
| | | openCron: false, |
| | | // 传入的表达式 |
| | | expression: "", |
| | | // 任务组名字典 |
| | | jobGroupOptions: [], |
| | | // 状态字典 |
| | |
| | | // 任务组名字典翻译 |
| | | jobGroupFormat(row, column) { |
| | | return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); |
| | | }, |
| | | // 状态字典翻译 |
| | | statusFormat(row, column) { |
| | | return this.selectDictLabel(this.statusOptions, row.status); |
| | | }, |
| | | // 取消按钮 |
| | | cancel() { |
| | |
| | | this.openView = true; |
| | | }); |
| | | }, |
| | | /** cron表达式按钮操作 */ |
| | | handleShowCron() { |
| | | this.expression = this.form.cronExpression; |
| | | this.openCron = true; |
| | | }, |
| | | /** 确定后回传值 */ |
| | | crontabFill(value) { |
| | | this.form.cronExpression = value; |
| | | }, |
| | | /** 任务日志列表查询 */ |
| | | handleJobLog(row) { |
| | | const jobId = row.jobId || 0; |
| | | this.$router.push({ path: '/job/log', query: { jobId: jobId } }) |
| | | this.$router.push({ path: '/monitor/job-log/index', query: { jobId: jobId } }) |
| | | }, |
| | | /** 新增按钮操作 */ |
| | | handleAdd() { |
| | |
| | | }, |
| | | /** 导出按钮操作 */ |
| | | handleExport() { |
| | | const queryParams = this.queryParams; |
| | | this.$confirm("是否确认导出所有定时任务数据项?", "警告", { |
| | | confirmButtonText: "确定", |
| | | cancelButtonText: "取消", |
| | | type: "warning" |
| | | }).then(() => { |
| | | this.exportLoading = true; |
| | | return exportJob(queryParams); |
| | | }).then(response => { |
| | | this.download(response.msg); |
| | | this.exportLoading = false; |
| | | }).catch(() => {}); |
| | | this.downLoadExcel('/monitor/job/export', this.queryParams); |
| | | } |
| | | } |
| | | }; |