123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- <template>
- <div class="fanMonitor">
- <div class="title-top" @click="getDetail">局部通风系统</div>
- <div class="toggle-search">
- <i class="icon-search">
- <SvgIcon class="icon" size="14" name="toggle" />
- </i>
- <a-select
- v-model:value="searchValue"
- style="width: 180px; margin-right: 10px"
- :options="fanTypeList"
- aria-placeholder="请选择"
- @change="changeSelect"
- />
- <div class="status-yx">
- <div class="now-name">
- <i style="margin: 0px 5px 0px 5px">
- <SvgIcon class="icon" size="14" name="yxfj" />
- </i>
- <span style="color: #fff">运行风机</span>
- </div>
- <div class="now-status">{{ fjStatus }}</div>
- </div>
- </div>
- <div class="fan-contents">
- <div class="fan" ref="fan"></div>
- </div>
- </div>
- </template>
- <script lang="ts" setup>
- import { ref, reactive, onMounted, nextTick, defineProps, watch } from 'vue';
- import { SvgIcon } from '/@/components/Icon';
- import * as echarts from 'echarts';
- import { useGo } from '/@/hooks/web/usePage';
- let props = defineProps({
- fandata: Array,
- });
- const emit = defineEmits(['goDetail']);
- const go = useGo();
- let searchValue = ref('');
- let fanList = reactive<any[]>([]);
- let fanTypeList = reactive<any[]>([]); //下拉列表
- let fjStatus = ref(''); //运行风机
- //获取dom节点
- let fan = ref<any>();
- //echart图表数据
- let echartData = reactive<any>({
- xdata: 0,
- ydata: 0,
- });
- //跳转详情
- function getDetail() {
- emit('goDetail', 'ju');
- }
- //选项切换
- function changeSelect(val) {
- switch (val) {
- case '局扇监测':
- fjStatus.value =
- fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.Fan1StartStatus == '1'
- ? '1号风机'
- : fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.Fan2StartStatus == '1'
- ? '2号风机'
- : '';
- echartData.xdata = fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.windQuantity1;
- echartData.ydata = fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.windQuantity2;
- getOption();
- break;
- case '局部通风机系统':
- fjStatus.value =
- fanList.filter((v) => v.strinstallpos == '局扇监测')[1].readData.Fan1StartStatus == '1'
- ? '1号风机'
- : fanList.filter((v) => v.strinstallpos == '局扇监测')[0].readData.Fan2StartStatus == '1'
- ? '2号风机'
- : '';
- echartData.xdata = fanList.filter((v) => v.strinstallpos == '局扇监测')[1].readData.windQuantity1;
- echartData.ydata = fanList.filter((v) => v.strinstallpos == '局扇监测')[1].readData.windQuantity2;
- getOption();
- break;
- }
- }
- function getOption() {
- nextTick(() => {
- const myChart = echarts.init(fan.value);
- let option = {
- grid: {
- top: '20%',
- left: '7%',
- bottom: '14%',
- right: '7%',
- containLabel: true,
- },
- xAxis: [
- {
- type: 'category',
- data: ['吸风量', '供风量'],
- axisTick: {
- alignWithLabel: true,
- },
- nameTextStyle: {
- color: 'red',
- },
- axisLine: {
- //坐标轴轴线相关设置。数学上的x轴
- show: true,
- lineStyle: {
- color: 'rgba(62, 103, 164)',
- },
- },
- axisLabel: {
- //坐标轴刻度标签的相关设置
- textStyle: {
- color: '#b3b8cc',
- padding: 10,
- fontSize: 14,
- },
- formatter: function (data) {
- return data;
- },
- },
- },
- ],
- yAxis: [
- {
- type: 'value',
- min: 0,
- name: '(m³/min)',
- nameTextStyle: {
- color: '#b3b8cc',
- fontSize: 12,
- padding: 0,
- },
- splitLine: {
- show: false,
- lineStyle: {
- color: 'rgba(62, 103, 164,.4)',
- },
- },
- axisLine: {
- show: true,
- lineStyle: {
- color: 'rgba(62, 103, 164)',
- },
- },
- axisLabel: {
- show: true,
- textStyle: {
- color: '#b3b8cc',
- padding: 0,
- fontSize: 14,
- },
- formatter: function (value) {
- if (value === 0) {
- return value;
- }
- return value;
- },
- },
- axisTick: {
- show: false,
- },
- },
- ],
- series: [
- {
- name: '',
- type: 'pictorialBar',
- symbolSize: [60, 16],
- symbolOffset: [0, -10],
- symbolPosition: 'end',
- z: 12,
- //"barWidth": "20",
- label: {
- normal: {
- show: true,
- position: 'top',
- formatter: '{c}',
- color: '#fff',
- },
- },
- data: [
- {
- value: echartData.xdata,
- itemStyle: {
- color: '#59cb42',
- },
- },
- {
- value: echartData.ydata,
- itemStyle: {
- color: '#3cefff',
- },
- },
- ],
- },
- {
- name: '',
- type: 'pictorialBar',
- symbolSize: [60, 16],
- symbolOffset: [0, 10],
- // "barWidth": "20",
- z: 12,
- data: [
- {
- value: 100,
- itemStyle: {
- color: '#59cb42',
- },
- },
- {
- value: 100,
- itemStyle: {
- color: '#3cefff',
- },
- },
- ],
- },
- {
- name: '',
- type: 'pictorialBar',
- symbolSize: [90, 30],
- symbolOffset: [0, 20],
- z: 10,
- itemStyle: {
- normal: {
- color: 'transparent',
- borderColor: '#14b1eb',
- borderType: 'dashed',
- borderWidth: 5,
- },
- },
- data: [100, 100],
- },
- {
- type: 'bar',
- itemStyle: {
- normal: {
- //color: '#14b1eb',
- opacity: 0.7,
- },
- },
- //silent: true,
- barWidth: '60',
- //barGap: '-100%', // Make series be overlap
- data: [
- {
- value: echartData.xdata,
- itemStyle: {
- color: '#59cb42',
- },
- },
- {
- value: echartData.ydata,
- itemStyle: {
- color: '#3cefff',
- },
- },
- ],
- markLine: {
- symbol: 'none',
- label: {
- position: 'middle',
- formatter: '{b}',
- },
- data: [
- {
- name: '目标值',
- yAxis: 40, //res.targetTwo,
- lineStyle: {
- color: 'rgba(0, 119, 233,.8)',
- },
- },
- ],
- },
- },
- ],
- };
- myChart.setOption(option);
- window.onresize = function () {
- myChart.resize();
- };
- });
- }
- watch(
- () => props.fandata,
- (val) => {
- console.log(val, '局部风机数据');
- fanList = val[0];
- fanTypeList.length = 0;
- fanList.forEach((el) => {
- fanTypeList.push({
- label: el.strinstallpos,
- value: el.strinstallpos,
- });
- });
- searchValue.value = fanTypeList[0].value;
- console.log(searchValue.value, '77777');
- changeSelect(searchValue.value);
- },
- {
- deep: true,
- }
- );
- onMounted(() => {});
- </script>
- <style lang="less" scoped>
- @font-face {
- font-family: 'douyuFont';
- src: url('../../../../../assets/font/douyuFont.otf');
- }
- .fanMonitor {
- width: 100%;
- height: 100%;
- position: relative;
- .title-top {
- position: absolute;
- top: 9px;
- left: 46px;
- color: #fff;
- font-size: 16px;
- font-family: 'douyuFont';
- cursor: pointer;
- &:hover {
- color: #66ffff;
- }
- }
- .toggle-search {
- position: absolute;
- left: 9px;
- top: 37px;
- display: flex;
- .icon-search {
- position: absolute;
- top: 50%;
- left: 5px;
- transform: translate(0%, -50%);
- }
- .status-yx {
- height: 30px;
- width: 180px;
- background-color: rgba(8, 148, 255, 0.3);
- border: 1px solid #1d80da;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .now-status {
- margin-right: 5px;
- padding-top: 3px;
- font-family: 'douyuFont';
- color: #3df6ff;
- }
- }
- }
- .fan-contents {
- position: absolute;
- top: 66px;
- left: 0;
- height: calc(100% - 66px);
- width: 100%;
- .fan {
- width: 100%;
- height: 100%;
- }
- }
- }
- :deep .zxm-select-selector {
- width: 100%;
- height: 30px !important;
- padding: 0 11px 0px 25px !important;
- background-color: rgba(8, 148, 255, 0.3) !important;
- border: 1px solid #1d80da !important;
- }
- :deep .zxm-select-selection-item {
- color: #fff !important;
- line-height: 28px !important;
- }
- :deep .zxm-select-arrow {
- color: #fff !important;
- }
- </style>
|