123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410 |
- <template>
- <el-dialog
- width="50%"
- @open="opened()"
- @closed="closed()"
- :show-close="false"
- class="my-info-dialog"
- >
- <template #title>
- <div class="showTitles">
- <div class="titles">校验记录详情</div>
- </div>
- </template>
- <div class="bodyDetial">
- <!-- <div style="width: 50%;height:200px;background-color:red;"></div>
- <div style="width: 50%;height:200px;background-color:yellow;"></div> -->
- <div class="left-item">
- <el-scrollbar>
- <el-input placeholder="输入关键字进行过滤" v-model="filterText">
- </el-input>
- <el-tree
- class="filter-tree"
- :data="showData"
- :props="defaultProps"
- :filter-node-method="filterNode"
- node-key="id"
- :default-expanded-keys="[0]"
- ref="tree"
- @node-click="handleChange"
- >
- </el-tree>
- </el-scrollbar>
- </div>
- <div class="right-item">
- <div class="dateBar">
- <el-date-picker
- class="pickers"
- @change="changes"
- v-model="timeValue"
- type="datetimerange"
- range-separator="至"
- start-placeholder="开始日期"
- end-placeholder="结束日期"
- >
- </el-date-picker>
- <div class="buttons" @click="getControlRecord()">查询</div>
- </div>
- <el-scrollbar style="height: 86%">
- <div class="tables">
- <el-table
- :data="recordData"
- class="table"
- style="width: 100%"
- height="49vh"
- :header-cell-style="{
- background: 'rgb(30,30,30)',
- color: 'rgb(220,220,220)',
- padding: '4px',
- fontSize: '14px',
- 'border-bottom': 'solid 1px rgba(77, 77, 77, 1)',
- }"
- :cell-style="{
- height: '40px',
- background: 'rgb(30,30,30)',
- color: 'rgb(220,220,220)',
- padding: '3px',
- fontSize: '12px',
- 'border-bottom': '1px solid #000000',
- }"
- >
- <el-table-column
- prop="time"
- label="日期"
- width="120"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="showName"
- label="风机号"
- width="120"
- align="center"
- >
- </el-table-column>
- <el-table-column
- prop="controls"
- label="控制命令"
- width="100"
- align="center"
- >
- </el-table-column>
- <el-table-column prop="result" label="操作结果" align="center">
- </el-table-column>
- <el-table-column
- prop="userName"
- label="操作人"
- width="160"
- align="center"
- >
- </el-table-column>
- </el-table>
- </div>
- </el-scrollbar>
- <div class="paginations">
- <el-pagination
- :hide-on-single-page="true"
- :page-size="currentPage"
- background
- layout="prev, pager, next"
- :total="total"
- @current-change="handleCurrentChange"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- </el-dialog>
- </template>
- <script>
- import dayjs from "dayjs";
- import api from "api/index";
- export default {
- props: {},
- updated() {
- if (this.timeValue.length === 0) {
- let date = new Date();
- this.timeValue[0] = date.getTime() - 28800000;
- this.timeValue[1] = date.getTime() + 3600000;
- }
- },
- mounted() {},
- data() {
- return {
- currentPage: 10,
- filterText: "",
- pageIndex: 1,
- station: [],
- datas: {},
- chooseStation: {},
- timeValue: [],
- showData: [
- {
- id: 0,
- windturbineId: "全部",
- stationId: "",
- children: [],
- },
- ],
- defaultProps: {
- children: "children",
- label: "windturbineId",
- },
- recordData: [],
- total: "",
- controlErorCodes: [
- "控制成功",
- "控制命令发送失败",
- "无效的控制地址",
- "被控设备异常",
- "无效的控制功能",
- "网络连接错误,检查场站通信",
- "控制结果读取超时",
- "未知错误",
- "控制命令错误",
- "收到无法识别数据",
- "未读取到数据包",
- "未知错误",
- "风机操作过频繁",
- "风机被挂牌",
- "风机操作与风机状态不符",
- "需要登录",
- ],
- };
- },
- methods: {
- // getWindturbineFdc() {
- // api.getWindturbineFdc().then((res) => {
- // this.station = res.data;
- // this.getControlRecord();
- // });
- // },
- dataDeal() {
- let stationList = this.$store.state.stationList;
- this.showData[0].children = [];
- stationList.forEach((item, index) => {
- let obj = {};
- obj.id = index + 1;
- obj.windturbineId = item.name;
- obj.stationId = item.code;
- obj.children = [];
- this.showData[0].children.push(obj);
- });
- this.datas = this.$store.state.windturbinelist
- ? this.$store.state.windturbinelist
- : {};
- let arr = Object.keys(this.datas).sort();
- for (let id of arr) {
- let item = this.datas[id];
- this.showData[0].children
- .filter((val) => val.stationId === item.stationId)[0]
- .children.push(item);
- }
- },
- handleChange(value) {
- this.chooseStation = value;
- this.pageIndex = 1;
- this.getControlRecord(value);
- },
- closed() {
- this.pageIndex = 1;
- this.chooseStation = {};
- this.showData = [
- {
- id: 0,
- windturbineId: "全部",
- stationId: "",
- children: [],
- },
- ];
- let stationList = this.$store.state.stationList;
- stationList.forEach((item, index) => {
- let obj = {};
- obj.id = index + 1;
- obj.windturbineId = item.name;
- obj.stationId = item.code;
- obj.children = [];
- this.showData[0].children.push(obj);
- });
- this.$emit("closed");
- },
- filterNode(value, data) {
- if (!value) return true;
- return data.windturbineId.indexOf(value) !== -1;
- },
- handleCurrentChange(val) {
- this.pageIndex = val;
- this.getControlRecord();
- },
- opened() {
- let date = new Date();
- this.timeValue[0] = date.getTime() - 28800000;
- this.timeValue[1] = date.getTime() + 3600000;
- this.getControlRecord();
- },
- getControlRecord() {
- api
- .controlRecord({
- stationId: this.chooseStation.stationId
- ? this.chooseStation.stationId
- : "",
- userName: "",
- windturbineId: this.chooseStation.id
- ? ""
- : this.chooseStation.stationId
- ? this.chooseStation.windturbineId
- : "",
- startTime: dayjs(this.timeValue[0]).format("YYYY/MM/DD HH:mm:ss"),
- endTime: dayjs(this.timeValue[1]).format("YYYY/MM/DD HH:mm:ss"),
- pageSize: this.currentPage,
- pageIndex: this.pageIndex,
- })
- .then((res) => {
- if (res) {
- let types = {
- Start: "启动",
- Stop: "停止",
- Reset: "复位",
- Maintain: "维护",
- UnMaintain: "取消维护",
- Lock: "挂牌",
- UnLock: "取消挂牌",
- };
- res.data.dataList.forEach((item) => {
- item.time = dayjs(item.time).format("MM-DD HH:mm:ss");
- item.result = this.controlErorCodes[item.errorCode];
- item.controls = types[item.controlType];
- item.showName = item.windturbineId;
- });
- this.total = res.data.total;
- this.recordData = res.data.dataList;
- }
- });
- },
- },
- watch: {
- filterText(val) {
- this.$refs.tree.filter(val);
- },
- },
- };
- </script>
- <style scoped>
- .showTitles {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- margin-top: -10px;
- font-size: 18px;
- color: #ffffff;
- height: 40px;
- }
- .titles {
- font-size: 16px;
- color: #ffffff;
- }
- .el-dialog__body {
- padding: 30px 10px 10px 10px;
- }
- .bodyDetial {
- display: flex;
- flex-direction: row;
- background-color: black;
- width: 100%;
- margin-top: -30px;
- height: 60vh;
- }
- .left-item {
- width: 20%;
- height: 100%;
- background-color: rgba(77, 77, 77, 1);
- border-right: 2px solid #000000;
- }
- .right-item {
- width: 80%;
- height: 100%;
- background-color: rgba(77, 77, 77, 1);
- }
- .el-tree {
- color: #ffffff !important;
- background-color: rgba(77, 77, 77, 1) !important;
- }
- .el-tree-node:focus > .el-tree-node__content {
- background-color: #000000 !important;
- }
- .el-tree-node__content:hover {
- background-color: #000000 !important;
- }
- .dateBar {
- display: flex;
- flex-direction: row;
- align-items: center;
- justify-content: space-between;
- margin-left: 20px;
- }
- .pickers {
- margin-left: 20px;
- }
- .tables {
- margin-top: 20px;
- width: 95%;
- margin-left: 3%;
- }
- .table {
- background-color: rgba(77, 77, 77, 1) !important;
- }
- .el-table td,
- .el-table th.is-leaf {
- border-bottom: 1px solid rgba(77, 77, 77, 1) !important;
- }
- .el-table__header {
- width: 100% !important;
- }
- .el-table__body-wrapper {
- background-color: rgba(77, 77, 77, 1) !important;
- }
- .el-table::before {
- width: 0;
- }
- tr {
- line-height: 1.5;
- background: #1e1e1e;
- margin-bottom: 2px;
- border-radius: 5px;
- }
- .table-main {
- font-size: 14px;
- width: 600px;
- text-align: center;
- background: #000000;
- margin: 5px;
- border-collapse: separate;
- border-spacing: 0px 5px;
- }
- .paginations {
- display: flex;
- flex-direction: row-reverse;
- }
- </style>
|