| | |
| | | import Home from '../views/Home.vue'; // 假设这是你的主页组件 |
| | | import deviceWindows from '../views/deviceWindows.vue' |
| | | import deviceWindows2 from '../views/deviceWindoes2.vue' |
| | | // import Search from '../views/Search.vue'; // 搜索结果页,接收查询参数 |
| | | import test from '../views/test.vue'; // 搜索结果页,接收查询参数 |
| | | |
| | | // 定义路由规则,并为每个路由指定类型安全的 props |
| | | const routes: Array<RouteRecordRaw> = [ |
| | |
| | | component: deviceWindows2, |
| | | }, |
| | | { |
| | | path: '/deviceWindows/:deviceid', |
| | | name: 'deviceWindows', |
| | | component: deviceWindows, |
| | | path: '/test', |
| | | name: 'test', |
| | | component: test, |
| | | props: true, // 路径参数将作为 props 传递给组件 |
| | | }, |
| | | // { |
| | |
| | | <el-button type="primary" @click="saveSet"> |
| | | 确认 |
| | | </el-button> |
| | | <el-button type="success" @click="shuaxin"> |
| | | 刷新 |
| | | </el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | |
| | | ElMessage.warning('请先输入设备编号') |
| | | } |
| | | } |
| | | /** |
| | | * 刷新页面 |
| | | */ |
| | | const shuaxin=()=>{ |
| | | window.location.reload(); |
| | | } |
| | | const onFileChange=async(event: Event)=> { |
| | | const inputElement = event.target as HTMLInputElement; |
| | | if (!inputElement.files || inputElement.files.length === 0) return; |
| New file |
| | |
| | | <template> |
| | | <div ref="chart" style="width: 100%; height: 400px;"></div> |
| | | </template> |
| | | |
| | | <script> |
| | | import * as echarts from 'echarts'; |
| | | |
| | | export default { |
| | | name: 'LineChart', |
| | | data() { |
| | | return { |
| | | chartInstance: null, |
| | | threshold: 1.4, // 设置阈值 |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.initChart(); |
| | | }, |
| | | beforeUnmount() { |
| | | if (this.chartInstance) { |
| | | this.chartInstance.dispose(); |
| | | this.chartInstance = null; |
| | | } |
| | | }, |
| | | methods: { |
| | | initChart() { |
| | | const chartDom = this.$refs.chart; |
| | | this.chartInstance = echarts.init(chartDom); |
| | | |
| | | const option = { |
| | | title: { |
| | | text: '营养状态和透析情况', |
| | | left: 'center' |
| | | }, |
| | | tooltip: { |
| | | trigger: 'axis' |
| | | }, |
| | | xAxis: { |
| | | type: 'category', |
| | | data: ['12:21', '12:22', '12:23', '12:24', '12:25', '12:26', '12:27', '12:28', '12:29', '12:30', '12:31', '12:32', '12:33', '12:34', '12:35', '12:36', '12:37', '12:38'] |
| | | }, |
| | | yAxis: { |
| | | type: 'value' |
| | | }, |
| | | series: [ |
| | | { |
| | | data: [1.4, 1.2, 1.4, 1.4, 1.0, 1.4, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.5, 1.7], |
| | | type: 'line', |
| | | smooth: true, |
| | | color:'red', |
| | | itemStyle: { |
| | | color: function(params) { |
| | | if (params.value > 1.2) { |
| | | return 'red'; |
| | | } else { |
| | | return 'blue'; |
| | | } |
| | | }.bind(this) |
| | | }, |
| | | lineStyle: { |
| | | color: function(params) { |
| | | if (params.value > 1.2) { |
| | | return 'red'; |
| | | } else { |
| | | return 'blue'; |
| | | } |
| | | }.bind(this) |
| | | } |
| | | } |
| | | ] |
| | | }; |
| | | |
| | | this.chartInstance.setOption(option); |
| | | } |
| | | } |
| | | }; |
| | | </script> |
| | | |
| | | <style scoped> |
| | | /* 添加一些样式 */ |
| | | </style> |