123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- <template>
- <div>
- <div class="header">
- <el-form label-width="120px">
- <div style="display: flex; padding: 10px">
- <el-form-item label="任务名称:">
- <el-input
- v-model="form.taskName"
- placeholder="请输入任务名称"
- style="width: 200px"
- ></el-input>
- </el-form-item>
- <el-form-item label="任务组名:">
- <el-select
- v-model="form.taskGroupName"
- placeholder="请输入任务组名"
- style="width: 200px"
- >
- <el-option
- v-for="item in taskGroupOptions"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="任务状态:">
- <el-select
- v-model="form.taskStatus"
- placeholder="请选择任务状态"
- style="width: 200px"
- >
- <el-option
- v-for="item in taskStatusOptions"
- :key="item.value"
- :value="item.value"
- :label="item.label"
- ></el-option>
- </el-select>
- </el-form-item>
- <el-button class="reset-btn" @click="resetEvent">重置</el-button>
- <el-button class="search-btn" @click="searchEvent">查询</el-button>
- </div>
- </el-form>
- </div>
- <div class="content">
- <div class="content-inner">
- <!-- <el-button class="blue-btn" @click="addEvent">新增</el-button> -->
- <!-- <el-button class="blue-btn" @click="modifyEvent">修改</el-button> -->
- <el-button class="delete-btn" @click="batchDelete">批量删除</el-button>
- </div>
- <el-table
- ref="multipleTable"
- :data="tableData"
- tooltip-effect="dark"
- :header-cell-style="{ textAlign: 'center' }"
- :cell-style="{ textAlign: 'center' }"
- style="width: 100%"
- height="350"
- @selection-change="handleSelectionChange"
- >
- <el-table-column type="selection" width="50"> </el-table-column>
- <el-table-column prop="taskID" label="任务编号"> </el-table-column>
- <el-table-column prop="taskName" label="任务名称"> </el-table-column>
- <el-table-column prop="taskGroupName" label="任务组名">
- </el-table-column>
- <el-table-column prop="taskDescription" label="任务描述">
- </el-table-column>
- <el-table-column prop="cron" label="cron 执行表达式"> </el-table-column>
- <el-table-column prop="status" label="状态">
- <template slot-scope="scope">
- <el-switch
- v-model="scope.row.status"
- active-color="#13ce66"
- inactive-color="#ff4949"
- ></el-switch>
- </template>
- </el-table-column>
- <el-table-column prop="operation" label="操作">
- <template slot-scope="scope">
- <!-- <el-button
- v-show="scope.row.taskID == null ? false : true"
- size="mini"
- type="text"
- >查看</el-button
- > -->
- <el-button
- v-show="scope.row.taskID == null ? false : true"
- size="mini"
- type="text"
- @click="alterTaskEvent(scope.row)"
- >编辑</el-button
- >
- <el-button
- v-show="scope.row.taskID == null ? false : true"
- size="mini"
- type="text"
- @click="deleteEvent(scope.row)"
- >删除</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div class="bottom">
- <page class="page" :paginationData="paginationData"></page>
- </div>
- <alterTask ref="altertask" @submitForm="submitForm"></alterTask>
- </div>
- </template>
- <script>
- import checkbox from "@/components/Checkbox/index";
- import page from "@/components/pagination/index";
- import alterTask from "../messageDialog/alterTask";
- import publicFunc from "@/utils/publicFunc";
- import { getTaskList } from "@/api/security/systemMonitor";
- export default {
- components: { checkbox, page, alterTask },
- data() {
- return {
- input: "",
- show: true,
- form: {
- taskName: "",
- taskGroupName: "",
- taskStatus: "",
- },
- tableData: [
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "系统",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "true",
- },
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "默认",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "true",
- },
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "系统",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "false",
- },
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "系统",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "false",
- },
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "系统",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "false",
- },
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "系统",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "false",
- },
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "系统",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "false",
- },
- {
- id: publicFunc.buildGuid("video"),
- taskID: "1",
- taskName: "采集视频云平台",
- taskGroupName: "系统",
- taskDescription: "xxx.xxx.xxx.xxx",
- cron: "001***?",
- status: "false",
- },
- ],
- taskStatusOptions: [
- {
- value: "",
- label: "不限",
- },
- {
- value: 1,
- label: "暂停",
- },
- {
- value: 0,
- label: "正常",
- },
- ],
- taskGroupOptions: [
- {
- value: "",
- label: "不限",
- },
- {
- value: 1,
- label: "系统",
- },
- ],
- multipleSelection: [],
- currentPageSize: 10,
- currentPage: 1,
- paginationData: {
- pageSize: 10,
- pagerCount: 5,
- currentPage: 1,
- pageSizes: [5, 10, 20, 30],
- total: 30,
- currentChange: (val) => {
- this.getTableData(val);
- },
- handleSizeChange: (val) => {
- this.handleSizeChange(val);
- },
- },
- };
- },
- mounted() {
- this.initData();
- },
- methods: {
- initData() {
- this.getTableData(1);
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- cancleChecked() {
- this.$refs.multipleTable.clearSelection();
- },
- alterTaskEvent(data) {
- this.$refs.altertask.dialogVisible = true;
- this.$refs.altertask.form.taskID = data.taskID;
- this.$refs.altertask.form.name = data.taskName;
- this.$refs.altertask.form.groupName = data.taskGroupName;
- this.$refs.altertask.form.cron_expression = data.cron;
- },
- resetEvent() {
- this.form.taskName = "";
- this.form.taskGroupName = "";
- this.form.taskStatus = "";
- },
- searchEvent() {
- console.log(this.form);
- this.getTableData(1);
- },
- getTableData(val) {
- this.tableData = [];
- getTaskList(
- val,
- this.currentPageSize,
- this.form.taskName,
- this.form.taskGroupName,
- this.form.taskStatus
- ).then((res) => {
- if (res.data.code === 0) {
- let data = res.data.data.data;
- this.paginationData.total = data.total;
- this.tableData = data.list.map((v) => {
- return {
- taskID: v.id,
- taskName: v.name,
- taskGroupName: v.groupType === 1 ? "系统" : "默认",
- taskDescription: v.description,
- cron: v.cronExpression,
- status: v.status === 0 ? true : false,
- };
- });
- }
- });
- },
- handleSizeChange() {},
- deleteEvent(data) {
- this.tableData = this.tableData.filter((v) => {
- return v.taskID !== data.taskID;
- });
- },
- addEvent() {},
- modifyEvent() {},
- batchDelete() {
- console.log(this.multipleSelection);
- let selectedIds = this.multipleSelection.map((v) => v.taskID);
- this.tableData = this.tableData.filter(
- (v) => !selectedIds.includes(v.taskID)
- );
- },
- submitForm(data) {
- this.$refs.altertask.dialogVisible = false;
- this.tableData = this.tableData.map((v) => {
- if (v.taskID == data.taskID) {
- let name = data.name;
- let groupName = data.groupName;
- return {
- taskID: v.taskID,
- taskName: name,
- taskGroupName: groupName,
- taskDescription: v.taskDescription,
- cron: data.cron_expression,
- };
- } else {
- return {
- taskID: v.taskID,
- taskName: v.taskName,
- taskGroupName: v.taskGroupName,
- taskDescription: v.taskDescription,
- cron: v.cron,
- status: v.status,
- };
- }
- });
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .header {
- margin: 0 2.5%;
- height: 60px;
- background-color: #fafafa;
- position: relative;
- .reset-btn,
- .search-btn {
- height: 30px;
- width: 80px;
- position: absolute;
- color: #fff;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .reset-btn {
- top: 10px;
- background-color: #b3b3b3;
- right: 130px;
- }
- .search-btn {
- top: 10px;
- background-color: #2ea8e6;
- right: 25px;
- }
- .el-form-item {
- margin-bottom: 0 !important;
- margin-right: 60px !important;
- /deep/.el-form-item {
- margin-right: 50px;
- margin-bottom: 0;
- }
- /deep/.el-form-item__content {
- margin-left: 120px;
- }
- }
- }
- .content {
- width: 95%;
- position: absolute;
- margin-top: 30px;
- margin-left: 2.5%;
- margin-right: 2.5%;
- height: 400px;
- &-inner {
- height: 30px;
- width: 100%;
- display: flex;
- align-items: center;
- .blue-btn,
- .delete-btn {
- width: 80px;
- height: 30px;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 10px;
- color: #fff;
- border-radius: 3px;
- }
- .blue-btn {
- background-color: #2ea8e6;
- }
- .delete-btn {
- background: #b3b3b3;
- }
- }
- .el-table {
- position: absolute;
- top: 30px;
- left: 0;
- width: 100%;
- height: calc(100% - 30px);
- border: 1px solid #f0f2f2;
- margin-top: 10px;
- font-size: 0.95rem;
- font-family: PingFang SC;
- font-weight: 500;
- color: #b2b2b2;
- background: rgba(255, 255, 255, 0.8);
- /deep/th {
- background: #f7fbff;
- }
- /deep/.el-checkbox {
- color: #b2b2b2;
- .el-checkbox__input.is-checked + .el-checkbox__label {
- color: #2ea8e6;
- }
- .el-checkbox__input.is-checked .el-checkbox__inner::after {
- width: 70%;
- height: 70%;
- background: #2ea8e6;
- border-radius: 0;
- transform: rotate(0deg) scaleY(1);
- position: static;
- // border: 1px solid #8DD9FF;
- }
- .el-checkbox__inner {
- border: 1px solid #8dd9ff;
- background: rgba(0, 170, 255, 0);
- display: flex;
- align-items: center;
- justify-content: center;
- position: static;
- &::after {
- transition: 0ms;
- }
- }
- .el-checkbox__label {
- padding-left: 0;
- font-size: 15px;
- position: absolute;
- top: 1px;
- left: 25px;
- }
- }
- }
- }
- .el-select {
- width: 80px;
- margin-right: 20px;
- }
- .bottom {
- position: absolute;
- bottom: 10px;
- left: 50px;
- height: 50px;
- width: 95%;
- line-height: 20px;
- background-color: rgba(255, 255, 255, 1);
- text-align: center;
- }
- </style>
|