123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- <template>
- <div class="safeCom" @click="clickAlarmItem">
- <div class="safeCom_head">
- <i
- :class="['iconfont', iconfonts()]"
- style="font-size: 24px; margin-right: 10px"
- ></i>
- <div style="display: flex; justify-content: space-between; width: 100%">
- <div class="safeCom_title">{{ title }}</div>
- <div
- style="font-size: 14px; position: relative; right: 35px; top: 15px"
- >
- 共{{ alarmList.length }}/{{ fullTableData.length }}条
- </div>
- </div>
- </div>
- <el-table :data="alarmList" style="width: 100%" height="calc(100% - 51px)">
- <el-table-column
- prop="tsName"
- label="报警时间"
- width="150"
- show-overflow-tooltip
- />
- <el-table-column
- prop="lvName"
- label="报警等级"
- show-overflow-tooltip
- />
- <el-table-column
- prop="alarmName"
- label="报警类型"
- show-overflow-tooltip
- />
- <el-table-column
- prop="isCloseName"
- label="是否解除"
- show-overflow-tooltip
- />
- </el-table>
- <el-dialog
- v-model="showDialog"
- :title="title"
- top="50px"
- width="75%"
- modal-class="alarmDialog"
- :show-close="false"
- draggable
- @closed="
- () => {
- stopUpdate = false;
- }
- "
- >
- <el-card>
- <el-table
- :data="dialogTableData"
- style="width: 100%"
- height="420px"
- border
- >
- <el-table-column
- prop="tsName"
- label="报警时间"
- width="150"
- show-overflow-tooltip
- />
- <el-table-column
- prop="code"
- label="报警设备"
- show-overflow-tooltip
- />
- <el-table-column
- prop="alarmName"
- label="报警类型"
- show-overflow-tooltip
- />
- <el-table-column
- prop="characteristic"
- label="报警特征"
- show-overflow-tooltip
- />
- <el-table-column
- prop="isCloseName"
- label="报警是否解除"
- show-overflow-tooltip
- />
- <el-table-column
- prop="faultCause"
- label="报警故障原因"
- show-overflow-tooltip
- />
- <el-table-column
- prop="resolvent"
- label="报警解决方法"
- show-overflow-tooltip
- />
- <el-table-column label="操作">
- <template #default="scope">
- <el-button type="text" size="small" @click="confirm(scope.row)"
- >确认本条</el-button
- >
- </template>
- </el-table-column>
- </el-table>
- </el-card>
- <el-button class="confirmAllBtn" type="info" plain @click="confirmAll"
- >确认所有报警</el-button
- >
- </el-dialog>
- </div>
- </template>
- <script>
- export default {
- props: {
- title: {
- type: String,
- default: () => {
- return "";
- },
- },
- deviceType: {
- type: String,
- default: () => {
- return "";
- },
- },
- alarmType: {
- type: String,
- default: () => {
- return "";
- },
- },
- },
- data() {
- return {
- alarmList: [],
- iconfontsObj: {
- booststation: "iconIOTtubiao_huabanfuben",
- windturbine: "iconfengji",
- custom: "iconzidingyi",
- inverter: "iconzidingyi",
- },
- showDialog: false,
- dialogTableData: [],
- fullTableData: [],
- stopUpdate: false,
- };
- },
- created() {
- this.initWarningList();
- },
- methods: {
- iconfonts() {
- return this.iconfontsObj[this.deviceType];
- },
- initWarningList() {
- let alarmList = [];
- let fullTableData = [];
- let dialogTableData = [];
- this.$store.state.warningList.forEach((ele) => {
- if (
- this.deviceType === ele.deviceType &&
- this.alarmType === ele.alarmType
- ) {
- alarmList?.length < this.$store.state.warningListLimitLength &&
- alarmList.push(ele);
- dialogTableData?.length < 50 && dialogTableData.push(ele);
- fullTableData.push(ele);
- }
- });
- alarmList.sort((a, b) => {
- return b.ts - a.ts;
- });
- dialogTableData.sort((a, b) => {
- return b.ts - a.ts;
- });
- fullTableData.sort((a, b) => {
- return b.ts - a.ts;
- });
- this.alarmList = alarmList;
- if (!this.stopUpdate) {
- this.dialogTableData = dialogTableData;
- }
- this.fullTableData = fullTableData;
- },
- clickAlarmItem() {
- this.showDialog = true;
- },
- confirm(alarmItem) {
- this.stopUpdate = true;
- this.$confirm("您确定要执行此操作吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- confirmAlart([alarmItem]).then((res) => {
- if (res.code === 200) {
- this.BASE.showMsg({
- type: "success",
- msg: `${this.title}确认成功`,
- });
- this.$store.commit("removeWarning", alarmItem);
- this.playAudioEffect();
- }
- this.stopUpdate = false;
- });
- })
- .catch(() => {
- this.stopUpdate = false;
- });
- },
- confirmAll() {
- this.stopUpdate = true;
- this.$confirm("您确定要执行此操作吗?", "提示", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning",
- })
- .then(() => {
- confirmAlart(this.dialogTableData).then((res) => {
- if (res.code === 200) {
- this.BASE.showMsg({
- type: "success",
- msg: `全部${this.title}确认成功`,
- });
- this.$store.commit("removeWarning", this.dialogTableData);
- this.playAudioEffect();
- }
- this.stopUpdate = false;
- });
- })
- .catch(() => {
- this.stopUpdate = false;
- });
- },
- },
- watch: {
- "$store.state.warningList.length"() {
- this.initWarningList();
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .safeCom {
- width: 100%;
- height: calc(100% - 20px);
- cursor: pointer;
- .safeCom_head {
- height: 50px;
- display: flex;
- align-items: center;
- border-bottom: 1.5px solid rgb(221, 221, 221);
- .safeCom_title {
- font-size: 24px;
- text-align: center;
- }
- .safeCom_fifter {
- flex: 1;
- }
- }
- }
- .currentAlartDialogHeader {
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
- </style>
- <style lang="scss">
- .alarmDialog {
- .el-dialog__body {
- height: 500px;
- max-height: 500px;
- padding: 0;
- overflow: hidden;
- .el-card {
- width: calc(100% - 40px);
- height: calc(100% - 40px);
- margin: 20px;
- }
- .confirmAllBtn {
- position: absolute;
- right: 20px;
- top: 20px;
- }
- }
- }
- </style>
- <style lang="scss" >
- .alarmDialog {
- z-index: 5100 !important;
- }
- </style>
|