소스 검색

BUG修复、停机查询模块新增

Koishi 1 년 전
부모
커밋
38d39853d2

+ 16 - 1
src/api/api.js

@@ -548,7 +548,7 @@ export function point(
     model
 ) {
     return request.get(
-        `device/metrics/page?pagenum=${pagenum}&pagesize=${pagesize}&deviceId=${deviceId}&categorydata=${categorydata}&keyword=${keyword}&model=${model}&structureCode=${code}`
+        `device/metrics/page?pageNum=${pagenum}&pageSize=${pagesize}&deviceId=${deviceId}&categorydata=${categorydata}&keyword=${keyword}&model=${model}&structureCode=${code}`
     );
 }
 //测点新增
@@ -831,6 +831,7 @@ export const getAlartConfig = () => {
 export const saveAlartConfig = (data) => {
     return request({
         method: "post",
+        baseURL,
         url: "/alarmswitch/save",
         data
     });
@@ -838,6 +839,7 @@ export const saveAlartConfig = (data) => {
 
 export const getWtModel = (wpId) => {
     return request({
+        baseURL,
         method: "get",
         url: `/alertrule/querymodellist?wpId=${wpId}`,
     });
@@ -846,11 +848,13 @@ export const getWtModel = (wpId) => {
 export const getWpList = (types = "") => {
     return request({
         method: "get",
+        baseURL,
         url: `/alertrule/querywpllist?types=${types}`,
     });
 };
 export const getBpList = () => {
     return request({
+        baseURL,
         method: "get",
         url: `/alertrule/querysubllist`,
     });
@@ -859,6 +863,7 @@ export const getBpList = () => {
 export const getPointList = (params) => {
     return request({
         method: "get",
+        baseURL,
         url: "/alertrule/querysubpointllist",
         params,
     });
@@ -866,7 +871,17 @@ export const getPointList = (params) => {
 export const saveAlarmconfiguration = (data) => {
     return request({
         method: "post",
+        baseURL,
         url: "/alarmconfiguration/save",
         data,
     });
+};
+
+export const getStopQueryTableData = (params) => {
+    return request({
+        method: "get",
+        baseURL,
+        url: "shutdownevent2/queryshutdowneventlist",
+        params,
+    });
 };

+ 45 - 42
src/components/alarmPopupa/index.vue

@@ -247,48 +247,7 @@ export default {
         this.ws.onmessage = (res) => {
           let alarmItem = JSON.parse(res.data);
           if (alarmItem) {
-            const configItem = this.getConfigItem(alarmItem.rank);
-            const alarmOption = {
-              id: alarmItem.id,
-              lv: alarmItem.rank,
-              lvName: this.getLvName(alarmItem),
-              rank: alarmItem.rank,
-              class: `animate__bounceInRight lv${alarmItem.rank}`,
-              isClose: alarmItem.isClose,
-              isCloseName: alarmItem.isClose ? "已解除" : "未解除",
-              alarmId: alarmItem.alarmId,
-              alarmType: alarmItem.alarmType,
-              alarmName: this.getAlarmName(alarmItem),
-              description: alarmItem.description,
-              deviceType: alarmItem.deviceType,
-              oval: alarmItem.oval,
-              triggerType: alarmItem.triggerType,
-              ts: alarmItem.ts,
-              tsName: new Date(alarmItem.ts).formatDate("MM-dd hh:mm:ss"),
-              fullTsName: new Date(alarmItem.ts).formatDate(
-                "yyyy-MM-dd hh:mm:ss"
-              ),
-              deviceId: alarmItem.deviceId,
-              deviceType: alarmItem.deviceType,
-              faultCause: alarmItem.faultCause,
-              resolvent: alarmItem.resolvent,
-              characteristic: alarmItem.characteristic,
-              code: alarmItem.code,
-              wpName: alarmItem.wpName,
-            };
-            if (
-              configItem.isAlarmSound ||
-              configItem.isAlart ||
-              configItem.isContinuousAlarm
-            ) {
-              this.alarmList.push(alarmOption);
-            }
-
-            this.$store.commit("setWarning", alarmOption);
-            this.alarmList.sort((a, b) => {
-              return b.lv - a.lv;
-            });
-            this.playAudioEffect();
+            this.pushALarmItem(alarmItem);
           }
         };
 
@@ -311,6 +270,49 @@ export default {
       }
     },
 
+    pushALarmItem(alarmItem) {
+      const configItem = this.getConfigItem(alarmItem.rank);
+      const alarmOption = {
+        id: alarmItem.id,
+        lv: alarmItem.rank,
+        lvName: this.getLvName(alarmItem),
+        rank: alarmItem.rank,
+        class: `animate__bounceInRight lv${alarmItem.rank}`,
+        isClose: alarmItem.isClose,
+        isCloseName: alarmItem.isClose ? "已解除" : "未解除",
+        alarmId: alarmItem.alarmId,
+        alarmType: alarmItem.alarmType,
+        alarmName: this.getAlarmName(alarmItem),
+        description: alarmItem.description,
+        deviceType: alarmItem.deviceType,
+        oval: alarmItem.oval,
+        triggerType: alarmItem.triggerType,
+        ts: alarmItem.ts,
+        tsName: new Date(alarmItem.ts).formatDate("MM-dd hh:mm:ss"),
+        fullTsName: new Date(alarmItem.ts).formatDate("yyyy-MM-dd hh:mm:ss"),
+        deviceId: alarmItem.deviceId,
+        deviceType: alarmItem.deviceType,
+        faultCause: alarmItem.faultCause,
+        resolvent: alarmItem.resolvent,
+        characteristic: alarmItem.characteristic,
+        code: alarmItem.code,
+        wpName: alarmItem.wpName,
+      };
+      if (
+        configItem.isAlarmSound ||
+        configItem.isAlart ||
+        configItem.isContinuousAlarm
+      ) {
+        this.alarmList.push(alarmOption);
+      }
+
+      this.$store.commit("setWarning", alarmOption);
+      this.alarmList.sort((a, b) => {
+        return b.lv - a.lv;
+      });
+      this.playAudioEffect();
+    },
+
     reconnect(serveIP) {
       if (this.timeConnect < this.limitConnect) {
         console.log(`webSocket 连接失败,第 ${++this.timeConnect} 次重连`);
@@ -345,6 +347,7 @@ export default {
     "$store.state.alarmResetFlg"() {
       getAlartConfig()
         .then((res) => {
+          console.log(2222, res.data);
           this.alarmConfigArray = res.data;
         })
         .catch(() => {

+ 1 - 1
src/pages/alarmConfig/bj_windturbine/windturbine_components.vue

@@ -343,7 +343,7 @@ export default {
         this.dialogOptions.deviceType === "windturbine" ||
         this.dialogOptions.deviceType === "inverter"
       ) {
-        getWpList().then((res) => {
+        getWpList(this.dialogOptions.deviceType).then((res) => {
           this.dialogOptions.stationId = res?.data?.[0]?.id || "";
           this.wpArray = res.data;
           this.getWtModel();

+ 16 - 16
src/pages/baseData/device.vue

@@ -12,12 +12,14 @@
         >删除</el-button
       >
       <el-tree
-      style="margin-top:10px"
+        style="margin-top: 10px"
         :data="state.treedata"
         :props="state.defaultProps"
         node-key="id"
         highlight-current
-        :default-expanded-keys="[23]" :current-node-key="23" :expand-on-click-node="false"
+        :default-expanded-keys="[23]"
+        :current-node-key="23"
+        :expand-on-click-node="false"
         @node-click="handleNodeClick"
       />
     </el-card>
@@ -26,22 +28,22 @@
         <!-- <el-tab-pane label="传感点">
           <point />
         </el-tab-pane> -->
-        <el-tab-pane label="遥测点">
+        <el-tab-pane label="遥测点" >
           <ycpoint />
         </el-tab-pane>
-        <el-tab-pane label="遥信点">
+        <el-tab-pane label="遥信点" v-if="false">
           <yxpoint />
         </el-tab-pane>
-         <el-tab-pane label="设备报警">
+        <el-tab-pane label="设备报警" v-if="false">
           <windturbine />
         </el-tab-pane>
-        <el-tab-pane label="故障预警">
+        <el-tab-pane label="故障预警" v-if="false">
           <custom />
         </el-tab-pane>
-        <el-tab-pane label="故障原因">
+        <el-tab-pane label="故障原因" v-if="false">
           <faultmode />
         </el-tab-pane>
-        <el-tab-pane label="基本信息">
+        <el-tab-pane label="基本信息" v-if="false">
           <message />
         </el-tab-pane>
       </el-tabs>
@@ -124,7 +126,7 @@
   </div>
 </template>
 <script setup>
-import { ref, onMounted, reactive, provide, computed ,nextTick} from "vue";
+import { ref, onMounted, reactive, provide, computed, nextTick } from "vue";
 import { ElMessageBox, ElMessage } from "element-plus";
 import faultmode from "./fan_components/faultmode.vue";
 import message from "./fan_components/message.vue";
@@ -138,12 +140,11 @@ let editFormData = ref({});
 onMounted(async () => {
   await getData();
   nextTick(() => {
-    handleNodeClick(state.cascaderdata[0])
-  })
-
+    handleNodeClick(state.cascaderdata[0]);
+  });
 });
 let state = reactive({
-  isDel:false, //是否能被删除
+  isDel: false, //是否能被删除
   treedata: [],
   cascaderdata: [],
   defaultProps: {
@@ -210,7 +211,7 @@ let state = reactive({
   treeDelVal: "",
   deviceModel: [],
   deviceModelSel: "",
-  treeId:'',
+  treeId: "",
 });
 
 // 父子传参
@@ -229,8 +230,7 @@ provide(
 
 // tree click
 const handleNodeClick = (data) => {
-  console.log(data);
-  state.isDel = data.children?false:true;
+  state.isDel = data.children ? false : true;
   state.treeId = data.id;
   state.desc = data.node;
   state.addFormData.structurecode = data.node.code;

+ 204 - 102
src/pages/baseData/fan_components/windturbine.vue

@@ -1,96 +1,205 @@
 <template>
-    <el-row type="flex" justify="space-between">
-      <div class="handle-box" style="margin-bottom: 10px">
-        <el-button type="primary" icon="el-icon-lx-add" class="handle-edit mr10" @click="handleInsert">
-          新增记录
-        </el-button>
-        <el-button type="primary" icon="el-icon-lx-down" class="handle-edit mr10" @click="export2Excel">
-          批量导出</el-button>
-        <el-button type="primary" icon="el-icon-lx-down" class="handle-edit mr10" @click="outExe">
-          模板下载</el-button>
-        <el-upload class="handle-edit mr10" style=" display: inline;" action="/sharding/warning2/import"
-          :headers="token" :show-file-list="false" :on-success="handleSuccess" :on-progress="handleProgress"
-          :on-error="handleError">
-          <el-button type="primary" icon="el-icon-lx-top" @click="exportShow = true">
-            批量导入</el-button>
-        </el-upload>
-      </div>
-      <div style="display: flex; flex-direction: row; margin-bottom: 10px">
-        <el-select v-if="!isStation" v-model="query.stationId" clearable class="mr10" style="width: 150px"
-          placeholder="全部场站" popper-class="select" @change="changeStation()">
-          <el-option v-for="item in stationList" :key="item.id" :value="item.id" :label="item.name"></el-option>
-        </el-select>
-        <el-select v-model="query.modelId" clearable class="mr10" style="width: 150px" placeholder="全部机型"
-          popper-class="select">
-          <el-option v-for="item in state.modelList" :key="item" :value="item" :label="item"></el-option>
-        </el-select>
+  <el-row type="flex" justify="space-between">
+    <div class="handle-box" style="margin-bottom: 10px">
+      <el-button
+        type="primary"
+        icon="el-icon-lx-add"
+        class="handle-edit mr10"
+        @click="handleInsert"
+      >
+        新增记录
+      </el-button>
+      <el-button
+        type="primary"
+        icon="el-icon-lx-down"
+        class="handle-edit mr10"
+        @click="export2Excel"
+      >
+        批量导出</el-button
+      >
+      <el-button
+        type="primary"
+        icon="el-icon-lx-down"
+        class="handle-edit mr10"
+        @click="outExe"
+      >
+        模板下载</el-button
+      >
+      <el-upload
+        class="handle-edit mr10"
+        style="display: inline"
+        action="/sharding/warning2/import"
+        :headers="token"
+        :show-file-list="false"
+        :on-success="handleSuccess"
+        :on-progress="handleProgress"
+        :on-error="handleError"
+      >
+        <el-button
+          type="primary"
+          icon="el-icon-lx-top"
+          @click="exportShow = true"
+        >
+          批量导入</el-button
+        >
+      </el-upload>
+    </div>
+    <div style="display: flex; flex-direction: row; margin-bottom: 10px">
+      <el-select
+        v-if="!isStation"
+        v-model="query.stationId"
+        clearable
+        class="mr10"
+        style="width: 150px"
+        placeholder="全部场站"
+        popper-class="select"
+        @change="changeStation()"
+      >
+        <el-option
+          v-for="item in stationList"
+          :key="item.id"
+          :value="item.id"
+          :label="item.name"
+        ></el-option>
+      </el-select>
+      <el-select
+        v-model="query.modelId"
+        clearable
+        class="mr10"
+        style="width: 150px"
+        placeholder="全部机型"
+        popper-class="select"
+      >
+        <el-option
+          v-for="item in state.modelList"
+          :key="item"
+          :value="item"
+          :label="item"
+        ></el-option>
+      </el-select>
 
-        <el-input placeholder="请输入名称" v-model="query.name" style="width: 150px" class="mr10" clearable></el-input>
-        <el-button icon="el-icon-search" type="primary" @click="getData">搜索</el-button>
-      </div>
-    </el-row>
-    <el-table :data="state.tableData" :highlight-current-row="true" border>
-      <el-table-column label="序列号" align="center" prop="id" />
-      <el-table-column label="统一编码" align="center" prop="uniformCode">
-        <template #default="scope">{{
-            // ednaValueConvert(scope.row.ednaValue)
-            scope.row.uniformCode
-        }}</template>
-      </el-table-column>
-      <el-table-column label="名称" align="left" prop="chineseText" width="180" />
-      <el-table-column label="停机类型" align="center" prop="characteristic" />
-      <el-table-column label="风机型号" align="center" prop="modelId" />
-      <el-table-column label="报警类型" align="center" prop="warningTypeId" />
-      <el-table-column label="故障编码" align="center" prop="faultCode" />
-      <el-table-column label="报警级别" align="center" prop="levelId">
-        <template #default="scope">{{
-            levelIdConvert(scope.row.levelId)
-        }}</template>
-      </el-table-column>
-      <el-table-column label="报警分类" align="center" prop="warningClassIfyId" min-width="50">
-        <template #default="scope">{{
-            warningClassIfyIdConvert(scope.row.warningClassIfyId)
-        }}</template>
-      </el-table-column>
-      <el-table-column label="是否可以复位" align="center" prop="isreset" min-width="50">
-        <template #default="scope">{{
-            isresetConvert(scope.row.isreset)
-        }}</template>
-      </el-table-column>
-      <el-table-column label="是否启用" align="center" prop="display" min-width="50">
-        <template #default="scope">{{
-            scope.row.enabled == 1?'是':'否'
-        }}</template>
-      </el-table-column>
-      <el-table-column label="关联部件" align="center" prop="relatedParts" min-width="50">
-        <template #default="scope">
-          <span>{{ relatePartConvert(scope.row.relatedParts) }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="操作" align="center" width="100">
-        <template #default="scope">
-          <el-button type="primary" plain round size="mini" icon="el-icon-lx-edit" @click="handleEditClick(scope.row)">
-            编辑</el-button>
-        </template>
-      </el-table-column>
-    </el-table>
-    <div class="pagination">
-      <el-pagination background layout="total, prev, pager, next" hide-on-single-page :current-page="query.pagenum"
-        :page-size="query.pagesize" :total="total" @current-change="handlePageChange"></el-pagination>
+      <el-input
+        placeholder="请输入名称"
+        v-model="query.name"
+        style="width: 150px"
+        class="mr10"
+        clearable
+      ></el-input>
+      <el-button icon="el-icon-search" type="primary" @click="getData"
+        >搜索</el-button
+      >
     </div>
-    <windturbinecomponents @close="dialogclose" :isVisible="state.visible" :form="state.form" />
+  </el-row>
+  <el-table :data="state.tableData" :highlight-current-row="true" border>
+    <el-table-column label="序列号" align="center" prop="id" />
+    <el-table-column label="统一编码" align="center" prop="uniformCode">
+      <template #default="scope">{{
+        // ednaValueConvert(scope.row.ednaValue)
+        scope.row.uniformCode
+      }}</template>
+    </el-table-column>
+    <el-table-column label="名称" align="left" prop="chineseText" width="180" />
+    <el-table-column label="停机类型" align="center" prop="characteristic" />
+    <el-table-column label="风机型号" align="center" prop="modelId" />
+    <el-table-column label="报警类型" align="center" prop="warningTypeId" />
+    <el-table-column label="故障编码" align="center" prop="faultCode" />
+    <el-table-column label="报警级别" align="center" prop="levelId">
+      <template #default="scope">{{
+        levelIdConvert(scope.row.levelId)
+      }}</template>
+    </el-table-column>
+    <el-table-column
+      label="报警分类"
+      align="center"
+      prop="warningClassIfyId"
+      min-width="50"
+    >
+      <template #default="scope">{{
+        warningClassIfyIdConvert(scope.row.warningClassIfyId)
+      }}</template>
+    </el-table-column>
+    <el-table-column
+      label="是否可以复位"
+      align="center"
+      prop="isreset"
+      min-width="50"
+    >
+      <template #default="scope">{{
+        isresetConvert(scope.row.isreset)
+      }}</template>
+    </el-table-column>
+    <el-table-column
+      label="是否启用"
+      align="center"
+      prop="display"
+      min-width="50"
+    >
+      <template #default="scope">{{
+        scope.row.enabled == 1 ? "是" : "否"
+      }}</template>
+    </el-table-column>
+    <el-table-column
+      label="关联部件"
+      align="center"
+      prop="relatedParts"
+      min-width="50"
+    >
+      <template #default="scope">
+        <span>{{ relatePartConvert(scope.row.relatedParts) }}</span>
+      </template>
+    </el-table-column>
+    <el-table-column label="操作" align="center" width="100">
+      <template #default="scope">
+        <el-button
+          type="primary"
+          plain
+          round
+          size="mini"
+          icon="el-icon-lx-edit"
+          @click="handleEditClick(scope.row)"
+        >
+          编辑</el-button
+        >
+      </template>
+    </el-table-column>
+  </el-table>
+  <div class="pagination">
+    <el-pagination
+      background
+      layout="total, prev, pager, next"
+      hide-on-single-page
+      :current-page="query.pagenum"
+      :page-size="query.pagesize"
+      :total="total"
+      @current-change="handlePageChange"
+    ></el-pagination>
+  </div>
+  <windturbinecomponents
+    @close="dialogclose"
+    :isVisible="state.visible"
+    :form="state.form"
+  />
 </template>
 <script setup>
-import { windturbinebj_fetchTableData, getStationinfo } from "/@/api/api.js";
+import {
+  windturbinebj_fetchTableData,
+  getWtModel,
+  getWpList,
+} from "/@/api/api.js";
 import { outExportExcel } from "/@/utils/exportExcel"; //引入文件
 import { ref, onMounted, provide, computed, reactive, watch } from "vue";
 import { useStore } from "vuex";
 import { ElMessageBox, ElMessage } from "element-plus";
 import windturbinecomponents from "./windturbine_components.vue";
-const token = { 'token': sessionStorage.getItem('token') }
+const token = { token: sessionStorage.getItem("token") };
 const store = useStore();
-const stationList = computed(() => store.state.stationList);
-const isStation = computed(() => store.getters.isStation);
+const stationList = ref([]);
+
+const getStationList = async () => {
+  const { data } = await getWpList("windturbine");
+  stationList.value = data || [];
+};
+const isStation = computed(() => stationList.length);
 const state = reactive({
   tableData: [],
   modelList: [],
@@ -106,24 +215,25 @@ const query = reactive({
 });
 let total = ref(0);
 onMounted(() => {
+  getStationList();
   getData();
-  getequipmentmodel_list()
+  getequipmentmodel_list();
 });
 const dialogclose = () => {
-  state.visible = false
-  getData()
-}
+  state.visible = false;
+  getData();
+};
 const getData = async () => {
-  const res = await windturbinebj_fetchTableData(query);
-  state.tableData = res.records;
-  total.value = res.total;
+  const { data } = await windturbinebj_fetchTableData(query);
+  state.tableData = data.records;
+  total.value = data.total;
 };
 const handleInsert = () => {
   state.visible = true;
 };
 const handleEditClick = (row) => {
   console.warn(row);
-  let obj = Object.assign({}, row)
+  let obj = Object.assign({}, row);
   state.form = obj;
   state.visible = true;
 };
@@ -134,16 +244,8 @@ const changeStation = async () => {
 };
 // 机型
 const getequipmentmodel_list = async () => {
-  const { data } = await getStationinfo(query.stationId);
-  if (query.stationId == '') {
-    let arr = []
-    data.forEach(e => {
-      arr.push(...e.pointModelList)
-    });
-    state.modelList = [...new Set(arr)]
-  } else {
-    state.modelList = data[0].pointModelList;
-  }
+  const { data } = await getWtModel(query.stationId);
+  state.modelList = data || [];
 };
 // 分页导航
 const handlePageChange = (val) => {
@@ -217,7 +319,7 @@ const handleSuccess = (response, file, fileList) => {
   ElMessage.success("导入成功!");
   getData();
 };
-const handleProgress = (response, file, fileList) => { };
+const handleProgress = (response, file, fileList) => {};
 const handleError = (response, file, fileList) => {
   ElMessage.success("导入失败!");
 };
@@ -391,7 +493,7 @@ const relatePartConvert = (val) => {
   margin-right: 10px;
 }
 
-.el-button+.el-button {
+.el-button + .el-button {
   margin-left: 10px;
 }
 </style>

+ 437 - 307
src/pages/baseData/fan_components/windturbine_components.vue

@@ -1,326 +1,456 @@
 <template>
-  <el-dialog v-model="isShow" width="800px" :before-close="handleClose">
-    <el-form ref="ruleFormRef" :model="form" :rules="rules" label-position="right" label-width="100px">
-      <el-row :gutter="50">
-        <el-col :span="12">
-          <el-form-item label="序列号" prop="id">
-            <el-input v-model="form.id" disabled />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="制造商" prop="manufacturerCode">
-            <el-select class="width-100" v-model="form.manufacturerCode">
-              <el-option v-for="item in state.creator" :key="item.id" :value="item.id" :label="item.name" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="50">
-        <el-col :span="12">
-          <el-form-item label="风机型号" prop="modelId">
-            <el-select class="width-100" v-model="form.modelId" @change="modelChange">
-              <el-option v-for="item in state.modelList" :key="item" :value="item" :label="item" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="风机测点" prop="uniformCode">
-            <el-select v-model="form.uniformCode" class="width-100" filterable placeholder="请选择">
-              <el-option v-for="item in state.pointList" :key="item.id" :label="item.uniformCode + '    ' + item.name"
-                :value="item.uniformCode">
-                <span style="float: left">{{ item.name }}</span>
-                <span style="float: right; color: #8492a6; font-size: 13px">{{ item.uniformCode }}</span>
-              </el-option>
-            </el-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="50">
-        <el-col :span="12">
-          <el-form-item label="停机类型" prop="characteristic">
-            <el-select class="width-100" v-model="form.characteristic">
-              <el-option v-for="item in state.CHARACTERISTIC" :key="item" :label="item" :value="item" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="故障编码" prop="faultCode">
-            <el-input v-model="form.faultCode" :disabled="isEdit" />
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="50">
-        <el-col :span="12">
-          <el-form-item label="描述" prop="chineseText">
-            <el-input v-model="form.chineseText" />
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="报警级别" prop="levelId">
-            <el-select class="width-100" v-model="form.levelId">
-              <el-option v-for="item in state.LEVELID" :key="item.id" :value="item.id" :label="item.name" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="50">
-        <el-col :span="12">
-          <el-form-item label="报警分类" prop="warningClassIfyId">
-            <el-select class="width-100" v-model="form.warningClassIfyId">
-              <el-option v-for="item in state.warningClassifyList" :key="item.id" :value="item.id" :label="item.name" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <!-- <el-col :span="12">
-          <el-form-item label="报警类型" prop="warningTypeId">
-            <el-select class="width-100" v-model="form.warningTypeId">
-              <el-option v-for="item in warningTypeList" :key="item.id" :value="item.id" :label="item.name" />
-            </el-select>
-          </el-form-item>
-        </el-col> -->
-        <el-col :span="12">
-          <el-form-item label="是否启用" prop="enabled">
-            <el-radio-group v-model="form.enabled">
-              <el-radio-button label="1">是</el-radio-button>
-              <el-radio-button label="0">否</el-radio-button>
-            </el-radio-group>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="50">
-        <el-col :span="12">
-          <el-form-item label="关联部件" prop="relatedParts">
-            <el-select class="width-100" v-model="form.relatedParts">
-              <el-option v-for="item in state.relatePartList" :key="item.id" :value="item.id" :label="item.name" />
-            </el-select>
-          </el-form-item>
-        </el-col>
-        <el-col :span="12">
-          <el-form-item label="是否可以复位" prop="isreset">
-            <el-radio-group v-model="form.isreset">
-              <el-radio-button label="0">是</el-radio-button>
-              <el-radio-button label="1">否</el-radio-button>
-            </el-radio-group>
-          </el-form-item>
-        </el-col>
-      </el-row>
-      <el-row :gutter="50">
-        <el-col :span="12"></el-col>
-      </el-row>
+  <el-dialog
+    v-model="isShow"
+    width="800px"
+    :before-close="dialogClose"
+    @closed="resetOptions"
+  >
+    <el-form
+      :model="dialogOptions"
+      :rules="rules"
+      label-width="120px"
+      ref="formRef"
+      inline
+    >
+      <el-form-item label="报警类别" prop="deviceType">
+        <el-select
+          v-model="dialogOptions.deviceType"
+          filterable
+          placeholder="请选择"
+          @change="
+            (res) => {
+              dialogOptions.stationId = '';
+              checkRules();
+              getWpList();
+            }
+          "
+        >
+          <el-option
+            v-for="item in categoryArray"
+            :key="item.id"
+            :label="item.label"
+            :value="item.id"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="序列号">
+        <el-input
+          v-model="dialogOptions.id"
+          placeholder="自动生成"
+          clearable
+          readonly
+        />
+      </el-form-item>
+      <el-form-item label="场站" prop="stationId">
+        <el-select
+          v-model="dialogOptions.stationId"
+          filterable
+          placeholder="请选择"
+          :disabled="!wpArray?.length"
+          @change="
+            (res) => {
+              dialogOptions.modelId = '';
+              getWtModel();
+            }
+          "
+        >
+          <el-option
+            v-for="item in wpArray"
+            :key="item.id"
+            :label="item.aname"
+            :value="item.id"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        label="设备型号"
+        prop="modelId"
+        v-if="dialogOptions.deviceType !== 'booststation'"
+      >
+        <el-select
+          v-model="dialogOptions.modelId"
+          filterable
+          placeholder="请选择"
+          :disabled="!modelArray?.length"
+        >
+          <el-option
+            v-for="item in modelArray"
+            :key="item"
+            :label="item"
+            :value="item"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="统一编码" prop="uniformCode">
+        <el-input v-model="dialogOptions.uniformCode" clearable />
+      </el-form-item>
+      <el-form-item label="特性" prop="characteristic">
+        <el-select
+          v-model="dialogOptions.characteristic"
+          filterable
+          placeholder="请选择"
+        >
+          <el-option
+            v-for="item in characteristicArray"
+            :key="item"
+            :label="item"
+            :value="item"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item label="故障编码">
+        <el-input v-model="dialogOptions.nemCode" clearable />
+      </el-form-item>
+      <el-form-item label="描述" prop="description">
+        <el-input
+          v-model="dialogOptions.description"
+          placeholder="请输入"
+          clearable
+        />
+      </el-form-item>
+      <el-form-item label="报警级别">
+        <el-select v-model="dialogOptions.rank" filterable placeholder="请选择">
+          <el-option
+            v-for="item in levelArray"
+            :key="item.id"
+            :label="item.label"
+            :value="item.id"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        label="测点"
+        prop="tagId"
+        v-if="dialogOptions.deviceType === 'booststation'"
+      >
+        <el-select
+          v-model="dialogOptions.tagId"
+          filterable
+          placeholder="请选择"
+        >
+          <el-option
+            v-for="item in pointArray"
+            :key="item.nemCode"
+            :label="item.name"
+            :value="item.nemCode"
+          />
+        </el-select>
+      </el-form-item>
+      <el-form-item
+        label="关键部件"
+        prop="components"
+        v-if="dialogOptions.deviceType !== 'booststation'"
+      >
+        <el-select v-model="dialogOptions.components" filterable>
+          <el-option-group
+            v-for="group in associatedComponentsArray"
+            :key="group.label"
+            :label="group.label"
+          >
+            <el-option
+              v-for="item in group.options"
+              :key="item.nemCode"
+              :label="item.name"
+              :value="item.nemCode"
+            />
+          </el-option-group>
+        </el-select>
+      </el-form-item>
+      <el-form-item label="是否启用">
+        <el-radio-group v-model="dialogOptions.enable">
+          <el-radio-button :label="true">是</el-radio-button>
+          <el-radio-button :label="false">否</el-radio-button>
+        </el-radio-group>
+      </el-form-item>
+      <el-form-item label="是否可复位">
+        <el-radio-group v-model="dialogOptions.resetTable">
+          <el-radio-button :label="true">是</el-radio-button>
+          <el-radio-button :label="false">否</el-radio-button>
+        </el-radio-group>
+      </el-form-item>
     </el-form>
     <template #footer>
       <span class="dialog-footer">
-        <el-button @click="closeDialog">取 消</el-button>
-        <el-button type="primary" @click="submitForm(ruleFormRef)">确 定</el-button>
+        <el-button @click="cancle">取 消</el-button>
+        <el-button type="primary" @click="checkData">确 定</el-button>
       </span>
     </template>
   </el-dialog>
 </template>
-<script setup>
-import { ref, onMounted, reactive, computed, watch, nextTick } from "vue";
-import { ElMessageBox, ElMessage } from "element-plus";
+<script>
 import {
-//   fetchRelatePart,
-  windturbinebj_postSave,
-//   getDIPointList,
-  getStationinfo,
-  fetchWarningClassify,
+  getWpList,
+  getBpList,
+  getWtModel,
+  getPointList,
+  fetchRelatePartAndAlarmType,
+  saveAlarmconfiguration,
 } from "/@/api/api.js";
-import { useStore } from "vuex";
-const store = useStore();
-const stationList = computed(() => store.state.stationList);
-onMounted(() => {
-  getfetchRelatePart();
-  getdatadictionaryList()
-  getfetchWarningClassify()
-});
-watch(
-  () => props.isVisible,
-  (val, old) => {
-    isShow.value = val
-  },
-  {
-    deep: true,
-  },
-);
-watch(
-  () => props.form?.id,
-  (val, old) => {
-    if (val != "") {
-      nextTick(async () => {
-        modelChange()
-      });
-    }
-  },
-  {
-    deep: true,
-  },
-);
-watch(
-  () => props.form,
-  (val, old) => {
-    nextTick(() => {
-      form.value = val
-    });
+export default {
+  props: {
+    isVisible: {
+      type: Boolean,
+      default: () => false,
+    },
+    form: {
+      type: Object,
+      default: () => {
+        return {};
+      },
+    },
   },
-  {
-    deep: true,
-  }
-)
-const isShow=ref(false);
-const form = ref({
-  id: "",
-  levelId: "",
-  manufacturerCode: "",
-  chineseText: "",
-  sequenceNumber: "",
-  characteristic: "",
-  modelId: "",
-  codeName: "1",
-  uniformCode: "",
-  enabled: "0",
-  warningClassIfyId: "",
-  standardTime: 2,
-  isreset: "1",
-  warningTypeId: "",
-  faultCode: "",
-  relatedParts: "",
-  userName: "",
-})
-const emits = defineEmits(["close"]);
-const props = defineProps({
-  isVisible: {
-    type: Boolean,
-    defaule: false,
+
+  data() {
+    return {
+      isShow: false,
+      dialogOptions: {
+        deviceType: "",
+        id: "",
+        stationId: "",
+        modelId: "",
+        uniformCode: "",
+        nemCode: "",
+        characteristic: "正常停机",
+        description: "",
+        rank: 1,
+        tagId: "",
+        components: "",
+        enable: false,
+        resetTable: false,
+      },
+      rules: {
+        deviceType: [
+          {
+            required: true,
+            message: "报警类型不可为空",
+            trigger: "change",
+          },
+        ],
+        stationId: [
+          {
+            required: true,
+            message: "场站不可为空",
+            trigger: "change",
+          },
+        ],
+        modelId: [
+          {
+            required: true,
+            message: "设备型号不可为空",
+            trigger: "change",
+          },
+        ],
+        uniformCode: [
+          {
+            required: true,
+            message: "统一编码不可为空",
+            trigger: "change",
+          },
+        ],
+        characteristic: [
+          {
+            required: true,
+            message: "统一编码不可为空",
+            trigger: "change",
+          },
+        ],
+        tagId: [
+          {
+            required: true,
+            message: "测点不可为空",
+            trigger: "change",
+          },
+        ],
+        description: [
+          {
+            required: true,
+            message: "描述不可为空",
+            trigger: "change",
+          },
+        ],
+        components: [
+          {
+            required: true,
+            message: "部件不可为空",
+            trigger: "change",
+          },
+        ],
+      },
+      categoryArray: [
+        { id: "windturbine", label: "风机报警" },
+        { id: "booststation", label: "升压站报警" },
+        { id: "inverter", label: "光伏报警" },
+      ],
+      wpArray: [],
+      modelArray: [],
+      characteristicArray: ["正常停机", "正常启动", "快速停机", "紧急停机"],
+      levelArray: [
+        { id: 1, label: "低级" },
+        { id: 2, label: "低中级" },
+        { id: 3, label: "中级" },
+        { id: 4, label: "中高级" },
+        { id: 5, label: "高级" },
+      ],
+      pointArray: [],
+      associatedComponentsArray: [],
+    };
   },
-  form: {
-    type: Object,
+
+  created() {
+    this.isShow = this.isVisible;
+    this.dialogOptions = Object.assign(this.dialogOptions, this.form);
+    this.checkRules();
+    this.getWpList();
+    this.getfetchRelatePart();
   },
-});
-const toEmits = () => {
-  emits("close"); // 向父组件传递数据
-};
-const state = reactive({
-  modelList: [],
-  pointList: [],
-  relatePartList: [],
-  warningClassifyList: [],
-  creator: [
-    {
-      id: "HFYG_CS",
-      name: "合肥阳光电源有限公司",
-      country: "中国",
-      place: "合肥",
+
+  methods: {
+    dialogClose(done) {
+      this.$confirm("确认关闭?")
+        .then(() => {
+          done();
+        })
+        .catch(() => {});
     },
-    { id: "AMS_CS", name: "艾默生", country: "", place: "" },
-    {
-      id: "NRJD_CS",
-      name: "国电南瑞吉电新能源",
-      country: "中国",
-      place: "",
+
+    cancle() {
+      this.$confirm("确认关闭?")
+        .then(() => {
+          this.isShow = false;
+        })
+        .catch(() => {});
     },
-    { id: "MGSK_CS", name: "美国赛康", country: "美国", place: "" },
-    { id: "LHDL_CS", name: "联合动力", country: "中国", place: "保定" },
-    { id: "SYHC_CS", name: "沈阳华创", country: "中国", place: "沈阳" },
-  ],
-  LEVELID: [
-    { id: "ZC_BJ", name: "运转正常" },
-    { id: "YJ_BJ", name: "运转状态超出标准范围" },
-    { id: "GZ_BJ", name: "非正常停止运转" },
-    { id: "WH_BJ", name: "停机维护" },
-    { id: "XD_BJ", name: "限电/计划停机" },
-  ],
-  CHARACTERISTIC: ["正常停机", "正常启动", "快速停机", "紧急停机"],
 
-});
-const ruleFormRef = ref(null);
-const rules = reactive({
-  manufacturerCode: {
-    required: true,
-    message: "请选择制造商",
-    trigger: "change",
-  },
-  uniformCode: {
-    required: true,
-    message: "请输入统一编码",
-    trigger: "trigger",
-  },
-  characteristic: {
-    required: true,
-    message: "请选择类别",
-    trigger: "trigger",
-  },
-  modelId: {
-    required: true,
-    message: "请选择风机型号",
-    trigger: "change",
-  },
-});
+    checkRules() {
+      const isBp = this.dialogOptions.deviceType === "booststation";
+      const isWt = this.dialogOptions.deviceType === "windturbine";
+      const isInv = this.dialogOptions.deviceType === "inverter";
+      this.rules.tagId.forEach((ele) => {
+        ele.required = isBp;
+      });
 
-const modelChange = async () => {
-  const { data } = await getDIPointList(form.value?.modelId);
-  state.pointList = data
-};
-//机型
-const getdatadictionaryList = async () => {
-  const { data } = await getStationinfo('');
-    let arr = []
-    data.forEach(e => {
-      arr.push(...e.pointModelList)
-    });
-    state.modelList = [...new Set(arr)]
-};
-//所属部件
-const getfetchRelatePart = async () => {
-  const res = await fetchRelatePart();
-  state.relatePartList = res;
-};
-const getfetchWarningClassify = async () => {
-  const res = await fetchWarningClassify();
-  state.warningClassifyList = res;
-};
+      this.rules.modelId.forEach((ele) => {
+        ele.required = !isBp;
+      });
 
-//保存
-const save = async () => {
-  const res = await windturbinebj_postSave(form.value);
-  console.warn(res);
-  ElMessage.success(`保存成功!`);
-  closeDialog()
-};
-//提交
-const submitForm = async (formEl) => {
-  if (!formEl) return;
-  await formEl.validate((valid, fields) => {
-    if (valid) {
-      save()
-    } else {
-      console.log("error submit!", fields);
-    }
-  });
-};
-//reset
-const resetForm = (formEl) => {
-  if (!formEl) return;
-  formEl.resetFields();
-};
-//confirm关闭
-const handleClose = () => {
-  ElMessageBox.confirm("确认关闭?")
-    .then(() => {
-      closeDialog();
-    })
-    .catch(() => {
-      // catch error
-    });
-};
-//关闭触发事件
-const closeDialog = () => {
-  resetForm(ruleFormRef.value);
-  toEmits();
+      this.rules.components.forEach((ele) => {
+        ele.required = isWt || isInv;
+      });
+    },
+
+    getWpList() {
+      if (
+        this.dialogOptions.deviceType === "windturbine" ||
+        this.dialogOptions.deviceType === "inverter"
+      ) {
+        getWpList(this.dialogOptions.deviceType).then((res) => {
+          this.dialogOptions.stationId = res?.data?.[0]?.id || "";
+          this.wpArray = res.data;
+          this.getWtModel();
+        });
+      } else {
+        getBpList().then((res) => {
+          this.dialogOptions.stationId = res?.data?.[0]?.id || "";
+          this.wpArray = res.data;
+          this.getWtModel();
+        });
+      }
+    },
+
+    getWtModel() {
+      getWtModel(this.dialogOptions.stationId).then((res) => {
+        this.dialogOptions.modelId = res?.data?.[0] || "";
+        this.modelArray = res.data;
+        if (this.dialogOptions.deviceType === "booststation") {
+          this.getPointList();
+        }
+      });
+    },
+
+    getPointList() {
+      getPointList({
+        subId: this.dialogOptions.stationId,
+      }).then((res) => {
+        this.pointArray = res.data.total;
+      });
+    },
+
+    getfetchRelatePart() {
+      fetchRelatePartAndAlarmType().then((res) => {
+        const keyMap = {
+          fjbj: "风机部件",
+          gfbj: "光伏部件",
+        };
+
+        let associatedComponentsArray = [];
+
+        for (let key in keyMap) {
+          associatedComponentsArray.push({
+            id: key,
+            label: keyMap[key],
+            options: res.data[key] || [],
+          });
+        }
+        this.dialogOptions.components =
+          associatedComponentsArray?.[0]?.options?.[0]?.nemCode || "";
+        this.associatedComponentsArray = associatedComponentsArray;
+      });
+    },
+
+    checkData() {
+      this.$refs.formRef.validate((valid, fields) => {
+        if (valid) {
+          saveAlarmconfiguration(
+            Object.assign(this.dialogOptions, {
+              alarmType:
+                this.dialogOptions.alarmType || this.dialogOptions.deviceType,
+            })
+          ).then((res) => {
+            if (res.code === 200) {
+              this.BASE.showMsg({
+                type: "success",
+                msg: "提交成功",
+              });
+              this.isShow = false;
+            }
+          });
+        }
+      });
+    },
+
+    resetOptions() {
+      this.dialogOptions = {
+        deviceType: "",
+        id: "",
+        stationId: "",
+        modelId: "",
+        uniformCode: "",
+        characteristic: "正常停机",
+        nemCode: "",
+        description: "",
+        rank: 1,
+        tagId: "",
+        components: "",
+        enable: false,
+        resetTable: false,
+      };
+      this.resetForm();
+    },
+
+    resetForm() {
+      this.$refs.formRef.resetFields();
+    },
+  },
+
+  watch: {
+    isVisible(value) {
+      this.isShow = value;
+    },
+    form(value) {
+      this.dialogOptions = value;
+      this.checkRules();
+      this.getWpList();
+    },
+  },
 };
-</script>
-<style scoped>
-.width-100 {
-  width: 100%;
-}
-</style>
+</script>

+ 87 - 29
src/pages/safe/historywaring.vue

@@ -144,32 +144,62 @@
       border
       stripe
     >
-      <el-table-column
-        v-for="item in state.isshowwindturbineName
-          ? state.tableHeader
-          : state.tableHeader1"
-        :label="item.title"
-        :prop="item.code"
-        :key="item.code"
-        :width="item.width ? item.width : 0"
-        show-overflow-tooltip
-        header-align="center"
-      >
-        <template #default="scope">
-          <span v-if="item.code == 'rank'">
-            {{ tableFilter(scope.row.rank) }}
-          </span>
-          <span v-else-if="item.code == 'alarmtype'">
-            {{ tableFilter(scope.row.alarmtype) }}
-          </span>
-          <span v-else-if="item.code == 'ts'">
-            {{ formatTime(scope.row.ts) }}
-          </span>
-          <span v-else>
-            {{ scope.row[item.code] }}
-          </span>
-        </template>
-      </el-table-column>
+      <template v-if="state.isshowwindturbineName">
+        <el-table-column
+          v-for="item in state.tableHeader"
+          :label="item.title"
+          :prop="item.code"
+          :key="item.code"
+          :width="item.width || ''"
+          show-overflow-tooltip
+          header-align="center"
+        >
+          <template #default="scope">
+            <p :style="item.style && item.style(item)">
+              <span v-if="item.code == 'rank'">
+                {{ tableFilter(scope.row.rank) }}
+              </span>
+              <span v-else-if="item.code == 'alarmtype'">
+                {{ tableFilter(scope.row.alarmtype) }}
+              </span>
+              <span v-else-if="item.code == 'ts'">
+                {{ formatTime(scope.row.ts) }}
+              </span>
+              <span v-else>
+                {{ scope.row[item.code] }}
+              </span>
+            </p>
+          </template>
+        </el-table-column>
+      </template>
+      <template v-else>
+        <el-table-column
+          v-for="item in state.tableHeader1"
+          :label="item.title"
+          :prop="item.code"
+          :key="item.code"
+          :width="item.width || ''"
+          show-overflow-tooltip
+          header-align="center"
+        >
+          <template #default="scope">
+            <p :style="item.style && item.style(item)">
+              <span v-if="item.code == 'rank'">
+                {{ tableFilter(scope.row.rank) }}
+              </span>
+              <span v-else-if="item.code == 'alarmtype'">
+                {{ tableFilter(scope.row.alarmtype) }}
+              </span>
+              <span v-else-if="item.code == 'ts'">
+                {{ formatTime(scope.row.ts) }}
+              </span>
+              <span v-else>
+                {{ scope.row[item.code] }}
+              </span>
+            </p>
+          </template>
+        </el-table-column>
+      </template>
     </el-table>
     <div class="pagination-wrapper">
       <el-pagination
@@ -227,6 +257,17 @@ const getfetchRelatePart = async () => {
   const { data } = await fetchRelatePartAndAlarmType();
   state.fetchListAll = data;
 };
+
+const getColumnStyle = (columnItem) => {
+  let style = "color:";
+  if (columnItem.endts) {
+    style += "var(--el-color-success)";
+  } else {
+    style += "var(--el-color-danger)";
+  }
+  return style;
+};
+
 const state = reactive({
   typeList: [
     {
@@ -271,13 +312,27 @@ const state = reactive({
     { title: "报警信息", code: "description", width: "180" },
     { title: "级别", code: "rank", width: "80" },
     { title: "类型", code: "alarmtype", width: "80" },
+    {
+      title: "状态",
+      code: "isCloseName",
+      width: "80",
+      style: getColumnStyle,
+      width: 100,
+    },
   ],
   tableHeader1: [
     { title: "时间", code: "ts", width: "150" },
     { title: "升压站", code: "stationname", width: "150" },
-    { title: "报警信息", code: "description", width: "180" },
+    { title: "报警信息", code: "description" },
     { title: "级别", code: "rank", width: "80" },
     { title: "类型", code: "alarmtype", width: "80" },
+    {
+      title: "状态",
+      code: "isCloseName",
+      style: getColumnStyle,
+      width: 100,
+      width: "80",
+    },
   ],
 });
 // 场站列表/升压站列表
@@ -285,7 +340,6 @@ const stationList = ref([]);
 
 const getStationList = async () => {
   const { data } = await getWpList(state.typeVal);
-  console.log(1111, data);
   stationList.value = data;
 };
 
@@ -326,6 +380,7 @@ const modelList = computed(() => {
     if (state.stationId == "") {
       return [];
     } else {
+      state.modelId = state.modelListAll[state.stationId]?.[0]?.id || "";
       return state.modelListAll[state.stationId];
     }
   } else {
@@ -375,7 +430,7 @@ const getAlarmHistoryt = async () => {
     deviceid:
       state.deviceId ||
       (state.typeVal == "booststation" ? "" : state.windturbineId),
-    modelId: state.modelId,
+    modelId: state.typeVal == "booststation" ? "" : state.modelId,
     components: state.components,
     description: state.description,
     begin: state.dateTime[0],
@@ -383,6 +438,9 @@ const getAlarmHistoryt = async () => {
   };
   const { data } = await alarm_history(params);
   query.pageTotal = data?.total;
+  data?.ls?.forEach((ele) => {
+    ele.isCloseName = ele.endts ? "已解除" : "未解除";
+  });
   state.tableData = data?.ls;
 };
 //报警类型变化

+ 243 - 0
src/pages/stopQuery/index.vue

@@ -0,0 +1,243 @@
+<template>
+  <div class="stopQueryBox">
+    <el-card>
+      <el-space wrap>
+        <div>
+          <span>风场:</span>
+          <el-select
+            v-model="wpId"
+            size="mini"
+            style="width: 150px"
+            placeholder="全部"
+            popper-class="select"
+            @change="
+              () => {
+                wtId = '';
+                getWtList();
+              }
+            "
+          >
+            <el-option
+              v-for="item in wpArray"
+              :key="item.id"
+              :value="item.id"
+              :label="item.aname"
+            >
+            </el-option>
+          </el-select>
+        </div>
+        <div>
+          <span>风机:</span>
+          <el-select
+            v-model="wtId"
+            clearable
+            size="mini"
+            style="width: 150px"
+            placeholder="全部"
+            popper-class="select"
+            @change="() => {}"
+          >
+            <el-option
+              v-for="item in wtArray"
+              :key="item.nemCode"
+              :value="item.nemCode"
+              :label="item.name"
+            >
+            </el-option>
+          </el-select>
+        </div>
+        <div>
+          <span>故障描述:</span>
+          <el-input
+            v-model="description"
+            style="width: 150px"
+            size="mini"
+            clearable
+          ></el-input>
+        </div>
+        <div>
+          <span>日期区间:</span>
+          <el-date-picker
+            v-model="dateRange"
+            size="mini"
+            type="datetimerange"
+            range-separator="-"
+            format="YYYY-MM-DD HH:mm:ss"
+            value-format="YYYY-MM-DD HH:mm:ss"
+            start-placeholder="开始时间"
+            end-placeholder="结束时间"
+            @change="getTableData"
+          >
+          </el-date-picker>
+        </div>
+        <el-button type="primary" size="mini" @click="getTableData"
+          >查询</el-button
+        >
+      </el-space>
+    </el-card>
+    <div class="table-wrapper">
+      <el-table
+        :data="tableData"
+        height="calc(100% - 35px - 10px)"
+        style="width: 100%"
+        border
+        stripe
+      >
+        <el-table-column
+          :label="item.label"
+          :prop="item.prop"
+          show-overflow-tooltip
+          header-align="center"
+          align="center"
+          v-for="(item, index) in tHeader"
+          :key="index"
+        >
+          <template #default="scope">
+            <span>
+              {{ scope.row[item.prop] }}
+            </span>
+          </template>
+        </el-table-column>
+      </el-table>
+      <div class="pagination-wrapper">
+        <el-pagination
+          background
+          layout="total, prev, pager, next"
+          hide-on-single-page
+          :current-page="pageNum"
+          :page-size="pageSize"
+          :total="total"
+          @current-change="currentChange"
+        ></el-pagination>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script>
+import dayJS from "dayjs";
+import {
+  getWpList,
+  fetchWindturbineList,
+  getStopQueryTableData,
+} from "/@/api/api.js";
+
+export default {
+  data() {
+    return {
+      wpId: "",
+      wpArray: [],
+      wtId: "",
+      wtArray: [],
+      dateRange: [],
+      description: "",
+      pageNum: 1,
+      pageSize: 15,
+      total: 0,
+      tableData: [],
+      tHeader: [
+        {
+          label: "设备编号",
+          prop: "code",
+        },
+        {
+          label: "停机时间",
+          prop: "stopTimeName",
+        },
+        {
+          label: "恢复启动时间",
+          prop: "startTimeName",
+        },
+        {
+          label: "停机小时数",
+          prop: "stopHours",
+        },
+        {
+          label: "损失电量",
+          prop: "lossPower",
+        },
+        {
+          label: "报警编号",
+          prop: "warningId",
+        },
+        {
+          label: "处理方式",
+          prop: " handleWay",
+        },
+        {
+          label: "故障现象",
+          prop: " aultView",
+        },
+      ],
+    };
+  },
+
+  created() {
+    this.dateRange = [
+      dayJS().subtract(7, "day").format("YYYY-MM-DD HH:mm:ss"),
+      dayJS().format("YYYY-MM-DD HH:mm:ss"),
+    ];
+    this.getWpList();
+  },
+
+  methods: {
+    async getWpList() {
+      const { data } = await getWpList("windturbine");
+      //   this.wpId = data?.[0]?.id || "";
+      this.wpId = "SXJ_KGDL_GJY_FDC_STA";
+      this.wpArray = data || [];
+      this.getWtList();
+    },
+
+    async getWtList() {
+      const { data } = await fetchWindturbineList(this.wpId);
+      this.wtArray = data || [];
+      this.getTableData();
+    },
+
+    async getTableData() {
+      const { data } = await getStopQueryTableData({
+        wpId: this.wpId,
+        wtId: this.wtId,
+        description: this.description,
+        begin: this.dateRange?.[0] || "",
+        end: this.dateRange?.[1] || "",
+        pageNum: this.pageNum,
+        pageSize: this.pageSize,
+      });
+
+      data?.records?.forEach((ele) => {
+        ele.stopTimeName = dayJS(ele.stopTime).format("YYYY-MM-DD HH:mm:ss");
+        ele.startTimeName = dayJS(ele.startTime).format("YYYY-MM-DD HH:mm:ss");
+      });
+
+      this.tableData = data?.records || [];
+      this.total = data.total || 0;
+    },
+
+    currentChange(pageNum) {
+      this.pageNum = pageNum;
+      this.getTableData();
+    },
+  },
+};
+</script>
+
+<style  lang="scss" scoped>
+.stopQueryBox {
+  height: 100%;
+  .table-wrapper {
+    height: calc(100% - 70px - 50px);
+    background-color: #fff;
+    margin-top: 10px;
+    padding: 20px;
+    .pagination-wrapper :deep {
+      text-align: right;
+      margin-top: 10px;
+      .el-icon {
+        width: unset;
+      }
+    }
+  }
+}
+</style>

+ 27 - 14
src/router/index.js

@@ -77,6 +77,19 @@ const routes = [
               ),
           },
           {
+            path: "/safe/stopQuery",
+            name: "stopQuery",
+            isshow: "super_admin,common",
+            meta: {
+              title: "停机查询",
+            },
+            component: () =>
+              import(
+                /* webpackChunkName: "form" */
+                "../pages/stopQuery/index.vue"
+              ),
+          },
+          {
             path: "/safe/dataSearch",
             name: "safedataSearch",
             isshow: "super_admin,common",
@@ -319,20 +332,20 @@ const routes = [
             "../pages/routerView.vue"
           ),
         children: [
-          //   {
-          //     icon: "el-icon-s-home",
-          //     path: "/basedata/device",
-          //     name: "basedatadevice",
-          //     meta: {
-          //       title: "设备模型",
-          //       keepAlive: true,
-          //     },
-          //     component: () =>
-          //       import(
-          //         /* webpackChunkName: "form" */
-          //         "../pages/baseData/device.vue"
-          //       ),
-          //   },
+          {
+            icon: "el-icon-s-home",
+            path: "/basedata/device",
+            name: "basedatadevice",
+            meta: {
+              title: "设备模型",
+              keepAlive: true,
+            },
+            component: () =>
+              import(
+                /* webpackChunkName: "form" */
+                "../pages/baseData/device.vue"
+              ),
+          },
           {
             icon: "el-icon-s-home",
             path: "/basedata/dictionary",