|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084 |
- <template>
- <div class="app-container">
- <div style="margin-bottom:10px">
- <el-button type="success" @click="addBtn">新增</el-button>
- <el-button type="info" @click="goSearchLogs">日志</el-button>
- </div>
- <!--搜索-->
- <el-form class="mt_15" ref="form" inline size="small">
- <el-form-item label="任务名称">
- <el-input v-model="searchParm.jobName" clearable placeholder="任务名称"></el-input>
- </el-form-item>
- <el-date-picker
- v-model="searchTime"
- type="daterange"
- range-separator=":"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- style="width:270px"
- ></el-date-picker>
- <el-form-item label="状态">
- <el-select v-model="searchParm.isPause" placeholder="请选择">
- <el-option
- v-for="item in isPauseList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="goSearchByCondition">搜索</el-button>
- <el-button type="warning" @click="resetForm">重置</el-button>
- </el-form-item>
- </el-form>
- <!--表格渲染-->
- <el-table
- ref="table"
- border
- size="small"
- :data="list"
- :header-cell-style="{textAlign:'center'}"
- :cell-style="{textAlign:'center'}"
- >
- <el-table-column label="序号" type="index" width="50" />
- <el-table-column label="任务ID" prop="jobId" />
- <el-table-column label="任务名称" prop="jobName" />
- <el-table-column label="SpringBean名称" prop="beanName" />
- <el-table-column label="方法名称" prop="methodName" />
- <el-table-column label="参数" prop="params">
- <template slot-scope="scope">
- <el-button type="text" @click="showParams(scope.row)">查看参数</el-button>
- </template>
- </el-table-column>
- <el-table-column label="cron表达式" prop="cronExpression" />
- <el-table-column label="运行状态" prop="isPause">
- <template slot-scope="scope">{{ scope.row.isPause | getStatus}}</template>
- </el-table-column>
- <el-table-column label="描述" prop="description" />
- <el-table-column label="创建时间" prop="createTime" />
- <el-table-column label="操作" width="310">
- <template slot-scope="scope">
- <!-- <el-button type="info" @click="modifyStatus(scope.row.jobId)">恢复</el-button> -->
- <el-button
- type="info"
- @click="modifyStatus(scope.row.jobId)"
- >{{scope.row.isPause ?'恢复':'暂停'}}</el-button>
- <el-button type="primary" @click="executionById(scope.row.jobId)">执行</el-button>
- <el-button type="warning" @click="editById(scope.row)">修改</el-button>
- <el-button type="danger" @click="delById(scope.row.jobId)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--分页-->
- <div class="mt_15">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="searchParm.page"
- :page-sizes="[10, 20, 30, 40, 50]"
- :page-size="searchParm.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total"
- ></el-pagination>
- </div>
-
- <!--新增弹窗-->
- <el-dialog :visible.sync="dialogAddVisible" :title="dialogAddTitle" center width="45%">
- <div class="dialog-content">
- <el-form ref="ruleForm" size="small" :model="addParm" :rules="rules" label-width="130px">
- <el-form-item label="任务名称" prop="jobName">
- <el-input v-model="addParm.jobName" clearable></el-input>
- </el-form-item>
- <el-form-item label="SpringBean名称" hidden prop="beanName">
- <el-input v-model="editParm.beanName" clearable></el-input>
- </el-form-item>
- <el-form-item label="方法名称" hidden prop="methodName">
- <el-input v-model="editParm.methodName" clearable></el-input>
- </el-form-item>
- <el-form-item label="描述" prop="description">
- <el-input v-model="addParm.description" clearable></el-input>
- </el-form-item>
- <el-form-item label="cron表达式" prop="cronExpression">
- <el-input v-model="addParm.cronExpression" clearable></el-input>
- </el-form-item>
- <el-form-item label="子任务ID" prop="subTask">
- <el-input v-model="addParm.subTask" clearable></el-input>
- </el-form-item>
- <el-form-item label="负责人" prop="personInCharge">
- <el-input v-model="addParm.personInCharge" clearable></el-input>
- </el-form-item>
- <el-form-item label="报警邮箱" prop="email">
- <el-input v-model="addParm.email" clearable></el-input>
- </el-form-item>
- <el-form-item label="失败后暂停" prop="pauseAfterFailure">
- <el-select v-model="addParm.pauseAfterFailure" placeholder="请选择">
- <el-option
- v-for="item in pauseAfterFailureList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>`
- </el-form-item>
- <el-form-item label="运行状态" prop="isPause">
- <el-select v-model="addParm.isPause" placeholder="请选择">
- <el-option
- v-for="item in isPauseList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="设备名称" prop="rebotName">
- <el-input v-model="addParm.rebotName" disabled="true" style="width:200px" />
- <el-button
- type="primary"
- icon="el-icon-search"
- @click="goSearchRebot"
- style="width:130px"
- >请选择设备</el-button>
- </el-form-item>
- <el-form-item label="应用名称" prop="applyId">
- <el-select v-model="addParm.applyId" @change="applyClick" placeholder="请选择">
- <el-option
- v-for="item in applys"
- :key="item.name"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <div id="app">
- <el-form class="base-form" ref="baseForm" :model="baseForm">
- <el-table
- ref="table-input"
- class="table"
- highlight-current-row
- :data="baseForm.demoList"
- @row-click="selectItem"
- >
- <el-table-column label="参数名称">
- <template slot-scope="scope">
- <el-form-item :prop="'demoList.'+scope.$index+'.name'" class="all">
- <el-input v-model="scope.row.name" placeholder="请输入"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="参数值">
- <template slot-scope="scope">
- <el-form-item :prop="'demoList.'+scope.$index+'.value'" class="all">
- <el-input v-model="scope.row.value" placeholder="请输入"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="参数类型">
- <template slot-scope="scope">
- <el-form-item :prop="'demoList.'+scope.$index+'.type'" class="all">
- <el-input v-model="scope.row.type" placeholder="请输入"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop label="操作">
- <template>
- <div class="flex-c-a">
- <el-button type="primary" @click="addLine()">增加</el-button>
- <el-button type="danger">删除</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </el-form>
- </div>
- </div>
- <span slot="footer">
- <el-button type="info" @click="dialogAddVisible=flase">取消</el-button>
- <el-button type="primary" @click="sureAdd">确认</el-button>
- </span>
- </el-dialog>
-
- <!--修改弹窗-->
- <el-dialog :visible.sync="dialogEditVisible" :title="dialogEditTitle" center width="45%">
- <div class="dialog-content">
- <el-form ref="ruleForm" size="small" :model="editParm" :rules="rules" label-width="130px">
- <el-form-item label="任务名称" prop="jobName">
- <el-input v-model="editParm.jobName" clearable></el-input>
- </el-form-item>
- <el-form-item label="描述" prop="description">
- <el-input v-model="editParm.description" clearable></el-input>
- </el-form-item>
- <el-form-item label="SpringBean名称" hidden prop="beanName">
- <el-input v-model="editParm.beanName" clearable></el-input>
- </el-form-item>
- <el-form-item label="方法名称" hidden prop="methodName">
- <el-input v-model="editParm.methodName" hidden clearable></el-input>
- </el-form-item>
- <el-form-item label="cron表达式" prop="cronExpression">
- <el-input v-model="editParm.cronExpression" clearable></el-input>
- </el-form-item>
- <el-form-item label="子任务ID" prop="subTask">
- <el-input v-model="editParm.subTask" clearable></el-input>
- </el-form-item>
- <el-form-item label="负责人" prop="personInCharge">
- <el-input v-model="editParm.personInCharge" clearable></el-input>
- </el-form-item>
- <el-form-item label="报警邮箱" prop="email">
- <el-input v-model="editParm.email" clearable></el-input>
- </el-form-item>
- <el-form-item label="失败后暂停" prop="pauseAfterFailure">
- <el-select v-model="editParm.pauseAfterFailure" placeholder="请选择">
- <el-option
- v-for="item in pauseAfterFailureList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>`
- </el-form-item>
- <el-form-item label="运行状态" prop="isPause">
- <el-select v-model="editParm.isPause" placeholder="请选择">
- <el-option
- v-for="item in isPauseList"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="设备名称" prop="rebotName">
- <el-input v-model="editParm.rebotName" disabled="true" style="width:200px" />
- <el-button
- type="primary"
- icon="el-icon-search"
- @click="goSearchRebot"
- style="width:130px"
- >请选择设备</el-button>
- </el-form-item>
- <el-form-item label="应用名称" prop="applyId">
- <el-select v-model="editParm.applyId" @change="applyClick" placeholder="请选择">
- <el-option
- v-for="item in applys"
- :key="item.name"
- :label="item.name"
- :value="item.id"
- ></el-option>
- </el-select>
- </el-form-item>
- </el-form>
- <div id="app">
- <el-form class="base-form" ref="baseForm" :model="baseForm">
- <el-table
- ref="table-input"
- class="table"
- highlight-current-row
- :data="baseForm.demoList"
- @row-click="selectItem"
- >
- <el-table-column label="参数名称">
- <template slot-scope="scope">
- <el-form-item :prop="'demoList.'+scope.$index+'.name'" class="all">
- <el-input v-model="scope.row.name" placeholder="请输入"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="参数值">
- <template slot-scope="scope">
- <el-form-item :prop="'demoList.'+scope.$index+'.value'" class="all">
- <el-input v-model="scope.row.value" placeholder="请输入"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column label="参数类型">
- <template slot-scope="scope">
- <el-form-item :prop="'demoList.'+scope.$index+'.type'" class="all">
- <el-input v-model="scope.row.type" placeholder="请输入"></el-input>
- </el-form-item>
- </template>
- </el-table-column>
- <el-table-column prop label="操作">
- <template>
- <div class="flex-c-a">
- <el-button type="primary" @click="addLine()">增加</el-button>
- <el-button type="danger">删除</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </el-form>
- </div>
- </div>
- <span slot="footer">
- <el-button type="info" @click="dialogEditVisible=false">取消</el-button>
- <el-button type="primary" @click="sureEdit">确认</el-button>
- </span>
- </el-dialog>
-
- <!--日志弹窗-->
- <el-dialog
- width="75%"
- :visible.sync="dialogLogsListVisible"
- :title="dialogLogsListTitle"
- center
- append-to-body
- >
- <!-- 搜索日志 -->
- <el-form class="mt_15" ref="form" inline size="small">
- <el-form-item label="任务名称">
- <el-input v-model="searchLogsParm.jobName" clearable placeholder="任务名称"></el-input>
- </el-form-item>
- <el-date-picker
- v-model="searchLogsTime"
- type="daterange"
- range-separator=":"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- style="width:270px"
- ></el-date-picker>
- <el-form-item label="状态">
- <el-input v-model="searchLogsParm.isSuccess" clearable placeholder="状态"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="goSearchLogsByCondition">搜索</el-button>
- <el-button type="warning" @click="resetLogsForm">重置</el-button>
- </el-form-item>
- </el-form>
- <!--表格渲染-->
- <el-table
- ref="table"
- border
- size="small"
- :data="logsList"
- :header-cell-style="{textAlign:'center'}"
- :cell-style="{textAlign:'center'}"
- >
- <el-table-column label="任务名称" prop="jobName" />
- <el-table-column label="Bean名称" prop="beanName" />
- <el-table-column label="执行方法" prop="methodName" />
- <el-table-column label="参数">
- <template slot-scope="scope">
- <el-button type="text" @click="showParams(scope.row)">查看参数</el-button>
- </template>
- </el-table-column>
- <el-table-column label="cron表达式" prop="cronExpression" />
- <el-table-column label="异常详情" prop="exceptionDetail">
- <template slot-scope="scope">
- <el-button type="text" @click="showDetail(scope.row)">查看异常详情</el-button>
- </template>
- </el-table-column>
- <el-table-column label="耗时(毫秒)" prop="time" />
- <el-table-column label="状态" prop="isSuccess">
- <template slot-scope="scope">{{ scope.row.isSuccess | getLogIsSuccess}}</template>
- </el-table-column>
- <el-table-column label="创建日期" prop="createTime" />
- </el-table>
- <!--分页-->
- <div class="mt_15">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="searchLogsParm.page"
- :page-sizes="[10, 20, 30, 40, 50]"
- :page-size="searchLogsParm.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="logsTotal"
- ></el-pagination>
- </div>
- </el-dialog>
-
- <!--设备选择弹窗-->
- <el-dialog
- width="75%"
- :visible.sync="dialogRebotListVisible"
- :title="dialogRebotListTitle"
- center
- append-to-body
- >
- <!--搜索-->
- <el-form class="mt_15" ref="form" inline size="small">
- <el-form-item label="机器人账号">
- <el-input v-model="searchRebotParm.accountName" clearable placeholder="机器人账号"></el-input>
- </el-form-item>
- <el-form-item label="uuid">
- <el-input v-model="searchRebotParm.robotClientUuid" clearable placeholder="uuid"></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="goSearchRebot">搜索</el-button>
- <el-button type="warning" @click="resetRebotForm">重置</el-button>
- </el-form-item>
- </el-form>
- <!--表格渲染-->
- <el-table
- ref="table"
- border
- size="small"
- :data="rebotList"
- :header-cell-style="{textAlign:'center'}"
- :cell-style="{textAlign:'center'}"
- >
- <el-table-column label="序号" type="index" width="50" />
- <el-table-column label="机器人账号" prop="accountName" />
- <el-table-column label="uuid信息" prop="robotClientUuid" />
- <el-table-column label="状态" prop="status">
- <template slot-scope="scope">{{ scope.row.status | getRebotStatus}}</template>
- </el-table-column>
- <el-table-column label="创建时间" prop="createdAt" />
- <el-table-column label="修改时间" prop="updatedAt" />
- <el-table-column label="操作" width="220">
- <template slot-scope="scope">
- <el-button type="success" @click="pickRebot(scope.row)">选中</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--分页-->
- <div class="mt_15">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :current-page="searchRebotParm.page"
- :page-sizes="[10, 20, 30, 40, 50]"
- :page-size="searchRebotParm.pageSize"
- layout="total, sizes, prev, pager, next, jumper"
- :total="this.rebotTotal"
- ></el-pagination>
- </div>
- </el-dialog>
-
- <!--參數詳情-->
- <el-dialog
- :title="dialogParamTitle"
- :visible.sync="dialogParamVisible"
- width="30%"
- style="overflow: hidden"
- >
- <div style="overflow-y: auto; height: 310px">
- <json-viewer :value="paramJsonData" :expand-depth="5" copyable boxed sort></json-viewer>
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="dialogParamVisible = false">确定</el-button>
- </span>
- </el-dialog>
-
- <!--异常详情-->
- <el-dialog :title="dialogExceTitle" :visible.sync="dialogExceVisible" width="30%">
- <div v-text="this.exceptionDetail" />
- </el-dialog>
- </div>
- </template>
- <script>
- import {
- getList,
- add,
- editById,
- delById,
- getById,
- modifyStatus,
- executionById,
- getLogsList
- } from "@/api/group/quartzJob";
- import { getAll } from "@/api/group/apply";
- import { getFreeList } from "@/api/group/rebot";
- import Vue from "vue";
- import JsonViewer from "vue-json-viewer";
- Vue.use(JsonViewer);
- export default {
- filters: {
- getStatus: function(value) {
- if (value == 1) {
- return "已暂停";
- } else if (value == 0) {
- return "运行中";
- }
- },
- getLogIsSuccess: function(value) {
- if (value == 1) {
- return "成功";
- } else if (value == 0) {
- return "失败";
- }
- },
- getRebotStatus: function(value) {
- if (value == 0) {
- return "未占用";
- } else if (value == 1) {
- return "已占用";
- }
- }
- },
- // 数据
- data() {
- return {
- searchParm: {
- page: 1,
- pageSize: 10,
- sort: "job_id",
- order: "desc",
- jobName: null,
- isPause: null,
- sTime: null,
- eTime: null
- },
- searchLogsParm: {
- page: 1,
- pageSize: 10,
- sort: "log_id",
- order: "desc",
- jobName: null,
- isSuccess: null,
- sTime: null,
- eTime: null
- },
- searchRebotParm: {
- page: 1,
- pageSize: 10,
- sort: "id",
- order: "desc",
- accountName: null,
- robotClientUuid: null
- },
- logsTotal: 0,
- rebotTotal: 0,
- total: 0,
- logsList: [],
- list: [],
- baseForm: {
- demoList: [
- {
- name: null,
- value: null,
- type: null
- }
- ]
- },
- newParams: {
- name: "",
- value: "",
- type: ""
- },
- index: 0,
- //新增、修改弹窗判断:1新增、2修改
- isEdit: 0,
- rebotList: [],
- applys: [],
- searchTime: "",
- searchLogsTime: "",
- paramJsonData: "",
- params: [],
- taskParam: {
- name: null,
- value: null,
- type: null
- },
- requestParams: {
- accountName: null,
- applyId: null,
- params: null
- },
- exceptionDetail: "",
- dialogAddVisible: false,
- dialogAddTitle: "新增",
- dialogEditVisible: false,
- dialogEditTitle: "修改",
- dialogImportVisible: false,
- dialogLogsListTitle: "操作日志",
- dialogLogsListVisible: false,
- dialogRebotListTitle: "设备日志",
- dialogRebotListVisible: false,
- dialogParamVisible: false,
- dialogParamTitle: "参数详情",
- dialogExceVisible: false,
- dialogExceTitle: "异常详情",
- pauseAfterFailureList: [
- {
- value: 1,
- label: "是"
- },
- {
- value: 0,
- label: "否"
- }
- ],
- isPauseList: [
- {
- value: 1,
- label: "已暂停"
- },
- {
- value: 0,
- label: "运行中"
- }
- ],
- logIsSuccess: [
- {
- value: 0,
- label: "失败"
- },
- {
- value: 1,
- label: "成功"
- }
- ],
- addListDemo: [],
- addParm: {
- jobId: null,
- jobName: null,
- description: null,
- beanName: null,
- methodName: null,
- cronExpression: null,
- subTask: null,
- personInCharge: null,
- email: null,
- pauseAfterFailure: null,
- isPause: null,
- rebotName: null,
- applyId: null,
- params: null
- },
- editParm: {
- jobId: null,
- jobName: null,
- description: null,
- beanName: null,
- methodName: null,
- cronExpression: null,
- subTask: null,
- personInCharge: null,
- email: null,
- pauseAfterFailure: null,
- isPause: null,
- params: null,
- applyId: null,
- rebotName: null
- },
- testTest: null,
- testTestStr: "",
- ruleForm: {
- contntryShort: null,
- ipAddress: null,
- parentIpAddress: null,
- port: null,
- name: null,
- pwd: null,
- vpsType: null,
- dealer: null,
- mac: null,
- status: null
- },
- rules: {
- jobName: [
- { required: true, message: "请输入任务名称", trigger: "blur" }
- ],
- description: [
- { required: true, message: "请输入任务描述", trigger: "blur" }
- ],
- // beanName: [
- // { required: true, message: '请输入SpringBean名称', trigger: 'blur' }
- // ],
- // methodName: [
- // { required: true, message: '请输入方法名称', trigger: 'blur' }
- // ],
- cronExpression: [
- { required: true, message: "请输入cron表达式", trigger: "blur" }
- ],
- personInCharge: [
- { required: true, message: "请输入负责人", trigger: "blur" }
- ],
- pauseAfterFailure: [
- { required: true, message: "请选择失败后是否暂停", trigger: "blur" }
- ],
- isPause: [
- { required: true, message: "请选择运行状态", trigger: "blur" }
- ],
- rebotName: [{ required: true, message: "请选择设备", trigger: "blur" }],
- applyId: [{ required: true, message: "请选择应用", trigger: "blur" }]
- },
- paramsRules: {
- name: [
- {
- required: true,
- message: "请输入参数名称",
- trigger: "blur"
- }
- ],
- value: [
- {
- required: true,
- message: "请输入参数值",
- trigger: "blur"
- }
- ],
- type: [
- {
- required: true,
- message: "请输入参数类型",
- trigger: "blur"
- }
- ]
- }
- };
- },
- // 调用
- created() {
- this.goSearch();
- },
- //方法
- methods: {
- showDetail(data) {
- if (data.exceptionDetail == null || data.exceptionDetail == "") {
- this.$alert("无异常", "异常详情", {
- confirmButtonText: "确定",
- closeOnClickModal: true,
- closeOnPressEscape: true
- });
- } else {
- this.dialogExceVisible = true;
- this.exceptionDetail = data.exceptionDetail;
- }
- },
- showParams(data) {
- console.log(data);
- if (data.params == null || data.params == "") {
- this.$alert("无参数", "参数详情", {
- confirmButtonText: "确定",
- closeOnClickModal: true,
- closeOnPressEscape: true
- });
- } else {
- this.paramJsonData = JSON.parse(data.params);
- this.dialogParamVisible = true;
- }
- },
- applyClick(value) {
- this.requestParams.applyId = value;
- console.log(this.requestParams);
- },
- //重置
- resetForm() {
- this.searchParm.jobName = null;
- this.searchParm.isPause = null;
- this.searchParm.sTime = null;
- this.searchParm.eTime = null;
- this.searchTime = null;
- this.goSearch();
- },
- resetLogsForm() {
- this.searchLogsParm.jobName = null;
- this.searchLogsParm.isSuccess = null;
- this.searchLogsParm.sTime = null;
- this.searchLogsParm.eTime = null;
- this.searchLogsTime = null;
- this.goSearchLogs();
- },
- resetRebotForm() {
- this.searchRebotParm.accountName = null;
- this.searchRebotParm.robotClientUuid = null;
- this.goSearchRebot();
- },
- // 查询
- goSearchByCondition() {
- this.searchParm.sTime = this.searchTime[0];
- this.searchParm.eTime = this.searchTime[1];
- console.log(this.searchParm);
- this.goSearch();
- },
- goSearch() {
- this.searchParm.page = 1;
- this.getAllApply();
- this.getDataList();
- },
- goSearchLogsByCondition() {
- this.searchLogsParm.sTime = this.searchLogsTime[0];
- this.searchLogsParm.eTime = this.searchLogsTime[1];
- this.goSearchLogs();
- },
- goSearchLogs() {
- this.dialogLogsListVisible = true;
- this.searchLogsParm.page = 1;
- this.getLogsDataList();
- },
- goSearchRebot() {
- this.dialogRebotListVisible = true;
- this.searchRebotParm.page = 1;
- this.getRebotDataList();
- },
- // 分页获取表格数据
- getDataList() {
- getList(this.searchParm)
- .then(res => {
- if (res.code == 200) {
- this.list = res.data.list;
- this.total = res.data.total;
- }
- })
- .catch(err => {
- console.log(err);
- });
- },
- getLogsDataList() {
- getLogsList(this.searchLogsParm)
- .then(res => {
- console.log(res);
- if (res.code == 200) {
- this.logsList = res.data.list;
- this.logsTotal = res.data.total;
- }
- })
- .catch(err => {
- console.log(err);
- });
- },
- getRebotDataList() {
- getFreeList(this.searchRebotParm)
- .then(res => {
- console.log(res);
- if (res.code == 200) {
- this.rebotList = res.data.list;
- this.rebotTotal = res.data.total;
- }
- })
- .catch(err => {
- console.log(err);
- });
- },
- getAllApply() {
- getAll().then(res => {
- if (res.code == 200) {
- this.applys = res.data;
- }
- });
- },
- // 新增
- addBtn() {
- this.addParm = {
- id: null,
- jobId: null,
- jobName: null,
- description: null,
- beanName: null,
- methodName: null,
- cronExpression: null,
- subTask: null,
- personInCharge: null,
- email: null,
- pauseAfterFailure: null,
- isPause: null,
- params: null,
- applyId: null,
- rebotName: null
- };
-
- this.baseForm.demoList = [
- {
- name: "",
- value: "",
- type: ""
- }
- ];
- this.requestParams.applyId = "";
- this.requestParams.accountName = "";
- this.requestParams.params = "";
- this.addParm.params = JSON.stringify(this.requestParams);
- this.isEdit = 1;
- this.dialogAddVisible = true;
- },
- // 确认新增
- sureAdd() {
- this.$refs.baseForm.validate(valid => {
- if (valid) {
- this.requestParams.params = this.baseForm.demoList;
- this.addParm.params = JSON.stringify(this.requestParams);
- add(this.addParm)
- .then(res => {
- if (res.code == 200) {
- this.dialogAddVisible = false;
- this.$message.success("新增成功!");
- this.getDataList();
- } else if (res.code == -1) {
- this.$message.warning(res.message);
- }
- })
- .catch(err => {
- console.log(err);
- });
- } else {
- this.$message.warning("请输入所有必填项");
- }
- });
- },
- // 根据id删除
- delById(id) {
- this.$confirm("确认删除?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- delById({ id })
- .then(res => {
- if (res.code == 200) {
- this.$message.success("删除成功!");
- this.getDataList();
- }
- })
- .catch(err => {
- console.log(err);
- });
- })
- .catch(() => {
- this.$message.info("取消删除");
- });
- },
- executionById(id) {
- executionById({ id })
- .then(res => {
- if (res.code == 200) {
- this.$message.success("执行成功");
- this.getDataList;
- } else {
- this.$message.error("执行失败");
- }
- })
- .catch(err => {
- console.log(err);
- });
- },
- // 修改
- editById(data) {
- getById({ id: data.jobId })
- .then(res => {
- if (res.code == 200) {
- this.editParm.jobId = res.data.jobId;
- this.editParm.jobName = res.data.jobName;
- this.editParm.description = res.data.description;
- this.editParm.beanName = res.data.beanName;
- this.editParm.methodName = res.data.methodName;
- this.editParm.cronExpression = res.data.cronExpression;
- this.editParm.subTask = res.data.subTask;
- this.editParm.personInCharge = res.data.personInCharge;
- this.editParm.email = res.data.email;
- this.editParm.pauseAfterFailure = res.data.pauseAfterFailure;
- this.editParm.isPause = res.data.isPause;
- this.editParm.params = res.data.params;
- this.requestParams = JSON.parse(this.editParm.params);
- this.editParm.rebotName = this.requestParams.accountName;
- this.editParm.applyId = this.requestParams.applyId;
- console.log(this.requestParams.params);
- if (this.requestParams.params.length != 0) {
- this.baseForm.demoList = this.requestParams.params;
- } else {
- this.baseForm.demoList = [
- {
- name: "",
- value: "",
- type: ""
- }
- ];
- }
-
- this.isEdit = 2;
- this.dialogEditVisible = true;
- this.$refs.ruleForm.clearValidate();
- }
- })
- .catch(err => {
- console.log(err);
- });
- },
- // 确认修改
- sureEdit() {
- this.$refs.baseForm.validate(valid => {
- if (valid) {
- this.requestParams.params = this.baseForm.demoList;
- this.editParm.params = JSON.stringify(this.requestParams);
- editById(this.editParm)
- .then(res => {
- if (res.code == 200) {
- this.dialogEditVisible = false;
- this.$message.success("修改成功!");
- this.getDataList();
- }
- })
- .catch(err => {
- console.log(err);
- });
- } else {
- this.$message.warning("请输入所有必填项");
- }
- });
- },
- modifyStatus(id) {
- modifyStatus({ id })
- .then(res => {
- if (res.code == 200) {
- this.$message.success("更改成功!");
- this.getDataList();
- }
- })
- .catch(err => {
- console.log(err);
- });
- },
- pickRebot(data) {
- if (this.isEdit == 1) {
- this.addParm.rebotName = data.accountName;
- } else if (this.isEdit == 2) {
- this.editParm.rebotName = data.accountName;
- }
- this.requestParams.accountName = data.accountName;
- this.dialogRebotListVisible = false;
- this.$message.success("选择成功");
- },
- // 分页
- handleSizeChange(val) {
- console.log(`每页 ${val} 条`);
- this.searchParm.pageSize = val;
- this.getDataList();
- },
- handleCurrentChange(val) {
- console.log(`当前页: ${val}`);
- this.searchParm.page = val;
- this.getDataList();
- },
- // 选中某一行修改或移除
- selectItem(row, column, event) {
- this.selectedFundRow = row;
- if (event.target.innerText == "删除") {
- this.removeFundBtn(this.selectedFundRow);
- }
- },
- // 删除指定行
- removeFundBtn(params) {
- this.baseForm.demoList = this.baseForm.demoList.filter(ele => {
- var flag = false;
- // 如果不一致,则保留该行
- for (const key in params) {
- if (ele[key] != params[key]) {
- flag = true;
- break;
- }
- }
- return flag;
- });
- // 如果全部删除后没有可以点击的一行了,需要加一行空行
- if (!this.baseForm.demoList.length) {
- this.addLine();
- }
- },
- // 增加一个空行, 用于录入或显示第一行
- addLine() {
- const newParams = {
- name: "",
- value: "",
- type: ""
- };
- this.index++;
- this.baseForm.demoList.push(newParams);
- }
- }
- };
- </script>
-
- <style rel="stylesheet/scss" lang="scss" scoped>
- </style>
|