|
@@ -7,18 +7,23 @@
|
|
|
<div class="filter-item">
|
|
|
站点:
|
|
|
<el-select
|
|
|
- v-model="region"
|
|
|
+ v-model="store.state.siteId"
|
|
|
placeholder="请选择"
|
|
|
style="width: 200px"
|
|
|
+ clearable
|
|
|
>
|
|
|
- <el-option label="已执行" value="1"></el-option>
|
|
|
- <el-option label="未执行" value="2"></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="item in store.state.siteList"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.siteName"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
</div>
|
|
|
<div class="filter-item">
|
|
|
时间:
|
|
|
<el-date-picker
|
|
|
- v-model="value1"
|
|
|
+ v-model="dateValue"
|
|
|
type="datetimerange"
|
|
|
range-separator="至"
|
|
|
start-placeholder="开始日期"
|
|
@@ -27,7 +32,9 @@
|
|
|
></el-date-picker>
|
|
|
</div>
|
|
|
<el-button class="search-button">重置</el-button>
|
|
|
- <el-button type="primary" class="search-button">搜索</el-button>
|
|
|
+ <el-button type="primary" class="search-button" @click="listSelect()">
|
|
|
+ 搜索
|
|
|
+ </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -47,60 +54,63 @@
|
|
|
<div @click="handleClick(scope.row)">{{ scope.row.siteName }}</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="totalNum" label="总数">
|
|
|
+ <el-table-column prop="totalGrade" label="总数">
|
|
|
<template #default="scope">
|
|
|
<span
|
|
|
class="gradualBg total"
|
|
|
- :class="{ transparent: scope.row.totalNum == 0 }"
|
|
|
+ :class="{ transparent: scope.row.totalGrade == 0 }"
|
|
|
:style="{
|
|
|
- width: (scope.row.totalNum / this.allMaxData.totalNumMax) * 100 + '%',
|
|
|
+ width:
|
|
|
+ (scope.row.totalGrade / allMaxData.totalNumMax) * 100 + '%',
|
|
|
}"
|
|
|
@click="goAlarmTotal"
|
|
|
>
|
|
|
- {{ scope.row.totalNum }}
|
|
|
+ {{ scope.row.totalGrade }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="oneAlarming" label="一级告警" width="">
|
|
|
+ <el-table-column prop="oneGrade" label="一级告警" width="">
|
|
|
<template #default="scope">
|
|
|
<span
|
|
|
class="gradualBg"
|
|
|
- :class="{ transparent: scope.row.oneAlarming == 0 }"
|
|
|
+ :class="{ transparent: scope.row.oneGrade == 0 }"
|
|
|
:style="{
|
|
|
- width: (scope.row.oneAlarming / this.allMaxData.oneAlarmingMax) * 100 + '%',
|
|
|
+ width:
|
|
|
+ (scope.row.oneGrade / allMaxData.oneAlarmingMax) * 100 + '%',
|
|
|
}"
|
|
|
@click="goAlarmTotal"
|
|
|
>
|
|
|
- {{ scope.row.oneAlarming }}
|
|
|
+ {{ scope.row.oneGrade }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="twoAlarming" label="二级告警" width="">
|
|
|
+ <el-table-column prop="twoGrade" label="二级告警" width="">
|
|
|
<template #default="scope">
|
|
|
<span
|
|
|
class="gradualBg"
|
|
|
- :class="{ transparent: scope.row.twoAlarming == 0 }"
|
|
|
+ :class="{ transparent: scope.row.twoGrade == 0 }"
|
|
|
:style="{
|
|
|
- width: (scope.row.twoAlarming / this.allMaxData.twoAlarmingMax) * 100 + '%',
|
|
|
+ width:
|
|
|
+ (scope.row.twoGrade / allMaxData.twoAlarmingMax) * 100 + '%',
|
|
|
}"
|
|
|
@click="goAlarmTotal"
|
|
|
>
|
|
|
- {{ scope.row.twoAlarming }}
|
|
|
+ {{ scope.row.twoGrade }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<!-- <el-table-column prop="other" label="其他" width=""></el-table-column> -->
|
|
|
- <el-table-column prop="other" label="其他" width="">
|
|
|
+ <el-table-column prop="otherGrade" label="其他" width="">
|
|
|
<template #default="scope">
|
|
|
<span
|
|
|
class="gradualBg"
|
|
|
- :class="{ transparent: scope.row.other == 0 }"
|
|
|
+ :class="{ transparent: scope.row.otherGrade == 0 }"
|
|
|
:style="{
|
|
|
- width: (scope.row.other / this.allMaxData.otherMax) * 100 + '%',
|
|
|
+ width: (scope.row.otherGrade / allMaxData.otherMax) * 100 + '%',
|
|
|
}"
|
|
|
@click="goAlarmTotal"
|
|
|
>
|
|
|
- {{ scope.row.other }}
|
|
|
+ {{ scope.row.otherGrade }}
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
@@ -112,11 +122,11 @@
|
|
|
<el-pagination
|
|
|
@size-change="handleSizeChange"
|
|
|
@current-change="handleCurrentChange"
|
|
|
- :current-page="currentPage4"
|
|
|
- :page-sizes="[100, 200, 300, 400]"
|
|
|
- :page-size="100"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-sizes="[15, 20, 25, 30]"
|
|
|
+ :page-size="pageSize"
|
|
|
layout="total, sizes, prev, pager, next, jumper"
|
|
|
- :total="400"
|
|
|
+ :total="total"
|
|
|
></el-pagination>
|
|
|
</div>
|
|
|
|
|
@@ -130,165 +140,150 @@
|
|
|
|
|
|
<script>
|
|
|
import alarmTotal from './alarmTotal'
|
|
|
-export default {
|
|
|
+import { useStore } from 'vuex'
|
|
|
+import { computed, defineComponent, onMounted, ref } from 'vue'
|
|
|
+import * as api from '@/api/alarmManage/index'
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { useRouter } from 'vue-router'
|
|
|
+export default defineComponent({
|
|
|
components: { alarmTotal },
|
|
|
name: 'VariableList',
|
|
|
+ setup() {
|
|
|
+ const store = useStore()
|
|
|
+ const router = useRouter()
|
|
|
|
|
|
- data() {
|
|
|
- return {
|
|
|
- pageShow: true,
|
|
|
- value1: [new Date(2000, 10, 10, 10, 10), new Date(2000, 10, 11, 10, 10)],
|
|
|
- select: 1,
|
|
|
- currentPage4: 4,
|
|
|
+ const pageShow = ref(true)
|
|
|
+ const dateValue = ref([
|
|
|
+ new Date(2021, 10, 10, 10, 10),
|
|
|
+ new Date(2021, 10, 11, 10, 10),
|
|
|
+ ])
|
|
|
|
|
|
- showDialog: false,
|
|
|
- tabPosition: 'one',
|
|
|
+ const total = ref(400)
|
|
|
+ const pageSize = ref(15)
|
|
|
+ const currentPage = ref(1)
|
|
|
+ const tableData = ref([])
|
|
|
|
|
|
- input: '',
|
|
|
- region: '',
|
|
|
- tableData: [
|
|
|
- {
|
|
|
- other: '10',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '626',
|
|
|
- oneAlarming: '10',
|
|
|
- twoAlarming: '10',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '10',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '626',
|
|
|
- oneAlarming: '10',
|
|
|
- twoAlarming: '10',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '10',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '626',
|
|
|
- oneAlarming: '10',
|
|
|
- twoAlarming: '10',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '10',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '626',
|
|
|
- oneAlarming: '10',
|
|
|
- twoAlarming: '10',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '10',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '626',
|
|
|
- oneAlarming: '10',
|
|
|
- twoAlarming: '10',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '10',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '66',
|
|
|
- oneAlarming: '10',
|
|
|
- twoAlarming: '10',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '0',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '6',
|
|
|
- oneAlarming: '3',
|
|
|
- twoAlarming: '10',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '0',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '3',
|
|
|
- oneAlarming: '3',
|
|
|
- twoAlarming: '3',
|
|
|
- },
|
|
|
- {
|
|
|
- other: '0',
|
|
|
- siteName: '测试站点1',
|
|
|
- totalNum: '1',
|
|
|
- oneAlarming: '2',
|
|
|
- twoAlarming: '0',
|
|
|
- },
|
|
|
- ],
|
|
|
+ //查询
|
|
|
+ function listSelect() {
|
|
|
+ api
|
|
|
+ .alarmGradeCount({
|
|
|
+ siteId: store.state.siteId,
|
|
|
+ size: pageSize.value,
|
|
|
+ current: currentPage.value,
|
|
|
+ })
|
|
|
+ .then((requset) => {
|
|
|
+ if (requset.status === 'SUCCESS') {
|
|
|
+ console.log(requset.data.records)
|
|
|
+ total.value = requset.data.total
|
|
|
+ tableData.value = requset.data.records
|
|
|
+ } else {
|
|
|
+ ElMessage.error(requset.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
- },
|
|
|
- computed: {
|
|
|
|
|
|
- allMaxData:function(){
|
|
|
+ //查看
|
|
|
+ const handleClick = (row) => {
|
|
|
+ alert('查看对应站点(页面跳转)')
|
|
|
+ console.log(row)
|
|
|
+ }
|
|
|
|
|
|
- var allMaxData = {};
|
|
|
+ const handleSizeChange = (val) => {
|
|
|
+ console.log(`每页 ${val} 条`)
|
|
|
+ }
|
|
|
|
|
|
- var totalNumData = [];
|
|
|
- var oneAlarmingData = [];
|
|
|
- var twoAlarmingData = [];
|
|
|
- var otherData = [];
|
|
|
+ const handleCurrentChange = (val) => {
|
|
|
+ console.log(`当前页: ${val}`)
|
|
|
+ }
|
|
|
|
|
|
- this.tableData.forEach((element,index) => {
|
|
|
- totalNumData[index] = element.totalNum;
|
|
|
- oneAlarmingData[index] = element.oneAlarming;
|
|
|
- twoAlarmingData[index] = element.twoAlarming;
|
|
|
- otherData[index] = element.other;
|
|
|
- });
|
|
|
+ const goVariableList = () => {
|
|
|
+ // 跳转至订单列表页面传参
|
|
|
+ router.push({
|
|
|
+ path: '../siteManage/variableList/index.vue',
|
|
|
+ })
|
|
|
+ // this.$router.push({ name:'variableList'})
|
|
|
+ }
|
|
|
|
|
|
- allMaxData.totalNumMax = Math.max.apply(Math,totalNumData);
|
|
|
- allMaxData.oneAlarmingMax = Math.max.apply(Math,oneAlarmingData);
|
|
|
- allMaxData.twoAlarmingMax = Math.max.apply(Math,twoAlarmingData);
|
|
|
- allMaxData.otherMax = Math.max.apply(Math,otherData);
|
|
|
+ const getMsgFormSon = () => {
|
|
|
+ pageShow.value = !pageShow.value
|
|
|
+ }
|
|
|
+ const goAlarmTotal = () => {
|
|
|
+ pageShow.value = !pageShow.value
|
|
|
+ }
|
|
|
|
|
|
- return allMaxData;
|
|
|
+ onMounted(() => {
|
|
|
+ listSelect()
|
|
|
+ })
|
|
|
|
|
|
- },
|
|
|
- },
|
|
|
- methods: {
|
|
|
+ const allMaxData = computed(() => {
|
|
|
+ var allMaxData = {}
|
|
|
|
|
|
-
|
|
|
- getMsgFormSon() {
|
|
|
- this.pageShow = !this.pageShow
|
|
|
- },
|
|
|
+ var totalNumData = []
|
|
|
+ var oneAlarmingData = []
|
|
|
+ var twoAlarmingData = []
|
|
|
+ var otherData = []
|
|
|
+
|
|
|
+ tableData.value.forEach((element, index) => {
|
|
|
+ totalNumData[index] = element.totalGrade
|
|
|
+ oneAlarmingData[index] = element.oneGrade
|
|
|
+ twoAlarmingData[index] = element.twoGrade
|
|
|
+ otherData[index] = element.otherGrade
|
|
|
+ })
|
|
|
+
|
|
|
+ allMaxData.totalNumMax = Math.max.apply(Math, totalNumData)
|
|
|
+ allMaxData.oneAlarmingMax = Math.max.apply(Math, oneAlarmingData)
|
|
|
+ allMaxData.twoAlarmingMax = Math.max.apply(Math, twoAlarmingData)
|
|
|
+ allMaxData.otherMax = Math.max.apply(Math, otherData)
|
|
|
+
|
|
|
+ return allMaxData
|
|
|
+ })
|
|
|
|
|
|
- goAlarmTotal() {
|
|
|
- this.pageShow = !this.pageShow
|
|
|
- },
|
|
|
- //查看
|
|
|
- handleClick(row) {
|
|
|
- alert('查看对应站点(页面跳转)')
|
|
|
- console.log(row)
|
|
|
- },
|
|
|
//自定义列样式
|
|
|
- cellStyle({ row, column, rowIndex, columnIndex }) {
|
|
|
- row, column, rowIndex
|
|
|
+ const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
|
|
|
+ row, column, rowIndex
|
|
|
// console.log(row, column, rowIndex)
|
|
|
if (columnIndex === 0) {
|
|
|
return `color:#0284E8;cursor:pointer`
|
|
|
}
|
|
|
- if (columnIndex ) {
|
|
|
+ if (columnIndex) {
|
|
|
// return `text-align:left;cursor:pointer;`
|
|
|
} else {
|
|
|
return ''
|
|
|
}
|
|
|
- },
|
|
|
-
|
|
|
- handleSizeChange(val) {
|
|
|
- console.log(`每页 ${val} 条`)
|
|
|
- },
|
|
|
- handleCurrentChange(val) {
|
|
|
- console.log(`当前页: ${val}`)
|
|
|
- },
|
|
|
-
|
|
|
+ }
|
|
|
// 表头样式设置
|
|
|
- goVariableList() {
|
|
|
- // 跳转至订单列表页面传参
|
|
|
- this.$router.push({
|
|
|
- path: '../siteManage/variableList/index.vue',
|
|
|
- })
|
|
|
- // this.$router.push({ name:'variableList'})
|
|
|
- },
|
|
|
- headClass() {
|
|
|
+ const headClass = () => {
|
|
|
return 'background:#FAFAFA;'
|
|
|
- },
|
|
|
+ }
|
|
|
+ return {
|
|
|
+ headClass,
|
|
|
+ goVariableList,
|
|
|
+ handleCurrentChange,
|
|
|
+ handleSizeChange,
|
|
|
+ cellStyle,
|
|
|
+ handleClick,
|
|
|
+ goAlarmTotal,
|
|
|
+ getMsgFormSon,
|
|
|
+ listSelect,
|
|
|
+
|
|
|
+ store,
|
|
|
+ pageShow,
|
|
|
+ dateValue,
|
|
|
+
|
|
|
+ total,
|
|
|
+ pageSize,
|
|
|
+ currentPage,
|
|
|
+ tableData,
|
|
|
+
|
|
|
+ showDialog: false,
|
|
|
+ tabPosition: 'one',
|
|
|
+
|
|
|
+ input: '',
|
|
|
+ region: '',
|
|
|
+ allMaxData,
|
|
|
+ }
|
|
|
},
|
|
|
-}
|
|
|
+})
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|