123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522 |
- <template>
- <div class="powerLinefitting">
- <div class="powerLinefitting_top">
- <div class="form-wrapper">
- <div class="select-wrapper">
- <el-select
- size="mini"
- v-model="tabEvent"
- placeholder="请选择"
- @change="changeBtn"
- >
- <el-option
- v-for="item in tabOptions"
- :key="item.id"
- :label="item.name"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <el-select
- size="mini"
- v-model="companyVal"
- placeholder="请选择"
- @change="changeCompan"
- >
- <el-option
- v-for="item in companyOptions"
- :key="item.id"
- :label="item.aname"
- :value="item.id"
- >
- </el-option>
- </el-select>
- <el-select
- size="mini"
- v-model="stationVal"
- placeholder="请选择"
- @change="changeStation"
- >
- <el-option
- v-for="item in stationOptions"
- :key="item.id"
- :label="item.aname"
- :value="item.id"
- >
- </el-option>
- </el-select>
- </div>
- <div class="date-wrapper">
- <div class="date-item-wrapper">
- 开始时间
- <div class="date-item-date">
- <el-date-picker
- size="mini"
- v-model="starTime"
- type="datetime"
- value-format="YYYY-MM-DD HH:mm:ss"
- placeholder="选择时间"
- >
- </el-date-picker>
- </div>
- </div>
- <div class="date-item-wrapper">
- 结束时间
- <div class="date-item-date">
- <el-date-picker
- size="mini"
- v-model="endTime"
- type="datetime"
- value-format="YYYY-MM-DD HH:mm:ss"
- placeholder="选择时间"
- >
- </el-date-picker>
- </div>
- </div>
- </div>
- </div>
- <div class="but">
- <el-button round size="mini" class="buttons" @click="getTableData"
- >查询</el-button
- >
- <el-button round size="mini" class="buttons" @click="handleAdd"
- >新增</el-button
- >
- <el-button round size="mini" class="buttons" @click="downXlsxFn"
- >导出</el-button
- >
- </div>
- </div>
- <div style="background: rgba(0, 0, 0, 0.4); height: calc(100% - 60px)">
- <div class="powerLinefitting_title clearfix">
- <div class="leftContent floatLeft"><span>故障录入</span></div>
- <div class="rightContent floatRight"></div>
- </div>
- <div class="powerLinefitting_Table">
- <el-table
- :data="stationAnalyseData"
- stripe
- size="mini"
- height="calc(100% - 35px)"
- ref="fitting_table"
- style="width: 100%"
- @row-click="handleRowClick"
- >
- <el-table-column
- v-for="(item, index) in tableHeader"
- :key="index"
- sortable
- :prop="item.code"
- :label="item.title"
- align="center"
- >
- <template #default="scope" v-if="item.title === '操作'">
- <span class="operationBtn" @click="handleEdit(scope.row)"
- >编辑</span
- >
- <span class="operationBtn" @click="handleDelete(scope.row)"
- >删除</span
- >
- </template>
- </el-table-column>
- </el-table>
- <div class="pagination-wrapper">
- <el-pagination
- @current-change="handleCurrentChange"
- :current-page="page.currentPage"
- :page-size="page.pagesize"
- layout="total, prev, pager, next, jumper"
- :total="page.total"
- >
- </el-pagination>
- </div>
- </div>
- </div>
- <operation
- ref="operation"
- :stationOptions="stationOptions"
- @handleSuccess="getTableData"
- />
- </div>
- </template>
- <script>
- import { GetFaultList, FaultDelete } from "@/api/insert.js";
- import { GetOrganization, GetStationByCompany } from "@/api/headerNav.js";
- import utils from "@/utils/downXlsx";
- import dayjs from "dayjs";
- import operation from "./components/operation.vue";
- export default {
- name: "faultInsert", //故障录入
- data() {
- return {
- companyVal: "",
- companyOptions: [],
- stationVal: "",
- stationOptions: [],
- starTime: "",
- endTime: "",
- stationAnalyseData: [],
- stationLineData: [],
- tableHeader: [
- { title: "场站", code: "windpowerstationName" },
- { title: "设备", code: "equipmentName" },
- { title: "开始时间", code: "begindate" },
- { title: "计划结束时间", code: "planEnddate" },
- { title: "实际结束时间", code: "actualEnddate" },
- { title: "故障描述", code: "faultDescription" },
- { title: "处理过程", code: "processingProcess" },
- { title: "备注", code: "spare1" },
- { title: "操作" },
- ],
- tabEvent: -2,
- tabOptions: [{ id: -2, name: "光伏" }],
- page: {
- pagesize: 20,
- currentPage: 1,
- total: 0,
- },
- };
- },
- components: {
- operation,
- },
- created() {
- this.starTime = dayjs().startOf("day").format("YYYY-MM-DD HH:mm:ss");
- this.endTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
- this.getCompanyData();
- },
- methods: {
- //切换风电光伏
- changeBtn() {},
- // 获取公司列表
- async getCompanyData() {
- this.companyOptions = [];
- const datas = await GetOrganization({ type: this.tabEvent });
- this.companyOptions = datas.data;
- this.companyVal = datas.data[0]?.id;
- this.getStationData(this.companyVal);
- },
- // 获取场站列表
- async getStationData() {
- this.stationOptions = [];
- let params = {
- type: this.tabEvent,
- companyids: this.companyVal,
- };
- const datas = await GetStationByCompany(params);
- this.stationOptions = datas.data;
- this.stationVal = datas.data[0].id;
- this.getTableData();
- },
- //切换公司
- changeCompan(val) {
- this.companyVal = val;
- this.getStationData();
- },
- //切换场站
- changeStation(val) {
- this.stationVal = val;
- this.getTableData();
- },
- //查询
- async getTableData() {
- let params = {
- windpowerstationId: this.stationVal,
- pageSize: this.page.pagesize,
- pageNum: this.page.currentPage,
- begindate: this.starTime,
- planEnddate: this.endTime,
- };
- const { data } = await GetFaultList(params);
- this.stationAnalyseData = data.records;
- this.page.total = data.total;
- },
- //新增
- handleAdd() {
- this.$refs["operation"].form.windpowerstationId = this.stationVal;
- this.$refs["operation"].getEquipment(this.stationVal);
- this.$refs["operation"].form.begindate = dayjs().format(
- "YYYY-MM-DD HH:mm:ss"
- );
- // this.$refs["operation"].form.planEnddate = dayjs().format(
- // "YYYY-MM-DD HH:mm:ss"
- // );
- // this.$refs["operation"].form.actualEnddate = dayjs().format(
- // "YYYY-MM-DD HH:mm:ss"
- // );
- this.$refs["operation"].openDialog();
- },
- //编辑
- handleEdit(row) {
- this.$refs["operation"].getEquipment(row.windpowerstationId);
- this.$refs["operation"].openDialog(row);
- },
- //删除
- handleDelete(row) {
- if (row.id) {
- this.$confirm("你确定要删除吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- FaultDelete(row.id).then((res) => {
- if (res.data) {
- this.$message({
- type: "success",
- message: "删除成功!",
- });
- this.getTableData();
- }
- });
- })
- .catch(() => {
- this.$message({
- type: "info",
- message: "已取消删除",
- });
- });
- } else {
- this.$baseMessage("未选中任何行", "error");
- return false;
- }
- },
- //导出
- downXlsxFn() {
- let header = [];
- this.tableHeader.forEach((it) => {
- if (it.title !== "操作") {
- header.push(it.title);
- }
- });
- utils.exportExcel(
- this.$refs["fitting_table"].$el,
- header,
- "故障录入列表"
- );
- },
- },
- };
- </script>
- <style lang="less" scoped>
- .powerLinefitting {
- padding: 0 23px;
- height: 100%;
- .powerLinefitting_top::v-deep {
- display: flex;
- flex-direction: row;
- align-items: center;
- margin-top: 10px;
- margin-bottom: 10px;
- padding-left: 10px;
- .form-wrapper {
- display: flex;
- align-items: center;
- .select-wrapper {
- display: flex;
- align-items: center;
- .el-select {
- width: 155px;
- .el-input .el-input__inner {
- width: 150px;
- }
- }
- }
- .date-wrapper {
- display: flex;
- align-items: center;
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #b3b3b3;
- margin-left: 10px;
- .date-item-wrapper {
- display: flex;
- align-items: center;
- margin-right: 15px;
- .date-item-date {
- margin-left: 10px;
- .el-input .el-input__inner {
- font-size: 13px;
- color: #b3b3b3;
- }
- }
- }
- }
- }
- .station {
- display: flex;
- flex-direction: row;
- align-items: center;
- font-size: 14px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #b3b3b3;
- margin-right: 25px;
- }
- .search-input {
- margin-left: 10px;
- .el-input__inner {
- width: 175px;
- }
- .el-input__suffix {
- right: -50px;
- }
- }
- .but {
- display: flex;
- flex-direction: row;
- align-content: center;
- .buttons:nth-child(1) {
- background: rgba(0, 70, 199, 0.6);
- border: 1px solid #1f51ae;
- border-radius: 13px;
- color: #fff;
- &:hover {
- background: rgba(14, 90, 229, 0.9);
- border-radius: 13px;
- color: #fff;
- }
- }
- .buttons:nth-child(2) {
- background: rgba(0, 70, 199, 0.6);
- border: 1px solid #1f51ae;
- border-radius: 13px;
- color: #fff;
- &:hover {
- background: rgba(14, 90, 229, 0.9);
- border-radius: 13px;
- color: #fff;
- }
- }
- .buttons:nth-child(3) {
- background: rgba(67, 81, 107, 0.3);
- border: 1px solid #3b4c6c;
- border-radius: 13px;
- font-size: 14px;
- color: #b3b3b3;
- }
- }
- }
- .powerLinefitting_title {
- padding-left: 10px;
- .leftContent {
- width: 242px;
- height: 41px;
- line-height: 41px;
- background: url("../../../../../assets/imgs/title_left_bg.png");
- span {
- font-size: 16px;
- font-family: Microsoft YaHei;
- font-weight: 400;
- color: #ffffff;
- margin-left: 25px;
- }
- }
- .floatLeft {
- float: left;
- }
- .floatRight {
- float: right;
- }
- .rightContent {
- width: 212px;
- height: 28px;
- margin-top: 13px;
- background: url("../../../../../assets/imgs/title_right_bg.png");
- }
- }
- .clearfix::after {
- content: "";
- clear: both;
- height: 0;
- line-height: 0;
- visibility: hidden;
- display: block;
- }
- .clearfix {
- zoom: 1;
- }
- .powerLinefitting_Table ::v-deep {
- margin: 0 5px 5px 5px;
- padding-bottom: 10px;
- height: calc(100% - 41px - 10px);
- .operationBtn {
- cursor: pointer;
- color: #1c99ff;
- padding: 3px 10px;
- }
- .pagination-wrapper {
- display: flex;
- justify-content: flex-end;
- padding-right: 20px;
- .el-pagination {
- display: flex;
- align-items: center;
- .btn-prev,
- .btn-next,
- .btn-quickprev,
- .btn-quicknext,
- .el-pager,
- .number {
- background: rgba(58, 63, 75, 0.4);
- color: #fff;
- border-radius: 2px;
- }
- .el-pager .active {
- background: #083c94;
- color: #fff;
- border-radius: 2px;
- }
- .el-pagination__total,
- .el-pagination__jump {
- color: #fff;
- .el-input__inner {
- background: rgba(58, 63, 75, 0.2);
- border: 1px solid #3e4349;
- color: #fff;
- border-radius: 2px;
- }
- }
- }
- }
- .el-table--mini {
- margin: 5px;
- .el-table__header-wrapper {
- tr {
- background: rgba(83, 89, 104, 0.3) !important;
- // th {
- // vertical-align: top !important;
- // }
- .cell {
- color: #b3b3b3;
- font-family: MicrosoftYaHei;
- font-size: 14px;
- }
- }
- }
- .el-table__body-wrapper {
- tr {
- &:nth-child(2n) {
- background: rgba(83, 89, 104, 0.05) !important;
- }
- .cell {
- color: #d8d8d9;
- font-family: ArialMT;
- font-size: 13px;
- height: 25px !important;
- }
- }
- }
- }
- }
- }
- </style>
|