You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

815 lines
21 KiB

<template>
<CardBox
class="card-page"
:showTitle="false"
>
<div class="page-container">
<el-form
:model="queryParams"
ref="queryForm"
:inline="true"
label-width="68px"
>
<el-form-item label="方案名称" prop="taskName">
<el-input
v-model="queryParams.taskName"
placeholder="请输入方案名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="区域名称" prop="areaName">
<el-select
v-model="queryParams.areaName"
filterable
clearable
placeholder="请选择区域"
@change="handleQuery"
>
<el-option
v-for="(item, index) in areaList"
:key="index"
:label="item.dictLabel"
:value="item.dictValue"
>
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="区域名称" prop="areaName">
<el-input
v-model="queryParams.areaName"
placeholder="请输入区域名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item> -->
<!--
<el-form-item label="状态">
<el-select v-model="queryParams.isenable" placeholder="请选择" clearable>
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="方案有效期" label-width="100px">
<el-date-picker v-model="dateRange" size="small" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" :picker-options="dateRangePickerOptions" range-separator="-" start-placeholder="开始日期"
end-placeholder="结束日期" :clearable="true"></el-date-picker>
</el-form-item>
<el-form-item label="创建时间">
<el-date-picker v-model="dateRange2" size="small" style="width: 240px" value-format="yyyy-MM-dd"
type="daterange" :picker-options="dateRangePickerOptions2" range-separator="-" start-placeholder="开始日期"
end-placeholder="结束日期" :clearable="true"></el-date-picker>
</el-form-item> -->
<el-form-item>
<el-button
class="task-toolbar-btn"
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button
class="task-toolbar-btn"
type="primary"
icon="el-icon-plus"
size="mini"
@click="linkUrl"
>添加</el-button
>
<!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
> -->
</el-form-item>
</el-form>
<div class="table-card" ref="tableCardRef">
<el-table
v-loading="loading"
:data="dataList"
class="card-table"
ref="tableRef"
border
stripe
:height="tableHeight"
@header-dragend="handleHeaderDragend"
>
<el-table-column
label="序号"
type="index"
width="60"
align="center"
:index="table_index"
:resizable="false"
/>
<el-table-column label="方案名称" align="left" prop="taskName" min-width="360" header-align="center" show-overflow-tooltip :resizable="true" />
<el-table-column label="点位数" align="center" prop="totalPoints" width="90" :resizable="true" />
<el-table-column label="时间" align="center" prop="createTime" width="170" show-overflow-tooltip :resizable="true" />
<el-table-column
label="区域名称"
align="center"
prop="areaName"
min-width="180"
:resizable="true"
>
<template slot-scope="scope">
<el-tooltip
:content="scope.row.areaName || ''"
placement="top"
popper-class="patrol-plan-area-tooltip"
>
<span class="area-name-cell">{{ scope.row.areaName || "-" }}</span>
</el-tooltip>
</template>
</el-table-column>
<el-table-column
label="策略"
align="center"
prop="executionStatus"
width="100"
:resizable="true"
:formatter="stateFormat"
>
</el-table-column>
<!-- <el-table-column
label="执行任务周期"
align="center"
prop="taskCycle"
:formatter="stateTask"
/> -->
<el-table-column label="操作" align="center" width="150" :resizable="true">
<template slot-scope="scope">
<el-tooltip content="立即执行" placement="bottom">
<i
class="el-icon-finished fss"
@click="controlChange(scope.row)"
></i>
</el-tooltip>
<el-tooltip content="编辑" placement="bottom">
<i class="el-icon-edit fss" @click="editClick(scope.row)"></i>
</el-tooltip>
<el-tooltip content="删除" placement="bottom">
<i class="el-icon-delete fss" @click="delClick(scope.row)"></i>
</el-tooltip>
</template>
</el-table-column>
</el-table>
<CardPagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
</div>
<el-dialog
title="新建方案"
:close-on-click-modal="false"
:close-on-press-escape="false"
:destroy-on-close="true"
:visible.sync="addShow"
width="1800px"
custom-class="card-dialog card-page patrol-plan-dialog"
>
<summaryNewTask
@hideDialog="addShow = false"
v-if="addShow"
@addSuccess="addSuccess"
>
</summaryNewTask>
</el-dialog>
<el-dialog
title="编辑任务"
:close-on-click-modal="false"
:close-on-press-escape="false"
:destroy-on-close="true"
:visible.sync="editShow"
width="1800px"
custom-class="card-dialog card-page patrol-plan-dialog"
>
<summaryEditTask
@hideDialog="editShow = false"
:editid="editid"
@editSuccess="editSuccess"
v-if="editShow"
>
</summaryEditTask>
</el-dialog>
</div>
</CardBox>
</template>
<script>
import {
taskPatrol,
changeStatus,
delTask,
controlChange,
} from "@/api/basedata/area/area";
import { listData } from "@/api/system/dict/data";
import summaryNewTask from "./summary_newTask"
import summaryEditTask from "./summary_editTask"
import debounce from "lodash.debounce";
import CardBox from "../components/cardBox.vue";
import CardPagination from "../components/CardPagination/index.vue";
export default {
name: "InspectionReporter",
dicts: ["patrol_type", "device_type"],
components: { summaryNewTask, summaryEditTask, CardBox, CardPagination },
data() {
return {
editShow: false,
editid: "",
addShow: false,
options: [
{
value: "0",
label: "开启",
},
{
value: "1",
label: "不开启",
},
],
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 总条数
total: 0,
// 数据
dataList: [],
//时间范围
dateRange: [],
dateRangePickerOptions: {
disabledDate(selectDate) {
return new Date().getTime() < selectDate.getTime();
},
},
dateRange2: [],
dateRangePickerOptions2: {
disabledDate(selectDate) {
return new Date().getTime() < selectDate.getTime();
},
},
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
taskName: null,
areaName: null,
isenable: null,
},
// 是否显示报告信息
showReport: false,
//报告信息
reportInfo: {},
// table 高度
tableHeight: null,
areaList: [
],
};
},
created() {
// 防抖
this.setTableHeight = debounce(this.setTableHeight, 300);
window.addEventListener("resize", this.setTableHeight);
this.getList();
window.addEventListener("message", (e) => {
let datasList = JSON.parse(e.data);
if (datasList.id == "editTask") {
this.getList();
}
});
},
mounted() {
this.setTableHeight();
this.getAreaList()
},
destroyed() {
this.setTableHeight.cancel();
window.removeEventListener("resize", this.setTableHeight);
},
methods: {
handleHeaderDragend() {
this.$nextTick(() => {
if (this.$refs.tableRef) {
this.$refs.tableRef.doLayout();
}
});
},
// 获取区域列表
getAreaList() {
var data = {"dictType":"sys_area_list"}
listData(data).then((res) => {
this.areaList = res.rows;
});
},
table_index(index) {
return (
(this.queryParams.pageNum - 1) * this.queryParams.pageSize + index + 1
);
},
delClick(row) {
let taskIds = row.taskId;
this.$modal
.confirm('是否确认删除方案名称为"' + row.taskName + '"的数据项?')
.then(function () {
return delTask(taskIds);
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
})
.catch(() => {});
},
linkUrl() {
this.addShow = true;
},
addSuccess() {
this.addShow = false;
this.$modal.msgSuccess("添加成功");
this.getList();
},
editSuccess() {
this.editShow = false;
this.getList();
},
changeSwitch(row) {
const data = {
taskId: row.taskId,
isenable: row.isenable,
};
changeStatus(data).then((response) => {
if (response.code == 200) {
this.getList();
}
});
},
controlChange(row) {
let result = 1;
let that = this;
this.loading = true;
controlChange(row.taskId)
.then((res) => {
sessionStorage.setItem("ShuanXing", JSON.stringify(result));
that.getList();
this.$modal.msgSuccess("指令下发成功");
// 传值刷新任务列表
var data = {
id: "notstart",
sourceId: "",
targetId: "main_frame_global_modal", // 基座系统弹窗ID
event: {
type: "PING",
data: {},
},
tm: new Date().getTime(), // 时间戳
};
window.top.postMessage(JSON.stringify(data), "*");
})
.finally(() => {
this.loading = false;
});
},
stateFormat(row, column) {
if (row.executionStatus == 0) {
return "立即执行";
} else if (row.executionStatus == 1) {
return "周期执行";
} else if (row.executionStatus == 2) {
return "定时执行";
} else if (row.executionStatus == 3) {
return "已执行";
} else if (row.executionStatus == 4) {
return "间隔执行";
}
},
stateTask(row, column) {
if (row.executionStatus == 1) {
// if (row.taskCycle == 0) {
// // return "按月";
// } else if (row.taskCycle == 1) {
// return "按周";
// }
return "";
}
},
setTableHeight() {
if (!this.$refs.tableCardRef) {
return;
}
this.tableHeight = Math.max(this.$refs.tableCardRef.clientHeight - 48, 160);
},
/** 获取数据列表 */
getList() {
this.loading = true;
// const params = {};
// for (const key in this.queryParams) {
// if (Object.hasOwnProperty.call(this.queryParams, key)) {
// const element = this.queryParams[key];
// if (element) {
// params[key] = element;
// }
// }
// }
if (this.dateRange && this.dateRange.length === 2) {
params.cycleStartTime = this.dateRange[0];
params.cycleEndTime = this.dateRange[1];
}
if (this.dateRange2 && this.dateRange.length2 === 2) {
params.beginTime = this.dateRange2[0];
params.endTime = this.dateRange2[1];
}
taskPatrol(this.queryParams).then((response) => {
this.dataList = response.rows;
this.total = response.total;
this.loading = false;
});
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.dateRange = [];
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
editClick(row) {
this.editid = row.taskId;
sessionStorage.setItem("reportLineId", JSON.stringify(this.editid));
this.editShow = true;
// this.$router.push({ path: "/edit_task", query: { taskId: row.taskId } });
// this.$router.push({name:'edit_task',params:{taskId:row.taskId}});
},
},
};
</script>
<style lang="scss" scoped>
.JiShu {
background-color: RGBA(23, 37, 51, 1);
}
.OuShu {
background-color: RGBA(32, 47, 62, 1);
}
.page-container {
height: 100%;
display: flex;
flex-direction: column;
position: relative;
overflow: hidden;
min-height: 0;
}
.card-page {
height: 100%;
overflow: hidden;
}
.fss {
font-size: 20px;
margin: 0 10px;
cursor: pointer;
color: #0042A6;
}
.fss:hover {
color: #0042A6;
opacity: 0.9;
}
.table-card {
flex: 1;
height: 0;
min-height: 0;
overflow: hidden;
::v-deep .el-card__body {
height: 100%;
}
}
.card-page .el-table td .cell {
color: #000000;
}
.card-page ::v-deep .card-table,
.card-page ::v-deep .el-table {
width: 100% !important;
background: transparent !important;
color: #000000;
border: 0 !important;
border-color: transparent !important;
}
.card-page ::v-deep .el-table__header,
.card-page ::v-deep .el-table__body,
.card-page ::v-deep .el-table__header-wrapper,
.card-page ::v-deep .el-table__body-wrapper,
.card-page ::v-deep .el-table th.el-table__cell,
.card-page ::v-deep .el-table td.el-table__cell {
border: 0 !important;
border-color: transparent !important;
}
.card-page ::v-deep .el-table::before,
.card-page ::v-deep .el-table::after,
.card-page ::v-deep .el-table--border::after,
.card-page ::v-deep .el-table--group::after {
background-color: transparent !important;
}
.card-page ::v-deep .el-table__header-wrapper,
.card-page ::v-deep .el-table__fixed-header-wrapper {
background: #012773 !important;
border: 1px solid #acb5e3 !important;
box-sizing: border-box;
}
.card-page ::v-deep .el-table__header,
.card-page ::v-deep .el-table__body {
min-width: 100% !important;
}
.card-page ::v-deep .el-table__body-wrapper,
.card-page ::v-deep .el-table__fixed,
.card-page ::v-deep .el-table__fixed-right,
.card-page ::v-deep .el-table__empty-block {
background: transparent !important;
background-color: transparent !important;
}
.card-page ::v-deep .el-table th.el-table__cell {
background: #012773 !important;
font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif !important;
font-size: 16px !important;
color: #ffffff !important;
letter-spacing: 0 !important;
line-height: 16px !important;
font-weight: 600 !important;
border-color: transparent !important;
}
.card-page ::v-deep .el-table th.el-table__cell .cell {
font-family: inherit !important;
font-size: inherit !important;
color: inherit !important;
letter-spacing: inherit !important;
line-height: inherit !important;
font-weight: inherit !important;
}
// Keep draggable column boundaries visible in the inspection-plan header.
.card-page ::v-deep .el-table__header-wrapper th.el-table__cell,
.card-page ::v-deep .el-table__fixed-header-wrapper th.el-table__cell {
border-right: 1px solid #acb5e3 !important;
border-left: 0 !important;
}
.card-page ::v-deep .el-table__header-wrapper th.el-table__cell:last-child,
.card-page ::v-deep .el-table__fixed-header-wrapper th.el-table__cell:last-child {
border-right: 0 !important;
}
.card-page ::v-deep .el-table__resize-proxy {
border-left: 2px solid #acb5e3 !important;
}
.area-name-cell {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.card-page ::v-deep .el-table td.el-table__cell {
background: transparent !important;
border-top-color: transparent !important;
border-left: 0 !important;
border-right: 1px solid #acb5e3 !important;
border-bottom: 1px solid #acb5e3 !important;
color: #000000 !important;
}
.card-page ::v-deep .el-table td.el-table__cell:last-child {
border-right: 0 !important;
}
.card-page ::v-deep .el-table td.el-table__cell .cell {
color: #000000 !important;
font-weight: 500;
}
.card-page ::v-deep .el-table__row {
background: #e4edfc !important;
}
.card-page ::v-deep .el-table__row--striped td.el-table__cell {
background: #d7e4f8 !important;
}
.card-page ::v-deep .el-table__body tr:hover > td.el-table__cell {
background: #c5d9f6 !important;
}
.card-page ::v-deep .el-table__body-wrapper {
overflow-y: auto;
overflow-x: auto;
scrollbar-width: none;
-ms-overflow-style: none;
}
.card-page ::v-deep .el-table__body-wrapper::-webkit-scrollbar {
width: 0;
height: 0;
display: none;
}
.task-toolbar-btn {
border: 1px solid transparent !important;
background: linear-gradient(180deg, #397bff 0%, #0c0c8a 100%) !important;
background-image: linear-gradient(180deg, #397bff 0%, #0c0c8a 100%) !important;
color: #ffffff !important;
}
.task-toolbar-btn:hover,
.task-toolbar-btn:focus {
border: 1px solid transparent !important;
background: linear-gradient(180deg, #397bff 0%, #0c0c8a 100%) !important;
background-image: linear-gradient(180deg, #397bff 0%, #0c0c8a 100%) !important;
color: #ffffff !important;
opacity: 0.9;
}
::v-deep .patrol-plan-dialog .el-dialog__body {
height: auto !important;
max-height: calc(100vh - 160px);
padding: 0 24px 24px !important;
overflow-y: auto !important;
}
.table1 {
width: 100%;
border-collapse: collapse;
text-align: center;
table-layout: fixed;
}
.table1 > thead > tr > th {
width: 200px;
border: 1px solid RGBA(64, 72, 106, 1);
border-bottom: none;
background-color: RGBA(16, 29, 41, 1);
height: 38px;
}
.Tbody {
height: 400px;
overflow: scroll;
}
.table1 > tbody > tr > td {
width: 211px;
border: 1px solid RGBA(64, 72, 106, 1);
height: 45px;
}
.HeadXuHao {
width: 50px !important;
}
.TbodyXuHao {
width: 52px !important;
}
.HeadCaoZuo {
width: 160px !important;
}
.TbodyCaoZuo {
width: 169px !important;
}
.HeadChuanJian {
width: 300px !important;
}
.TbodyChuanJian {
width: 317px !important;
}
.el-scrollbar {
background-color: RGBA(32, 47, 62, 1) !important;
}
.table-box {
flex: 1;
height: 0;
overflow-y: auto;
}
</style>
<style lang="scss">
.patrol-plan-area-tooltip {
max-width: 300px;
white-space: normal;
overflow-wrap: anywhere;
line-height: 20px;
}
</style>
<!--
<style lang="scss" scoped>
.title_img {
position: absolute;
top: 0px;
left: 0px;
z-index: 0;
width: 1848px;
}
.el-dialog__header {
background-color: #222f3d !important;
}
.el-dialog__body {
background-color: #222f3d !important;
}
.el-input__inner {
height: 28px !important;
line-height: 28px !important;
}
.el-select .el-input.is-focus .el-input__inner {
border-color: #1890ff !important;
}
.el-select-dropdown {
border: 1px solid RGBA(32, 47, 62, 1) !important;
}
.el-card.is-always-shadow {
border: none !important;
box-shadow: none !important;
}
.el-select-dropdown__list {
background-color: #202f3e !important;
border: 1px solid #40486a !important;
border-radius: 4px !important;
}
.el-select-dropdown__item.hover,
.el-select-dropdown__item:hover {
background-color: RGBA(23, 37, 51, 1) !important;
}
.el-form-item__label {
width: 82px !important;
}
.el-card__body {
padding: 0 0 15px 0 !important;
}
.content {
padding: 15px 15px 6px 15px !important;
}
.pagination-container {
margin-top: -2px !important;
}
.el-table {
height: 144px !important;
overflow: scroll !important;
}
.card-page .el-table::before {
background-color: rgb(0, 1, 1, 0) !important;
}
.el-table__header,
.el-table__body,
.el-table__footer {
border-left: 1px solid #40486a !important;
}
.el-table__header {
border-top: 1px solid #40486a !important;
border-left: 1px solid #40486a !important;
}
.el-table--border {
border: none;
}
.el-table__header-wrapper,
.el-table__body-wrapper,
.el-table__footer-wrapper {
border-right: 1px solid #40486a !important;
}
.el-table--border::after {
background-color: rgb(0, 1, 1, 0) !important;
}
</style> -->