forked from zhurui/management
1 line
24 KiB
JSON
1 line
24 KiB
JSON
{"remainingRequest":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js??ref--0-0!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\dormitoryManage\\electric.vue?vue&type=script&lang=js&","dependencies":[{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\src\\views\\modules\\dormitoryManage\\electric.vue","mtime":1614735254000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\babel-loader\\lib\\index.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"C:\\Users\\27446\\Desktop\\up\\front\\dkha-web-sz-main\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["import \"core-js/modules/es6.regexp.replace\";\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport dormitoryTree from \"../../../components/public/dormitory-tree\";\nexport default {\n data: function data() {\n return {\n dateTime: [new Date().toLocaleString(\"zh\", {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\"\n }).substr(0, 10) + \" 00:00:00\", new Date().toLocaleString(\"zh\", {\n year: \"numeric\",\n month: \"2-digit\",\n day: \"2-digit\"\n }).substr(0, 10) + \" 23:59:59\"],\n treeValue: {\n df_floorid: '',\n df_type: '',\n df_floorname: ''\n },\n dataForm: {\n startDate: \"\",\n endDate: \"\"\n },\n xAxisData: [],\n ydata: [],\n floorName: \"\"\n };\n },\n components: {\n dormitoryTree: dormitoryTree\n },\n activated: function activated() {\n var _this = this;\n\n var timer = setInterval(function () {\n _this.clickSearch();\n }, 30000);\n this.$once(\"hook:deactivated\", function () {\n clearInterval(timer);\n });\n this.$once(\"hook:destroyed\", function () {\n clearInterval(timer);\n });\n },\n watch: {\n '$store.state.user.defaultCheckedKeys': {\n handler: function handler(val) {\n if (val) {\n this.clickSearchs(val);\n }\n },\n deep: true,\n immediate: true\n }\n },\n methods: {\n //树形控件 回调函数\n treeFun: function treeFun(val) {\n this.treeValue = val;\n\n if (val.df_type != '2') {\n return this.$message.info('请选择房间查看宿舍电流');\n }\n\n this.floorName = val.df_floorname;\n this.clickSearch();\n },\n //搜索\n clickSearch: function clickSearch() {\n var _this2 = this;\n\n if (!this.dateTime || this.dateTime.length == '0') {\n return this.$message.error('请选择时间范围');\n } else if (!this.$store.state.user.defaultCheckedKeys) {\n return this.$message.error('暂无楼栋数据,无法查询');\n }\n\n var startDate = this.dateTime[0].replace(/\\//g, '-');\n var endDate = this.dateTime[1].replace(/\\//g, '-');\n var id = '';\n\n if (this.treeValue.df_floorid == '') {\n id = this.$store.state.user.defaultCheckedKeys;\n } else {\n id = this.treeValue.df_floorid;\n }\n\n this.$http.get(\"/system/sccurrenthistory/\".concat(id, \"/\").concat(startDate, \"/\").concat(endDate)).then(function (_ref) {\n var res = _ref.data;\n\n if (res.code != 0) {\n return _this2.$message.error(res.msg);\n } // chColltime: \"2020-10-31 17:53:08\",\n // chEcurrent: 0.0424328\n\n\n var arrData = res.data; //所有数据\n\n var xData = []; //x 数据\n\n var data = []; //y 数据\n\n _this2.xAxisData = [];\n xData = arrData.map(function (item) {\n return item.chColltime.slice(11, 19);\n });\n data = arrData.map(function (item) {\n return item.chEcurrent;\n });\n _this2.ydata = data.map(function (item) {\n return item.toFixed(2);\n });\n _this2.xAxisData = xData;\n\n _this2.electricFun();\n });\n },\n //搜索\n clickSearchs: function clickSearchs(val) {\n var _this3 = this;\n\n var startDate = this.dateTime[0].replace(/\\//g, '-');\n var endDate = this.dateTime[1].replace(/\\//g, '-');\n this.$http.get(\"/system/sccurrenthistory/\".concat(val, \"/\").concat(startDate, \"/\").concat(endDate)).then(function (_ref2) {\n var res = _ref2.data;\n\n if (res.code != 0) {\n return _this3.$message.error(res.msg);\n }\n\n var arrData = res.data; //所有数据\n\n var xData = []; //x 数据\n\n var data = []; //y 数据\n\n _this3.xAxisData = [];\n xData = arrData.map(function (item) {\n return item.chColltime.slice(11, 19);\n });\n data = arrData.map(function (item) {\n return item.chEcurrent;\n });\n _this3.ydata = data.map(function (item) {\n return item.toFixed(2);\n });\n _this3.xAxisData = xData;\n\n _this3.electricFun();\n });\n },\n //echarts 图表\n electricFun: function electricFun() {\n var mycharts = this.$echarts.init(document.getElementById('electric_echarts'));\n window.onresize = mycharts.resize;\n var options = {\n dataZoom: [{\n type: 'inside',\n start: this.xAxisData.length < 10 ? 0 : (this.xAxisData.length - 10) / this.xAxisData.length * 100,\n end: 100,\n filterMode: 'empty' // zoomLock:true,\n\n }],\n title: {//text: '监控'\n },\n tooltip: {\n trigger: 'axis',\n itemStyle: {\n normal: {\n label: {\n show: true\n }\n }\n }\n },\n //工具图标\n toolbox: {\n show: false,\n feature: {\n magicType: {\n type: ['line', 'bar']\n }\n }\n },\n xAxis: {\n type: 'category',\n axisLine: {\n lineStyle: {\n color: '#fff'\n }\n },\n data: this.xAxisData\n },\n yAxis: {\n type: 'value',\n name: \"电流(A)\",\n axisLine: {\n lineStyle: {\n color: '#fff'\n }\n },\n splitLine: {\n //网格线\n lineStyle: {\n type: 'dashed' //设置网格线类型 dotted:虚线 solid:实线\n\n },\n show: true //隐藏或显示\n\n }\n },\n series: [{\n name: '电流',\n type: 'line',\n data: this.ydata,\n label: {\n normal: {\n show: true,\n position: 'top',\n textStyle: {\n color: 'white'\n }\n }\n },\n //对于超上限的数据用默认样式展示\n markPoint: {\n itemStyle: {\n normal: {\n borderColor: '#fab60c',\n borderWidth: 5,\n // 标注边线线宽,单位px,默认为1\n label: {\n show: true\n }\n },\n emphasis: {\n borderColor: '#fab60c',\n borderWidth: 5,\n label: {\n show: true\n }\n }\n },\n data: 20\n },\n markLine: {\n symbol: \"none\",\n //去掉警戒线最后面的箭头\n label: {\n position: \"end\",\n //将警示值放在哪个位置,三个值“start”,\"middle\",\"end\" 开始 中点 结束\n formatter: \"阈值线\" + this.$getDictLabel(\"electricValue\", 0)\n },\n data: [{\n silent: true,\n //鼠标悬停事件 true没有,false有\n lineStyle: {\n //警戒线的样式 ,虚实 颜色\n type: \"dashes\",\n color: \"rgba(238, 99, 99)\"\n },\n name: '阈值线',\n yAxis: this.$getDictLabel(\"electricValue\", 0)\n }]\n },\n smooth: true\n }]\n };\n mycharts.setOption(options);\n }\n }\n};",{"version":3,"sources":["electric.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,OAAA,aAAA;AACA,eAAA;AACA,EAAA,IADA,kBACA;AACA,WAAA;AACA,MAAA,QAAA,EAAA,CACA,IAAA,IAAA,GACA,cADA,CACA,IADA,EACA;AACA,QAAA,IAAA,EAAA,SADA;AAEA,QAAA,KAAA,EAAA,SAFA;AAGA,QAAA,GAAA,EAAA;AAHA,OADA,EAMA,MANA,CAMA,CANA,EAMA,EANA,IAMA,WAPA,EAQA,IAAA,IAAA,GACA,cADA,CACA,IADA,EACA;AACA,QAAA,IAAA,EAAA,SADA;AAEA,QAAA,KAAA,EAAA,SAFA;AAGA,QAAA,GAAA,EAAA;AAHA,OADA,EAMA,MANA,CAMA,CANA,EAMA,EANA,IAMA,WAdA,CADA;AAiBA,MAAA,SAAA,EAAA;AACA,QAAA,UAAA,EAAA,EADA;AAEA,QAAA,OAAA,EAAA,EAFA;AAGA,QAAA,YAAA,EAAA;AAHA,OAjBA;AAsBA,MAAA,QAAA,EAAA;AACA,QAAA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,MAAA,EAAA,IADA;AACA;AACA,cAAA,SAAA,EAAA;AAAA;AACA,gBAAA,IAAA,EAAA,QADA;AAEA,gBAAA,KAAA,EAAA;AAFA,eAFA;AAMA,cAAA,IAAA,EAAA,KANA;AAOA,cAAA,KAAA,EAAA,KAAA,aAAA,CAAA,eAAA,EAAA,CAAA;AAPA,aAAA;AANA,WAjCA;AAiDA,UAAA,MAAA,EAAA;AAjDA,SAAA;AAtDA,OAAA;AA0GA,MAAA,QAAA,CAAA,SAAA,CAAA,OAAA;AACA;AAjMA;AA1DA,CAAA","sourcesContent":["<template>\n\t<el-card shadow=\"never\" class=\"aui-card--fill\">\n\t\t<el-row :gutter=\"10\">\n\t\t\t<el-col :span=\"4\">\n\t\t\t\t<div class=\"left\">\n\t\t\t\t\t<dormitory-tree ref=\"dormitoryTree\" type='electric' @treeFun=\"treeFun\"></dormitory-tree>\n\t\t\t\t</div>\n\t\t\t</el-col>\n\t\t\t<el-col :span=\"20\">\n\t\t\t\t<div class=\"right\">\n\t\t\t\t\t<el-date-picker v-model=\"dateTime\" type=\"datetimerange\" value-format=\"yyyy/MM/dd HH:mm:ss\" range-separator=\"至\"\n\t\t\t\t\t start-placeholder=\"开始日期\" end-placeholder=\"结束日期\" :clearable=\"false\">\n\t\t\t\t\t</el-date-picker>\n\t\t\t\t\t<el-button @click=\"clickSearch\" style=\"margin-left:20px\">查询</el-button>\n\t\t\t\t\t<hr>\n\t\t\t\t\t<div v-if=\"floorName==''\" style=\"font-size: 20px;text-align: center;margin-top: 24px;\">301房间</div>\n\t\t\t\t\t<div v-else style=\"font-size: 20px; text-align: center;margin-top: 24px;\">{{floorName}}房间</div>\n\t\t\t\t\t<div id=\"electric_echarts\"></div>\n\t\t\t\t</div>\n\t\t\t</el-col>\n\t\t</el-row>\n\t</el-card>\n</template>\n\n<script>\n\timport dormitoryTree from '../../../components/public/dormitory-tree'\n\texport default {\n\t\tdata() {\n\t\t\treturn {\n\t\t\t\tdateTime: [\n\t\t\t\t\tnew Date()\n\t\t\t\t\t.toLocaleString(\"zh\", {\n\t\t\t\t\t\tyear: \"numeric\",\n\t\t\t\t\t\tmonth: \"2-digit\",\n\t\t\t\t\t\tday: \"2-digit\"\n\t\t\t\t\t})\n\t\t\t\t\t.substr(0, 10) + \" 00:00:00\",\n\t\t\t\t\tnew Date()\n\t\t\t\t\t.toLocaleString(\"zh\", {\n\t\t\t\t\t\tyear: \"numeric\",\n\t\t\t\t\t\tmonth: \"2-digit\",\n\t\t\t\t\t\tday: \"2-digit\"\n\t\t\t\t\t})\n\t\t\t\t\t.substr(0, 10) + \" 23:59:59\"\n\t\t\t\t],\n\t\t\t\ttreeValue: {\n\t\t\t\t\tdf_floorid: '',\n\t\t\t\t\tdf_type: '',\n\t\t\t\t\tdf_floorname: ''\n\t\t\t\t},\n\t\t\t\tdataForm: {\n\t\t\t\t\tstartDate: \"\",\n\t\t\t\t\tendDate: \"\",\n\t\t\t\t},\n\t\t\t\txAxisData: [],\n\t\t\t\tydata: [],\n\t\t\t\tfloorName: \"\",\n\t\t\t}\n\t\t},\n\t\tcomponents: {\n\t\t\tdormitoryTree\n\t\t},\n\t\tactivated() {\n\t\t\tconst timer = setInterval(() => {\n\t\t\t\tthis.clickSearch();\n\t\t\t}, 30000);\n\t\t\tthis.$once(\"hook:deactivated\", () => {\n\t\t\t\tclearInterval(timer)\n\t\t\t})\n\t\t\tthis.$once(\"hook:destroyed\", () => {\n\t\t\t\tclearInterval(timer)\n\t\t\t})\n\t\t},\n\t\twatch: {\n\t\t\t'$store.state.user.defaultCheckedKeys': {\n\t\t\t\thandler(val) {\n\t\t\t\t\tif (val) {\n\t\t\t\t\t\tthis.clickSearchs(val);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tdeep: true,\n\t\t\t\timmediate: true\n\t\t\t},\n\t\t},\n\t\tmethods: {\n\t\t\t//树形控件 回调函数\n\t\t\ttreeFun(val) {\n\t\t\t\tthis.treeValue = val;\n\t\t\t\tif (val.df_type != '2') {\n\t\t\t\t\treturn this.$message.info('请选择房间查看宿舍电流')\n\t\t\t\t}\n\t\t\t\tthis.floorName = val.df_floorname\n\t\t\t\tthis.clickSearch()\n\t\t\t},\n\t\t\t//搜索\n\t\t\tclickSearch() {\n\t\t\t\tif (!this.dateTime || this.dateTime.length == '0') {\n\t\t\t\t\treturn this.$message.error('请选择时间范围')\n\t\t\t\t} else if (!this.$store.state.user.defaultCheckedKeys) {\n\t\t\t\t\treturn this.$message.error('暂无楼栋数据,无法查询')\n\t\t\t\t}\n\t\t\t\tlet startDate = this.dateTime[0].replace(/\\//g, '-')\n\t\t\t\tlet endDate = this.dateTime[1].replace(/\\//g, '-')\n\t\t\t\tlet id = ''\n\t\t\t\tif (this.treeValue.df_floorid == '') {\n\t\t\t\t\tid = this.$store.state.user.defaultCheckedKeys\n\t\t\t\t} else {\n\t\t\t\t\tid = this.treeValue.df_floorid\n\t\t\t\t}\n\n\t\t\t\tthis.$http.get(`/system/sccurrenthistory/${id}/${startDate}/${endDate}`)\n\t\t\t\t\t.then(({\n\t\t\t\t\t\tdata: res\n\t\t\t\t\t}) => {\n\t\t\t\t\t\tif (res.code != 0) {\n\t\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t// chColltime: \"2020-10-31 17:53:08\",\n\t\t\t\t\t\t// chEcurrent: 0.0424328\n\n\n\t\t\t\t\t\tlet arrData = res.data; //所有数据\n\t\t\t\t\t\tlet xData = []; //x 数据\n\t\t\t\t\t\tlet data = []; //y 数据\n\n\t\t\t\t\t\tthis.xAxisData = []\n\n\t\t\t\t\t\txData = arrData.map(item => item.chColltime.slice(11, 19))\n\t\t\t\t\t\tdata = arrData.map(item => item.chEcurrent)\n\t\t\t\t\t\tthis.ydata = data.map(item => {\n\t\t\t\t\t\t\treturn item.toFixed(2)\n\t\t\t\t\t\t})\n\t\t\t\t\t\tthis.xAxisData = xData;\n\t\t\t\t\t\tthis.electricFun()\n\t\t\t\t\t})\n\t\t\t},\n\t\t\t//搜索\n\t\t\tclickSearchs(val) {\n\t\t\t\tlet startDate = this.dateTime[0].replace(/\\//g, '-')\n\t\t\t\tlet endDate = this.dateTime[1].replace(/\\//g, '-')\n\n\t\t\t\tthis.$http.get(`/system/sccurrenthistory/${val}/${startDate}/${endDate}`)\n\t\t\t\t\t.then(({\n\t\t\t\t\t\tdata: res\n\t\t\t\t\t}) => {\n\t\t\t\t\t\tif (res.code != 0) {\n\t\t\t\t\t\t\treturn this.$message.error(res.msg)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tlet arrData = res.data; //所有数据\n\t\t\t\t\t\tlet xData = []; //x 数据\n\t\t\t\t\t\tlet data = []; //y 数据\n\n\t\t\t\t\t\tthis.xAxisData = []\n\n\t\t\t\t\t\txData = arrData.map(item => item.chColltime.slice(11, 19))\n\t\t\t\t\t\tdata = arrData.map(item => item.chEcurrent)\n\t\t\t\t\t\tthis.ydata = data.map(item => {\n\t\t\t\t\t\t\treturn item.toFixed(2)\n\t\t\t\t\t\t})\n\t\t\t\t\t\tthis.xAxisData = xData;\n\t\t\t\t\t\tthis.electricFun()\n\n\t\t\t\t\t})\n\t\t\t},\n\t\t\t//echarts 图表\n\t\t\telectricFun() {\n\t\t\t\tlet mycharts = this.$echarts.init(document.getElementById('electric_echarts'));\n\t\t\t\twindow.onresize = mycharts.resize;\n\t\t\t\tlet options = {\n\t\t\t\t\tdataZoom: [{\n\t\t\t\t\t\ttype: 'inside',\n\t\t\t\t\t\tstart: this.xAxisData.length < 10 ? 0 : ((this.xAxisData.length - 10) / this.xAxisData.length) * 100,\n\t\t\t\t\t\tend: 100,\n\t\t\t\t\t\tfilterMode: 'empty',\n\t\t\t\t\t\t// zoomLock:true,\n\t\t\t\t\t}],\n\t\t\t\t\ttitle: {\n\t\t\t\t\t\t//text: '监控'\n\t\t\t\t\t},\n\t\t\t\t\ttooltip: {\n\t\t\t\t\t\ttrigger: 'axis',\n\t\t\t\t\t\titemStyle: {\n\t\t\t\t\t\t\tnormal: {\n\t\t\t\t\t\t\t\tlabel: {\n\t\t\t\t\t\t\t\t\tshow: true\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\t//工具图标\n\t\t\t\t\ttoolbox: {\n\t\t\t\t\t\tshow: false,\n\t\t\t\t\t\tfeature: {\n\t\t\t\t\t\t\tmagicType: {\n\t\t\t\t\t\t\t\ttype: ['line', 'bar']\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\txAxis: {\n\t\t\t\t\t\ttype: 'category',\n\t\t\t\t\t\taxisLine: {\n\t\t\t\t\t\t\tlineStyle: {\n\t\t\t\t\t\t\t\tcolor: '#fff'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdata: this.xAxisData\n\t\t\t\t\t},\n\t\t\t\t\tyAxis: {\n\t\t\t\t\t\ttype: 'value',\n\t\t\t\t\t\tname: \"电流(A)\",\n\t\t\t\t\t\taxisLine: {\n\t\t\t\t\t\t\tlineStyle: {\n\t\t\t\t\t\t\t\tcolor: '#fff'\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsplitLine: { //网格线\n\t\t\t\t\t\t\tlineStyle: {\n\t\t\t\t\t\t\t\ttype: 'dashed' //设置网格线类型 dotted:虚线 solid:实线\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tshow: true //隐藏或显示\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t\tseries: [{\n\t\t\t\t\t\tname: '电流',\n\t\t\t\t\t\ttype: 'line',\n\t\t\t\t\t\tdata: this.ydata,\n\t\t\t\t\t\tlabel: {\n\t\t\t\t\t\t\tnormal: {\n\t\t\t\t\t\t\t\tshow: true,\n\t\t\t\t\t\t\t\tposition: 'top',\n\t\t\t\t\t\t\t\ttextStyle: {\n\t\t\t\t\t\t\t\t\tcolor: 'white'\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t//对于超上限的数据用默认样式展示\n\t\t\t\t\t\tmarkPoint: {\n\t\t\t\t\t\t\titemStyle: {\n\t\t\t\t\t\t\t\tnormal: {\n\t\t\t\t\t\t\t\t\tborderColor: '#fab60c',\n\t\t\t\t\t\t\t\t\tborderWidth: 5, // 标注边线线宽,单位px,默认为1\n\t\t\t\t\t\t\t\t\tlabel: {\n\t\t\t\t\t\t\t\t\t\tshow: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\temphasis: {\n\t\t\t\t\t\t\t\t\tborderColor: '#fab60c',\n\t\t\t\t\t\t\t\t\tborderWidth: 5,\n\t\t\t\t\t\t\t\t\tlabel: {\n\t\t\t\t\t\t\t\t\t\tshow: true\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdata: 20\n\t\t\t\t\t\t},\n\t\t\t\t\t\tmarkLine: {\n\t\t\t\t\t\t\tsymbol: \"none\", //去掉警戒线最后面的箭头\n\t\t\t\t\t\t\tlabel: {\n\t\t\t\t\t\t\t\tposition: \"end\", //将警示值放在哪个位置,三个值“start”,\"middle\",\"end\" 开始 中点 结束\n\t\t\t\t\t\t\t\tformatter: \"阈值线\" + this.$getDictLabel(\"electricValue\", 0)\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdata: [{\n\t\t\t\t\t\t\t\tsilent: true, //鼠标悬停事件 true没有,false有\n\t\t\t\t\t\t\t\tlineStyle: { //警戒线的样式 ,虚实 颜色\n\t\t\t\t\t\t\t\t\ttype: \"dashes\",\n\t\t\t\t\t\t\t\t\tcolor: \"rgba(238, 99, 99)\"\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tname: '阈值线',\n\t\t\t\t\t\t\t\tyAxis: this.$getDictLabel(\"electricValue\", 0)\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t},\n\t\t\t\t\t\tsmooth: true,\n\t\t\t\t\t}]\n\t\t\t\t}\n\t\t\t\tmycharts.setOption(options)\n\t\t\t}\n\t\t}\n\t}\n</script>\n\n<style lang=\"scss\" scoped>\n\t.left {\n\t\t/deep/ .el-tree {\n\t\t\theight: 690px;\n\t\t\tpadding-right: 10px;\n\t\t\toverflow-y: auto;\n\t\t}\n\t}\n\n\t.right {\n\t\tmargin-left: 100px;\n\t\tcolor: #fff;\n\n\t\t#electric_echarts {\n\t\t\twidth: 100%;\n\t\t\theight: 690px;\n\t\t}\n\t}\n</style>\n"],"sourceRoot":"src/views/modules/dormitoryManage"}]} |