¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="ä»»å¡åç§°" prop="jobName"> |
| | | <el-input |
| | | v-model="queryParams.jobName" |
| | | placeholder="请è¾å
¥ä»»å¡åç§°" |
| | | clearable |
| | | size="small" |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ä»»å¡ç»å" prop="jobGroup"> |
| | | <el-select v-model="queryParams.jobGroup" placeholder="è¯·éæ©ä»»å¡ç»å" clearable size="small"> |
| | | <el-option |
| | | v-for="dict in jobGroupOptions" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictLabel" |
| | | :value="dict.dictValue" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ä»»å¡ç¶æ" prop="status"> |
| | | <el-select v-model="queryParams.status" placeholder="è¯·éæ©ä»»å¡ç¶æ" clearable size="small"> |
| | | <el-option |
| | | v-for="dict in statusOptions" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictLabel" |
| | | :value="dict.dictValue" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['monitor:job:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['monitor:job:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['monitor:job:remove']" |
| | | >å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | :loading="exportLoading" |
| | | @click="handleExport" |
| | | v-hasPermi="['monitor:job:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="info" |
| | | plain |
| | | icon="el-icon-s-operation" |
| | | size="mini" |
| | | @click="handleJobLog" |
| | | v-hasPermi="['monitor:job:query']" |
| | | >æ¥å¿</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <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="ä»»å¡åç§°" 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="invokeTarget" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="cronæ§è¡è¡¨è¾¾å¼" align="center" prop="cronExpression" :show-overflow-tooltip="true" /> |
| | | <el-table-column label="ç¶æ" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-switch |
| | | v-model="scope.row.status" |
| | | active-value="0" |
| | | inactive-value="1" |
| | | @change="handleStatusChange(scope.row)" |
| | | ></el-switch> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-caret-right" |
| | | @click="handleRun(scope.row)" |
| | | v-hasPermi="['monitor:job:changeStatus']" |
| | | >æ§è¡ä¸æ¬¡</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="text" |
| | | icon="el-icon-view" |
| | | @click="handleView(scope.row)" |
| | | v-hasPermi="['monitor:job:query']" |
| | | >详ç»</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- æ·»å æä¿®æ¹å®æ¶ä»»å¡å¯¹è¯æ¡ --> |
| | | <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="120px"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡åç§°" prop="jobName"> |
| | | <el-input v-model="form.jobName" placeholder="请è¾å
¥ä»»å¡åç§°" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡åç»" prop="jobGroup"> |
| | | <el-select v-model="form.jobGroup" placeholder="è¯·éæ©"> |
| | | <el-option |
| | | v-for="dict in jobGroupOptions" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictLabel" |
| | | :value="dict.dictValue" |
| | | ></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item prop="invokeTarget"> |
| | | <span slot="label"> |
| | | è°ç¨æ¹æ³ |
| | | <el-tooltip placement="top"> |
| | | <div slot="content"> |
| | | Beanè°ç¨ç¤ºä¾ï¼ryTask.ryParams('ry') |
| | | <br />Classç±»è°ç¨ç¤ºä¾ï¼com.ruoyi.quartz.task.RyTask.ryParams('ry') |
| | | <br />åæ°è¯´æï¼æ¯æå符串ï¼å¸å°ç±»åï¼é¿æ´åï¼æµ®ç¹åï¼æ´å |
| | | </div> |
| | | <i class="el-icon-question"></i> |
| | | </el-tooltip> |
| | | </span> |
| | | <el-input v-model="form.invokeTarget" placeholder="请è¾å
¥è°ç¨ç®æ å符串" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <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-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="é误çç¥" prop="misfirePolicy"> |
| | | <el-radio-group v-model="form.misfirePolicy" size="small"> |
| | | <el-radio-button label="1">ç«å³æ§è¡</el-radio-button> |
| | | <el-radio-button label="2">æ§è¡ä¸æ¬¡</el-radio-button> |
| | | <el-radio-button label="3">æ¾å¼æ§è¡</el-radio-button> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="ç¶æ"> |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | | v-for="dict in statusOptions" |
| | | :key="dict.dictValue" |
| | | :label="dict.dictValue" |
| | | >{{dict.dictLabel}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | <!-- 任塿¥å¿è¯¦ç» --> |
| | | <el-dialog title="ä»»å¡è¯¦ç»" :visible.sync="openView" width="700px" append-to-body> |
| | | <el-form ref="form" :model="form" label-width="120px" size="mini"> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡ç¼å·ï¼">{{ form.jobId }}</el-form-item> |
| | | <el-form-item label="ä»»å¡åç§°ï¼">{{ form.jobName }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡åç»ï¼">{{ jobGroupFormat(form) }}</el-form-item> |
| | | <el-form-item label="å建æ¶é´ï¼">{{ form.createTime }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="cron表达å¼ï¼">{{ form.cronExpression }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="䏿¬¡æ§è¡æ¶é´ï¼">{{ parseTime(form.nextValidTime) }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="24"> |
| | | <el-form-item label="è°ç¨ç®æ æ¹æ³ï¼">{{ form.invokeTarget }}</el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="ä»»å¡ç¶æï¼"> |
| | | <div v-if="form.status == 0">æ£å¸¸</div> |
| | | <div v-else-if="form.status == 1">失败</div> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ¯å¦å¹¶åï¼"> |
| | | <div v-if="form.concurrent == 0">å
许</div> |
| | | <div v-else-if="form.concurrent == 1">ç¦æ¢</div> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="æ§è¡çç¥ï¼"> |
| | | <div v-if="form.misfirePolicy == 0">é»è®¤çç¥</div> |
| | | <div v-else-if="form.misfirePolicy == 1">ç«å³æ§è¡</div> |
| | | <div v-else-if="form.misfirePolicy == 2">æ§è¡ä¸æ¬¡</div> |
| | | <div v-else-if="form.misfirePolicy == 3">æ¾å¼æ§è¡</div> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="openView = false">å
³ é</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listJob, getJob, delJob, addJob, updateJob, exportJob, runJob, changeJobStatus } from "@/api/monitor/job"; |
| | | |
| | | export default { |
| | | name: "Job", |
| | | data() { |
| | | return { |
| | | // é®ç½©å± |
| | | loading: true, |
| | | // 导åºé®ç½©å± |
| | | exportLoading: false, |
| | | // é䏿°ç» |
| | | ids: [], |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // 宿¶ä»»å¡è¡¨æ ¼æ°æ® |
| | | jobList: [], |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // æ¯å¦æ¾ç¤ºè¯¦ç»å¼¹åºå± |
| | | openView: false, |
| | | // ä»»å¡ç»ååå
¸ |
| | | jobGroupOptions: [], |
| | | // ç¶æåå
¸ |
| | | statusOptions: [], |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | jobName: undefined, |
| | | jobGroup: undefined, |
| | | status: undefined |
| | | }, |
| | | // 表ååæ° |
| | | form: {}, |
| | | // è¡¨åæ ¡éª |
| | | rules: { |
| | | jobName: [ |
| | | { required: true, message: "ä»»å¡åç§°ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | invokeTarget: [ |
| | | { required: true, message: "è°ç¨ç®æ å符串ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | cronExpression: [ |
| | | { required: true, message: "cronæ§è¡è¡¨è¾¾å¼ä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ] |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | this.getDicts("sys_job_group").then(response => { |
| | | this.jobGroupOptions = response.data; |
| | | }); |
| | | this.getDicts("sys_job_status").then(response => { |
| | | this.statusOptions = response.data; |
| | | }); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢å®æ¶ä»»å¡å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listJob(this.queryParams).then(response => { |
| | | this.jobList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | // ä»»å¡ç»ååå
¸ç¿»è¯ |
| | | jobGroupFormat(row, column) { |
| | | return this.selectDictLabel(this.jobGroupOptions, row.jobGroup); |
| | | }, |
| | | // ç¶æåå
¸ç¿»è¯ |
| | | statusFormat(row, column) { |
| | | return this.selectDictLabel(this.statusOptions, row.status); |
| | | }, |
| | | // åæ¶æé® |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表åéç½® |
| | | reset() { |
| | | this.form = { |
| | | jobId: undefined, |
| | | jobName: undefined, |
| | | jobGroup: undefined, |
| | | invokeTarget: undefined, |
| | | cronExpression: undefined, |
| | | misfirePolicy: 1, |
| | | concurrent: 1, |
| | | status: "0" |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡é䏿°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.jobId); |
| | | this.single = selection.length != 1; |
| | | this.multiple = !selection.length; |
| | | }, |
| | | // ä»»å¡ç¶æä¿®æ¹ |
| | | handleStatusChange(row) { |
| | | let text = row.status === "0" ? "å¯ç¨" : "åç¨"; |
| | | this.$confirm('确认è¦"' + text + '""' + row.jobName + '"ä»»å¡å?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return changeJobStatus(row.jobId, row.status); |
| | | }).then(() => { |
| | | this.msgSuccess(text + "æå"); |
| | | }).catch(function() { |
| | | row.status = row.status === "0" ? "1" : "0"; |
| | | }); |
| | | }, |
| | | /* ç«å³æ§è¡ä¸æ¬¡ */ |
| | | handleRun(row) { |
| | | this.$confirm('确认è¦ç«å³æ§è¡ä¸æ¬¡"' + row.jobName + '"ä»»å¡å?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return runJob(row.jobId, row.jobGroup); |
| | | }).then(() => { |
| | | this.msgSuccess("æ§è¡æå"); |
| | | }) |
| | | }, |
| | | /** ä»»å¡è¯¦ç»ä¿¡æ¯ */ |
| | | handleView(row) { |
| | | getJob(row.jobId).then(response => { |
| | | this.form = response.data; |
| | | this.openView = true; |
| | | }); |
| | | }, |
| | | /** 任塿¥å¿å表æ¥è¯¢ */ |
| | | handleJobLog() { |
| | | this.$router.push("/job/log"); |
| | | }, |
| | | /** æ°å¢æé®æä½ */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.title = "æ·»å ä»»å¡"; |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const jobId = row.jobId || this.ids; |
| | | getJob(jobId).then(response => { |
| | | this.form = response.data; |
| | | this.open = true; |
| | | this.title = "ä¿®æ¹ä»»å¡"; |
| | | }); |
| | | }, |
| | | /** æäº¤æé® */ |
| | | submitForm: function() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.jobId != undefined) { |
| | | updateJob(this.form).then(response => { |
| | | this.msgSuccess("ä¿®æ¹æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addJob(this.form).then(response => { |
| | | this.msgSuccess("æ°å¢æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const jobIds = row.jobId || this.ids; |
| | | this.$confirm('æ¯å¦ç¡®è®¤å é¤å®æ¶ä»»å¡ç¼å·ä¸º"' + jobIds + '"çæ°æ®é¡¹?', "è¦å", { |
| | | confirmButtonText: "ç¡®å®", |
| | | cancelButtonText: "åæ¶", |
| | | type: "warning" |
| | | }).then(function() { |
| | | return delJob(jobIds); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.msgSuccess("å 餿å"); |
| | | }) |
| | | }, |
| | | /** å¯¼åºæé®æä½ */ |
| | | 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; |
| | | }) |
| | | } |
| | | } |
| | | }; |
| | | </script> |